summaryrefslogtreecommitdiff
authorFrank Chen <frank.chen@amlogic.com>2014-10-09 09:03:07 (GMT)
committer Frank Chen <frank.chen@amlogic.com>2014-12-17 13:08:34 (GMT)
commit7b2fc691a12c79b422bdaca5f72b9bed317c0480 (patch)
tree9057af293763ac9345034a40569cb07b89d09fe0
parent386dafa8a9e6fa0d6a761c0c008ca38df15b6ccb (diff)
downloadntfs-3g-7b2fc691a12c79b422bdaca5f72b9bed317c0480.zip
ntfs-3g-7b2fc691a12c79b422bdaca5f72b9bed317c0480.tar.gz
ntfs-3g-7b2fc691a12c79b422bdaca5f72b9bed317c0480.tar.bz2
Upgrade to version ntfs-3g_ntfsprogs-2014.2.15
download from http://www.tuxera.com/community/ntfs-3g-download/ Change-Id: I96cd5bc6ba03f5bfe485bc978ab22ffb9067abf6
Diffstat
-rwxr-xr-xAndroid.mk138
-rwxr-xr-xAndroid.mk.bak89
-rwxr-xr-xCREDITS20
-rwxr-xr-xINSTALL200
-rwxr-xr-xMakefile715
-rwxr-xr-xMakefile.am106
-rwxr-xr-xMakefile.in955
-rwxr-xr-xNEWS4
-rwxr-xr-xREADME80
-rwxr-xr-xTODO.ntfsprogs126
-rwxr-xr-xaclocal.m47091
-rwxr-xr-xcompile21
-rwxr-xr-xconfig.guess292
-rw-r--r--[-rwxr-xr-x]config.h165
-rwxr-xr-xconfig.h.in110
-rwxr-xr-xconfig.log3290
-rwxr-xr-xconfig.status1220
-rwxr-xr-xconfig.sub104
-rwxr-xr-xconfigure26448
-rwxr-xr-xconfigure.ac291
-rwxr-xr-xdepcomp87
-rwxr-xr-xinclude/Makefile.in181
-rwxr-xr-xinclude/fuse-lite/Makefile.in112
-rwxr-xr-xinclude/fuse-lite/fuse.h61
-rwxr-xr-xinclude/fuse-lite/fuse_common.h49
-rwxr-xr-xinclude/fuse-lite/fuse_kernel.h6
-rwxr-xr-xinclude/fuse-lite/fuse_lowlevel.h20
-rwxr-xr-xinclude/ntfs-3g/Makefile.am4
-rwxr-xr-xinclude/ntfs-3g/Makefile.in163
-rwxr-xr-xinclude/ntfs-3g/acls.h3
-rwxr-xr-xinclude/ntfs-3g/attrib.h50
-rwxr-xr-xinclude/ntfs-3g/cache.h7
-rwxr-xr-xinclude/ntfs-3g/compat.h6
-rwxr-xr-xinclude/ntfs-3g/compress.h6
-rwxr-xr-xinclude/ntfs-3g/debug.h4
-rwxr-xr-xinclude/ntfs-3g/device.h18
-rwxr-xr-xinclude/ntfs-3g/device_io.h21
-rwxr-xr-xinclude/ntfs-3g/dir.h11
-rwxr-xr-xinclude/ntfs-3g/layout.h32
-rwxr-xr-xinclude/ntfs-3g/lcnalloc.h1
-rwxr-xr-xinclude/ntfs-3g/logging.h3
-rwxr-xr-xinclude/ntfs-3g/mst.h3
-rwxr-xr-xinclude/ntfs-3g/ntfstime.h12
-rwxr-xr-xinclude/ntfs-3g/param.h72
-rwxr-xr-xinclude/ntfs-3g/realpath.h24
-rwxr-xr-xinclude/ntfs-3g/runlist.h3
-rwxr-xr-xinclude/ntfs-3g/security.h20
-rwxr-xr-xinclude/ntfs-3g/types.h8
-rwxr-xr-xinclude/ntfs-3g/unistr.h13
-rwxr-xr-xinclude/ntfs-3g/volume.h78
-rwxr-xr-xinclude/ntfs-3g/xattrs.h75
-rwxr-xr-xinstall-sh5
-rwxr-xr-xlibfuse-lite/Makefile.am3
-rwxr-xr-xlibfuse-lite/Makefile.in188
-rwxr-xr-xlibfuse-lite/fuse.c418
-rwxr-xr-xlibfuse-lite/fuse_kern_chan.c2
-rwxr-xr-xlibfuse-lite/fuse_lowlevel.c53
-rwxr-xr-xlibfuse-lite/fuse_opt.c20
-rwxr-xr-xlibfuse-lite/fuse_session.c12
-rwxr-xr-xlibfuse-lite/fusermount.c97
-rwxr-xr-xlibfuse-lite/helper.c21
-rwxr-xr-xlibfuse-lite/mount.c486
-rwxr-xr-xlibfuse-lite/mount_util.c246
-rwxr-xr-xlibfuse-lite/mount_util.h11
-rwxr-xr-xlibntfs-3g/Makefile.am15
-rwxr-xr-xlibntfs-3g/Makefile.in420
-rwxr-xr-xlibntfs-3g/acls.c219
-rwxr-xr-xlibntfs-3g/attrib.c1205
-rwxr-xr-xlibntfs-3g/bootsect.c4
-rwxr-xr-xlibntfs-3g/cache.c7
-rwxr-xr-xlibntfs-3g/compress.c962
-rwxr-xr-xlibntfs-3g/device.c252
-rwxr-xr-xlibntfs-3g/dir.c374
-rwxr-xr-xlibntfs-3g/efs.c217
-rwxr-xr-xlibntfs-3g/index.c30
-rwxr-xr-xlibntfs-3g/inode.c46
-rwxr-xr-xlibntfs-3g/lcnalloc.c36
-rw-r--r--libntfs-3g/libntfs-3g.pc10
-rw-r--r--libntfs-3g/libntfs-3g.script.so2
-rwxr-xr-xlibntfs-3g/logfile.c23
-rwxr-xr-xlibntfs-3g/logging.c24
-rwxr-xr-xlibntfs-3g/mft.c12
-rwxr-xr-xlibntfs-3g/mst.c24
-rwxr-xr-xlibntfs-3g/object_id.c9
-rwxr-xr-xlibntfs-3g/realpath.c103
-rwxr-xr-xlibntfs-3g/reparse.c67
-rwxr-xr-xlibntfs-3g/runlist.c62
-rwxr-xr-xlibntfs-3g/security.c345
-rwxr-xr-xlibntfs-3g/unistr.c244
-rwxr-xr-xlibntfs-3g/unix_io.c19
-rwxr-xr-xlibntfs-3g/volume.c365
-rwxr-xr-xlibntfs-3g/win32_io.c708
-rwxr-xr-xlibntfs-3g/xattrs.c791
-rwxr-xr-xlibtool9301
-rwxr-xr-xltmain.sh8439
-rwxr-xr-xm4/libtool.m47377
-rwxr-xr-xm4/ltoptions.m4368
-rwxr-xr-xm4/ltsugar.m4123
-rwxr-xr-xm4/ltversion.m423
-rwxr-xr-xm4/lt~obsolete.m492
-rwxr-xr-xmissing49
-rwxr-xr-xntfsprogs/Makefile.am154
-rwxr-xr-xntfsprogs/Makefile.in1199
-rwxr-xr-xntfsprogs/attrdef.c168
-rwxr-xr-xntfsprogs/attrdef.h7
-rwxr-xr-xntfsprogs/boot.c268
-rwxr-xr-xntfsprogs/boot.h7
-rwxr-xr-xntfsprogs/cluster.c118
-rwxr-xr-xntfsprogs/cluster.h39
-rwxr-xr-xntfsprogs/list.h194
-rw-r--r--ntfsprogs/mkntfs.8290
-rwxr-xr-xntfsprogs/mkntfs.8.in290
-rwxr-xr-xntfsprogs/mkntfs.c5177
-rw-r--r--ntfsprogs/ntfscat.8136
-rwxr-xr-xntfsprogs/ntfscat.8.in136
-rwxr-xr-xntfsprogs/ntfscat.c440
-rwxr-xr-xntfsprogs/ntfscat.h46
-rwxr-xr-xntfsprogs/ntfsck.c883
-rw-r--r--ntfsprogs/ntfsclone.8391
-rwxr-xr-xntfsprogs/ntfsclone.8.in391
-rwxr-xr-xntfsprogs/ntfsclone.c2701
-rw-r--r--ntfsprogs/ntfscluster.8124
-rwxr-xr-xntfsprogs/ntfscluster.8.in124
-rwxr-xr-xntfsprogs/ntfscluster.c563
-rwxr-xr-xntfsprogs/ntfscluster.h63
-rw-r--r--ntfsprogs/ntfscmp.877
-rwxr-xr-xntfsprogs/ntfscmp.8.in77
-rwxr-xr-xntfsprogs/ntfscmp.c1012
-rw-r--r--ntfsprogs/ntfscp.8111
-rwxr-xr-xntfsprogs/ntfscp.8.in111
-rwxr-xr-xntfsprogs/ntfscp.c590
-rwxr-xr-xntfsprogs/ntfsdecrypt.c1436
-rwxr-xr-xntfsprogs/ntfsdump_logfile.c779
-rw-r--r--ntfsprogs/ntfsfix.881
-rwxr-xr-xntfsprogs/ntfsfix.8.in81
-rwxr-xr-xntfsprogs/ntfsfix.c1657
-rw-r--r--ntfsprogs/ntfsinfo.889
-rwxr-xr-xntfsprogs/ntfsinfo.8.in89
-rwxr-xr-xntfsprogs/ntfsinfo.c2384
-rw-r--r--ntfsprogs/ntfslabel.8118
-rwxr-xr-xntfsprogs/ntfslabel.8.in118
-rwxr-xr-xntfsprogs/ntfslabel.c458
-rw-r--r--ntfsprogs/ntfsls.8172
-rwxr-xr-xntfsprogs/ntfsls.8.in172
-rwxr-xr-xntfsprogs/ntfsls.c717
-rwxr-xr-xntfsprogs/ntfsmftalloc.c368
-rwxr-xr-xntfsprogs/ntfsmove.c923
-rwxr-xr-xntfsprogs/ntfsmove.h46
-rw-r--r--ntfsprogs/ntfsprogs.869
-rwxr-xr-xntfsprogs/ntfsprogs.8.in69
-rw-r--r--ntfsprogs/ntfsresize.8326
-rwxr-xr-xntfsprogs/ntfsresize.8.in326
-rwxr-xr-xntfsprogs/ntfsresize.c4497
-rwxr-xr-xntfsprogs/ntfstruncate.c809
-rw-r--r--ntfsprogs/ntfsundelete.8324
-rwxr-xr-xntfsprogs/ntfsundelete.8.in324
-rwxr-xr-xntfsprogs/ntfsundelete.c2490
-rwxr-xr-xntfsprogs/ntfsundelete.h112
-rwxr-xr-xntfsprogs/ntfswipe.c2131
-rwxr-xr-xntfsprogs/ntfswipe.h54
-rwxr-xr-xntfsprogs/sd.c607
-rwxr-xr-xntfsprogs/sd.h11
-rwxr-xr-xntfsprogs/utils.c1184
-rwxr-xr-xntfsprogs/utils.h137
-rwxr-xr-xprog.IAB1071
-rwxr-xr-xprog.IAD5
-rwxr-xr-xprog.IMB466
-rwxr-xr-xprog.IMD2
-rwxr-xr-xprog.PFI2
-rwxr-xr-xprog.PO1
-rwxr-xr-xprog.PR14
-rwxr-xr-xprog.PRI219
-rwxr-xr-xprog.PS979
-rwxr-xr-xprog.SearchResults3
-rwxr-xr-xprog.WK39
-rwxr-xr-xsrc/Makefile.am86
-rwxr-xr-xsrc/Makefile.in938
-rwxr-xr-xsrc/lowntfs-3g.c1538
-rw-r--r--src/ntfs-3g.8448
-rwxr-xr-xsrc/ntfs-3g.8.in217
-rwxr-xr-xsrc/ntfs-3g.c1357
-rw-r--r--src/ntfs-3g.probe.881
-rwxr-xr-xsrc/ntfs-3g.probe.8.in4
-rwxr-xr-xsrc/ntfs-3g.probe.c9
-rw-r--r--src/ntfs-3g.secaudit.8184
-rwxr-xr-xsrc/ntfs-3g.secaudit.8.in15
-rw-r--r--src/ntfs-3g.usermap.896
-rwxr-xr-xsrc/ntfs-3g_common.c745
-rwxr-xr-xsrc/ntfs-3g_common.h185
-rwxr-xr-xsrc/secaudit.c673
-rwxr-xr-xsrc/secaudit.h32
-rwxr-xr-xsrc/usermap.c3
-rw-r--r--[-rwxr-xr-x]stamp-h10
193 files changed, 80411 insertions, 44563 deletions
diff --git a/Android.mk b/Android.mk
index 8b9345f..e67abd7 100755
--- a/Android.mk
+++ b/Android.mk
@@ -8,17 +8,25 @@ MY_CFLAG:= -O2 -g -W -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DHAVE_
include $(CLEAR_VARS)
LOCAL_SRC_FILES := \
- libfuse-lite/fuse.c libfuse-lite/fusermount.c libfuse-lite/fuse_kern_chan.c libfuse-lite/fuse_loop.c\
- libfuse-lite/fuse_lowlevel.c libfuse-lite/fuse_opt.c libfuse-lite/fuse_session.c libfuse-lite/fuse_signals.c\
- libfuse-lite/helper.c libfuse-lite/mount.c libfuse-lite/mount_util.c
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/fuse-lite
+ libfuse-lite/fuse.c \
+ libfuse-lite/fusermount.c \
+ libfuse-lite/fuse_kern_chan.c \
+ libfuse-lite/fuse_loop.c \
+ libfuse-lite/fuse_lowlevel.c \
+ libfuse-lite/fuse_opt.c \
+ libfuse-lite/fuse_session.c \
+ libfuse-lite/fuse_signals.c \
+ libfuse-lite/helper.c \
+ libfuse-lite/mount.c \
+ libfuse-lite/mount_util.c
+
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/fuse-lite
LOCAL_CFLAGS := $(MY_CFLAG)
LOCAL_MODULE := libfuse
LOCAL_MODULE_TAGS := optional
-LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils
+LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils
include $(BUILD_STATIC_LIBRARY)
@@ -27,20 +35,46 @@ include $(BUILD_STATIC_LIBRARY)
###################################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := libntfs-3g/acls.c libntfs-3g/attrib.c libntfs-3g/attrlist.c libntfs-3g/bitmap.c\
- libntfs-3g/bootsect.c libntfs-3g/cache.c libntfs-3g/collate.c libntfs-3g/compat.c libntfs-3g/compress.c \
- libntfs-3g/debug.c libntfs-3g/device.c libntfs-3g/dir.c libntfs-3g/efs.c libntfs-3g/index.c libntfs-3g/inode.c\
- libntfs-3g/lcnalloc.c libntfs-3g/logfile.c libntfs-3g/logging.c libntfs-3g/mft.c libntfs-3g/misc.c libntfs-3g/mst.c\
- libntfs-3g/object_id.c libntfs-3g/reparse.c libntfs-3g/runlist.c libntfs-3g/security.c libntfs-3g/unistr.c\
- libntfs-3g/unix_io.c libntfs-3g/volume.c
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/fuse-lite $(LOCAL_PATH)/include/ntfs-3g
+LOCAL_SRC_FILES := \
+ libntfs-3g/acls.c \
+ libntfs-3g/attrib.c \
+ libntfs-3g/attrlist.c \
+ libntfs-3g/bitmap.c \
+ libntfs-3g/bootsect.c \
+ libntfs-3g/cache.c \
+ libntfs-3g/collate.c \
+ libntfs-3g/compat.c \
+ libntfs-3g/compress.c \
+ libntfs-3g/debug.c \
+ libntfs-3g/device.c \
+ libntfs-3g/dir.c \
+ libntfs-3g/efs.c \
+ libntfs-3g/index.c \
+ libntfs-3g/inode.c \
+ libntfs-3g/lcnalloc.c \
+ libntfs-3g/logfile.c \
+ libntfs-3g/logging.c \
+ libntfs-3g/mft.c \
+ libntfs-3g/misc.c \
+ libntfs-3g/mst.c \
+ libntfs-3g/object_id.c \
+ libntfs-3g/reparse.c \
+ libntfs-3g/realpath.c \
+ libntfs-3g/runlist.c \
+ libntfs-3g/security.c \
+ libntfs-3g/unistr.c \
+ libntfs-3g/unix_io.c \
+ libntfs-3g/volume.c
+
+LOCAL_C_INCLUDES := \
+ $(LOCAL_PATH)/include/fuse-lite \
+ $(LOCAL_PATH)/include/ntfs-3g
LOCAL_CFLAGS := $(MY_CFLAG)
LOCAL_MODULE := libntfs-3g
LOCAL_MODULE_TAGS := optional
-LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils
+LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils
include $(BUILD_STATIC_LIBRARY)
@@ -49,9 +83,13 @@ include $(BUILD_STATIC_LIBRARY)
## For stage3, we make ntfs-3g
###################################################################
include $(CLEAR_VARS)
-LOCAL_SRC_FILES := src/ntfs-3g.c
+LOCAL_SRC_FILES := \
+ src/ntfs-3g.c \
+ src/ntfs-3g_common.c
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/fuse-lite $(LOCAL_PATH)/include/ntfs-3g \
+LOCAL_C_INCLUDES := \
+ $(LOCAL_PATH)/include/fuse-lite \
+ $(LOCAL_PATH)/include/ntfs-3g \
$(LOCAL_PATH)/src
LOCAL_CFLAGS := $(MY_CFLAG)
@@ -59,31 +97,79 @@ LOCAL_CFLAGS := $(MY_CFLAG)
LOCAL_MODULE := ntfs-3g
LOCAL_MODULE_TAGS := optional
LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils
-LOCAL_STATIC_LIBRARIES := libfuse libntfs-3g
+LOCAL_STATIC_LIBRARIES := libfuse libntfs-3g
include $(BUILD_EXECUTABLE)
###################################################################
-##
+##
###################################################################
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := src/test.c
+#include $(CLEAR_VARS)
+#LOCAL_SRC_FILES := src/test.c
-LOCAL_C_INCLUDES :=
+#LOCAL_C_INCLUDES :=
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/fuse-lite $(LOCAL_PATH)/include/ntfs-3g \
+#LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/fuse-lite $(LOCAL_PATH)/include/ntfs-3g \
$(LOCAL_PATH)/src
+#LOCAL_CFLAGS := $(MY_CFLAG)
+
+#LOCAL_MODULE := ntfstest
+#LOCAL_MODULE_TAGS := optional
+#LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils
+
+
+#include $(BUILD_EXECUTABLE)
+
+
+###################################################################
+##
+###################################################################
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := \
+ ntfsprogs/attrdef.c \
+ ntfsprogs/boot.c \
+ ntfsprogs/sd.c \
+ ntfsprogs/mkntfs.c \
+ ntfsprogs/utils.c
+
+LOCAL_C_INCLUDES := \
+ $(LOCAL_PATH)/include/fuse-lite \
+ $(LOCAL_PATH)/include/ntfs-3g \
+ $(LOCAL_PATH)/ntfsprogs
+
LOCAL_CFLAGS := $(MY_CFLAG)
-LOCAL_MODULE := ntfstest
+LOCAL_MODULE := mkntfs
LOCAL_MODULE_TAGS := optional
-LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils
-
+LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils
+LOCAL_STATIC_LIBRARIES:= libntfs-3g libfuse
include $(BUILD_EXECUTABLE)
+###################################################################
+##
+###################################################################
+include $(CLEAR_VARS)
+LOCAL_SRC_FILES := \
+ ntfsprogs/ntfsfix.c \
+ ntfsprogs/sd.c \
+ ntfsprogs/utils.c
+
+LOCAL_C_INCLUDES := \
+ $(LOCAL_PATH)/include/fuse-lite \
+ $(LOCAL_PATH)/include/ntfs-3g \
+ $(LOCAL_PATH)/ntfsprogs
+
+LOCAL_CFLAGS := $(MY_CFLAG)
+
+LOCAL_MODULE := ntfsfix
+LOCAL_MODULE_TAGS := optional
+LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils
+LOCAL_STATIC_LIBRARIES:= libntfs-3g libfuse
+
+include $(BUILD_EXECUTABLE)
endif
diff --git a/Android.mk.bak b/Android.mk.bak
deleted file mode 100755
index 2afb426..0000000
--- a/Android.mk.bak
+++ b/dev/null
@@ -1,89 +0,0 @@
-ifneq ($(TARGET_SIMULATOR), true)
-
-LOCAL_PATH := $(call my-dir)
-MY_CFLAG:= -O2 -g -W -Wall -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -D_OFF_T_DEFINED_ -DHAVE_CONFIG_H
-###################################################################
-## For stage1, we have to make libfuse
-###################################################################
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
- libfuse-lite/fuse.c libfuse-lite/fusermount.c libfuse-lite/fuse_kern_chan.c libfuse-lite/fuse_loop.c\
- libfuse-lite/fuse_lowlevel.c libfuse-lite/fuse_opt.c libfuse-lite/fuse_session.c libfuse-lite/fuse_signals.c\
- libfuse-lite/helper.c libfuse-lite/mount.c libfuse-lite/mount_util.c
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/fuse-lite
-
-LOCAL_CFLAGS := $(MY_CFLAG)
-
-LOCAL_MODULE := libfuse
-LOCAL_MODULE_TAGS :=
-LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils
-
-include $(BUILD_STATIC_LIBRARY)
-
-###################################################################
-## For stage2, we have to make libntfs-3g
-###################################################################
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := libntfs-3g/acls.c libntfs-3g/attrib.c libntfs-3g/attrlist.c libntfs-3g/bitmap.c\
- libntfs-3g/bootsect.c libntfs-3g/cache.c libntfs-3g/collate.c libntfs-3g/compat.c libntfs-3g/compress.c \
- libntfs-3g/debug.c libntfs-3g/device.c libntfs-3g/dir.c libntfs-3g/efs.c libntfs-3g/index.c libntfs-3g/inode.c\
- libntfs-3g/lcnalloc.c libntfs-3g/logfile.c libntfs-3g/logging.c libntfs-3g/mft.c libntfs-3g/misc.c libntfs-3g/mst.c\
- libntfs-3g/object_id.c libntfs-3g/reparse.c libntfs-3g/runlist.c libntfs-3g/security.c libntfs-3g/unistr.c\
- libntfs-3g/unix_io.c libntfs-3g/volume.c
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/fuse-lite $(LOCAL_PATH)/include/ntfs-3g
-
-LOCAL_CFLAGS := $(MY_CFLAG)
-
-LOCAL_MODULE := libntfs-3g
-LOCAL_MODULE_TAGS :=
-LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils
-
-include $(BUILD_STATIC_LIBRARY)
-
-
-###################################################################
-## For stage3, we make ntfs-3g
-###################################################################
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := src/ntfs-3g.c
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/fuse-lite $(LOCAL_PATH)/include/ntfs-3g \
- $(LOCAL_PATH)/src
-
-LOCAL_CFLAGS := $(MY_CFLAG)
-
-LOCAL_MODULE := ntfs-3g
-LOCAL_MODULE_TAGS :=
-LOCAL_SYSTEM_SHARED_LIBRARIES :=
-LOCAL_STATIC_LIBRARIES := libfuse libntfs-3g libc libc_common
-
-include $(BUILD_EXECUTABLE)
-
-
-
-###################################################################
-##
-###################################################################
-include $(CLEAR_VARS)
-LOCAL_SRC_FILES := src/test.c
-
-LOCAL_C_INCLUDES :=
-
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/include/fuse-lite $(LOCAL_PATH)/include/ntfs-3g \
- $(LOCAL_PATH)/src
-
-LOCAL_CFLAGS := $(MY_CFLAG)
-
-LOCAL_MODULE := ntfstest
-LOCAL_MODULE_TAGS :=
-LOCAL_SYSTEM_SHARED_LIBRARIES := libc libcutils
-
-
-include $(BUILD_EXECUTABLE)
-
-
-endif
diff --git a/CREDITS b/CREDITS
index 844a147..82cc124 100755
--- a/CREDITS
+++ b/CREDITS
@@ -38,4 +38,24 @@ Ismail Donmez
Laszlo Dvornik
Pallaghy Ajtony
Szabolcs Szakacsits
+Alexei Alexandrov
+Albert D. Cahalan
+Russ Christensen
+Pete Curran
+Andras Erdei
+Matthew J. Fanto
+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
+Yuri Per
+Richard Russon
+Erik Sørnes
diff --git a/INSTALL b/INSTALL
index d3c5b40..7d1c323 100755
--- a/INSTALL
+++ b/INSTALL
@@ -2,18 +2,24 @@ Installation Instructions
*************************
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
-2006, 2007 Free Software Foundation, Inc.
+2006, 2007, 2008, 2009 Free Software Foundation, Inc.
-This file is free documentation; the Free Software Foundation gives
-unlimited permission to copy, distribute and modify it.
+ Copying and distribution of this file, with or without modification,
+are permitted in any medium without royalty provided the copyright
+notice and this notice are preserved. This file is offered as-is,
+without warranty of any kind.
Basic Installation
==================
-Briefly, the shell commands `./configure; make; make install' should
+ Briefly, the shell commands `./configure; make; make install' should
configure, build, and install this package. The following
more-detailed instructions are generic; see the `README' file for
-instructions specific to this package.
+instructions specific to this package. Some packages provide this
+`INSTALL' file but do not implement all of the features documented
+below. The lack of an optional feature in a given package is not
+necessarily a bug. More recommendations for GNU packages can be found
+in *note Makefile Conventions: (standards)Makefile Conventions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
@@ -42,7 +48,7 @@ may remove or edit it.
you want to change it or regenerate `configure' using a newer version
of `autoconf'.
-The simplest way to compile this package is:
+ 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.
@@ -53,12 +59,22 @@ The simplest way to compile this package is:
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
- the package.
+ the package, generally using the just-built uninstalled binaries.
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
+ documentation. When installing into a prefix owned by root, it is
+ recommended that the package be configured and built as a regular
+ user, and only the `make install' phase executed with root
+ privileges.
+
+ 5. Optionally, type `make installcheck' to repeat any self-tests, but
+ this time using the binaries in their final installed location.
+ This target does not install anything. Running this target as a
+ regular user, particularly if the prior `make install' required
+ root privileges, verifies that the installation completed
+ correctly.
+
+ 6. 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
@@ -67,15 +83,22 @@ The simplest way to compile this package is:
all sorts of other programs in order to regenerate files that came
with the distribution.
- 6. Often, you can also type `make uninstall' to remove the installed
- files again.
+ 7. Often, you can also type `make uninstall' to remove the installed
+ files again. In practice, not all packages have tested that
+ uninstallation works correctly, even though it is required by the
+ GNU Coding Standards.
+
+ 8. Some packages, particularly those that use Automake, provide `make
+ distcheck', which can by used by developers to test that all other
+ targets like `make install' and `make uninstall' work correctly.
+ This target is generally not run by end users.
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
@@ -88,25 +111,41 @@ 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 can use 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 `..'.
+source code in the directory that `configure' is in and in `..'. This
+is known as a "VPATH" build.
With a non-GNU `make', it is safer 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.
+ On MacOS X 10.5 and later systems, you can create libraries and
+executables that work on multiple system types--known as "fat" or
+"universal" binaries--by specifying multiple `-arch' options to the
+compiler but only a single `-arch' option to the preprocessor. Like
+this:
+
+ ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
+ CPP="gcc -E" CXXCPP="g++ -E"
+
+ This is not guaranteed to produce working output in all cases, you
+may have to build one architecture at a time and combine the results
+using the `lipo' tool if you have problems.
+
Installation Names
==================
-By default, `make install' installs the package's commands under
+ By default, `make install' installs the package's commands under
`/usr/local/bin', include files under `/usr/local/include', etc. You
can specify an installation prefix other than `/usr/local' by giving
-`configure' the option `--prefix=PREFIX'.
+`configure' the option `--prefix=PREFIX', where PREFIX must be an
+absolute file name.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
@@ -117,16 +156,47 @@ Documentation and other data files 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.
+you can set and what kinds of files go in them. In general, the
+default for these options is expressed in terms of `${prefix}', so that
+specifying just `--prefix' will affect all of the other directory
+specifications that were not explicitly provided.
+
+ The most portable way to affect installation locations is to pass the
+correct locations to `configure'; however, many packages provide one or
+both of the following shortcuts of passing variable assignments to the
+`make install' command line to change installation locations without
+having to reconfigure or recompile.
+
+ The first method involves providing an override variable for each
+affected directory. For example, `make install
+prefix=/alternate/directory' will choose an alternate location for all
+directory configuration variables that were expressed in terms of
+`${prefix}'. Any directories that were specified during `configure',
+but not in terms of `${prefix}', must each be overridden at install
+time for the entire installation to be relocated. The approach of
+makefile variable overrides for each directory variable is required by
+the GNU Coding Standards, and ideally causes no recompilation.
+However, some platforms have known limitations with the semantics of
+shared libraries that end up requiring recompilation when using this
+method, particularly noticeable in packages that use GNU Libtool.
+
+ The second method involves providing the `DESTDIR' variable. For
+example, `make install DESTDIR=/alternate/directory' will prepend
+`/alternate/directory' before all installation names. The approach of
+`DESTDIR' overrides is not required by the GNU Coding Standards, and
+does not work on platforms that have drive letters. On the other hand,
+it does better at avoiding recompilation issues, and works well even
+when some directory options were not specified in terms of `${prefix}'
+at `configure' time.
+
+Optional Features
+=================
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
+ 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
@@ -138,14 +208,53 @@ 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.
+ Some packages offer the ability to configure how verbose the
+execution of `make' will be. For these packages, running `./configure
+--enable-silent-rules' sets the default to minimal output, which can be
+overridden with `make V=1'; while running `./configure
+--disable-silent-rules' sets the default to verbose, which can be
+overridden with `make V=0'.
+
+Particular systems
+==================
+
+ On HP-UX, the default C compiler is not ANSI C compatible. If GNU
+CC is not installed, it is recommended to use the following options in
+order to use an ANSI C compiler:
+
+ ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
+
+and if that doesn't work, install pre-built binaries of GCC for HP-UX.
+
+ On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
+parse its `<wchar.h>' header file. The option `-nodtk' can be used as
+a workaround. If GNU CC is not installed, it is therefore recommended
+to try
+
+ ./configure CC="cc"
+
+and if that doesn't work, try
+
+ ./configure CC="cc -nodtk"
+
+ On Solaris, don't put `/usr/ucb' early in your `PATH'. This
+directory contains several dysfunctional programs; working variants of
+these programs are available in `/usr/bin'. So, if you need `/usr/ucb'
+in your `PATH', put it _after_ `/usr/bin'.
+
+ On Haiku, software installed for all users goes in `/boot/common',
+not `/usr/local'. It is recommended to use the following options:
+
+ ./configure --prefix=/boot/common
+
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:
@@ -153,7 +262,8 @@ type, such as `sun4', or a canonical name which has the form:
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
@@ -171,9 +281,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.
@@ -182,7 +292,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
@@ -201,11 +311,19 @@ an Autoconf bug. Until the bug is fixed you can use this workaround:
`configure' Invocation
======================
-`configure' recognizes the following options to control how it operates.
+ `configure' recognizes the following options to control how it
+operates.
`--help'
`-h'
- Print a summary of the options to `configure', and exit.
+ Print a summary of all of the options to `configure', and exit.
+
+`--help=short'
+`--help=recursive'
+ Print a summary of the options unique to this package's
+ `configure', and exit. The `short' variant lists options used
+ only in the top level, while the `recursive' variant lists options
+ also present in any nested packages.
`--version'
`-V'
@@ -232,6 +350,16 @@ an Autoconf bug. Until the bug is fixed you can use this workaround:
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
+`--prefix=DIR'
+ Use DIR as the installation prefix. *note Installation Names::
+ for more details, including other options available for fine-tuning
+ the installation locations.
+
+`--no-create'
+`-n'
+ Run the configure checks, but stop before creating any output
+ files.
+
`configure' also accepts some other, not widely useful, options. Run
`configure --help' for more details.
diff --git a/Makefile b/Makefile
deleted file mode 100755
index c3adcc8..0000000
--- a/Makefile
+++ b/dev/null
@@ -1,715 +0,0 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
-# Makefile. Generated from Makefile.in by configure.
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 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.
-
-
-
-
-pkgdatadir = $(datadir)/ntfs-3g
-pkglibdir = $(libdir)/ntfs-3g
-pkgincludedir = $(includedir)/ntfs-3g
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-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 = i686-pc-linux-gnu
-host_triplet = arc-unknown-linux-uclibc
-target_triplet = arc-unknown-linux-uclibc
-subdir = .
-DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
- $(srcdir)/Makefile.in $(srcdir)/config.h.in \
- $(top_srcdir)/configure AUTHORS COPYING COPYING.LIB ChangeLog \
- INSTALL NEWS compile config.guess config.sub depcomp \
- install-sh ltmain.sh missing
-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 config.status.lineno
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES =
-SOURCES =
-DIST_SOURCES =
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
- html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
-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)$(docdir)"
-docDATA_INSTALL = $(INSTALL_DATA)
-DATA = $(doc_DATA)
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
- distclean-recursive maintainer-clean-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 = ${SHELL} /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/missing --run aclocal-1.10
-AMTAR = ${SHELL} /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/missing --run tar
-AR = arc-linux-uclibc-ar
-AUTOCONF = ${SHELL} /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/missing --run autoconf
-AUTOHEADER = ${SHELL} /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/missing --run autoheader
-AUTOMAKE = ${SHELL} /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/missing --run automake-1.10
-AWK = mawk
-CC = arc-linux-uclibc-gcc
-CCDEPMODE = depmode=gcc3
-CFLAGS = -mA7 -g -Wall
-CPP = arc-linux-uclibc-gcc -E
-CPPFLAGS =
-CXX = arc-linux-uclibc-g++
-CXXCPP = arc-linux-uclibc-g++ -E
-CXXDEPMODE = depmode=gcc3
-CXXFLAGS = -g -O2
-CYGPATH_W = echo
-DEFS = -DHAVE_CONFIG_H
-DEPDIR = .deps
-DSYMUTIL =
-ECHO = echo
-ECHO_C =
-ECHO_N = -n
-ECHO_T =
-EGREP = /bin/grep -E
-EXEEXT =
-F77 =
-FFLAGS =
-FUSE_MODULE_CFLAGS =
-FUSE_MODULE_LIBS =
-GREP = /bin/grep
-INSTALL = /usr/bin/install -c
-INSTALL_DATA = ${INSTALL} -m 644
-INSTALL_PROGRAM = ${INSTALL}
-INSTALL_SCRIPT = ${INSTALL}
-INSTALL_STRIP_PROGRAM = $(install_sh) -c -s
-LDCONFIG = /sbin/ldconfig
-LDFLAGS =
-LIBFUSE_LITE_LIBS = -lpthread
-LIBNTFS_3G_VERSION = 76
-LIBOBJS = ${LIBOBJDIR}memcmp$U.o ${LIBOBJDIR}lstat$U.o ${LIBOBJDIR}stat$U.o
-LIBS =
-LIBTOOL = $(SHELL) $(top_builddir)/libtool
-LN_S = ln -s
-LTLIBOBJS = ${LIBOBJDIR}memcmp$U.lo ${LIBOBJDIR}lstat$U.lo ${LIBOBJDIR}stat$U.lo
-MAINT = #
-MAKEINFO = ${SHELL} /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/missing --run makeinfo
-MKDIR_P = /bin/mkdir -p
-MV = /bin/mv
-NMEDIT =
-OBJEXT = o
-OUTPUT_FORMAT =
-PACKAGE = ntfs-3g
-PACKAGE_BUGREPORT = ntfs-3g-devel@lists.sf.net
-PACKAGE_NAME = ntfs-3g
-PACKAGE_STRING = ntfs-3g 2010.5.16
-PACKAGE_TARNAME = ntfs-3g
-PACKAGE_VERSION = 2010.5.16
-PATH_SEPARATOR = :
-PKG_CONFIG =
-RANLIB = arc-linux-uclibc-ranlib
-RM = /bin/rm
-SED = /bin/sed
-SET_MAKE =
-SHELL = /bin/bash
-STRIP = arc-linux-uclibc-strip
-VERSION = 2010.5.16
-abs_builddir = /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16
-abs_srcdir = /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16
-abs_top_builddir = /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16
-abs_top_srcdir = /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16
-ac_ct_CC =
-ac_ct_CXX =
-ac_ct_F77 =
-am__include = include
-am__leading_dot = .
-am__quote =
-am__tar = ${AMTAR} chof - "$$tardir"
-am__untar = ${AMTAR} xf -
-bindir = ${exec_prefix}/bin
-build = i686-pc-linux-gnu
-build_alias =
-build_cpu = i686
-build_os = linux-gnu
-build_vendor = pc
-builddir = .
-datadir = ${datarootdir}
-datarootdir = ${prefix}/share
-docdir = ${datarootdir}/doc/${PACKAGE_TARNAME}
-dvidir = ${docdir}
-exec_prefix = /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/bld_7266_h_64x2/./rootfs
-host = arc-unknown-linux-uclibc
-host_alias = arc-linux-uclibc
-host_cpu = arc
-host_os = linux-uclibc
-host_vendor = unknown
-htmldir = ${docdir}
-includedir = ${prefix}/include
-infodir = ${datarootdir}/info
-install_sh = $(SHELL) /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/install-sh
-libdir = ${exec_prefix}/lib
-libexecdir = ${exec_prefix}/libexec
-localedir = ${datarootdir}/locale
-localstatedir = ${prefix}/var
-mandir = ${datarootdir}/man
-mkdir_p = /bin/mkdir -p
-ntfs3gincludedir = $(includedir)/ntfs-3g
-oldincludedir = /usr/include
-pdfdir = ${docdir}
-pkgconfigdir = $(libdir)/pkgconfig
-prefix = /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/bld_7266_h_64x2/./rootfs
-program_transform_name = s,x,x,
-psdir = ${docdir}
-rootbindir = $(bindir)
-rootlibdir = $(libdir)
-rootsbindir = $(sbindir)
-sbindir = ${exec_prefix}/sbin
-sharedstatedir = ${prefix}/com
-srcdir = .
-sysconfdir = ${prefix}/etc
-target = arc-unknown-linux-uclibc
-target_alias =
-target_cpu = arc
-target_os = linux-uclibc
-target_vendor = unknown
-top_builddir = .
-top_srcdir = .
-AUTOMAKE_OPTIONS = gnu
-ACLOCAL_AMFLAGS = -I m4
-EXTRA_DIST = AUTHORS CREDITS COPYING NEWS autogen.sh
-MAINTAINERCLEANFILES = \
- $(srcdir)/configure \
- $(srcdir)/Makefile.in \
- $(srcdir)/aclocal.m4 \
- $(srcdir)/compile \
- $(srcdir)/depcomp \
- $(srcdir)/install-sh \
- $(srcdir)/ltmain.sh \
- $(srcdir)/missing \
- $(srcdir)/config.guess \
- $(srcdir)/config.sub \
- $(srcdir)/config.h.in \
- $(srcdir)/config.h.in~ \
- $(srcdir)/INSTALL \
- $(srcdir)/m4/ltsugar.m4 \
- $(srcdir)/m4/libtool.m4 \
- $(srcdir)/m4/ltversion.m4 \
- $(srcdir)/m4/lt~obsolete.m4 \
- $(srcdir)/m4/ltoptions.m4
-
-SUBDIRS = include libfuse-lite libntfs-3g src
-doc_DATA = README
-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) $(AM_MAKEFLAGS) 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
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-distclean-libtool:
- -rm -f libtool
-install-docDATA: $(doc_DATA)
- @$(NORMAL_INSTALL)
- test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)"
- @list='$(doc_DATA)'; for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- f=$(am__strip_dir) \
- echo " $(docDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docdir)/$$f'"; \
- $(docDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docdir)/$$f"; \
- done
-
-uninstall-docDATA:
- @$(NORMAL_UNINSTALL)
- @list='$(doc_DATA)'; for p in $$list; do \
- f=$(am__strip_dir) \
- echo " rm -f '$(DESTDIR)$(docdir)/$$f'"; \
- rm -f "$(DESTDIR)$(docdir)/$$f"; \
- done
-
-# 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"
-
-$(RECURSIVE_CLEAN_TARGETS):
- @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; nonemtpy = 1; } \
- END { if (nonempty) { 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; nonempty = 1; } \
- END { if (nonempty) { 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=; \
- 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; nonempty = 1; } \
- END { if (nonempty) { 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)
- test -d $(distdir) || mkdir $(distdir)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- 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" \
- am__remove_distdir=: \
- am__skip_length_check=: \
- 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 $(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-lzma: distdir
- tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
- $(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.lzma*) \
- unlzma -c $(distdir).tar.lzma | $(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 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$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 $(DATA) config.h
-installdirs: installdirs-recursive
-installdirs-am:
- for dir in "$(DESTDIR)$(docdir)"; do \
- test -z "$$dir" || $(MKDIR_P) "$$dir"; \
- done
-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."
- -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-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-docDATA
-
-install-dvi: install-dvi-recursive
-
-install-exec-am:
-
-install-html: install-html-recursive
-
-install-info: install-info-recursive
-
-install-man:
-
-install-pdf: install-pdf-recursive
-
-install-ps: install-ps-recursive
-
-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-docDATA
-
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
- install-strip
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am am--refresh check check-am clean clean-generic \
- clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
- dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-zip \
- distcheck distclean distclean-generic distclean-hdr \
- distclean-libtool distclean-tags distcleancheck distdir \
- distuninstallcheck dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am \
- install-docDATA install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
- installcheck-am installdirs installdirs-am maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
- uninstall uninstall-am uninstall-docDATA
-
-
-dist-hook:
- $(MKDIR_P) "$(distdir)/m4"
-# 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/Makefile.am b/Makefile.am
index 7d883a4..0123e1f 100755
--- a/Makefile.am
+++ b/Makefile.am
@@ -1,66 +1,60 @@
-MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
-
+AUTOMAKE_OPTIONS = gnu
+ACLOCAL_AMFLAGS = -I m4
+
+EXTRA_DIST = AUTHORS CREDITS COPYING NEWS autogen.sh
+
+MAINTAINERCLEANFILES=\
+ $(srcdir)/configure \
+ $(srcdir)/Makefile.in \
+ $(srcdir)/aclocal.m4 \
+ $(srcdir)/compile \
+ $(srcdir)/depcomp \
+ $(srcdir)/install-sh \
+ $(srcdir)/ltmain.sh \
+ $(srcdir)/missing \
+ $(srcdir)/config.guess \
+ $(srcdir)/config.sub \
+ $(srcdir)/config.h.in \
+ $(srcdir)/config.h.in~ \
+ $(srcdir)/INSTALL \
+ $(srcdir)/m4/ltsugar.m4 \
+ $(srcdir)/m4/libtool.m4 \
+ $(srcdir)/m4/ltversion.m4 \
+ $(srcdir)/m4/lt~obsolete.m4 \
+ $(srcdir)/m4/ltoptions.m4
+
+SUBDIRS = include libfuse-lite libntfs-3g ntfsprogs src
+
+doc_DATA = README
+
+dist-hook:
+ $(MKDIR_P) "$(distdir)/m4"
+
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
+
+libs:
if FUSE_INTERNAL
-FUSE_CFLAGS = -I$(top_srcdir)/include/fuse-lite
-FUSE_LIBS =
-else
-FUSE_CFLAGS = $(FUSE_MODULE_CFLAGS)
-FUSE_LIBS = $(FUSE_MODULE_LIBS)
-endif
-
-bin_PROGRAMS = ntfs-3g.probe
-rootbin_PROGRAMS = ntfs-3g lowntfs-3g
-rootsbin_DATA = #Create directory
-man_MANS = ntfs-3g.8 ntfs-3g.probe.8
-
-ntfs_3g_LDADD = $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la
-if REALLYSTATIC
-ntfs_3g_LDFLAGS = $(AM_LDFLAGS) -all-static
+ (cd libfuse-lite && $(MAKE) libs) || exit 1;
endif
-ntfs_3g_CFLAGS = \
- $(AM_CFLAGS) \
- -DFUSE_USE_VERSION=26 \
- $(FUSE_CFLAGS) \
- -I$(top_srcdir)/include/ntfs-3g
-ntfs_3g_SOURCES = ntfs-3g.c
+ (cd libntfs-3g && $(MAKE) libs) || exit 1;
-lowntfs_3g_LDADD = $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la
-if REALLYSTATIC
-lowntfs_3g_LDFLAGS = $(AM_LDFLAGS) -all-static
-endif
-lowntfs_3g_CFLAGS = \
- $(AM_CFLAGS) \
- -DFUSE_USE_VERSION=26 \
- $(FUSE_CFLAGS) \
- -I$(top_srcdir)/include/ntfs-3g
-lowntfs_3g_SOURCES = lowntfs-3g.c
+libntfs:
+ (cd libntfs-3g && $(MAKE) libs) || exit 1;
-ntfs_3g_probe_LDADD = $(top_builddir)/libntfs-3g/libntfs-3g.la
-if REALLYSTATIC
-ntfs_3g_probe_LDFLAGS = $(AM_LDFLAGS) -all-static
-endif
-ntfs_3g_probe_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/include/ntfs-3g
-ntfs_3g_probe_SOURCES = ntfs-3g.probe.c
+drivers: libs
+ (cd src && $(MAKE) drivers) || exit 1;
-if RUN_LDCONFIG
-install-exec-hook:
- $(LDCONFIG)
-endif
+ntfsprogs: libntfs
+ (cd ntfsprogs && $(MAKE)) || exit 1;
-if ENABLE_MOUNT_HELPER
-install-exec-local: install-rootbinPROGRAMS
- $(MKDIR_P) "$(DESTDIR)/sbin"
- $(LN_S) -f "$(rootbindir)/ntfs-3g" "$(DESTDIR)/sbin/mount.ntfs-3g"
- $(LN_S) -f "$(rootbindir)/lowntfs-3g" "$(DESTDIR)/sbin/mount.lowntfs-3g"
-endif
+if ENABLE_NTFSPROGS
+strip:
+ (cd ntfsprogs && $(MAKE) strip) || exit 1;
-install-data-local: install-man8
- $(LN_S) -f ntfs-3g.8 "$(DESTDIR)$(man8dir)/mount.ntfs-3g.8"
- $(LN_S) -f ntfs-3g.8 "$(DESTDIR)$(man8dir)/mount.lowntfs-3g.8"
+extra: extras
-uninstall-local:
- $(RM) -f "$(DESTDIR)$(man8dir)/mount.ntfs-3g.8"
-if ENABLE_MOUNT_HELPER
- $(RM) -f "$(DESTDIR)/sbin/mount.ntfs-3g" "$(DESTDIR)/sbin/mount.lowntfs-3g"
+extras: libs
+ (cd ntfsprogs && $(MAKE) extras) || exit 1;
endif
diff --git a/Makefile.in b/Makefile.in
index 4fc593f..250cf18 100755
--- a/Makefile.in
+++ b/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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,11 +15,11 @@
@SET_MAKE@
-
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
@@ -34,77 +35,101 @@ POST_UNINSTALL = :
build_triplet = @build@
host_triplet = @host@
target_triplet = @target@
-bin_PROGRAMS = ntfs-3g.probe$(EXEEXT)
-rootbin_PROGRAMS = ntfs-3g$(EXEEXT) lowntfs-3g$(EXEEXT)
-subdir = src
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
- $(srcdir)/ntfs-3g.8.in $(srcdir)/ntfs-3g.probe.8.in \
- $(srcdir)/ntfs-3g.secaudit.8.in $(srcdir)/ntfs-3g.usermap.8.in
+subdir = .
+DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
+ $(srcdir)/Makefile.in $(srcdir)/config.h.in \
+ $(top_srcdir)/configure AUTHORS COPYING COPYING.LIB ChangeLog \
+ INSTALL NEWS compile config.guess config.sub depcomp \
+ install-sh ltmain.sh missing
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(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 config.status.lineno
mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES = ntfs-3g.8 ntfs-3g.probe.8 ntfs-3g.usermap.8 \
- ntfs-3g.secaudit.8
-am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(rootbindir)" \
- "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(rootsbindir)"
-binPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
-rootbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
-PROGRAMS = $(bin_PROGRAMS) $(rootbin_PROGRAMS)
-am_lowntfs_3g_OBJECTS = lowntfs_3g-lowntfs-3g.$(OBJEXT)
-lowntfs_3g_OBJECTS = $(am_lowntfs_3g_OBJECTS)
-am__DEPENDENCIES_1 =
-@FUSE_INTERNAL_FALSE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
-lowntfs_3g_DEPENDENCIES = $(am__DEPENDENCIES_2) \
- $(top_builddir)/libntfs-3g/libntfs-3g.la
-lowntfs_3g_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(lowntfs_3g_CFLAGS) \
- $(CFLAGS) $(lowntfs_3g_LDFLAGS) $(LDFLAGS) -o $@
-am_ntfs_3g_OBJECTS = ntfs_3g-ntfs-3g.$(OBJEXT)
-ntfs_3g_OBJECTS = $(am_ntfs_3g_OBJECTS)
-ntfs_3g_DEPENDENCIES = $(am__DEPENDENCIES_2) \
- $(top_builddir)/libntfs-3g/libntfs-3g.la
-ntfs_3g_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(ntfs_3g_CFLAGS) $(CFLAGS) \
- $(ntfs_3g_LDFLAGS) $(LDFLAGS) -o $@
-am_ntfs_3g_probe_OBJECTS = ntfs_3g_probe-ntfs-3g.probe.$(OBJEXT)
-ntfs_3g_probe_OBJECTS = $(am_ntfs_3g_probe_OBJECTS)
-ntfs_3g_probe_DEPENDENCIES = $(top_builddir)/libntfs-3g/libntfs-3g.la
-ntfs_3g_probe_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(ntfs_3g_probe_CFLAGS) \
- $(CFLAGS) $(ntfs_3g_probe_LDFLAGS) $(LDFLAGS) -o $@
-DEFAULT_INCLUDES = -I.@am__isrc@ -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 $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
-SOURCES = $(lowntfs_3g_SOURCES) $(ntfs_3g_SOURCES) \
- $(ntfs_3g_probe_SOURCES)
-DIST_SOURCES = $(lowntfs_3g_SOURCES) $(ntfs_3g_SOURCES) \
- $(ntfs_3g_probe_SOURCES)
-man8dir = $(mandir)/man8
-NROFF = nroff
-MANS = $(man_MANS)
+CONFIG_HEADER = config.h
+CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
+SOURCES =
+DIST_SOURCES =
+RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
+ html-recursive info-recursive install-data-recursive \
+ install-dvi-recursive install-exec-recursive \
+ install-html-recursive install-info-recursive \
+ install-pdf-recursive install-ps-recursive install-recursive \
+ installcheck-recursive installdirs-recursive pdf-recursive \
+ ps-recursive uninstall-recursive
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|^.*/||'`;
-rootsbinDATA_INSTALL = $(INSTALL_DATA)
-DATA = $(rootsbin_DATA)
+am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__installdirs = "$(DESTDIR)$(docdir)"
+DATA = $(doc_DATA)
+RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
+ distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir dist dist-all distcheck
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)"; }; }
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
+DIST_ARCHIVES = $(distdir).tar.gz
+GZIP_ENV = --best
+distuninstallcheck_listfiles = find . -type f -print
+distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
@@ -117,54 +142,69 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FGREP = @FGREP@
FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@
FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
LDCONFIG = @LDCONFIG@
LDFLAGS = @LDFLAGS@
+LIBFUSE_LITE_CFLAGS = @LIBFUSE_LITE_CFLAGS@
LIBFUSE_LITE_LIBS = @LIBFUSE_LITE_LIBS@
+LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
LIBNTFS_3G_VERSION = @LIBNTFS_3G_VERSION@
+LIBNTFS_CPPFLAGS = @LIBNTFS_CPPFLAGS@
+LIBNTFS_LIBS = @LIBNTFS_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MKNTFS_CPPFLAGS = @MKNTFS_CPPFLAGS@
+MKNTFS_LIBS = @MKNTFS_LIBS@
MV = @MV@
+NM = @NM@
NMEDIT = @NMEDIT@
+NTFSPROGS_STATIC_LIBS = @NTFSPROGS_STATIC_LIBS@
+OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
OUTPUT_FORMAT = @OUTPUT_FORMAT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
RM = @RM@
SED = @SED@
@@ -177,8 +217,9 @@ abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+all_includes = @all_includes@
+all_libraries = @all_libraries@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -209,6 +250,7 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
ntfs3gincludedir = @ntfs3gincludedir@
@@ -230,283 +272,187 @@ target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
-@FUSE_INTERNAL_FALSE@FUSE_CFLAGS = $(FUSE_MODULE_CFLAGS)
-@FUSE_INTERNAL_TRUE@FUSE_CFLAGS = -I$(top_srcdir)/include/fuse-lite
-@FUSE_INTERNAL_FALSE@FUSE_LIBS = $(FUSE_MODULE_LIBS)
-@FUSE_INTERNAL_TRUE@FUSE_LIBS =
-rootsbin_DATA = #Create directory
-man_MANS = ntfs-3g.8 ntfs-3g.probe.8
-ntfs_3g_LDADD = $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la
-@REALLYSTATIC_TRUE@ntfs_3g_LDFLAGS = $(AM_LDFLAGS) -all-static
-ntfs_3g_CFLAGS = \
- $(AM_CFLAGS) \
- -DFUSE_USE_VERSION=26 \
- $(FUSE_CFLAGS) \
- -I$(top_srcdir)/include/ntfs-3g
-
-ntfs_3g_SOURCES = ntfs-3g.c
-lowntfs_3g_LDADD = $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la
-@REALLYSTATIC_TRUE@lowntfs_3g_LDFLAGS = $(AM_LDFLAGS) -all-static
-lowntfs_3g_CFLAGS = \
- $(AM_CFLAGS) \
- -DFUSE_USE_VERSION=26 \
- $(FUSE_CFLAGS) \
- -I$(top_srcdir)/include/ntfs-3g
-
-lowntfs_3g_SOURCES = lowntfs-3g.c
-ntfs_3g_probe_LDADD = $(top_builddir)/libntfs-3g/libntfs-3g.la
-@REALLYSTATIC_TRUE@ntfs_3g_probe_LDFLAGS = $(AM_LDFLAGS) -all-static
-ntfs_3g_probe_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/include/ntfs-3g
-ntfs_3g_probe_SOURCES = ntfs-3g.probe.c
-all: all-am
+AUTOMAKE_OPTIONS = gnu
+ACLOCAL_AMFLAGS = -I m4
+EXTRA_DIST = AUTHORS CREDITS COPYING NEWS autogen.sh
+MAINTAINERCLEANFILES = \
+ $(srcdir)/configure \
+ $(srcdir)/Makefile.in \
+ $(srcdir)/aclocal.m4 \
+ $(srcdir)/compile \
+ $(srcdir)/depcomp \
+ $(srcdir)/install-sh \
+ $(srcdir)/ltmain.sh \
+ $(srcdir)/missing \
+ $(srcdir)/config.guess \
+ $(srcdir)/config.sub \
+ $(srcdir)/config.h.in \
+ $(srcdir)/config.h.in~ \
+ $(srcdir)/INSTALL \
+ $(srcdir)/m4/ltsugar.m4 \
+ $(srcdir)/m4/libtool.m4 \
+ $(srcdir)/m4/ltversion.m4 \
+ $(srcdir)/m4/lt~obsolete.m4 \
+ $(srcdir)/m4/ltoptions.m4
+
+SUBDIRS = include libfuse-lite libntfs-3g ntfsprogs src
+doc_DATA = README
+all: config.h
+ $(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
+am--refresh:
+ @:
$(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 \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \
+ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \
&& exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu src/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
*config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ echo ' $(SHELL) ./config.status'; \
+ $(SHELL) ./config.status;; \
*) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ 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)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+ $(SHELL) ./config.status --recheck
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+ $(am__cd) $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-ntfs-3g.8: $(top_builddir)/config.status $(srcdir)/ntfs-3g.8.in
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-ntfs-3g.probe.8: $(top_builddir)/config.status $(srcdir)/ntfs-3g.probe.8.in
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-ntfs-3g.usermap.8: $(top_builddir)/config.status $(srcdir)/ntfs-3g.usermap.8.in
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-ntfs-3g.secaudit.8: $(top_builddir)/config.status $(srcdir)/ntfs-3g.secaudit.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) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \
- $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --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-rootbinPROGRAMS: $(rootbin_PROGRAMS)
- @$(NORMAL_INSTALL)
- test -z "$(rootbindir)" || $(MKDIR_P) "$(DESTDIR)$(rootbindir)"
- @list='$(rootbin_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) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(rootbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(rootbindir)/$$f'"; \
- $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(rootbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(rootbindir)/$$f" || exit 1; \
- else :; fi; \
- done
-
-uninstall-rootbinPROGRAMS:
- @$(NORMAL_UNINSTALL)
- @list='$(rootbin_PROGRAMS)'; for p in $$list; do \
- f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
- echo " rm -f '$(DESTDIR)$(rootbindir)/$$f'"; \
- rm -f "$(DESTDIR)$(rootbindir)/$$f"; \
- done
-
-clean-rootbinPROGRAMS:
- @list='$(rootbin_PROGRAMS)'; for p in $$list; do \
- f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f $$p $$f"; \
- rm -f $$p $$f ; \
- done
-lowntfs-3g$(EXEEXT): $(lowntfs_3g_OBJECTS) $(lowntfs_3g_DEPENDENCIES)
- @rm -f lowntfs-3g$(EXEEXT)
- $(lowntfs_3g_LINK) $(lowntfs_3g_OBJECTS) $(lowntfs_3g_LDADD) $(LIBS)
-ntfs-3g$(EXEEXT): $(ntfs_3g_OBJECTS) $(ntfs_3g_DEPENDENCIES)
- @rm -f ntfs-3g$(EXEEXT)
- $(ntfs_3g_LINK) $(ntfs_3g_OBJECTS) $(ntfs_3g_LDADD) $(LIBS)
-ntfs-3g.probe$(EXEEXT): $(ntfs_3g_probe_OBJECTS) $(ntfs_3g_probe_DEPENDENCIES)
- @rm -f ntfs-3g.probe$(EXEEXT)
- $(ntfs_3g_probe_LINK) $(ntfs_3g_probe_OBJECTS) $(ntfs_3g_probe_LDADD) $(LIBS)
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT)
-
-distclean-compile:
- -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lowntfs_3g-lowntfs-3g.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfs_3g-ntfs-3g.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfs_3g_probe-ntfs-3g.probe.Po@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@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@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@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 $@ $<
-
-lowntfs_3g-lowntfs-3g.o: lowntfs-3g.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lowntfs_3g_CFLAGS) $(CFLAGS) -MT lowntfs_3g-lowntfs-3g.o -MD -MP -MF $(DEPDIR)/lowntfs_3g-lowntfs-3g.Tpo -c -o lowntfs_3g-lowntfs-3g.o `test -f 'lowntfs-3g.c' || echo '$(srcdir)/'`lowntfs-3g.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/lowntfs_3g-lowntfs-3g.Tpo $(DEPDIR)/lowntfs_3g-lowntfs-3g.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lowntfs-3g.c' object='lowntfs_3g-lowntfs-3g.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) $(lowntfs_3g_CFLAGS) $(CFLAGS) -c -o lowntfs_3g-lowntfs-3g.o `test -f 'lowntfs-3g.c' || echo '$(srcdir)/'`lowntfs-3g.c
-
-lowntfs_3g-lowntfs-3g.obj: lowntfs-3g.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lowntfs_3g_CFLAGS) $(CFLAGS) -MT lowntfs_3g-lowntfs-3g.obj -MD -MP -MF $(DEPDIR)/lowntfs_3g-lowntfs-3g.Tpo -c -o lowntfs_3g-lowntfs-3g.obj `if test -f 'lowntfs-3g.c'; then $(CYGPATH_W) 'lowntfs-3g.c'; else $(CYGPATH_W) '$(srcdir)/lowntfs-3g.c'; fi`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/lowntfs_3g-lowntfs-3g.Tpo $(DEPDIR)/lowntfs_3g-lowntfs-3g.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lowntfs-3g.c' object='lowntfs_3g-lowntfs-3g.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) $(lowntfs_3g_CFLAGS) $(CFLAGS) -c -o lowntfs_3g-lowntfs-3g.obj `if test -f 'lowntfs-3g.c'; then $(CYGPATH_W) 'lowntfs-3g.c'; else $(CYGPATH_W) '$(srcdir)/lowntfs-3g.c'; fi`
-
-ntfs_3g-ntfs-3g.o: ntfs-3g.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfs_3g_CFLAGS) $(CFLAGS) -MT ntfs_3g-ntfs-3g.o -MD -MP -MF $(DEPDIR)/ntfs_3g-ntfs-3g.Tpo -c -o ntfs_3g-ntfs-3g.o `test -f 'ntfs-3g.c' || echo '$(srcdir)/'`ntfs-3g.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ntfs_3g-ntfs-3g.Tpo $(DEPDIR)/ntfs_3g-ntfs-3g.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ntfs-3g.c' object='ntfs_3g-ntfs-3g.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) $(ntfs_3g_CFLAGS) $(CFLAGS) -c -o ntfs_3g-ntfs-3g.o `test -f 'ntfs-3g.c' || echo '$(srcdir)/'`ntfs-3g.c
-
-ntfs_3g-ntfs-3g.obj: ntfs-3g.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfs_3g_CFLAGS) $(CFLAGS) -MT ntfs_3g-ntfs-3g.obj -MD -MP -MF $(DEPDIR)/ntfs_3g-ntfs-3g.Tpo -c -o ntfs_3g-ntfs-3g.obj `if test -f 'ntfs-3g.c'; then $(CYGPATH_W) 'ntfs-3g.c'; else $(CYGPATH_W) '$(srcdir)/ntfs-3g.c'; fi`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ntfs_3g-ntfs-3g.Tpo $(DEPDIR)/ntfs_3g-ntfs-3g.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ntfs-3g.c' object='ntfs_3g-ntfs-3g.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) $(ntfs_3g_CFLAGS) $(CFLAGS) -c -o ntfs_3g-ntfs-3g.obj `if test -f 'ntfs-3g.c'; then $(CYGPATH_W) 'ntfs-3g.c'; else $(CYGPATH_W) '$(srcdir)/ntfs-3g.c'; fi`
-
-ntfs_3g_probe-ntfs-3g.probe.o: ntfs-3g.probe.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfs_3g_probe_CFLAGS) $(CFLAGS) -MT ntfs_3g_probe-ntfs-3g.probe.o -MD -MP -MF $(DEPDIR)/ntfs_3g_probe-ntfs-3g.probe.Tpo -c -o ntfs_3g_probe-ntfs-3g.probe.o `test -f 'ntfs-3g.probe.c' || echo '$(srcdir)/'`ntfs-3g.probe.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ntfs_3g_probe-ntfs-3g.probe.Tpo $(DEPDIR)/ntfs_3g_probe-ntfs-3g.probe.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ntfs-3g.probe.c' object='ntfs_3g_probe-ntfs-3g.probe.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) $(ntfs_3g_probe_CFLAGS) $(CFLAGS) -c -o ntfs_3g_probe-ntfs-3g.probe.o `test -f 'ntfs-3g.probe.c' || echo '$(srcdir)/'`ntfs-3g.probe.c
-
-ntfs_3g_probe-ntfs-3g.probe.obj: ntfs-3g.probe.c
-@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfs_3g_probe_CFLAGS) $(CFLAGS) -MT ntfs_3g_probe-ntfs-3g.probe.obj -MD -MP -MF $(DEPDIR)/ntfs_3g_probe-ntfs-3g.probe.Tpo -c -o ntfs_3g_probe-ntfs-3g.probe.obj `if test -f 'ntfs-3g.probe.c'; then $(CYGPATH_W) 'ntfs-3g.probe.c'; else $(CYGPATH_W) '$(srcdir)/ntfs-3g.probe.c'; fi`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/ntfs_3g_probe-ntfs-3g.probe.Tpo $(DEPDIR)/ntfs_3g_probe-ntfs-3g.probe.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ntfs-3g.probe.c' object='ntfs_3g_probe-ntfs-3g.probe.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) $(ntfs_3g_probe_CFLAGS) $(CFLAGS) -c -o ntfs_3g_probe-ntfs-3g.probe.obj `if test -f 'ntfs-3g.probe.c'; then $(CYGPATH_W) 'ntfs-3g.probe.c'; else $(CYGPATH_W) '$(srcdir)/ntfs-3g.probe.c'; fi`
+ $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
+$(am__aclocal_m4_deps):
+
+config.h: stamp-h1
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) $(AM_MAKEFLAGS) 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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
+ rm -f stamp-h1
+ touch $@
+
+distclean-hdr:
+ -rm -f config.h stamp-h1
mostlyclean-libtool:
-rm -f *.lo
clean-libtool:
-rm -rf .libs _libs
-install-man8: $(man8_MANS) $(man_MANS)
+
+distclean-libtool:
+ -rm -f libtool config.lt
+install-docDATA: $(doc_DATA)
@$(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"; \
+ test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)"
+ @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(docdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(docdir)" || exit $$?; \
done
-uninstall-man8:
+
+uninstall-docDATA:
@$(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" ;; \
+ @list='$(doc_DATA)'; test -n "$(docdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(docdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(docdir)" && rm -f $$files
+
+# 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):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
esac; \
done; \
- for i in $$list; do \
- ext=`echo $$i | sed -e 's/^.*\\.//'`; \
- case "$$ext" in \
- 8*) ;; \
- *) ext='8' ;; \
+ 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; \
+ ($(am__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"
+
+$(RECURSIVE_CLEAN_TARGETS):
+ @fail= failcom='exit 1'; \
+ for f in x $$MAKEFLAGS; do \
+ case $$f in \
+ *=* | --[!k]*);; \
+ *k*) failcom='fail=yes';; \
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; \
+ 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; \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || eval $$failcom; \
+ done && test -z "$$fail"
+tags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
-install-rootsbinDATA: $(rootsbin_DATA)
- @$(NORMAL_INSTALL)
- test -z "$(rootsbindir)" || $(MKDIR_P) "$(DESTDIR)$(rootsbindir)"
- @list='$(rootsbin_DATA)'; for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- f=$(am__strip_dir) \
- echo " $(rootsbinDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(rootsbindir)/$$f'"; \
- $(rootsbinDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(rootsbindir)/$$f"; \
- done
-
-uninstall-rootsbinDATA:
- @$(NORMAL_UNINSTALL)
- @list='$(rootsbin_DATA)'; for p in $$list; do \
- f=$(am__strip_dir) \
- echo " rm -f '$(DESTDIR)$(rootsbindir)/$$f'"; \
- rm -f "$(DESTDIR)$(rootsbindir)/$$f"; \
+ctags-recursive:
+ list='$(SUBDIRS)'; for subdir in $$list; do \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@@ -514,49 +460,69 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
+ set x; \
here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ 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 || \
+ set "$$@" "$$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; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
fi
ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ 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; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
+ $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
+ $(am__remove_distdir)
+ test -d "$(distdir)" || mkdir "$(distdir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
list='$(DISTFILES)'; \
@@ -572,32 +538,183 @@ distdir: $(DISTFILES)
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
+ 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; \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
+ am__remove_distdir=: \
+ am__skip_length_check=: \
+ am__skip_mode_fix=: \
+ distdir) \
+ || exit 1; \
+ fi; \
+ done
+ $(MAKE) $(AM_MAKEFLAGS) \
+ top_distdir="$(top_distdir)" distdir="$(distdir)" \
+ dist-hook
+ -test -n "$(am__skip_mode_fix)" \
+ || find "$(distdir)" -type d ! -perm -755 \
+ -exec chmod u+rwx,go+rx {} \; -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 $(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-lzma: distdir
+ tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
+ $(am__remove_distdir)
+
+dist-xz: distdir
+ tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
+ $(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) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+ *.tar.bz2*) \
+ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
+ *.tar.lzma*) \
+ lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
+ *.tar.xz*) \
+ xz -dc $(distdir).tar.xz | $(am__untar) ;;\
+ *.tar.Z*) \
+ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ *.shar.gz*) \
+ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+ *.zip*) \
+ unzip $(distdir).zip ;;\
+ esac
+ chmod -R a-w $(distdir); chmod u+w $(distdir)
+ mkdir $(distdir)/_build
+ mkdir $(distdir)/_inst
+ chmod a-w $(distdir)
+ test -d $(distdir)/_build || exit 0; \
+ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
+ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
+ && am__cwd=`pwd` \
+ && $(am__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 \
+ && cd "$$am__cwd" \
+ || exit 1
+ $(am__remove_distdir)
+ @(echo "$(distdir) archives ready for distribution: "; \
+ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
+ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+distuninstallcheck:
+ @$(am__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-am
-all-am: Makefile $(PROGRAMS) $(MANS) $(DATA)
-installdirs:
- for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(rootbindir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(rootsbindir)"; do \
+check: check-recursive
+all-am: Makefile $(DATA) config.h
+installdirs: installdirs-recursive
+installdirs-am:
+ for dir in "$(DESTDIR)$(docdir)"; 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: 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_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
@@ -609,114 +726,130 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
-@ENABLE_MOUNT_HELPER_FALSE@install-exec-local:
-@RUN_LDCONFIG_FALSE@install-exec-hook:
-clean: clean-am
+clean: clean-recursive
-clean-am: clean-binPROGRAMS clean-generic clean-libtool \
- clean-rootbinPROGRAMS mostlyclean-am
+clean-am: clean-generic clean-libtool mostlyclean-am
-distclean: distclean-am
- -rm -rf ./$(DEPDIR)
+distclean: distclean-recursive
+ -rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+distclean-am: clean-am distclean-generic distclean-hdr \
+ distclean-libtool distclean-tags
-dvi: dvi-am
+dvi: dvi-recursive
dvi-am:
-html: html-am
+html: html-recursive
+
+html-am:
-info: info-am
+info: info-recursive
info-am:
-install-data-am: install-data-local install-man \
- install-rootbinPROGRAMS install-rootsbinDATA
+install-data-am: install-docDATA
-install-dvi: install-dvi-am
+install-dvi: install-dvi-recursive
-install-exec-am: install-binPROGRAMS install-exec-local
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+install-dvi-am:
+
+install-exec-am:
-install-html: install-html-am
+install-html: install-html-recursive
-install-info: install-info-am
+install-html-am:
-install-man: install-man8
+install-info: install-info-recursive
-install-pdf: install-pdf-am
+install-info-am:
-install-ps: install-ps-am
+install-man:
+
+install-pdf: install-pdf-recursive
+
+install-pdf-am:
+
+install-ps: install-ps-recursive
+
+install-ps-am:
installcheck-am:
-maintainer-clean: maintainer-clean-am
- -rm -rf ./$(DEPDIR)
+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-am
+mostlyclean: mostlyclean-recursive
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool
+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-binPROGRAMS uninstall-local uninstall-man \
- uninstall-rootbinPROGRAMS uninstall-rootsbinDATA
-
-uninstall-man: uninstall-man8
-
-.MAKE: install-am install-exec-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
- clean-generic clean-libtool clean-rootbinPROGRAMS 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-data-local install-dvi \
- install-dvi-am install-exec install-exec-am install-exec-hook \
- install-exec-local install-html install-html-am install-info \
- install-info-am install-man install-man8 install-pdf \
- install-pdf-am install-ps install-ps-am \
- install-rootbinPROGRAMS install-rootsbinDATA 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-local uninstall-man uninstall-man8 \
- uninstall-rootbinPROGRAMS uninstall-rootsbinDATA
-
-
-@RUN_LDCONFIG_TRUE@install-exec-hook:
-@RUN_LDCONFIG_TRUE@ $(LDCONFIG)
-
-@ENABLE_MOUNT_HELPER_TRUE@install-exec-local: install-rootbinPROGRAMS
-@ENABLE_MOUNT_HELPER_TRUE@ $(MKDIR_P) "$(DESTDIR)/sbin"
-@ENABLE_MOUNT_HELPER_TRUE@ $(LN_S) -f "$(rootbindir)/ntfs-3g" "$(DESTDIR)/sbin/mount.ntfs-3g"
-@ENABLE_MOUNT_HELPER_TRUE@ $(LN_S) -f "$(rootbindir)/lowntfs-3g" "$(DESTDIR)/sbin/mount.lowntfs-3g"
-
-install-data-local: install-man8
- $(LN_S) -f ntfs-3g.8 "$(DESTDIR)$(man8dir)/mount.ntfs-3g.8"
- $(LN_S) -f ntfs-3g.8 "$(DESTDIR)$(man8dir)/mount.lowntfs-3g.8"
-
-uninstall-local:
- $(RM) -f "$(DESTDIR)$(man8dir)/mount.ntfs-3g.8"
-@ENABLE_MOUNT_HELPER_TRUE@ $(RM) -f "$(DESTDIR)/sbin/mount.ntfs-3g" "$(DESTDIR)/sbin/mount.lowntfs-3g"
+uninstall-am: uninstall-docDATA
+
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \
+ ctags-recursive install-am install-strip tags-recursive
+
+.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
+ all all-am am--refresh check check-am clean clean-generic \
+ clean-libtool ctags ctags-recursive dist dist-all dist-bzip2 \
+ dist-gzip dist-hook dist-lzma dist-shar dist-tarZ dist-xz \
+ dist-zip distcheck distclean distclean-generic distclean-hdr \
+ distclean-libtool distclean-tags distcleancheck distdir \
+ distuninstallcheck dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am \
+ install-docDATA install-dvi install-dvi-am install-exec \
+ install-exec-am install-html install-html-am install-info \
+ install-info-am install-man install-pdf install-pdf-am \
+ install-ps install-ps-am install-strip installcheck \
+ installcheck-am installdirs installdirs-am maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-docDATA
+
+
+dist-hook:
+ $(MKDIR_P) "$(distdir)/m4"
+
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
+
+libs:
+@FUSE_INTERNAL_TRUE@ (cd libfuse-lite && $(MAKE) libs) || exit 1;
+ (cd libntfs-3g && $(MAKE) libs) || exit 1;
+
+libntfs:
+ (cd libntfs-3g && $(MAKE) libs) || exit 1;
+
+drivers: libs
+ (cd src && $(MAKE) drivers) || exit 1;
+
+ntfsprogs: libntfs
+ (cd ntfsprogs && $(MAKE)) || exit 1;
+
+@ENABLE_NTFSPROGS_TRUE@strip:
+@ENABLE_NTFSPROGS_TRUE@ (cd ntfsprogs && $(MAKE) strip) || exit 1;
+
+@ENABLE_NTFSPROGS_TRUE@extra: extras
+
+@ENABLE_NTFSPROGS_TRUE@extras: libs
+@ENABLE_NTFSPROGS_TRUE@ (cd ntfsprogs && $(MAKE) extras) || 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/NEWS b/NEWS
index 885ef59..3a7effd 100755
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,5 @@
-Project news are at http://www.ntfs-3g.org
+Project news are at http://tuxera.com/community/ntfs-3g-download/
-Release notes are maintained at http://www.ntfs-3g.org/releases.html
+Release notes are maintained at http://tuxera.com/community/release-history/
diff --git a/README b/README
index 12328b3..e7b08d9 100755
--- a/README
+++ b/README
@@ -38,14 +38,32 @@ the FUSE kernel module. Then unpack the source tarball and type:
make
make install # or 'sudo make install' if you aren't root.
-Please note that NTFS-3G doesn't require the FUSE user space package.
+Please note that NTFS-3G doesn't require the FUSE user space package any
+more.
+
+The list of options for building specific configurations is displayed by
+typing :
+
+ ./configure --help
+
+Below are a few specific options to ./configure :
+ --disable-ntfsprogs : do not build the ntfsprogs tools,
+ --enable-posix-acls : enable support for Posix ACLs
+ --enable-xattr-mappings : enable system extended attributes mappings
+ --with-fuse=external : use external fuse (overriding Linux default)
+
+There are also a few make targets for building parts :
+ make libntfs : only build the libntfs-3g library
+ make libs : only build libntfs-3g (and libfuse-lite, if relevant)
+ make drivers : only build drivers and libraries, without ntfsprogs
+ make ntfsprogs : only build ntfsprogs and libntfs-3g, without drivers
Non-Linux: Please see
http://www.tuxera.com/community/ntfs-3g-download/
-for OS specific installation and source packages.
-
+for known OS specific installation and source packages, but generally
+the same procedures apply.
USAGE
=====
@@ -66,3 +84,59 @@ line at the END(!) of the /etc/fstab file:
/dev/sda1 /mnt/windows ntfs-3g defaults 0 0
+
+TESTING WITHOUT INSTALLING
+=========================
+
+Newer versions of ntfs-3g can be tested without installing anything and
+without disturbing an existing installation. Just configure and make as
+shown previously. This will create the scripts ntfs-3g and lowntfs-3g
+in the src directory, which you may activate for testing :
+
+ ./configure
+ make
+
+then, as root :
+ src/ntfs-3g [-o mount-options] /dev/sda1 /mnt/windows
+
+And, to end the test, unmount the usual way :
+ umount /dev/sda1
+
+
+NTFS UTILITIES
+==============
+
+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 and force Windows to check NTFS.
+
+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.
+
+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.
+
+ntfscat - Concatenate files and print their contents on the standard output.
+
+ntfscp - Overwrite files on an NTFS partition.
diff --git a/TODO.ntfsprogs b/TODO.ntfsprogs
new file mode 100755
index 0000000..3a60421
--- a/dev/null
+++ b/TODO.ntfsprogs
@@ -0,0 +1,126 @@
+Please keep in alphabetical order so utilities are easier to find.
+
+Thanks,
+ Anton
+
+
+**********
+* 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
+ make it much smaller. Need to verify this and experiment with the bitmap
+ size to make it work. Note, reporter was using win2k.
+
+
+*************
+* ntfsclone *
+*************
+
+- 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
+- disable consistency check for --metadata (e.g. if the check is crashing)
+- 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
+
+
+***********
+* ntfscmp *
+***********
+
+- compare mft record headers
+- exit status is 0 if inputs are the same, 1 if different, other if trouble
+- optionally ignore less interesting fields (e.g. attribute instance)
+- new option: --metadata mode
+- unnamed resident attributes with same type are ignored
+- code cleanup, remove many cross-util duplicates
+- handle deleted records
+- performance: special handling for sparse files
+
+
+**********
+* ntfscp *
+**********
+
+- add ability to copy multiple files at once.
+
+
+***********
+* 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 kernel driver and ntfsmount for reading/changing the label.
+
+
+*************
+* ntfsmount *
+*************
+
+
+
+**************
+* ntfsresize *
+**************
+
+High priority
+ - 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
+ - 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
+
+
+****************
+* ntfsundelete *
+****************
+
+- undelete by name rather than inode number
+- support for compressed files
+- support for internationalisation
+- recover by type?
+- mass undelete (using wildcards)
+- display parent directory
+- name "<none>" to MFTn
diff --git a/aclocal.m4 b/aclocal.m4
index 1379c10..040cdfa 100755
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -1,7 +1,7 @@
-# generated automatically by aclocal 1.10.1 -*- Autoconf -*-
+# generated automatically by aclocal 1.11.1 -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2005, 2006, 2007, 2008, 2009 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.
@@ -13,6649 +13,123 @@
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(AC_AUTOCONF_VERSION, [2.61],,
-[m4_warning([this file was generated for autoconf 2.61.
+m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.67],,
+[m4_warning([this file was generated for autoconf 2.67.
You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
-# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
-
-# serial 52 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 Autoconf macros for libgcrypt
+dnl Copyright (C) 2002, 2004 Free Software Foundation, Inc.
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 MSVC,
-# 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 "$LTCFLAGS" && LTCFLAGS=$CFLAGS
-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_postinstall_cmds='chmod 644 $oldlib'
-old_postuninstall_cmds=
-
-if test -n "$RANLIB"; then
- case $host_os in
- openbsd*)
- old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
- ;;
- *)
- old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
- ;;
- 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*)
- if test "$file_magic_cmd" = '$MAGIC_CMD'; then
- AC_PATH_MAGIC
- fi
- ;;
-esac
-
-_LT_REQUIRED_DARWIN_CHECKS
-
-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"}
-
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
-
-# 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
-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_REQUIRE([LT_AC_PROG_SED])dnl
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/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_REQUIRE([LT_AC_PROG_SED])dnl
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$rm -r conftest*
-])# _LT_LINKER_BOILERPLATE
-
-# _LT_REQUIRED_DARWIN_CHECKS
-# --------------------------
-# Check for some things on darwin
-AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS],[
- case $host_os in
- rhapsody* | darwin*)
- AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
- AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
-
- AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
- [lt_cv_apple_cc_single_mod=no
- if test -z "${LT_MULTI_MODULE}"; then
- # By default we will add the -single_module flag. You can override
- # by either setting the environment variable LT_MULTI_MODULE
- # non-empty at configure time, or by adding -multi_module to the
- # link flags.
- echo "int foo(void){return 1;}" > conftest.c
- $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
- -dynamiclib ${wl}-single_module conftest.c
- if test -f libconftest.dylib; then
- lt_cv_apple_cc_single_mod=yes
- rm -rf libconftest.dylib*
- fi
- rm conftest.c
- fi])
- AC_CACHE_CHECK([for -exported_symbols_list linker flag],
- [lt_cv_ld_exported_symbols_list],
- [lt_cv_ld_exported_symbols_list=no
- save_LDFLAGS=$LDFLAGS
- echo "_main" > conftest.sym
- LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
- [lt_cv_ld_exported_symbols_list=yes],
- [lt_cv_ld_exported_symbols_list=no])
- LDFLAGS="$save_LDFLAGS"
- ])
- case $host_os in
- rhapsody* | darwin1.[[0123]])
- _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
- darwin1.*)
- _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
- darwin*)
- # if running on 10.5 or later, the deployment target defaults
- # to the OS version, if on x86, and 10.4, the deployment
- # target defaults to 10.4. Don't you love it?
- case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
- 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
- _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
- 10.[[012]]*)
- _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
- 10.*)
- _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
- esac
- ;;
- esac
- if test "$lt_cv_apple_cc_single_mod" = "yes"; then
- _lt_dar_single_mod='$single_module'
- fi
- if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
- _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
- else
- _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}"
- fi
- if test "$DSYMUTIL" != ":"; then
- _lt_dsymutil="~$DSYMUTIL \$lib || :"
- else
- _lt_dsymutil=
- 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_REQUIRE([LT_AC_PROG_SED])dnl
-AC_LINK_IFELSE(AC_LANG_PROGRAM,[
-lt_aix_libpath_sed='
- /Import File Strings/,/^$/ {
- /^0/ {
- s/^0 *\(.*\)$/\1/
- p
- }
- }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# 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 "$lt_aix_libpath_sed"`
-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 <<EOF
-[$]*
-EOF
- exit 0
-fi
-
-# 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 -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-*kfreebsd*-gnu|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-*kfreebsd*-gnu)
- LD="${LD-ld} -m elf_i386_fbsd"
- ;;
- 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-*kfreebsd*-gnu)
- LD="${LD-ld} -m elf_x86_64_fbsd"
- ;;
- 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
- ;;
-sparc*-*solaris*)
- # 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
- *64-bit*)
- case $lt_cv_prog_gnu_ld in
- yes*) LD="${LD-ld} -m elf64_sparc" ;;
- *)
- if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
- LD="${LD-ld} -64"
- fi
- ;;
- esac
- ;;
- esac
- fi
- rm -rf conftest*
- ;;
-
-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])
- echo "$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}\{0,1\} :&$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 -e '/^$/d' >conftest.exp
- $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
- if test ! -s conftest.er2 || 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_REQUIRE([LT_AC_PROG_SED])dnl
-AC_CACHE_CHECK([$1], [$2],
- [$2=no
- save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS $3"
- echo "$lt_simple_link_test_code" > conftest.$ac_ext
- if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
- # The linker 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 -e '/^$/d' > conftest.exp
- $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
- if diff conftest.exp conftest.er2 >/dev/null; then
- $2=yes
- fi
- else
- $2=yes
- fi
- fi
- $rm -r 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 all BSDs
- 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`
- ;;
-
- interix*)
- # We know the value 262144 and hardcode it with a safety zone (like BSD)
- lt_cv_sys_max_cmd_len=196608
- ;;
-
- 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
- ;;
- sco3.2v5*)
- lt_cv_sys_max_cmd_len=102400
- ;;
- sysv5* | sco5v6* | sysv4.2uw2*)
- kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
- if test -n "$kargmax"; then
- lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
- else
- lt_cv_sys_max_cmd_len=32768
- fi
- ;;
- *)
- lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
- if test -n "$lt_cv_sys_max_cmd_len"; then
- 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`
- else
- 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`
- fi
- ;;
- 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 <<EOF
-[#line __oline__ "configure"
-#include "confdefs.h"
-
-#if HAVE_DLFCN_H
-#include <dlfcn.h>
-#endif
-
-#include <stdio.h>
-
-#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); */
- }
- else
- puts (dlerror ());
-
- exit (status);
-}]
-EOF
- if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
- (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
- lt_status=$?
- case x$lt_status in
- x$lt_dlno_uscore) $1 ;;
- x$lt_dlneed_uscore) $2 ;;
- x$lt_dlunknown|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="-ldld"],
- [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="-ldld"])
- ])
- ])
- ])
- ])
- ])
- ;;
- 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"
- wl=$lt_prog_compiler_wl 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
- wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
- 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_PROG_SED])dnl
-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
- echo "$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}\{0,1\} :&$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 -e '/^$/d' > out/conftest.exp
- $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
- if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
- _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+dnl This file is free software; as a special exception the author gives
+dnl unlimited permission to copy and/or distribute it, with or without
+dnl modifications, as long as this notice is preserved.
+dnl
+dnl This file is distributed in the hope that it will be useful, but
+dnl WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
+dnl implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+
+dnl AM_PATH_LIBGCRYPT([MINIMUM-VERSION,
+dnl [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND ]]])
+dnl Test for libgcrypt and define LIBGCRYPT_CFLAGS and LIBGCRYPT_LIBS.
+dnl MINIMUN-VERSION is a string with the version number optionalliy prefixed
+dnl with the API version to also check the API compatibility. Example:
+dnl a MINIMUN-VERSION of 1:1.2.5 won't pass the test unless the installed
+dnl version of libgcrypt is at least 1.2.5 *and* the API number is 1. Using
+dnl this features allows to prevent build against newer versions of libgcrypt
+dnl with a changed API.
+dnl
+AC_DEFUN([AM_PATH_LIBGCRYPT],
+[ AC_ARG_WITH(libgcrypt-prefix,
+ AC_HELP_STRING([--with-libgcrypt-prefix=PFX],
+ [prefix where LIBGCRYPT is installed (optional)]),
+ libgcrypt_config_prefix="$withval", libgcrypt_config_prefix="")
+ if test x$libgcrypt_config_prefix != x ; then
+ if test x${LIBGCRYPT_CONFIG+set} != xset ; then
+ LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config
fi
- fi
- chmod u+w . 2>&AS_MESSAGE_LOG_FD
- $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"
- old_striplib="$STRIP -S"
- 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_REQUIRE([LT_AC_PROG_SED])dnl
-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"
-m4_if($1,[],[
-if test "$GCC" = yes; then
- case $host_os in
- darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
- *) lt_awk_arg="/^libraries:/" ;;
- esac
- lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
- if echo "$lt_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.
- lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'`
- else
- lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
- fi
- # Ok, now we have the path, separated by spaces, we can step through it
- # and add multilib dir if necessary.
- lt_tmp_lt_search_path_spec=
- lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
- for lt_sys_path in $lt_search_path_spec; do
- if test -d "$lt_sys_path/$lt_multi_os_dir"; then
- lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
- else
- test -d "$lt_sys_path" && \
- lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
- fi
- done
- lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk '
-BEGIN {RS=" "; FS="/|\n";} {
- lt_foo="";
- lt_count=0;
- for (lt_i = NF; lt_i > 0; lt_i--) {
- if ($lt_i != "" && $lt_i != ".") {
- if ($lt_i == "..") {
- lt_count++;
- } else {
- if (lt_count == 0) {
- lt_foo="/" $lt_i lt_foo;
- } else {
- lt_count--;
- }
- }
- }
- }
- if (lt_foo != "") { lt_freq[[lt_foo]]++; }
- if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
-}'`
- sys_lib_search_path_spec=`echo $lt_search_path_spec`
-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'
- ;;
-
-aix[[4-9]]*)
- 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<name>.so
- # instead of lib<name>.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~
- chmod a+x \$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`'
- m4_if([$1], [],[
- sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
- 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* | dragonfly*)
- # DragonFly does not have aout. When/if they implement a new
- # versioning mechanism, adjust this.
- if test -x /usr/bin/objformat; then
- objformat=`/usr/bin/objformat`
- else
- case $host_os in
- freebsd[[123]]*) objformat=aout ;;
- *) objformat=elf ;;
- esac
- fi
- 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
- ;;
- freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
- freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
- shlibpath_overrides_runpath=no
- hardcode_into_libs=yes
- ;;
- *) # from 4.6 on, and DragonFly
- shlibpath_overrides_runpath=yes
- 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'
- ;;
-
-interix[[3-9]]*)
- version_type=linux
- need_lib_prefix=no
- need_version=no
- 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='Interix 3.x ld.so.1 (PE, like ELF)'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=no
- hardcode_into_libs=yes
- ;;
-
-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* | k*bsd*-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'
- 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>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;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'
- ;;
-
-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'
+ AC_PATH_PROG(LIBGCRYPT_CONFIG, libgcrypt-config, no)
+ tmp=ifelse([$1], ,1:1.2.0,$1)
+ if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
+ req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
+ min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
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'
+ req_libgcrypt_api=0
+ min_libgcrypt_version="$tmp"
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
- sys_lib_dlsearch_path_spec="/usr/lib"
- 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"
- ;;
-
-rdos*)
- dynamic_linker=no
- ;;
-
-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.3*)
- 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
- ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
- version_type=freebsd-elf
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LD_LIBRARY_PATH
- hardcode_into_libs=yes
- if test "$with_gnu_ld" = yes; then
- sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
- shlibpath_overrides_runpath=no
- else
- sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
- shlibpath_overrides_runpath=yes
- case $host_os in
- sco3.2v5*)
- sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
- ;;
- esac
- fi
- sys_lib_dlsearch_path_spec='/usr/lib'
- ;;
-
-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_CACHE_VAL([lt_cv_sys_lib_search_path_spec],
-[lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"])
-sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-AC_CACHE_VAL([lt_cv_sys_lib_dlsearch_path_spec],
-[lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"])
-sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-
-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_SYS_DYNAMIC_LINKER
-
-
-# _LT_AC_TAGCONFIG
-# ----------------
-AC_DEFUN([_LT_AC_TAGCONFIG],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-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
- if test -z "$LTCFLAGS"; then
- eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
- 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 DLLs
-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 recognize 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 <<EOF 1>&2
-
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such. This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem. Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool@gnu.org
-
-EOF
- fi ;;
- esac
- fi
- break
- fi
- done
- IFS="$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 recognize 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 variants of GNU ld only accept -v.
- # Break only if it was the GNU/non-GNU ld that we prefer.
- case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
- *GNU* | *'with BFD'*)
- test "$with_gnu_ld" != no && break
- ;;
- *)
- test "$with_gnu_ld" != yes && break
- ;;
- esac
- fi
- done
- IFS="$lt_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
-
-
-# AC_PROG_LD_GNU
-# --------------
-AC_DEFUN([AC_PROG_LD_GNU],
-[AC_REQUIRE([AC_PROG_EGREP])dnl
-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 lds only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
- lt_cv_prog_gnu_ld=yes
- ;;
-*)
- lt_cv_prog_gnu_ld=no
- ;;
-esac])
-with_gnu_ld=$lt_cv_prog_gnu_ld
-])# AC_PROG_LD_GNU
-
-
-# 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
-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='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
- else
- reload_cmds='$LD$reload_flag -o $output$reload_objs'
- fi
- ;;
-esac
-])# AC_PROG_LD_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 recognize 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 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
-aix[[4-9]]*)
- 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',
- # unless we find 'file', for example because we are cross-compiling.
- if ( file / ) >/dev/null 2>&1; then
- lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
- lt_cv_file_magic_cmd='func_win32_libid'
- else
- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
- lt_cv_file_magic_cmd='$OBJDUMP -f'
- fi
- ;;
-
-darwin* | rhapsody*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-freebsd* | 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
- ;;
-
-interix[[3-9]]*)
- # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
- lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
- ;;
-
-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* | k*bsd*-gnu)
- 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
- ;;
-
-rdos*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-solaris*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-sysv4 | sysv4.3*)
- 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
- ;;
- pc)
- lt_cv_deplibs_check_method=pass_all
- ;;
- esac
- ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | 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_nm_to_check="${ac_tool_prefix}nm"
- if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
- lt_nm_to_check="$lt_nm_to_check nm"
- fi
- for lt_tmp_nm in $lt_nm_to_check; do
- lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
- for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
- IFS="$lt_save_ifs"
- test -z "$ac_dir" && ac_dir=.
- tmp_nm="$ac_dir/$lt_tmp_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"
- done
- 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
-# AC_CONFIG_SUBDIRS is not called here. 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
-# AC_CONFIG_SUBDIRS is not called here. 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 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;"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='int main(){return(0);}'
-
-_LT_AC_SYS_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-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
-
-# Report which library types will 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
- ;;
-
-aix[[4-9]]*)
- 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_shlibpath_var, $1)=unsupported
-_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)=
-_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
-
-# Source file extension for C++ test sources.
-ac_ext=cpp
-
-# 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;"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
-
-# 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
- $as_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
- $as_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
- ;;
- aix[[4-9]]*)
- 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]].*|aix[[5-9]]*)
- 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
- :
- 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 '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${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 '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_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'
- # Exported symbols can be pulled into shared objects from archives
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
- # This is similar to how AIX traditionally builds its shared libraries.
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
- fi
- fi
- ;;
-
- beos*)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
- # Joseph Beckenbach <jrb3@best.com> 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
- ;;
-
- 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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
- else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
- darwin* | rhapsody*)
- _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
- _LT_AC_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
- if test "$GXX" = 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_dar_single_mod${_lt_dsymutil}"
- _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
- _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
- if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- _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${_lt_dsymutil}"
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed '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${_lt_dar_export_syms}${_lt_dsymutil}"
- fi
- 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` $xlcverstring'
- _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 lds
- _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 $xlcverstring~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* | 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
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
- case $host_cpu in
- hppa*64*|ia64*) ;;
- *)
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
- ;;
- esac
- fi
- case $host_cpu in
- hppa*64*|ia64*)
- _LT_AC_TAGVAR(hardcode_direct, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- ;;
- *)
- _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*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- ia64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- *)
- _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
- hppa*64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- ia64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- *)
- _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
- ;;
- interix[[3-9]]*)
- _LT_AC_TAGVAR(hardcode_direct, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
- # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
- # Instead, shared libraries are loaded at an image base (0x10000000 by
- # default) and relocated if they conflict, which is a slow very memory
- # consuming and fragmenting process. To avoid this, we pick a random,
- # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
- # time. Moving up from 0x10000000 also allows more sbrk(2) space.
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- ;;
- 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* | k*bsd*-gnu)
- 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* | pgcpp*)
- # 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'
- ;;
- *)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- # Sun C++ 5.9
- _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-
- # Not sure whether something based on
- # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
- # would be better.
- output_verbose_link_cmd='echo'
-
- # 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'
- ;;
- esac
- ;;
- 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*)
- if test -f /usr/libexec/ld.so; then
- _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'
- else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
- 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
- ;;
- 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(archive_cmds_need_lc,$1)=yes
- _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -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} ${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 compiler driver will combine and reorder linker options,
- # but understands `-z linker_flag'.
- # 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
-
- output_verbose_link_cmd='echo'
-
- # 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'
- case $host_os in
- solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
- *)
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
- ;;
- esac
- fi
- ;;
- esac
- ;;
- sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
- _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- runpath_var='LD_RUN_PATH'
-
- case $cc_basename in
- CC*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- *)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- esac
- ;;
- sysv5* | sco3.2v5* | sco5v6*)
- # Note: We can NOT use -z defs as we might desire, because we do not
- # link with -lc, and that would cause any symbols used from libc to
- # always be unresolved, which means just about no library would
- # ever link correctly. If we're not using GNU ld we use -z text
- # though, which does catch some bad symbols but isn't as heavy-handed
- # as -z defs.
- # For security reasons, it is highly recommended that you always
- # use absolute paths for naming shared libraries, and exclude the
- # DT_RUNPATH tag from executables and libraries. But doing so
- # requires that you compile everything twice, which is a pain.
- # So that behaviour is only enabled if SCOABSPATH is set to a
- # non-empty value in the environment. Most likely only useful for
- # creating official distributions of packages.
- # This is a hack until libtool officially supports absolute path
- # names for shared libraries.
- _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
- _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
- runpath_var='LD_RUN_PATH'
-
- case $cc_basename in
- CC*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- *)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- esac
- ;;
- 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_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],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-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 <<EOF
-int a;
-void foo (void) { a = 0; }
-EOF
-],[$1],[CXX],[cat > conftest.$ac_ext <<EOF
-class Foo
-{
-public:
- Foo (void) { a = 0; }
-private:
- int a;
-};
-EOF
-],[$1],[F77],[cat > conftest.$ac_ext <<EOF
- subroutine foo
- implicit none
- integer*4 a
- a=0
- return
- end
-EOF
-],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF
-public class foo {
- private int a;
- public void bar (void) {
- a = 0;
- }
-};
-EOF
-])
-dnl Parse the compiler output and extract the necessary
-dnl objects, libraries and library flags.
-if AC_TRY_EVAL(ac_compile); 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 "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
- _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
- else
- _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${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 "$_LT_AC_TAGVAR(postdeps, $1)"; then
- _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}"
- else
- _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${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 "$_LT_AC_TAGVAR(predep_objects, $1)"; then
- _LT_AC_TAGVAR(predep_objects, $1)="$p"
- else
- _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p"
- fi
- else
- if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then
- _LT_AC_TAGVAR(postdep_objects, $1)="$p"
- else
- _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p"
- fi
- fi
- ;;
-
- *) ;; # Ignore the rest.
-
- esac
- done
-
- # Clean up.
- rm -f a.out a.exe
-else
- echo "libtool.m4: error: problem compiling $1 test program"
-fi
-
-$rm -f confest.$objext
-
-_LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=
-if test -n "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
- _LT_AC_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_AC_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
-fi
-
-# PORTME: override above test on systems where it is broken
-ifelse([$1],[CXX],
-[case $host_os in
-interix[[3-9]]*)
- # Interix 3.5 installs completely hosed .la files for C++, so rather than
- # hack all around it, let's just trust "g++" to DTRT.
- _LT_AC_TAGVAR(predep_objects,$1)=
- _LT_AC_TAGVAR(postdep_objects,$1)=
- _LT_AC_TAGVAR(postdeps,$1)=
- ;;
-
-linux*)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- # Sun C++ 5.9
- #
- # The more standards-conforming stlport4 library is
- # incompatible with the Cstd library. Avoid specifying
- # it if it's in CXXFLAGS. Ignore libCrun as
- # -library=stlport4 depends on it.
- case " $CXX $CXXFLAGS " in
- *" -library=stlport4 "*)
- solaris_use_stlport4=yes
- ;;
- esac
- if test "$solaris_use_stlport4" != yes; then
- _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
- fi
- ;;
- esac
- ;;
-
-solaris*)
- case $cc_basename in
- CC*)
- # The more standards-conforming stlport4 library is
- # incompatible with the Cstd library. Avoid specifying
- # it if it's in CXXFLAGS. Ignore libCrun as
- # -library=stlport4 depends on it.
- case " $CXX $CXXFLAGS " in
- *" -library=stlport4 "*)
- solaris_use_stlport4=yes
- ;;
- esac
-
- # Adding this requires a known-good setup of shared libraries for
- # Sun compiler versions before 5.6, else PIC objects from an old
- # archive will be linked into the output, leading to subtle bugs.
- if test "$solaris_use_stlport4" != yes; then
- _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
- fi
- ;;
- esac
- ;;
-esac
-])
-case " $_LT_AC_TAGVAR(postdeps, $1) " in
-*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
-esac
-])# AC_LIBTOOL_POSTDEP_PREDEP
-
-# AC_LIBTOOL_LANG_F77_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_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)])
-AC_DEFUN([_LT_AC_LANG_F77_CONFIG],
-[AC_REQUIRE([AC_PROG_F77])
-AC_LANG_PUSH(Fortran 77)
-
-_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
-
-# Source file extension for f77 test sources.
-ac_ext=f
-
-# Object file extension for compiled f77 test sources.
-objext=o
-_LT_AC_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="\
- subroutine t
- return
- end
-"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code="\
- program t
- end
-"
-
-# 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])
-
-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
- ;;
-aix[[4-9]]*)
- 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])
-
-_LT_AC_TAGVAR(GCC, $1)="$G77"
-_LT_AC_TAGVAR(LD, $1)="$LD"
-
-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_CONFIG($1)
-
-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 {}"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
-
-# 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_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 }'
-
-# 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
- # 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 LTCFLAGS 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 \
- _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(compiler_lib_search_dirs, $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(fix_srcfile_path, $1) \
- _LT_AC_TAGVAR(exclude_expsyms, $1) \
- _LT_AC_TAGVAR(include_expsyms, $1); 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 | \
- 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
-
-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, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
-# Free Software Foundation, Inc.
-#
-# This file is part of GNU Libtool:
-# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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., 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 program that does not truncate output.
-SED=$lt_SED
-
-# Sed that helps us avoid accidentally triggering echo(1) options like -n.
-Xsed="$SED -e 1s/^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
-
-# LTCC compiler flags.
-LTCFLAGS=$lt_LTCFLAGS
-
-# 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="$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 directories searched by this compiler when creating a shared
-# library
-compiler_lib_search_dirs=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_dirs, $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_fix_srcfile_path
-
-# 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([LT_AC_PROG_SED])
-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* | k*bsd*-gnu)
- 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*)
- symcode='[[BDRT]]'
- ;;
-sco3.2v5*)
- symcode='[[DT]]'
- ;;
-sysv4.2uw2*)
- symcode='[[DT]]'
- ;;
-sysv5* | sco5v6* | unixware* | OpenUNIX*)
- symcode='[[ABDT]]'
- ;;
-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 <<EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func();return(0);}
-EOF
-
- if AC_TRY_EVAL(ac_compile); then
- # Now try to grab the symbols.
- nlist=conftest.nm
- if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $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 <<EOF > 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 <<EOF >> 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
+ AC_MSG_CHECKING(for LIBGCRYPT - version >= $min_libgcrypt_version)
+ ok=no
+ if test "$LIBGCRYPT_CONFIG" != "no" ; then
+ req_major=`echo $min_libgcrypt_version | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\1/'`
+ req_minor=`echo $min_libgcrypt_version | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\2/'`
+ req_micro=`echo $min_libgcrypt_version | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\)/\3/'`
+ libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
+ major=`echo $libgcrypt_config_version | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\1/'`
+ minor=`echo $libgcrypt_config_version | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\2/'`
+ micro=`echo $libgcrypt_config_version | \
+ sed 's/\([[0-9]]*\)\.\([[0-9]]*\)\.\([[0-9]]*\).*/\3/'`
+ if test "$major" -gt "$req_major"; then
+ ok=yes
+ else
+ if test "$major" -eq "$req_major"; then
+ if test "$minor" -gt "$req_minor"; then
+ ok=yes
+ else
+ if test "$minor" -eq "$req_minor"; then
+ if test "$micro" -ge "$req_micro"; then
+ ok=yes
+ fi
+ fi
+ fi
+ fi
fi
- else
- echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
- cat conftest.$ac_ext >&5
- fi
- rm -rf 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* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
- # PIC is the default for these OSes.
- ;;
- mingw* | cygwin* | 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).
- # Although the cygwin gcc ignores -fPIC, still need this for old-style
- # (--disable-auto-import) libraries
- m4_if([$1], [GCJ], [],
- [_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)=
- ;;
- interix[[3-9]]*)
- # Interix 3.x gcc -fpic/-fPIC options generate broken code.
- # Instead, we relocate shared libraries at runtime.
- ;;
- 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
- aix[[4-9]]*)
- # 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* | 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)='${wl}-a ${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)='${wl}-a ${wl}archive'
- case $host_cpu in
- hppa*64*|ia64*)
- # +Z the default
- ;;
- *)
- _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
- ;;
- esac
- ;;
- *)
- ;;
- esac
- ;;
- interix*)
- # This is c89, which is MS Visual C++ (no shared libs)
- # Anyone wants to do a port?
- ;;
- 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* | k*bsd*-gnu)
- 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* | pgcpp*)
- # 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)='-Bstatic'
- ;;
- 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'
- ;;
- *)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- # Sun C++ 5.9
- _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 '
- ;;
- esac
- ;;
- 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*)
- ;;
- 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
- ;;
- sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
- case $cc_basename in
- CC*)
- _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'
- ;;
- esac
- ;;
- 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* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
- # PIC is the default for these OSes.
- ;;
-
- mingw* | cygwin* | 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).
- # Although the cygwin gcc ignores -fPIC, still need this for old-style
- # (--disable-auto-import) libraries
- m4_if([$1], [GCJ], [],
- [_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'
- ;;
-
- interix[[3-9]]*)
- # Interix 3.x gcc -fpic/-fPIC options generate broken code.
- # Instead, we relocate shared libraries at runtime.
- ;;
-
- 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
+ if test $ok = yes; then
+ AC_MSG_RESULT([yes ($libgcrypt_config_version)])
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* | cygwin* | 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).
- m4_if([$1], [GCJ], [],
- [_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* | k*bsd*-gnu)
- 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* | pgf95*)
- # 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)='-Bstatic'
- ;;
- 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'
- ;;
- *)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- # Sun C 5.9
- _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)='-Wl,'
- ;;
- *Sun\ F*)
- # Sun Fortran 8.3 passes all unrecognized flags to the linker
- _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)=''
- ;;
- esac
- ;;
- 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'
- ;;
-
- rdos*)
- _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
- ;;
-
- 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*)
- _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
- ;;
-
- sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
- _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'
- ;;
-
- 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
+ AC_MSG_RESULT(no)
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_cv_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
-
-#
-# Check to make sure the static flag actually works.
-#
-wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
-AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
- _LT_AC_TAGVAR(lt_cv_prog_compiler_static_works, $1),
- $lt_tmp_static_flag,
- [],
- [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
-])
-
-
-# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME])
-# ------------------------------------
-# See if the linker supports building shared libraries.
-AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
-[AC_REQUIRE([LT_AC_PROG_SED])dnl
-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
- aix[[4-9]]*)
- # 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
- _LT_AC_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
-],[
- 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_|_GLOBAL__F[ID]_.*']
- # 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.
- # Exclude shared library initialization/finalization symbols.
-dnl Note also adjust exclude_expsyms for C++ above.
- 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
- ;;
- interix*)
- # we just hope/assume this is gcc and not c89 (= MSVC++)
- with_gnu_ld=yes
- ;;
- 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
- aix[[3-9]]*)
- # On AIX/PPC, the GNU linker is very broken
- if test "$host_cpu" != ia64; then
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- cat <<EOF 1>&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 <kc5tja@dolphin.openprojects.net> 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 <jrb3@best.com> 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/'\'' -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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
- else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
-
- interix[[3-9]]*)
- _LT_AC_TAGVAR(hardcode_direct, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
- # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
- # Instead, shared libraries are loaded at an image base (0x10000000 by
- # default) and relocated if they conflict, which is a slow very memory
- # consuming and fragmenting process. To avoid this, we pick a random,
- # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
- # time. Moving up from 0x10000000 also allows more sbrk(2) space.
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- ;;
-
- gnu* | linux* | k*bsd*-gnu)
- 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* | pgf95*) # 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
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*) # Sun C 5.9
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
- tmp_sharedflag='-G' ;;
- *Sun\ F*) # Sun Fortran 8.3
- tmp_sharedflag='-G' ;;
- *)
- tmp_sharedflag='-shared' ;;
- esac
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$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 '"$tmp_sharedflag""$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*)
- if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- cat <<EOF 1>&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
- ;;
-
- sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
- case `$LD -v 2>&1` in
- *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- cat <<_LT_EOF 1>&2
-
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
-*** reliably create shared libraries on SCO systems. Therefore, libtool
-*** is disabling shared libraries support. We urge you to upgrade GNU
-*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-_LT_EOF
- ;;
- *)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
- else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
- esac
- ;;
-
- 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 "$lt_prog_compiler_static"; then
- # Neither direct hardcoding nor static linking is supported with a
- # broken collect2.
- _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
- fi
- ;;
-
- aix[[4-9]]*)
- 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]].*|aix[[5-9]]*)
- 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
- :
- 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 '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${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 '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_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'
- # Exported symbols can be pulled into shared objects from archives
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
- # This is similar to how AIX traditionally builds its shared libraries.
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${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_dar_single_mod${_lt_dsymutil}"
- _LT_AC_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
- _LT_AC_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
- 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` $xlcverstring'
- _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 lds
- _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 $xlcverstring~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* | 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*)
- if test "$GCC" = yes -a "$with_gnu_ld" = no; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
- else
- _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
- fi
- if test "$with_gnu_ld" = no; then
- _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
- fi
- ;;
-
- hpux11*)
- if test "$GCC" = yes -a "$with_gnu_ld" = no; then
- case $host_cpu in
- hppa*64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- ia64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -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*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- ia64*)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- *)
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- esac
- fi
- if test "$with_gnu_ld" = no; then
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
-
- case $host_cpu in
- hppa*64*|ia64*)
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
- _LT_AC_TAGVAR(hardcode_direct, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- ;;
- *)
- _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*)
- if test -f /usr/libexec/ld.so; then
- _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
+ if test $ok = yes; then
+ # If we have a recent libgcrypt, we should also check that the
+ # API is compatible
+ if test "$req_libgcrypt_api" -gt 0 ; then
+ tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
+ if test "$tmp" -gt 0 ; then
+ AC_MSG_CHECKING([LIBGCRYPT API version])
+ if test "$req_libgcrypt_api" -eq "$tmp" ; then
+ AC_MSG_RESULT([okay])
+ else
+ ok=no
+ AC_MSG_RESULT([does not match. want=$req_libgcrypt_api got=$tmp])
+ fi
fi
- else
- _LT_AC_TAGVAR(ld_shlibs, $1)=no
- 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)=:
- ;;
-
- 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 and reorder linker options,
- # but understands `-z linker_flag'. GCC discards it without `$wl',
- # but is careful enough not to reorder.
- # Supported since Solaris 2.6 (maybe 2.5.1?)
- if test "$GCC" = yes; then
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
- else
- _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
- fi
- ;;
- 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*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
- _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- runpath_var='LD_RUN_PATH'
-
- if test "$GCC" = yes; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- else
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- fi
- ;;
-
- sysv5* | sco3.2v5* | sco5v6*)
- # Note: We can NOT use -z defs as we might desire, because we do not
- # link with -lc, and that would cause any symbols used from libc to
- # always be unresolved, which means just about no library would
- # ever link correctly. If we're not using GNU ld we use -z text
- # though, which does catch some bad symbols but isn't as heavy-handed
- # as -z defs.
- _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
- _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
- _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
- _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
- _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
- runpath_var='LD_RUN_PATH'
-
- if test "$GCC" = yes; then
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- else
- _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- fi
- ;;
-
- 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
-
-#
-# 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*
- echo "$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)
- pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $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
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 <windows.h>
-# #undef WIN32_LEAN_AND_MEAN
-# #include <stdio.h>
-#
-# #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 <cygwin/cygwin_dll.h>
-# 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)
-])
-
-
-# Cheap backport of AS_EXECUTABLE_P and required macros
-# from Autoconf 2.59; we should not use $as_executable_p directly.
-
-# _AS_TEST_PREPARE
-# ----------------
-m4_ifndef([_AS_TEST_PREPARE],
-[m4_defun([_AS_TEST_PREPARE],
-[if test -x / >/dev/null 2>&1; then
- as_executable_p='test -x'
-else
- as_executable_p='test -f'
-fi
-])])# _AS_TEST_PREPARE
-
-# AS_EXECUTABLE_P
-# ---------------
-# Check whether a file is executable.
-m4_ifndef([AS_EXECUTABLE_P],
-[m4_defun([AS_EXECUTABLE_P],
-[AS_REQUIRE([_AS_TEST_PREPARE])dnl
-$as_executable_p $1[]dnl
-])])# AS_EXECUTABLE_P
-
-# 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
-IFS=$as_save_IFS
-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
+ if test $ok = yes; then
+ LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
+ LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
+ ifelse([$2], , :, [$2])
+ else
+ LIBGCRYPT_CFLAGS=""
+ LIBGCRYPT_LIBS=""
+ ifelse([$3], , :, [$3])
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_SUBST([SED])
-AC_MSG_RESULT([$SED])
+ AC_SUBST(LIBGCRYPT_CFLAGS)
+ AC_SUBST(LIBGCRYPT_LIBS)
])
# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*-
+# serial 1 (pkg-config-0.24)
#
# Copyright © 2004 Scott James Remnant <scott@netsplit.com>.
#
@@ -6683,7 +157,10 @@ AC_MSG_RESULT([$SED])
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
+AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])
+AC_ARG_VAR([PKG_CONFIG_PATH], [directories to add to pkg-config's search path])
+AC_ARG_VAR([PKG_CONFIG_LIBDIR], [path overriding pkg-config's built-in search path])
+
if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then
AC_PATH_TOOL([PKG_CONFIG], [pkg-config])
fi
@@ -6696,7 +173,6 @@ if test -n "$PKG_CONFIG"; then
AC_MSG_RESULT([no])
PKG_CONFIG=""
fi
-
fi[]dnl
])# PKG_PROG_PKG_CONFIG
@@ -6705,21 +181,20 @@ fi[]dnl
# Check to see whether a particular set of modules exists. Similar
# to PKG_CHECK_MODULES(), but does not set variables or print errors.
#
-#
-# Similar to PKG_CHECK_MODULES, make sure that the first instance of
-# this or PKG_CHECK_MODULES is called, or make sure to call
-# PKG_CHECK_EXISTS manually
+# Please remember that m4 expands AC_REQUIRE([PKG_PROG_PKG_CONFIG])
+# only at the first occurence in configure.ac, so if the first place
+# it's called might be skipped (such as if it is within an "if", you
+# have to call PKG_CHECK_EXISTS manually
# --------------------------------------------------------------
AC_DEFUN([PKG_CHECK_EXISTS],
[AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl
if test -n "$PKG_CONFIG" && \
AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then
- m4_ifval([$2], [$2], [:])
+ m4_default([$2], [:])
m4_ifvaln([$3], [else
$3])dnl
fi])
-
# _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES])
# ---------------------------------------------
m4_define([_PKG_CONFIG],
@@ -6772,6 +247,7 @@ and $1[]_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.])
if test $pkg_failed = yes; then
+ AC_MSG_RESULT([no])
_PKG_SHORT_ERRORS_SUPPORTED
if test $_pkg_short_errors_supported = yes; then
$1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1`
@@ -6781,7 +257,7 @@ if test $pkg_failed = yes; then
# Put the nasty error message in config.log where it belongs
echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD
- ifelse([$4], , [AC_MSG_ERROR(dnl
+ m4_default([$4], [AC_MSG_ERROR(
[Package requirements ($2) were not met:
$$1_PKG_ERRORS
@@ -6789,29 +265,28 @@ $$1_PKG_ERRORS
Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.
-_PKG_TEXT
-])],
- [AC_MSG_RESULT([no])
- $4])
+_PKG_TEXT])[]dnl
+ ])
elif test $pkg_failed = untried; then
- ifelse([$4], , [AC_MSG_FAILURE(dnl
+ AC_MSG_RESULT([no])
+ m4_default([$4], [AC_MSG_FAILURE(
[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.
_PKG_TEXT
-To get pkg-config, see <http://pkg-config.freedesktop.org/>.])],
- [$4])
+To get pkg-config, see <http://pkg-config.freedesktop.org/>.])[]dnl
+ ])
else
$1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS
$1[]_LIBS=$pkg_cv_[]$1[]_LIBS
AC_MSG_RESULT([yes])
- ifelse([$3], , :, [$3])
+ $3
fi[]dnl
])# PKG_CHECK_MODULES
-# Copyright (C) 2002, 2003, 2005, 2006, 2007 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -6823,10 +298,10 @@ fi[]dnl
# generated from the m4 files accompanying Automake X.Y.
# (This private macro should not be called outside this file.)
AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.10'
+[am__api_version='1.11'
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
dnl require some minimum version. Point them to the right macro.
-m4_if([$1], [1.10.1], [],
+m4_if([$1], [1.11.1], [],
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
])
@@ -6840,12 +315,12 @@ m4_define([_AM_AUTOCONF_VERSION], [])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
-# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
+# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.10.1])dnl
+[AM_AUTOMAKE_VERSION([1.11.1])dnl
m4_ifndef([AC_AUTOCONF_VERSION],
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-_AM_AUTOCONF_VERSION(AC_AUTOCONF_VERSION)])
+_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
# AM_AUX_DIR_EXPAND -*- Autoconf -*-
@@ -6902,14 +377,14 @@ am_aux_dir=`cd $ac_aux_dir && pwd`
# AM_CONDITIONAL -*- Autoconf -*-
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006
+# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
# 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
+# serial 9
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
@@ -6922,6 +397,7 @@ AC_SUBST([$1_TRUE])dnl
AC_SUBST([$1_FALSE])dnl
_AM_SUBST_NOTMAKE([$1_TRUE])dnl
_AM_SUBST_NOTMAKE([$1_FALSE])dnl
+m4_define([_AM_COND_VALUE_$1], [$2])dnl
if $2; then
$1_TRUE=
$1_FALSE='#'
@@ -6935,14 +411,14 @@ AC_CONFIG_COMMANDS_PRE(
Usually this means the macro was only invoked conditionally.]])
fi])])
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009
# 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 9
+# 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,
@@ -6999,6 +475,16 @@ AC_CACHE_CHECK([dependency style of $depcc],
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
fi
+ am__universal=false
+ m4_case([$1], [CC],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac],
+ [CXX],
+ [case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac])
+
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
@@ -7016,7 +502,17 @@ AC_CACHE_CHECK([dependency style of $depcc],
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+ # 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. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
@@ -7026,19 +522,23 @@ AC_CACHE_CHECK([dependency style of $depcc],
break
fi
;;
+ msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
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} \
+ source=sub/conftest.c object=$am__obj \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
- $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
- grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj 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
@@ -7095,57 +595,68 @@ _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl
# Generate code to set up dependency tracking. -*- Autoconf -*-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
+# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008
# 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
+#serial 5
# _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.
- # Grep'ing the whole file is not good either: AIX grep has a line
- # limit of 2048, but all sed's we know have understand at least 4000.
- if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/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"
+[{
+ # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ 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.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/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
-done
+}
])# _AM_OUTPUT_DEPENDENCY_COMMANDS
@@ -7165,13 +676,13 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# Do all the work for Automake. -*- Autoconf -*-
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2008 Free Software Foundation, Inc.
+# 2005, 2006, 2008, 2009 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 13
+# serial 16
# 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.
@@ -7188,7 +699,7 @@ AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
# 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.60])dnl
+[AC_PREREQ([2.62])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
@@ -7239,8 +750,8 @@ 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_INSTALL_SH])dnl
+AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
@@ -7248,24 +759,37 @@ 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([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
+ [_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
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_OBJC],
- [_AM_DEPENDENCIES(OBJC)],
- [define([AC_PROG_OBJC],
- defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+ [_AM_DEPENDENCIES(OBJC)],
+ [define([AC_PROG_OBJC],
+ defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
])
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
+dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
+dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
+dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
+AC_CONFIG_COMMANDS_PRE(dnl
+[m4_provide_if([_AM_COMPILER_EXEEXT],
+ [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
])
+dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
+dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
+dnl mangled by Autoconf and run in a shell conditional statement.
+m4_define([_AC_COMPILER_EXEEXT],
+m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
+
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
@@ -7288,7 +812,7 @@ for _am_header in $config_headers :; do
done
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
-# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc.
#
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
@@ -7299,7 +823,14 @@ echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_co
# Define $install_sh.
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"}
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
AC_SUBST(install_sh)])
# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
@@ -7326,27 +857,38 @@ 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
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008
# 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
+# serial 5
+# AM_MAINTAINER_MODE([DEFAULT-MODE])
+# ----------------------------------
+# Control maintainer-specific portions of Makefiles.
+# Default is to disable them, unless `enable' is passed literally.
+# For symmetry, `disable' may be passed as well. Anyway, the user
+# can override the default with the --enable/--disable switch.
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
+[m4_case(m4_default([$1], [disable]),
+ [enable], [m4_define([am_maintainer_other], [disable])],
+ [disable], [m4_define([am_maintainer_other], [enable])],
+ [m4_define([am_maintainer_other], [enable])
+ m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
+AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles])
+ dnl maintainer-mode's default is 'disable' unless 'enable' is passed
+ AC_ARG_ENABLE([maintainer-mode],
+[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful
(and sometimes confusing) to the casual installer],
- USE_MAINTAINER_MODE=$enableval,
- USE_MAINTAINER_MODE=no)
+ [USE_MAINTAINER_MODE=$enableval],
+ [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
AC_MSG_RESULT([$USE_MAINTAINER_MODE])
- AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
+ AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
MAINT=$MAINTAINER_MODE_TRUE
- AC_SUBST(MAINT)dnl
+ AC_SUBST([MAINT])dnl
]
)
@@ -7354,13 +896,13 @@ 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.
+# Copyright (C) 2001, 2002, 2003, 2005, 2009 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
+# serial 4
# AM_MAKE_INCLUDE()
# -----------------
@@ -7369,7 +911,7 @@ AC_DEFUN([AM_MAKE_INCLUDE],
[am_make=${MAKE-make}
cat > confinc << 'END'
am__doit:
- @echo done
+ @echo this is the am__doit target
.PHONY: am__doit
END
# If we don't find an include directive, just comment out the code.
@@ -7379,24 +921,24 @@ 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
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
# 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
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
fi
AC_SUBST([am__include])
AC_SUBST([am__quote])
@@ -7404,14 +946,14 @@ AC_MSG_RESULT([$_am_result])
rm -f confinc confmf
])
-# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005
+# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008
# 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 5
+# serial 6
# AM_PROG_CC_C_O
# --------------
@@ -7423,8 +965,9 @@ AC_REQUIRE_AUX_FILE([compile])dnl
# FIXME: we rely on the cache variable name because
# there is no other way.
set dummy $CC
-ac_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
-if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
+am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']`
+eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
+if test "$am_t" != yes; then
# Losing compiler, so override with the script.
# FIXME: It is wrong to rewrite CC.
# But if we don't then we get into trouble of one sort or another.
@@ -7440,14 +983,14 @@ m4_define([AC_PROG_CC],
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005
+# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
# 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 5
+# serial 6
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
@@ -7464,7 +1007,14 @@ AC_SUBST($1)])
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
AC_REQUIRE_AUX_FILE([missing])dnl
-test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
@@ -7502,13 +1052,13 @@ esac
# Helper functions for option handling. -*- Autoconf -*-
-# Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2003, 2005, 2008 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
+# serial 4
# _AM_MANGLE_OPTION(NAME)
# -----------------------
@@ -7525,7 +1075,7 @@ AC_DEFUN([_AM_SET_OPTION],
# ----------------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
-[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
@@ -7535,14 +1085,14 @@ AC_DEFUN([_AM_IF_OPTION],
# Check to make sure that the build environment is sane. -*- Autoconf -*-
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
# 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
+# serial 5
# AM_SANITY_CHECK
# ---------------
@@ -7551,16 +1101,29 @@ AC_DEFUN([AM_SANITY_CHECK],
# Just in case
sleep 1
echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[[\\\"\#\$\&\'\`$am_lf]]*)
+ AC_MSG_ERROR([unsafe absolute working directory name]);;
+esac
+case $srcdir in
+ *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
+ AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
+esac
+
# 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`
+ 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`
+ set X `ls -t "$srcdir/configure" conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
@@ -7613,18 +1176,25 @@ fi
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
-# Copyright (C) 2006 Free Software Foundation, Inc.
+# Copyright (C) 2006, 2008 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_SUBST_NOTMAKE(VARIABLE)
# ---------------------------
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
# This macro is traced by Automake.
AC_DEFUN([_AM_SUBST_NOTMAKE])
+# AM_SUBST_NOTMAKE(VARIABLE)
+# ---------------------------
+# Public sister of _AM_SUBST_NOTMAKE.
+AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
+
# Check how to create a tarball. -*- Autoconf -*-
# Copyright (C) 2004, 2005 Free Software Foundation, Inc.
@@ -7721,3 +1291,8 @@ AC_SUBST([am__tar])
AC_SUBST([am__untar])
]) # _AM_PROG_TAR
+m4_include([m4/libtool.m4])
+m4_include([m4/ltoptions.m4])
+m4_include([m4/ltsugar.m4])
+m4_include([m4/ltversion.m4])
+m4_include([m4/lt~obsolete.m4])
diff --git a/compile b/compile
index 1b1d232..c0096a7 100755
--- a/compile
+++ b/compile
@@ -1,9 +1,10 @@
#! /bin/sh
# Wrapper for compilers which do not understand `-c -o'.
-scriptversion=2005-05-14.22
+scriptversion=2009-10-06.20; # UTC
-# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software
+# Foundation, Inc.
# Written by Tom Tromey <tromey@cygnus.com>.
#
# This program is free software; you can redistribute it and/or modify
@@ -17,8 +18,7 @@ scriptversion=2005-05-14.22
# 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -103,13 +103,13 @@ if test -z "$ofile" || test -z "$cfile"; then
fi
# Name of file we expect compiler to create.
-cofile=`echo "$cfile" | sed -e 's|^.*/||' -e 's/\.c$/.o/'`
+cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'`
# Create the lock directory.
-# Note: use `[/.-]' here to ensure that we don't use the same name
+# 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
break
@@ -124,9 +124,9 @@ trap "rmdir '$lockdir'; exit 1" 1 2 15
ret=$?
if test -f "$cofile"; then
- mv "$cofile" "$ofile"
+ test "$cofile" = "$ofile" || mv "$cofile" "$ofile"
elif test -f "${cofile}bj"; then
- mv "${cofile}bj" "$ofile"
+ test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile"
fi
rmdir "$lockdir"
@@ -138,5 +138,6 @@ exit $ret
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
# End:
diff --git a/config.guess b/config.guess
index e6b5d5b..c2246a4 100755
--- a/config.guess
+++ b/config.guess
@@ -1,10 +1,10 @@
#! /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, 2006, 2007, 2008
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
-timestamp='2008-01-08'
+timestamp='2009-12-30'
# 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
@@ -27,16 +27,16 @@ timestamp='2008-01-08'
# the same distribution terms that you use for the rest of that program.
-# Originally written by Per Bothner <per@bothner.com>.
-# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
+# Originally written by Per Bothner. Please send patches (context
+# diff format) to <config-patches@gnu.org> and include a 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.
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
me=`echo "$0" | sed -e 's,.*/,,'`
@@ -56,8 +56,9 @@ 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, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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."
@@ -139,16 +140,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
@@ -180,7 +171,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 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
+ | grep -q __ELF__
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
@@ -334,14 +325,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7; exit ;;
esac ;;
+ s390x:SunOS:*:*)
+ echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ exit ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
+ i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
+ echo i386-pc-auroraux${UNAME_RELEASE}
+ exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
- echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ eval $set_cc_for_build
+ SUN_ARCH="i386"
+ # If there is a compiler, see if it is configured for 64-bit objects.
+ # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
+ # This test works for both compilers.
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ SUN_ARCH="x86_64"
+ fi
+ fi
+ echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
@@ -650,7 +660,7 @@ EOF
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
- grep __LP64__ >/dev/null
+ grep -q __LP64__
then
HP_ARCH="hppa2.0w"
else
@@ -801,12 +811,12 @@ EOF
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
- *:Interix*:[3456]*)
+ *:Interix*:*)
case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
- EM64T | authenticamd)
+ authenticamd | genuineintel | EM64T)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
@@ -816,6 +826,9 @@ EOF
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
+ 8664:Windows_NT:*)
+ echo x86_64-pc-mks
+ exit ;;
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
@@ -845,18 +858,32 @@ EOF
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
+ 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 -q ld.so.1
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
+ exit ;;
arm*:Linux:*:*)
eval $set_cc_for_build
if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \
| grep -q __ARM_EABI__
then
- echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
else
- echo ${UNAME_MACHINE}-${VENDOR}-linux-gnueabi
+ echo ${UNAME_MACHINE}-unknown-linux-gnueabi
fi
exit ;;
avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
cris:Linux:*:*)
echo cris-axis-linux-gnu
@@ -865,181 +892,91 @@ EOF
echo crisv32-axis-linux-gnu
exit ;;
frv:Linux:*:*)
- echo frv-${VENDOR}-linux-gnu
+ echo frv-unknown-linux-gnu
+ exit ;;
+ i*86:Linux:*:*)
+ LIBC=gnu
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
+EOF
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'`
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
exit ;;
ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
- 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 | sed -n '
- /^CPU/{
- s: ::g
- p
- }'`"
- test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-gnu"; exit; }
- ;;
- mips64:Linux:*:*)
+ mips:Linux:*:* | mips64:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
- #undef mips64
- #undef mips64el
+ #undef ${UNAME_MACHINE}
+ #undef ${UNAME_MACHINE}el
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=mips64el
+ CPU=${UNAME_MACHINE}el
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=mips64
+ CPU=${UNAME_MACHINE}
#else
CPU=
#endif
#endif
EOF
- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
- /^CPU/{
- s: ::g
- p
- }'`"
- test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-gnu"; exit; }
+ eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
or32:Linux:*:*)
- echo or32-${VENDOR}-linux-gnu
- exit ;;
- ppc:Linux:*:*)
- echo powerpc-${VENDOR}-linux-gnu
+ echo or32-unknown-linux-gnu
exit ;;
- ppc64:Linux:*:*)
- echo powerpc64-${VENDOR}-linux-gnu
+ padre:Linux:*:*)
+ echo sparc-unknown-linux-gnu
exit ;;
- 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-gnu${LIBC}
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
exit ;;
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-gnu ;;
- PA8*) echo hppa2.0-${VENDOR}-linux-gnu ;;
- *) echo hppa-${VENDOR}-linux-gnu ;;
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
esac
exit ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-${VENDOR}-linux-gnu
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit ;;
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
echo ${UNAME_MACHINE}-ibm-linux
exit ;;
sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
vax:Linux:*:*)
echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;;
x86_64:Linux:*:*)
- echo x86_64-${VENDOR}-linux-gnu
+ echo x86_64-unknown-linux-gnu
exit ;;
xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-${VENDOR}-linux-gnu
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
- 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-gnu"
- ;;
- a.out-i386-linux)
- echo "${UNAME_MACHINE}-${VENDOR}-linux-gnuaout"
- exit ;;
- coff-i386)
- echo "${UNAME_MACHINE}-${VENDOR}-linux-gnucoff"
- exit ;;
- "")
- # Either a pre-BFD a.out linker (linux-gnuoldld) or
- # one that does not give us useful --help.
- echo "${UNAME_MACHINE}-${VENDOR}-linux-gnuoldld"
- exit ;;
- esac
- # Determine whether the default compiler is a.out or elf
- eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
- #include <features.h>
- #ifdef __ELF__
- # ifdef __GLIBC__
- # if __GLIBC__ >= 2
- LIBC=gnu
- # else
- LIBC=gnulibc1
- # endif
- # else
- LIBC=gnulibc1
- # endif
- #else
- #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
- LIBC=gnu
- #else
- LIBC=gnuaout
- #endif
- #endif
- #ifdef __dietlibc__
- LIBC=dietlibc
- #endif
-EOF
- eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
- /^LIBC/{
- s: ::g
- p
- }'`"
- test x"${LIBC}" != x && {
- echo "${UNAME_MACHINE}-${VENDOR}-linux-${LIBC}"
- exit
- }
- test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
- ;;
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
@@ -1068,7 +1005,7 @@ EOF
i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit ;;
i*86:*DOS:*:*)
@@ -1112,8 +1049,11 @@ EOF
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
+ # the processor, so we play safe by assuming i586.
+ # Note: whatever this is, it MUST be the same as what config.sub
+ # prints for the "djgpp" host, or else GDB configury will decide that
+ # this is a cross-build.
+ echo i586-pc-msdosdjgpp
exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
@@ -1151,6 +1091,16 @@ EOF
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
/bin/uname -p 2>/dev/null | grep 86 >/dev/null \
&& { echo i486-ncr-sysv4; exit; } ;;
+ NCR*:*:4.2:* | MPRAS*:*:4.2:*)
+ OS_REL='.3'
+ 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; }
+ /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
+ /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
+ && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit ;;
@@ -1163,7 +1113,7 @@ EOF
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit ;;
SM[BE]S:UNIX_SV:*:*)
@@ -1226,6 +1176,9 @@ EOF
BePC:BeOS:*:*) # BeOS running on Intel PC compatible.
echo i586-pc-beos
exit ;;
+ BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
+ echo i586-pc-haiku
+ exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
@@ -1253,6 +1206,16 @@ EOF
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
case $UNAME_PROCESSOR in
+ i386)
+ eval $set_cc_for_build
+ if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
+ if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \
+ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
+ grep IS_64BIT_ARCH >/dev/null
+ then
+ UNAME_PROCESSOR="x86_64"
+ fi
+ fi ;;
unknown) UNAME_PROCESSOR=powerpc ;;
esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
@@ -1334,6 +1297,9 @@ EOF
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
exit ;;
+ i*86:AROS:*:*)
+ echo ${UNAME_MACHINE}-pc-aros
+ exit ;;
esac
#echo '(No uname command or uname output not recognized.)' 1>&2
@@ -1494,9 +1460,9 @@ This script, last modified $timestamp, has failed to recognize
the operating system you are using. It is advised that you
download the most up to date version of the config scripts from
- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD
and
- http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
+ http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
If the version you run ($0) is already up to date, please
send the following data and any information you think might be
diff --git a/config.h b/config.h
index 669f775..f34630b 100755..100644
--- a/config.h
+++ b/config.h
@@ -1,14 +1,35 @@
-#ifndef NTFS3G_CONFIG_H
-#define NTFS3G_CONFIG_H
/* config.h. Generated from config.h.in by configure. */
/* config.h.in. Generated from configure.ac by autoheader. */
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
+/* Define this to 1 if you want to enable support of encrypted files in
+ libntfs and utilities. */
+/* #undef ENABLE_CRYPTO */
+
/* Define to 1 if debug should be enabled */
/* #undef ENABLE_DEBUG */
-//#define DEBUG
+
+/* Define this to 1 if you want to enable use of Windows compliant disk
+ geometry. */
+/* #undef ENABLE_HD */
/* Define to 1 if the nfconv patch should be enabled */
/* #undef ENABLE_NFCONV */
+#ifndef MOUNTED
+#define MOUNTED "/etc/mtab"
+#endif
+
+#ifndef _PATH_MOUNTED
+#define _PATH_MOUNTED "/etc/mtab"
+#endif
+
+#define __USE_FILE_OFFSET64
+
+/* Define this to 1 if you want to enable generation of DCE compliant UUIDs.
+ */
+//#define ENABLE_UUID 1
/* Define to 1 if using internal fuse */
#define FUSE_INTERNAL 1
@@ -23,7 +44,7 @@
#define HAVE_BYTESWAP_H 1
/* Define to 1 if you have the `clock_gettime' function. */
-#define HAVE_CLOCK_GETTIME 1
+/* #undef HAVE_CLOCK_GETTIME */
/* Define to 1 if you have the <ctype.h> header file. */
#define HAVE_CTYPE_H 1
@@ -41,9 +62,7 @@
#define HAVE_DUP2 1
/* Define to 1 if you have the <endian.h> header file. */
-#ifndef HAVE_ENDIAN_H
-#define HAVE_ENDIAN_H 1
-#endif
+//#define HAVE_ENDIAN_H 1
/* Define to 1 if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
@@ -64,7 +83,7 @@
#define HAVE_FORK 1
/* Define to 1 if you have the `getmntent' function. */
-#define HAVE_GETMNTENT
+#define HAVE_GETMNTENT 1
/* Define to 1 if you have the <getopt.h> header file. */
#define HAVE_GETOPT_H 1
@@ -85,7 +104,7 @@
#define HAVE_LIBGEN_H 1
/* Define to 1 if you have the <libintl.h> header file. */
-/* #undef HAVE_LIBINTL_H */
+//#define HAVE_LIBINTL_H 1
/* Define to 1 if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
@@ -105,12 +124,18 @@
/* Define to 1 if you have the <machine/endian.h> header file. */
/* #undef HAVE_MACHINE_ENDIAN_H */
+/* Define to 1 if you have the <malloc.h> header file. */
+//#define HAVE_MALLOC_H 1
+
/* Define to 1 if mbrtowc and mbstate_t are properly declared. */
#define HAVE_MBRTOWC 1
/* Define to 1 if you have the `mbsinit' function. */
#define HAVE_MBSINIT 1
+/* Define to 1 if you have the `memcpy' function. */
+#define HAVE_MEMCPY 1
+
/* Define to 1 if you have the `memmove' function. */
#define HAVE_MEMMOVE 1
@@ -122,7 +147,12 @@
/* Define to 1 if you have the <mntent.h> header file. */
#define HAVE_MNTENT_H 1
- #define MOUNTED "/etc/mtab"
+
+/* Define to 1 if you have the <pwd.h> header file. */
+#define HAVE_PWD_H 1
+
+/* Define to 1 if you have the `random' function. */
+#define HAVE_RANDOM 1
/* Define to 1 if you have the `realpath' function. */
#define HAVE_REALPATH 1
@@ -130,15 +160,21 @@
/* Define to 1 if you have the `regcomp' function. */
#define HAVE_REGCOMP 1
+/* Define to 1 if you have the <regex.h> header file. */
+#define HAVE_REGEX_H 1
+
/* Define to 1 if you have the `setlocale' function. */
#define HAVE_SETLOCALE 1
/* Define to 1 if you have the `setxattr' function. */
//#define HAVE_SETXATTR 1
+/* Define to 1 if you have the `snprintf' function. */
+#define HAVE_SNPRINTF 1
+
/* Define to 1 if `stat' has the bug that it succeeds when given the
zero-length file name argument. */
-#define HAVE_STAT_EMPTY_STRING_BUG 1
+/* #undef HAVE_STAT_EMPTY_STRING_BUG */
/* Define to 1 if you have the <stdarg.h> header file. */
#define HAVE_STDARG_H 1
@@ -191,19 +227,19 @@
/* Define to 1 if you have the `strtoul' function. */
#define HAVE_STRTOUL 1
-/* Define to 1 if `st_atim' is member of `struct stat'. */
-/* #undef HAVE_STRUCT_STAT_ST_ATIM */
+/* Define to 1 if `st_atim' is a member of `struct stat'. */
+//#define HAVE_STRUCT_STAT_ST_ATIM 1
-/* Define to 1 if `st_atimensec' is member of `struct stat'. */
-#define HAVE_STRUCT_STAT_ST_ATIMENSEC 1
+/* Define to 1 if `st_atimensec' is a member of `struct stat'. */
+/* #undef HAVE_STRUCT_STAT_ST_ATIMENSEC */
-/* Define to 1 if `st_atimespec' is member of `struct stat'. */
+/* Define to 1 if `st_atimespec' is a member of `struct stat'. */
/* #undef HAVE_STRUCT_STAT_ST_ATIMESPEC */
-/* Define to 1 if `st_blocks' is member of `struct stat'. */
+/* Define to 1 if `st_blocks' is a member of `struct stat'. */
#define HAVE_STRUCT_STAT_ST_BLOCKS 1
-/* Define to 1 if `st_rdev' is member of `struct stat'. */
+/* Define to 1 if `st_rdev' is a member of `struct stat'. */
#define HAVE_STRUCT_STAT_ST_RDEV 1
/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use
@@ -219,6 +255,9 @@
/* Define to 1 if you have the <sys/byteorder.h> header file. */
/* #undef HAVE_SYS_BYTEORDER_H */
+/* Define to 1 if you have the <sys/disk.h> header file. */
+/* #undef HAVE_SYS_DISK_H */
+
/* Define to 1 if you have the <sys/endian.h> header file. */
/* #undef HAVE_SYS_ENDIAN_H */
@@ -244,7 +283,7 @@
#define HAVE_SYS_SYSMACROS_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
-#define HAVE_SYS_TYPES_H 0
+#define HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <sys/vfs.h> header file. */
#define HAVE_SYS_VFS_H 1
@@ -254,20 +293,18 @@
/* Define to 1 if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
- #define __USE_FILE_OFFSET64
-
/* Define to 1 if you have the `utime' function. */
#define HAVE_UTIME 1
/* Define to 1 if you have the `utimensat' function. */
-/* #undef HAVE_UTIMENSAT */
+//#define HAVE_UTIMENSAT 1
/* Define to 1 if you have the <utime.h> header file. */
#define HAVE_UTIME_H 1
/* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */
-/* #undef HAVE_UTIME_NULL */
+#define HAVE_UTIME_NULL 1
/* Define to 1 if you have the `vprintf' function. */
#define HAVE_VPRINTF 1
@@ -286,7 +323,11 @@
/* Define to 1 if `lstat' dereferences a symlink specified with a trailing
slash. */
-/* #undef LSTAT_FOLLOWS_SLASHED_SYMLINK */
+#define LSTAT_FOLLOWS_SLASHED_SYMLINK 1
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#define LT_OBJDIR ".libs/"
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
/* #undef NO_MINUS_C_MINUS_O */
@@ -304,13 +345,16 @@
#define PACKAGE_NAME "ntfs-3g"
/* Define to the full name and version of this package. */
-#define PACKAGE_STRING "ntfs-3g 2010.5.16"
+#define PACKAGE_STRING "ntfs-3g 2014.2.15"
/* Define to the one symbol short name of this package. */
#define PACKAGE_TARNAME "ntfs-3g"
+/* Define to the home page for this package. */
+#define PACKAGE_URL ""
+
/* Define to the version of this package. */
-#define PACKAGE_VERSION "2010.5.16"
+#define PACKAGE_VERSION "2014.2.15"
/* POSIX ACL support */
/* #undef POSIXACLS */
@@ -318,41 +362,74 @@
/* Define to 1 if you have the ANSI C header files. */
#define STDC_HEADERS 1
+/* Enable extensions on AIX 3, Interix. */
+#ifndef _ALL_SOURCE
+# define _ALL_SOURCE 1
+#endif
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# define _GNU_SOURCE 1
+#endif
+/* Enable threading extensions on Solaris. */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# define _POSIX_PTHREAD_SEMANTICS 1
+#endif
+/* Enable extensions on HP NonStop. */
+#ifndef _TANDEM_SOURCE
+# define _TANDEM_SOURCE 1
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# define __EXTENSIONS__ 1
+#endif
+
+
/* Version number of package */
-#define VERSION "2010.5.16"
+#define VERSION "2014.2.15"
/* Define to 1 if this is a Windows OS */
/* #undef WINDOWS */
-/* 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 WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+/* # undef WORDS_BIGENDIAN */
+# endif
+#endif
/* Define to 1 if your processor stores words with the least significant byte
first (like Intel and VAX, unlike Motorola and SPARC). */
#define WORDS_LITTLEENDIAN 1
-/* Number of bits in a file offset, on hosts where this is settable. */
-#define _FILE_OFFSET_BITS 64
-
-#ifndef _OFF_T_DEFINED_
-#define _OFF_T_DEFINED_
-//typedef loff_t off_t;
-//#define off_t loff_t
-#endif
+/* system extended attributes mappings */
+/* #undef XATTR_MAPPINGS */
-/* Enable GNU extensions on systems that have them. */
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE 1
-#endif
+/* Number of bits in a file offset, on hosts where this is settable. */
+/* #undef _FILE_OFFSET_BITS */
/* Define for large files, on AIX-style hosts. */
/* #undef _LARGE_FILES */
+/* Define to 1 if on MINIX. */
+/* #undef _MINIX */
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+ this defined. */
+/* #undef _POSIX_1_SOURCE */
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+/* #undef _POSIX_SOURCE */
+
/* Required define if using POSIX threads */
#define _REENTRANT 1
-#define _PATH_MOUNTED "/etc/mtab"
+/* 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. */
@@ -365,5 +442,3 @@
/* Define to `unsigned int' if <sys/types.h> does not define. */
/* #undef size_t */
-#endif
-
diff --git a/config.h.in b/config.h.in
index 49c2cf5..242f97a 100755
--- a/config.h.in
+++ b/config.h.in
@@ -1,11 +1,26 @@
/* config.h.in. Generated from configure.ac by autoheader. */
+/* Define if building universal (internal helper macro) */
+#undef AC_APPLE_UNIVERSAL_BUILD
+
+/* Define this to 1 if you want to enable support of encrypted files in
+ libntfs and utilities. */
+#undef ENABLE_CRYPTO
+
/* Define to 1 if debug should be enabled */
#undef ENABLE_DEBUG
+/* Define this to 1 if you want to enable use of Windows compliant disk
+ geometry. */
+#undef ENABLE_HD
+
/* Define to 1 if the nfconv patch should be enabled */
#undef ENABLE_NFCONV
+/* Define this to 1 if you want to enable generation of DCE compliant UUIDs.
+ */
+#undef ENABLE_UUID
+
/* Define to 1 if using internal fuse */
#undef FUSE_INTERNAL
@@ -99,12 +114,18 @@
/* Define to 1 if you have the <machine/endian.h> header file. */
#undef HAVE_MACHINE_ENDIAN_H
+/* Define to 1 if you have the <malloc.h> header file. */
+#undef HAVE_MALLOC_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 `memcpy' function. */
+#undef HAVE_MEMCPY
+
/* Define to 1 if you have the `memmove' function. */
#undef HAVE_MEMMOVE
@@ -117,18 +138,30 @@
/* Define to 1 if you have the <mntent.h> header file. */
#undef HAVE_MNTENT_H
+/* Define to 1 if you have the <pwd.h> header file. */
+#undef HAVE_PWD_H
+
+/* Define to 1 if you have the `random' function. */
+#undef HAVE_RANDOM
+
/* Define to 1 if you have the `realpath' function. */
#undef HAVE_REALPATH
/* Define to 1 if you have the `regcomp' function. */
#undef HAVE_REGCOMP
+/* Define to 1 if you have the <regex.h> header file. */
+#undef HAVE_REGEX_H
+
/* 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 you have the `snprintf' function. */
+#undef HAVE_SNPRINTF
+
/* 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
@@ -184,19 +217,19 @@
/* Define to 1 if you have the `strtoul' function. */
#undef HAVE_STRTOUL
-/* Define to 1 if `st_atim' is member of `struct stat'. */
+/* Define to 1 if `st_atim' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_ATIM
-/* Define to 1 if `st_atimensec' is member of `struct stat'. */
+/* Define to 1 if `st_atimensec' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_ATIMENSEC
-/* Define to 1 if `st_atimespec' is member of `struct stat'. */
+/* Define to 1 if `st_atimespec' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_ATIMESPEC
-/* Define to 1 if `st_blocks' is member of `struct stat'. */
+/* Define to 1 if `st_blocks' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_BLOCKS
-/* Define to 1 if `st_rdev' is member of `struct stat'. */
+/* Define to 1 if `st_rdev' is a member of `struct stat'. */
#undef HAVE_STRUCT_STAT_ST_RDEV
/* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use
@@ -212,6 +245,9 @@
/* Define to 1 if you have the <sys/byteorder.h> header file. */
#undef HAVE_SYS_BYTEORDER_H
+/* Define to 1 if you have the <sys/disk.h> header file. */
+#undef HAVE_SYS_DISK_H
+
/* Define to 1 if you have the <sys/endian.h> header file. */
#undef HAVE_SYS_ENDIAN_H
@@ -279,6 +315,10 @@
slash. */
#undef LSTAT_FOLLOWS_SLASHED_SYMLINK
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
/* Define to 1 if your C compiler doesn't accept -c and -o together. */
#undef NO_MINUS_C_MINUS_O
@@ -300,6 +340,9 @@
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
/* Define to the version of this package. */
#undef PACKAGE_VERSION
@@ -309,34 +352,75 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
+/* Enable extensions on AIX 3, Interix. */
+#ifndef _ALL_SOURCE
+# undef _ALL_SOURCE
+#endif
+/* Enable GNU extensions on systems that have them. */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+/* Enable threading extensions on Solaris. */
+#ifndef _POSIX_PTHREAD_SEMANTICS
+# undef _POSIX_PTHREAD_SEMANTICS
+#endif
+/* Enable extensions on HP NonStop. */
+#ifndef _TANDEM_SOURCE
+# undef _TANDEM_SOURCE
+#endif
+/* Enable general extensions on Solaris. */
+#ifndef __EXTENSIONS__
+# undef __EXTENSIONS__
+#endif
+
+
/* Version number of package */
#undef VERSION
/* Define to 1 if this is a Windows OS */
#undef WINDOWS
-/* 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 WORDS_BIGENDIAN to 1 if your processor stores words with the most
+ significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+# define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+# undef WORDS_BIGENDIAN
+# endif
+#endif
/* 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
+/* system extended attributes mappings */
+#undef XATTR_MAPPINGS
+
/* 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 1 if on MINIX. */
+#undef _MINIX
+
+/* Define to 2 if the system does not provide POSIX.1 features except with
+ this defined. */
+#undef _POSIX_1_SOURCE
+
+/* Define to 1 if you need to in order for `stat' and other things to work. */
+#undef _POSIX_SOURCE
+
/* Required define if using POSIX threads */
#undef _REENTRANT
+/* 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
diff --git a/config.log b/config.log
deleted file mode 100755
index 3f928ac..0000000
--- a/config.log
+++ b/dev/null
@@ -1,3290 +0,0 @@
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by ntfs-3g configure 2010.5.16, which was
-generated by GNU Autoconf 2.61. Invocation command line was
-
- $ ./configure CC=arc-linux-uclibc-gcc --prefix=/mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/bld_7266_h_64x2/./rootfs --host=arc-linux-uclibc CFLAGS=-mA7 -g --enable-mount-helper=no --enable-ldconfig=no exec_prefix=/mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/bld_7266_h_64x2/./rootfs
-
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = announce
-uname -m = i686
-uname -r = 2.6.31-14-generic-pae
-uname -s = Linux
-uname -v = #48-Ubuntu SMP Fri Oct 16 15:22:42 UTC 2009
-
-/usr/bin/uname -p = unknown
-/bin/uname -X = unknown
-
-/bin/arch = unknown
-/usr/bin/arch -k = unknown
-/usr/convex/getsysinfo = unknown
-/usr/bin/hostinfo = unknown
-/bin/machine = unknown
-/usr/bin/oslevel = unknown
-/bin/universe = unknown
-
-PATH: /usr/local/sbin
-PATH: /usr/local/bin
-PATH: /usr/sbin
-PATH: /usr/bin
-PATH: /sbin
-PATH: /bin
-PATH: /usr/games
-PATH: /opt/gnutools/arc2.3-p0/elf32-4.2.1/bin
-PATH: /opt/gnutools/arc2.3-p0/uclibc-4.2.1/bin
-PATH: .
-PATH: /opt/qtcreator-1.2.0/bin
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-configure:2048: checking build system type
-configure:2066: result: i686-pc-linux-gnu
-configure:2088: checking host system type
-configure:2103: result: arc-unknown-linux-uclibc
-configure:2125: checking target system type
-configure:2140: result: arc-unknown-linux-uclibc
-configure:2185: checking for a BSD-compatible install
-configure:2241: result: /usr/bin/install -c
-configure:2252: checking whether build environment is sane
-configure:2295: result: yes
-configure:2323: checking for a thread-safe mkdir -p
-configure:2362: result: /bin/mkdir -p
-configure:2375: checking for gawk
-configure:2405: result: no
-configure:2375: checking for mawk
-configure:2391: found /usr/bin/mawk
-configure:2402: result: mawk
-configure:2413: checking whether make sets $(MAKE)
-configure:2434: result: yes
-configure:2514: checking for arc-linux-uclibc-strip
-configure:2530: found /opt/gnutools/arc2.3-p0/uclibc-4.2.1/bin/arc-linux-uclibc-strip
-configure:2541: result: arc-linux-uclibc-strip
-configure:2625: checking whether to enable maintainer-specific portions of Makefiles
-configure:2634: result: no
-configure:2786: checking for arc-linux-uclibc-gcc
-configure:2813: result: arc-linux-uclibc-gcc
-configure:2893: checking for C compiler version
-configure:2900: arc-linux-uclibc-gcc --version >&5
-arc-linux-uclibc-gcc (GCC) 4.2.1 (ARC_2.3)
-Copyright (C) 2007 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.
-
-configure:2903: $? = 0
-configure:2910: arc-linux-uclibc-gcc -v >&5
-Using built-in specs.
-Target: arc-linux-uclibc
-Configured with: ../src/configure --target=arc-linux-uclibc --prefix=/opt/gnutools/arc2.3-p0/uclibc-4.2.1 --with-headers=/opt/gnutools/arc2.3-p0/uclibc-4.2.1/arc-linux-uclibc/include --enable-shared --disable-multilib --without-newlib --enable-languages=c,c++ --with-cpu=arc700 --disable-c99
-Thread model: posix
-gcc version 4.2.1 (ARC_2.3)
-configure:2913: $? = 0
-configure:2920: arc-linux-uclibc-gcc -V >&5
-arc-linux-uclibc-gcc: '-V' option must have argument
-configure:2923: $? = 1
-configure:2946: checking for C compiler default output file name
-configure:2973: arc-linux-uclibc-gcc -mA7 -g conftest.c >&5
-configure:2976: $? = 0
-configure:3014: result: a.out
-configure:3031: checking whether the C compiler works
-configure:3041: ./a.out
-./configure: line 3042: ./a.out: cannot execute binary file
-configure:3044: $? = 126
-configure:3061: result: yes
-configure:3068: checking whether we are cross compiling
-configure:3070: result: yes
-configure:3073: checking for suffix of executables
-configure:3080: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:3083: $? = 0
-configure:3107: result:
-configure:3113: checking for suffix of object files
-configure:3139: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:3142: $? = 0
-configure:3165: result: o
-configure:3169: checking whether we are using the GNU C compiler
-configure:3198: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:3204: $? = 0
-configure:3221: result: yes
-configure:3226: checking whether arc-linux-uclibc-gcc accepts -g
-configure:3256: arc-linux-uclibc-gcc -c -g conftest.c >&5
-configure:3262: $? = 0
-configure:3361: result: yes
-configure:3378: checking for arc-linux-uclibc-gcc option to accept ISO C89
-configure:3452: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:3458: $? = 0
-configure:3481: result: none needed
-configure:3510: checking for style of include used by make
-configure:3538: result: GNU
-configure:3563: checking dependency style of arc-linux-uclibc-gcc
-configure:3654: result: gcc3
-configure:3669: checking whether ln -s works
-configure:3673: result: yes
-configure:3681: checking whether arc-linux-uclibc-gcc and cc understand -c and -o together
-configure:3716: arc-linux-uclibc-gcc -c conftest.c -o conftest2.o >&5
-configure:3719: $? = 0
-configure:3725: arc-linux-uclibc-gcc -c conftest.c -o conftest2.o >&5
-configure:3728: $? = 0
-configure:3739: cc -c conftest.c >&5
-configure:3742: $? = 0
-configure:3750: cc -c conftest.c -o conftest2.o >&5
-configure:3753: $? = 0
-configure:3759: cc -c conftest.c -o conftest2.o >&5
-configure:3762: $? = 0
-configure:3780: result: yes
-configure:3879: checking for a sed that does not truncate output
-configure:3935: result: /bin/sed
-configure:3938: checking for grep that handles long lines and -e
-configure:4012: result: /bin/grep
-configure:4017: checking for egrep
-configure:4095: result: /bin/grep -E
-configure:4111: checking for ld used by arc-linux-uclibc-gcc
-configure:4178: result: /opt/gnutools/arc2.3-p0/uclibc-4.2.1/arc-linux-uclibc/bin/ld
-configure:4187: checking if the linker (/opt/gnutools/arc2.3-p0/uclibc-4.2.1/arc-linux-uclibc/bin/ld) is GNU ld
-configure:4202: result: yes
-configure:4207: checking for /opt/gnutools/arc2.3-p0/uclibc-4.2.1/arc-linux-uclibc/bin/ld option to reload object files
-configure:4214: result: -r
-configure:4232: checking for BSD-compatible nm
-configure:4281: result: /opt/gnutools/arc2.3-p0/uclibc-4.2.1/bin/arc-linux-uclibc-nm -B
-configure:4285: checking how to recognize dependent libraries
-configure:4471: result: pass_all
-configure:4716: checking how to run the C preprocessor
-configure:4756: arc-linux-uclibc-gcc -E conftest.c
-configure:4762: $? = 0
-configure:4793: arc-linux-uclibc-gcc -E conftest.c
-conftest.c:11:28: error: ac_nonexistent.h: No such file or directory
-configure:4799: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| /* end confdefs.h. */
-| #include <ac_nonexistent.h>
-configure:4832: result: arc-linux-uclibc-gcc -E
-configure:4861: arc-linux-uclibc-gcc -E conftest.c
-configure:4867: $? = 0
-configure:4898: arc-linux-uclibc-gcc -E conftest.c
-conftest.c:11:28: error: ac_nonexistent.h: No such file or directory
-configure:4904: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| /* end confdefs.h. */
-| #include <ac_nonexistent.h>
-configure:4942: checking for ANSI C header files
-configure:4972: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:4978: $? = 0
-configure:5106: result: yes
-configure:5130: checking for sys/types.h
-configure:5151: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:5157: $? = 0
-configure:5173: result: yes
-configure:5130: checking for sys/stat.h
-configure:5151: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:5157: $? = 0
-configure:5173: result: yes
-configure:5130: checking for stdlib.h
-configure:5151: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:5157: $? = 0
-configure:5173: result: yes
-configure:5130: checking for string.h
-configure:5151: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:5157: $? = 0
-configure:5173: result: yes
-configure:5130: checking for memory.h
-configure:5151: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:5157: $? = 0
-configure:5173: result: yes
-configure:5130: checking for strings.h
-configure:5151: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:5157: $? = 0
-configure:5173: result: yes
-configure:5130: checking for inttypes.h
-configure:5151: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:5157: $? = 0
-configure:5173: result: yes
-configure:5130: checking for stdint.h
-configure:5151: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:5157: $? = 0
-configure:5173: result: yes
-configure:5130: checking for unistd.h
-configure:5151: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:5157: $? = 0
-configure:5173: result: yes
-configure:5200: checking dlfcn.h usability
-configure:5217: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:5223: $? = 0
-configure:5237: result: yes
-configure:5241: checking dlfcn.h presence
-configure:5256: arc-linux-uclibc-gcc -E conftest.c
-configure:5262: $? = 0
-configure:5276: result: yes
-configure:5309: checking for dlfcn.h
-configure:5317: result: yes
-configure:5344: checking for arc-linux-uclibc-g++
-configure:5360: found /opt/gnutools/arc2.3-p0/uclibc-4.2.1/bin/arc-linux-uclibc-g++
-configure:5371: result: arc-linux-uclibc-g++
-configure:5446: checking for C++ compiler version
-configure:5453: arc-linux-uclibc-g++ --version >&5
-arc-linux-uclibc-g++ (GCC) 4.2.1 (ARC_2.3)
-Copyright (C) 2007 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.
-
-configure:5456: $? = 0
-configure:5463: arc-linux-uclibc-g++ -v >&5
-Using built-in specs.
-Target: arc-linux-uclibc
-Configured with: ../src/configure --target=arc-linux-uclibc --prefix=/opt/gnutools/arc2.3-p0/uclibc-4.2.1 --with-headers=/opt/gnutools/arc2.3-p0/uclibc-4.2.1/arc-linux-uclibc/include --enable-shared --disable-multilib --without-newlib --enable-languages=c,c++ --with-cpu=arc700 --disable-c99
-Thread model: posix
-gcc version 4.2.1 (ARC_2.3)
-configure:5466: $? = 0
-configure:5473: arc-linux-uclibc-g++ -V >&5
-arc-linux-uclibc-g++: '-V' option must have argument
-configure:5476: $? = 1
-configure:5479: checking whether we are using the GNU C++ compiler
-configure:5508: arc-linux-uclibc-g++ -c conftest.cpp >&5
-configure:5514: $? = 0
-configure:5531: result: yes
-configure:5536: checking whether arc-linux-uclibc-g++ accepts -g
-configure:5566: arc-linux-uclibc-g++ -c -g conftest.cpp >&5
-configure:5572: $? = 0
-configure:5671: result: yes
-configure:5696: checking dependency style of arc-linux-uclibc-g++
-configure:5787: result: gcc3
-configure:5812: checking how to run the C++ preprocessor
-configure:5848: arc-linux-uclibc-g++ -E conftest.cpp
-configure:5854: $? = 0
-configure:5885: arc-linux-uclibc-g++ -E conftest.cpp
-conftest.cpp:22:28: error: ac_nonexistent.h: No such file or directory
-configure:5891: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| /* end confdefs.h. */
-| #include <ac_nonexistent.h>
-configure:5924: result: arc-linux-uclibc-g++ -E
-configure:5953: arc-linux-uclibc-g++ -E conftest.cpp
-configure:5959: $? = 0
-configure:5990: arc-linux-uclibc-g++ -E conftest.cpp
-conftest.cpp:22:28: error: ac_nonexistent.h: No such file or directory
-configure:5996: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| /* end confdefs.h. */
-| #include <ac_nonexistent.h>
-configure:6045: checking for arc-linux-uclibc-g77
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-xlf
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-f77
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-frt
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-pgf77
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-cf77
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-fort77
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-fl32
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-af77
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-xlf90
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-f90
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-pgf90
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-pghpf
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-epcf90
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-gfortran
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-g95
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-xlf95
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-f95
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-fort
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-ifort
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-ifc
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-efc
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-pgf95
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-lf95
-configure:6075: result: no
-configure:6045: checking for arc-linux-uclibc-ftn
-configure:6075: result: no
-configure:6089: checking for g77
-configure:6119: result: no
-configure:6089: checking for xlf
-configure:6119: result: no
-configure:6089: checking for f77
-configure:6119: result: no
-configure:6089: checking for frt
-configure:6119: result: no
-configure:6089: checking for pgf77
-configure:6119: result: no
-configure:6089: checking for cf77
-configure:6119: result: no
-configure:6089: checking for fort77
-configure:6119: result: no
-configure:6089: checking for fl32
-configure:6119: result: no
-configure:6089: checking for af77
-configure:6119: result: no
-configure:6089: checking for xlf90
-configure:6119: result: no
-configure:6089: checking for f90
-configure:6119: result: no
-configure:6089: checking for pgf90
-configure:6119: result: no
-configure:6089: checking for pghpf
-configure:6119: result: no
-configure:6089: checking for epcf90
-configure:6119: result: no
-configure:6089: checking for gfortran
-configure:6119: result: no
-configure:6089: checking for g95
-configure:6119: result: no
-configure:6089: checking for xlf95
-configure:6119: result: no
-configure:6089: checking for f95
-configure:6119: result: no
-configure:6089: checking for fort
-configure:6119: result: no
-configure:6089: checking for ifort
-configure:6119: result: no
-configure:6089: checking for ifc
-configure:6119: result: no
-configure:6089: checking for efc
-configure:6119: result: no
-configure:6089: checking for pgf95
-configure:6119: result: no
-configure:6089: checking for lf95
-configure:6119: result: no
-configure:6089: checking for ftn
-configure:6119: result: no
-configure:6146: checking for Fortran 77 compiler version
-configure:6153: --version >&5
-./configure: line 6154: --version: command not found
-configure:6156: $? = 127
-configure:6163: -v >&5
-./configure: line 6164: -v: command not found
-configure:6166: $? = 127
-configure:6173: -V >&5
-./configure: line 6174: -V: command not found
-configure:6176: $? = 127
-configure:6184: checking whether we are using the GNU Fortran 77 compiler
-configure:6203: -c conftest.F >&5
-./configure: line 6204: -c: command not found
-configure:6209: $? = 127
-configure: failed program was:
-| program main
-| #ifndef __GNUC__
-| choke me
-| #endif
-|
-| end
-configure:6226: result: no
-configure:6232: checking whether accepts -g
-configure:6249: -c -g conftest.f >&5
-./configure: line 6250: -c: command not found
-configure:6255: $? = 127
-configure: failed program was:
-| program main
-|
-| end
-configure:6271: result: no
-configure:6300: checking the maximum length of command line arguments
-configure:6412: result: 805306365
-configure:6424: checking command to parse /opt/gnutools/arc2.3-p0/uclibc-4.2.1/bin/arc-linux-uclibc-nm -B output from arc-linux-uclibc-gcc object
-configure:6529: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:6532: $? = 0
-configure:6536: /opt/gnutools/arc2.3-p0/uclibc-4.2.1/bin/arc-linux-uclibc-nm -B conftest.o \| sed -n -e 's/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p' \> conftest.nm
-configure:6539: $? = 0
-configure:6591: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c conftstm.o >&5
-configure:6594: $? = 0
-configure:6632: result: ok
-configure:6636: checking for objdir
-configure:6651: result: .libs
-configure:6703: checking for arc-linux-uclibc-ar
-configure:6719: found /opt/gnutools/arc2.3-p0/uclibc-4.2.1/bin/arc-linux-uclibc-ar
-configure:6730: result: arc-linux-uclibc-ar
-configure:6799: checking for arc-linux-uclibc-ranlib
-configure:6815: found /opt/gnutools/arc2.3-p0/uclibc-4.2.1/bin/arc-linux-uclibc-ranlib
-configure:6826: result: arc-linux-uclibc-ranlib
-configure:6895: checking for arc-linux-uclibc-strip
-configure:6922: result: arc-linux-uclibc-strip
-configure:7560: checking if arc-linux-uclibc-gcc supports -fno-rtti -fno-exceptions
-configure:7578: arc-linux-uclibc-gcc -c -mA7 -g -fno-rtti -fno-exceptions conftest.c >&5
-cc1: warning: command line option "-fno-rtti" is valid for C++/ObjC++ but not for C
-configure:7582: $? = 0
-configure:7595: result: no
-configure:7610: checking for arc-linux-uclibc-gcc option to produce PIC
-configure:7842: result: -fPIC
-configure:7850: checking if arc-linux-uclibc-gcc PIC flag -fPIC works
-configure:7868: arc-linux-uclibc-gcc -c -mA7 -g -fPIC -DPIC conftest.c >&5
-configure:7872: $? = 0
-configure:7885: result: yes
-configure:7913: checking if arc-linux-uclibc-gcc static flag -static works
-configure:7941: result: yes
-configure:7951: checking if arc-linux-uclibc-gcc supports -c -o file.o
-configure:7972: arc-linux-uclibc-gcc -c -mA7 -g -o out/conftest2.o conftest.c >&5
-configure:7976: $? = 0
-configure:7998: result: yes
-configure:8024: checking whether the arc-linux-uclibc-gcc linker (/opt/gnutools/arc2.3-p0/uclibc-4.2.1/arc-linux-uclibc/bin/ld) supports shared libraries
-configure:9004: result: yes
-configure:9025: checking whether -lc should be explicitly linked in
-configure:9030: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:9033: $? = 0
-configure:9048: arc-linux-uclibc-gcc -shared conftest.o -v -Wl,-soname -Wl,conftest -o conftest 2\>\&1 \| grep -lc \>/dev/null 2\>\&1
-configure:9051: $? = 0
-configure:9063: result: no
-configure:9071: checking dynamic linker characteristics
-configure:9673: result: GNU/Linux ld.so
-configure:9697: checking how to hardcode library paths into programs
-configure:9722: result: immediate
-configure:9736: checking whether stripping libraries is possible
-configure:9741: result: yes
-configure:10543: checking if libtool supports shared libraries
-configure:10545: result: yes
-configure:10548: checking whether to build shared libraries
-configure:10569: result: yes
-configure:10572: checking whether to build static libraries
-configure:10576: result: yes
-configure:10670: creating libtool
-configure:11263: checking for ld used by arc-linux-uclibc-g++
-configure:11330: result: /opt/gnutools/arc2.3-p0/uclibc-4.2.1/arc-linux-uclibc/bin/ld
-configure:11339: checking if the linker (/opt/gnutools/arc2.3-p0/uclibc-4.2.1/arc-linux-uclibc/bin/ld) is GNU ld
-configure:11354: result: yes
-configure:11405: checking whether the arc-linux-uclibc-g++ linker (/opt/gnutools/arc2.3-p0/uclibc-4.2.1/arc-linux-uclibc/bin/ld) supports shared libraries
-configure:12351: result: yes
-configure:12368: arc-linux-uclibc-g++ -c -g -O2 conftest.cpp >&5
-configure:12371: $? = 0
-configure:12527: checking for arc-linux-uclibc-g++ option to produce PIC
-configure:12811: result: -fPIC
-configure:12819: checking if arc-linux-uclibc-g++ PIC flag -fPIC works
-configure:12837: arc-linux-uclibc-g++ -c -g -O2 -fPIC -DPIC conftest.cpp >&5
-configure:12841: $? = 0
-configure:12854: result: yes
-configure:12882: checking if arc-linux-uclibc-g++ static flag -static works
-configure:12910: result: yes
-configure:12920: checking if arc-linux-uclibc-g++ supports -c -o file.o
-configure:12941: arc-linux-uclibc-g++ -c -g -O2 -o out/conftest2.o conftest.cpp >&5
-configure:12945: $? = 0
-configure:12967: result: yes
-configure:12993: checking whether the arc-linux-uclibc-g++ linker (/opt/gnutools/arc2.3-p0/uclibc-4.2.1/arc-linux-uclibc/bin/ld) supports shared libraries
-configure:13019: result: yes
-configure:13086: checking dynamic linker characteristics
-configure:13636: result: GNU/Linux ld.so
-configure:13660: checking how to hardcode library paths into programs
-configure:13685: result: immediate
-configure:19910: checking for mv
-configure:19928: found /bin/mv
-configure:19940: result: /bin/mv
-configure:19950: checking for rm
-configure:19968: found /bin/rm
-configure:19980: result: /bin/rm
-configure:19990: checking for sed
-configure:20020: result: /bin/sed
-configure:20031: checking for ldconfig
-configure:20049: found /sbin/ldconfig
-configure:20062: result: /sbin/ldconfig
-configure:20072: checking Windows OS
-configure:20086: result: no
-configure:20092: checking fuse compatibility
-configure:20120: result: internal
-configure:20149: checking for pthread_create in -lpthread
-configure:20184: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c -lpthread >&5
-configure:20190: $? = 0
-configure:20208: result: yes
-configure:20481: checking for ANSI C header files
-configure:20645: result: yes
-configure:20715: checking ctype.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking ctype.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for ctype.h
-configure:20832: result: yes
-configure:20715: checking fcntl.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking fcntl.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for fcntl.h
-configure:20832: result: yes
-configure:20715: checking libgen.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking libgen.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for libgen.h
-configure:20832: result: yes
-configure:20715: checking libintl.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-conftest.c:61:21: error: libintl.h: No such file or directory
-configure:20738: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| /* end confdefs.h. */
-| #include <stdio.h>
-| #ifdef HAVE_SYS_TYPES_H
-| # include <sys/types.h>
-| #endif
-| #ifdef HAVE_SYS_STAT_H
-| # include <sys/stat.h>
-| #endif
-| #ifdef STDC_HEADERS
-| # include <stdlib.h>
-| # include <stddef.h>
-| #else
-| # ifdef HAVE_STDLIB_H
-| # include <stdlib.h>
-| # endif
-| #endif
-| #ifdef HAVE_STRING_H
-| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
-| # include <memory.h>
-| # endif
-| # include <string.h>
-| #endif
-| #ifdef HAVE_STRINGS_H
-| # include <strings.h>
-| #endif
-| #ifdef HAVE_INTTYPES_H
-| # include <inttypes.h>
-| #endif
-| #ifdef HAVE_STDINT_H
-| # include <stdint.h>
-| #endif
-| #ifdef HAVE_UNISTD_H
-| # include <unistd.h>
-| #endif
-| #include <libintl.h>
-configure:20752: result: no
-configure:20756: checking libintl.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-conftest.c:28:21: error: libintl.h: No such file or directory
-configure:20777: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| /* end confdefs.h. */
-| #include <libintl.h>
-configure:20791: result: no
-configure:20824: checking for libintl.h
-configure:20832: result: no
-configure:20715: checking limits.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking limits.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for limits.h
-configure:20832: result: yes
-configure:20715: checking locale.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking locale.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for locale.h
-configure:20832: result: yes
-configure:20715: checking mntent.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking mntent.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for mntent.h
-configure:20832: result: yes
-configure:20715: checking stddef.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking stddef.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for stddef.h
-configure:20832: result: yes
-configure:20705: checking for stdint.h
-configure:20711: result: yes
-configure:20705: checking for stdlib.h
-configure:20711: result: yes
-configure:20715: checking stdio.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking stdio.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for stdio.h
-configure:20832: result: yes
-configure:20715: checking stdarg.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking stdarg.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for stdarg.h
-configure:20832: result: yes
-configure:20705: checking for string.h
-configure:20711: result: yes
-configure:20705: checking for strings.h
-configure:20711: result: yes
-configure:20715: checking errno.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking errno.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for errno.h
-configure:20832: result: yes
-configure:20715: checking time.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking time.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for time.h
-configure:20832: result: yes
-configure:20705: checking for unistd.h
-configure:20711: result: yes
-configure:20715: checking utime.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking utime.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for utime.h
-configure:20832: result: yes
-configure:20715: checking wchar.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking wchar.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for wchar.h
-configure:20832: result: yes
-configure:20715: checking getopt.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking getopt.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for getopt.h
-configure:20832: result: yes
-configure:20715: checking features.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking features.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for features.h
-configure:20832: result: yes
-configure:20715: checking endian.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking endian.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for endian.h
-configure:20832: result: yes
-configure:20715: checking byteswap.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking byteswap.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for byteswap.h
-configure:20832: result: yes
-configure:20715: checking sys/byteorder.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-conftest.c:80:27: error: sys/byteorder.h: No such file or directory
-configure:20738: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_LOCALE_H 1
-| #define HAVE_MNTENT_H 1
-| #define HAVE_STDDEF_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STDIO_H 1
-| #define HAVE_STDARG_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_ERRNO_H 1
-| #define HAVE_TIME_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_WCHAR_H 1
-| #define HAVE_GETOPT_H 1
-| #define HAVE_FEATURES_H 1
-| #define HAVE_ENDIAN_H 1
-| #define HAVE_BYTESWAP_H 1
-| /* end confdefs.h. */
-| #include <stdio.h>
-| #ifdef HAVE_SYS_TYPES_H
-| # include <sys/types.h>
-| #endif
-| #ifdef HAVE_SYS_STAT_H
-| # include <sys/stat.h>
-| #endif
-| #ifdef STDC_HEADERS
-| # include <stdlib.h>
-| # include <stddef.h>
-| #else
-| # ifdef HAVE_STDLIB_H
-| # include <stdlib.h>
-| # endif
-| #endif
-| #ifdef HAVE_STRING_H
-| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
-| # include <memory.h>
-| # endif
-| # include <string.h>
-| #endif
-| #ifdef HAVE_STRINGS_H
-| # include <strings.h>
-| #endif
-| #ifdef HAVE_INTTYPES_H
-| # include <inttypes.h>
-| #endif
-| #ifdef HAVE_STDINT_H
-| # include <stdint.h>
-| #endif
-| #ifdef HAVE_UNISTD_H
-| # include <unistd.h>
-| #endif
-| #include <sys/byteorder.h>
-configure:20752: result: no
-configure:20756: checking sys/byteorder.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-conftest.c:47:27: error: sys/byteorder.h: No such file or directory
-configure:20777: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_LOCALE_H 1
-| #define HAVE_MNTENT_H 1
-| #define HAVE_STDDEF_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STDIO_H 1
-| #define HAVE_STDARG_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_ERRNO_H 1
-| #define HAVE_TIME_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_WCHAR_H 1
-| #define HAVE_GETOPT_H 1
-| #define HAVE_FEATURES_H 1
-| #define HAVE_ENDIAN_H 1
-| #define HAVE_BYTESWAP_H 1
-| /* end confdefs.h. */
-| #include <sys/byteorder.h>
-configure:20791: result: no
-configure:20824: checking for sys/byteorder.h
-configure:20832: result: no
-configure:20715: checking sys/endian.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-conftest.c:80:24: error: sys/endian.h: No such file or directory
-configure:20738: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_LOCALE_H 1
-| #define HAVE_MNTENT_H 1
-| #define HAVE_STDDEF_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STDIO_H 1
-| #define HAVE_STDARG_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_ERRNO_H 1
-| #define HAVE_TIME_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_WCHAR_H 1
-| #define HAVE_GETOPT_H 1
-| #define HAVE_FEATURES_H 1
-| #define HAVE_ENDIAN_H 1
-| #define HAVE_BYTESWAP_H 1
-| /* end confdefs.h. */
-| #include <stdio.h>
-| #ifdef HAVE_SYS_TYPES_H
-| # include <sys/types.h>
-| #endif
-| #ifdef HAVE_SYS_STAT_H
-| # include <sys/stat.h>
-| #endif
-| #ifdef STDC_HEADERS
-| # include <stdlib.h>
-| # include <stddef.h>
-| #else
-| # ifdef HAVE_STDLIB_H
-| # include <stdlib.h>
-| # endif
-| #endif
-| #ifdef HAVE_STRING_H
-| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
-| # include <memory.h>
-| # endif
-| # include <string.h>
-| #endif
-| #ifdef HAVE_STRINGS_H
-| # include <strings.h>
-| #endif
-| #ifdef HAVE_INTTYPES_H
-| # include <inttypes.h>
-| #endif
-| #ifdef HAVE_STDINT_H
-| # include <stdint.h>
-| #endif
-| #ifdef HAVE_UNISTD_H
-| # include <unistd.h>
-| #endif
-| #include <sys/endian.h>
-configure:20752: result: no
-configure:20756: checking sys/endian.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-conftest.c:47:24: error: sys/endian.h: No such file or directory
-configure:20777: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_LOCALE_H 1
-| #define HAVE_MNTENT_H 1
-| #define HAVE_STDDEF_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STDIO_H 1
-| #define HAVE_STDARG_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_ERRNO_H 1
-| #define HAVE_TIME_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_WCHAR_H 1
-| #define HAVE_GETOPT_H 1
-| #define HAVE_FEATURES_H 1
-| #define HAVE_ENDIAN_H 1
-| #define HAVE_BYTESWAP_H 1
-| /* end confdefs.h. */
-| #include <sys/endian.h>
-configure:20791: result: no
-configure:20824: checking for sys/endian.h
-configure:20832: result: no
-configure:20715: checking sys/param.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking sys/param.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for sys/param.h
-configure:20832: result: yes
-configure:20715: checking sys/ioctl.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking sys/ioctl.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for sys/ioctl.h
-configure:20832: result: yes
-configure:20715: checking sys/mkdev.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-conftest.c:82:23: error: sys/mkdev.h: No such file or directory
-configure:20738: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_LOCALE_H 1
-| #define HAVE_MNTENT_H 1
-| #define HAVE_STDDEF_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STDIO_H 1
-| #define HAVE_STDARG_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_ERRNO_H 1
-| #define HAVE_TIME_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_WCHAR_H 1
-| #define HAVE_GETOPT_H 1
-| #define HAVE_FEATURES_H 1
-| #define HAVE_ENDIAN_H 1
-| #define HAVE_BYTESWAP_H 1
-| #define HAVE_SYS_PARAM_H 1
-| #define HAVE_SYS_IOCTL_H 1
-| /* end confdefs.h. */
-| #include <stdio.h>
-| #ifdef HAVE_SYS_TYPES_H
-| # include <sys/types.h>
-| #endif
-| #ifdef HAVE_SYS_STAT_H
-| # include <sys/stat.h>
-| #endif
-| #ifdef STDC_HEADERS
-| # include <stdlib.h>
-| # include <stddef.h>
-| #else
-| # ifdef HAVE_STDLIB_H
-| # include <stdlib.h>
-| # endif
-| #endif
-| #ifdef HAVE_STRING_H
-| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
-| # include <memory.h>
-| # endif
-| # include <string.h>
-| #endif
-| #ifdef HAVE_STRINGS_H
-| # include <strings.h>
-| #endif
-| #ifdef HAVE_INTTYPES_H
-| # include <inttypes.h>
-| #endif
-| #ifdef HAVE_STDINT_H
-| # include <stdint.h>
-| #endif
-| #ifdef HAVE_UNISTD_H
-| # include <unistd.h>
-| #endif
-| #include <sys/mkdev.h>
-configure:20752: result: no
-configure:20756: checking sys/mkdev.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-conftest.c:49:23: error: sys/mkdev.h: No such file or directory
-configure:20777: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_LOCALE_H 1
-| #define HAVE_MNTENT_H 1
-| #define HAVE_STDDEF_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STDIO_H 1
-| #define HAVE_STDARG_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_ERRNO_H 1
-| #define HAVE_TIME_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_WCHAR_H 1
-| #define HAVE_GETOPT_H 1
-| #define HAVE_FEATURES_H 1
-| #define HAVE_ENDIAN_H 1
-| #define HAVE_BYTESWAP_H 1
-| #define HAVE_SYS_PARAM_H 1
-| #define HAVE_SYS_IOCTL_H 1
-| /* end confdefs.h. */
-| #include <sys/mkdev.h>
-configure:20791: result: no
-configure:20824: checking for sys/mkdev.h
-configure:20832: result: no
-configure:20715: checking sys/mount.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking sys/mount.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for sys/mount.h
-configure:20832: result: yes
-configure:20705: checking for sys/stat.h
-configure:20711: result: yes
-configure:20705: checking for sys/types.h
-configure:20711: result: yes
-configure:20715: checking sys/vfs.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking sys/vfs.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for sys/vfs.h
-configure:20832: result: yes
-configure:20715: checking sys/statvfs.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking sys/statvfs.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for sys/statvfs.h
-configure:20832: result: yes
-configure:20715: checking sys/sysmacros.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking sys/sysmacros.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for sys/sysmacros.h
-configure:20832: result: yes
-configure:20715: checking linux/major.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking linux/major.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for linux/major.h
-configure:20832: result: yes
-configure:20715: checking linux/fd.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking linux/fd.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for linux/fd.h
-configure:20832: result: yes
-configure:20715: checking linux/hdreg.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking linux/hdreg.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for linux/hdreg.h
-configure:20832: result: yes
-configure:20715: checking machine/endian.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-conftest.c:91:28: error: machine/endian.h: No such file or directory
-configure:20738: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_LOCALE_H 1
-| #define HAVE_MNTENT_H 1
-| #define HAVE_STDDEF_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STDIO_H 1
-| #define HAVE_STDARG_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_ERRNO_H 1
-| #define HAVE_TIME_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_WCHAR_H 1
-| #define HAVE_GETOPT_H 1
-| #define HAVE_FEATURES_H 1
-| #define HAVE_ENDIAN_H 1
-| #define HAVE_BYTESWAP_H 1
-| #define HAVE_SYS_PARAM_H 1
-| #define HAVE_SYS_IOCTL_H 1
-| #define HAVE_SYS_MOUNT_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_VFS_H 1
-| #define HAVE_SYS_STATVFS_H 1
-| #define HAVE_SYS_SYSMACROS_H 1
-| #define HAVE_LINUX_MAJOR_H 1
-| #define HAVE_LINUX_FD_H 1
-| #define HAVE_LINUX_HDREG_H 1
-| /* end confdefs.h. */
-| #include <stdio.h>
-| #ifdef HAVE_SYS_TYPES_H
-| # include <sys/types.h>
-| #endif
-| #ifdef HAVE_SYS_STAT_H
-| # include <sys/stat.h>
-| #endif
-| #ifdef STDC_HEADERS
-| # include <stdlib.h>
-| # include <stddef.h>
-| #else
-| # ifdef HAVE_STDLIB_H
-| # include <stdlib.h>
-| # endif
-| #endif
-| #ifdef HAVE_STRING_H
-| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
-| # include <memory.h>
-| # endif
-| # include <string.h>
-| #endif
-| #ifdef HAVE_STRINGS_H
-| # include <strings.h>
-| #endif
-| #ifdef HAVE_INTTYPES_H
-| # include <inttypes.h>
-| #endif
-| #ifdef HAVE_STDINT_H
-| # include <stdint.h>
-| #endif
-| #ifdef HAVE_UNISTD_H
-| # include <unistd.h>
-| #endif
-| #include <machine/endian.h>
-configure:20752: result: no
-configure:20756: checking machine/endian.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-conftest.c:58:28: error: machine/endian.h: No such file or directory
-configure:20777: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_LOCALE_H 1
-| #define HAVE_MNTENT_H 1
-| #define HAVE_STDDEF_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STDIO_H 1
-| #define HAVE_STDARG_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_ERRNO_H 1
-| #define HAVE_TIME_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_WCHAR_H 1
-| #define HAVE_GETOPT_H 1
-| #define HAVE_FEATURES_H 1
-| #define HAVE_ENDIAN_H 1
-| #define HAVE_BYTESWAP_H 1
-| #define HAVE_SYS_PARAM_H 1
-| #define HAVE_SYS_IOCTL_H 1
-| #define HAVE_SYS_MOUNT_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_VFS_H 1
-| #define HAVE_SYS_STATVFS_H 1
-| #define HAVE_SYS_SYSMACROS_H 1
-| #define HAVE_LINUX_MAJOR_H 1
-| #define HAVE_LINUX_FD_H 1
-| #define HAVE_LINUX_HDREG_H 1
-| /* end confdefs.h. */
-| #include <machine/endian.h>
-configure:20791: result: no
-configure:20824: checking for machine/endian.h
-configure:20832: result: no
-configure:20715: checking windows.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-conftest.c:91:21: error: windows.h: No such file or directory
-configure:20738: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_LOCALE_H 1
-| #define HAVE_MNTENT_H 1
-| #define HAVE_STDDEF_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STDIO_H 1
-| #define HAVE_STDARG_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_ERRNO_H 1
-| #define HAVE_TIME_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_WCHAR_H 1
-| #define HAVE_GETOPT_H 1
-| #define HAVE_FEATURES_H 1
-| #define HAVE_ENDIAN_H 1
-| #define HAVE_BYTESWAP_H 1
-| #define HAVE_SYS_PARAM_H 1
-| #define HAVE_SYS_IOCTL_H 1
-| #define HAVE_SYS_MOUNT_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_VFS_H 1
-| #define HAVE_SYS_STATVFS_H 1
-| #define HAVE_SYS_SYSMACROS_H 1
-| #define HAVE_LINUX_MAJOR_H 1
-| #define HAVE_LINUX_FD_H 1
-| #define HAVE_LINUX_HDREG_H 1
-| /* end confdefs.h. */
-| #include <stdio.h>
-| #ifdef HAVE_SYS_TYPES_H
-| # include <sys/types.h>
-| #endif
-| #ifdef HAVE_SYS_STAT_H
-| # include <sys/stat.h>
-| #endif
-| #ifdef STDC_HEADERS
-| # include <stdlib.h>
-| # include <stddef.h>
-| #else
-| # ifdef HAVE_STDLIB_H
-| # include <stdlib.h>
-| # endif
-| #endif
-| #ifdef HAVE_STRING_H
-| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
-| # include <memory.h>
-| # endif
-| # include <string.h>
-| #endif
-| #ifdef HAVE_STRINGS_H
-| # include <strings.h>
-| #endif
-| #ifdef HAVE_INTTYPES_H
-| # include <inttypes.h>
-| #endif
-| #ifdef HAVE_STDINT_H
-| # include <stdint.h>
-| #endif
-| #ifdef HAVE_UNISTD_H
-| # include <unistd.h>
-| #endif
-| #include <windows.h>
-configure:20752: result: no
-configure:20756: checking windows.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-conftest.c:58:21: error: windows.h: No such file or directory
-configure:20777: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_LOCALE_H 1
-| #define HAVE_MNTENT_H 1
-| #define HAVE_STDDEF_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STDIO_H 1
-| #define HAVE_STDARG_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_ERRNO_H 1
-| #define HAVE_TIME_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_WCHAR_H 1
-| #define HAVE_GETOPT_H 1
-| #define HAVE_FEATURES_H 1
-| #define HAVE_ENDIAN_H 1
-| #define HAVE_BYTESWAP_H 1
-| #define HAVE_SYS_PARAM_H 1
-| #define HAVE_SYS_IOCTL_H 1
-| #define HAVE_SYS_MOUNT_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_VFS_H 1
-| #define HAVE_SYS_STATVFS_H 1
-| #define HAVE_SYS_SYSMACROS_H 1
-| #define HAVE_LINUX_MAJOR_H 1
-| #define HAVE_LINUX_FD_H 1
-| #define HAVE_LINUX_HDREG_H 1
-| /* end confdefs.h. */
-| #include <windows.h>
-configure:20791: result: no
-configure:20824: checking for windows.h
-configure:20832: result: no
-configure:20715: checking syslog.h usability
-configure:20732: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20738: $? = 0
-configure:20752: result: yes
-configure:20756: checking syslog.h presence
-configure:20771: arc-linux-uclibc-gcc -E conftest.c
-configure:20777: $? = 0
-configure:20791: result: yes
-configure:20824: checking for syslog.h
-configure:20832: result: yes
-configure:20847: checking for stdbool.h that conforms to C99
-configure:20940: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20946: $? = 0
-configure:20961: result: yes
-configure:20963: checking for _Bool
-configure:20993: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:20999: $? = 0
-configure:21014: result: yes
-configure:21033: checking whether byte ordering is bigendian
-configure:21066: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:21072: $? = 0
-configure:21104: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-conftest.c: In function 'main':
-conftest.c:68: error: 'not' undeclared (first use in this function)
-conftest.c:68: error: (Each undeclared identifier is reported only once
-conftest.c:68: error: for each function it appears in.)
-conftest.c:68: error: expected ';' before 'big'
-configure:21110: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_LOCALE_H 1
-| #define HAVE_MNTENT_H 1
-| #define HAVE_STDDEF_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STDIO_H 1
-| #define HAVE_STDARG_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_ERRNO_H 1
-| #define HAVE_TIME_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_WCHAR_H 1
-| #define HAVE_GETOPT_H 1
-| #define HAVE_FEATURES_H 1
-| #define HAVE_ENDIAN_H 1
-| #define HAVE_BYTESWAP_H 1
-| #define HAVE_SYS_PARAM_H 1
-| #define HAVE_SYS_IOCTL_H 1
-| #define HAVE_SYS_MOUNT_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_VFS_H 1
-| #define HAVE_SYS_STATVFS_H 1
-| #define HAVE_SYS_SYSMACROS_H 1
-| #define HAVE_LINUX_MAJOR_H 1
-| #define HAVE_LINUX_FD_H 1
-| #define HAVE_LINUX_HDREG_H 1
-| #define HAVE_SYSLOG_H 1
-| #define HAVE__BOOL 1
-| #define HAVE_STDBOOL_H 1
-| /* end confdefs.h. */
-| #include <sys/types.h>
-| #include <sys/param.h>
-|
-| int
-| main ()
-| {
-| #if BYTE_ORDER != BIG_ENDIAN
-| not big endian
-| #endif
-|
-| ;
-| return 0;
-| }
-configure:21250: result: no
-configure:21276: checking for inline
-configure:21302: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:21308: $? = 0
-configure:21326: result: inline
-configure:21345: checking for off_t
-configure:21375: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:21381: $? = 0
-configure:21396: result: yes
-configure:21408: checking for size_t
-configure:21438: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:21444: $? = 0
-configure:21459: result: yes
-configure:21471: checking for struct stat.st_blocks
-configure:21499: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:21505: $? = 0
-configure:21562: result: yes
-configure:21585: checking for struct stat.st_rdev
-configure:21613: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:21619: $? = 0
-configure:21676: result: yes
-configure:21687: checking for struct stat.st_atim
-configure:21715: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-conftest.c: In function 'main':
-conftest.c:102: error: 'struct stat' has no member named 'st_atim'
-configure:21721: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_LOCALE_H 1
-| #define HAVE_MNTENT_H 1
-| #define HAVE_STDDEF_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STDIO_H 1
-| #define HAVE_STDARG_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_ERRNO_H 1
-| #define HAVE_TIME_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_WCHAR_H 1
-| #define HAVE_GETOPT_H 1
-| #define HAVE_FEATURES_H 1
-| #define HAVE_ENDIAN_H 1
-| #define HAVE_BYTESWAP_H 1
-| #define HAVE_SYS_PARAM_H 1
-| #define HAVE_SYS_IOCTL_H 1
-| #define HAVE_SYS_MOUNT_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_VFS_H 1
-| #define HAVE_SYS_STATVFS_H 1
-| #define HAVE_SYS_SYSMACROS_H 1
-| #define HAVE_LINUX_MAJOR_H 1
-| #define HAVE_LINUX_FD_H 1
-| #define HAVE_LINUX_HDREG_H 1
-| #define HAVE_SYSLOG_H 1
-| #define HAVE__BOOL 1
-| #define HAVE_STDBOOL_H 1
-| #define WORDS_LITTLEENDIAN 1
-| #define HAVE_STRUCT_STAT_ST_BLOCKS 1
-| #define HAVE_ST_BLOCKS 1
-| #define HAVE_STRUCT_STAT_ST_RDEV 1
-| /* end confdefs.h. */
-| #include <stdio.h>
-| #ifdef HAVE_SYS_TYPES_H
-| # include <sys/types.h>
-| #endif
-| #ifdef HAVE_SYS_STAT_H
-| # include <sys/stat.h>
-| #endif
-| #ifdef STDC_HEADERS
-| # include <stdlib.h>
-| # include <stddef.h>
-| #else
-| # ifdef HAVE_STDLIB_H
-| # include <stdlib.h>
-| # endif
-| #endif
-| #ifdef HAVE_STRING_H
-| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
-| # include <memory.h>
-| # endif
-| # include <string.h>
-| #endif
-| #ifdef HAVE_STRINGS_H
-| # include <strings.h>
-| #endif
-| #ifdef HAVE_INTTYPES_H
-| # include <inttypes.h>
-| #endif
-| #ifdef HAVE_STDINT_H
-| # include <stdint.h>
-| #endif
-| #ifdef HAVE_UNISTD_H
-| # include <unistd.h>
-| #endif
-| int
-| main ()
-| {
-| static struct stat ac_aggr;
-| if (ac_aggr.st_atim)
-| return 0;
-| ;
-| return 0;
-| }
-configure:21754: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-conftest.c: In function 'main':
-conftest.c:102: error: 'struct stat' has no member named 'st_atim'
-configure:21760: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_LOCALE_H 1
-| #define HAVE_MNTENT_H 1
-| #define HAVE_STDDEF_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STDIO_H 1
-| #define HAVE_STDARG_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_ERRNO_H 1
-| #define HAVE_TIME_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_WCHAR_H 1
-| #define HAVE_GETOPT_H 1
-| #define HAVE_FEATURES_H 1
-| #define HAVE_ENDIAN_H 1
-| #define HAVE_BYTESWAP_H 1
-| #define HAVE_SYS_PARAM_H 1
-| #define HAVE_SYS_IOCTL_H 1
-| #define HAVE_SYS_MOUNT_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_VFS_H 1
-| #define HAVE_SYS_STATVFS_H 1
-| #define HAVE_SYS_SYSMACROS_H 1
-| #define HAVE_LINUX_MAJOR_H 1
-| #define HAVE_LINUX_FD_H 1
-| #define HAVE_LINUX_HDREG_H 1
-| #define HAVE_SYSLOG_H 1
-| #define HAVE__BOOL 1
-| #define HAVE_STDBOOL_H 1
-| #define WORDS_LITTLEENDIAN 1
-| #define HAVE_STRUCT_STAT_ST_BLOCKS 1
-| #define HAVE_ST_BLOCKS 1
-| #define HAVE_STRUCT_STAT_ST_RDEV 1
-| /* end confdefs.h. */
-| #include <stdio.h>
-| #ifdef HAVE_SYS_TYPES_H
-| # include <sys/types.h>
-| #endif
-| #ifdef HAVE_SYS_STAT_H
-| # include <sys/stat.h>
-| #endif
-| #ifdef STDC_HEADERS
-| # include <stdlib.h>
-| # include <stddef.h>
-| #else
-| # ifdef HAVE_STDLIB_H
-| # include <stdlib.h>
-| # endif
-| #endif
-| #ifdef HAVE_STRING_H
-| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
-| # include <memory.h>
-| # endif
-| # include <string.h>
-| #endif
-| #ifdef HAVE_STRINGS_H
-| # include <strings.h>
-| #endif
-| #ifdef HAVE_INTTYPES_H
-| # include <inttypes.h>
-| #endif
-| #ifdef HAVE_STDINT_H
-| # include <stdint.h>
-| #endif
-| #ifdef HAVE_UNISTD_H
-| # include <unistd.h>
-| #endif
-| int
-| main ()
-| {
-| static struct stat ac_aggr;
-| if (sizeof ac_aggr.st_atim)
-| return 0;
-| ;
-| return 0;
-| }
-configure:21778: result: no
-configure:21789: checking for struct stat.st_atimespec
-configure:21817: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-conftest.c: In function 'main':
-conftest.c:102: error: 'struct stat' has no member named 'st_atimespec'
-configure:21823: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_LOCALE_H 1
-| #define HAVE_MNTENT_H 1
-| #define HAVE_STDDEF_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STDIO_H 1
-| #define HAVE_STDARG_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_ERRNO_H 1
-| #define HAVE_TIME_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_WCHAR_H 1
-| #define HAVE_GETOPT_H 1
-| #define HAVE_FEATURES_H 1
-| #define HAVE_ENDIAN_H 1
-| #define HAVE_BYTESWAP_H 1
-| #define HAVE_SYS_PARAM_H 1
-| #define HAVE_SYS_IOCTL_H 1
-| #define HAVE_SYS_MOUNT_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_VFS_H 1
-| #define HAVE_SYS_STATVFS_H 1
-| #define HAVE_SYS_SYSMACROS_H 1
-| #define HAVE_LINUX_MAJOR_H 1
-| #define HAVE_LINUX_FD_H 1
-| #define HAVE_LINUX_HDREG_H 1
-| #define HAVE_SYSLOG_H 1
-| #define HAVE__BOOL 1
-| #define HAVE_STDBOOL_H 1
-| #define WORDS_LITTLEENDIAN 1
-| #define HAVE_STRUCT_STAT_ST_BLOCKS 1
-| #define HAVE_ST_BLOCKS 1
-| #define HAVE_STRUCT_STAT_ST_RDEV 1
-| /* end confdefs.h. */
-| #include <stdio.h>
-| #ifdef HAVE_SYS_TYPES_H
-| # include <sys/types.h>
-| #endif
-| #ifdef HAVE_SYS_STAT_H
-| # include <sys/stat.h>
-| #endif
-| #ifdef STDC_HEADERS
-| # include <stdlib.h>
-| # include <stddef.h>
-| #else
-| # ifdef HAVE_STDLIB_H
-| # include <stdlib.h>
-| # endif
-| #endif
-| #ifdef HAVE_STRING_H
-| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
-| # include <memory.h>
-| # endif
-| # include <string.h>
-| #endif
-| #ifdef HAVE_STRINGS_H
-| # include <strings.h>
-| #endif
-| #ifdef HAVE_INTTYPES_H
-| # include <inttypes.h>
-| #endif
-| #ifdef HAVE_STDINT_H
-| # include <stdint.h>
-| #endif
-| #ifdef HAVE_UNISTD_H
-| # include <unistd.h>
-| #endif
-| int
-| main ()
-| {
-| static struct stat ac_aggr;
-| if (ac_aggr.st_atimespec)
-| return 0;
-| ;
-| return 0;
-| }
-configure:21856: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-conftest.c: In function 'main':
-conftest.c:102: error: 'struct stat' has no member named 'st_atimespec'
-configure:21862: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_LOCALE_H 1
-| #define HAVE_MNTENT_H 1
-| #define HAVE_STDDEF_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STDIO_H 1
-| #define HAVE_STDARG_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_ERRNO_H 1
-| #define HAVE_TIME_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_WCHAR_H 1
-| #define HAVE_GETOPT_H 1
-| #define HAVE_FEATURES_H 1
-| #define HAVE_ENDIAN_H 1
-| #define HAVE_BYTESWAP_H 1
-| #define HAVE_SYS_PARAM_H 1
-| #define HAVE_SYS_IOCTL_H 1
-| #define HAVE_SYS_MOUNT_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_VFS_H 1
-| #define HAVE_SYS_STATVFS_H 1
-| #define HAVE_SYS_SYSMACROS_H 1
-| #define HAVE_LINUX_MAJOR_H 1
-| #define HAVE_LINUX_FD_H 1
-| #define HAVE_LINUX_HDREG_H 1
-| #define HAVE_SYSLOG_H 1
-| #define HAVE__BOOL 1
-| #define HAVE_STDBOOL_H 1
-| #define WORDS_LITTLEENDIAN 1
-| #define HAVE_STRUCT_STAT_ST_BLOCKS 1
-| #define HAVE_ST_BLOCKS 1
-| #define HAVE_STRUCT_STAT_ST_RDEV 1
-| /* end confdefs.h. */
-| #include <stdio.h>
-| #ifdef HAVE_SYS_TYPES_H
-| # include <sys/types.h>
-| #endif
-| #ifdef HAVE_SYS_STAT_H
-| # include <sys/stat.h>
-| #endif
-| #ifdef STDC_HEADERS
-| # include <stdlib.h>
-| # include <stddef.h>
-| #else
-| # ifdef HAVE_STDLIB_H
-| # include <stdlib.h>
-| # endif
-| #endif
-| #ifdef HAVE_STRING_H
-| # if !defined STDC_HEADERS && defined HAVE_MEMORY_H
-| # include <memory.h>
-| # endif
-| # include <string.h>
-| #endif
-| #ifdef HAVE_STRINGS_H
-| # include <strings.h>
-| #endif
-| #ifdef HAVE_INTTYPES_H
-| # include <inttypes.h>
-| #endif
-| #ifdef HAVE_STDINT_H
-| # include <stdint.h>
-| #endif
-| #ifdef HAVE_UNISTD_H
-| # include <unistd.h>
-| #endif
-| int
-| main ()
-| {
-| static struct stat ac_aggr;
-| if (sizeof ac_aggr.st_atimespec)
-| return 0;
-| ;
-| return 0;
-| }
-configure:21880: result: no
-configure:21891: checking for struct stat.st_atimensec
-configure:21919: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:21925: $? = 0
-configure:21982: result: yes
-configure:22152: checking for library containing getmntent
-configure:22193: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:22199: $? = 0
-configure:22227: result: none required
-configure:22244: checking whether mbrtowc and mbstate_t are properly declared
-configure:22274: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:22280: $? = 0
-configure:22297: result: yes
-configure:22307: checking for working memcmp
-configure:22388: result: no
-configure:22397: checking whether lstat dereferences a symlink specified with a trailing slash
-configure:22468: result: no
-configure:22487: checking whether stat accepts an empty string
-configure:22545: result: yes
-configure:22565: checking for strftime
-configure:22621: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-conftest.c:92: warning: conflicting types for built-in function 'strftime'
-configure:22627: $? = 0
-configure:22645: result: yes
-configure:22734: checking for utime.h
-configure:22740: result: yes
-configure:22882: checking whether utime accepts a null argument
-configure:22949: result: no
-configure:22964: checking for vprintf
-configure:23020: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-conftest.c:94: warning: conflicting types for built-in function 'vprintf'
-configure:23026: $? = 0
-configure:23044: result: yes
-configure:23051: checking for _doprnt
-configure:23107: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-/tmp/ccW5tSya.o: In function `main':
-/mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/conftest.c:106: undefined reference to `_doprnt'
-collect2: ld returned 1 exit status
-configure:23113: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_LOCALE_H 1
-| #define HAVE_MNTENT_H 1
-| #define HAVE_STDDEF_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STDIO_H 1
-| #define HAVE_STDARG_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_ERRNO_H 1
-| #define HAVE_TIME_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_WCHAR_H 1
-| #define HAVE_GETOPT_H 1
-| #define HAVE_FEATURES_H 1
-| #define HAVE_ENDIAN_H 1
-| #define HAVE_BYTESWAP_H 1
-| #define HAVE_SYS_PARAM_H 1
-| #define HAVE_SYS_IOCTL_H 1
-| #define HAVE_SYS_MOUNT_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_VFS_H 1
-| #define HAVE_SYS_STATVFS_H 1
-| #define HAVE_SYS_SYSMACROS_H 1
-| #define HAVE_LINUX_MAJOR_H 1
-| #define HAVE_LINUX_FD_H 1
-| #define HAVE_LINUX_HDREG_H 1
-| #define HAVE_SYSLOG_H 1
-| #define HAVE__BOOL 1
-| #define HAVE_STDBOOL_H 1
-| #define WORDS_LITTLEENDIAN 1
-| #define HAVE_STRUCT_STAT_ST_BLOCKS 1
-| #define HAVE_ST_BLOCKS 1
-| #define HAVE_STRUCT_STAT_ST_RDEV 1
-| #define HAVE_STRUCT_STAT_ST_ATIMENSEC 1
-| #define HAVE_GETMNTENT
-| #define HAVE_MBRTOWC 1
-| #define HAVE_STAT_EMPTY_STRING_BUG 1
-| #define HAVE_STRFTIME 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_VPRINTF 1
-| /* end confdefs.h. */
-| /* Define _doprnt to an innocuous variant, in case <limits.h> declares _doprnt.
-| For example, HP-UX 11i <limits.h> declares gettimeofday. */
-| #define _doprnt innocuous__doprnt
-|
-| /* System header to define __stub macros and hopefully few prototypes,
-| which can conflict with char _doprnt (); below.
-| Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-| <limits.h> exists even on freestanding compilers. */
-|
-| #ifdef __STDC__
-| # include <limits.h>
-| #else
-| # include <assert.h>
-| #endif
-|
-| #undef _doprnt
-|
-| /* Override any GCC internal prototype to avoid an error.
-| Use char because int might match the return type of a GCC
-| builtin and then its argument prototype would still apply. */
-| #ifdef __cplusplus
-| extern "C"
-| #endif
-| 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
-| #endif
-|
-| int
-| main ()
-| {
-| return _doprnt ();
-| ;
-| return 0;
-| }
-configure:23130: result: no
-configure:23181: checking for atexit
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for basename
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for daemon
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for dup2
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for fdatasync
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for ffs
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-conftest.c:100: warning: conflicting types for built-in function 'ffs'
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for getopt_long
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for hasmntopt
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for mbsinit
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for memmove
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-conftest.c:104: warning: conflicting types for built-in function 'memmove'
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for memset
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-conftest.c:105: warning: conflicting types for built-in function 'memset'
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for realpath
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for regcomp
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for setlocale
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for setxattr
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for strcasecmp
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-conftest.c:110: warning: conflicting types for built-in function 'strcasecmp'
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for strchr
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-conftest.c:111: warning: conflicting types for built-in function 'strchr'
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for strdup
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-conftest.c:112: warning: conflicting types for built-in function 'strdup'
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for strerror
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for strnlen
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for strsep
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for strtol
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for strtoul
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for sysconf
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for utime
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for utimensat
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-/tmp/ccaBiGqI.o: In function `main':
-/mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/conftest.c:131: undefined reference to `utimensat'
-collect2: ld returned 1 exit status
-configure:23243: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_LOCALE_H 1
-| #define HAVE_MNTENT_H 1
-| #define HAVE_STDDEF_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STDIO_H 1
-| #define HAVE_STDARG_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_ERRNO_H 1
-| #define HAVE_TIME_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_WCHAR_H 1
-| #define HAVE_GETOPT_H 1
-| #define HAVE_FEATURES_H 1
-| #define HAVE_ENDIAN_H 1
-| #define HAVE_BYTESWAP_H 1
-| #define HAVE_SYS_PARAM_H 1
-| #define HAVE_SYS_IOCTL_H 1
-| #define HAVE_SYS_MOUNT_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_VFS_H 1
-| #define HAVE_SYS_STATVFS_H 1
-| #define HAVE_SYS_SYSMACROS_H 1
-| #define HAVE_LINUX_MAJOR_H 1
-| #define HAVE_LINUX_FD_H 1
-| #define HAVE_LINUX_HDREG_H 1
-| #define HAVE_SYSLOG_H 1
-| #define HAVE__BOOL 1
-| #define HAVE_STDBOOL_H 1
-| #define WORDS_LITTLEENDIAN 1
-| #define HAVE_STRUCT_STAT_ST_BLOCKS 1
-| #define HAVE_ST_BLOCKS 1
-| #define HAVE_STRUCT_STAT_ST_RDEV 1
-| #define HAVE_STRUCT_STAT_ST_ATIMENSEC 1
-| #define HAVE_GETMNTENT
-| #define HAVE_MBRTOWC 1
-| #define HAVE_STAT_EMPTY_STRING_BUG 1
-| #define HAVE_STRFTIME 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_VPRINTF 1
-| #define HAVE_ATEXIT 1
-| #define HAVE_BASENAME 1
-| #define HAVE_DAEMON 1
-| #define HAVE_DUP2 1
-| #define HAVE_FDATASYNC 1
-| #define HAVE_FFS 1
-| #define HAVE_GETOPT_LONG 1
-| #define HAVE_HASMNTOPT 1
-| #define HAVE_MBSINIT 1
-| #define HAVE_MEMMOVE 1
-| #define HAVE_MEMSET 1
-| #define HAVE_REALPATH 1
-| #define HAVE_REGCOMP 1
-| #define HAVE_SETLOCALE 1
-| #define HAVE_SETXATTR 1
-| #define HAVE_STRCASECMP 1
-| #define HAVE_STRCHR 1
-| #define HAVE_STRDUP 1
-| #define HAVE_STRERROR 1
-| #define HAVE_STRNLEN 1
-| #define HAVE_STRSEP 1
-| #define HAVE_STRTOL 1
-| #define HAVE_STRTOUL 1
-| #define HAVE_SYSCONF 1
-| #define HAVE_UTIME 1
-| /* end confdefs.h. */
-| /* Define utimensat to an innocuous variant, in case <limits.h> declares utimensat.
-| For example, HP-UX 11i <limits.h> declares gettimeofday. */
-| #define utimensat innocuous_utimensat
-|
-| /* System header to define __stub macros and hopefully few prototypes,
-| which can conflict with char utimensat (); below.
-| Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-| <limits.h> exists even on freestanding compilers. */
-|
-| #ifdef __STDC__
-| # include <limits.h>
-| #else
-| # include <assert.h>
-| #endif
-|
-| #undef utimensat
-|
-| /* Override any GCC internal prototype to avoid an error.
-| Use char because int might match the return type of a GCC
-| builtin and then its argument prototype would still apply. */
-| #ifdef __cplusplus
-| extern "C"
-| #endif
-| char utimensat ();
-| /* 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_utimensat || defined __stub___utimensat
-| choke me
-| #endif
-|
-| int
-| main ()
-| {
-| return utimensat ();
-| ;
-| return 0;
-| }
-configure:23261: result: no
-configure:23181: checking for gettimeofday
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for clock_gettime
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23181: checking for fork
-configure:23237: arc-linux-uclibc-gcc -o conftest -mA7 -g conftest.c >&5
-conftest.c:122: warning: conflicting types for built-in function 'fork'
-configure:23243: $? = 0
-configure:23261: result: yes
-configure:23278: checking for special C compiler options needed for large files
-configure:23371: result: no
-configure:23377: checking for _FILE_OFFSET_BITS value needed for large files
-configure:23412: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-conftest.c:106: warning: left shift count >= width of type
-conftest.c:106: warning: left shift count >= width of type
-conftest.c:108: error: size of array 'off_t_is_large' is negative
-configure:23418: $? = 1
-configure: failed program was:
-| /* confdefs.h. */
-| #define PACKAGE_NAME "ntfs-3g"
-| #define PACKAGE_TARNAME "ntfs-3g"
-| #define PACKAGE_VERSION "2010.5.16"
-| #define PACKAGE_STRING "ntfs-3g 2010.5.16"
-| #define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-| #define PACKAGE "ntfs-3g"
-| #define VERSION "2010.5.16"
-| #define _GNU_SOURCE 1
-| #define STDC_HEADERS 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_MEMORY_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_INTTYPES_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_DLFCN_H 1
-| #define _REENTRANT 1
-| #define FUSE_INTERNAL 1
-| #define STDC_HEADERS 1
-| #define HAVE_CTYPE_H 1
-| #define HAVE_FCNTL_H 1
-| #define HAVE_LIBGEN_H 1
-| #define HAVE_LIMITS_H 1
-| #define HAVE_LOCALE_H 1
-| #define HAVE_MNTENT_H 1
-| #define HAVE_STDDEF_H 1
-| #define HAVE_STDINT_H 1
-| #define HAVE_STDLIB_H 1
-| #define HAVE_STDIO_H 1
-| #define HAVE_STDARG_H 1
-| #define HAVE_STRING_H 1
-| #define HAVE_STRINGS_H 1
-| #define HAVE_ERRNO_H 1
-| #define HAVE_TIME_H 1
-| #define HAVE_UNISTD_H 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_WCHAR_H 1
-| #define HAVE_GETOPT_H 1
-| #define HAVE_FEATURES_H 1
-| #define HAVE_ENDIAN_H 1
-| #define HAVE_BYTESWAP_H 1
-| #define HAVE_SYS_PARAM_H 1
-| #define HAVE_SYS_IOCTL_H 1
-| #define HAVE_SYS_MOUNT_H 1
-| #define HAVE_SYS_STAT_H 1
-| #define HAVE_SYS_TYPES_H 1
-| #define HAVE_SYS_VFS_H 1
-| #define HAVE_SYS_STATVFS_H 1
-| #define HAVE_SYS_SYSMACROS_H 1
-| #define HAVE_LINUX_MAJOR_H 1
-| #define HAVE_LINUX_FD_H 1
-| #define HAVE_LINUX_HDREG_H 1
-| #define HAVE_SYSLOG_H 1
-| #define HAVE__BOOL 1
-| #define HAVE_STDBOOL_H 1
-| #define WORDS_LITTLEENDIAN 1
-| #define HAVE_STRUCT_STAT_ST_BLOCKS 1
-| #define HAVE_ST_BLOCKS 1
-| #define HAVE_STRUCT_STAT_ST_RDEV 1
-| #define HAVE_STRUCT_STAT_ST_ATIMENSEC 1
-| #define HAVE_GETMNTENT
-| #define HAVE_MBRTOWC 1
-| #define HAVE_STAT_EMPTY_STRING_BUG 1
-| #define HAVE_STRFTIME 1
-| #define HAVE_UTIME_H 1
-| #define HAVE_VPRINTF 1
-| #define HAVE_ATEXIT 1
-| #define HAVE_BASENAME 1
-| #define HAVE_DAEMON 1
-| #define HAVE_DUP2 1
-| #define HAVE_FDATASYNC 1
-| #define HAVE_FFS 1
-| #define HAVE_GETOPT_LONG 1
-| #define HAVE_HASMNTOPT 1
-| #define HAVE_MBSINIT 1
-| #define HAVE_MEMMOVE 1
-| #define HAVE_MEMSET 1
-| #define HAVE_REALPATH 1
-| #define HAVE_REGCOMP 1
-| #define HAVE_SETLOCALE 1
-| #define HAVE_SETXATTR 1
-| #define HAVE_STRCASECMP 1
-| #define HAVE_STRCHR 1
-| #define HAVE_STRDUP 1
-| #define HAVE_STRERROR 1
-| #define HAVE_STRNLEN 1
-| #define HAVE_STRSEP 1
-| #define HAVE_STRTOL 1
-| #define HAVE_STRTOUL 1
-| #define HAVE_SYSCONF 1
-| #define HAVE_UTIME 1
-| #define HAVE_GETTIMEOFDAY 1
-| #define HAVE_CLOCK_GETTIME 1
-| #define HAVE_FORK 1
-| /* end confdefs.h. */
-| #include <sys/types.h>
-| /* Check that off_t can represent 2**63 - 1 correctly.
-| We can't simply define LARGE_OFF_T 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;
-| }
-configure:23462: arc-linux-uclibc-gcc -c -mA7 -g conftest.c >&5
-configure:23468: $? = 0
-configure:23486: result: 64
-configure:23957: creating ./config.status
-
-## ---------------------- ##
-## Running config.status. ##
-## ---------------------- ##
-
-This file was extended by ntfs-3g config.status 2010.5.16, which was
-generated by GNU Autoconf 2.61. Invocation command line was
-
- CONFIG_FILES =
- CONFIG_HEADERS =
- CONFIG_LINKS =
- CONFIG_COMMANDS =
- $ ./config.status
-
-on announce
-
-config.status:714: creating Makefile
-config.status:714: creating include/Makefile
-config.status:714: creating include/fuse-lite/Makefile
-config.status:714: creating include/ntfs-3g/Makefile
-config.status:714: creating libfuse-lite/Makefile
-config.status:714: creating libntfs-3g/Makefile
-config.status:714: creating libntfs-3g/libntfs-3g.pc
-config.status:714: creating libntfs-3g/libntfs-3g.script.so
-config.status:714: creating src/Makefile
-config.status:714: creating src/ntfs-3g.8
-config.status:714: creating src/ntfs-3g.probe.8
-config.status:714: creating src/ntfs-3g.usermap.8
-config.status:714: creating src/ntfs-3g.secaudit.8
-config.status:714: creating config.h
-config.status:1084: executing depfiles commands
-
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-
-ac_cv_build=i686-pc-linux-gnu
-ac_cv_c_bigendian=no
-ac_cv_c_compiler_gnu=yes
-ac_cv_c_inline=inline
-ac_cv_cxx_compiler_gnu=yes
-ac_cv_env_CCC_set=
-ac_cv_env_CCC_value=
-ac_cv_env_CC_set=set
-ac_cv_env_CC_value=arc-linux-uclibc-gcc
-ac_cv_env_CFLAGS_set=set
-ac_cv_env_CFLAGS_value='-mA7 -g'
-ac_cv_env_CPPFLAGS_set=
-ac_cv_env_CPPFLAGS_value=
-ac_cv_env_CPP_set=
-ac_cv_env_CPP_value=
-ac_cv_env_CXXCPP_set=
-ac_cv_env_CXXCPP_value=
-ac_cv_env_CXXFLAGS_set=
-ac_cv_env_CXXFLAGS_value=
-ac_cv_env_CXX_set=
-ac_cv_env_CXX_value=
-ac_cv_env_F77_set=
-ac_cv_env_F77_value=
-ac_cv_env_FFLAGS_set=
-ac_cv_env_FFLAGS_value=
-ac_cv_env_FUSE_MODULE_CFLAGS_set=
-ac_cv_env_FUSE_MODULE_CFLAGS_value=
-ac_cv_env_FUSE_MODULE_LIBS_set=
-ac_cv_env_FUSE_MODULE_LIBS_value=
-ac_cv_env_LDCONFIG_set=
-ac_cv_env_LDCONFIG_value=
-ac_cv_env_LDFLAGS_set=
-ac_cv_env_LDFLAGS_value=
-ac_cv_env_LIBS_set=
-ac_cv_env_LIBS_value=
-ac_cv_env_PKG_CONFIG_set=
-ac_cv_env_PKG_CONFIG_value=
-ac_cv_env_build_alias_set=
-ac_cv_env_build_alias_value=
-ac_cv_env_host_alias_set=set
-ac_cv_env_host_alias_value=arc-linux-uclibc
-ac_cv_env_target_alias_set=
-ac_cv_env_target_alias_value=
-ac_cv_f77_compiler_gnu=no
-ac_cv_func__doprnt=no
-ac_cv_func_atexit=yes
-ac_cv_func_basename=yes
-ac_cv_func_clock_gettime=yes
-ac_cv_func_daemon=yes
-ac_cv_func_dup2=yes
-ac_cv_func_fdatasync=yes
-ac_cv_func_ffs=yes
-ac_cv_func_fork=yes
-ac_cv_func_getmntent=yes
-ac_cv_func_getopt_long=yes
-ac_cv_func_gettimeofday=yes
-ac_cv_func_hasmntopt=yes
-ac_cv_func_lstat_dereferences_slashed_symlink=no
-ac_cv_func_mbrtowc=yes
-ac_cv_func_mbsinit=yes
-ac_cv_func_memcmp_working=no
-ac_cv_func_memmove=yes
-ac_cv_func_memset=yes
-ac_cv_func_realpath=yes
-ac_cv_func_regcomp=yes
-ac_cv_func_setlocale=yes
-ac_cv_func_setxattr=yes
-ac_cv_func_stat_empty_string_bug=yes
-ac_cv_func_strcasecmp=yes
-ac_cv_func_strchr=yes
-ac_cv_func_strdup=yes
-ac_cv_func_strerror=yes
-ac_cv_func_strftime=yes
-ac_cv_func_strnlen=yes
-ac_cv_func_strsep=yes
-ac_cv_func_strtol=yes
-ac_cv_func_strtoul=yes
-ac_cv_func_sysconf=yes
-ac_cv_func_utime=yes
-ac_cv_func_utime_null=no
-ac_cv_func_utimensat=no
-ac_cv_func_vprintf=yes
-ac_cv_header_byteswap_h=yes
-ac_cv_header_ctype_h=yes
-ac_cv_header_dlfcn_h=yes
-ac_cv_header_endian_h=yes
-ac_cv_header_errno_h=yes
-ac_cv_header_fcntl_h=yes
-ac_cv_header_features_h=yes
-ac_cv_header_getopt_h=yes
-ac_cv_header_inttypes_h=yes
-ac_cv_header_libgen_h=yes
-ac_cv_header_libintl_h=no
-ac_cv_header_limits_h=yes
-ac_cv_header_linux_fd_h=yes
-ac_cv_header_linux_hdreg_h=yes
-ac_cv_header_linux_major_h=yes
-ac_cv_header_locale_h=yes
-ac_cv_header_machine_endian_h=no
-ac_cv_header_memory_h=yes
-ac_cv_header_mntent_h=yes
-ac_cv_header_stdarg_h=yes
-ac_cv_header_stdbool_h=yes
-ac_cv_header_stdc=yes
-ac_cv_header_stddef_h=yes
-ac_cv_header_stdint_h=yes
-ac_cv_header_stdio_h=yes
-ac_cv_header_stdlib_h=yes
-ac_cv_header_string_h=yes
-ac_cv_header_strings_h=yes
-ac_cv_header_sys_byteorder_h=no
-ac_cv_header_sys_endian_h=no
-ac_cv_header_sys_ioctl_h=yes
-ac_cv_header_sys_mkdev_h=no
-ac_cv_header_sys_mount_h=yes
-ac_cv_header_sys_param_h=yes
-ac_cv_header_sys_stat_h=yes
-ac_cv_header_sys_statvfs_h=yes
-ac_cv_header_sys_sysmacros_h=yes
-ac_cv_header_sys_types_h=yes
-ac_cv_header_sys_vfs_h=yes
-ac_cv_header_syslog_h=yes
-ac_cv_header_time_h=yes
-ac_cv_header_unistd_h=yes
-ac_cv_header_utime_h=yes
-ac_cv_header_wchar_h=yes
-ac_cv_header_windows_h=no
-ac_cv_host=arc-unknown-linux-uclibc
-ac_cv_lib_pthread_pthread_create=yes
-ac_cv_member_struct_stat_st_atim=no
-ac_cv_member_struct_stat_st_atimensec=yes
-ac_cv_member_struct_stat_st_atimespec=no
-ac_cv_member_struct_stat_st_blocks=yes
-ac_cv_member_struct_stat_st_rdev=yes
-ac_cv_objext=o
-ac_cv_path_EGREP='/bin/grep -E'
-ac_cv_path_GREP=/bin/grep
-ac_cv_path_LDCONFIG=/sbin/ldconfig
-ac_cv_path_MV=/bin/mv
-ac_cv_path_RM=/bin/rm
-ac_cv_path_SED=/bin/sed
-ac_cv_path_install='/usr/bin/install -c'
-ac_cv_path_mkdir=/bin/mkdir
-ac_cv_prog_AR=arc-linux-uclibc-ar
-ac_cv_prog_AWK=mawk
-ac_cv_prog_CC=arc-linux-uclibc-gcc
-ac_cv_prog_CPP='arc-linux-uclibc-gcc -E'
-ac_cv_prog_CXX=arc-linux-uclibc-g++
-ac_cv_prog_CXXCPP='arc-linux-uclibc-g++ -E'
-ac_cv_prog_RANLIB=arc-linux-uclibc-ranlib
-ac_cv_prog_STRIP=arc-linux-uclibc-strip
-ac_cv_prog_cc_arc_linux_uclibc_gcc_c_o=yes
-ac_cv_prog_cc_c89=
-ac_cv_prog_cc_g=yes
-ac_cv_prog_cxx_g=yes
-ac_cv_prog_f77_g=no
-ac_cv_prog_make_make_set=yes
-ac_cv_search_getmntent='none required'
-ac_cv_sys_file_offset_bits=64
-ac_cv_sys_largefile_CC=no
-ac_cv_target=arc-unknown-linux-uclibc
-ac_cv_type__Bool=yes
-ac_cv_type_off_t=yes
-ac_cv_type_size_t=yes
-am_cv_CC_dependencies_compiler_type=gcc3
-am_cv_CXX_dependencies_compiler_type=gcc3
-lt_cv_deplibs_check_method=pass_all
-lt_cv_file_magic_cmd='$MAGIC_CMD'
-lt_cv_file_magic_test_file=
-lt_cv_ld_reload_flag=-r
-lt_cv_objdir=.libs
-lt_cv_path_LD=/opt/gnutools/arc2.3-p0/uclibc-4.2.1/arc-linux-uclibc/bin/ld
-lt_cv_path_LDCXX=/opt/gnutools/arc2.3-p0/uclibc-4.2.1/arc-linux-uclibc/bin/ld
-lt_cv_path_NM='/opt/gnutools/arc2.3-p0/uclibc-4.2.1/bin/arc-linux-uclibc-nm -B'
-lt_cv_path_SED=/bin/sed
-lt_cv_prog_compiler_c_o=yes
-lt_cv_prog_compiler_c_o_CXX=yes
-lt_cv_prog_compiler_pic_works=yes
-lt_cv_prog_compiler_pic_works_CXX=yes
-lt_cv_prog_compiler_rtti_exceptions=no
-lt_cv_prog_compiler_static_works=yes
-lt_cv_prog_compiler_static_works_CXX=yes
-lt_cv_prog_gnu_ld=yes
-lt_cv_prog_gnu_ldcxx=yes
-lt_cv_sys_global_symbol_pipe='sed -n -e '\''s/^.*[ ]\([ABCDGIRSTW][ABCDGIRSTW]*\)[ ][ ]*\([_A-Za-z][_A-Za-z0-9]*\)$/\1 \2 \2/p'\'''
-lt_cv_sys_global_symbol_to_c_name_address='sed -n -e '\''s/^: \([^ ]*\) $/ {\"\1\", (lt_ptr) 0},/p'\'' -e '\''s/^[BCDEGRST] \([^ ]*\) \([^ ]*\)$/ {"\2", (lt_ptr) \&\2},/p'\'''
-lt_cv_sys_global_symbol_to_cdecl='sed -n -e '\''s/^. .* \(.*\)$/extern int \1;/p'\'''
-lt_cv_sys_lib_dlsearch_path_spec='/lib /usr/lib /lib/i486-linux-gnu /usr/lib/i486-linux-gnu /usr/lib/alsa-lib /usr/local/lib '
-lt_cv_sys_lib_search_path_spec='/opt/gnutools/arc2.3-p0/uclibc-4.2.1/lib/gcc/arc-linux-uclibc/4.2.1 /opt/gnutools/arc2.3-p0/uclibc-4.2.1/arc-linux-uclibc/lib'
-lt_cv_sys_max_cmd_len=805306365
-lt_lt_cv_prog_compiler_c_o='"yes"'
-lt_lt_cv_prog_compiler_c_o_CXX='"yes"'
-lt_lt_cv_sys_global_symbol_pipe='"sed -n -e '\''s/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'\''"'
-lt_lt_cv_sys_global_symbol_to_c_name_address='"sed -n -e '\''s/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p'\'' -e '\''s/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'\''"'
-lt_lt_cv_sys_global_symbol_to_cdecl='"sed -n -e '\''s/^. .* \\(.*\\)\$/extern int \\1;/p'\''"'
-
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-
-ACLOCAL='${SHELL} /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/missing --run aclocal-1.10'
-AMDEPBACKSLASH='\'
-AMDEP_FALSE='#'
-AMDEP_TRUE=''
-AMTAR='${SHELL} /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/missing --run tar'
-AR='arc-linux-uclibc-ar'
-AUTOCONF='${SHELL} /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/missing --run autoconf'
-AUTOHEADER='${SHELL} /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/missing --run autoheader'
-AUTOMAKE='${SHELL} /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/missing --run automake-1.10'
-AWK='mawk'
-CC='arc-linux-uclibc-gcc'
-CCDEPMODE='depmode=gcc3'
-CFLAGS='-mA7 -g -Wall'
-CPP='arc-linux-uclibc-gcc -E'
-CPPFLAGS=''
-CXX='arc-linux-uclibc-g++'
-CXXCPP='arc-linux-uclibc-g++ -E'
-CXXDEPMODE='depmode=gcc3'
-CXXFLAGS='-g -O2'
-CYGPATH_W='echo'
-DEFS='-DHAVE_CONFIG_H'
-DEPDIR='.deps'
-DSYMUTIL=''
-ECHO='echo'
-ECHO_C=''
-ECHO_N='-n'
-ECHO_T=''
-EGREP='/bin/grep -E'
-ENABLE_MOUNT_HELPER_FALSE=''
-ENABLE_MOUNT_HELPER_TRUE='#'
-EXEEXT=''
-F77=''
-FFLAGS=''
-FUSE_INTERNAL_FALSE='#'
-FUSE_INTERNAL_TRUE=''
-FUSE_MODULE_CFLAGS=''
-FUSE_MODULE_LIBS=''
-GENERATE_LDSCRIPT_FALSE=''
-GENERATE_LDSCRIPT_TRUE='#'
-GREP='/bin/grep'
-INSTALL_DATA='${INSTALL} -m 644'
-INSTALL_LIBRARY_FALSE='#'
-INSTALL_LIBRARY_TRUE=''
-INSTALL_PROGRAM='${INSTALL}'
-INSTALL_SCRIPT='${INSTALL}'
-INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
-LDCONFIG='/sbin/ldconfig'
-LDFLAGS=''
-LIBFUSE_LITE_LIBS=' -lpthread'
-LIBNTFS_3G_VERSION='76'
-LIBOBJS=' ${LIBOBJDIR}memcmp$U.o ${LIBOBJDIR}lstat$U.o ${LIBOBJDIR}stat$U.o'
-LIBS=''
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-LN_S='ln -s'
-LTLIBOBJS=' ${LIBOBJDIR}memcmp$U.lo ${LIBOBJDIR}lstat$U.lo ${LIBOBJDIR}stat$U.lo'
-MAINT='#'
-MAINTAINER_MODE_FALSE=''
-MAINTAINER_MODE_TRUE='#'
-MAKEINFO='${SHELL} /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/missing --run makeinfo'
-MKDIR_P='/bin/mkdir -p'
-MV='/bin/mv'
-NMEDIT=''
-NTFS_DEVICE_DEFAULT_IO_OPS_FALSE='#'
-NTFS_DEVICE_DEFAULT_IO_OPS_TRUE=''
-OBJEXT='o'
-OUTPUT_FORMAT=''
-PACKAGE='ntfs-3g'
-PACKAGE_BUGREPORT='ntfs-3g-devel@lists.sf.net'
-PACKAGE_NAME='ntfs-3g'
-PACKAGE_STRING='ntfs-3g 2010.5.16'
-PACKAGE_TARNAME='ntfs-3g'
-PACKAGE_VERSION='2010.5.16'
-PATH_SEPARATOR=':'
-PKG_CONFIG=''
-RANLIB='arc-linux-uclibc-ranlib'
-REALLYSTATIC_FALSE=''
-REALLYSTATIC_TRUE='#'
-RM='/bin/rm'
-RUN_LDCONFIG_FALSE=''
-RUN_LDCONFIG_TRUE='#'
-SED='/bin/sed'
-SET_MAKE=''
-SHELL='/bin/bash'
-STRIP='arc-linux-uclibc-strip'
-VERSION='2010.5.16'
-WINDOWS_FALSE=''
-WINDOWS_TRUE='#'
-ac_ct_CC=''
-ac_ct_CXX=''
-ac_ct_F77=''
-am__fastdepCC_FALSE='#'
-am__fastdepCC_TRUE=''
-am__fastdepCXX_FALSE='#'
-am__fastdepCXX_TRUE=''
-am__include='include'
-am__isrc=''
-am__leading_dot='.'
-am__quote=''
-am__tar='${AMTAR} chof - "$$tardir"'
-am__untar='${AMTAR} xf -'
-bindir='${exec_prefix}/bin'
-build='i686-pc-linux-gnu'
-build_alias=''
-build_cpu='i686'
-build_os='linux-gnu'
-build_vendor='pc'
-datadir='${datarootdir}'
-datarootdir='${prefix}/share'
-docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
-dvidir='${docdir}'
-exec_prefix='/mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/bld_7266_h_64x2/./rootfs'
-host='arc-unknown-linux-uclibc'
-host_alias='arc-linux-uclibc'
-host_cpu='arc'
-host_os='linux-uclibc'
-host_vendor='unknown'
-htmldir='${docdir}'
-includedir='${prefix}/include'
-infodir='${datarootdir}/info'
-install_sh='$(SHELL) /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/install-sh'
-libdir='${exec_prefix}/lib'
-libexecdir='${exec_prefix}/libexec'
-localedir='${datarootdir}/locale'
-localstatedir='${prefix}/var'
-mandir='${datarootdir}/man'
-mkdir_p='/bin/mkdir -p'
-ntfs3gincludedir='$(includedir)/ntfs-3g'
-oldincludedir='/usr/include'
-pdfdir='${docdir}'
-pkgconfigdir='$(libdir)/pkgconfig'
-prefix='/mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/bld_7266_h_64x2/./rootfs'
-program_transform_name='s,x,x,'
-psdir='${docdir}'
-rootbindir='$(bindir)'
-rootlibdir='$(libdir)'
-rootsbindir='$(sbindir)'
-sbindir='${exec_prefix}/sbin'
-sharedstatedir='${prefix}/com'
-sysconfdir='${prefix}/etc'
-target='arc-unknown-linux-uclibc'
-target_alias=''
-target_cpu='arc'
-target_os='linux-uclibc'
-target_vendor='unknown'
-
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-
-#define PACKAGE_NAME "ntfs-3g"
-#define PACKAGE_TARNAME "ntfs-3g"
-#define PACKAGE_VERSION "2010.5.16"
-#define PACKAGE_STRING "ntfs-3g 2010.5.16"
-#define PACKAGE_BUGREPORT "ntfs-3g-devel@lists.sf.net"
-#define PACKAGE "ntfs-3g"
-#define VERSION "2010.5.16"
-#define _GNU_SOURCE 1
-#define STDC_HEADERS 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_SYS_STAT_H 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STRING_H 1
-#define HAVE_MEMORY_H 1
-#define HAVE_STRINGS_H 1
-#define HAVE_INTTYPES_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_UNISTD_H 1
-#define HAVE_DLFCN_H 1
-#define _REENTRANT 1
-#define FUSE_INTERNAL 1
-#define STDC_HEADERS 1
-#define HAVE_CTYPE_H 1
-#define HAVE_FCNTL_H 1
-#define HAVE_LIBGEN_H 1
-#define HAVE_LIMITS_H 1
-#define HAVE_LOCALE_H 1
-#define HAVE_MNTENT_H 1
-#define HAVE_STDDEF_H 1
-#define HAVE_STDINT_H 1
-#define HAVE_STDLIB_H 1
-#define HAVE_STDIO_H 1
-#define HAVE_STDARG_H 1
-#define HAVE_STRING_H 1
-#define HAVE_STRINGS_H 1
-#define HAVE_ERRNO_H 1
-#define HAVE_TIME_H 1
-#define HAVE_UNISTD_H 1
-#define HAVE_UTIME_H 1
-#define HAVE_WCHAR_H 1
-#define HAVE_GETOPT_H 1
-#define HAVE_FEATURES_H 1
-#define HAVE_ENDIAN_H 1
-#define HAVE_BYTESWAP_H 1
-#define HAVE_SYS_PARAM_H 1
-#define HAVE_SYS_IOCTL_H 1
-#define HAVE_SYS_MOUNT_H 1
-#define HAVE_SYS_STAT_H 1
-#define HAVE_SYS_TYPES_H 1
-#define HAVE_SYS_VFS_H 1
-#define HAVE_SYS_STATVFS_H 1
-#define HAVE_SYS_SYSMACROS_H 1
-#define HAVE_LINUX_MAJOR_H 1
-#define HAVE_LINUX_FD_H 1
-#define HAVE_LINUX_HDREG_H 1
-#define HAVE_SYSLOG_H 1
-#define HAVE__BOOL 1
-#define HAVE_STDBOOL_H 1
-#define WORDS_LITTLEENDIAN 1
-#define HAVE_STRUCT_STAT_ST_BLOCKS 1
-#define HAVE_ST_BLOCKS 1
-#define HAVE_STRUCT_STAT_ST_RDEV 1
-#define HAVE_STRUCT_STAT_ST_ATIMENSEC 1
-#define HAVE_GETMNTENT
-#define HAVE_MBRTOWC 1
-#define HAVE_STAT_EMPTY_STRING_BUG 1
-#define HAVE_STRFTIME 1
-#define HAVE_UTIME_H 1
-#define HAVE_VPRINTF 1
-#define HAVE_ATEXIT 1
-#define HAVE_BASENAME 1
-#define HAVE_DAEMON 1
-#define HAVE_DUP2 1
-#define HAVE_FDATASYNC 1
-#define HAVE_FFS 1
-#define HAVE_GETOPT_LONG 1
-#define HAVE_HASMNTOPT 1
-#define HAVE_MBSINIT 1
-#define HAVE_MEMMOVE 1
-#define HAVE_MEMSET 1
-#define HAVE_REALPATH 1
-#define HAVE_REGCOMP 1
-#define HAVE_SETLOCALE 1
-#define HAVE_SETXATTR 1
-#define HAVE_STRCASECMP 1
-#define HAVE_STRCHR 1
-#define HAVE_STRDUP 1
-#define HAVE_STRERROR 1
-#define HAVE_STRNLEN 1
-#define HAVE_STRSEP 1
-#define HAVE_STRTOL 1
-#define HAVE_STRTOUL 1
-#define HAVE_SYSCONF 1
-#define HAVE_UTIME 1
-#define HAVE_GETTIMEOFDAY 1
-#define HAVE_CLOCK_GETTIME 1
-#define HAVE_FORK 1
-#define _FILE_OFFSET_BITS 64
-
-configure: exit 0
diff --git a/config.status b/config.status
deleted file mode 100755
index aede0bf..0000000
--- a/config.status
+++ b/dev/null
@@ -1,1220 +0,0 @@
-#! /bin/bash
-# Generated by configure.
-# 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-/bin/bash}
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
-
-# Be more Bourne compatible
-DUALCASE=1; export DUALCASE # for MKS sh
-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+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
-esac
-
-fi
-
-
-
-
-# PATH needs CR
-# 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
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
-fi
-
-
-# IFS
-# We need space, tab and new line, in precisely that order. Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-as_nl='
-'
-IFS=" "" $as_nl"
-
-# Find who we are. Look in the path if we contain no directory separator.
-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
-IFS=$as_save_IFS
-
- ;;
-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_myself: error: cannot find myself; rerun with an absolute file name" >&2
- { (exit 1); exit 1; }
-fi
-
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-done
-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) >/dev/null 2>&1 && $as_unset $as_var
- fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; 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'`
-
-# CDPATH.
-$as_unset CDPATH
-
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
- # 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 after each line using $LINENO; the second 'sed'
- # does the real work. The second script uses 'N' to pair each
- # line-number line with the line containing $LINENO, 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
- # scripts with optimization help from Paolo Bonzini. Blame Lee
- # E. McMahon (1931-1989) for sed's syntax. :-)
- sed -n '
- p
- /[$]LINENO/=
- ' <$as_myself |
- sed '
- s/[$]LINENO.*/&-/
- t lineno
- b
- :lineno
- N
- :loop
- s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
- t loop
- s/-\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 sensitive to this).
- . "./$as_me.lineno"
- # Exit status is that of the last command.
- exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
- case `echo 'x\c'` in
- *c*) ECHO_T=' ';; # ECHO_T is single tab character.
- *) ECHO_C='\c';;
- esac;;
-*)
- ECHO_N='-n';;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
- rm -f conf$$.dir/conf$$.file
-else
- rm -f conf$$.dir
- mkdir conf$$.dir
-fi
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- as_ln_s='ln -s'
- # ... but there are two gotchas:
- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -p'
-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$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
-else
- test -d ./-p && rmdir ./-p
- as_mkdir_p=false
-fi
-
-if test -x / >/dev/null 2>&1; then
- as_test_x='test -x'
-else
- if ls -dL / >/dev/null 2>&1; then
- as_ls_L_option=L
- else
- as_ls_L_option=
- fi
- as_test_x='
- eval sh -c '\''
- if test -d "$1"; then
- test -d "$1/.";
- else
- case $1 in
- -*)set "./$1";;
- esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
- ???[sx]*):;;*)false;;esac;fi
- '\'' sh
- '
-fi
-as_executable_p=$as_test_x
-
-# 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'"
-
-
-exec 6>&1
-
-# Save the log message, to keep $[0] and so on meaningful, and to
-# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling.
-ac_log="
-This file was extended by ntfs-3g $as_me 2010.5.16, which was
-generated by GNU Autoconf 2.61. Invocation command line was
-
- CONFIG_FILES = $CONFIG_FILES
- CONFIG_HEADERS = $CONFIG_HEADERS
- CONFIG_LINKS = $CONFIG_LINKS
- CONFIG_COMMANDS = $CONFIG_COMMANDS
- $ $0 $@
-
-on `(hostname || uname -n) 2>/dev/null | sed 1q`
-"
-
-# Files that config.status was made for.
-config_files=" Makefile include/Makefile include/fuse-lite/Makefile include/ntfs-3g/Makefile libfuse-lite/Makefile libntfs-3g/Makefile libntfs-3g/libntfs-3g.pc libntfs-3g/libntfs-3g.script.so src/Makefile src/ntfs-3g.8 src/ntfs-3g.probe.8 src/ntfs-3g.usermap.8 src/ntfs-3g.secaudit.8"
-config_headers=" config.h"
-config_commands=" depfiles"
-
-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 and configuration settings, then exit
- -q, --quiet do not print progress messages
- -d, --debug don't remove temporary files
- --recheck update $as_me by reconfiguring in the same conditions
- --file=FILE[:TEMPLATE]
- instantiate the configuration file FILE
- --header=FILE[:TEMPLATE]
- instantiate the configuration header FILE
-
-Configuration files:
-$config_files
-
-Configuration headers:
-$config_headers
-
-Configuration commands:
-$config_commands
-
-Report bugs to <bug-autoconf@gnu.org>."
-
-ac_cs_version="\
-ntfs-3g config.status 2010.5.16
-configured by ./configure, generated by GNU Autoconf 2.61,
- with options \"'CC=arc-linux-uclibc-gcc' '--prefix=/mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/bld_7266_h_64x2/./rootfs' '--host=arc-linux-uclibc' 'CFLAGS=-mA7 -g' '--enable-mount-helper=no' '--enable-ldconfig=no' 'exec_prefix=/mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/bld_7266_h_64x2/./rootfs' 'host_alias=arc-linux-uclibc'\"
-
-Copyright (C) 2006 Free Software Foundation, Inc.
-This config.status script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it."
-
-ac_pwd='/mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16'
-srcdir='.'
-INSTALL='/usr/bin/install -c'
-MKDIR_P='/bin/mkdir -p'
-# 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
- ;;
- esac
-
- case $ac_option in
- # Handling of the options.
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- ac_cs_recheck=: ;;
- --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
- echo "$ac_cs_version"; exit ;;
- --debug | --debu | --deb | --de | --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;;
- --he | --h)
- # Conflict between --help and --header
- { 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 ;;
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil | --si | --s)
- ac_cs_silent=: ;;
-
- # This is an error.
- -*) { 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"
- ac_need_defaults=false ;;
-
- 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
-
-if $ac_cs_recheck; then
- echo "running CONFIG_SHELL=/bin/bash /bin/bash ./configure " 'CC=arc-linux-uclibc-gcc' '--prefix=/mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/bld_7266_h_64x2/./rootfs' '--host=arc-linux-uclibc' 'CFLAGS=-mA7 -g' '--enable-mount-helper=no' '--enable-ldconfig=no' 'exec_prefix=/mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/bld_7266_h_64x2/./rootfs' 'host_alias=arc-linux-uclibc' $ac_configure_extra_args " --no-create --no-recursion" >&6
- CONFIG_SHELL=/bin/bash
- export CONFIG_SHELL
- exec /bin/bash "./configure" 'CC=arc-linux-uclibc-gcc' '--prefix=/mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/bld_7266_h_64x2/./rootfs' '--host=arc-linux-uclibc' 'CFLAGS=-mA7 -g' '--enable-mount-helper=no' '--enable-ldconfig=no' 'exec_prefix=/mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/bld_7266_h_64x2/./rootfs' 'host_alias=arc-linux-uclibc' $ac_configure_extra_args --no-create --no-recursion
-fi
-
-exec 5>>config.log
-{
- echo
- sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
- echo "$ac_log"
-} >&5
-
-#
-# INIT-COMMANDS
-#
-AMDEP_TRUE="" ac_aux_dir="."
-
-
-# Handling of arguments.
-for ac_config_target in $ac_config_targets
-do
- case $ac_config_target in
- "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
- "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
- "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
- "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
- "include/fuse-lite/Makefile") CONFIG_FILES="$CONFIG_FILES include/fuse-lite/Makefile" ;;
- "include/ntfs-3g/Makefile") CONFIG_FILES="$CONFIG_FILES include/ntfs-3g/Makefile" ;;
- "libfuse-lite/Makefile") CONFIG_FILES="$CONFIG_FILES libfuse-lite/Makefile" ;;
- "libntfs-3g/Makefile") CONFIG_FILES="$CONFIG_FILES libntfs-3g/Makefile" ;;
- "libntfs-3g/libntfs-3g.pc") CONFIG_FILES="$CONFIG_FILES libntfs-3g/libntfs-3g.pc" ;;
- "libntfs-3g/libntfs-3g.script.so") CONFIG_FILES="$CONFIG_FILES libntfs-3g/libntfs-3g.script.so" ;;
- "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
- "src/ntfs-3g.8") CONFIG_FILES="$CONFIG_FILES src/ntfs-3g.8" ;;
- "src/ntfs-3g.probe.8") CONFIG_FILES="$CONFIG_FILES src/ntfs-3g.probe.8" ;;
- "src/ntfs-3g.usermap.8") CONFIG_FILES="$CONFIG_FILES src/ntfs-3g.usermap.8" ;;
- "src/ntfs-3g.secaudit.8") CONFIG_FILES="$CONFIG_FILES src/ntfs-3g.secaudit.8" ;;
-
- *) { { 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 against having it here, and in addition,
-# creating and moving files from /tmp can sometimes cause problems.
-# Hook for its removal unless debugging.
-# Note that there is a small window in which the directory will not be cleaned:
-# after its creation but before its name has been assigned to `$tmp'.
-$debug ||
-{
- tmp=
- trap 'exit_status=$?
- { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$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 "./confXXXXXX") 2>/dev/null` &&
- test -n "$tmp" && test -d "$tmp"
-} ||
-{
- tmp=./conf$$-$RANDOM
- (umask 077 && mkdir "$tmp")
-} ||
-{
- echo "$me: cannot create a temporary directory in ." >&2
- { (exit 1); exit 1; }
-}
-
-#
-# Set up the sed scripts for 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
-
-cat >"$tmp/subs-1.sed" <<\CEOF
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s,@SHELL@,|#_!!_#|/bin/bash,g
-s,@PATH_SEPARATOR@,|#_!!_#|:,g
-s,@PACKAGE_NAME@,|#_!!_#|ntfs-3g,g
-s,@PACKAGE_TARNAME@,|#_!!_#|ntfs-3g,g
-s,@PACKAGE_VERSION@,|#_!!_#|2010.5.16,g
-s,@PACKAGE_STRING@,|#_!!_#|ntfs-3g 2010.5.16,g
-s,@PACKAGE_BUGREPORT@,|#_!!_#|ntfs-3g-devel@|#_!!_#|lists.sf.net,g
-s,@exec_prefix@,|#_!!_#|/mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/bld_7266_h_64x2/./rootfs,g
-s,@prefix@,|#_!!_#|/mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/bld_7266_h_64x2/./rootfs,g
-s,@program_transform_name@,|#_!!_#|s\,x\,x\,,g
-s,@bindir@,|#_!!_#|${exec_prefix}/bin,g
-s,@sbindir@,|#_!!_#|${exec_prefix}/sbin,g
-s,@libexecdir@,|#_!!_#|${exec_prefix}/libexec,g
-s,@datarootdir@,|#_!!_#|${prefix}/share,g
-s,@datadir@,|#_!!_#|${datarootdir},g
-s,@sysconfdir@,|#_!!_#|${prefix}/etc,g
-s,@sharedstatedir@,|#_!!_#|${prefix}/com,g
-s,@localstatedir@,|#_!!_#|${prefix}/var,g
-s,@includedir@,|#_!!_#|${prefix}/include,g
-s,@oldincludedir@,|#_!!_#|/usr/include,g
-s,@docdir@,|#_!!_#|${datarootdir}/doc/${PACKAGE_TARNAME},g
-s,@infodir@,|#_!!_#|${datarootdir}/info,g
-s,@htmldir@,|#_!!_#|${docdir},g
-s,@dvidir@,|#_!!_#|${docdir},g
-s,@pdfdir@,|#_!!_#|${docdir},g
-s,@psdir@,|#_!!_#|${docdir},g
-s,@libdir@,|#_!!_#|${exec_prefix}/lib,g
-s,@localedir@,|#_!!_#|${datarootdir}/locale,g
-s,@mandir@,|#_!!_#|${datarootdir}/man,g
-s,@DEFS@,|#_!!_#|-DHAVE_CONFIG_H,g
-s,@ECHO_C@,|#_!!_#|,g
-s,@ECHO_N@,|#_!!_#|-n,g
-s,@ECHO_T@,|#_!!_#|,g
-s,@LIBS@,|#_!!_#|,g
-s,@build_alias@,|#_!!_#|,g
-s,@host_alias@,|#_!!_#|arc-linux-uclibc,g
-s,@target_alias@,|#_!!_#|,g
-s,@build@,|#_!!_#|i686-pc-linux-gnu,g
-s,@build_cpu@,|#_!!_#|i686,g
-s,@build_vendor@,|#_!!_#|pc,g
-s,@build_os@,|#_!!_#|linux-gnu,g
-s,@host@,|#_!!_#|arc-unknown-linux-uclibc,g
-s,@host_cpu@,|#_!!_#|arc,g
-s,@host_vendor@,|#_!!_#|unknown,g
-s,@host_os@,|#_!!_#|linux-uclibc,g
-s,@target@,|#_!!_#|arc-unknown-linux-uclibc,g
-s,@target_cpu@,|#_!!_#|arc,g
-s,@target_vendor@,|#_!!_#|unknown,g
-s,@target_os@,|#_!!_#|linux-uclibc,g
-s,@INSTALL_PROGRAM@,|#_!!_#|${INSTALL},g
-s,@INSTALL_SCRIPT@,|#_!!_#|${INSTALL},g
-s,@INSTALL_DATA@,|#_!!_#|${INSTALL} -m 644,g
-s,@am__isrc@,|#_!!_#|,g
-s,@CYGPATH_W@,|#_!!_#|echo,g
-s,@PACKAGE@,|#_!!_#|ntfs-3g,g
-s,@VERSION@,|#_!!_#|2010.5.16,g
-s,@ACLOCAL@,|#_!!_#|${SHELL} /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/missing --run aclocal-1.10,g
-s,@AUTOCONF@,|#_!!_#|${SHELL} /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/missing --run autoconf,g
-s,@AUTOMAKE@,|#_!!_#|${SHELL} /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/missing --run automake-1.10,g
-s,@AUTOHEADER@,|#_!!_#|${SHELL} /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/missing --run autoheader,g
-s,@MAKEINFO@,|#_!!_#|${SHELL} /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/missing --run makeinfo,g
-s,@install_sh@,|#_!!_#|$(SHELL) /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/install-sh,g
-s,@STRIP@,|#_!!_#|arc-linux-uclibc-strip,g
-s,@INSTALL_STRIP_PROGRAM@,|#_!!_#|$(install_sh) -c -s,g
-s,@mkdir_p@,|#_!!_#|/bin/mkdir -p,g
-s,@AWK@,|#_!!_#|mawk,g
-s,@SET_MAKE@,|#_!!_#|,g
-s,@am__leading_dot@,|#_!!_#|.,g
-s,@AMTAR@,|#_!!_#|${SHELL} /mnt/fileroot/michael.wang/linux-top-pub/ui_ref/trunk/build/packages/ntfs-3g-2010.5.16/missing --run tar,g
-s,@am__tar@,|#_!!_#|${AMTAR} chof - "$$tardir",g
-s,@am__untar@,|#_!!_#|${AMTAR} xf -,g
-s,@MAINTAINER_MODE_TRUE@,|#_!!_#|#,g
-s,@MAINTAINER_MODE_FALSE@,|#_!!_#|,g
-s,@MAINT@,|#_!!_#|#,g
-s,@CC@,|#_!!_#|arc-linux-uclibc-gcc,g
-s,@CFLAGS@,|#_!!_#|-mA7 -g -Wall,g
-s,@LDFLAGS@,|#_!!_#|,g
-s,@CPPFLAGS@,|#_!!_#|,g
-s,@ac_ct_CC@,|#_!!_#|,g
-s,@EXEEXT@,|#_!!_#|,g
-s,@OBJEXT@,|#_!!_#|o,g
-s,@DEPDIR@,|#_!!_#|.deps,g
-s,@am__include@,|#_!!_#|include,g
-s,@am__quote@,|#_!!_#|,g
-s,@AMDEP_TRUE@,|#_!!_#|,g
-s,@AMDEP_FALSE@,|#_!!_#|#,g
-s,@AMDEPBACKSLASH@,|#_!!_#|\\,g
-s,@CCDEPMODE@,|#_!!_#|depmode=gcc3,g
-s,@am__fastdepCC_TRUE@,|#_!!_#|,g
-s,@am__fastdepCC_FALSE@,|#_!!_#|#,g
-s,@LN_S@,|#_!!_#|ln -s,g
-s,@SED@,|#_!!_#|/bin/sed,g
-s,@GREP@,|#_!!_#|/bin/grep,g
-s,@EGREP@,|#_!!_#|/bin/grep -E,g
-s,@ECHO@,|#_!!_#|echo,g
-s,@AR@,|#_!!_#|arc-linux-uclibc-ar,g
-s,@RANLIB@,|#_!!_#|arc-linux-uclibc-ranlib,g
-CEOF
-cat >"$tmp/subs-2.sed" <<\CEOF
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
-s,@DSYMUTIL@,|#_!!_#|,g
-s,@NMEDIT@,|#_!!_#|,g
-s,@CPP@,|#_!!_#|arc-linux-uclibc-gcc -E,g
-s,@CXX@,|#_!!_#|arc-linux-uclibc-g++,g
-s,@CXXFLAGS@,|#_!!_#|-g -O2,g
-s,@ac_ct_CXX@,|#_!!_#|,g
-s,@CXXDEPMODE@,|#_!!_#|depmode=gcc3,g
-s,@am__fastdepCXX_TRUE@,|#_!!_#|,g
-s,@am__fastdepCXX_FALSE@,|#_!!_#|#,g
-s,@CXXCPP@,|#_!!_#|arc-linux-uclibc-g++ -E,g
-s,@F77@,|#_!!_#|,g
-s,@FFLAGS@,|#_!!_#|,g
-s,@ac_ct_F77@,|#_!!_#|,g
-s,@LIBTOOL@,|#_!!_#|$(SHELL) $(top_builddir)/libtool,g
-s,@MV@,|#_!!_#|/bin/mv,g
-s,@RM@,|#_!!_#|/bin/rm,g
-s,@LDCONFIG@,|#_!!_#|/sbin/ldconfig,g
-s,@PKG_CONFIG@,|#_!!_#|,g
-s,@FUSE_MODULE_CFLAGS@,|#_!!_#|,g
-s,@FUSE_MODULE_LIBS@,|#_!!_#|,g
-s,@LIBOBJS@,|#_!!_#| ${LIBOBJDIR}memcmp$U.o ${LIBOBJDIR}lstat$U.o ${LIBOBJDIR}stat$U.o,g
-s,@pkgconfigdir@,|#_!!_#|$(libdir)/pkgconfig,g
-s,@ntfs3gincludedir@,|#_!!_#|$(includedir)/ntfs-3g,g
-s,@rootbindir@,|#_!!_#|$(bindir),g
-s,@rootsbindir@,|#_!!_#|$(sbindir),g
-s,@rootlibdir@,|#_!!_#|$(libdir),g
-s,@LIBNTFS_3G_VERSION@,|#_!!_#|76,g
-s,@LIBFUSE_LITE_LIBS@,|#_!!_#| -lpthread,g
-s,@OUTPUT_FORMAT@,|#_!!_#|,g
-s,@FUSE_INTERNAL_TRUE@,|#_!!_#|,g
-s,@FUSE_INTERNAL_FALSE@,|#_!!_#|#,g
-s,@GENERATE_LDSCRIPT_TRUE@,|#_!!_#|#,g
-s,@GENERATE_LDSCRIPT_FALSE@,|#_!!_#|,g
-s,@WINDOWS_TRUE@,|#_!!_#|#,g
-s,@WINDOWS_FALSE@,|#_!!_#|,g
-s,@NTFS_DEVICE_DEFAULT_IO_OPS_TRUE@,|#_!!_#|,g
-s,@NTFS_DEVICE_DEFAULT_IO_OPS_FALSE@,|#_!!_#|#,g
-s,@RUN_LDCONFIG_TRUE@,|#_!!_#|#,g
-s,@RUN_LDCONFIG_FALSE@,|#_!!_#|,g
-s,@REALLYSTATIC_TRUE@,|#_!!_#|#,g
-s,@REALLYSTATIC_FALSE@,|#_!!_#|,g
-s,@INSTALL_LIBRARY_TRUE@,|#_!!_#|,g
-s,@INSTALL_LIBRARY_FALSE@,|#_!!_#|#,g
-s,@ENABLE_MOUNT_HELPER_TRUE@,|#_!!_#|#,g
-s,@ENABLE_MOUNT_HELPER_FALSE@,|#_!!_#|,g
-s,@MKDIR_P@,|#_!!_#|/bin/mkdir -p,g
-s,@LTLIBOBJS@,|#_!!_#| ${LIBOBJDIR}memcmp$U.lo ${LIBOBJDIR}lstat$U.lo ${LIBOBJDIR}stat$U.lo,g
-:end
-s/|#_!!_#|//g
-CEOF
-fi # test -n "$CONFIG_FILES"
-
-
-for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS
-do
- case $ac_tag in
- :[FHLC]) ac_mode=$ac_tag; continue;;
- esac
- case $ac_mode$ac_tag in
- :[FHL]*:*);;
- :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
-echo "$as_me: error: Invalid tag $ac_tag." >&2;}
- { (exit 1); exit 1; }; };;
- :[FH]-) ac_tag=-:-;;
- :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
- esac
- ac_save_IFS=$IFS
- IFS=:
- set x $ac_tag
- IFS=$ac_save_IFS
- shift
- ac_file=$1
- shift
-
- case $ac_mode in
- :L) ac_source=$1;;
- :[FH])
- ac_file_inputs=
- for ac_f
- do
- case $ac_f in
- -) ac_f="$tmp/stdin";;
- *) # Look for the file first in the build tree, then in the source tree
- # (if the path is not absolute). The absolute path cannot be DOS-style,
- # because $ac_f cannot contain `:'.
- test -f "$ac_f" ||
- case $ac_f in
- [\\/$]*) false;;
- *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
- esac ||
- { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-echo "$as_me: error: cannot find input file: $ac_f" >&2;}
- { (exit 1); exit 1; }; };;
- esac
- ac_file_inputs="$ac_file_inputs $ac_f"
- done
-
- # 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. */
- configure_input="Generated from "`IFS=:
- echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
- if test x"$ac_file" != x-; then
- configure_input="$ac_file. $configure_input"
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
- fi
-
- case $ac_tag in
- *:-:* | *:-) cat >"$tmp/stdin";;
- esac
- ;;
- esac
-
- ac_dir=`$as_dirname -- "$ac_file" ||
-$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'`
- { as_dir="$ac_dir"
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
- as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
-$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'`
- test -d "$as_dir" && break
- done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
- { (exit 1); exit 1; }; }; }
- ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
- # A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
- case $ac_top_builddir_sub in
- "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
- *) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
- esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
- .) # We are building in place.
- ac_srcdir=.
- ac_top_srcdir=$ac_top_builddir_sub
- ac_abs_top_srcdir=$ac_pwd ;;
- [\\/]* | ?:[\\/]* ) # Absolute name.
- ac_srcdir=$srcdir$ac_dir_suffix;
- ac_top_srcdir=$srcdir
- ac_abs_top_srcdir=$srcdir ;;
- *) # Relative name.
- ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
- ac_top_srcdir=$ac_top_build_prefix$srcdir
- ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
-
- case $ac_mode in
- :F)
- #
- # CONFIG_FILE
- #
-
- case $INSTALL in
- [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
- *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
- esac
- ac_MKDIR_P=$MKDIR_P
- case $MKDIR_P in
- [\\/$]* | ?:[\\/]* ) ;;
- */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
- esac
-# If the template does not know about datarootdir, expand it.
-# FIXME: This hack should be removed a few years after 2.60.
-ac_datarootdir_hack=; ac_datarootdir_seen=
-
-case `sed -n '/datarootdir/ {
- p
- q
-}
-/@datadir@/p
-/@docdir@/p
-/@infodir@/p
-/@localedir@/p
-/@mandir@/p
-' $ac_file_inputs` in
-*datarootdir*) ac_datarootdir_seen=yes;;
-*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
- { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
- ac_datarootdir_hack='
- s&@datadir@&${datarootdir}&g
- s&@docdir@&${datarootdir}/doc/${PACKAGE_TARNAME}&g
- s&@infodir@&${datarootdir}/info&g
- s&@localedir@&${datarootdir}/locale&g
- s&@mandir@&${datarootdir}/man&g
- s&\${datarootdir}&${prefix}/share&g' ;;
-esac
- sed "/^[ ]*VPATH[ ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[ ]*\):*/\1/
-s/:*$//
-s/^[^=]*=[ ]*$//
-}
-
-:t
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s&@configure_input@&$configure_input&;t t
-s&@top_builddir@&$ac_top_builddir_sub&;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&@abs_top_builddir@&$ac_abs_top_builddir&;t t
-s&@INSTALL@&$ac_INSTALL&;t t
-s&@MKDIR_P@&$ac_MKDIR_P&;t t
-$ac_datarootdir_hack
-" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
-
-test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
- { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
- { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
- { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&5
-echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&2;}
-
- rm -f "$tmp/stdin"
- case $ac_file in
- -) cat "$tmp/out"; rm -f "$tmp/out";;
- *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
- esac
- ;;
- :H)
- #
- # CONFIG_HEADER
- #
- # First, check the format of the line:
- cat >"$tmp/defines.sed" <<\CEOF
-/^[ ]*#[ ]*undef[ ][ ]*[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*[ ]*$/b def
-/^[ ]*#[ ]*define[ ][ ]*[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*[( ]/b def
-b
-:def
-s/$/ /
-s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_NAME\)[ (].*,\1define\2 "ntfs-3g" ,
-s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_TARNAME\)[ (].*,\1define\2 "ntfs-3g" ,
-s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_VERSION\)[ (].*,\1define\2 "2010.5.16" ,
-s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_STRING\)[ (].*,\1define\2 "ntfs-3g 2010.5.16" ,
-s,^\([ #]*\)[^ ]*\([ ]*PACKAGE_BUGREPORT\)[ (].*,\1define\2 "ntfs-3g-devel@lists.sf.net" ,
-s,^\([ #]*\)[^ ]*\([ ]*PACKAGE\)[ (].*,\1define\2 "ntfs-3g" ,
-s,^\([ #]*\)[^ ]*\([ ]*VERSION\)[ (].*,\1define\2 "2010.5.16" ,
-s,^\([ #]*\)[^ ]*\([ ]*_GNU_SOURCE\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*STDC_HEADERS\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_SYS_TYPES_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_SYS_STAT_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STDLIB_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRING_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_MEMORY_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRINGS_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_INTTYPES_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STDINT_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_UNISTD_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_DLFCN_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*_REENTRANT\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*FUSE_INTERNAL\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*STDC_HEADERS\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_CTYPE_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_FCNTL_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_LIBGEN_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_LIMITS_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_LOCALE_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_MNTENT_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STDDEF_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STDINT_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STDLIB_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STDIO_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STDARG_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRING_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRINGS_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_ERRNO_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_TIME_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_UNISTD_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_UTIME_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_WCHAR_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_GETOPT_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_FEATURES_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_ENDIAN_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_BYTESWAP_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_SYS_PARAM_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_SYS_IOCTL_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_SYS_MOUNT_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_SYS_STAT_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_SYS_TYPES_H\)[ (].*,\1define\2 1 ,
-CEOF
- sed -f "$tmp/defines.sed" $ac_file_inputs >"$tmp/out1"
- # First, check the format of the line:
- cat >"$tmp/defines.sed" <<\CEOF
-/^[ ]*#[ ]*undef[ ][ ]*[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*[ ]*$/b def
-/^[ ]*#[ ]*define[ ][ ]*[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*[( ]/b def
-b
-:def
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_SYS_VFS_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_SYS_STATVFS_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_SYS_SYSMACROS_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_LINUX_MAJOR_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_LINUX_FD_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_LINUX_HDREG_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_SYSLOG_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE__BOOL\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STDBOOL_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*WORDS_LITTLEENDIAN\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRUCT_STAT_ST_BLOCKS\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_ST_BLOCKS\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRUCT_STAT_ST_RDEV\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRUCT_STAT_ST_ATIMENSEC\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_GETMNTENT\)[ (].*,\1define\2 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_MBRTOWC\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STAT_EMPTY_STRING_BUG\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRFTIME\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_UTIME_H\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_VPRINTF\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_ATEXIT\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_BASENAME\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_DAEMON\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_DUP2\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_FDATASYNC\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_FFS\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_GETOPT_LONG\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_HASMNTOPT\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_MBSINIT\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_MEMMOVE\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_MEMSET\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_REALPATH\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_REGCOMP\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_SETLOCALE\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_SETXATTR\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRCASECMP\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRCHR\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRDUP\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRERROR\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRNLEN\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRSEP\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRTOL\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_STRTOUL\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_SYSCONF\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_UTIME\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_GETTIMEOFDAY\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_CLOCK_GETTIME\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*HAVE_FORK\)[ (].*,\1define\2 1 ,
-s,^\([ #]*\)[^ ]*\([ ]*_FILE_OFFSET_BITS\)[ (].*,\1define\2 64 ,
-s/ $//
-CEOF
- sed -f "$tmp/defines.sed" "$tmp/out1" >"$tmp/out2"
- # First, check the format of the line:
- cat >"$tmp/defines.sed" <<\CEOF
-/^[ ]*#[ ]*undef[ ][ ]*[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*[ ]*$/b def
-/^[ ]*#[ ]*define[ ][ ]*[_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ][_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789]*[( ]/b def
-b
-:def
-s,^[ #]*u.*,/* & */,
-CEOF
- sed -f "$tmp/defines.sed" "$tmp/out2" >"$tmp/out1"
-ac_result="$tmp/out1"
- if test x"$ac_file" != x-; then
- echo "/* $configure_input */" >"$tmp/config.h"
- cat "$ac_result" >>"$tmp/config.h"
- 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
- rm -f $ac_file
- mv "$tmp/config.h" $ac_file
- fi
- else
- echo "/* $configure_input */"
- cat "$ac_result"
- fi
- rm -f "$tmp/out12"
-# Compute $ac_file's index in $config_headers.
-_am_arg=$ac_file
-_am_stamp_count=1
-for _am_header in $config_headers :; do
- case $_am_header in
- $_am_arg | $_am_arg:* )
- break ;;
- * )
- _am_stamp_count=`expr $_am_stamp_count + 1` ;;
- esac
-done
-echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
-$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$_am_arg" : 'X\(//\)[^/]' \| \
- X"$_am_arg" : 'X\(//\)$' \| \
- X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$_am_arg" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`/stamp-h$_am_stamp_count
- ;;
-
- :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5
-echo "$as_me: executing $ac_file commands" >&6;}
- ;;
- esac
-
-
- case $ac_file$ac_mode in
- "depfiles":C) 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.
- # Grep'ing the whole file is not good either: AIX grep has a line
- # limit of 2048, but all sed's we know have understand at least 4000.
- if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
- dirpart=`$as_dirname -- "$mf" ||
-$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=`$as_dirname -- "$file" ||
-$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'`
- { as_dir=$dirpart/$fdir
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
- as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
-$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'`
- test -d "$as_dir" && break
- done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
- { (exit 1); exit 1; }; }; }
- # echo "creating $dirpart/$file"
- echo '# dummy' > "$dirpart/$file"
- done
-done
- ;;
-
- esac
-done # for ac_tag
-
-
-{ (exit 0); exit 0; }
diff --git a/config.sub b/config.sub
index 6759825..b62f01c 100755
--- a/config.sub
+++ b/config.sub
@@ -1,10 +1,10 @@
#! /bin/sh
# Configuration validation subroutine script.
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010
# Free Software Foundation, Inc.
-timestamp='2008-01-16'
+timestamp='2010-01-22'
# This file is (in principle) common to ALL GNU software.
# The presence of a machine in this file suggests that SOME GNU software
@@ -32,13 +32,16 @@ timestamp='2008-01-16'
# Please send patches to <config-patches@gnu.org>. Submit a context
-# diff and a properly formatted ChangeLog entry.
+# diff and a properly formatted GNU 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.
+# You can get the latest version of this script from:
+# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
+
# 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.
@@ -72,8 +75,9 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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."
@@ -122,6 +126,7 @@ maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
+ kopensolaris*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
@@ -148,10 +153,13 @@ 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 | -knuth | -cray | -microblaze)
os=
basic_machine=$1
;;
+ -bluegene*)
+ os=-cnk
+ ;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
@@ -236,7 +244,7 @@ esac
case $basic_machine in
# Recognize the basic CPU types without company name.
# Some are omitted here because they have special meanings below.
- 1750a | 580 \
+ rsky | 1750a | 580 \
| a29k \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
@@ -249,13 +257,16 @@ case $basic_machine in
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
+ | lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | mcore | mep \
+ | maxq | mb | microblaze | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
- | mips64vr | mips64vrel \
+ | mips64octeon | mips64octeonel \
| mips64orion | mips64orionel \
+ | mips64r5900 | mips64r5900el \
+ | mips64vr | mips64vrel \
| mips64vr4100 | mips64vr4100el \
| mips64vr4300 | mips64vr4300el \
| mips64vr5000 | mips64vr5000el \
@@ -268,6 +279,7 @@ case $basic_machine in
| mipsisa64sr71k | mipsisa64sr71kel \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
+ | moxie \
| mt \
| msp430 \
| nios | nios2 \
@@ -276,20 +288,22 @@ case $basic_machine in
| pdp10 | pdp11 | pj | pjl \
| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
+ | rx \
| score \
- | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
| spu | strongarm \
| tahoe | thumb | tic4x | tic80 | tron \
+ | ubicom32 \
| v850 | v850e \
| we32k \
| x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
- | z8k)
+ | z8k | z80)
basic_machine=$basic_machine-unknown
;;
- m6811 | m68hc11 | m6812 | m68hc12)
+ m6811 | m68hc11 | m6812 | m68hc12 | picochip)
# Motorola 68HC11/12.
basic_machine=$basic_machine-unknown
os=-none
@@ -329,14 +343,17 @@ case $basic_machine in
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
+ | lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
- | m88110-* | m88k-* | maxq-* | mcore-* \
+ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
- | mips64vr-* | mips64vrel-* \
+ | mips64octeon-* | mips64octeonel-* \
| mips64orion-* | mips64orionel-* \
+ | mips64r5900-* | mips64r5900el-* \
+ | mips64vr-* | mips64vrel-* \
| mips64vr4100-* | mips64vr4100el-* \
| mips64vr4300-* | mips64vr4300el-* \
| mips64vr5000-* | mips64vr5000el-* \
@@ -357,21 +374,23 @@ case $basic_machine in
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
- | romp-* | rs6000-* \
- | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | romp-* | rs6000-* | rx-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
| sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
| tahoe-* | thumb-* \
| tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
+ | tile-* | tilegx-* \
| tron-* \
+ | ubicom32-* \
| v850-* | v850e-* | vax-* \
| we32k-* \
| x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
- | z8k-*)
+ | z8k-* | z80-*)
;;
# Recognize the basic CPU types without company name, with glob match.
xtensa*)
@@ -439,6 +458,10 @@ case $basic_machine in
basic_machine=m68k-apollo
os=-bsd
;;
+ aros)
+ basic_machine=i386-pc
+ os=-aros
+ ;;
aux)
basic_machine=m68k-apple
os=-aux
@@ -455,10 +478,18 @@ case $basic_machine in
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
+ bluegene*)
+ basic_machine=powerpc-ibm
+ os=-cnk
+ ;;
c90)
basic_machine=c90-cray
os=-unicos
;;
+ cegcc)
+ basic_machine=arm-unknown
+ os=-cegcc
+ ;;
convex-c1)
basic_machine=c1-convex
os=-bsd
@@ -526,6 +557,10 @@ case $basic_machine in
basic_machine=m88k-motorola
os=-sysv3
;;
+ dicos)
+ basic_machine=i686-pc
+ os=-dicos
+ ;;
djgpp)
basic_machine=i586-pc
os=-msdosdjgpp
@@ -699,6 +734,9 @@ case $basic_machine in
basic_machine=ns32k-utek
os=-sysv
;;
+ microblaze)
+ basic_machine=microblaze-xilinx
+ ;;
mingw32)
basic_machine=i386-pc
os=-mingw32
@@ -1049,6 +1087,11 @@ case $basic_machine in
basic_machine=tic6x-unknown
os=-coff
;;
+ # This must be matched before tile*.
+ tilegx*)
+ basic_machine=tilegx-unknown
+ os=-linux-gnu
+ ;;
tile*)
basic_machine=tile-unknown
os=-linux-gnu
@@ -1128,6 +1171,10 @@ case $basic_machine in
basic_machine=z8k-unknown
os=-sim
;;
+ z80-*-coff)
+ basic_machine=z80-unknown
+ os=-sim
+ ;;
none)
basic_machine=none-none
os=-none
@@ -1166,7 +1213,7 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
- sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
+ sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
@@ -1216,6 +1263,9 @@ 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.
+ -auroraux)
+ os=-auroraux
+ ;;
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
@@ -1236,10 +1286,11 @@ case $os in
# 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* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \
+ | -sym* | -kopensolaris* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* \
+ | -aos* | -aros* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
@@ -1248,7 +1299,7 @@ case $os in
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
- | -chorusos* | -chorusrdb* \
+ | -chorusos* | -chorusrdb* | -cegcc* \
| -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
| -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
@@ -1258,7 +1309,7 @@ case $os in
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1388,6 +1439,11 @@ case $os in
-zvmoe)
os=-zvmoe
;;
+ -dicos*)
+ os=-dicos
+ ;;
+ -nacl*)
+ ;;
-none)
;;
*)
@@ -1585,7 +1641,7 @@ case $basic_machine in
-sunos*)
vendor=sun
;;
- -aix*)
+ -cnk*|-aix*)
vendor=ibm
;;
-beos*)
diff --git a/configure b/configure
index 508d09c..37c54b9 100755
--- a/configure
+++ b/configure
@@ -1,62 +1,85 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.61 for ntfs-3g 2010.5.16.
+# Generated by GNU Autoconf 2.67 for ntfs-3g 2014.2.15.
#
# Report bugs to <ntfs-3g-devel@lists.sf.net>.
#
+#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 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. ##
-## --------------------- ##
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+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
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
esac
-
fi
-
-
-# PATH needs CR
-# 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=';'
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
else
- PATH_SEPARATOR=:
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
fi
- rm -f conf$$.sh
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
fi
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
fi
@@ -65,20 +88,18 @@ fi
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
-as_nl='
-'
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
-case $0 in
+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
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
IFS=$as_save_IFS
;;
@@ -89,354 +110,322 @@ if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
- echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- { (exit 1); exit 1; }
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
fi
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
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) >/dev/null 2>&1 && $as_unset $as_var
- fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; 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'`
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
# CDPATH.
-$as_unset CDPATH
-
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
if test "x$CONFIG_SHELL" = x; then
- if (eval ":") 2>/dev/null; then
- as_have_required=yes
+ as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
+ emulate sh
+ NULLCMD=:
+ # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
else
- as_have_required=no
+ case \`(set -o) 2>/dev/null\` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
+esac
fi
-
- if test $as_have_required = yes && (eval ":
-(as_func_return () {
- (exit \$1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
+"
+ as_required="as_fn_return () { (exit \$1); }
+as_fn_success () { as_fn_return 0; }
+as_fn_failure () { as_fn_return 1; }
+as_fn_ret_success () { return 0; }
+as_fn_ret_failure () { return 1; }
exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
- :
-else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
- :
+as_fn_success || { exitcode=1; echo as_fn_success failed.; }
+as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
+as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
+as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
+if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
+
+else
+ exitcode=1; echo positional parameters were not saved.
+fi
+test x\$exitcode = x0 || exit 1"
+ as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
+ as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
+ eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
+ test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
+test \$(( 1 + 1 )) = 2 || exit 1"
+ if (eval "$as_required") 2>/dev/null; then :
+ as_have_required=yes
else
- exitcode=1
- echo positional parameters were not saved.
+ as_have_required=no
fi
+ if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
-test \$exitcode = 0) || { (exit 1); exit 1; }
-
-(
- as_lineno_1=\$LINENO
- as_lineno_2=\$LINENO
- test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
- test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
-") 2> /dev/null; then
- :
else
- as_candidate_shells=
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+as_found=false
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- case $as_dir in
+ as_found=:
+ case $as_dir in #(
/*)
for as_base in sh bash ksh sh5; do
- as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
+ # Try only shells that exist, to save several forks.
+ as_shell=$as_dir/$as_base
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ CONFIG_SHELL=$as_shell as_have_required=yes
+ if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
+ break 2
+fi
+fi
done;;
esac
+ as_found=false
done
+$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
+ { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
+ CONFIG_SHELL=$SHELL as_have_required=yes
+fi; }
IFS=$as_save_IFS
- for as_shell in $as_candidate_shells $SHELL; do
- # Try only shells that exist, to save several forks.
- if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
- { ("$as_shell") 2> /dev/null <<\_ASEOF
-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+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
-esac
-
+ if test "x$CONFIG_SHELL" != x; then :
+ # We cannot yet assume a decent shell, so we have to provide a
+ # neutralization value for shells without unset; and this also
+ # works around shells that cannot unset nonexistent variables.
+ BASH_ENV=/dev/null
+ ENV=/dev/null
+ (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
fi
-
-:
-_ASEOF
-}; then
- CONFIG_SHELL=$as_shell
- as_have_required=yes
- if { "$as_shell" 2> /dev/null <<\_ASEOF
-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+"$@"}'='"$@"'
- setopt NO_GLOB_SUBST
-else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
-esac
-
+ if test x$as_have_required = xno; then :
+ $as_echo "$0: This script requires a shell more modern than all"
+ $as_echo "$0: the shells that I found on your system."
+ if test x${ZSH_VERSION+set} = xset ; then
+ $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
+ $as_echo "$0: be upgraded to zsh 4.3.4 or later."
+ else
+ $as_echo "$0: Please tell bug-autoconf@gnu.org and
+$0: ntfs-3g-devel@lists.sf.net about your system, including
+$0: any error possibly output before this message. Then
+$0: install a modern shell, or manually run the script
+$0: under such a shell if you do have one."
+ fi
+ exit 1
fi
+fi
+fi
+SHELL=${CONFIG_SHELL-/bin/sh}
+export SHELL
+# Unset more variables known to interfere with behavior of common tools.
+CLICOLOR_FORCE= GREP_OPTIONS=
+unset CLICOLOR_FORCE GREP_OPTIONS
-
-:
-(as_func_return () {
- (exit $1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
+## --------------------- ##
+## M4sh Shell Functions. ##
+## --------------------- ##
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
}
+as_unset=as_fn_unset
-exitcode=0
-if as_func_success; then
- :
-else
- exitcode=1
- echo as_func_success failed.
-fi
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
-fi
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
-if as_func_ret_success; then
- :
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = "$1" ); then
- :
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
else
- exitcode=1
- echo positional parameters were not saved.
-fi
-
-test $exitcode = 0) || { (exit 1); exit 1; }
-
-(
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
-
-_ASEOF
-}; then
- break
-fi
-
-fi
-
- done
-
- if test "x$CONFIG_SHELL" != x; then
- for as_var in BASH_ENV ENV
- do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
- done
- export CONFIG_SHELL
- exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
-fi
-
-
- if test $as_have_required = no; then
- echo This script requires a shell more modern than all the
- echo shells that I found on your system. Please install a
- echo modern shell, or manually run the script under such a
- echo shell if you do have one.
- { (exit 1); exit 1; }
-fi
-
-
-fi
-
-fi
-
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
-(eval "as_func_return () {
- (exit \$1)
-}
-as_func_success () {
- as_func_return 0
-}
-as_func_failure () {
- as_func_return 1
-}
-as_func_ret_success () {
- return 0
-}
-as_func_ret_failure () {
- return 1
-}
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+ fi
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
-exitcode=0
-if as_func_success; then
- :
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
else
- exitcode=1
- echo as_func_success failed.
-fi
-
-if as_func_failure; then
- exitcode=1
- echo as_func_failure succeeded.
+ as_expr=false
fi
-if as_func_ret_success; then
- :
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
else
- exitcode=1
- echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
- exitcode=1
- echo as_func_ret_failure succeeded.
+ as_basename=false
fi
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
- :
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
else
- exitcode=1
- echo positional parameters were not saved.
+ as_dirname=false
fi
-test \$exitcode = 0") || {
- echo No shell found that supports shell functions.
- echo Please tell autoconf@gnu.org about your system,
- echo including any error possibly output before this
- echo message
-}
-
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+# 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
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
- # 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 after each line using $LINENO; the second 'sed'
- # does the real work. The second script uses 'N' to pair each
- # line-number line with the line containing $LINENO, 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
- # scripts with optimization help from Paolo Bonzini. Blame Lee
- # E. McMahon (1931-1989) for sed's syntax. :-)
+ as_lineno_1=$LINENO as_lineno_1a=$LINENO
+ as_lineno_2=$LINENO as_lineno_2a=$LINENO
+ eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
+ test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
+ # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
sed -n '
p
/[$]LINENO/=
@@ -453,8 +442,7 @@ test \$exitcode = 0") || {
s/-\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; }; }
+ { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_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
@@ -464,49 +452,40 @@ test \$exitcode = 0") || {
exit
}
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
-
ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
+case `echo -n x` in #(((((
-n*)
- case `echo 'x\c'` in
+ case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
- *) ECHO_C='\c';;
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
esac;;
*)
ECHO_N='-n';;
esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
- mkdir conf$$.dir
-fi
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- as_ln_s='ln -s'
- # ... but there are two gotchas:
- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
as_ln_s='cp -p'
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
+ fi
else
as_ln_s='cp -p'
fi
@@ -514,7 +493,7 @@ rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
+ as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
@@ -531,12 +510,12 @@ else
as_test_x='
eval sh -c '\''
if test -d "$1"; then
- test -d "$1/.";
+ test -d "$1/.";
else
- case $1 in
- -*)set "./$1";;
+ case $1 in #(
+ -*)set "./$1";;
esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
???[sx]*):;;*)false;;esac;fi
'\'' sh
'
@@ -551,26 +530,25 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
# Check that we are running under the correct shell.
SHELL=${CONFIG_SHELL-/bin/sh}
-case X$ECHO in
+case X$lt_ECHO in
X*--fallback-echo)
# Remove one level of quotation (which was required for Make).
- ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','`
+ ECHO=`echo "$lt_ECHO" | sed 's,\\\\\$\\$0,'$0','`
;;
esac
-echo=${ECHO-echo}
+ECHO=${lt_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!
+elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t' ; then
+ # Yippee, $ECHO works!
:
else
# Restart under the correct shell.
@@ -580,9 +558,9 @@ fi
if test "X$1" = X--fallback-echo; then
# used as fallback echo
shift
- cat <<EOF
+ cat <<_LT_EOF
$*
-EOF
+_LT_EOF
exit 0
fi
@@ -590,125 +568,121 @@ fi
# if CDPATH is set.
(unset CDPATH) >/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 -z "$lt_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 &&
+ { 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.
+ 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
+ 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 -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"
+ 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
- # maybe with a smaller string...
- prev=:
+ # 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
+ 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
+ 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
-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"
+lt_ECHO=$ECHO
+if test "X$lt_ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+ lt_ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
fi
-tagnames=${tagnames+${tagnames},}CXX
-
-tagnames=${tagnames+${tagnames},}F77
-
-exec 7<&0 </dev/null 6>&1
+test -n "$DJDIR" || exec 7<&0 </dev/null
+exec 6>&1
# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
+# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
@@ -723,14 +697,14 @@ cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='ntfs-3g'
PACKAGE_TARNAME='ntfs-3g'
-PACKAGE_VERSION='2010.5.16'
-PACKAGE_STRING='ntfs-3g 2010.5.16'
+PACKAGE_VERSION='2014.2.15'
+PACKAGE_STRING='ntfs-3g 2014.2.15'
PACKAGE_BUGREPORT='ntfs-3g-devel@lists.sf.net'
+PACKAGE_URL=''
ac_unique_file="src/ntfs-3g.c"
# Factoring default headers for most tests.
@@ -770,151 +744,209 @@ ac_includes_default="\
#endif"
ac_header_list=
-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
-datarootdir
-datadir
-sysconfdir
-sharedstatedir
-localstatedir
-includedir
-oldincludedir
-docdir
-infodir
-htmldir
-dvidir
-pdfdir
-psdir
-libdir
-localedir
-mandir
-DEFS
-ECHO_C
-ECHO_N
-ECHO_T
-LIBS
-build_alias
-host_alias
-target_alias
-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
-am__isrc
-CYGPATH_W
-PACKAGE
-VERSION
-ACLOCAL
-AUTOCONF
-AUTOMAKE
-AUTOHEADER
-MAKEINFO
-install_sh
-STRIP
-INSTALL_STRIP_PROGRAM
-mkdir_p
-AWK
-SET_MAKE
-am__leading_dot
-AMTAR
-am__tar
-am__untar
-MAINTAINER_MODE_TRUE
-MAINTAINER_MODE_FALSE
-MAINT
-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
+ac_subst_vars='am__EXEEXT_FALSE
+am__EXEEXT_TRUE
+LTLIBOBJS
+ENABLE_EXTRAS_FALSE
+ENABLE_EXTRAS_TRUE
+ENABLE_NTFSPROGS_FALSE
+ENABLE_NTFSPROGS_TRUE
+ENABLE_NTFS_3G_FALSE
+ENABLE_NTFS_3G_TRUE
+ENABLE_MOUNT_HELPER_FALSE
+ENABLE_MOUNT_HELPER_TRUE
+INSTALL_LIBRARY_FALSE
+INSTALL_LIBRARY_TRUE
+REALLYSTATIC_FALSE
+REALLYSTATIC_TRUE
+RUN_LDCONFIG_FALSE
+RUN_LDCONFIG_TRUE
+NTFS_DEVICE_DEFAULT_IO_OPS_FALSE
+NTFS_DEVICE_DEFAULT_IO_OPS_TRUE
+WINDOWS_FALSE
+WINDOWS_TRUE
+GENERATE_LDSCRIPT_FALSE
+GENERATE_LDSCRIPT_TRUE
+FUSE_INTERNAL_FALSE
+FUSE_INTERNAL_TRUE
+OUTPUT_FORMAT
+NTFSPROGS_STATIC_LIBS
+LIBNTFS_LIBS
+LIBNTFS_CPPFLAGS
+MKNTFS_LIBS
+MKNTFS_CPPFLAGS
+LIBFUSE_LITE_LIBS
+LIBFUSE_LITE_CFLAGS
+LIBNTFS_3G_VERSION
+rootlibdir
+rootsbindir
+rootbindir
+ntfs3gincludedir
+pkgconfigdir
+LIBOBJS
+all_libraries
+all_includes
+ENABLE_CRYPTO_FALSE
+ENABLE_CRYPTO_TRUE
+GNUTLS_LIBS
+GNUTLS_CFLAGS
+LIBGCRYPT_LIBS
+LIBGCRYPT_CFLAGS
+LIBGCRYPT_CONFIG
+FUSE_MODULE_LIBS
+FUSE_MODULE_CFLAGS
+LDCONFIG
+RM
+MV
+PKG_CONFIG_LIBDIR
+PKG_CONFIG_PATH
+PKG_CONFIG
+OTOOL64
+OTOOL
+LIPO
+NMEDIT
+DSYMUTIL
+lt_ECHO
+RANLIB
+AR
+OBJDUMP
+NM
+ac_ct_DUMPBIN
+DUMPBIN
+LD
+FGREP
SED
-GREP
+LIBTOOL
+LN_S
EGREP
-ECHO
-AR
-RANLIB
-DSYMUTIL
-NMEDIT
+GREP
CPP
-CXX
-CXXFLAGS
-ac_ct_CXX
-CXXDEPMODE
-am__fastdepCXX_TRUE
-am__fastdepCXX_FALSE
-CXXCPP
-F77
-FFLAGS
-ac_ct_F77
-LIBTOOL
-MV
-RM
-LDCONFIG
-PKG_CONFIG
-FUSE_MODULE_CFLAGS
-FUSE_MODULE_LIBS
-LIBOBJS
-pkgconfigdir
-ntfs3gincludedir
-rootbindir
-rootsbindir
-rootlibdir
-LIBNTFS_3G_VERSION
-LIBFUSE_LITE_LIBS
-OUTPUT_FORMAT
-FUSE_INTERNAL_TRUE
-FUSE_INTERNAL_FALSE
-GENERATE_LDSCRIPT_TRUE
-GENERATE_LDSCRIPT_FALSE
-WINDOWS_TRUE
-WINDOWS_FALSE
-NTFS_DEVICE_DEFAULT_IO_OPS_TRUE
-NTFS_DEVICE_DEFAULT_IO_OPS_FALSE
-RUN_LDCONFIG_TRUE
-RUN_LDCONFIG_FALSE
-REALLYSTATIC_TRUE
-REALLYSTATIC_FALSE
-INSTALL_LIBRARY_TRUE
-INSTALL_LIBRARY_FALSE
-ENABLE_MOUNT_HELPER_TRUE
-ENABLE_MOUNT_HELPER_FALSE
+am__fastdepCC_FALSE
+am__fastdepCC_TRUE
+CCDEPMODE
+AMDEPBACKSLASH
+AMDEP_FALSE
+AMDEP_TRUE
+am__quote
+am__include
+DEPDIR
+OBJEXT
+EXEEXT
+ac_ct_CC
+CPPFLAGS
+LDFLAGS
+CFLAGS
+CC
+MAINT
+MAINTAINER_MODE_FALSE
+MAINTAINER_MODE_TRUE
+am__untar
+am__tar
+AMTAR
+am__leading_dot
+SET_MAKE
+AWK
+mkdir_p
MKDIR_P
-LTLIBOBJS'
+INSTALL_STRIP_PROGRAM
+STRIP
+install_sh
+MAKEINFO
+AUTOHEADER
+AUTOMAKE
+AUTOCONF
+ACLOCAL
+VERSION
+PACKAGE
+CYGPATH_W
+am__isrc
+INSTALL_DATA
+INSTALL_SCRIPT
+INSTALL_PROGRAM
+target_os
+target_vendor
+target_cpu
+target
+host_os
+host_vendor
+host_cpu
+host
+build_os
+build_vendor
+build_cpu
+build
+target_alias
+host_alias
+build_alias
+LIBS
+ECHO_T
+ECHO_N
+ECHO_C
+DEFS
+mandir
+localedir
+libdir
+psdir
+pdfdir
+dvidir
+htmldir
+infodir
+docdir
+oldincludedir
+includedir
+localstatedir
+sharedstatedir
+sysconfdir
+datadir
+datarootdir
+libexecdir
+sbindir
+bindir
+program_transform_name
+prefix
+exec_prefix
+PACKAGE_URL
+PACKAGE_BUGREPORT
+PACKAGE_STRING
+PACKAGE_VERSION
+PACKAGE_TARNAME
+PACKAGE_NAME
+PATH_SEPARATOR
+SHELL'
ac_subst_files=''
+ac_user_opts='
+enable_option_checking
+enable_maintainer_mode
+enable_debug
+enable_warnings
+enable_pedantic
+enable_really_static
+enable_mount_helper
+enable_ldscript
+enable_ldconfig
+enable_library
+enable_mtab
+enable_posix_acls
+enable_xattr_mappings
+enable_device_default_io_ops
+enable_ntfs_3g
+enable_ntfsprogs
+enable_crypto
+enable_extras
+enable_nfconv
+enable_dependency_tracking
+enable_shared
+enable_static
+with_pic
+enable_fast_install
+with_gnu_ld
+enable_libtool_lock
+with_fuse
+with_libgcrypt_prefix
+with_uuid
+with_hd
+enable_largefile
+'
ac_precious_vars='build_alias
host_alias
target_alias
@@ -924,21 +956,21 @@ LDFLAGS
LIBS
CPPFLAGS
CPP
-CXX
-CXXFLAGS
-CCC
-CXXCPP
-F77
-FFLAGS
-LDCONFIG
PKG_CONFIG
+PKG_CONFIG_PATH
+PKG_CONFIG_LIBDIR
+LDCONFIG
FUSE_MODULE_CFLAGS
-FUSE_MODULE_LIBS'
+FUSE_MODULE_LIBS
+GNUTLS_CFLAGS
+GNUTLS_LIBS'
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
+ac_unrecognized_opts=
+ac_unrecognized_sep=
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
@@ -994,8 +1026,9 @@ do
fi
case $ac_option in
- *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
- *) ac_optarg=yes ;;
+ *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *=) ac_optarg= ;;
+ *) ac_optarg=yes ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
@@ -1037,13 +1070,20 @@ do
datarootdir=$ac_optarg ;;
-disable-* | --disable-*)
- ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ ac_useropt=`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 ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=no ;;
-docdir | --docdir | --docdi | --doc | --do)
ac_prev=docdir ;;
@@ -1056,13 +1096,20 @@ do
dvidir=$ac_optarg ;;
-enable-* | --enable-*)
- ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ ac_useropt=`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'`
- eval enable_$ac_feature=\$ac_optarg ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid feature name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"enable_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval enable_$ac_useropt=\$ac_optarg ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -1253,22 +1300,36 @@ do
ac_init_version=: ;;
-with-* | --with-*)
- ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ ac_useropt=`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'`
- eval with_$ac_package=\$ac_optarg ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=\$ac_optarg ;;
-without-* | --without-*)
- ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ ac_useropt=`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 ;;
+ expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
+ as_fn_error $? "invalid package name: $ac_useropt"
+ ac_useropt_orig=$ac_useropt
+ ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
+ case $ac_user_opts in
+ *"
+"with_$ac_useropt"
+"*) ;;
+ *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
+ ac_unrecognized_sep=', ';;
+ esac
+ eval with_$ac_useropt=no ;;
--x)
# Obsolete; use --with-x.
@@ -1288,25 +1349,25 @@ do
| --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; }; }
+ -*) as_fn_error $? "unrecognized option: \`$ac_option'
+Try \`$0 --help' for more information"
;;
*=*)
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; }; }
+ case $ac_envvar in #(
+ '' | [0-9]* | *[!_$as_cr_alnum]* )
+ as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
+ esac
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
+ $as_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
+ $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
: ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
;;
@@ -1315,23 +1376,36 @@ 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; }; }
+ as_fn_error $? "missing argument to $ac_option"
fi
-# Be sure to have absolute directory names.
+if test -n "$ac_unrecognized_opts"; then
+ case $enable_option_checking in
+ no) ;;
+ fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
+ *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
+ esac
+fi
+
+# Check all directory arguments for consistency.
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
do
eval ac_val=\$$ac_var
+ # Remove trailing slashes.
+ case $ac_val in
+ */ )
+ ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
+ eval $ac_var=\$ac_val;;
+ esac
+ # Be sure to have absolute directory names.
case $ac_val in
[\\/$]* | ?:[\\/]* ) continue;;
NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac
- { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
done
# There might be people who depend on the old broken behavior: `$host'
@@ -1345,8 +1419,8 @@ target=$target_alias
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
+ $as_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
@@ -1361,23 +1435,21 @@ test "$silent" = yes && exec 6>/dev/null
ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
- { echo "$as_me: error: Working directory cannot be determined" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error $? "working directory cannot be determined"
test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
- { echo "$as_me: error: pwd does not report name of working directory" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error $? "pwd does not report name of working directory"
# 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 the parent directory.
- ac_confdir=`$as_dirname -- "$0" ||
-$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$0" : 'X\(//\)[^/]' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$0" |
+ ac_confdir=`$as_dirname -- "$as_myself" ||
+$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_myself" : 'X\(//\)[^/]' \| \
+ X"$as_myself" : 'X\(//\)$' \| \
+ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_myself" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
@@ -1404,13 +1476,11 @@ else
fi
if test ! -r "$srcdir/$ac_unique_file"; then
test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
- { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
- { (exit 1); exit 1; }; }
+ as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
fi
ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
ac_abs_confdir=`(
- cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
- { (exit 1); exit 1; }; }
+ cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
pwd)`
# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1436,7 +1506,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 ntfs-3g 2010.5.16 to adapt to many kinds of systems.
+\`configure' configures ntfs-3g 2014.2.15 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1450,7 +1520,7 @@ Configuration:
--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
+ -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
@@ -1458,9 +1528,9 @@ Configuration:
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
@@ -1470,25 +1540,25 @@ 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]
- --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]
- --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
- --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
- --infodir=DIR info documentation [DATAROOTDIR/info]
- --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
- --mandir=DIR man documentation [DATAROOTDIR/man]
- --docdir=DIR documentation root [DATAROOTDIR/doc/ntfs-3g]
- --htmldir=DIR html documentation [DOCDIR]
- --dvidir=DIR dvi documentation [DOCDIR]
- --pdfdir=DIR pdf documentation [DOCDIR]
- --psdir=DIR ps documentation [DOCDIR]
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --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]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/ntfs-3g]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
_ACEOF
cat <<\_ACEOF
@@ -1507,11 +1577,12 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of ntfs-3g 2010.5.16:";;
+ short | recursive ) echo "Configuration of ntfs-3g 2014.2.15:";;
esac
cat <<\_ACEOF
Optional Features:
+ --disable-option-checking ignore unrecognized --enable/--with options
--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
@@ -1526,8 +1597,14 @@ Optional Features:
--disable-library do not install libntfs-3g but link it into ntfs-3g
--disable-mtab disable and ignore usage of /etc/mtab
--enable-posix-acls enable POSIX ACL support
+ --enable-xattr-mappings enable system extended attributes mappings
--disable-device-default-io-ops
install default IO ops
+ --disable-ntfs-3g disable the ntfs-3g FUSE driver
+ --disable-ntfsprogs disable ntfsprogs utilities (default=no)
+ --enable-crypto enable crypto related code and utilities
+ (default=no)
+ --enable-extras enable extra ntfsprogs utilities (default=no)
--disable-nfconv disable the 'nfconv' patch, which adds support for
Unicode normalization form conversion when built on
Mac OS X [default=enabled for Mac OS X]
@@ -1543,13 +1620,22 @@ Optional Features:
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-fuse=<internal|external>
Select FUSE library: internal or external
[default=internal]
+ --with-libgcrypt-prefix=PFX
+ prefix where LIBGCRYPT is installed (optional)
+
+ --with-uuid[=PFX] generate DCE compliant UUIDs, with optional prefix
+ to uuid library and headers [default=detect]
+ --without-uuid do not generate DCE compliant UUIDs
+
+ --with-hd[=PFX] use Windows compliant disk geometry, with optional
+ prefix to hd library and headers [default=detect]
+ --without-hd do not use Windows compliant disk geometry
Some influential environment variables:
CC C compiler command
@@ -1557,20 +1643,22 @@ Some influential environment variables:
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
- CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
+ CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
- CXX C++ compiler command
- CXXFLAGS C++ compiler flags
- CXXCPP C++ preprocessor
- F77 Fortran 77 compiler command
- FFLAGS Fortran 77 compiler flags
- LDCONFIG ldconfig utility
PKG_CONFIG path to pkg-config utility
+ PKG_CONFIG_PATH
+ directories to add to pkg-config's search path
+ PKG_CONFIG_LIBDIR
+ path overriding pkg-config's built-in search path
+ LDCONFIG ldconfig utility
FUSE_MODULE_CFLAGS
C compiler flags for FUSE_MODULE, overriding pkg-config
FUSE_MODULE_LIBS
linker flags for FUSE_MODULE, overriding pkg-config
+ GNUTLS_CFLAGS
+ C compiler flags for GNUTLS, overriding pkg-config
+ GNUTLS_LIBS linker flags for GNUTLS, 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.
@@ -1583,15 +1671,17 @@ fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d "$ac_dir" || continue
+ test -d "$ac_dir" ||
+ { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
+ continue
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
# A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
@@ -1627,7 +1717,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
echo &&
$SHELL "$ac_srcdir/configure" --help=recursive
else
- echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi || ac_status=$?
cd "$ac_pwd" || { ac_status=$?; break; }
done
@@ -1636,22 +1726,488 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-ntfs-3g configure 2010.5.16
-generated by GNU Autoconf 2.61
+ntfs-3g configure 2014.2.15
+generated by GNU Autoconf 2.67
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
+Copyright (C) 2010 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
fi
+
+## ------------------------ ##
+## Autoconf initialization. ##
+## ------------------------ ##
+
+# ac_fn_c_try_compile LINENO
+# --------------------------
+# Try to compile conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext
+ if { { ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compile") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_compile
+
+# ac_fn_c_try_cpp LINENO
+# ----------------------
+# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_cpp ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } > conftest.i && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_cpp
+
+# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists, giving a warning if it cannot be compiled using
+# the include files in INCLUDES and setting the cache variable VAR
+# accordingly.
+ac_fn_c_check_header_mongrel ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if eval "test \"\${$3+set}\"" = set; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+ $as_echo_n "(cached) " >&6
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
+$as_echo_n "checking $2 usability... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_header_compiler=yes
+else
+ ac_header_compiler=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
+$as_echo "$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
+$as_echo_n "checking $2 presence... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <$2>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ ac_header_preproc=yes
+else
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
+$as_echo "$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
+ yes:no: )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
+$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+ ;;
+ no:yes:* )
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
+$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
+$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
+$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
+$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
+$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
+( $as_echo "## ----------------------------------------- ##
+## Report this to ntfs-3g-devel@lists.sf.net ##
+## ----------------------------------------- ##"
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=\$ac_header_compiler"
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+fi
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_mongrel
+
+# ac_fn_c_try_run LINENO
+# ----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
+# that executables *can* be run.
+ac_fn_c_try_run ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: program exited with status $ac_status" >&5
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=$ac_status
+fi
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_run
+
+# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
+# -------------------------------------------------------
+# Tests whether HEADER exists and can be compiled using the include files in
+# INCLUDES, setting the cache variable VAR accordingly.
+ac_fn_c_check_header_compile ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+#include <$2>
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_header_compile
+
+# ac_fn_c_try_link LINENO
+# -----------------------
+# Try to link conftest.$ac_ext, and return whether this succeeded.
+ac_fn_c_try_link ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ rm -f conftest.$ac_objext conftest$ac_exeext
+ if { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>conftest.err
+ ac_status=$?
+ if test -s conftest.err; then
+ grep -v '^ *+' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ mv -f conftest.er1 conftest.err
+ fi
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext && {
+ test "$cross_compiling" = yes ||
+ $as_test_x conftest$ac_exeext
+ }; then :
+ ac_retval=0
+else
+ $as_echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_retval=1
+fi
+ # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information
+ # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would
+ # interfere with the next link command; also delete a directory that is
+ # left behind by Apple's compiler. We do this before executing the actions.
+ rm -rf conftest.dSYM conftest_ipa8_conftest.oo
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+ as_fn_set_status $ac_retval
+
+} # ac_fn_c_try_link
+
+# ac_fn_c_check_func LINENO FUNC VAR
+# ----------------------------------
+# Tests whether FUNC exists, setting the cache variable VAR accordingly
+ac_fn_c_check_func ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $2 innocuous_$2
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $2 (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $2
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char $2 ();
+/* 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_$2 || defined __stub___$2
+choke me
+#endif
+
+int
+main ()
+{
+return $2 ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ eval "$3=yes"
+else
+ eval "$3=no"
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_func
+
+# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
+# -------------------------------------------
+# Tests whether TYPE exists after having included INCLUDES, setting cache
+# variable VAR accordingly.
+ac_fn_c_check_type ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
+$as_echo_n "checking for $2... " >&6; }
+if eval "test \"\${$3+set}\"" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ eval "$3=no"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof ($2))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$4
+int
+main ()
+{
+if (sizeof (($2)))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+else
+ eval "$3=yes"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$3
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_type
+
+# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
+# ----------------------------------------------------
+# Tries to find if the field MEMBER exists in type AGGR, after including
+# INCLUDES, setting cache variable VAR accordingly.
+ac_fn_c_check_member ()
+{
+ as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
+$as_echo_n "checking for $2.$3... " >&6; }
+if eval "test \"\${$4+set}\"" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (ac_aggr.$3)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$4=yes"
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+$5
+int
+main ()
+{
+static $2 ac_aggr;
+if (sizeof ac_aggr.$3)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ eval "$4=yes"
+else
+ eval "$4=no"
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+eval ac_res=\$$4
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
+$as_echo "$ac_res" >&6; }
+ eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;}
+
+} # ac_fn_c_check_member
cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by ntfs-3g $as_me 2010.5.16, which was
-generated by GNU Autoconf 2.61. Invocation command line was
+It was created by ntfs-3g $as_me 2014.2.15, which was
+generated by GNU Autoconf 2.67. Invocation command line was
$ $0 $@
@@ -1687,8 +2243,8 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- echo "PATH: $as_dir"
-done
+ $as_echo "PATH: $as_dir"
+ done
IFS=$as_save_IFS
} >&5
@@ -1722,12 +2278,12 @@ do
| -silent | --silent | --silen | --sile | --sil)
continue ;;
*\'*)
- ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
- 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
+ 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
2)
- ac_configure_args1="$ac_configure_args1 '$ac_arg'"
+ as_fn_append ac_configure_args1 " '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
@@ -1743,13 +2299,13 @@ do
-* ) ac_must_keep_next=true ;;
esac
fi
- ac_configure_args="$ac_configure_args '$ac_arg'"
+ as_fn_append ac_configure_args " '$ac_arg'"
;;
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; }
+{ ac_configure_args0=; unset ac_configure_args0;}
+{ ac_configure_args1=; unset ac_configure_args1;}
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
@@ -1761,11 +2317,9 @@ trap 'exit_status=$?
{
echo
- cat <<\_ASBOX
-## ---------------- ##
+ $as_echo "## ---------------- ##
## Cache variables. ##
-## ---------------- ##
-_ASBOX
+## ---------------- ##"
echo
# The following way of writing the cache mishandles newlines in values,
(
@@ -1774,12 +2328,13 @@ _ASBOX
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
- *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
- *) $as_unset $ac_var ;;
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
@@ -1798,132 +2353,140 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
)
echo
- cat <<\_ASBOX
-## ----------------- ##
+ $as_echo "## ----------------- ##
## Output variables. ##
-## ----------------- ##
-_ASBOX
+## ----------------- ##"
echo
for ac_var in $ac_subst_vars
do
eval ac_val=\$$ac_var
case $ac_val in
- *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
- echo "$ac_var='\''$ac_val'\''"
+ $as_echo "$ac_var='\''$ac_val'\''"
done | sort
echo
if test -n "$ac_subst_files"; then
- cat <<\_ASBOX
-## ------------------- ##
+ $as_echo "## ------------------- ##
## File substitutions. ##
-## ------------------- ##
-_ASBOX
+## ------------------- ##"
echo
for ac_var in $ac_subst_files
do
eval ac_val=\$$ac_var
case $ac_val in
- *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
- echo "$ac_var='\''$ac_val'\''"
+ $as_echo "$ac_var='\''$ac_val'\''"
done | sort
echo
fi
if test -s confdefs.h; then
- cat <<\_ASBOX
-## ----------- ##
+ $as_echo "## ----------- ##
## confdefs.h. ##
-## ----------- ##
-_ASBOX
+## ----------- ##"
echo
cat confdefs.h
echo
fi
test "$ac_signal" != 0 &&
- echo "$as_me: caught signal $ac_signal"
- echo "$as_me: exit $exit_status"
+ $as_echo "$as_me: caught signal $ac_signal"
+ $as_echo "$as_me: exit $exit_status"
} >&5
rm -f core *.core core.conftest.* &&
rm -f -r 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
+ trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -f -r conftest* confdefs.h
+$as_echo "/* confdefs.h */" > 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
+cat >>confdefs.h <<_ACEOF
+#define PACKAGE_URL "$PACKAGE_URL"
+_ACEOF
+
# Let the site file select an alternate cache file if it wants to.
-# Prefer explicitly selected file to automatically selected ones.
+# Prefer an explicitly selected file to automatically selected ones.
+ac_site_file1=NONE
+ac_site_file2=NONE
if test -n "$CONFIG_SITE"; then
- set x "$CONFIG_SITE"
+ # We do not want a PATH search for config.site.
+ case $CONFIG_SITE in #((
+ -*) ac_site_file1=./$CONFIG_SITE;;
+ */*) ac_site_file1=$CONFIG_SITE;;
+ *) ac_site_file1=./$CONFIG_SITE;;
+ esac
elif test "x$prefix" != xNONE; then
- set x "$prefix/share/config.site" "$prefix/etc/config.site"
+ ac_site_file1=$prefix/share/config.site
+ ac_site_file2=$prefix/etc/config.site
else
- set x "$ac_default_prefix/share/config.site" \
- "$ac_default_prefix/etc/config.site"
+ ac_site_file1=$ac_default_prefix/share/config.site
+ ac_site_file2=$ac_default_prefix/etc/config.site
fi
-shift
-for ac_site_file
+for ac_site_file in "$ac_site_file1" "$ac_site_file2"
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;}
+ test "x$ac_site_file" = xNONE && continue
+ if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
+$as_echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
- . "$ac_site_file"
+ . "$ac_site_file" \
+ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "failed to load site script $ac_site_file
+See \`config.log' for more details" "$LINENO" 5 ; }
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;}
+ # Some versions of bash will fail to source /dev/null (special files
+ # actually), so we avoid doing that. DJGPP emulates it as a regular file.
+ if test /dev/null != "$cache_file" && test -f "$cache_file"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
+$as_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;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
+$as_echo "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
-ac_header_list="$ac_header_list utime.h"
+as_fn_append ac_header_list " utime.h"
# Check that the precious variables saved in the cache have kept the same
# value.
ac_cache_corrupted=false
@@ -1934,68 +2497,56 @@ for ac_var in $ac_precious_vars; do
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;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+$as_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;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
+$as_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=:
+ # differences in whitespace do not lead to failure.
+ ac_old_val_w=`echo x $ac_old_val`
+ ac_new_val_w=`echo x $ac_new_val`
+ if test "$ac_old_val_w" != "$ac_new_val_w"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
+$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ ac_cache_corrupted=:
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
+$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
+ eval $ac_var=\$ac_old_val
+ fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
+$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
+$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
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=`$as_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'" ;;
+ *) as_fn_append 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; }; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
+$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+## -------------------- ##
+## Main body of script. ##
+## -------------------- ##
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -2004,7 +2555,7 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $
ac_compiler_gnu=$ac_cv_c_compiler_gnu
-LIBNTFS_3G_VERSION="76"
+LIBNTFS_3G_VERSION="85"
# Environment
@@ -2025,9 +2576,7 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
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; }; }
+ as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
fi
# These three variables are undocumented and unsupported,
@@ -2041,35 +2590,27 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
- { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
-echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
-{ 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
+$as_echo_n "checking build system type... " >&6; }
+if test "${ac_cv_build+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
ac_build_alias=$build_alias
test "x$ac_build_alias" = x &&
ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
test "x$ac_build_alias" = x &&
- { { 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; }; }
+ as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
- { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-echo "${ECHO_T}$ac_cv_build" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
+$as_echo "$ac_cv_build" >&6; }
case $ac_cv_build in
*-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
-echo "$as_me: error: invalid value of canonical build" >&2;}
- { (exit 1); exit 1; }; };;
+*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5 ;;
esac
build=$ac_cv_build
ac_save_IFS=$IFS; IFS='-'
@@ -2085,28 +2626,24 @@ IFS=$ac_save_IFS
case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
-{ 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
+$as_echo_n "checking host system type... " >&6; }
+if test "${ac_cv_host+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
if test "x$host_alias" = x; then
ac_cv_host=$ac_cv_build
else
ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
- { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
fi
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-echo "${ECHO_T}$ac_cv_host" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
+$as_echo "$ac_cv_host" >&6; }
case $ac_cv_host in
*-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
-echo "$as_me: error: invalid value of canonical host" >&2;}
- { (exit 1); exit 1; }; };;
+*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5 ;;
esac
host=$ac_cv_host
ac_save_IFS=$IFS; IFS='-'
@@ -2122,28 +2659,24 @@ IFS=$ac_save_IFS
case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
-{ 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5
+$as_echo_n "checking target system type... " >&6; }
+if test "${ac_cv_target+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
if test "x$target_alias" = x; then
ac_cv_target=$ac_cv_host
else
ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` ||
- { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $target_alias failed" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5
fi
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_target" >&5
-echo "${ECHO_T}$ac_cv_target" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5
+$as_echo "$ac_cv_target" >&6; }
case $ac_cv_target in
*-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical target" >&5
-echo "$as_me: error: invalid value of canonical target" >&2;}
- { (exit 1); exit 1; }; };;
+*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5 ;;
esac
target=$ac_cv_target
ac_save_IFS=$IFS; IFS='-'
@@ -2167,7 +2700,7 @@ test -n "$target_alias" &&
program_prefix=${target_alias}-
# Automake
-am__api_version='1.10'
+am__api_version='1.11'
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
@@ -2182,22 +2715,23 @@ am__api_version='1.10'
# 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; }
+# Reject install programs that cannot install multiple files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
+$as_echo_n "checking for a BSD-compatible install... " >&6; }
if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+if test "${ac_cv_path_install+set}" = set; then :
+ $as_echo_n "(cached) " >&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/* | \
+ # 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\\/* | \
+ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
/usr/ucb/* ) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
@@ -2215,17 +2749,29 @@ case $as_dir/ in
# 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
+ rm -rf conftest.one conftest.two conftest.dir
+ echo one > conftest.one
+ echo two > conftest.two
+ mkdir conftest.dir
+ if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
+ test -s conftest.one && test -s conftest.two &&
+ test -s conftest.dir/conftest.one &&
+ test -s conftest.dir/conftest.two
+ then
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
+ fi
fi
fi
done
done
;;
esac
-done
+
+ done
IFS=$as_save_IFS
+rm -rf conftest.one conftest.two conftest.dir
fi
if test "${ac_cv_path_install+set}" = set; then
@@ -2238,8 +2784,8 @@ fi
INSTALL=$ac_install_sh
fi
fi
-{ echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
+$as_echo "$INSTALL" >&6; }
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
@@ -2249,21 +2795,34 @@ 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; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
+$as_echo_n "checking whether build environment is sane... " >&6; }
# Just in case
sleep 1
echo timestamp > conftest.file
+# Reject unsafe characters in $srcdir or the absolute working directory
+# name. Accept space and tab only in the latter.
+am_lf='
+'
+case `pwd` in
+ *[\\\"\#\$\&\'\`$am_lf]*)
+ as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5 ;;
+esac
+case $srcdir in
+ *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
+ as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5 ;;
+esac
+
# 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`
+ 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`
+ set X `ls -t "$srcdir/configure" conftest.file`
fi
rm -f conftest.file
if test "$*" != "X $srcdir/configure conftest.file" \
@@ -2273,11 +2832,8 @@ if (
# 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; }; }
+ as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
+alias in your environment" "$LINENO" 5
fi
test "$2" = conftest.file
@@ -2286,52 +2842,162 @@ 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; }; }
+ as_fn_error $? "newly created file is older than distributed files!
+Check your system clock" "$LINENO" 5
fi
-{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "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.
+# Double any \ or $.
# 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 -f conftest.sed
+ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
+program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
# 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"
+if test x"${MISSING+set}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
+ *)
+ MISSING="\${SHELL} $am_aux_dir/missing" ;;
+ esac
+fi
# 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;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
+$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if test x"${install_sh}" != xset; then
+ case $am_aux_dir in
+ *\ * | *\ *)
+ install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
+ *)
+ install_sh="\${SHELL} $am_aux_dir/install-sh"
+ esac
+fi
+
+# 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then :
+ $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
-{ echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5
-echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+ $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
+$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
if test -z "$MKDIR_P"; then
- if test "${ac_cv_path_mkdir+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+ if test "${ac_cv_path_mkdir+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_prog in mkdir gmkdir; do
+ for ac_prog in mkdir gmkdir; do
for ac_exec_ext in '' $ac_executable_extensions; do
{ test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue
case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
@@ -2343,11 +3009,12 @@ do
esac
done
done
-done
+ done
IFS=$as_save_IFS
fi
+ test -d ./--version && rmdir ./--version
if test "${ac_cv_path_mkdir+set}" = set; then
MKDIR_P="$ac_cv_path_mkdir -p"
else
@@ -2355,12 +3022,11 @@ fi
# value for MKDIR_P within a source directory, because that will
# break other packages using the cache if that directory is
# removed, or if the value is a relative name.
- test -d ./--version && rmdir ./--version
MKDIR_P="$ac_install_sh -d"
fi
fi
-{ echo "$as_me:$LINENO: result: $MKDIR_P" >&5
-echo "${ECHO_T}$MKDIR_P" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
+$as_echo "$MKDIR_P" >&6; }
mkdir_p="$MKDIR_P"
case $mkdir_p in
@@ -2372,10 +3038,10 @@ 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
if test -n "$AWK"; then
ac_cv_prog_AWK="$AWK" # Let the user override the test.
@@ -2385,43 +3051,44 @@ 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
fi
fi
AWK=$ac_cv_prog_AWK
if test -n "$AWK"; then
- { echo "$as_me:$LINENO: result: $AWK" >&5
-echo "${ECHO_T}$AWK" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
+$as_echo "$AWK" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "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 x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
+set x ${MAKE-make}
+ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\"" = set; then :
+ $as_echo_n "(cached) " >&6
else
cat >conftest.make <<\_ACEOF
SHELL = /bin/sh
all:
@echo '@@@%%%=$(MAKE)=@@@%%%'
_ACEOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
+# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
case `${MAKE-make} -f conftest.make 2>/dev/null` in
*@@@%%%=?*=@@@%%%*)
eval ac_cv_prog_make_${ac_make}_set=yes;;
@@ -2431,12 +3098,12 @@ esac
rm -f conftest.make
fi
if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
- { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
SET_MAKE=
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
SET_MAKE="MAKE=${MAKE-make}"
fi
@@ -2455,9 +3122,7 @@ if test "`cd $srcdir && pwd`" != "`pwd`"; then
am__isrc=' -I$(srcdir)'
# test to see if srcdir already configured
if 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; }; }
+ as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
fi
fi
@@ -2501,112 +3166,6 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
-install_sh=${install_sh-"\$(SHELL) $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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
-IFS=$as_save_IFS
-
-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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
-IFS=$as_save_IFS
-
-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
-
- if test "x$ac_ct_STRIP" = x; then
- STRIP=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- STRIP=$ac_ct_STRIP
- fi
-else
- STRIP="$ac_cv_prog_STRIP"
-fi
-
-fi
-INSTALL_STRIP_PROGRAM="\$(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.
@@ -2622,17 +3181,18 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
ac_config_headers="$ac_config_headers config.h"
-{ echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
-echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6; }
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
+$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
# Check whether --enable-maintainer-mode was given.
-if test "${enable_maintainer_mode+set}" = set; then
+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; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
+$as_echo "$USE_MAINTAINER_MODE" >&6; }
if test $USE_MAINTAINER_MODE = yes; then
MAINTAINER_MODE_TRUE=
MAINTAINER_MODE_FALSE='#'
@@ -2647,7 +3207,7 @@ fi
# Options
# Check whether --enable-debug was given.
-if test "${enable_debug+set}" = set; then
+if test "${enable_debug+set}" = set; then :
enableval=$enable_debug;
else
enable_debug="no"
@@ -2656,7 +3216,7 @@ fi
# Check whether --enable-warnings was given.
-if test "${enable_warnings+set}" = set; then
+if test "${enable_warnings+set}" = set; then :
enableval=$enable_warnings;
else
enable_warnings="no"
@@ -2665,7 +3225,7 @@ fi
# Check whether --enable-pedantic was given.
-if test "${enable_pedantic+set}" = set; then
+if test "${enable_pedantic+set}" = set; then :
enableval=$enable_pedantic;
else
enable_pedantic="no"
@@ -2674,7 +3234,7 @@ fi
# Check whether --enable-really-static was given.
-if test "${enable_really_static+set}" = set; then
+if test "${enable_really_static+set}" = set; then :
enableval=$enable_really_static;
else
enable_really_static="no"
@@ -2683,7 +3243,7 @@ fi
# Check whether --enable-mount-helper was given.
-if test "${enable_mount_helper+set}" = set; then
+if test "${enable_mount_helper+set}" = set; then :
enableval=$enable_mount_helper;
else
@@ -2697,7 +3257,7 @@ fi
# Check whether --enable-ldscript was given.
-if test "${enable_ldscript+set}" = set; then
+if test "${enable_ldscript+set}" = set; then :
enableval=$enable_ldscript;
else
enable_ldscript="no"
@@ -2706,7 +3266,7 @@ fi
# Check whether --enable-ldconfig was given.
-if test "${enable_ldconfig+set}" = set; then
+if test "${enable_ldconfig+set}" = set; then :
enableval=$enable_ldconfig;
else
enable_ldconfig="yes"
@@ -2715,7 +3275,7 @@ fi
# Check whether --enable-library was given.
-if test "${enable_library+set}" = set; then
+if test "${enable_library+set}" = set; then :
enableval=$enable_library;
else
enable_library="yes"
@@ -2724,7 +3284,7 @@ fi
# Check whether --enable-mtab was given.
-if test "${enable_mtab+set}" = set; then
+if test "${enable_mtab+set}" = set; then :
enableval=$enable_mtab;
else
enable_mtab="yes"
@@ -2733,7 +3293,7 @@ fi
# Check whether --enable-posix-acls was given.
-if test "${enable_posix_acls+set}" = set; then
+if test "${enable_posix_acls+set}" = set; then :
enableval=$enable_posix_acls;
else
enable_posix_acls="no"
@@ -2741,8 +3301,17 @@ else
fi
+# Check whether --enable-xattr-mappings was given.
+if test "${enable_xattr_mappings+set}" = set; then :
+ enableval=$enable_xattr_mappings;
+else
+ enable_xattr_mappings="no"
+
+fi
+
+
# Check whether --enable-device-default-io-ops was given.
-if test "${enable_device_default_io_ops+set}" = set; then
+if test "${enable_device_default_io_ops+set}" = set; then :
enableval=$enable_device_default_io_ops;
else
enable_device_default_io_ops="yes"
@@ -2750,8 +3319,44 @@ else
fi
+# Check whether --enable-ntfs-3g was given.
+if test "${enable_ntfs_3g+set}" = set; then :
+ enableval=$enable_ntfs_3g;
+else
+ enable_ntfs_3g="yes"
+
+fi
+
+
+# Check whether --enable-ntfsprogs was given.
+if test "${enable_ntfsprogs+set}" = set; then :
+ enableval=$enable_ntfsprogs;
+else
+ enable_ntfsprogs="yes"
+
+fi
+
+
+# Check whether --enable-crypto was given.
+if test "${enable_crypto+set}" = set; then :
+ enableval=$enable_crypto;
+else
+ enable_crypto=no
+
+fi
+
+
+# Check whether --enable-extras was given.
+if test "${enable_extras+set}" = set; then :
+ enableval=$enable_extras;
+else
+ enable_extras="no"
+
+fi
+
+
# Check whether --enable-nfconv was given.
-if test "${enable_nfconv+set}" = set; then
+if test "${enable_nfconv+set}" = set; then :
enableval=$enable_nfconv; enable_nfconv="no"
else
@@ -2765,28 +3370,272 @@ fi
# pthread_rwlock_t requires _GNU_SOURCE
+DEPDIR="${am__leading_dot}deps"
-cat >>confdefs.h <<\_ACEOF
-#define _GNU_SOURCE 1
-_ACEOF
+ac_config_commands="$ac_config_commands depfiles"
+am_make=${MAKE-make}
+cat > confinc << 'END'
+am__doit:
+ @echo this is the am__doit target
+.PHONY: am__doit
+END
+# If we don't find an include directive, just comment out the code.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5
+$as_echo_n "checking for style of include used by $am_make... " >&6; }
+am__include="#"
+am__quote=
+_am_result=none
+# First try GNU make style include.
+echo "include confinc" > confmf
+# Ignore all kinds of additional output from `make'.
+case `$am_make -s -f confmf 2> /dev/null` in #(
+*the\ am__doit\ target*)
+ am__include=include
+ am__quote=
+ _am_result=GNU
+ ;;
+esac
+# Now try BSD make style include.
+if test "$am__include" = "#"; then
+ echo '.include "confinc"' > confmf
+ case `$am_make -s -f confmf 2> /dev/null` in #(
+ *the\ am__doit\ target*)
+ am__include=.include
+ am__quote="\""
+ _am_result=BSD
+ ;;
+ esac
+fi
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5
+$as_echo "$_am_result" >&6; }
+rm -f confinc confmf
+
+# Check whether --enable-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
+
-# 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
- for ac_prog in gcc cc
+ # 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_CC="gcc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_CC" = x; then
+ CC=""
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ CC=$ac_ct_CC
+ fi
+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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_CC="${ac_tool_prefix}cc"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_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 $# != 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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$CC"; then
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in cl.exe
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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -2796,25 +3645,25 @@ 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
@@ -2823,14 +3672,14 @@ fi
fi
if test -z "$CC"; then
ac_ct_CC=$CC
- for ac_prog in gcc cc
+ for ac_prog in cl.exe
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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
@@ -2840,25 +3689,25 @@ 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
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; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
@@ -2870,64 +3719,48 @@ done
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
fi
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; }; }
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5 ; }
# Provide some information about the compiler.
-echo "$as_me:$LINENO: checking for C compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compiler --version >&5") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compiler -v >&5") 2>&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compiler -V >&5") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -2939,42 +3772,38 @@ main ()
}
_ACEOF
ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe b.out"
+ac_clean_files="$ac_clean_files a.out a.out.dSYM 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[^ ]*//'`
-#
-# List of possible output files, starting from the most likely.
-# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
-# only as a last resort. b.out is created by i960 compilers.
-ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
-#
-# The IRIX 6 linker writes into existing files which may not be
-# executable, retaining their permissions. Remove them first so a
-# subsequent execution test works.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
+$as_echo_n "checking whether the C compiler works... " >&6; }
+ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+
+# The possible output files:
+ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
+
ac_rmfiles=
for ac_file in $ac_files
do
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
* ) ac_rmfiles="$ac_rmfiles $ac_file";;
esac
done
rm -f $ac_rmfiles
-if { (ac_try="$ac_link_default"
+if { { ac_try="$ac_link_default"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link_default") 2>&5
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
# Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
# in a Makefile. We should not override ac_cv_exeext if it was cached,
@@ -2984,14 +3813,14 @@ for ac_file in $ac_files ''
do
test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
- if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
then :; else
ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
fi
@@ -3010,78 +3839,41 @@ test "$ac_cv_exeext" = no && ac_cv_exeext=
else
ac_file=''
fi
-
-{ echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6; }
-if test -z "$ac_file"; then
- echo "$as_me: failed program was:" >&5
+if test -z "$ac_file"; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+$as_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; }; }
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error 77 "C compiler cannot create executables
+See \`config.log' for more details" "$LINENO" 5 ; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
fi
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
+$as_echo_n "checking for C compiler default output file name... " >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
+$as_echo "$ac_file" >&6; }
ac_exeext=$ac_cv_exeext
-# Check that 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'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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
+rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
-# Check that 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 { (ac_try="$ac_link"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
+$as_echo_n "checking for suffix of executables... " >&6; }
+if { { ac_try="$ac_link"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
(eval "$ac_link") 2>&5
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; 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
@@ -3089,37 +3881,90 @@ eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
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 | *.map | *.inf | *.o | *.obj ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
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; }; }
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details" "$LINENO" 5 ; }
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 conftest$ac_cv_exeext
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
+$as_echo "$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. */
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdio.h>
+int
+main ()
+{
+FILE *f = fopen ("conftest.out", "w");
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ac_clean_files="$ac_clean_files conftest.out"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
+$as_echo_n "checking whether we are cross compiling... " >&6; }
+if test "$cross_compiling" != yes; then
+ { { ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+ if { ac_try='./conftest$ac_cv_exeext'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details" "$LINENO" 5 ; }
+ fi
+ fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
+$as_echo "$cross_compiling" >&6; }
+
+rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
+ac_clean_files=$ac_clean_files_save
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
+$as_echo_n "checking for suffix of object files... " >&6; }
+if test "${ac_cv_objext+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -3131,51 +3976,46 @@ main ()
}
_ACEOF
rm -f conftest.o conftest.obj
-if { (ac_try="$ac_compile"
+if { { ac_try="$ac_compile"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
(eval "$ac_compile") 2>&5
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; then
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then :
for ac_file in conftest.o conftest.obj conftest.*; do
test -f "$ac_file" || continue;
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
done
else
- echo "$as_me: failed program was:" >&5
+ $as_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; }; }
+{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "cannot compute suffix of object files: cannot compile
+See \`config.log' for more details" "$LINENO" 5 ; }
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; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
+$as_echo "$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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -3189,54 +4029,34 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
ac_compiler_gnu=yes
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_compiler_gnu=no
+ ac_compiler_gnu=no
fi
-
rm -f core 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`
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
-{ 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
ac_cv_prog_cc_g=no
CFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -3247,34 +4067,11 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- CFLAGS=""
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -3285,35 +4082,12 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_compile "$LINENO"; then :
- ac_c_werror_flag=$ac_save_c_werror_flag
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -3324,42 +4098,18 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_g=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
fi
-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$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
@@ -3375,18 +4125,14 @@ else
CFLAGS=
fi
fi
-{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
-echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
ac_cv_prog_cc_c89=no
ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
@@ -3443,31 +4189,9 @@ for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
- rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+ if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_prog_cc_c89=$ac_arg
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
fi
-
rm -f core conftest.err conftest.$ac_objext
test "x$ac_cv_prog_cc_c89" != "xno" && break
done
@@ -3478,92 +4202,32 @@ fi
# AC_CACHE_VAL
case "x$ac_cv_prog_cc_c89" in
x)
- { echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6; } ;;
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
xno)
- { echo "$as_me:$LINENO: result: unsupported" >&5
-echo "${ECHO_T}unsupported" >&6; } ;;
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
*)
CC="$CC $ac_cv_prog_cc_c89"
- { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+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
-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 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+ $as_echo_n "(cached) " >&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
@@ -3588,6 +4252,11 @@ else
if test "$am_compiler_list" = ""; then
am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
fi
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
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
@@ -3605,7 +4274,17 @@ else
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+ # 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. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
@@ -3615,19 +4294,23 @@ else
break
fi
;;
+ msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
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} \
+ source=sub/conftest.c object=$am__obj \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
- $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
- grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj 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
@@ -3651,8 +4334,8 @@ else
fi
fi
-{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
-echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; }
CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
if
@@ -3666,314 +4349,179 @@ else
fi
-{ 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
-if test "x$CC" != xcc; then
- { echo "$as_me:$LINENO: checking whether $CC and cc understand -c and -o together" >&5
-echo $ECHO_N "checking whether $CC and cc understand -c and -o together... $ECHO_C" >&6; }
-else
- { echo "$as_me:$LINENO: checking whether cc understands -c and -o together" >&5
-echo $ECHO_N "checking whether cc understands -c and -o together... $ECHO_C" >&6; }
+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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
+$as_echo_n "checking how to run the C preprocessor... " >&6; }
+# On Suns, sometimes $CPP names a directory.
+if test -n "$CPP" && test -d "$CPP"; then
+ CPP=
fi
-set dummy $CC; ac_cc=`echo $2 |
- sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-if { as_var=ac_cv_prog_cc_${ac_cc}_c_o; eval "test \"\${$as_var+set}\" = set"; }; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+if test -z "$CPP"; then
+ if test "${ac_cv_prog_CPP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ # Double quotes because CPP needs to be expanded
+ for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
_ACEOF
-# Make sure it works both with $CC and with simple cc.
-# We do the test twice because some compilers refuse to overwrite an
-# existing .o file with -o, though they will create one.
-ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
-rm -f conftest2.*
-if { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- test -f conftest2.$ac_objext && { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); };
-then
- eval ac_cv_prog_cc_${ac_cc}_c_o=yes
- if test "x$CC" != xcc; then
- # Test first that cc exists at all.
- if { ac_try='cc -c conftest.$ac_ext >&5'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
- ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
- rm -f conftest2.*
- if { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- test -f conftest2.$ac_objext && { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); };
- then
- # cc works too.
- :
- else
- # cc exists but doesn't like -o.
- eval ac_cv_prog_cc_${ac_cc}_c_o=no
- fi
- fi
- fi
-else
- eval ac_cv_prog_cc_${ac_cc}_c_o=no
-fi
-rm -f core conftest*
+if ac_fn_c_try_cpp "$LINENO"; then :
-fi
-if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; 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; }
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.i conftest.$ac_ext
-cat >>confdefs.h <<\_ACEOF
-#define NO_MINUS_C_MINUS_O 1
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
_ACEOF
-
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
+else
+ # Passes both tests.
+ac_preproc_ok=:
+break
fi
+rm -f conftest.err conftest.i conftest.$ac_ext
-# FIXME: we rely on the cache variable name because
-# there is no other way.
-set dummy $CC
-ac_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
-if eval "test \"`echo '$ac_cv_prog_cc_'${ac_cc}_c_o`\" != yes"; then
- # Losing compiler, so override with the script.
- # FIXME: It is wrong to rewrite CC.
- # But if we don't then we get into trouble of one sort or another.
- # A longer-term fix would be to have automake use am__CC in this case,
- # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
- CC="$am_aux_dir/compile $CC"
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+ break
fi
+ done
+ ac_cv_prog_CPP=$CPP
-
-# Check whether --enable-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
+fi
+ CPP=$ac_cv_prog_CPP
else
- enable_shared=yes
+ ac_cv_prog_CPP=$CPP
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
+$as_echo "$CPP" >&6; }
+ac_preproc_ok=false
+for ac_c_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
-
-# Check whether --enable-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
+ # Broken: fails on valid input.
+continue
fi
+rm -f conftest.err conftest.i conftest.$ac_ext
-
-# Check whether --enable-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
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if ac_fn_c_try_cpp "$LINENO"; then :
+ # Broken: success on invalid input.
+continue
else
- enable_fast_install=yes
+ # Passes both tests.
+ac_preproc_ok=:
+break
fi
+rm -f conftest.err conftest.i conftest.$ac_ext
-
-{ 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 { test -f "$as_dir/$lt_ac_prog$ac_exec_ext" && $as_test_x "$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
-IFS=$as_save_IFS
-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
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.i conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then :
+else
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details" "$LINENO" 5 ; }
fi
-SED=$lt_cv_path_SED
+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: result: $SED" >&5
-echo "${ECHO_T}$SED" >&6; }
-{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
-echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- # Extract the first word of "grep ggrep" to use in msg output
-if test -z "$GREP"; then
-set dummy grep ggrep; ac_prog_name=$2
-if test "${ac_cv_path_GREP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
+$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
+ if test -z "$GREP"; then
ac_path_GREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_prog in grep ggrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
- # Check for GNU ac_path_GREP and select it if it is found.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+# Check for GNU ac_path_GREP and select it if it is found.
# Check for GNU $ac_path_GREP
case `"$ac_path_GREP" --version 2>&1` in
*GNU*)
ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
*)
ac_count=0
- echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+ $as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
- echo 'GREP' >> "conftest.nl"
+ $as_echo 'GREP' >> "conftest.nl"
"$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- ac_count=`expr $ac_count + 1`
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_GREP_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_GREP="$ac_path_GREP"
@@ -3985,77 +4533,61 @@ case `"$ac_path_GREP" --version 2>&1` in
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
-
- $ac_path_GREP_found && break 3
+ $ac_path_GREP_found && break 3
+ done
+ done
done
-done
-
-done
IFS=$as_save_IFS
-
-
-fi
-
-GREP="$ac_cv_path_GREP"
-if test -z "$GREP"; then
- { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
+ if test -z "$ac_cv_path_GREP"; then
+ as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
else
ac_cv_path_GREP=$GREP
fi
-
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
-echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
+$as_echo "$ac_cv_path_GREP" >&6; }
GREP="$ac_cv_path_GREP"
-{ echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
+$as_echo_n "checking for egrep... " >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
then ac_cv_path_EGREP="$GREP -E"
else
- # Extract the first word of "egrep" to use in msg output
-if test -z "$EGREP"; then
-set dummy egrep; ac_prog_name=$2
-if test "${ac_cv_path_EGREP+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
+ if test -z "$EGREP"; then
ac_path_EGREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_prog in egrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
- { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
- # Check for GNU ac_path_EGREP and select it if it is found.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+# Check for GNU ac_path_EGREP and select it if it is found.
# Check for GNU $ac_path_EGREP
case `"$ac_path_EGREP" --version 2>&1` in
*GNU*)
ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
*)
ac_count=0
- echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
+ $as_echo_n 0123456789 >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
- echo 'EGREP' >> "conftest.nl"
+ $as_echo 'EGREP' >> "conftest.nl"
"$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- ac_count=`expr $ac_count + 1`
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
if test $ac_count -gt ${ac_path_EGREP_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_EGREP="$ac_path_EGREP"
@@ -4067,888 +4599,31 @@ case `"$ac_path_EGREP" --version 2>&1` in
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
-
- $ac_path_EGREP_found && break 3
+ $ac_path_EGREP_found && break 3
+ done
+ done
done
-done
-
-done
IFS=$as_save_IFS
-
-
-fi
-
-EGREP="$ac_cv_path_EGREP"
-if test -z "$EGREP"; then
- { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
- { (exit 1); exit 1; }; }
-fi
-
+ if test -z "$ac_cv_path_EGREP"; then
+ as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
else
ac_cv_path_EGREP=$EGREP
fi
-
fi
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
-echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
+$as_echo "$ac_cv_path_EGREP" >&6; }
EGREP="$ac_cv_path_EGREP"
-
-# Check whether --with-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 variants of GNU ld only accept -v.
- # Break only if it was the GNU/non-GNU ld that we prefer.
- case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
- *GNU* | *'with BFD'*)
- test "$with_gnu_ld" != no && break
- ;;
- *)
- test "$with_gnu_ld" != yes && break
- ;;
- esac
- fi
- done
- IFS="$lt_save_ifs"
-else
- lt_cv_path_LD="$LD" # Let the user override the test with a path.
-fi
-fi
-
-LD="$lt_cv_path_LD"
-if test -n "$LD"; then
- { echo "$as_me:$LINENO: result: $LD" >&5
-echo "${ECHO_T}$LD" >&6; }
-else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-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 lds only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
- lt_cv_prog_gnu_ld=yes
- ;;
-*)
- lt_cv_prog_gnu_ld=no
- ;;
-esac
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
-echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
-with_gnu_ld=$lt_cv_prog_gnu_ld
-
-
-{ echo "$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='$LTCC $LTCFLAGS -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_nm_to_check="${ac_tool_prefix}nm"
- if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
- lt_nm_to_check="$lt_nm_to_check nm"
- fi
- for lt_tmp_nm in $lt_nm_to_check; do
- lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
- for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
- IFS="$lt_save_ifs"
- test -z "$ac_dir" && ac_dir=.
- tmp_nm="$ac_dir/$lt_tmp_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"
- done
- 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 recognize dependent libraries" >&5
-echo $ECHO_N "checking how to recognize 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
-aix[4-9]*)
- 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',
- # unless we find 'file', for example because we are cross-compiling.
- if ( file / ) >/dev/null 2>&1; then
- lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
- lt_cv_file_magic_cmd='func_win32_libid'
- else
- lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
- lt_cv_file_magic_cmd='$OBJDUMP -f'
- fi
- ;;
-
-darwin* | rhapsody*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-freebsd* | 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
- ;;
-
-interix[3-9]*)
- # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
- lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
- ;;
-
-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* | k*bsd*-gnu)
- 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
- ;;
-
-rdos*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-solaris*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
-sysv4 | sysv4.3*)
- 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
- ;;
- pc)
- lt_cv_deplibs_check_method=pass_all
- ;;
- esac
- ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | 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"}
-
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
-
-# Allow CC to be a program name with arguments.
-compiler=$CC
-
-
-# Check whether --enable-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 4521 "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-*kfreebsd*-gnu|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-*kfreebsd*-gnu)
- LD="${LD-ld} -m elf_i386_fbsd"
- ;;
- 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-*kfreebsd*-gnu)
- LD="${LD-ld} -m elf_x86_64_fbsd"
- ;;
- 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
+ $as_echo_n "(cached) " >&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 { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- 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
- ;;
-sparc*-*solaris*)
- # 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
- *64-bit*)
- case $lt_cv_prog_gnu_ld in
- yes*) LD="${LD-ld} -m elf64_sparc" ;;
- *)
- if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
- LD="${LD-ld} -64"
- fi
- ;;
- esac
- ;;
- esac
- fi
- rm -rf conftest*
- ;;
-
-
-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 <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.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 nonexistent 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 <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.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 <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.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 nonexistent 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 <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.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
- 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
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
#include <stdarg.h>
@@ -4963,47 +4638,23 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; 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
+ ac_cv_header_stdc=no
fi
-
rm -f core 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
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <string.h>
_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
ac_cv_header_stdc=no
fi
@@ -5013,18 +4664,14 @@ 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
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
_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
ac_cv_header_stdc=no
fi
@@ -5034,14 +4681,10 @@ 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 <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <ctype.h>
#include <stdlib.h>
@@ -5068,424 +4711,248 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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
+if ac_fn_c_try_run "$LINENO"; then :
-( exit $ac_status )
-ac_cv_header_stdc=no
+else
+ ac_cv_header_stdc=no
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-
fi
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
if test $ac_cv_header_stdc = yes; then
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
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=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+ cat >>confdefs.h <<_ACEOF
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+fi
+done
+ ac_fn_c_check_header_mongrel "$LINENO" "minix/config.h" "ac_cv_header_minix_config_h" "$ac_includes_default"
+if test "x$ac_cv_header_minix_config_h" = x""yes; then :
+ MINIX=yes
+else
+ MINIX=
+fi
+ if test "$MINIX" = yes; then
+$as_echo "#define _POSIX_SOURCE 1" >>confdefs.h
-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 { as_var=$as_ac_Header; eval "test \"\${$as_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. */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- eval "$as_ac_Header=yes"
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+$as_echo "#define _POSIX_1_SOURCE 2" >>confdefs.h
- eval "$as_ac_Header=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&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
+$as_echo "#define _MINIX 1" >>confdefs.h
+ fi
-for ac_header in dlfcn.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether it is safe to define __EXTENSIONS__" >&5
+$as_echo_n "checking whether it is safe to define __EXTENSIONS__... " >&6; }
+if test "${ac_cv_safe_to_define___extensions__+set}" = set; then :
+ $as_echo_n "(cached) " >&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
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-$ac_includes_default
-#include <$ac_header>
+
+# define __EXTENSIONS__ 1
+ $ac_includes_default
+int
+main ()
+{
+
+ ;
+ return 0;
+}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_header_compiler=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_safe_to_define___extensions__=yes
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_header_compiler=no
+ ac_cv_safe_to_define___extensions__=no
fi
-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_safe_to_define___extensions__" >&5
+$as_echo "$ac_cv_safe_to_define___extensions__" >&6; }
+ test $ac_cv_safe_to_define___extensions__ = yes &&
+ $as_echo "#define __EXTENSIONS__ 1" >>confdefs.h
-# 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 { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then
- ac_header_preproc=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ $as_echo "#define _ALL_SOURCE 1" >>confdefs.h
- ac_header_preproc=no
-fi
+ $as_echo "#define _GNU_SOURCE 1" >>confdefs.h
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
+ $as_echo "#define _POSIX_PTHREAD_SEMANTICS 1" >>confdefs.h
-# 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 ntfs-3g-devel@lists.sf.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 { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
+ $as_echo "#define _TANDEM_SOURCE 1" >>confdefs.h
-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=cpp
-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 -z "$CXX"; then
- if test -n "$CCC"; then
- CXX=$CCC
- else
- if test -n "$ac_tool_prefix"; then
- for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+# 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
+ for ac_prog in gcc cc
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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
+ 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+ ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
fi
fi
-CXX=$ac_cv_prog_CXX
-if test -n "$CXX"; then
- { echo "$as_me:$LINENO: result: $CXX" >&5
-echo "${ECHO_T}$CXX" >&6; }
+CC=$ac_cv_prog_CC
+if test -n "$CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
+$as_echo "$CC" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
- test -n "$CXX" && break
+ test -n "$CC" && break
done
fi
-if test -z "$CXX"; then
- ac_ct_CXX=$CXX
- for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
+if test -z "$CC"; then
+ ac_ct_CC=$CC
+ for ac_prog in gcc cc
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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
- if test -n "$ac_ct_CXX"; then
- ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
+ 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+ ac_cv_prog_ac_ct_CC="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
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; }
+ac_ct_CC=$ac_cv_prog_ac_ct_CC
+if test -n "$ac_ct_CC"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
+$as_echo "$ac_ct_CC" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
- test -n "$ac_ct_CXX" && break
+ test -n "$ac_ct_CC" && break
done
- if test "x$ac_ct_CXX" = x; then
- CXX="g++"
+ if test "x$ac_ct_CC" = x; then
+ CC=""
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
- CXX=$ac_ct_CXX
+ CC=$ac_ct_CC
fi
fi
- fi
-fi
+
+test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
+$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
+as_fn_error $? "no acceptable C compiler found in \$PATH
+See \`config.log' for more details" "$LINENO" 5 ; }
+
# Provide some information about the compiler.
-echo "$as_me:$LINENO: checking for C++ compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compiler --version >&5") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compiler -v >&5") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
+$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
+set X $ac_compile
+ac_compiler=$2
+for ac_option in --version -v -V -qversion; do
+ { { ac_try="$ac_compiler $ac_option >&5"
case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compiler -V >&5") 2>&5
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_compiler $ac_option >&5") 2>conftest.err
ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
+ if test -s conftest.err; then
+ sed '10a\
+... rest of stderr output deleted ...
+ 10q' conftest.err >conftest.er1
+ cat conftest.er1 >&5
+ fi
+ rm -f conftest.er1 conftest.err
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
+done
-{ 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
+$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -5499,54 +4966,34 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_cxx_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
ac_compiler_gnu=yes
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_compiler_gnu=no
+ ac_compiler_gnu=no
fi
-
rm -f core 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
-{ 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
- ac_save_cxx_werror_flag=$ac_cxx_werror_flag
- ac_cxx_werror_flag=yes
- ac_cv_prog_cxx_g=no
- CXXFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ac_cv_c_compiler_gnu=$ac_compiler_gnu
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
+$as_echo "$ac_cv_c_compiler_gnu" >&6; }
+if test $ac_compiler_gnu = yes; then
+ GCC=yes
+else
+ GCC=
+fi
+ac_test_CFLAGS=${CFLAGS+set}
+ac_save_CFLAGS=$CFLAGS
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
+$as_echo_n "checking whether $CC accepts -g... " >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_save_c_werror_flag=$ac_c_werror_flag
+ ac_c_werror_flag=yes
+ ac_cv_prog_cc_g=no
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -5557,34 +5004,11 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_cxx_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cxx_g=yes
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- CXXFLAGS=""
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ CFLAGS=""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -5595,35 +5019,12 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_cxx_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- :
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+if ac_fn_c_try_compile "$LINENO"; then :
- ac_cxx_werror_flag=$ac_save_cxx_werror_flag
- CXXFLAGS="-g"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+else
+ ac_c_werror_flag=$ac_save_c_werror_flag
+ CFLAGS="-g"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -5634,69 +5035,136 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_cxx_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_prog_cxx_g=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_g=yes
fi
-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- ac_cxx_werror_flag=$ac_save_cxx_werror_flag
-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"
+ ac_c_werror_flag=$ac_save_c_werror_flag
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
+$as_echo "$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
- CXXFLAGS="-g"
+ CFLAGS="-g"
fi
else
- if test "$GXX" = yes; then
- CXXFLAGS="-O2"
+ if test "$GCC" = yes; then
+ CFLAGS="-O2"
else
- CXXFLAGS=
+ CFLAGS=
fi
fi
-ac_ext=cpp
-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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
+$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_prog_cc_c89=no
+ac_save_CC=$CC
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <stdarg.h>
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
+struct buf { int x; };
+FILE * (*rcsopen) (struct buf *, struct stat *, int);
+static char *e (p, i)
+ char **p;
+ int i;
+{
+ return p[i];
+}
+static char *f (char * (*g) (char **, int), char **p, ...)
+{
+ char *s;
+ va_list v;
+ va_start (v,p);
+ s = g (p, va_arg (v,int));
+ va_end (v);
+ return s;
+}
+
+/* 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 -std 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 -std. */
+int osf4_cc_array ['\x00' == 0 ? 1 : -1];
+
+/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
+ inside strings and character constants. */
+#define FOO(x) 'x'
+int xlc6_cc_array[FOO(a) == 'x' ? 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
+for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
+ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
+do
+ CC="$ac_save_CC $ac_arg"
+ if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_prog_cc_c89=$ac_arg
+fi
+rm -f core conftest.err conftest.$ac_objext
+ test "x$ac_cv_prog_cc_c89" != "xno" && break
+done
+rm -f conftest.$ac_ext
+CC=$ac_save_CC
-depcc="$CXX" am_compiler_list=
+fi
+# AC_CACHE_VAL
+case "x$ac_cv_prog_cc_c89" in
+ x)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
+$as_echo "none needed" >&6; } ;;
+ xno)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
+$as_echo "unsupported" >&6; } ;;
+ *)
+ CC="$CC $ac_cv_prog_cc_c89"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
+$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+esac
+if test "x$ac_cv_prog_cc_c89" != xno; then :
+
+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 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
+depcc="$CC" am_compiler_list=
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5
+$as_echo_n "checking dependency style of $depcc... " >&6; }
+if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then :
+ $as_echo_n "(cached) " >&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
@@ -5717,10 +5185,15 @@ else
# directory.
mkdir sub
- am_cv_CXX_dependencies_compiler_type=none
+ 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
+ am__universal=false
+ case " $depcc " in #(
+ *\ -arch\ *\ -arch\ *) am__universal=true ;;
+ esac
+
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
@@ -5738,7 +5211,17 @@ else
done
echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
+ # 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. Also, some Intel
+ # versions had trouble with output in subdirs
+ am__obj=sub/conftest.${OBJEXT-o}
+ am__minus_obj="-o $am__obj"
case $depmode in
+ gcc)
+ # This depmode causes a compiler race in universal mode.
+ test "$am__universal" = false || continue
+ ;;
nosideeffect)
# after this tag, mechanisms are not by side-effect, so they'll
# only be used when explicitly requested
@@ -5748,19 +5231,23 @@ else
break
fi
;;
+ msvisualcpp | msvcmsys)
+ # This compiler won't grok `-c -o', but also, the minuso test has
+ # not run yet. These depmodes are late enough in the game, and
+ # so weak that their functioning should not be impacted.
+ am__obj=conftest.${OBJEXT-o}
+ am__minus_obj=
+ ;;
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} \
+ source=sub/conftest.c object=$am__obj \
depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
- $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
+ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \
>/dev/null 2>conftest.err &&
grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 &&
grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
- grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
+ grep $am__obj 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
@@ -5771,7 +5258,7 @@ else
# 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
+ am_cv_CC_dependencies_compiler_type=$depmode
break
fi
fi
@@ -5780,527 +5267,663 @@ else
cd ..
rm -rf conftest.dir
else
- am_cv_CXX_dependencies_compiler_type=none
+ am_cv_CC_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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5
+$as_echo "$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_CXX_dependencies_compiler_type" = gcc3; then
- am__fastdepCXX_TRUE=
- am__fastdepCXX_FALSE='#'
+ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
+ am__fastdepCC_TRUE=
+ am__fastdepCC_FALSE='#'
else
- am__fastdepCXX_TRUE='#'
- am__fastdepCXX_FALSE=
+ am__fastdepCC_TRUE='#'
+ am__fastdepCC_FALSE=
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
+$as_echo_n "checking whether ln -s works... " >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
+$as_echo "no, using $LN_S" >&6; }
+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=cpp
-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
+if test "x$CC" != xcc; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5
+$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&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 <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5
+$as_echo_n "checking whether cc understands -c and -o together... " >&6; }
+fi
+set dummy $CC; ac_cc=`$as_echo "$2" |
+ sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+if eval "test \"\${ac_cv_prog_cc_${ac_cc}_c_o+set}\"" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
+# Make sure it works both with $CC and with simple cc.
+# We do the test twice because some compilers refuse to overwrite an
+# existing .o file with -o, though they will create one.
+ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+rm -f conftest2.*
+if { { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
- 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 && {
- test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
- test ! -s conftest.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 nonexistent 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 <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } &&
+ test -f conftest2.$ac_objext && { { case "(($ac_try" in
*\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
*) ac_try_echo=$ac_try;;
esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
ac_status=$?
- 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 && {
- test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
- test ! -s conftest.err
- }; then
- # Broken: success on invalid input.
-continue
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; };
+then
+ eval ac_cv_prog_cc_${ac_cc}_c_o=yes
+ if test "x$CC" != xcc; then
+ # Test first that cc exists at all.
+ if { ac_try='cc -c conftest.$ac_ext >&5'
+ { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; }; then
+ ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5'
+ rm -f conftest2.*
+ if { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } &&
+ test -f conftest2.$ac_objext && { { case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\""
+$as_echo "$ac_try_echo"; } >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; };
+ then
+ # cc works too.
+ :
+ else
+ # cc exists but doesn't like -o.
+ eval ac_cv_prog_cc_${ac_cc}_c_o=no
+ fi
+ fi
+ fi
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- # Passes both tests.
-ac_preproc_ok=:
-break
+ eval ac_cv_prog_cc_${ac_cc}_c_o=no
fi
+rm -f core conftest*
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
- break
fi
+if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
- done
- ac_cv_prog_CXXCPP=$CXXCPP
+$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h
fi
- CXXCPP=$ac_cv_prog_CXXCPP
-else
- ac_cv_prog_CXXCPP=$CXXCPP
+
+# FIXME: we rely on the cache variable name because
+# there is no other way.
+set dummy $CC
+am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'`
+eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o
+if test "$am_t" != yes; then
+ # Losing compiler, so override with the script.
+ # FIXME: It is wrong to rewrite CC.
+ # But if we don't then we get into trouble of one sort or another.
+ # A longer-term fix would be to have automake use am__CC in this case,
+ # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)"
+ CC="$am_aux_dir/compile $CC"
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
+
+
+
+case `pwd` in
+ *\ * | *\ *)
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
+$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
+esac
+
+
+
+macro_version='2.2.6b'
+macro_revision='1.3017'
+
+
+
+
+
+
+
+
+
+
+
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
+$as_echo_n "checking for a sed that does not truncate output... " >&6; }
+if test "${ac_cv_path_SED+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
+ for ac_i in 1 2 3 4 5 6 7; do
+ ac_script="$ac_script$as_nl$ac_script"
+ done
+ echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
+ { ac_script=; unset ac_script;}
+ if test -z "$SED"; then
+ ac_path_SED_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
+ 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
+ ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue
+# Check for GNU ac_path_SED and select it if it is found.
+ # Check for GNU $ac_path_SED
+case `"$ac_path_SED" --version 2>&1` in
+*GNU*)
+ ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo '' >> "conftest.nl"
+ "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_SED_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_SED="$ac_path_SED"
+ ac_path_SED_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
- test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
- test ! -s conftest.err
- }; then
- :
+
+ $ac_path_SED_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_SED"; then
+ as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+ fi
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ ac_cv_path_SED=$SED
+fi
- # Broken: fails on valid input.
-continue
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
+$as_echo "$ac_cv_path_SED" >&6; }
+ SED="$ac_cv_path_SED"
+ rm -f conftest.sed
-rm -f conftest.err conftest.$ac_ext
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
- # OK, works on sane cases. Now check whether nonexistent 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 <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
+
+
+
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
+$as_echo_n "checking for fgrep... " >&6; }
+if test "${ac_cv_path_FGREP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
+ then ac_cv_path_FGREP="$GREP -F"
+ else
+ if test -z "$FGREP"; then
+ ac_path_FGREP_found=false
+ # Loop through the user's path and test for each of PROGNAME-LIST
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_prog in fgrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue
+# Check for GNU ac_path_FGREP and select it if it is found.
+ # Check for GNU $ac_path_FGREP
+case `"$ac_path_FGREP" --version 2>&1` in
+*GNU*)
+ ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
+*)
+ ac_count=0
+ $as_echo_n 0123456789 >"conftest.in"
+ while :
+ do
+ cat "conftest.in" "conftest.in" >"conftest.tmp"
+ mv "conftest.tmp" "conftest.in"
+ cp "conftest.in" "conftest.nl"
+ $as_echo 'FGREP' >> "conftest.nl"
+ "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
+ diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
+ as_fn_arith $ac_count + 1 && ac_count=$as_val
+ if test $ac_count -gt ${ac_path_FGREP_max-0}; then
+ # Best one so far, save it but keep looking for a better one
+ ac_cv_path_FGREP="$ac_path_FGREP"
+ ac_path_FGREP_max=$ac_count
+ fi
+ # 10*(2^10) chars as input seems more than enough
+ test $ac_count -gt 10 && break
+ done
+ rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
- test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
- test ! -s conftest.err
- }; then
- # Broken: success on invalid input.
-continue
+
+ $ac_path_FGREP_found && break 3
+ done
+ done
+ done
+IFS=$as_save_IFS
+ if test -z "$ac_cv_path_FGREP"; then
+ as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
+ fi
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ ac_cv_path_FGREP=$FGREP
+fi
- # Passes both tests.
-ac_preproc_ok=:
-break
+ fi
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
+$as_echo "$ac_cv_path_FGREP" >&6; }
+ FGREP="$ac_cv_path_FGREP"
-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
- :
+test -z "$GREP" && GREP=grep
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --with-gnu-ld was given.
+if test "${with_gnu_ld+set}" = set; then :
+ withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
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; }; }
+ with_gnu_ld=no
fi
-ac_ext=cpp
-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_prog=ld
+if test "$GCC" = yes; then
+ # Check if gcc -print-prog-name=ld gives a path.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
+$as_echo_n "checking for ld used by $CC... " >&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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
+$as_echo_n "checking for GNU ld... " >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
+$as_echo_n "checking for non-GNU ld... " >&6; }
+fi
+if test "${lt_cv_path_LD+set}" = set; then :
+ $as_echo_n "(cached) " >&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 variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
+$as_echo "$LD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
+test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
+$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ # I'd rather use --version here, but apparently some GNU lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
+$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+with_gnu_ld=$lt_cv_prog_gnu_ld
-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 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+
+
+
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
+$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
+if test "${lt_cv_path_NM+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_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"
+ done
+ : ${lt_cv_path_NM=no}
+fi
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
+$as_echo "$lt_cv_path_NM" >&6; }
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ if test -n "$ac_tool_prefix"; then
+ for ac_prog in "dumpbin -symbols" "link -dump -symbols"
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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DUMPBIN+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
- if test -n "$F77"; then
- ac_cv_prog_F77="$F77" # Let the user override the test.
+ if test -n "$DUMPBIN"; then
+ ac_cv_prog_DUMPBIN="$DUMPBIN" # 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+ ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
fi
fi
-F77=$ac_cv_prog_F77
-if test -n "$F77"; then
- { echo "$as_me:$LINENO: result: $F77" >&5
-echo "${ECHO_T}$F77" >&6; }
+DUMPBIN=$ac_cv_prog_DUMPBIN
+if test -n "$DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
+$as_echo "$DUMPBIN" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
- test -n "$F77" && break
+ test -n "$DUMPBIN" && break
done
fi
-if test -z "$F77"; then
- ac_ct_F77=$F77
- for ac_prog in g77 xlf f77 frt pgf77 cf77 fort77 fl32 af77 xlf90 f90 pgf90 pghpf epcf90 gfortran g95 xlf95 f95 fort ifort ifc efc pgf95 lf95 ftn
+if test -z "$DUMPBIN"; then
+ ac_ct_DUMPBIN=$DUMPBIN
+ for ac_prog in "dumpbin -symbols" "link -dump -symbols"
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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DUMPBIN+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
- if test -n "$ac_ct_F77"; then
- ac_cv_prog_ac_ct_F77="$ac_ct_F77" # Let the user override the test.
+ if test -n "$ac_ct_DUMPBIN"; then
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+ ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
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; }
+ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
+if test -n "$ac_ct_DUMPBIN"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
+$as_echo "$ac_ct_DUMPBIN" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
- test -n "$ac_ct_F77" && break
+ test -n "$ac_ct_DUMPBIN" && break
done
- if test "x$ac_ct_F77" = x; then
- F77=""
+ if test "x$ac_ct_DUMPBIN" = x; then
+ DUMPBIN=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
- F77=$ac_ct_F77
+ DUMPBIN=$ac_ct_DUMPBIN
fi
fi
-# Provide some information about the compiler.
-echo "$as_me:$LINENO: checking for Fortran 77 compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compiler --version >&5") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_compiler -v >&5") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_f77_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_compiler_gnu=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_compiler_gnu=no
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
fi
+test -z "$NM" && NM=nm
-rm -f core 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 { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_f77_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; 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 core 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
+$as_echo_n "checking the name lister ($NM) interface... " >&6; }
+if test "${lt_cv_nm_interface+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
- if test "x$ac_cv_f77_compiler_gnu" = xyes; then
- FFLAGS="-O2"
- else
- FFLAGS=
+ lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:5906: $ac_compile\"" >&5)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:5909: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&5
+ (eval echo "\"\$as_me:5912: output\"" >&5)
+ cat conftest.out >&5
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
fi
+ rm -f conftest*
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
+$as_echo "$lt_cv_nm_interface" >&6; }
-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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
+$as_echo_n "checking the maximum length of command line arguments... " >&6; }
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
i=0
teststring="ABCD"
@@ -6321,7 +5944,7 @@ else
lt_cv_sys_max_cmd_len=-1;
;;
- cygwin* | mingw*)
+ cygwin* | mingw* | cegcc*)
# 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,
@@ -6376,7 +5999,7 @@ else
sysv5* | sco5v6* | sysv4.2uw2*)
kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
if test -n "$kargmax"; then
- lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
else
lt_cv_sys_max_cmd_len=32768
fi
@@ -6387,20 +6010,28 @@ else
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`
else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
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 &&
+ # 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"`$SHELL $0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+ = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
test $i != 17 # 1/2 MB should be enough
do
i=`expr $i + 1`
teststring=$teststring$teststring
done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
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.
+ # 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`
fi
;;
@@ -6409,301 +6040,433 @@ else
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; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
+$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
else
- { echo "$as_me:$LINENO: result: none" >&5
-echo "${ECHO_T}none" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
+$as_echo "none" >&6; }
fi
+max_cmd_len=$lt_cv_sys_max_cmd_len
-# 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?!! ;)]
+: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
-# Character class describing NM global symbol codes.
-symcode='[BCDEGRST]'
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
+$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,, \
+ && eval 'test $(( 1 + 1 )) -eq 2 \
+ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
+$as_echo "$xsi_shell" >&6; }
-# 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'"
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
+$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
+ >/dev/null 2>&1 \
+ && lt_shell_append=yes
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
+$as_echo "$lt_shell_append" >&6; }
-# 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* | k*bsd*-gnu)
- 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*)
- symcode='[BDRT]'
- ;;
-sco3.2v5*)
- symcode='[DT]'
- ;;
-sysv4.2uw2*)
- symcode='[DT]'
- ;;
-sysv5* | sco5v6* | unixware* | OpenUNIX*)
- symcode='[ABDT]'
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+
+
+
+
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
;;
-sysv4)
- symcode='[DFNSTU]'
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
;;
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 <<EOF
-#ifdef __cplusplus
-extern "C" {
-#endif
-char nm_test_var;
-void nm_test_func(){}
-#ifdef __cplusplus
-}
-#endif
-int main(){nm_test_var='a';nm_test_func();return(0);}
-EOF
- 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
- 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 <<EOF > conftest.$ac_ext
-#ifdef __cplusplus
-extern "C" {
-#endif
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
+$as_echo_n "checking for $LD option to reload object files... " >&6; }
+if test "${lt_cv_ld_reload_flag+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_ld_reload_flag='-r'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
+$as_echo "$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='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
-EOF
- # Now generate the symbol file.
- eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
- cat <<EOF >> 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 -rf 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=
+
+
+
+
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OBJDUMP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OBJDUMP"; then
+ ac_cv_prog_OBJDUMP="$OBJDUMP" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
fi
done
+ done
+IFS=$as_save_IFS
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; }
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
+$as_echo "$OBJDUMP" >&6; }
else
- { echo "$as_me:$LINENO: result: ok" >&5
-echo "${ECHO_T}ok" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "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
- echo $ECHO_N "(cached) $ECHO_C" >&6
+
+fi
+if test -z "$ac_cv_prog_OBJDUMP"; then
+ ac_ct_OBJDUMP=$OBJDUMP
+ # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
- rm -f .libs 2>/dev/null
-mkdir .libs 2>/dev/null
-if test -d .libs; then
- lt_cv_objdir=.libs
+ if test -n "$ac_ct_OBJDUMP"; then
+ ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
else
- # MS-DOS does not allow filenames that begin with a dot.
- lt_cv_objdir=_libs
+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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_OBJDUMP="objdump"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
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
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
+$as_echo "$ac_ct_OBJDUMP" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OBJDUMP" = x; then
+ OBJDUMP="false"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OBJDUMP=$ac_ct_OBJDUMP
+ fi
+else
+ OBJDUMP="$ac_cv_prog_OBJDUMP"
+fi
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+
+
+
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
+$as_echo_n "checking how to recognize dependent libraries... " >&6; }
+if test "${lt_cv_deplibs_check_method+set}" = set; then :
+ $as_echo_n "(cached) " >&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
-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
+aix[4-9]*)
+ 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',
+ # unless we find 'file', for example because we are cross-compiling.
+ if ( file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+cegcc)
+ # use the weaker test based on 'objdump'. See mingw*.
+ lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | 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
+ ;;
+
+interix[3-9]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$'
+ ;;
+
+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* | k*bsd*-gnu | kopensolaris*-gnu)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd* | netbsdelf*-gnu)
+ 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=pass_all
+ ;;
+
+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
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ 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
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+tpf*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
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'
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
+$as_echo "$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
+
+
+
+
+
-# 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 MSVC,
-# 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
if test -n "$AR"; then
ac_cv_prog_AR="$AR" # Let the user override the test.
@@ -6713,25 +6476,25 @@ 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
fi
fi
AR=$ac_cv_prog_AR
if test -n "$AR"; then
- { echo "$as_me:$LINENO: result: $AR" >&5
-echo "${ECHO_T}$AR" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
+$as_echo "$AR" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
@@ -6740,10 +6503,10 @@ 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_AR"; then
ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
@@ -6753,25 +6516,25 @@ 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
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; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
+$as_echo "$ac_ct_AR" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
if test "x$ac_ct_AR" = x; then
@@ -6779,12 +6542,8 @@ fi
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
AR=$ac_ct_AR
@@ -6793,219 +6552,216 @@ else
AR="$ac_cv_prog_AR"
fi
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+
+
+
+
+
+
+
+
+
+
+
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
+ # 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
+ 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
fi
fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
- { echo "$as_me:$LINENO: result: $RANLIB" >&5
-echo "${ECHO_T}$RANLIB" >&6; }
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
+$as_echo "$STRIP" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "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
+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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
- if test -n "$ac_ct_RANLIB"; then
- ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # 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
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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+ ac_cv_prog_ac_ct_STRIP="strip"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
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; }
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
+$as_echo "$ac_ct_STRIP" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
- if test "x$ac_ct_RANLIB" = x; then
- RANLIB=":"
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
- RANLIB=$ac_ct_RANLIB
+ STRIP=$ac_ct_STRIP
fi
else
- RANLIB="$ac_cv_prog_RANLIB"
+ STRIP="$ac_cv_prog_STRIP"
fi
+test -z "$STRIP" && STRIP=:
+
+
+
+
+
+
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
+ # 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
- if test -n "$STRIP"; then
- ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+ 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
fi
fi
-STRIP=$ac_cv_prog_STRIP
-if test -n "$STRIP"; then
- { echo "$as_me:$LINENO: result: $STRIP" >&5
-echo "${ECHO_T}$STRIP" >&6; }
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
+$as_echo "$RANLIB" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "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
+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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
- if test -n "$ac_ct_STRIP"; then
- ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # 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
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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
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; }
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
+$as_echo "$ac_ct_RANLIB" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
- if test "x$ac_ct_STRIP" = x; then
- STRIP=":"
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
- STRIP=$ac_ct_STRIP
+ RANLIB=$ac_ct_RANLIB
fi
else
- STRIP="$ac_cv_prog_STRIP"
+ RANLIB="$ac_cv_prog_RANLIB"
fi
+test -z "$RANLIB" && RANLIB=:
+
+
+
-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 "$LTCFLAGS" && LTCFLAGS=$CFLAGS
-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'
@@ -7024,162 +6780,501 @@ 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-%%"`
-# 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
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+
+
+# Check for command to grab the raw symbol name followed by C symbol from nm.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
+$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then :
+ $as_echo_n "(cached) " >&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 <<EOF 1>&2
-*** Warning: the command libtool uses to detect shared libraries,
-*** $file_magic_cmd, produces output that libtool cannot recognize.
-*** The result is that libtool may fail to recognize shared libraries
-*** as such. This will affect the creation of libtool libraries that
-*** depend on shared libraries, but programs linked with such libtool
-*** libraries will work regardless of this problem. Nevertheless, you
-*** may want to report the problem to your system manager and/or to
-*** bug-libtool@gnu.org
+# These are sane defaults that work on at least a few old systems.
+# [They come from Ultrix. What could be older than Ultrix?!! ;)]
-EOF
- fi ;;
- esac
- fi
- break
- fi
- done
- IFS="$lt_save_ifs"
- MAGIC_CMD="$lt_save_MAGIC_CMD"
+# 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]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[BCDT]'
+ ;;
+cygwin* | mingw* | pw32* | cegcc*)
+ symcode='[ABCDGISTW]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[ABCDEGRST]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[BCDEGRST]'
+ ;;
+osf*)
+ symcode='[BCDEGQRST]'
+ ;;
+solaris*)
+ symcode='[BDRT]'
+ ;;
+sco3.2v5*)
+ symcode='[DT]'
+ ;;
+sysv4.2uw2*)
+ symcode='[DT]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[ABDT]'
+ ;;
+sysv4)
+ symcode='[DFNSTU]'
;;
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 we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[ABCDGIRSTW]' ;;
+esac
-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.
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \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\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
+
+# 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
;;
-*)
- 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 <<EOF 1>&2
+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
+# Try without a prefix underscore, then with it.
+for ac_symprfx in "" "_"; do
-EOF
- fi ;;
- esac
+ # 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.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK '"\
+" {last_section=section; section=\$ 3};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if { { eval echo "\"\$as_me\":${as_lineno-$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=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && 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
- break
+
+ # 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 <<_LT_EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_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\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ (eval $ac_link) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && 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
- done
- IFS="$lt_save_ifs"
- MAGIC_CMD="$lt_save_MAGIC_CMD"
- ;;
-esac
+ else
+ echo "$progname: failed program was:" >&5
+ cat conftest.$ac_ext >&5
+ fi
+ rm -rf 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
-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; }
+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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
+$as_echo "failed" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
+$as_echo "ok" >&6; }
fi
- else
- MAGIC_CMD=:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+# Check whether --enable-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\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; 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 7106 "configure"' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; 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-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ 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-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ 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"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
+$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
+if test "${lt_cv_cc_needs_belf+set}" = set; then :
+ $as_echo_n "(cached) " >&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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ lt_cv_cc_needs_belf=yes
+else
+ lt_cv_cc_needs_belf=no
fi
+rm -f core 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
+$as_echo "$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
;;
+sparc*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*) LD="${LD-ld} -m elf64_sparc" ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
esac
+need_locks="$enable_libtool_lock"
+
case $host_os in
rhapsody* | darwin*)
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
set dummy ${ac_tool_prefix}dsymutil; 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_DSYMUTIL+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_DSYMUTIL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
if test -n "$DSYMUTIL"; then
ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
@@ -7189,25 +7284,25 @@ 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
fi
fi
DSYMUTIL=$ac_cv_prog_DSYMUTIL
if test -n "$DSYMUTIL"; then
- { echo "$as_me:$LINENO: result: $DSYMUTIL" >&5
-echo "${ECHO_T}$DSYMUTIL" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
+$as_echo "$DSYMUTIL" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
@@ -7216,10 +7311,10 @@ if test -z "$ac_cv_prog_DSYMUTIL"; then
ac_ct_DSYMUTIL=$DSYMUTIL
# Extract the first word of "dsymutil", so it can be a program name with args.
set dummy dsymutil; 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_DSYMUTIL+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_DSYMUTIL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_DSYMUTIL"; then
ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
@@ -7229,25 +7324,25 @@ 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
fi
fi
ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
if test -n "$ac_ct_DSYMUTIL"; then
- { echo "$as_me:$LINENO: result: $ac_ct_DSYMUTIL" >&5
-echo "${ECHO_T}$ac_ct_DSYMUTIL" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
+$as_echo "$ac_ct_DSYMUTIL" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
if test "x$ac_ct_DSYMUTIL" = x; then
@@ -7255,12 +7350,8 @@ fi
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
DSYMUTIL=$ac_ct_DSYMUTIL
@@ -7272,10 +7363,10 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
set dummy ${ac_tool_prefix}nmedit; 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_NMEDIT+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_NMEDIT+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
if test -n "$NMEDIT"; then
ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
@@ -7285,25 +7376,25 @@ 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
fi
fi
NMEDIT=$ac_cv_prog_NMEDIT
if test -n "$NMEDIT"; then
- { echo "$as_me:$LINENO: result: $NMEDIT" >&5
-echo "${ECHO_T}$NMEDIT" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
+$as_echo "$NMEDIT" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
@@ -7312,10 +7403,10 @@ if test -z "$ac_cv_prog_NMEDIT"; then
ac_ct_NMEDIT=$NMEDIT
# Extract the first word of "nmedit", so it can be a program name with args.
set dummy nmedit; 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_NMEDIT+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_NMEDIT+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
if test -n "$ac_ct_NMEDIT"; then
ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
@@ -7325,25 +7416,25 @@ 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_NMEDIT="nmedit"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
fi
fi
ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
if test -n "$ac_ct_NMEDIT"; then
- { echo "$as_me:$LINENO: result: $ac_ct_NMEDIT" >&5
-echo "${ECHO_T}$ac_ct_NMEDIT" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
+$as_echo "$ac_ct_NMEDIT" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
if test "x$ac_ct_NMEDIT" = x; then
@@ -7351,12 +7442,8 @@ fi
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
ac_tool_warned=yes ;;
esac
NMEDIT=$ac_ct_NMEDIT
@@ -7365,44 +7452,347 @@ else
NMEDIT="$ac_cv_prog_NMEDIT"
fi
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
+set dummy ${ac_tool_prefix}lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_LIPO+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$LIPO"; then
+ ac_cv_prog_LIPO="$LIPO" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+LIPO=$ac_cv_prog_LIPO
+if test -n "$LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
+$as_echo "$LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_LIPO"; then
+ ac_ct_LIPO=$LIPO
+ # Extract the first word of "lipo", so it can be a program name with args.
+set dummy lipo; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_LIPO+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_LIPO"; then
+ ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_LIPO="lipo"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
+if test -n "$ac_ct_LIPO"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
+$as_echo "$ac_ct_LIPO" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
- { echo "$as_me:$LINENO: checking for -single_module linker flag" >&5
-echo $ECHO_N "checking for -single_module linker flag... $ECHO_C" >&6; }
-if test "${lt_cv_apple_cc_single_mod+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+ if test "x$ac_ct_LIPO" = x; then
+ LIPO=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ LIPO=$ac_ct_LIPO
+ fi
+else
+ LIPO="$ac_cv_prog_LIPO"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OTOOL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL"; then
+ ac_cv_prog_OTOOL="$OTOOL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL=$ac_cv_prog_OTOOL
+if test -n "$OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
+$as_echo "$OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL"; then
+ ac_ct_OTOOL=$OTOOL
+ # Extract the first word of "otool", so it can be a program name with args.
+set dummy otool; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OTOOL+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL"; then
+ ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_OTOOL="otool"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
+if test -n "$ac_ct_OTOOL"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
+$as_echo "$ac_ct_OTOOL" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL" = x; then
+ OTOOL=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL=$ac_ct_OTOOL
+ fi
+else
+ OTOOL="$ac_cv_prog_OTOOL"
+fi
+
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
+set dummy ${ac_tool_prefix}otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_OTOOL64+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$OTOOL64"; then
+ ac_cv_prog_OTOOL64="$OTOOL64" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+OTOOL64=$ac_cv_prog_OTOOL64
+if test -n "$OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
+$as_echo "$OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+fi
+if test -z "$ac_cv_prog_OTOOL64"; then
+ ac_ct_OTOOL64=$OTOOL64
+ # Extract the first word of "otool64", so it can be a program name with args.
+set dummy otool64; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_prog_ac_ct_OTOOL64+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ if test -n "$ac_ct_OTOOL64"; then
+ ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_OTOOL64="otool64"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+ done
+IFS=$as_save_IFS
+
+fi
+fi
+ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
+if test -n "$ac_ct_OTOOL64"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
+$as_echo "$ac_ct_OTOOL64" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+ if test "x$ac_ct_OTOOL64" = x; then
+ OTOOL64=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ OTOOL64=$ac_ct_OTOOL64
+ fi
+else
+ OTOOL64="$ac_cv_prog_OTOOL64"
+fi
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
+$as_echo_n "checking for -single_module linker flag... " >&6; }
+if test "${lt_cv_apple_cc_single_mod+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
lt_cv_apple_cc_single_mod=no
if test -z "${LT_MULTI_MODULE}"; then
- # By default we will add the -single_module flag. You can override
- # by either setting the environment variable LT_MULTI_MODULE
- # non-empty at configure time, or by adding -multi_module to the
- # link flags.
- echo "int foo(void){return 1;}" > conftest.c
- $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
- -dynamiclib ${wl}-single_module conftest.c
- if test -f libconftest.dylib; then
- lt_cv_apple_cc_single_mod=yes
- rm -rf libconftest.dylib*
- fi
- rm conftest.c
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ rm -rf libconftest.dylib*
+ echo "int foo(void){return 1;}" > conftest.c
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&5
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+ _lt_result=$?
+ if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+ lt_cv_apple_cc_single_mod=yes
+ else
+ cat conftest.err >&5
+ fi
+ rm -rf libconftest.dylib*
+ rm -f conftest.*
fi
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_apple_cc_single_mod" >&5
-echo "${ECHO_T}$lt_cv_apple_cc_single_mod" >&6; }
- { echo "$as_me:$LINENO: checking for -exported_symbols_list linker flag" >&5
-echo $ECHO_N "checking for -exported_symbols_list linker flag... $ECHO_C" >&6; }
-if test "${lt_cv_ld_exported_symbols_list+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
+$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
+$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
+if test "${lt_cv_ld_exported_symbols_list+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
lt_cv_ld_exported_symbols_list=no
save_LDFLAGS=$LDFLAGS
echo "_main" > conftest.sym
LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -7413,55 +7803,34 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; then :
lt_cv_ld_exported_symbols_list=yes
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- lt_cv_ld_exported_symbols_list=no
+ lt_cv_ld_exported_symbols_list=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
- LDFLAGS="$save_LDFLAGS"
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_ld_exported_symbols_list" >&5
-echo "${ECHO_T}$lt_cv_ld_exported_symbols_list" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5
+$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
case $host_os in
- rhapsody* | darwin1.[0123])
+ rhapsody* | darwin1.[012])
_lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
darwin1.*)
- _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
- darwin*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*) # darwin 5.x on
# if running on 10.5 or later, the deployment target defaults
# to the OS version, if on x86, and 10.4, the deployment
# target defaults to 10.4. Don't you love it?
case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
- 10.0,*86*-darwin8*|10.0,*-darwin[91]*)
- _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
- 10.[012]*)
- _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
- 10.*)
- _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.0,*86*-darwin8*|10.0,*-darwin[91]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[012]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
esac
;;
esac
@@ -7471,39 +7840,448 @@ echo "${ECHO_T}$lt_cv_ld_exported_symbols_list" >&6; }
if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
_lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
else
- _lt_dar_export_syms="~$NMEDIT -s \$output_objdir/\${libname}-symbols.expsym \${lib}"
+ _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
fi
if test "$DSYMUTIL" != ":"; then
- _lt_dsymutil="~$DSYMUTIL \$lib || :"
+ _lt_dsymutil='~$DSYMUTIL $lib || :'
else
_lt_dsymutil=
fi
;;
esac
+for ac_header in dlfcn.h
+do :
+ ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
+"
+if test "x$ac_cv_header_dlfcn_h" = x""yes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DLFCN_H 1
+_ACEOF
-enable_dlopen=no
-enable_win32_dll=no
+fi
-# Check whether --enable-libtool-lock was given.
-if test "${enable_libtool_lock+set}" = set; then
- enableval=$enable_libtool_lock;
+done
+
+
+
+# Set options
+
+
+
+ enable_dlopen=no
+
+
+ enable_win32_dll=no
+
+
+ # Check whether --enable-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
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+
+
+
+
+
+
+
+ # Check whether --enable-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
+
+
+
+
+
+
+
+
# Check whether --with-pic was given.
-if test "${with_pic+set}" = set; then
+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
+
+
+
+
+
+
+ # Check whether --enable-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
+
+
+
+
+
+
+
+
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+test -z "$LN_S" && LN_S="ln -s"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
+$as_echo_n "checking for objdir... " >&6; }
+if test "${lt_cv_objdir+set}" = set; then :
+ $as_echo_n "(cached) " >&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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
+$as_echo "$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
+
+
+
+
+
+cat >>confdefs.h <<_ACEOF
+#define LT_OBJDIR "$lt_cv_objdir/"
+_ACEOF
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+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.
+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 delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+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
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
+$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+ $as_echo_n "(cached) " >&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 <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+
+
+
+if test -z "$lt_cv_path_MAGIC_CMD"; then
+ if test -n "$ac_tool_prefix"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
+$as_echo_n "checking for file... " >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then :
+ $as_echo_n "(cached) " >&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 <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
+$as_echo "$MAGIC_CMD" >&6; }
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+
+ else
+ MAGIC_CMD=:
+ fi
+fi
+
+ fi
+ ;;
+esac
+
# Use C for the default configuration in the libtool script
-tagname=
+
lt_save_CC="$CC"
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -7526,6 +8304,11 @@ lt_simple_compile_test_code="int some_variable = 0;"
lt_simple_link_test_code='int main(){return(0);}'
+
+
+
+
+
# If no C compiler was specified, use CC.
LTCC=${LTCC-"$CC"}
@@ -7535,35 +8318,42 @@ LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
# Allow CC to be a program name with arguments.
compiler=$CC
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
# save warnings/boilerplate of simple test code
ac_outfile=conftest.$ac_objext
echo "$lt_simple_compile_test_code" >conftest.$ac_ext
eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
_lt_compiler_boilerplate=`cat conftest.err`
-$rm conftest*
+$RM conftest*
ac_outfile=conftest.$ac_objext
echo "$lt_simple_link_test_code" >conftest.$ac_ext
eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
_lt_linker_boilerplate=`cat conftest.err`
-$rm -r conftest*
+$RM -r conftest*
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
lt_cv_prog_compiler_rtti_exceptions=no
- ac_outfile=conftest.$ac_objext
+ ac_outfile=conftest.$ac_objext
echo "$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
@@ -7575,25 +8365,25 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7578: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8368: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7582: \$? = $ac_status" >&5
+ echo "$as_me:8372: \$? = $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 -e '/^$/d' >conftest.exp
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
$SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
lt_cv_prog_compiler_rtti_exceptions=yes
fi
fi
- $rm conftest*
+ $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; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+$as_echo "$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"
@@ -7603,12 +8393,17 @@ fi
fi
-lt_prog_compiler_wl=
+
+
+
+
+
+ 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; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5
+$as_echo_n "checking for $compiler option to produce PIC... " >&6; }
if test "$GCC" = yes; then
lt_prog_compiler_wl='-Wl,'
@@ -7624,17 +8419,25 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
;;
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'
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ m68k)
+ # 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'
+ ;;
+ esac
;;
beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
- mingw* | cygwin* | pw32* | os2*)
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
# 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).
# Although the cygwin gcc ignores -fPIC, still need this for old-style
@@ -7648,6 +8451,20 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
lt_prog_compiler_pic='-fno-common'
;;
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ # +Z the default
+ ;;
+ *)
+ lt_prog_compiler_pic='-fPIC'
+ ;;
+ esac
+ ;;
+
interix[3-9]*)
# Interix 3.x gcc -fpic/-fPIC options generate broken code.
# Instead, we relocate shared libraries at runtime.
@@ -7660,25 +8477,18 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
enable_shared=no
;;
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
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'
;;
@@ -7695,18 +8505,8 @@ 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* | cygwin* | pw32* | os2*)
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
# 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'
@@ -7734,18 +8534,27 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
lt_prog_compiler_static='-non_shared'
;;
- newsos6)
- lt_prog_compiler_pic='-KPIC'
- lt_prog_compiler_static='-Bstatic'
- ;;
-
- linux* | k*bsd*-gnu)
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
case $cc_basename in
- icc* | ecc*)
+ # old Intel for x86_64 which still supported -KPIC.
+ ecc*)
lt_prog_compiler_wl='-Wl,'
lt_prog_compiler_pic='-KPIC'
lt_prog_compiler_static='-static'
;;
+ # icc used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ icc* | ifort*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-fPIC'
+ lt_prog_compiler_static='-static'
+ ;;
+ # Lahey Fortran 8.1.
+ lf95*)
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='--shared'
+ lt_prog_compiler_static='--static'
+ ;;
pgcc* | pgf77* | pgf90* | pgf95*)
# Portland Group compilers (*not* the Pentium gcc compiler,
# which looks to be a dead project)
@@ -7758,8 +8567,14 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
# All Alpha code is PIC.
lt_prog_compiler_static='-non_shared'
;;
+ xl*)
+ # IBM XL C 8.0/Fortran 10.1 on PPC
+ lt_prog_compiler_wl='-Wl,'
+ lt_prog_compiler_pic='-qpic'
+ lt_prog_compiler_static='-qstaticlink'
+ ;;
*)
- case `$CC -V 2>&1 | sed 5q` in
+ case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
# Sun C 5.9
lt_prog_compiler_pic='-KPIC'
@@ -7777,6 +8592,17 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
esac
;;
+ newsos6)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ lt_prog_compiler_pic='-fPIC -shared'
+ ;;
+
osf3* | osf4* | osf5*)
lt_prog_compiler_wl='-Wl,'
# All OSF/1 code is PIC.
@@ -7839,21 +8665,34 @@ echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
esac
fi
-{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
-echo "${ECHO_T}$lt_prog_compiler_pic" >&6; }
+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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_prog_compiler_pic" >&5
+$as_echo "$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_cv_prog_compiler_pic_works+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
+if test "${lt_cv_prog_compiler_pic_works+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
lt_cv_prog_compiler_pic_works=no
- ac_outfile=conftest.$ac_objext
+ ac_outfile=conftest.$ac_objext
echo "$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
@@ -7865,25 +8704,25 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7868: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8707: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:7872: \$? = $ac_status" >&5
+ echo "$as_me:8711: \$? = $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 -e '/^$/d' >conftest.exp
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
$SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
lt_cv_prog_compiler_pic_works=yes
fi
fi
- $rm conftest*
+ $RM conftest*
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_pic_works" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
+$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
case $lt_prog_compiler_pic in
@@ -7896,24 +8735,20 @@ else
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
+
+
+
+
+
#
# Check to make sure the static flag actually works.
#
wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
-{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_static_works+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; }
+if test "${lt_cv_prog_compiler_static_works+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
lt_cv_prog_compiler_static_works=no
save_LDFLAGS="$LDFLAGS"
@@ -7925,7 +8760,7 @@ 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 -e '/^$/d' > conftest.exp
+ $ECHO "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
$SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
if diff conftest.exp conftest.er2 >/dev/null; then
lt_cv_prog_compiler_static_works=yes
@@ -7934,12 +8769,12 @@ else
lt_cv_prog_compiler_static_works=yes
fi
fi
- $rm -r conftest*
+ $RM -r conftest*
LDFLAGS="$save_LDFLAGS"
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_static_works" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
+$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
if test x"$lt_cv_prog_compiler_static_works" = xyes; then
:
@@ -7948,13 +8783,18 @@ else
fi
-{ 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
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
lt_cv_prog_compiler_c_o=no
- $rm -r conftest 2>/dev/null
+ $RM -r conftest 2>/dev/null
mkdir conftest
cd conftest
mkdir out
@@ -7969,83 +8809,148 @@ else
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
-e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:7972: $lt_compile\"" >&5)
+ (eval echo "\"\$as_me:8812: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:7976: \$? = $ac_status" >&5
+ echo "$as_me:8816: \$? = $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 -e '/^$/d' > out/conftest.exp
+ $ECHO "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' > out/conftest.exp
$SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
lt_cv_prog_compiler_c_o=yes
fi
fi
chmod u+w . 2>&5
- $rm conftest*
+ $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
+ 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
+ $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; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5
+$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ lt_cv_prog_compiler_c_o=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$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}\{0,1\} :&$lt_compiler_flag :; t' \
+ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
+ -e 's:$: $lt_compiler_flag:'`
+ (eval echo "\"\$as_me:8867: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:8871: \$? = $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 -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ lt_cv_prog_compiler_c_o=yes
+ fi
+ fi
+ chmod u+w . 2>&5
+ $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 ..
+ $RM -r conftest
+ $RM conftest*
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
+$as_echo "$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; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5
+$as_echo_n "checking if we can lock with hard links... " >&6; }
hard_links=yes
- $rm conftest*
+ $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; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5
+$as_echo "$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;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+$as_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; }
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; }
runpath_var=
allow_undefined_flag=
- enable_shared_with_static_runtimes=no
+ always_export_symbols=no
archive_cmds=
archive_expsym_cmds=
- old_archive_From_new_cmds=
- old_archive_from_expsyms_cmds=
+ compiler_needs_object=no
+ enable_shared_with_static_runtimes=no
export_dynamic_flag_spec=
- whole_archive_flag_spec=
- thread_safe_flag_spec=
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ hardcode_automatic=no
+ hardcode_direct=no
+ hardcode_direct_absolute=no
hardcode_libdir_flag_spec=
hardcode_libdir_flag_spec_ld=
hardcode_libdir_separator=
- hardcode_direct=no
hardcode_minus_L=no
hardcode_shlibpath_var=unsupported
+ inherit_rpath=no
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'
+ old_archive_from_new_cmds=
+ old_archive_from_expsyms_cmds=
+ thread_safe_flag_spec=
+ whole_archive_flag_spec=
# include_expsyms should be a list of space-separated symbols to be *always*
# included in the symbol list
include_expsyms=
@@ -8061,19 +8966,9 @@ echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared librar
# preloaded symbol tables.
# Exclude shared library initialization/finalization symbols.
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*)
+ cygwin* | mingw* | pw32* | cegcc*)
# 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++.
@@ -8088,6 +8983,9 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
openbsd*)
with_gnu_ld=no
;;
+ linux* | k*bsd*-gnu)
+ link_all_deplibs=no
+ ;;
esac
ld_shlibs=yes
@@ -8099,16 +8997,17 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
# 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'
+ 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=
+ 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
+ case `$LD -v 2>&1` in
+ *GNU\ gold*) supports_anon_versioning=yes ;;
*\ [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 ...
@@ -8122,7 +9021,7 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
ld_shlibs=no
- cat <<EOF 1>&2
+ cat <<_LT_EOF 1>&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.
@@ -8130,26 +9029,27 @@ cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
*** really care for shared libraries, you may want to modify your PATH
*** so that a non-GNU linker is found, and then restart.
-EOF
+_LT_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 <kc5tja@dolphin.openprojects.net> 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
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ 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
+ ;;
+ esac
;;
beos*)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
allow_undefined_flag=unsupported
# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
# support --undefined. This deserves some investigation. FIXME
@@ -8159,16 +9059,16 @@ EOF
fi
;;
- cygwin* | mingw* | pw32*)
- # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_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/'\'' -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
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
# If the export-symbols file already is a .def file (1st line
# is EXPORTS), use it as is; otherwise, prepend...
@@ -8199,48 +9099,78 @@ EOF
archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
;;
- gnu* | linux* | k*bsd*-gnu)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
tmp_addflag=
+ tmp_sharedflag='-shared'
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'
+ 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* | pgf95*) # 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'
+ 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
+ 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' ;;
+ lf95*) # Lahey Fortran 8.1
+ whole_archive_flag_spec=
+ tmp_sharedflag='--shared' ;;
+ xl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ tmp_sharedflag='-qmkshrobj'
+ tmp_addflag= ;;
esac
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*) # Sun C 5.9
- whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ compiler_needs_object=yes
tmp_sharedflag='-G' ;;
*Sun\ F*) # Sun Fortran 8.3
tmp_sharedflag='-G' ;;
- *)
- tmp_sharedflag='-shared' ;;
esac
archive_cmds='$CC '"$tmp_sharedflag""$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 '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
- fi
+ if test "x$supports_anon_versioning" = xyes; 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 '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+
+ case $cc_basename in
+ xlf*)
+ # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+ whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive'
+ hardcode_libdir_flag_spec=
+ hardcode_libdir_flag_spec_ld='-rpath $libdir'
+ archive_cmds='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; 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~
+ $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ esac
else
- ld_shlibs=no
+ ld_shlibs=no
fi
;;
- netbsd*)
- if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ netbsd* | netbsdelf*-gnu)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
wlarc=
else
@@ -8250,9 +9180,9 @@ EOF
;;
solaris*)
- if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
- cat <<EOF 1>&2
+ cat <<_LT_EOF 1>&2
*** Warning: The releases 2.8.* of the GNU linker cannot reliably
*** create shared libraries on Solaris systems. Therefore, libtool
@@ -8261,8 +9191,8 @@ EOF
*** 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_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
@@ -8286,10 +9216,14 @@ EOF
_LT_EOF
;;
*)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
+ 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
@@ -8305,7 +9239,7 @@ _LT_EOF
;;
*)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ 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
@@ -8347,10 +9281,10 @@ _LT_EOF
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'
+ 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'
+ 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
@@ -8359,10 +9293,10 @@ _LT_EOF
# need to do runtime linking.
case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
for ld_flag in $LDFLAGS; do
- if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
- aix_use_runtimelinking=yes
- break
- fi
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
done
;;
esac
@@ -8379,28 +9313,30 @@ _LT_EOF
archive_cmds=''
hardcode_direct=yes
+ hardcode_direct_absolute=yes
hardcode_libdir_separator=':'
link_all_deplibs=yes
+ file_list_spec='${wl}-f,'
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
+ if test -f "$collect2name" &&
+ strings "$collect2name" | $GREP resolve_lib_name >/dev/null
then
- # We have reworked collect2
- :
+ # We have reworked collect2
+ :
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=
+ # 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
@@ -8408,11 +9344,12 @@ _LT_EOF
if test "$aix_use_runtimelinking" = yes; then
shared_flag="$shared_flag "'${wl}-G'
fi
+ link_all_deplibs=no
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:
+ # 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
@@ -8423,6 +9360,7 @@ _LT_EOF
fi
fi
+ export_dynamic_flag_spec='${wl}-bexpall'
# 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
@@ -8430,12 +9368,9 @@ _LT_EOF
# 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
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -8446,24 +9381,7 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; then :
lt_aix_libpath_sed='
/Import File Strings/,/^$/ {
@@ -8477,31 +9395,22 @@ aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpat
if test -z "$aix_libpath"; then
aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
fi
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core 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 '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
- else
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${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 '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_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
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -8512,24 +9421,7 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; then :
lt_aix_libpath_sed='
/Import File Strings/,/^$/ {
@@ -8543,15 +9435,9 @@ aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpat
if test -z "$aix_libpath"; then
aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
fi
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core 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"
@@ -8569,18 +9455,25 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; 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
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds=''
+ ;;
+ m68k)
+ 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
+ ;;
+ esac
;;
bsdi[45]*)
export_dynamic_flag_spec=-rdynamic
;;
- cygwin* | mingw* | pw32*)
+ cygwin* | mingw* | pw32* | cegcc*)
# When not using gcc, we currently assume that we are using
# Microsoft Visual C++.
# hardcode_libdir_flag_spec is actually meaningless, as there is
@@ -8592,9 +9485,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
# 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='
+ archive_cmds='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -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'
+ 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"`'
@@ -8602,52 +9495,30 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
;;
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 $_lt_dar_single_mod${_lt_dsymutil}"
- module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
- module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
- 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` $xlcverstring'
- 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 lds
- 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 $xlcverstring~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
+
+
+ archive_cmds_need_lc=no
+ hardcode_direct=no
+ hardcode_automatic=yes
+ hardcode_shlibpath_var=unsupported
+ whole_archive_flag_spec=''
+ link_all_deplibs=yes
+ allow_undefined_flag="$_lt_dar_allow_undefined"
+ case $cc_basename in
+ ifort*) _lt_dar_can_shared=yes ;;
+ *) _lt_dar_can_shared=$GCC ;;
+ esac
+ if test "$_lt_dar_can_shared" = "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 $_lt_dar_single_mod${_lt_dsymutil}"
+ module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+
+ else
+ ld_shlibs=no
+ fi
+
;;
dgux*)
@@ -8689,9 +9560,9 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
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'
+ 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'
+ 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=:
@@ -8711,11 +9582,11 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
fi
if test "$with_gnu_ld" = no; then
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
+ hardcode_libdir_flag_spec_ld='+b $libdir'
hardcode_libdir_separator=:
-
hardcode_direct=yes
+ hardcode_direct_absolute=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
@@ -8729,7 +9600,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
- archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -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'
@@ -8754,12 +9625,12 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
case $host_cpu in
hppa*64*|ia64*)
- hardcode_libdir_flag_spec_ld='+b $libdir'
hardcode_direct=no
hardcode_shlibpath_var=no
;;
*)
hardcode_direct=yes
+ hardcode_direct_absolute=yes
export_dynamic_flag_spec='${wl}-E'
# hardcode_minus_L: Not really in the search PATH,
@@ -8772,18 +9643,36 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; 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'
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+int foo(void) {}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS="$save_LDFLAGS"
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'
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
fi
+ archive_cmds_need_lc='no'
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
+ inherit_rpath=yes
link_all_deplibs=yes
;;
- netbsd*)
- if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ netbsd* | netbsdelf*-gnu)
+ 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
@@ -8801,11 +9690,15 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
hardcode_shlibpath_var=no
;;
+ *nto* | *qnx*)
+ ;;
+
openbsd*)
if test -f /usr/libexec/ld.so; then
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
+ hardcode_direct_absolute=yes
+ 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'
@@ -8821,7 +9714,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
esac
- fi
+ fi
else
ld_shlibs=no
fi
@@ -8831,18 +9724,19 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
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'
+ 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'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${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'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
fi
+ archive_cmds_need_lc='no'
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
@@ -8850,32 +9744,43 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
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'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${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'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -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; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -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'
fi
+ archive_cmds_need_lc='no'
hardcode_libdir_separator=:
;;
solaris*)
- no_undefined_flag=' -z text'
+ no_undefined_flag=' -z defs'
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'
+ archive_cmds='$CC -shared ${wl}-z ${wl}text ${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}-z ${wl}text ${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'
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ 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'
+ ;;
+ *)
+ wlarc='${wl}'
+ archive_cmds='$CC -G${allow_undefined_flag} -h $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 -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
fi
hardcode_libdir_flag_spec='-R$libdir'
hardcode_shlibpath_var=no
@@ -8885,7 +9790,7 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
# The compiler driver will combine and reorder linker options,
# but understands `-z linker_flag'. GCC discards it without `$wl',
# but is careful enough not to reorder.
- # Supported since Solaris 2.6 (maybe 2.5.1?)
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
if test "$GCC" = yes; then
whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
else
@@ -8974,18 +9879,18 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
allow_undefined_flag='${wl}-z,nodefs'
archive_cmds_need_lc=no
hardcode_shlibpath_var=no
- hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ hardcode_libdir_flag_spec='${wl}-R,$libdir'
hardcode_libdir_separator=':'
link_all_deplibs=yes
export_dynamic_flag_spec='${wl}-Bexport'
runpath_var='LD_RUN_PATH'
if test "$GCC" = yes; then
- archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
else
- archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
fi
;;
@@ -8999,12 +9904,36 @@ if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
ld_shlibs=no
;;
esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
fi
-{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5
-echo "${ECHO_T}$ld_shlibs" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
+$as_echo "$ld_shlibs" >&6; }
test "$ld_shlibs" = no && can_build_shared=no
+with_gnu_ld=$with_gnu_ld
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
#
# Do we need to explicitly link libc?
#
@@ -9022,16 +9951,16 @@ x|xyes)
# 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*
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5
+$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; }
+ $RM conftest*
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
- if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ if { { eval echo "\"\$as_me\":${as_lineno-$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
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } 2>conftest.err; then
soname=conftest
lib=conftest
libobjs=conftest.$ac_objext
@@ -9045,11 +9974,11 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&
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
+ if { { eval echo "\"\$as_me\":${as_lineno-$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); }
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }
then
archive_cmds_need_lc=no
else
@@ -9059,30 +9988,173 @@ echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&
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; }
+ $RM conftest*
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $archive_cmds_need_lc" >&5
+$as_echo "$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"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
+$as_echo_n "checking dynamic linker characteristics... " >&6; }
if test "$GCC" = yes; then
case $host_os in
@@ -9090,14 +10162,14 @@ if test "$GCC" = yes; then
*) lt_awk_arg="/^libraries:/" ;;
esac
lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
- if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then
+ if $ECHO "$lt_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.
- lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
else
- lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
fi
# Ok, now we have the path, separated by spaces, we can step through it
# and add multilib dir if necessary.
@@ -9111,7 +10183,7 @@ if test "$GCC" = yes; then
lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
fi
done
- lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk '
+ lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
BEGIN {RS=" "; FS="/|\n";} {
lt_foo="";
lt_count=0;
@@ -9131,10 +10203,23 @@ BEGIN {RS=" "; FS="/|\n";} {
if (lt_foo != "") { lt_freq[lt_foo]++; }
if (lt_freq[lt_foo] == 1) { print lt_foo; }
}'`
- sys_lib_search_path_spec=`echo $lt_search_path_spec`
+ sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
else
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
fi
+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"
need_lib_prefix=unknown
hardcode_into_libs=no
@@ -9171,7 +10256,7 @@ aix[4-9]*)
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
+ echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then
:
else
can_build_shared=no
@@ -9197,9 +10282,18 @@ aix[4-9]*)
;;
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'
+ case $host_cpu in
+ powerpc)
+ # Since July 2007 AmigaOS4 officially supports .so libraries.
+ # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ ;;
+ m68k)
+ 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'
+ ;;
+ esac
;;
beos*)
@@ -9222,25 +10316,28 @@ bsdi[45]*)
# libtool to hard-code these into programs
;;
-cygwin* | mingw* | pw32*)
+cygwin* | mingw* | pw32* | cegcc*)
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* | yes,mingw* | yes,pw32* | yes,cegcc*)
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'\''`~
+ 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~
- chmod a+x \$dldir/$dlname'
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
dlpath=$dir/\$dldll~
- $rm \$dlpath'
+ $RM \$dlpath'
shlibpath_overrides_runpath=yes
case $host_os in
@@ -9249,20 +10346,20 @@ cygwin* | mingw* | pw32*)
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* | cegcc*)
# 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
+ 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'`
+ 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"`
+ sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
fi
;;
pw32*)
@@ -9286,7 +10383,7 @@ 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'
+ library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
soname_spec='${libname}${release}${major}$shared_ext'
shlibpath_overrides_runpath=yes
shlibpath_var=DYLD_LIBRARY_PATH
@@ -9385,18 +10482,18 @@ hpux9* | hpux10* | hpux11*)
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
- ;;
- *)
+ 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
@@ -9464,7 +10561,7 @@ linux*oldld* | linux*aout* | linux*coff*)
;;
# This must be Linux ELF.
-linux* | k*bsd*-gnu)
+linux* | k*bsd*-gnu | kopensolaris*-gnu)
version_type=linux
need_lib_prefix=no
need_version=no
@@ -9473,6 +10570,32 @@ linux* | k*bsd*-gnu)
finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
shlibpath_var=LD_LIBRARY_PATH
shlibpath_overrides_runpath=no
+ # Some binutils ld are patched to set DT_RUNPATH
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \
+ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then :
+ shlibpath_overrides_runpath=yes
+fi
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+
# This implies no fast_install, which is unacceptable.
# Some rework will be needed to allow for fast_install
# before this can be enabled.
@@ -9480,7 +10603,7 @@ linux* | k*bsd*-gnu)
# 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>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
+ lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;/^$/d' | tr '\n' ' '`
sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
fi
@@ -9493,11 +10616,23 @@ linux* | k*bsd*-gnu)
dynamic_linker='GNU/Linux ld.so'
;;
+netbsdelf*-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='NetBSD ld.elf_so'
+ ;;
+
netbsd*)
version_type=sunos
need_lib_prefix=no
need_version=no
- if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ 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'
@@ -9518,14 +10653,16 @@ newsos6)
shlibpath_overrides_runpath=yes
;;
-nto-qnx*)
- version_type=linux
+*nto* | *qnx*)
+ version_type=qnx
need_lib_prefix=no
need_version=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
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ dynamic_linker='ldqnx.so'
;;
openbsd*)
@@ -9534,13 +10671,13 @@ openbsd*)
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 ;;
+ 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
+ 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
@@ -9612,7 +10749,6 @@ sysv4 | sysv4.3*)
sni)
shlibpath_overrides_runpath=no
need_lib_prefix=no
- export_dynamic_flag_spec='${wl}-Blargedynsym'
runpath_var=LD_RUN_PATH
;;
siemens)
@@ -9643,13 +10779,12 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
soname_spec='${libname}${release}${shared_ext}$major'
shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
hardcode_into_libs=yes
if test "$with_gnu_ld" = yes; then
sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
- shlibpath_overrides_runpath=no
else
sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
- shlibpath_overrides_runpath=yes
case $host_os in
sco3.2v5*)
sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
@@ -9659,6 +10794,17 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
sys_lib_dlsearch_path_spec='/usr/lib'
;;
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/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}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
uts4*)
version_type=linux
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -9670,43 +10816,121 @@ uts4*)
dynamic_linker=no
;;
esac
-{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
-echo "${ECHO_T}$dynamic_linker" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
+$as_echo "$dynamic_linker" >&6; }
test "$dynamic_linker" = no && can_build_shared=no
-if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
+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
-sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
+ sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
fi
-sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-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
-{ 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; }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5
+$as_echo_n "checking how to hardcode library paths into programs... " >&6; }
hardcode_action=
-if test -n "$hardcode_libdir_flag_spec" || \
- test -n "$runpath_var" || \
+if test -n "$hardcode_libdir_flag_spec" ||
+ test -n "$runpath_var" ||
test "X$hardcode_automatic" = "Xyes" ; then
- # We can hardcode non-existant directories.
+ # We can hardcode non-existent 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 "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no &&
test "$hardcode_minus_L" != no; then
# Linking always hardcodes the temporary library directory.
hardcode_action=relink
@@ -9719,10 +10943,11 @@ else
# directories.
hardcode_action=unsupported
fi
-{ echo "$as_me:$LINENO: result: $hardcode_action" >&5
-echo "${ECHO_T}$hardcode_action" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
+$as_echo "$hardcode_action" >&6; }
-if test "$hardcode_action" = relink; then
+if test "$hardcode_action" = relink ||
+ test "$inherit_rpath" = yes; then
# Fast installation is not supported
enable_fast_install=no
elif test "$shlibpath_overrides_runpath" = yes ||
@@ -9731,37 +10956,12 @@ 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"
- old_striplib="$STRIP -S"
- { 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
+
+
+
+
+ if test "x$enable_dlopen" != xyes; then
enable_dlopen=unknown
enable_dlopen_self=unknown
enable_dlopen_self_static=unknown
@@ -9776,30 +10976,26 @@ else
lt_cv_dlopen_self=yes
;;
- mingw* | pw32*)
+ mingw* | pw32* | cegcc*)
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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+ $as_echo_n "(cached) " >&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
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -9817,39 +11013,18 @@ return dlopen ();
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; 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
+ ac_cv_lib_dl_dlopen=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""yes; then :
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
else
@@ -9859,105 +11034,21 @@ else
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 <limits.h> declares shl_load.
- For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef shl_load
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-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
-#endif
-
-int
-main ()
-{
-return shl_load ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- 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
+ ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
+if test "x$ac_cv_func_shl_load" = x""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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
+$as_echo_n "checking for shl_load in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then :
+ $as_echo_n "(cached) " >&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
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -9975,137 +11066,32 @@ return shl_load ();
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; 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
+ ac_cv_lib_dld_shl_load=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
+$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
+if test "x$ac_cv_lib_dld_shl_load" = x""yes; then :
lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
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 <limits.h> declares dlopen.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define dlopen innocuous_dlopen
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char dlopen (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef dlopen
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-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
-#endif
-
-int
-main ()
-{
-return dlopen ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- 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
+ ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
+if test "x$ac_cv_func_dlopen" = x""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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
+$as_echo_n "checking for dlopen in -ldl... " >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then :
+ $as_echo_n "(cached) " >&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
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -10123,53 +11109,28 @@ return dlopen ();
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; 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
+ ac_cv_lib_dl_dlopen=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
+$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
+if test "x$ac_cv_lib_dl_dlopen" = x""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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
+$as_echo_n "checking for dlopen in -lsvld... " >&6; }
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then :
+ $as_echo_n "(cached) " >&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
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -10187,53 +11148,28 @@ return dlopen ();
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; 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
+ ac_cv_lib_svld_dlopen=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
+$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
+if test "x$ac_cv_lib_svld_dlopen" = x""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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
+$as_echo_n "checking for dld_link in -ldld... " >&6; }
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then :
+ $as_echo_n "(cached) " >&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
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -10251,39 +11187,18 @@ return dld_link ();
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; 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
+ ac_cv_lib_dld_dld_link=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
+$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
+if test "x$ac_cv_lib_dld_dld_link" = x""yes; then :
lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
fi
@@ -10322,18 +11237,18 @@ fi
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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
+$as_echo_n "checking whether a program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self+set}" = set; then :
+ $as_echo_n "(cached) " >&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 <<EOF
-#line 10336 "configure"
+ cat > conftest.$ac_ext <<_LT_EOF
+#line 11251 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10374,10 +11289,6 @@ else
# endif
#endif
-#ifdef __cplusplus
-extern "C" void exit (int);
-#endif
-
void fnord() { int i=42;}
int main ()
{
@@ -10393,14 +11304,14 @@ int main ()
else
puts (dlerror ());
- exit (status);
+ return status;
}
-EOF
- if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$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
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
(./conftest; exit; ) >&5 2>/dev/null
lt_status=$?
case x$lt_status in
@@ -10417,23 +11328,23 @@ rm -fr conftest*
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
+$as_echo "$lt_cv_dlopen_self" >&6; }
if test "x$lt_cv_dlopen_self" = xyes; then
wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
- { 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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
+$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
+if test "${lt_cv_dlopen_self_static+set}" = set; then :
+ $as_echo_n "(cached) " >&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 <<EOF
-#line 10436 "configure"
+ cat > conftest.$ac_ext <<_LT_EOF
+#line 11347 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -10474,10 +11385,6 @@ else
# endif
#endif
-#ifdef __cplusplus
-extern "C" void exit (int);
-#endif
-
void fnord() { int i=42;}
int main ()
{
@@ -10493,14 +11400,14 @@ int main ()
else
puts (dlerror ());
- exit (status);
+ return status;
}
-EOF
- if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
+_LT_EOF
+ if { { eval echo "\"\$as_me\":${as_lineno-$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
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
(./conftest; exit; ) >&5 2>/dev/null
lt_status=$?
case x$lt_status in
@@ -10517,8 +11424,8 @@ rm -fr conftest*
fi
-{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
-echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
+$as_echo "$lt_cv_dlopen_self_static" >&6; }
fi
CPPFLAGS="$save_CPPFLAGS"
@@ -10539,6197 +11446,103 @@ echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
fi
-# Report which library types will 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
- ;;
-
-aix[4-9]*)
- 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 EGREP RANLIB LN_S LTCC LTCFLAGS 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 \
- compiler_lib_search_dirs \
- 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 \
- fix_srcfile_path \
- 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, 2002, 2003, 2004, 2005, 2006, 2007, 2008
-# Free Software Foundation, Inc.
-#
-# This file is part of GNU Libtool:
-# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 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., 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 program that does not truncate output.
-SED=$lt_SED
-
-# Sed that helps us avoid accidentally triggering echo(1) options like -n.
-Xsed="$SED -e 1s/^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
-
-# LTCC compiler flags.
-LTCFLAGS=$lt_LTCFLAGS
-
-# 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="$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 directories searched by this compiler when creating a shared
-# library
-compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
-
-# 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=$lt_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 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
- if test -z "$LTCFLAGS"; then
- eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
- 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=cpp
-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_shlibpath_var_CXX=unsupported
-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=
-compiler_lib_search_dirs_CXX=
-
-# Source file extension for C++ test sources.
-ac_ext=cpp
-
-# 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;"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='int main(int, char *[]) { return(0); }'
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
-
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
-
-# Allow CC to be a program name with arguments.
-compiler=$CC
-
-
-# save warnings/boilerplate of simple test code
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$rm conftest*
-
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$rm -r 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
- $as_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
- $as_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 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 variants of GNU ld only accept -v.
- # Break only if it was the GNU/non-GNU ld that we prefer.
- case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
- *GNU* | *'with BFD'*)
- test "$with_gnu_ld" != no && break
- ;;
- *)
- test "$with_gnu_ld" != yes && break
- ;;
- esac
- fi
- done
- IFS="$lt_save_ifs"
-else
- lt_cv_path_LD="$LD" # Let the user override the test with a path.
-fi
-fi
-
-LD="$lt_cv_path_LD"
-if test -n "$LD"; then
- { echo "$as_me:$LINENO: result: $LD" >&5
-echo "${ECHO_T}$LD" >&6; }
-else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-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 lds only accept -v.
-case `$LD -v 2>&1 </dev/null` in
-*GNU* | *'with BFD'*)
- lt_cv_prog_gnu_ld=yes
- ;;
-*)
- lt_cv_prog_gnu_ld=no
- ;;
-esac
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
-echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
-with_gnu_ld=$lt_cv_prog_gnu_ld
-
-
-
- # 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
- ;;
- aix[4-9]*)
- 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].*|aix[5-9]*)
- 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
- :
- 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 { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_cxx_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
-
-lt_aix_libpath_sed='
- /Import File Strings/,/^$/ {
- /^0/ {
- s/^0 *\(.*\)$/\1/
- p
- }
- }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# 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 "$lt_aix_libpath_sed"`
-fi
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- 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 '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${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 '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_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 { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_cxx_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
-
-lt_aix_libpath_sed='
- /Import File Strings/,/^$/ {
- /^0/ {
- s/^0 *\(.*\)$/\1/
- p
- }
- }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# 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 "$lt_aix_libpath_sed"`
-fi
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- 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'
- # Exported symbols can be pulled into shared objects from archives
- whole_archive_flag_spec_CXX='$convenience'
- archive_cmds_need_lc_CXX=yes
- # This is similar to how AIX traditionally builds its shared libraries.
- archive_expsym_cmds_CXX="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
- fi
- fi
- ;;
-
- beos*)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- allow_undefined_flag_CXX=unsupported
- # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
- # support --undefined. This deserves some investigation. FIXME
- archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- else
- ld_shlibs_CXX=no
- 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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
- else
- ld_shlibs_CXX=no
- fi
- ;;
- darwin* | rhapsody*)
- 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
- allow_undefined_flag_CXX="$_lt_dar_allow_undefined"
- if test "$GXX" = yes ; then
- output_verbose_link_cmd='echo'
- archive_cmds_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
- module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
- module_expsym_cmds_CXX="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
- if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- 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${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed '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${_lt_dar_export_syms}${_lt_dsymutil}"
- fi
- 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` $xlcverstring'
- 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 lds
- 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 $xlcverstring~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* | 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
- hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
- hardcode_libdir_separator_CXX=:
-
- case $host_cpu in
- hppa*64*|ia64*) ;;
- *)
- export_dynamic_flag_spec_CXX='${wl}-E'
- ;;
- esac
- fi
- case $host_cpu in
- hppa*64*|ia64*)
- hardcode_direct_CXX=no
- hardcode_shlibpath_var_CXX=no
- ;;
- *)
- 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*)
- archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- ia64*)
- archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- *)
- 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
- hppa*64*)
- archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- ia64*)
- archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- *)
- 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
- ;;
- interix[3-9]*)
- hardcode_direct_CXX=no
- hardcode_shlibpath_var_CXX=no
- hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
- export_dynamic_flag_spec_CXX='${wl}-E'
- # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
- # Instead, shared libraries are loaded at an image base (0x10000000 by
- # default) and relocated if they conflict, which is a slow very memory
- # consuming and fragmenting process. To avoid this, we pick a random,
- # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
- # time. Moving up from 0x10000000 also allows more sbrk(2) space.
- archive_cmds_CXX='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- archive_expsym_cmds_CXX='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- ;;
- 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* | k*bsd*-gnu)
- 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* | pgcpp*)
- # 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'
- ;;
- *)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- # Sun C++ 5.9
- no_undefined_flag_CXX=' -zdefs'
- archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
- hardcode_libdir_flag_spec_CXX='-R$libdir'
- whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
-
- # Not sure whether something based on
- # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
- # would be better.
- output_verbose_link_cmd='echo'
-
- # 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'
- ;;
- esac
- ;;
- 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*)
- if test -f /usr/libexec/ld.so; then
- 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'
- else
- ld_shlibs_CXX=no
- fi
- ;;
- 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
- ;;
- 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++
- archive_cmds_need_lc_CXX=yes
- no_undefined_flag_CXX=' -zdefs'
- archive_cmds_CXX='$CC -G${allow_undefined_flag} -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} ${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 compiler driver will combine and reorder linker options,
- # but understands `-z linker_flag'.
- # Supported since Solaris 2.6 (maybe 2.5.1?)
- whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
- ;;
- esac
- link_all_deplibs_CXX=yes
-
- output_verbose_link_cmd='echo'
-
- # 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'
- case $host_os in
- solaris2.[0-5] | solaris2.[0-5].*) ;;
- *)
- whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
- ;;
- esac
- fi
- ;;
- esac
- ;;
- sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
- no_undefined_flag_CXX='${wl}-z,text'
- archive_cmds_need_lc_CXX=no
- hardcode_shlibpath_var_CXX=no
- runpath_var='LD_RUN_PATH'
-
- case $cc_basename in
- CC*)
- archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- *)
- archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- esac
- ;;
- sysv5* | sco3.2v5* | sco5v6*)
- # Note: We can NOT use -z defs as we might desire, because we do not
- # link with -lc, and that would cause any symbols used from libc to
- # always be unresolved, which means just about no library would
- # ever link correctly. If we're not using GNU ld we use -z text
- # though, which does catch some bad symbols but isn't as heavy-handed
- # as -z defs.
- # For security reasons, it is highly recommended that you always
- # use absolute paths for naming shared libraries, and exclude the
- # DT_RUNPATH tag from executables and libraries. But doing so
- # requires that you compile everything twice, which is a pain.
- # So that behaviour is only enabled if SCOABSPATH is set to a
- # non-empty value in the environment. Most likely only useful for
- # creating official distributions of packages.
- # This is a hack until libtool officially supports absolute path
- # names for shared libraries.
- no_undefined_flag_CXX='${wl}-z,text'
- allow_undefined_flag_CXX='${wl}-z,nodefs'
- archive_cmds_need_lc_CXX=no
- hardcode_shlibpath_var_CXX=no
- hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
- hardcode_libdir_separator_CXX=':'
- link_all_deplibs_CXX=yes
- export_dynamic_flag_spec_CXX='${wl}-Bexport'
- runpath_var='LD_RUN_PATH'
-
- case $cc_basename in
- CC*)
- archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- *)
- archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- esac
- ;;
- 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 <<EOF
-class Foo
-{
-public:
- Foo (void) { a = 0; }
-private:
- int a;
-};
-EOF
-
-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
- # 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
-
-compiler_lib_search_dirs_CXX=
-if test -n "$compiler_lib_search_path_CXX"; then
- compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
-fi
-# PORTME: override above test on systems where it is broken
-case $host_os in
-interix[3-9]*)
- # Interix 3.5 installs completely hosed .la files for C++, so rather than
- # hack all around it, let's just trust "g++" to DTRT.
- predep_objects_CXX=
- postdep_objects_CXX=
- postdeps_CXX=
- ;;
-linux*)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- # Sun C++ 5.9
- #
- # The more standards-conforming stlport4 library is
- # incompatible with the Cstd library. Avoid specifying
- # it if it's in CXXFLAGS. Ignore libCrun as
- # -library=stlport4 depends on it.
- case " $CXX $CXXFLAGS " in
- *" -library=stlport4 "*)
- solaris_use_stlport4=yes
- ;;
- esac
- if test "$solaris_use_stlport4" != yes; then
- postdeps_CXX='-library=Cstd -library=Crun'
- fi
- ;;
- esac
- ;;
-solaris*)
- case $cc_basename in
- CC*)
- # The more standards-conforming stlport4 library is
- # incompatible with the Cstd library. Avoid specifying
- # it if it's in CXXFLAGS. Ignore libCrun as
- # -library=stlport4 depends on it.
- case " $CXX $CXXFLAGS " in
- *" -library=stlport4 "*)
- solaris_use_stlport4=yes
- ;;
- esac
- # Adding this requires a known-good setup of shared libraries for
- # Sun compiler versions before 5.6, else PIC objects from an old
- # archive will be linked into the output, leading to subtle bugs.
- if test "$solaris_use_stlport4" != yes; then
- postdeps_CXX='-library=Cstd -library=Crun'
- fi
- ;;
- esac
- ;;
-esac
-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* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
- # PIC is the default for these OSes.
- ;;
- mingw* | cygwin* | 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).
- # Although the cygwin gcc ignores -fPIC, still need this for old-style
- # (--disable-auto-import) libraries
- 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=
- ;;
- interix[3-9]*)
- # Interix 3.x gcc -fpic/-fPIC options generate broken code.
- # Instead, we relocate shared libraries at runtime.
- ;;
- 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
- aix[4-9]*)
- # 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* | dragonfly*)
- # FreeBSD uses GNU C++
- ;;
- hpux9* | hpux10* | hpux11*)
- case $cc_basename in
- CC*)
- lt_prog_compiler_wl_CXX='-Wl,'
- lt_prog_compiler_static_CXX='${wl}-a ${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='${wl}-a ${wl}archive'
- case $host_cpu in
- hppa*64*|ia64*)
- # +Z the default
- ;;
- *)
- lt_prog_compiler_pic_CXX='+Z'
- ;;
- esac
- ;;
- *)
- ;;
- esac
- ;;
- interix*)
- # This is c89, which is MS Visual C++ (no shared libs)
- # Anyone wants to do a port?
- ;;
- 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* | k*bsd*-gnu)
- 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* | pgcpp*)
- # Portland Group C++ compiler.
- lt_prog_compiler_wl_CXX='-Wl,'
- lt_prog_compiler_pic_CXX='-fpic'
- lt_prog_compiler_static_CXX='-Bstatic'
- ;;
- 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'
- ;;
- *)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- # Sun C++ 5.9
- lt_prog_compiler_pic_CXX='-KPIC'
- lt_prog_compiler_static_CXX='-Bstatic'
- lt_prog_compiler_wl_CXX='-Qoption ld '
- ;;
- esac
- ;;
- 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*)
- ;;
- 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
- ;;
- sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
- case $cc_basename in
- CC*)
- lt_prog_compiler_wl_CXX='-Wl,'
- lt_prog_compiler_pic_CXX='-KPIC'
- lt_prog_compiler_static_CXX='-Bstatic'
- ;;
- esac
- ;;
- 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_cv_prog_compiler_pic_works_CXX+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- lt_cv_prog_compiler_pic_works_CXX=no
- ac_outfile=conftest.$ac_objext
- echo "$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}\{0,1\} :&$lt_compiler_flag :; t' \
- -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
- -e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:12837: $lt_compile\"" >&5)
- (eval "$lt_compile" 2>conftest.err)
- ac_status=$?
- cat conftest.err >&5
- echo "$as_me:12841: \$? = $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 -e '/^$/d' >conftest.exp
- $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
- if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
- lt_cv_prog_compiler_pic_works_CXX=yes
- fi
- fi
- $rm conftest*
-
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_CXX" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_CXX" >&6; }
-
-if test x"$lt_cv_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
-#
-# Check to make sure the static flag actually works.
-#
-wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
-{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_static_works_CXX+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- lt_cv_prog_compiler_static_works_CXX=no
- save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
- echo "$lt_simple_link_test_code" > conftest.$ac_ext
- if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
- # The linker 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 -e '/^$/d' > conftest.exp
- $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
- if diff conftest.exp conftest.er2 >/dev/null; then
- lt_cv_prog_compiler_static_works_CXX=yes
- fi
- else
- lt_cv_prog_compiler_static_works_CXX=yes
- fi
- fi
- $rm -r conftest*
- LDFLAGS="$save_LDFLAGS"
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_CXX" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_static_works_CXX" >&6; }
-if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then
- :
-else
- lt_prog_compiler_static_CXX=
-fi
-{ 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
- echo "$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}\{0,1\} :&$lt_compiler_flag :; t' \
- -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
- -e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:12941: $lt_compile\"" >&5)
- (eval "$lt_compile" 2>out/conftest.err)
- ac_status=$?
- cat out/conftest.err >&5
- echo "$as_me:12945: \$? = $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 -e '/^$/d' > out/conftest.exp
- $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
- if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
- lt_cv_prog_compiler_c_o_CXX=yes
- fi
- fi
- chmod u+w . 2>&5
- $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
+striplib=
+old_striplib=
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
+$as_echo_n "checking whether stripping libraries is possible... " >&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"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
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
- aix[4-9]*)
- # 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
- exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
-
-{ 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
-
-#
-# 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*
- echo "$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
- pic_flag=$lt_prog_compiler_pic_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"
-
-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'
- ;;
-
-aix[4-9]*)
- 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<name>.so
- # instead of lib<name>.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~
- chmod a+x \$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`'
-
- 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* | dragonfly*)
- # DragonFly does not have aout. When/if they implement a new
- # versioning mechanism, adjust this.
- if test -x /usr/bin/objformat; then
- objformat=`/usr/bin/objformat`
- else
- case $host_os in
- freebsd[123]*) objformat=aout ;;
- *) objformat=elf ;;
- esac
- fi
- 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
+# FIXME - insert some real tests, host_os isn't really good enough
case $host_os in
- freebsd2*)
- shlibpath_overrides_runpath=yes
- ;;
- freebsd3.[01]* | freebsdelf3.[01]*)
- shlibpath_overrides_runpath=yes
- hardcode_into_libs=yes
- ;;
- freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
- freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
- shlibpath_overrides_runpath=no
- hardcode_into_libs=yes
- ;;
- *) # from 4.6 on, and DragonFly
- shlibpath_overrides_runpath=yes
- 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"
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
else
- sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
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'
- ;;
-
-interix[3-9]*)
- version_type=linux
- need_lib_prefix=no
- need_version=no
- 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='Interix 3.x ld.so.1 (PE, like ELF)'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=no
- hardcode_into_libs=yes
- ;;
-
-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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
;;
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* | k*bsd*-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'
- 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>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;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'
- ;;
-
-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
- sys_lib_dlsearch_path_spec="/usr/lib"
- 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"
- ;;
-
-rdos*)
- dynamic_linker=no
- ;;
-
-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.3*)
- 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
- ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
- version_type=freebsd-elf
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LD_LIBRARY_PATH
- hardcode_into_libs=yes
- if test "$with_gnu_ld" = yes; then
- sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
- shlibpath_overrides_runpath=no
- else
- sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
- shlibpath_overrides_runpath=yes
- case $host_os in
- sco3.2v5*)
- sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
- ;;
- esac
- fi
- sys_lib_dlsearch_path_spec='/usr/lib'
- ;;
-
-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 "${lt_cv_sys_lib_search_path_spec+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
fi
-sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
-fi
-
-sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-
-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
-
-{ 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
-
-
-# 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 LTCFLAGS 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 \
- compiler_lib_search_dirs_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 \
- fix_srcfile_path_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
-
-# LTCC compiler flags.
-LTCFLAGS=$lt_LTCFLAGS
-
-# 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
+ # Report which library types will actually be built
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5
+$as_echo_n "checking if libtool supports shared libraries... " >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5
+$as_echo "$can_build_shared" >&6; }
-# 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 directories searched by this compiler when creating a shared
-# library
-compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_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=$lt_fix_srcfile_path
-
-# 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
- return
- end
-"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code="\
- program t
- end
-"
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
-
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
-
-# Allow CC to be a program name with arguments.
-compiler=$CC
-
-
-# save warnings/boilerplate of simple test code
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$rm conftest*
-
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$rm -r 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
- ;;
-aix[4-9]*)
- 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; }
-
-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* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
- # PIC is the default for these OSes.
- ;;
-
- mingw* | cygwin* | 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).
- # Although the cygwin gcc ignores -fPIC, still need this for old-style
- # (--disable-auto-import) libraries
- 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'
- ;;
-
- interix[3-9]*)
- # Interix 3.x gcc -fpic/-fPIC options generate broken code.
- # Instead, we relocate shared libraries at runtime.
- ;;
-
- 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* | cygwin* | 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* | k*bsd*-gnu)
- 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* | pgf95*)
- # 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='-Bstatic'
- ;;
- ccc*)
- lt_prog_compiler_wl_F77='-Wl,'
- # All Alpha code is PIC.
- lt_prog_compiler_static_F77='-non_shared'
- ;;
- *)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- # Sun C 5.9
- lt_prog_compiler_pic_F77='-KPIC'
- lt_prog_compiler_static_F77='-Bstatic'
- lt_prog_compiler_wl_F77='-Wl,'
- ;;
- *Sun\ F*)
- # Sun Fortran 8.3 passes all unrecognized flags to the linker
- lt_prog_compiler_pic_F77='-KPIC'
- lt_prog_compiler_static_F77='-Bstatic'
- lt_prog_compiler_wl_F77=''
- ;;
- esac
- ;;
- esac
- ;;
-
- osf3* | osf4* | osf5*)
- lt_prog_compiler_wl_F77='-Wl,'
- # All OSF/1 code is PIC.
- lt_prog_compiler_static_F77='-non_shared'
- ;;
-
- rdos*)
- lt_prog_compiler_static_F77='-non_shared'
- ;;
-
- 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*)
- 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
- ;;
-
- sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
- lt_prog_compiler_wl_F77='-Wl,'
- lt_prog_compiler_pic_F77='-KPIC'
- lt_prog_compiler_static_F77='-Bstatic'
- ;;
-
- 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_cv_prog_compiler_pic_works_F77+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- lt_cv_prog_compiler_pic_works_F77=no
- ac_outfile=conftest.$ac_objext
- echo "$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}\{0,1\} :&$lt_compiler_flag :; t' \
- -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
- -e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14524: $lt_compile\"" >&5)
- (eval "$lt_compile" 2>conftest.err)
- ac_status=$?
- cat conftest.err >&5
- echo "$as_me:14528: \$? = $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 -e '/^$/d' >conftest.exp
- $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
- if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
- lt_cv_prog_compiler_pic_works_F77=yes
- fi
- fi
- $rm conftest*
-
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_F77" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_F77" >&6; }
-
-if test x"$lt_cv_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
-
-#
-# Check to make sure the static flag actually works.
-#
-wl=$lt_prog_compiler_wl_F77 eval lt_tmp_static_flag=\"$lt_prog_compiler_static_F77\"
-{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_static_works_F77+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- lt_cv_prog_compiler_static_works_F77=no
- save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
- echo "$lt_simple_link_test_code" > conftest.$ac_ext
- if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
- # The linker 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 -e '/^$/d' > conftest.exp
- $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
- if diff conftest.exp conftest.er2 >/dev/null; then
- lt_cv_prog_compiler_static_works_F77=yes
- fi
- else
- lt_cv_prog_compiler_static_works_F77=yes
- fi
- fi
- $rm -r conftest*
- LDFLAGS="$save_LDFLAGS"
-
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_F77" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_static_works_F77" >&6; }
-
-if test x"$lt_cv_prog_compiler_static_works_F77" = xyes; then
- :
-else
- lt_prog_compiler_static_F77=
-fi
-
-
-{ 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
- echo "$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}\{0,1\} :&$lt_compiler_flag :; t' \
- -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
- -e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:14628: $lt_compile\"" >&5)
- (eval "$lt_compile" 2>out/conftest.err)
- ac_status=$?
- cat out/conftest.err >&5
- echo "$as_me:14632: \$? = $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 -e '/^$/d' > out/conftest.exp
- $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
- if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
- lt_cv_prog_compiler_c_o_F77=yes
- fi
- fi
- chmod u+w . 2>&5
- $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_|_GLOBAL__F[ID]_.*'
- # 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.
- # Exclude shared library initialization/finalization symbols.
- 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-%%"`
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5
+$as_echo_n "checking whether to build shared libraries... " >&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
- 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
- ;;
- interix*)
- # we just hope/assume this is gcc and not c89 (= MSVC++)
- with_gnu_ld=yes
- ;;
- 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
- aix[3-9]*)
- # On AIX/PPC, the GNU linker is very broken
- if test "$host_cpu" != ia64; then
- ld_shlibs_F77=no
- cat <<EOF 1>&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 <kc5tja@dolphin.openprojects.net> 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 <jrb3@best.com> 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/'\'' -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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
- else
- ld_shlibs_F77=no
- fi
- ;;
-
- interix[3-9]*)
- hardcode_direct_F77=no
- hardcode_shlibpath_var_F77=no
- hardcode_libdir_flag_spec_F77='${wl}-rpath,$libdir'
- export_dynamic_flag_spec_F77='${wl}-E'
- # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
- # Instead, shared libraries are loaded at an image base (0x10000000 by
- # default) and relocated if they conflict, which is a slow very memory
- # consuming and fragmenting process. To avoid this, we pick a random,
- # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
- # time. Moving up from 0x10000000 also allows more sbrk(2) space.
- archive_cmds_F77='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- archive_expsym_cmds_F77='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- ;;
-
- gnu* | linux* | k*bsd*-gnu)
- 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* | pgf95*) # 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
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*) # Sun C 5.9
- whole_archive_flag_spec_F77='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
- tmp_sharedflag='-G' ;;
- *Sun\ F*) # Sun Fortran 8.3
- tmp_sharedflag='-G' ;;
- *)
- tmp_sharedflag='-shared' ;;
- esac
- archive_cmds_F77='$CC '"$tmp_sharedflag""$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 '"$tmp_sharedflag""$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*)
- if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
- ld_shlibs_F77=no
- cat <<EOF 1>&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
- ;;
-
- sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
- case `$LD -v 2>&1` in
- *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
- ld_shlibs_F77=no
- cat <<_LT_EOF 1>&2
-
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
-*** reliably create shared libraries on SCO systems. Therefore, libtool
-*** is disabling shared libraries support. We urge you to upgrade GNU
-*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-_LT_EOF
- ;;
- *)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
- archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
- archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
- else
- ld_shlibs_F77=no
- fi
- ;;
- esac
- ;;
-
- 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 "$lt_prog_compiler_static"; then
- # Neither direct hardcoding nor static linking is supported with a
- # broken collect2.
- hardcode_direct_F77=unsupported
- fi
- ;;
-
- aix[4-9]*)
- 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].*|aix[5-9]*)
- 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
- :
- 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 { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_f77_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
-
-lt_aix_libpath_sed='
- /Import File Strings/,/^$/ {
- /^0/ {
- s/^0 *\(.*\)$/\1/
- p
- }
- }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# 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 "$lt_aix_libpath_sed"`
-fi
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- 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 '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${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 '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_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 { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_f77_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
-
-lt_aix_libpath_sed='
- /Import File Strings/,/^$/ {
- /^0/ {
- s/^0 *\(.*\)$/\1/
- p
- }
- }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# 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 "$lt_aix_libpath_sed"`
-fi
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- 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'
- # Exported symbols can be pulled into shared objects from archives
- whole_archive_flag_spec_F77='$convenience'
- archive_cmds_need_lc_F77=yes
- # This is similar to how AIX traditionally builds its shared libraries.
- archive_expsym_cmds_F77="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${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 $_lt_dar_single_mod${_lt_dsymutil}"
- module_cmds_F77="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_F77="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
- module_expsym_cmds_F77="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
- 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` $xlcverstring'
- 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 lds
- 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 $xlcverstring~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* | 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*)
- if test "$GCC" = yes -a "$with_gnu_ld" = no; then
- archive_cmds_F77='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
- else
- archive_cmds_F77='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
- fi
- if test "$with_gnu_ld" = no; then
- 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
- fi
- ;;
-
- hpux11*)
- if test "$GCC" = yes -a "$with_gnu_ld" = no; then
- case $host_cpu in
- hppa*64*)
- archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- ia64*)
- archive_cmds_F77='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -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*)
- archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- ia64*)
- archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- *)
- archive_cmds_F77='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- esac
- fi
- if test "$with_gnu_ld" = no; then
- hardcode_libdir_flag_spec_F77='${wl}+b ${wl}$libdir'
- hardcode_libdir_separator_F77=:
-
- case $host_cpu in
- hppa*64*|ia64*)
- hardcode_libdir_flag_spec_ld_F77='+b $libdir'
- hardcode_direct_F77=no
- hardcode_shlibpath_var_F77=no
- ;;
- *)
- 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*)
- if test -f /usr/libexec/ld.so; then
- 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
- else
- ld_shlibs_F77=no
- 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=:
- ;;
-
- 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 and reorder linker options,
- # but understands `-z linker_flag'. GCC discards it without `$wl',
- # but is careful enough not to reorder.
- # Supported since Solaris 2.6 (maybe 2.5.1?)
- if test "$GCC" = yes; then
- whole_archive_flag_spec_F77='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
- else
- whole_archive_flag_spec_F77='-z allextract$convenience -z defaultextract'
- fi
- ;;
- 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*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
- no_undefined_flag_F77='${wl}-z,text'
- archive_cmds_need_lc_F77=no
- hardcode_shlibpath_var_F77=no
- runpath_var='LD_RUN_PATH'
-
- if test "$GCC" = yes; then
- archive_cmds_F77='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- else
- archive_cmds_F77='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- fi
- ;;
-
- sysv5* | sco3.2v5* | sco5v6*)
- # Note: We can NOT use -z defs as we might desire, because we do not
- # link with -lc, and that would cause any symbols used from libc to
- # always be unresolved, which means just about no library would
- # ever link correctly. If we're not using GNU ld we use -z text
- # though, which does catch some bad symbols but isn't as heavy-handed
- # as -z defs.
- no_undefined_flag_F77='${wl}-z,text'
- allow_undefined_flag_F77='${wl}-z,nodefs'
- archive_cmds_need_lc_F77=no
- hardcode_shlibpath_var_F77=no
- hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
- hardcode_libdir_separator_F77=':'
- link_all_deplibs_F77=yes
- export_dynamic_flag_spec_F77='${wl}-Bexport'
- runpath_var='LD_RUN_PATH'
-
- if test "$GCC" = yes; then
- archive_cmds_F77='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- else
- archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- fi
- ;;
-
- 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
-
-#
-# 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*
- echo "$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
- pic_flag=$lt_prog_compiler_pic_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"
-
-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'
- ;;
-
-aix[4-9]*)
- 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<name>.so
- # instead of lib<name>.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'
+ aix3*)
+ test "$enable_shared" = yes && enable_static=no
+ if test -n "$RANLIB"; then
+ archive_cmds="$archive_cmds~\$RANLIB \$lib"
+ postinstall_cmds='$RANLIB $lib'
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~
- chmod a+x \$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`'
-
- 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* | dragonfly*)
- # DragonFly does not have aout. When/if they implement a new
- # versioning mechanism, adjust this.
- if test -x /usr/bin/objformat; then
- objformat=`/usr/bin/objformat`
- else
- case $host_os in
- freebsd[123]*) objformat=aout ;;
- *) objformat=elf ;;
- esac
- fi
- 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
;;
- freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
- freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
- shlibpath_overrides_runpath=no
- hardcode_into_libs=yes
- ;;
- *) # from 4.6 on, and DragonFly
- shlibpath_overrides_runpath=yes
- 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"
+ aix[4-9]*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
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'
- ;;
-
-interix[3-9]*)
- version_type=linux
- need_lib_prefix=no
- need_version=no
- 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='Interix 3.x ld.so.1 (PE, like ELF)'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=no
- hardcode_into_libs=yes
- ;;
-
-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* | k*bsd*-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'
- 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>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;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'
- ;;
-
-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
- sys_lib_dlsearch_path_spec="/usr/lib"
- 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"
- ;;
-
-rdos*)
- dynamic_linker=no
- ;;
-
-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.3*)
- 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
- ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
- version_type=freebsd-elf
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LD_LIBRARY_PATH
- hardcode_into_libs=yes
- if test "$with_gnu_ld" = yes; then
- sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
- shlibpath_overrides_runpath=no
- else
- sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
- shlibpath_overrides_runpath=yes
- case $host_os in
- sco3.2v5*)
- sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
- ;;
- esac
- fi
- sys_lib_dlsearch_path_spec='/usr/lib'
- ;;
-
-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 "${lt_cv_sys_lib_search_path_spec+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
-fi
-
-sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
-fi
-
-sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-
-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
-
-{ 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
-
-
-# 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 LTCFLAGS 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 \
- compiler_lib_search_dirs_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 \
- fix_srcfile_path_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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5
+$as_echo "$enable_shared" >&6; }
-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
-
-# LTCC compiler flags.
-LTCFLAGS=$lt_LTCFLAGS
-
-# 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"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5
+$as_echo_n "checking whether to build static libraries... " >&6; }
+ # Make sure either enable_shared or enable_static is yes.
+ test "$enable_shared" = yes || enable_static=yes
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5
+$as_echo "$enable_static" >&6; }
-# 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 directories searched by this compiler when creating a shared
-# library
-compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_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=$lt_fix_srcfile_path
-
-# 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'
@@ -16738,3179 +11551,154 @@ 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 {}"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }'
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-
-# If no C compiler was specified, use CC.
-LTCC=${LTCC-"$CC"}
-
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
-
-# Allow CC to be a program name with arguments.
-compiler=$CC
-
-
-# save warnings/boilerplate of simple test code
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$rm conftest*
-
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$rm -r 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
- echo "$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}\{0,1\} :&$lt_compiler_flag :; t' \
- -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
- -e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:16835: $lt_compile\"" >&5)
- (eval "$lt_compile" 2>conftest.err)
- ac_status=$?
- cat conftest.err >&5
- echo "$as_me:16839: \$? = $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 -e '/^$/d' >conftest.exp
- $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
- if test ! -s conftest.er2 || 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* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
- # PIC is the default for these OSes.
- ;;
- mingw* | cygwin* | 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).
- # Although the cygwin gcc ignores -fPIC, still need this for old-style
- # (--disable-auto-import) libraries
- ;;
- darwin* | rhapsody*)
- # PIC is the default on this platform
- # Common symbols not allowed in MH_DYLIB files
- lt_prog_compiler_pic_GCJ='-fno-common'
- ;;
- interix[3-9]*)
- # Interix 3.x gcc -fpic/-fPIC options generate broken code.
- # Instead, we relocate shared libraries at runtime.
- ;;
- 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* | cygwin* | 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).
- ;;
- 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* | k*bsd*-gnu)
- 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* | pgf95*)
- # 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='-Bstatic'
- ;;
- ccc*)
- lt_prog_compiler_wl_GCJ='-Wl,'
- # All Alpha code is PIC.
- lt_prog_compiler_static_GCJ='-non_shared'
- ;;
- *)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- # Sun C 5.9
- lt_prog_compiler_pic_GCJ='-KPIC'
- lt_prog_compiler_static_GCJ='-Bstatic'
- lt_prog_compiler_wl_GCJ='-Wl,'
- ;;
- *Sun\ F*)
- # Sun Fortran 8.3 passes all unrecognized flags to the linker
- lt_prog_compiler_pic_GCJ='-KPIC'
- lt_prog_compiler_static_GCJ='-Bstatic'
- lt_prog_compiler_wl_GCJ=''
- ;;
- esac
- ;;
- esac
- ;;
- osf3* | osf4* | osf5*)
- lt_prog_compiler_wl_GCJ='-Wl,'
- # All OSF/1 code is PIC.
- lt_prog_compiler_static_GCJ='-non_shared'
- ;;
+ ac_config_commands="$ac_config_commands libtool"
- rdos*)
- lt_prog_compiler_static_GCJ='-non_shared'
- ;;
- 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*)
- lt_prog_compiler_wl_GCJ='-Wl,'
- lt_prog_compiler_pic_GCJ='-KPIC'
- lt_prog_compiler_static_GCJ='-Bstatic'
- ;;
+# Only expand once:
- sysv4*MP*)
- if test -d /usr/nec ;then
- lt_prog_compiler_pic_GCJ='-Kconform_pic'
- lt_prog_compiler_static_GCJ='-Bstatic'
- fi
- ;;
- sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
- lt_prog_compiler_wl_GCJ='-Wl,'
- lt_prog_compiler_pic_GCJ='-KPIC'
- lt_prog_compiler_static_GCJ='-Bstatic'
- ;;
- 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_cv_prog_compiler_pic_works_GCJ+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- lt_cv_prog_compiler_pic_works_GCJ=no
- ac_outfile=conftest.$ac_objext
- echo "$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}\{0,1\} :&$lt_compiler_flag :; t' \
- -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
- -e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:17125: $lt_compile\"" >&5)
- (eval "$lt_compile" 2>conftest.err)
- ac_status=$?
- cat conftest.err >&5
- echo "$as_me:17129: \$? = $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 -e '/^$/d' >conftest.exp
- $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
- if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
- lt_cv_prog_compiler_pic_works_GCJ=yes
- fi
- fi
- $rm conftest*
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_pic_works_GCJ" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_pic_works_GCJ" >&6; }
-if test x"$lt_cv_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
+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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
+ $as_echo_n "(cached) " >&6
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=
- ;;
+ case $PKG_CONFIG in
+ [\\/]* | ?:[\\/]*)
+ ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path.
+ ;;
*)
- lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ"
- ;;
-esac
-
-#
-# Check to make sure the static flag actually works.
-#
-wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\"
-{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
-echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
-if test "${lt_cv_prog_compiler_static_works_GCJ+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- lt_cv_prog_compiler_static_works_GCJ=no
- save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
- echo "$lt_simple_link_test_code" > conftest.$ac_ext
- if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
- # The linker 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 -e '/^$/d' > conftest.exp
- $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
- if diff conftest.exp conftest.er2 >/dev/null; then
- lt_cv_prog_compiler_static_works_GCJ=yes
- fi
- else
- lt_cv_prog_compiler_static_works_GCJ=yes
- fi
- fi
- $rm -r conftest*
- LDFLAGS="$save_LDFLAGS"
-
-fi
-{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_static_works_GCJ" >&5
-echo "${ECHO_T}$lt_cv_prog_compiler_static_works_GCJ" >&6; }
-
-if test x"$lt_cv_prog_compiler_static_works_GCJ" = xyes; then
- :
-else
- lt_prog_compiler_static_GCJ=
-fi
-
-
-{ 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
- echo "$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}\{0,1\} :&$lt_compiler_flag :; t' \
- -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
- -e 's:$: $lt_compiler_flag:'`
- (eval echo "\"\$as_me:17229: $lt_compile\"" >&5)
- (eval "$lt_compile" 2>out/conftest.err)
- ac_status=$?
- cat out/conftest.err >&5
- echo "$as_me:17233: \$? = $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 -e '/^$/d' > out/conftest.exp
- $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
- if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
- lt_cv_prog_compiler_c_o_GCJ=yes
- fi
- fi
- chmod u+w . 2>&5
- $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
+ 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
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_|_GLOBAL__F[ID]_.*'
- # 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.
- # Exclude shared library initialization/finalization symbols.
- 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
- ;;
- interix*)
- # we just hope/assume this is gcc and not c89 (= MSVC++)
- with_gnu_ld=yes
- ;;
- 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
- aix[3-9]*)
- # On AIX/PPC, the GNU linker is very broken
- if test "$host_cpu" != ia64; then
- ld_shlibs_GCJ=no
- cat <<EOF 1>&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 <kc5tja@dolphin.openprojects.net> 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 <jrb3@best.com> 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/'\'' -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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
- else
- ld_shlibs_GCJ=no
- fi
- ;;
-
- interix[3-9]*)
- hardcode_direct_GCJ=no
- hardcode_shlibpath_var_GCJ=no
- hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
- export_dynamic_flag_spec_GCJ='${wl}-E'
- # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
- # Instead, shared libraries are loaded at an image base (0x10000000 by
- # default) and relocated if they conflict, which is a slow very memory
- # consuming and fragmenting process. To avoid this, we pick a random,
- # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
- # time. Moving up from 0x10000000 also allows more sbrk(2) space.
- archive_cmds_GCJ='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- archive_expsym_cmds_GCJ='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- ;;
-
- gnu* | linux* | k*bsd*-gnu)
- 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* | pgf95*) # 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
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*) # Sun C 5.9
- whole_archive_flag_spec_GCJ='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
- tmp_sharedflag='-G' ;;
- *Sun\ F*) # Sun Fortran 8.3
- tmp_sharedflag='-G' ;;
- *)
- tmp_sharedflag='-shared' ;;
- esac
- archive_cmds_GCJ='$CC '"$tmp_sharedflag""$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 '"$tmp_sharedflag""$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*)
- if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
- ld_shlibs_GCJ=no
- cat <<EOF 1>&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
- ;;
-
- sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
- case `$LD -v 2>&1` in
- *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
- ld_shlibs_GCJ=no
- cat <<_LT_EOF 1>&2
-
-*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
-*** reliably create shared libraries on SCO systems. Therefore, libtool
-*** is disabling shared libraries support. We urge you to upgrade GNU
-*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
-*** your PATH or compiler configuration so that the native linker is
-*** used, and then restart.
-
-_LT_EOF
- ;;
- *)
- if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
- hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
- archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
- archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
- else
- ld_shlibs_GCJ=no
- fi
- ;;
- esac
- ;;
-
- 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 "$lt_prog_compiler_static"; then
- # Neither direct hardcoding nor static linking is supported with a
- # broken collect2.
- hardcode_direct_GCJ=unsupported
- fi
- ;;
-
- aix[4-9]*)
- 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].*|aix[5-9]*)
- 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
- :
- 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 ()
-{
+ done
+IFS=$as_save_IFS
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
+ ;;
esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
-
-lt_aix_libpath_sed='
- /Import File Strings/,/^$/ {
- /^0/ {
- s/^0 *\(.*\)$/\1/
- p
- }
- }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# 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 "$lt_aix_libpath_sed"`
fi
+PKG_CONFIG=$ac_cv_path_PKG_CONFIG
+if test -n "$PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- 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 '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${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 '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_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 { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
-
-lt_aix_libpath_sed='
- /Import File Strings/,/^$/ {
- /^0/ {
- s/^0 *\(.*\)$/\1/
- p
- }
- }'
-aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
-# 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 "$lt_aix_libpath_sed"`
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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_ac_pt_PKG_CONFIG+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- 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'
- # Exported symbols can be pulled into shared objects from archives
- whole_archive_flag_spec_GCJ='$convenience'
- archive_cmds_need_lc_GCJ=yes
- # This is similar to how AIX traditionally builds its shared libraries.
- archive_expsym_cmds_GCJ="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${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 $_lt_dar_single_mod${_lt_dsymutil}"
- module_cmds_GCJ="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_GCJ="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
- module_expsym_cmds_GCJ="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
- 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` $xlcverstring'
- 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 lds
- 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 $xlcverstring~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* | 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*)
- if test "$GCC" = yes -a "$with_gnu_ld" = no; then
- archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
- else
- archive_cmds_GCJ='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
- fi
- if test "$with_gnu_ld" = no; then
- 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
- fi
- ;;
-
- hpux11*)
- if test "$GCC" = yes -a "$with_gnu_ld" = no; then
- case $host_cpu in
- hppa*64*)
- archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- ia64*)
- archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -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*)
- archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- ia64*)
- archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- *)
- archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- esac
- fi
- if test "$with_gnu_ld" = no; then
- hardcode_libdir_flag_spec_GCJ='${wl}+b ${wl}$libdir'
- hardcode_libdir_separator_GCJ=:
-
- case $host_cpu in
- hppa*64*|ia64*)
- hardcode_libdir_flag_spec_ld_GCJ='+b $libdir'
- hardcode_direct_GCJ=no
- hardcode_shlibpath_var_GCJ=no
- ;;
- *)
- 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*)
- if test -f /usr/libexec/ld.so; then
- 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
- else
- ld_shlibs_GCJ=no
- 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=:
- ;;
-
- 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 and reorder linker options,
- # but understands `-z linker_flag'. GCC discards it without `$wl',
- # but is careful enough not to reorder.
- # Supported since Solaris 2.6 (maybe 2.5.1?)
- if test "$GCC" = yes; then
- whole_archive_flag_spec_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
- else
- whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract'
- fi
- ;;
- 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*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
- no_undefined_flag_GCJ='${wl}-z,text'
- archive_cmds_need_lc_GCJ=no
- hardcode_shlibpath_var_GCJ=no
- runpath_var='LD_RUN_PATH'
-
- if test "$GCC" = yes; then
- archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- else
- archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- fi
- ;;
-
- sysv5* | sco3.2v5* | sco5v6*)
- # Note: We can NOT use -z defs as we might desire, because we do not
- # link with -lc, and that would cause any symbols used from libc to
- # always be unresolved, which means just about no library would
- # ever link correctly. If we're not using GNU ld we use -z text
- # though, which does catch some bad symbols but isn't as heavy-handed
- # as -z defs.
- no_undefined_flag_GCJ='${wl}-z,text'
- allow_undefined_flag_GCJ='${wl}-z,nodefs'
- archive_cmds_need_lc_GCJ=no
- hardcode_shlibpath_var_GCJ=no
- hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
- hardcode_libdir_separator_GCJ=':'
- link_all_deplibs_GCJ=yes
- export_dynamic_flag_spec_GCJ='${wl}-Bexport'
- runpath_var='LD_RUN_PATH'
-
- if test "$GCC" = yes; then
- archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- else
- archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
- fi
- ;;
-
- 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
-
-#
-# 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*
- echo "$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
- pic_flag=$lt_prog_compiler_pic_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"
-
-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'
- ;;
-
-aix[4-9]*)
- 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<name>.so
- # instead of lib<name>.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~
- chmod a+x \$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`'
-
- 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* | dragonfly*)
- # DragonFly does not have aout. When/if they implement a new
- # versioning mechanism, adjust this.
- if test -x /usr/bin/objformat; then
- objformat=`/usr/bin/objformat`
- else
- case $host_os in
- freebsd[123]*) objformat=aout ;;
- *) objformat=elf ;;
- esac
- fi
- 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
- ;;
- freebsd3.[2-9]* | freebsdelf3.[2-9]* | \
- freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1)
- shlibpath_overrides_runpath=no
- hardcode_into_libs=yes
- ;;
- *) # from 4.6 on, and DragonFly
- shlibpath_overrides_runpath=yes
- 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'
- ;;
-
-interix[3-9]*)
- version_type=linux
- need_lib_prefix=no
- need_version=no
- 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='Interix 3.x ld.so.1 (PE, like ELF)'
- shlibpath_var=LD_LIBRARY_PATH
- shlibpath_overrides_runpath=no
- hardcode_into_libs=yes
+ 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.
;;
-
-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* | k*bsd*-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'
- 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>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;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'
- ;;
-
-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
- sys_lib_dlsearch_path_spec="/usr/lib"
- 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"
- ;;
-
-rdos*)
- dynamic_linker=no
- ;;
-
-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.3*)
- 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
- ;;
-
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
- version_type=freebsd-elf
- need_lib_prefix=no
- need_version=no
- library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
- soname_spec='${libname}${release}${shared_ext}$major'
- shlibpath_var=LD_LIBRARY_PATH
- hardcode_into_libs=yes
- if test "$with_gnu_ld" = yes; then
- sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
- shlibpath_overrides_runpath=no
- else
- sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
- shlibpath_overrides_runpath=yes
- case $host_os in
- sco3.2v5*)
- sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
- ;;
- esac
+ 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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
fi
- sys_lib_dlsearch_path_spec='/usr/lib'
- ;;
-
-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
- ;;
+done
+ done
+IFS=$as_save_IFS
-*)
- 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 "${lt_cv_sys_lib_search_path_spec+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- lt_cv_sys_lib_search_path_spec="$sys_lib_search_path_spec"
fi
-
-sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
-if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
+if test -n "$ac_pt_PKG_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5
+$as_echo "$ac_pt_PKG_CONFIG" >&6; }
else
- lt_cv_sys_lib_dlsearch_path_spec="$sys_lib_dlsearch_path_spec"
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
-sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
-
-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
-
-{ 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
+ if test "x$ac_pt_PKG_CONFIG" = x; then
+ PKG_CONFIG=""
else
- # We can link without hardcoding, and we can hardcode nonexisting dirs.
- hardcode_action_GCJ=immediate
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
+$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+ac_tool_warned=yes ;;
+esac
+ PKG_CONFIG=$ac_pt_PKG_CONFIG
fi
else
- # We cannot hardcode anything, or else we can only hardcode existing
- # directories.
- hardcode_action_GCJ=unsupported
+ PKG_CONFIG="$ac_cv_path_PKG_CONFIG"
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
-
-
-# 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 LTCFLAGS 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 \
- compiler_lib_search_dirs_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 \
- fix_srcfile_path_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
-
-# LTCC compiler flags.
-LTCFLAGS=$lt_LTCFLAGS
-
-# 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 directories searched by this compiler when creating a shared
-# library
-compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_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=$lt_fix_srcfile_path
-
-# 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"
-
+if test -n "$PKG_CONFIG"; then
+ _pkg_min_version=0.9.0
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5
+$as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; }
+ if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
else
- tagname=""
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ PKG_CONFIG=""
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 }'
-
-# 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"}
-
-# If no C compiler flags were specified, use CFLAGS.
-LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
-
-# Allow CC to be a program name with arguments.
-compiler=$CC
-
-
-# save warnings/boilerplate of simple test code
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_compile_test_code" >conftest.$ac_ext
-eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_compiler_boilerplate=`cat conftest.err`
-$rm conftest*
-
-ac_outfile=conftest.$ac_objext
-echo "$lt_simple_link_test_code" >conftest.$ac_ext
-eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
-_lt_linker_boilerplate=`cat conftest.err`
-$rm -r 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 LTCFLAGS 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 \
- compiler_lib_search_dirs_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 \
- fix_srcfile_path_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
-
-# LTCC compiler flags.
-LTCFLAGS=$lt_LTCFLAGS
-
-# 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 directories searched by this compiler when creating a shared
-# library
-compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_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=$lt_fix_srcfile_path
-
-# 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
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
# Extract the first word of "mv", so it can be a program name with args.
set dummy mv; 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_MV+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_MV+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
case $MV in
[\\/]* | ?:[\\/]*)
@@ -19922,14 +11710,14 @@ 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_MV="$as_dir/$ac_word$ac_exec_ext"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
;;
@@ -19937,20 +11725,20 @@ esac
fi
MV=$ac_cv_path_MV
if test -n "$MV"; then
- { echo "$as_me:$LINENO: result: $MV" >&5
-echo "${ECHO_T}$MV" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MV" >&5
+$as_echo "$MV" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
# Extract the first word of "rm", so it can be a program name with args.
set dummy rm; 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_RM+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_RM+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
case $RM in
[\\/]* | ?:[\\/]*)
@@ -19962,14 +11750,14 @@ 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_RM="$as_dir/$ac_word$ac_exec_ext"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
;;
@@ -19977,20 +11765,20 @@ esac
fi
RM=$ac_cv_path_RM
if test -n "$RM"; then
- { echo "$as_me:$LINENO: result: $RM" >&5
-echo "${ECHO_T}$RM" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RM" >&5
+$as_echo "$RM" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
# Extract the first word of "sed", so it can be a program name with args.
set dummy sed; 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_SED+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_SED+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
case $SED in
[\\/]* | ?:[\\/]*)
@@ -20002,14 +11790,14 @@ 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_SED="$as_dir/$ac_word$ac_exec_ext"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
;;
@@ -20017,21 +11805,21 @@ esac
fi
SED=$ac_cv_path_SED
if test -n "$SED"; then
- { echo "$as_me:$LINENO: result: $SED" >&5
-echo "${ECHO_T}$SED" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $SED" >&5
+$as_echo "$SED" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
# Extract the first word of "ldconfig", so it can be a program name with args.
set dummy ldconfig; 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_LDCONFIG+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_LDCONFIG+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
case $LDCONFIG in
[\\/]* | ?:[\\/]*)
@@ -20043,14 +11831,14 @@ for as_dir in /sbin /usr/sbin $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_path_LDCONFIG="$as_dir/$ac_word$ac_exec_ext"
- echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
test -z "$ac_cv_path_LDCONFIG" && ac_cv_path_LDCONFIG="true"
@@ -20059,105 +11847,97 @@ esac
fi
LDCONFIG=$ac_cv_path_LDCONFIG
if test -n "$LDCONFIG"; then
- { echo "$as_me:$LINENO: result: $LDCONFIG" >&5
-echo "${ECHO_T}$LDCONFIG" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LDCONFIG" >&5
+$as_echo "$LDCONFIG" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
# Environment
-{ echo "$as_me:$LINENO: checking Windows OS" >&5
-echo $ECHO_N "checking Windows OS... $ECHO_C" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking Windows OS" >&5
+$as_echo_n "checking Windows OS... " >&6; }
case "${target}" in
*-mingw32*|*-winnt*|*-cygwin*)
- { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
WINDOWS="yes"
-cat >>confdefs.h <<\_ACEOF
-#define WINDOWS 1
-_ACEOF
+$as_echo "#define WINDOWS 1" >>confdefs.h
;;
*)
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
WINDOWS="no"
;;
esac
-{ echo "$as_me:$LINENO: checking fuse compatibility" >&5
-echo $ECHO_N "checking fuse compatibility... $ECHO_C" >&6; }
-case "${target_os}" in
-linux*)
+if test "x${enable_ntfs_3g}" = "xyes"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking fuse compatibility" >&5
+$as_echo_n "checking fuse compatibility... " >&6; }
+ case "${target_os}" in
+ linux*|solaris*)
# Check whether --with-fuse was given.
-if test "${with_fuse+set}" = set; then
+if test "${with_fuse+set}" = set; then :
withval=$with_fuse;
else
with_fuse="internal"
fi
- ;;
-darwin*|netbsd*|solaris*)
- with_fuse="external"
- ;;
-freebsd*)
- { { echo "$as_me:$LINENO: error: Please see FreeBSD support at http://www.freshports.org/sysutils/fusefs-ntfs" >&5
-echo "$as_me: error: Please see FreeBSD support at http://www.freshports.org/sysutils/fusefs-ntfs" >&2;}
- { (exit 1); exit 1; }; }
- ;;
-*)
- { { echo "$as_me:$LINENO: error: ntfs-3g can be built for Linux, FreeBSD, Mac OS X, NetBSD, and Solaris only." >&5
-echo "$as_me: error: ntfs-3g can be built for Linux, FreeBSD, Mac OS X, NetBSD, and Solaris only." >&2;}
- { (exit 1); exit 1; }; }
- ;;
-esac
-{ echo "$as_me:$LINENO: result: ${with_fuse}" >&5
-echo "${ECHO_T}${with_fuse}" >&6; }
+ ;;
+ darwin*|netbsd*|kfreebsd*-gnu)
+ with_fuse="external"
+ ;;
+ freebsd*)
+ as_fn_error $? "Please see FreeBSD support at http://www.freshports.org/sysutils/fusefs-ntfs" "$LINENO" 5
+ ;;
+ *)
+ as_fn_error $? "ntfs-3g can be built for Linux, FreeBSD, Mac OS X, NetBSD, and Solaris only." "$LINENO" 5
+ ;;
+ esac
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_fuse}" >&5
+$as_echo "${with_fuse}" >&6; }
+else
+ with_fuse="none"
+fi
case "${target_os}" in
solaris*)
if test "x$GCC" != "xyes" ; then
- { { echo "$as_me:$LINENO: error: ntfs-3g can be built only with gcc on Solaris. Install it by 'pkg install gcc-dev' and retry.)" >&5
-echo "$as_me: error: ntfs-3g can be built only with gcc on Solaris. Install it by 'pkg install gcc-dev' and retry.)" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "ntfs-3g can be built only with gcc on Solaris. Install it by 'pkg install gcc-dev' and retry.)" "$LINENO" 5
fi
;;
esac
if test "${enable_ldscript}" = "yes"; then
- { echo "$as_me:$LINENO: checking Output format" >&5
-echo $ECHO_N "checking Output format... $ECHO_C" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Output format" >&5
+$as_echo_n "checking Output format... " >&6; }
OUTPUT_FORMAT="$(${CC} ${CFLAGS} ${LDFLAGS} -Wl,--verbose 2>&1 | ${SED} -n 's/^OUTPUT_FORMAT("\([^"]*\)",.*/\1/p')"
if test -z "${OUTPUT_FORMAT}"; then
- { echo "$as_me:$LINENO: result: None" >&5
-echo "${ECHO_T}None" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: None" >&5
+$as_echo "None" >&6; }
else
- { echo "$as_me:$LINENO: result: ${OUTPUT_FORMAT}" >&5
-echo "${ECHO_T}${OUTPUT_FORMAT}" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${OUTPUT_FORMAT}" >&5
+$as_echo "${OUTPUT_FORMAT}" >&6; }
OUTPUT_FORMAT="OUTPUT_FORMAT ( ${OUTPUT_FORMAT} )"
fi
fi
# Libraries
if test "${with_fuse}" = "internal"; then
- { echo "$as_me:$LINENO: checking for pthread_create in -lpthread" >&5
-echo $ECHO_N "checking for pthread_create in -lpthread... $ECHO_C" >&6; }
-if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5
+$as_echo_n "checking for pthread_create in -lpthread... " >&6; }
+if test "${ac_cv_lib_pthread_pthread_create+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lpthread $LIBS"
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -20175,66 +11955,78 @@ return pthread_create ();
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; then :
ac_cv_lib_pthread_pthread_create=yes
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_lib_pthread_pthread_create=no
+ ac_cv_lib_pthread_pthread_create=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core 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_pthread_pthread_create" >&5
-echo "${ECHO_T}$ac_cv_lib_pthread_pthread_create" >&6; }
-if test $ac_cv_lib_pthread_pthread_create = yes; then
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5
+$as_echo "$ac_cv_lib_pthread_pthread_create" >&6; }
+if test "x$ac_cv_lib_pthread_pthread_create" = x""yes; then :
LIBFUSE_LITE_LIBS="${LIBFUSE_LITE_LIBS} -lpthread"
else
- { { echo "$as_me:$LINENO: error: Cannot find pthread library" >&5
-echo "$as_me: error: Cannot find pthread library" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "Cannot find pthread library" "$LINENO" 5
fi
-cat >>confdefs.h <<\_ACEOF
-#define _REENTRANT 1
-_ACEOF
+$as_echo "#define _REENTRANT 1" >>confdefs.h
# required so that we re-compile anything
-cat >>confdefs.h <<\_ACEOF
-#define FUSE_INTERNAL 1
+$as_echo "#define FUSE_INTERNAL 1" >>confdefs.h
+
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking Solaris OS" >&5
+$as_echo_n "checking Solaris OS... " >&6; }
+ 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 confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+ #if !((defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__)))
+ #error "Not a Solaris system."
+ #endif
+
+
_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ LIBFUSE_LITE_CFLAGS="${LIBFUSE_LITE_CFLAGS} -std=c99 -D__SOLARIS__ -D_XOPEN_SOURCE=600 -D__EXTENSIONS__"
+ LIBFUSE_LITE_LIBS="${LIBFUSE_LITE_LIBS} -lxnet"
else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+
+fi
+rm -f core 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
+
+elif test "${with_fuse}" = "external"; then
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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_PKG_CONFIG+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
case $PKG_CONFIG in
[\\/]* | ?:[\\/]*)
@@ -20246,14 +12038,14 @@ 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
test -z "$ac_cv_path_PKG_CONFIG" && ac_cv_path_PKG_CONFIG="no"
@@ -20262,78 +12054,125 @@ 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; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5
+$as_echo "$PKG_CONFIG" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
fi
- test "x${PKG_CONFIG}" = "xno" && { { echo "$as_me:$LINENO: error: pkg-config wasn't found! Please install from your vendor, or see http://pkg-config.freedesktop.org/wiki/" >&5
-echo "$as_me: error: pkg-config wasn't found! Please install from your vendor, or see http://pkg-config.freedesktop.org/wiki/" >&2;}
- { (exit 1); exit 1; }; }
+ test "x${PKG_CONFIG}" = "xno" && as_fn_error $? "pkg-config wasn't found! Please install from your vendor, or see http://pkg-config.freedesktop.org/wiki/" "$LINENO" 5
# Libraries often install their metadata .pc files in directories
# not searched by pkg-config. Let's workaround this.
export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/lib/pkgconfig:/usr/lib/pkgconfig:/opt/gnome/lib/pkgconfig:/usr/share/pkgconfig:/usr/local/lib/pkgconfig:$prefix/lib/pkgconfig:/opt/gnome/share/pkgconfig:/usr/local/share/pkgconfig
+pkg_failed=no
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for FUSE_MODULE" >&5
+$as_echo_n "checking for FUSE_MODULE... " >&6; }
-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
- echo $ECHO_N "(cached) $ECHO_C" >&6
+if test -n "$FUSE_MODULE_CFLAGS"; then
+ pkg_cv_FUSE_MODULE_CFLAGS="$FUSE_MODULE_CFLAGS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fuse >= 2.6.0\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "fuse >= 2.6.0") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_FUSE_MODULE_CFLAGS=`$PKG_CONFIG --cflags "fuse >= 2.6.0" 2>/dev/null`
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 { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
-IFS=$as_save_IFS
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
+if test -n "$FUSE_MODULE_LIBS"; then
+ pkg_cv_FUSE_MODULE_LIBS="$FUSE_MODULE_LIBS"
+ elif test -n "$PKG_CONFIG"; then
+ if test -n "$PKG_CONFIG" && \
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fuse >= 2.6.0\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "fuse >= 2.6.0") 2>&5
+ ac_status=$?
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_FUSE_MODULE_LIBS=`$PKG_CONFIG --libs "fuse >= 2.6.0" 2>/dev/null`
+else
+ pkg_failed=yes
+fi
+ else
+ pkg_failed=untried
+fi
- ;;
-esac
+
+
+if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
+ _pkg_short_errors_supported=yes
+else
+ _pkg_short_errors_supported=no
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 $_pkg_short_errors_supported = yes; then
+ FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "fuse >= 2.6.0" 2>&1`
+ else
+ FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --print-errors "fuse >= 2.6.0" 2>&1`
+ fi
+ # Put the nasty error message in config.log where it belongs
+ echo "$FUSE_MODULE_PKG_ERRORS" >&5
+
+
+ as_fn_error $? "FUSE >= 2.6.0 was not found. Either older FUSE is still present, or FUSE is not fully installed (e.g. fuse, libfuse, libfuse2, libfuse-dev, etc packages). Source code: http://fuse.sf.net" "$LINENO" 5
+
+
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+ as_fn_error $? "FUSE >= 2.6.0 was not found. Either older FUSE is still present, or FUSE is not fully installed (e.g. fuse, libfuse, libfuse2, libfuse-dev, etc packages). Source code: http://fuse.sf.net" "$LINENO" 5
+
+
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ FUSE_MODULE_CFLAGS=$pkg_cv_FUSE_MODULE_CFLAGS
+ FUSE_MODULE_LIBS=$pkg_cv_FUSE_MODULE_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+fi
+ FUSE_LIB_PATH=`$PKG_CONFIG --libs-only-L fuse | sed -e 's,//*,/,g' -e 's, *$,,'`
fi
+# Autodetect whether we can build crypto stuff or not.
+compile_crypto=false
+if test "$enable_crypto" != "no"; then
+ have_libgcrypt=false
+# Check whether --with-libgcrypt-prefix was given.
+if test "${with_libgcrypt_prefix+set}" = set; then :
+ withval=$with_libgcrypt_prefix; libgcrypt_config_prefix="$withval"
+else
+ libgcrypt_config_prefix=""
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
+
+ if test x$libgcrypt_config_prefix != x ; then
+ if test x${LIBGCRYPT_CONFIG+set} != xset ; then
+ LIBGCRYPT_CONFIG=$libgcrypt_config_prefix/bin/libgcrypt-config
+ fi
+ fi
+
+ # Extract the first word of "libgcrypt-config", so it can be a program name with args.
+set dummy libgcrypt-config; ac_word=$2
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
+$as_echo_n "checking for $ac_word... " >&6; }
+if test "${ac_cv_path_LIBGCRYPT_CONFIG+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
- case $ac_pt_PKG_CONFIG in
+ case $LIBGCRYPT_CONFIG in
[\\/]* | ?:[\\/]*)
- ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path.
+ ac_cv_path_LIBGCRYPT_CONFIG="$LIBGCRYPT_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
@@ -20341,93 +12180,149 @@ 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
+ for ac_exec_ext in '' $ac_executable_extensions; do
if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$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
+ ac_cv_path_LIBGCRYPT_CONFIG="$as_dir/$ac_word$ac_exec_ext"
+ $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
-done
+ done
IFS=$as_save_IFS
+ test -z "$ac_cv_path_LIBGCRYPT_CONFIG" && ac_cv_path_LIBGCRYPT_CONFIG="no"
;;
esac
fi
-ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG
-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; }
+LIBGCRYPT_CONFIG=$ac_cv_path_LIBGCRYPT_CONFIG
+if test -n "$LIBGCRYPT_CONFIG"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBGCRYPT_CONFIG" >&5
+$as_echo "$LIBGCRYPT_CONFIG" >&6; }
else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
fi
- if test "x$ac_pt_PKG_CONFIG" = x; then
- PKG_CONFIG=""
+
+ tmp=1.2.2
+ if echo "$tmp" | grep ':' >/dev/null 2>/dev/null ; then
+ req_libgcrypt_api=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\1/'`
+ min_libgcrypt_version=`echo "$tmp" | sed 's/\(.*\):\(.*\)/\2/'`
else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet. If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
- PKG_CONFIG=$ac_pt_PKG_CONFIG
+ req_libgcrypt_api=0
+ min_libgcrypt_version="$tmp"
fi
-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; }
- else
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
- PKG_CONFIG=""
- fi
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBGCRYPT - version >= $min_libgcrypt_version" >&5
+$as_echo_n "checking for LIBGCRYPT - version >= $min_libgcrypt_version... " >&6; }
+ ok=no
+ if test "$LIBGCRYPT_CONFIG" != "no" ; then
+ req_major=`echo $min_libgcrypt_version | \
+ sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\1/'`
+ req_minor=`echo $min_libgcrypt_version | \
+ sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\2/'`
+ req_micro=`echo $min_libgcrypt_version | \
+ sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)/\3/'`
+ libgcrypt_config_version=`$LIBGCRYPT_CONFIG --version`
+ major=`echo $libgcrypt_config_version | \
+ sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1/'`
+ minor=`echo $libgcrypt_config_version | \
+ sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\2/'`
+ micro=`echo $libgcrypt_config_version | \
+ sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\3/'`
+ if test "$major" -gt "$req_major"; then
+ ok=yes
+ else
+ if test "$major" -eq "$req_major"; then
+ if test "$minor" -gt "$req_minor"; then
+ ok=yes
+ else
+ if test "$minor" -eq "$req_minor"; then
+ if test "$micro" -ge "$req_micro"; then
+ ok=yes
+ fi
+ fi
+ fi
+ fi
+ fi
+ fi
+ if test $ok = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes ($libgcrypt_config_version)" >&5
+$as_echo "yes ($libgcrypt_config_version)" >&6; }
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ fi
+ if test $ok = yes; then
+ # If we have a recent libgcrypt, we should also check that the
+ # API is compatible
+ if test "$req_libgcrypt_api" -gt 0 ; then
+ tmp=`$LIBGCRYPT_CONFIG --api-version 2>/dev/null || echo 0`
+ if test "$tmp" -gt 0 ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking LIBGCRYPT API version" >&5
+$as_echo_n "checking LIBGCRYPT API version... " >&6; }
+ if test "$req_libgcrypt_api" -eq "$tmp" ; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: okay" >&5
+$as_echo "okay" >&6; }
+ else
+ ok=no
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: does not match. want=$req_libgcrypt_api got=$tmp" >&5
+$as_echo "does not match. want=$req_libgcrypt_api got=$tmp" >&6; }
+ fi
+ fi
+ fi
+ fi
+ if test $ok = yes; then
+ LIBGCRYPT_CFLAGS=`$LIBGCRYPT_CONFIG --cflags`
+ LIBGCRYPT_LIBS=`$LIBGCRYPT_CONFIG --libs`
+ have_libgcrypt=true
+ else
+ LIBGCRYPT_CFLAGS=""
+ LIBGCRYPT_LIBS=""
-fi
+ if test "$enable_crypto" = "yes"; then
+ as_fn_error $? "ntfsprogs crypto code requires the gcrypt library." "$LINENO" 5
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ntfsprogs crypto code requires the gcrypt library." >&5
+$as_echo "$as_me: WARNING: ntfsprogs crypto code requires the gcrypt library." >&2;}
+ fi
+
+ fi
+
+
+
+ have_libgnutls=false
pkg_failed=no
-{ echo "$as_me:$LINENO: checking for FUSE_MODULE" >&5
-echo $ECHO_N "checking for FUSE_MODULE... $ECHO_C" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNUTLS" >&5
+$as_echo_n "checking for GNUTLS... " >&6; }
-if test -n "$FUSE_MODULE_CFLAGS"; then
- pkg_cv_FUSE_MODULE_CFLAGS="$FUSE_MODULE_CFLAGS"
+if test -n "$GNUTLS_CFLAGS"; then
+ pkg_cv_GNUTLS_CFLAGS="$GNUTLS_CFLAGS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"fuse >= 2.6.0\"") >&5
- ($PKG_CONFIG --exists --print-errors "fuse >= 2.6.0") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gnutls >= 1.4.4\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "gnutls >= 1.4.4") 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.6.0" 2>/dev/null`
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_GNUTLS_CFLAGS=`$PKG_CONFIG --cflags "gnutls >= 1.4.4" 2>/dev/null`
else
pkg_failed=yes
fi
else
pkg_failed=untried
fi
-if test -n "$FUSE_MODULE_LIBS"; then
- pkg_cv_FUSE_MODULE_LIBS="$FUSE_MODULE_LIBS"
+if test -n "$GNUTLS_LIBS"; then
+ pkg_cv_GNUTLS_LIBS="$GNUTLS_LIBS"
elif test -n "$PKG_CONFIG"; then
if test -n "$PKG_CONFIG" && \
- { (echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"fuse >= 2.6.0\"") >&5
- ($PKG_CONFIG --exists --print-errors "fuse >= 2.6.0") 2>&5
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"gnutls >= 1.4.4\""; } >&5
+ ($PKG_CONFIG --exists --print-errors "gnutls >= 1.4.4") 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.6.0" 2>/dev/null`
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
+ test $ac_status = 0; }; then
+ pkg_cv_GNUTLS_LIBS=`$PKG_CONFIG --libs "gnutls >= 1.4.4" 2>/dev/null`
else
pkg_failed=yes
fi
@@ -20438,6 +12333,8 @@ fi
if test $pkg_failed = yes; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
_pkg_short_errors_supported=yes
@@ -20445,49 +12342,263 @@ else
_pkg_short_errors_supported=no
fi
if test $_pkg_short_errors_supported = yes; then
- FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "fuse >= 2.6.0" 2>&1`
+ GNUTLS_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "gnutls >= 1.4.4" 2>&1`
else
- FUSE_MODULE_PKG_ERRORS=`$PKG_CONFIG --print-errors "fuse >= 2.6.0" 2>&1`
+ GNUTLS_PKG_ERRORS=`$PKG_CONFIG --print-errors "gnutls >= 1.4.4" 2>&1`
fi
# Put the nasty error message in config.log where it belongs
- echo "$FUSE_MODULE_PKG_ERRORS" >&5
+ echo "$GNUTLS_PKG_ERRORS" >&5
- { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
+ if test "$enable_crypto" = "yes"; then
+ as_fn_error $? "ntfsprogs crypto code requires the gnutls library." "$LINENO" 5
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ntfsprogs crypto code requires the gnutls library." >&5
+$as_echo "$as_me: WARNING: ntfsprogs crypto code requires the gnutls library." >&2;}
+ fi
- { { echo "$as_me:$LINENO: error: FUSE >= 2.6.0 was not found. Either older FUSE is still present, or FUSE is not fully installed (e.g. fuse, libfuse, libfuse2, libfuse-dev, etc packages). Source code: http://fuse.sf.net" >&5
-echo "$as_me: error: FUSE >= 2.6.0 was not found. Either older FUSE is still present, or FUSE is not fully installed (e.g. fuse, libfuse, libfuse2, libfuse-dev, etc packages). Source code: http://fuse.sf.net" >&2;}
- { (exit 1); exit 1; }; }
+elif test $pkg_failed = untried; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+ if test "$enable_crypto" = "yes"; then
+ as_fn_error $? "ntfsprogs crypto code requires the gnutls library." "$LINENO" 5
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ntfsprogs crypto code requires the gnutls library." >&5
+$as_echo "$as_me: WARNING: ntfsprogs crypto code requires the gnutls library." >&2;}
+ fi
+else
+ GNUTLS_CFLAGS=$pkg_cv_GNUTLS_CFLAGS
+ GNUTLS_LIBS=$pkg_cv_GNUTLS_LIBS
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+ have_libgnutls=true
+fi
+ if test "$have_libgcrypt" = "true"; then
+ if test "$have_libgnutls" = "true"; then
+ compile_crypto=true
-elif test $pkg_failed = untried; then
+$as_echo "#define ENABLE_CRYPTO 1" >>confdefs.h
+
+ fi
+ fi
+fi
+ if $compile_crypto; then
+ ENABLE_CRYPTO_TRUE=
+ ENABLE_CRYPTO_FALSE='#'
+else
+ ENABLE_CRYPTO_TRUE='#'
+ ENABLE_CRYPTO_FALSE=
+fi
- { { echo "$as_me:$LINENO: error: FUSE >= 2.6.0 was not found. Either older FUSE is still present, or FUSE is not fully installed (e.g. fuse, libfuse, libfuse2, libfuse-dev, etc packages). Source code: http://fuse.sf.net" >&5
-echo "$as_me: error: FUSE >= 2.6.0 was not found. Either older FUSE is still present, or FUSE is not fully installed (e.g. fuse, libfuse, libfuse2, libfuse-dev, etc packages). Source code: http://fuse.sf.net" >&2;}
- { (exit 1); exit 1; }; }
+# add --with-extra-includes and --with-extra-libs switch to ./configure
+all_libraries="$all_libraries $USER_LDFLAGS"
+all_includes="$all_includes $USER_INCLUDES"
+
+
+# Specify support for generating DCE compliant UUIDs (aka GUIDs). We check if
+# uuid/uuid.h header is present and the uuid library is present that goes with
+# it and then check if uuid_generate() is present and usable.
+#
+# DCE UUIDs are enabled by default and can be disabled with the --disable-uuid
+# option to the configure script.
+
+# Check whether --with-uuid was given.
+if test "${with_uuid+set}" = set; then :
+ withval=$with_uuid; if test "$with_uuid" = "yes"; then
+ extrapath=default
+ elif test "$with_uuid" = "no"; then
+ extrapath=
+ else
+ extrapath=$with_uuid
+ fi
else
- FUSE_MODULE_CFLAGS=$pkg_cv_FUSE_MODULE_CFLAGS
- FUSE_MODULE_LIBS=$pkg_cv_FUSE_MODULE_LIBS
- { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
- :
+ extrapath=default
+
fi
- FUSE_LIB_PATH=`$PKG_CONFIG --libs-only-L fuse | sed -e 's,//*,/,g' -e 's, *$,,'`
+
+if test "x$extrapath" != "x"; then
+ if test "x$extrapath" != "xdefault"; then
+ MKNTFS_CPPFLAGS="$MKNTFS_CPPFLAGS -I$extrapath/include"
+ MKNTFS_LIBS="$MKNTFS_LIBS -L$extrapath/lib"
+ fi
+
+ search_for_luuid="yes"
+ ac_fn_c_check_header_mongrel "$LINENO" "uuid/uuid.h" "ac_cv_header_uuid_uuid_h" "$ac_includes_default"
+if test "x$ac_cv_header_uuid_uuid_h" = x""yes; then :
+
+else
+
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ntfsprogs DCE compliant UUID generation code requires the uuid library." >&5
+$as_echo "$as_me: WARNING: ntfsprogs DCE compliant UUID generation code requires the uuid library." >&2;}
+ search_for_luuid="no"
+
fi
-# 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
+
+
+ if test "x$search_for_luuid" != "xno"; then
+ # Look for uuid_generate in the standard C library.
+ ac_fn_c_check_func "$LINENO" "uuid_generate" "ac_cv_func_uuid_generate"
+if test "x$ac_cv_func_uuid_generate" = x""yes; then :
+
+
+$as_echo "#define ENABLE_UUID 1" >>confdefs.h
+
+ search_for_luuid="no"
+
+fi
+
+ fi
+
+ if test "x$search_for_luuid" != "xno"; then
+ # Look for uuid_generate in the 'uuid' library.
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uuid_generate in -luuid" >&5
+$as_echo_n "checking for uuid_generate in -luuid... " >&6; }
+if test "${ac_cv_lib_uuid_uuid_generate+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-luuid $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char uuid_generate ();
+int
+main ()
+{
+return uuid_generate ();
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_uuid_uuid_generate=yes
else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
+ ac_cv_lib_uuid_uuid_generate=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_uuid_uuid_generate" >&5
+$as_echo "$ac_cv_lib_uuid_uuid_generate" >&6; }
+if test "x$ac_cv_lib_uuid_uuid_generate" = x""yes; then :
+
+
+$as_echo "#define ENABLE_UUID 1" >>confdefs.h
+
+ MKNTFS_LIBS="$MKNTFS_LIBS -luuid"
+ search_for_luuid="no"
+
+fi
+
+ fi
+
+ if test "x$search_for_luuid" != "xno"; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ntfsprogs DCE compliant UUID generation code requires the uuid library." >&5
+$as_echo "$as_me: WARNING: ntfsprogs DCE compliant UUID generation code requires the uuid library." >&2;}
+ fi
+fi
+
+# Specify support for obtaining the correct BIOS legacy geometry needed for
+# Windows to boot in CHS mode. We check if hd.h header is present and the hd
+# library is present that goes with it and then check if the hd_list() function
+# is present and usable.
+#
+# Using the hd library is enabled by default and can be disabled with the
+# --disable-hd option to the configure script.
+
+# Check whether --with-hd was given.
+if test "${with_hd+set}" = set; then :
+ withval=$with_hd; if test "$with_hd" = "yes"; then
+ extrapath2=default
+ elif test "$with_hd" = "no"; then
+ extrapath2=
+ else
+ extrapath2=$with_hd
+ fi
+else
+ extrapath2=default
+
+fi
+
+if test "x$extrapath2" != "x"; then
+ if test "x$extrapath2" != "xdefault"; then
+ LIBNTFS_CPPFLAGS="$LIBNTFS_CPPFLAGS -I$extrapath2/include"
+ LIBNTFS_LIBS="$LIBNTFS_LIBS -L$extrapath2/lib"
+ fi
+ ac_fn_c_check_header_mongrel "$LINENO" "hd.h" "ac_cv_header_hd_h" "$ac_includes_default"
+if test "x$ac_cv_header_hd_h" = x""yes; then :
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hd_list in -lhd" >&5
+$as_echo_n "checking for hd_list in -lhd... " >&6; }
+if test "${ac_cv_lib_hd_hd_list+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_check_lib_save_LIBS=$LIBS
+LIBS="-lhd $LIBS"
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char hd_list ();
+int
+main ()
+{
+return hd_list ();
+ ;
+ return 0;
+}
_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ ac_cv_lib_hd_hd_list=yes
+else
+ ac_cv_lib_hd_hd_list=no
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+LIBS=$ac_check_lib_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_hd_hd_list" >&5
+$as_echo "$ac_cv_lib_hd_hd_list" >&6; }
+if test "x$ac_cv_lib_hd_hd_list" = x""yes; then :
+
+$as_echo "#define ENABLE_HD 1" >>confdefs.h
+
+ LIBNTFS_LIBS="$LIBNTFS_LIBS -lhd"
+ NTFSPROGS_STATIC_LIBS="$NTFSPROGS_STATIC_LIBS -lhd"
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ntfsprogs Windows compliant geometry code requires the hd library." >&5
+$as_echo "$as_me: WARNING: ntfsprogs Windows compliant geometry code requires the hd library." >&2;}
+fi
+
+else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: ntfsprogs Windows compliant geometry code requires the hd library." >&5
+$as_echo "$as_me: WARNING: ntfsprogs Windows compliant geometry code requires the hd library." >&2;}
+fi
+
+
+fi
+
+# Checks for header files.
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
+$as_echo_n "checking for ANSI C header files... " >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
#include <stdarg.h>
@@ -20502,47 +12613,23 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; 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
+ ac_cv_header_stdc=no
fi
-
rm -f core 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
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <string.h>
_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
ac_cv_header_stdc=no
fi
@@ -20552,18 +12639,14 @@ 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
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdlib.h>
_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
ac_cv_header_stdc=no
fi
@@ -20573,14 +12656,10 @@ 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 <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <ctype.h>
#include <stdlib.h>
@@ -20607,235 +12686,38 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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
+if ac_fn_c_try_run "$LINENO"; then :
-( exit $ac_status )
-ac_cv_header_stdc=no
+else
+ ac_cv_header_stdc=no
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-
fi
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
+$as_echo "$ac_cv_header_stdc" >&6; }
if test $ac_cv_header_stdc = yes; then
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
+$as_echo "#define STDC_HEADERS 1" >>confdefs.h
fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
for ac_header in 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/mkdev.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 windows.h syslog.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&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 { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; 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 core 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 { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.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 ntfs-3g-devel@lists.sf.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 { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ regex.h endian.h byteswap.h sys/byteorder.h sys/disk.h sys/endian.h \
+ sys/param.h sys/ioctl.h sys/mkdev.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 windows.h syslog.h pwd.h malloc.h
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
@@ -20844,16 +12726,12 @@ 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for stdbool.h that conforms to C99" >&5
+$as_echo_n "checking for stdbool.h that conforms to C99... " >&6; }
+if test "${ac_cv_header_stdbool_h+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <stdbool.h>
@@ -20888,6 +12766,8 @@ cat >>conftest.$ac_ext <<_ACEOF
char h[sizeof (_Bool)];
char i[sizeof s.t];
enum { j = false, k = true, l = false * true, m = true * 256 };
+ /* The following fails for
+ HP aC++/ANSI C B3910B A.05.55 [Dec 04 2003]. */
_Bool n[m];
char o[sizeof n == m * sizeof n[0] ? 1 : -1];
char p[-1 - (_Bool) 0 < 0 && -1 - (bool) 0 < 0 ? 1 : -1];
@@ -20931,89 +12811,17 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; 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
+ ac_cv_header_stdbool_h=no
fi
-
rm -f core 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
-typedef _Bool ac__type_new_;
-int
-main ()
-{
-if ((ac__type_new_ *) 0)
- return 0;
-if (sizeof (ac__type_new_))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; 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 core 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdbool_h" >&5
+$as_echo "$ac_cv_header_stdbool_h" >&6; }
+ac_fn_c_check_type "$LINENO" "_Bool" "ac_cv_type__Bool" "$ac_includes_default"
+if test "x$ac_cv_type__Bool" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE__BOOL 1
@@ -21024,267 +12832,327 @@ fi
if test $ac_cv_header_stdbool_h = yes; then
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_STDBOOL_H 1
-_ACEOF
+$as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
+$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
+if test "${ac_cv_c_bigendian+set}" = set; then :
+ $as_echo_n "(cached) " >&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
+ ac_cv_c_bigendian=unknown
+ # See if we're dealing with a universal compiler.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef __APPLE_CC__
+ not a universal capable compiler
+ #endif
+ typedef int dummy;
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+ # Check for potential -arch flags. It is not universal unless
+ # there are at least two -arch flags with different values.
+ ac_arch=
+ ac_prev=
+ for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
+ if test -n "$ac_prev"; then
+ case $ac_word in
+ i?86 | x86_64 | ppc | ppc64)
+ if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
+ ac_arch=$ac_word
+ else
+ ac_cv_c_bigendian=universal
+ break
+ fi
+ ;;
+ esac
+ ac_prev=
+ elif test "x$ac_word" = "x-arch"; then
+ ac_prev=arch
+ fi
+ done
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ if test $ac_cv_c_bigendian = unknown; then
+ # See if sys/param.h defines the BYTE_ORDER macro.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
-#include <sys/param.h>
+ #include <sys/param.h>
int
main ()
{
-#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \
- && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
- bogus endian macros
-#endif
+#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
+ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
+ && LITTLE_ENDIAN)
+ bogus endian macros
+ #endif
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; 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
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
-#include <sys/param.h>
+ #include <sys/param.h>
int
main ()
{
#if BYTE_ORDER != BIG_ENDIAN
- not big endian
-#endif
+ not big endian
+ #endif
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; 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
+ ac_cv_c_bigendian=no
fi
-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+ if test $ac_cv_c_bigendian = unknown; then
+ # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#include <limits.h>
- # 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. */
+int
+main ()
+{
+#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
+ bogus endian macros
+ #endif
+
+ ;
+ return 0;
+}
_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ # It does; now see whether it defined to _BIG_ENDIAN or not.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
-short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
-short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
-void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
-short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
-short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
-void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
+#include <limits.h>
+
int
main ()
{
- _ascii (); _ebcdic ();
+#ifndef _BIG_ENDIAN
+ not big endian
+ #endif
+
;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
+if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_c_bigendian=yes
+else
+ ac_cv_c_bigendian=no
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
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ fi
+ if test $ac_cv_c_bigendian = unknown; then
+ # Compile a test program.
+ if test "$cross_compiling" = yes; then :
+ # Try to guess by grepping values from an object file.
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+short int ascii_mm[] =
+ { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+ short int ascii_ii[] =
+ { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+ int use_ascii (int i) {
+ return ascii_mm[i] + ascii_ii[i];
+ }
+ short int ebcdic_ii[] =
+ { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+ short int ebcdic_mm[] =
+ { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+ int use_ebcdic (int i) {
+ return ebcdic_mm[i] + ebcdic_ii[i];
+ }
+ extern int foo;
+int
+main ()
+{
+return use_ascii (foo) == use_ebcdic (foo);
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; 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
fi
-
rm -f core 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
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
- /* Are we little or big endian? From Harbison&Steele. */
- union
- {
- long int l;
- char c[sizeof (long int)];
- } u;
- u.l = 1;
- return u.c[sizeof (long int) - 1] == 1;
+ /* Are we little or big endian? From Harbison&Steele. */
+ union
+ {
+ long int l;
+ char c[sizeof (long int)];
+ } u;
+ u.l = 1;
+ return u.c[sizeof (long int) - 1] == 1;
;
return 0;
}
_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; 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
+ ac_cv_c_bigendian=yes
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-
+ fi
fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
+$as_echo "$ac_cv_c_bigendian" >&6; }
+ case $ac_cv_c_bigendian in #(
+ yes)
+ $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h
+;; #(
+ no)
-rm -f core 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)
+$as_echo "#define WORDS_LITTLEENDIAN 1" >>confdefs.h
+
+
+ ;; #(
+ universal)
+
+$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
+ ;; #(
+ *)
+ as_fn_error $? "unknown endianness
+ presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
+ esac
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5
+$as_echo_n "checking for an ANSI C-conforming const... " >&6; }
+if test "${ac_cv_c_const+set}" = set; then :
+ $as_echo_n "(cached) " >&6
+else
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* 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 cs;
+ /* SunOS 4.1.1 cc rejects this. */
+ char const *const *pcpcc;
+ char **ppc;
+ /* 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";
+ pcpcc = &g + (g ? g-g : 0);
+ /* HPUX 7.0 cc rejects these. */
+ ++pcpcc;
+ ppc = (char**) pcpcc;
+ pcpcc = (char const *const *) ppc;
+ { /* SCO 3.2v4 cc rejects this. */
+ char *t;
+ char const *s = 0 ? (char *) 0 : (char const *) 0;
+
+ *t++ = 0;
+ if (s) return 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;
+ if (!foo) return 0;
+ }
+ return !cs[0] && !zero.x;
+#endif
-cat >>confdefs.h <<\_ACEOF
-#define WORDS_LITTLEENDIAN 1
+ ;
+ return 0;
+}
_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_const=yes
+else
+ ac_cv_c_const=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5
+$as_echo "$ac_cv_c_const" >&6; }
+if test $ac_cv_c_const = no; then
+$as_echo "#define const /**/" >>confdefs.h
- ;;
- *)
- { { 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
+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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+$as_echo_n "checking for inline... " >&6; }
+if test "${ac_cv_c_inline+set}" = set; then :
+ $as_echo_n "(cached) " >&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
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#ifndef __cplusplus
typedef int foo_t;
@@ -21293,39 +13161,16 @@ $ac_kw foo_t foo () {return 0; }
#endif
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_c_inline=$ac_kw
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
fi
-
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
test "$ac_cv_c_inline" != no && break
done
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
-echo "${ECHO_T}$ac_cv_c_inline" >&6; }
-
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+$as_echo "$ac_cv_c_inline" >&6; }
case $ac_cv_c_inline in
inline | yes) ;;
@@ -21342,61 +13187,9 @@ _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
-typedef off_t ac__type_new_;
-int
-main ()
-{
-if ((ac__type_new_ *) 0)
- return 0;
-if (sizeof (ac__type_new_))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; 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
+ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default"
+if test "x$ac_cv_type_off_t" = x""yes; then :
-rm -f core 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
@@ -21405,61 +13198,9 @@ _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
-typedef size_t ac__type_new_;
-int
-main ()
-{
-if ((ac__type_new_ *) 0)
- return 0;
-if (sizeof (ac__type_new_))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; 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
+ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default"
+if test "x$ac_cv_type_size_t" = x""yes; then :
-rm -f core 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
@@ -21468,109 +13209,15 @@ _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 { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; 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 { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; 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 core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core 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
+ac_fn_c_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default"
+if test "x$ac_cv_member_struct_stat_st_blocks" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_STAT_ST_BLOCKS 1
_ACEOF
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ST_BLOCKS 1
-_ACEOF
+$as_echo "#define HAVE_ST_BLOCKS 1" >>confdefs.h
else
case " $LIBOBJS " in
@@ -21582,100 +13229,8 @@ 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 { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; 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 { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; 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 core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core 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
+ac_fn_c_check_member "$LINENO" "struct stat" "st_rdev" "ac_cv_member_struct_stat_st_rdev" "$ac_includes_default"
+if test "x$ac_cv_member_struct_stat_st_rdev" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_STAT_ST_RDEV 1
@@ -21684,100 +13239,8 @@ _ACEOF
fi
-{ echo "$as_me:$LINENO: checking for struct stat.st_atim" >&5
-echo $ECHO_N "checking for struct stat.st_atim... $ECHO_C" >&6; }
-if test "${ac_cv_member_struct_stat_st_atim+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_atim)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_member_struct_stat_st_atim=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_atim)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_member_struct_stat_st_atim=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_member_struct_stat_st_atim=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_atim" >&5
-echo "${ECHO_T}$ac_cv_member_struct_stat_st_atim" >&6; }
-if test $ac_cv_member_struct_stat_st_atim = yes; then
+ac_fn_c_check_member "$LINENO" "struct stat" "st_atim" "ac_cv_member_struct_stat_st_atim" "$ac_includes_default"
+if test "x$ac_cv_member_struct_stat_st_atim" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_STAT_ST_ATIM 1
@@ -21786,100 +13249,8 @@ _ACEOF
fi
-{ echo "$as_me:$LINENO: checking for struct stat.st_atimespec" >&5
-echo $ECHO_N "checking for struct stat.st_atimespec... $ECHO_C" >&6; }
-if test "${ac_cv_member_struct_stat_st_atimespec+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_atimespec)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_member_struct_stat_st_atimespec=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_atimespec)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_member_struct_stat_st_atimespec=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_member_struct_stat_st_atimespec=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_atimespec" >&5
-echo "${ECHO_T}$ac_cv_member_struct_stat_st_atimespec" >&6; }
-if test $ac_cv_member_struct_stat_st_atimespec = yes; then
+ac_fn_c_check_member "$LINENO" "struct stat" "st_atimespec" "ac_cv_member_struct_stat_st_atimespec" "$ac_includes_default"
+if test "x$ac_cv_member_struct_stat_st_atimespec" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_STAT_ST_ATIMESPEC 1
@@ -21888,100 +13259,8 @@ _ACEOF
fi
-{ echo "$as_me:$LINENO: checking for struct stat.st_atimensec" >&5
-echo $ECHO_N "checking for struct stat.st_atimensec... $ECHO_C" >&6; }
-if test "${ac_cv_member_struct_stat_st_atimensec+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_atimensec)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_member_struct_stat_st_atimensec=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_atimensec)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
- ac_cv_member_struct_stat_st_atimensec=yes
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_cv_member_struct_stat_st_atimensec=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_stat_st_atimensec" >&5
-echo "${ECHO_T}$ac_cv_member_struct_stat_st_atimensec" >&6; }
-if test $ac_cv_member_struct_stat_st_atimensec = yes; then
+ac_fn_c_check_member "$LINENO" "struct stat" "st_atimensec" "ac_cv_member_struct_stat_st_atimensec" "$ac_includes_default"
+if test "x$ac_cv_member_struct_stat_st_atimensec" = x""yes; then :
cat >>confdefs.h <<_ACEOF
#define HAVE_STRUCT_STAT_ST_ATIMENSEC 1
@@ -21995,149 +13274,16 @@ fi
case "${target_os}" in
darwin*)
if test "${enable_nfconv}" = "yes"; then
- if test "${ac_cv_header_CoreFoundation_CoreFoundation_h+set}" = set; then
- { echo "$as_me:$LINENO: checking for CoreFoundation/CoreFoundation.h" >&5
-echo $ECHO_N "checking for CoreFoundation/CoreFoundation.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_CoreFoundation_CoreFoundation_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_CoreFoundation_CoreFoundation_h" >&5
-echo "${ECHO_T}$ac_cv_header_CoreFoundation_CoreFoundation_h" >&6; }
-else
- # Is the header compilable?
-{ echo "$as_me:$LINENO: checking CoreFoundation/CoreFoundation.h usability" >&5
-echo $ECHO_N "checking CoreFoundation/CoreFoundation.h 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 <CoreFoundation/CoreFoundation.h>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; 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 core 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 CoreFoundation/CoreFoundation.h presence" >&5
-echo $ECHO_N "checking CoreFoundation/CoreFoundation.h 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 <CoreFoundation/CoreFoundation.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.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: CoreFoundation/CoreFoundation.h: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: CoreFoundation/CoreFoundation.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { echo "$as_me:$LINENO: WARNING: CoreFoundation/CoreFoundation.h: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: CoreFoundation/CoreFoundation.h: proceeding with the compiler's result" >&2;}
- ac_header_preproc=yes
- ;;
- no:yes:* )
- { echo "$as_me:$LINENO: WARNING: CoreFoundation/CoreFoundation.h: present but cannot be compiled" >&5
-echo "$as_me: WARNING: CoreFoundation/CoreFoundation.h: present but cannot be compiled" >&2;}
- { echo "$as_me:$LINENO: WARNING: CoreFoundation/CoreFoundation.h: check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: CoreFoundation/CoreFoundation.h: check for missing prerequisite headers?" >&2;}
- { echo "$as_me:$LINENO: WARNING: CoreFoundation/CoreFoundation.h: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: CoreFoundation/CoreFoundation.h: see the Autoconf documentation" >&2;}
- { echo "$as_me:$LINENO: WARNING: CoreFoundation/CoreFoundation.h: section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: CoreFoundation/CoreFoundation.h: section \"Present But Cannot Be Compiled\"" >&2;}
- { echo "$as_me:$LINENO: WARNING: CoreFoundation/CoreFoundation.h: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: CoreFoundation/CoreFoundation.h: proceeding with the preprocessor's result" >&2;}
- { echo "$as_me:$LINENO: WARNING: CoreFoundation/CoreFoundation.h: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: CoreFoundation/CoreFoundation.h: in the future, the compiler will take precedence" >&2;}
- ( cat <<\_ASBOX
-## ----------------------------------------- ##
-## Report this to ntfs-3g-devel@lists.sf.net ##
-## ----------------------------------------- ##
-_ASBOX
- ) | sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
-{ echo "$as_me:$LINENO: checking for CoreFoundation/CoreFoundation.h" >&5
-echo $ECHO_N "checking for CoreFoundation/CoreFoundation.h... $ECHO_C" >&6; }
-if test "${ac_cv_header_CoreFoundation_CoreFoundation_h+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- ac_cv_header_CoreFoundation_CoreFoundation_h=$ac_header_preproc
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_CoreFoundation_CoreFoundation_h" >&5
-echo "${ECHO_T}$ac_cv_header_CoreFoundation_CoreFoundation_h" >&6; }
-
-fi
-if test $ac_cv_header_CoreFoundation_CoreFoundation_h = yes; then
+ ac_fn_c_check_header_mongrel "$LINENO" "CoreFoundation/CoreFoundation.h" "ac_cv_header_CoreFoundation_CoreFoundation_h" "$ac_includes_default"
+if test "x$ac_cv_header_CoreFoundation_CoreFoundation_h" = x""yes; then :
LDFLAGS="${LDFLAGS} -framework CoreFoundation"
-cat >>confdefs.h <<\_ACEOF
-#define ENABLE_NFCONV 1
-_ACEOF
+$as_echo "#define ENABLE_NFCONV 1" >>confdefs.h
else
- { { echo "$as_me:$LINENO: error: Cannot find CoreFoundation required for 'nfconv' functionality Mac OS X. You may use the --disable-nfconv 'configure' option to avoid this error." >&5
-echo "$as_me: error: Cannot find CoreFoundation required for 'nfconv' functionality Mac OS X. You may use the --disable-nfconv 'configure' option to avoid this error." >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "Cannot find CoreFoundation required for 'nfconv' functionality Mac OS X. You may use the --disable-nfconv 'configure' option to avoid this error." "$LINENO" 5
fi
@@ -22149,17 +13295,13 @@ esac
# Checks for library functions.
# getmntent is in the standard C library on UNICOS, in -lsun on Irix 4,
# -lseq on Dynix/PTX, -lgen on Unixware.
-{ echo "$as_me:$LINENO: checking for library containing getmntent" >&5
-echo $ECHO_N "checking for library containing getmntent... $ECHO_C" >&6; }
-if test "${ac_cv_search_getmntent+set}" = set; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing getmntent" >&5
+$as_echo_n "checking for library containing getmntent... " >&6; }
+if test "${ac_cv_search_getmntent+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
ac_func_search_save_LIBS=$LIBS
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -22184,56 +13326,31 @@ for ac_lib in '' sun seq gen; do
ac_res=-l$ac_lib
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
fi
- rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+ if ac_fn_c_try_link "$LINENO"; then :
ac_cv_search_getmntent=$ac_res
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext
- if test "${ac_cv_search_getmntent+set}" = set; then
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext
+ if test "${ac_cv_search_getmntent+set}" = set; then :
break
fi
done
-if test "${ac_cv_search_getmntent+set}" = set; then
- :
+if test "${ac_cv_search_getmntent+set}" = set; then :
+
else
ac_cv_search_getmntent=no
fi
rm conftest.$ac_ext
LIBS=$ac_func_search_save_LIBS
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_search_getmntent" >&5
-echo "${ECHO_T}$ac_cv_search_getmntent" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_getmntent" >&5
+$as_echo "$ac_cv_search_getmntent" >&6; }
ac_res=$ac_cv_search_getmntent
-if test "$ac_res" != no; then
+if test "$ac_res" != no; then :
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
ac_cv_func_getmntent=yes
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GETMNTENT
-_ACEOF
+$as_echo "#define HAVE_GETMNTENT 1" >>confdefs.h
else
ac_cv_func_getmntent=no
@@ -22241,16 +13358,12 @@ 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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mbrtowc and mbstate_t are properly declared" >&5
+$as_echo_n "checking whether mbrtowc and mbstate_t are properly declared... " >&6; }
+if test "${ac_cv_func_mbrtowc+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <wchar.h>
int
@@ -22265,58 +13378,31 @@ wchar_t wc;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; 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
+ ac_cv_func_mbrtowc=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core 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; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mbrtowc" >&5
+$as_echo "$ac_cv_func_mbrtowc" >&6; }
if test $ac_cv_func_mbrtowc = yes; then
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_MBRTOWC 1
-_ACEOF
+$as_echo "#define HAVE_MBRTOWC 1" >>confdefs.h
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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working memcmp" >&5
+$as_echo_n "checking for working memcmp... " >&6; }
+if test "${ac_cv_func_memcmp_working+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
- if test "$cross_compiling" = yes; then
+ 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
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
@@ -22351,42 +13437,18 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; 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
+ ac_cv_func_memcmp_working=no
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam 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; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_memcmp_working" >&5
+$as_echo "$ac_cv_func_memcmp_working" >&6; }
test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in
*" memcmp.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS memcmp.$ac_objext"
@@ -22394,29 +13456,25 @@ test $ac_cv_func_memcmp_working = no && case " $LIBOBJS " in
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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5
+$as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; }
+if test "${ac_cv_func_lstat_dereferences_slashed_symlink+set}" = set; then :
+ $as_echo_n "(cached) " >&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
+ 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
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
struct stat sbuf;
- /* Linux will dereference the symlink and fail.
+ /* Linux will dereference the symlink and fail, as required by POSIX.
That is better in the sense that it means we will not
have to compile and use the lstat wrapper. */
return lstat ("conftest.sym/", &sbuf) == 0;
@@ -22424,39 +13482,15 @@ struct stat sbuf;
return 0;
}
_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; 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
+ ac_cv_func_lstat_dereferences_slashed_symlink=no
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-
else
# If the `ln -s' command failed, then we probably don't even
# have an lstat function.
@@ -22465,8 +13499,8 @@ 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; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5
+$as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; }
test $ac_cv_func_lstat_dereferences_slashed_symlink = yes &&
@@ -22475,7 +13509,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
-if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then
+if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then
case " $LIBOBJS " in
*" lstat.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS lstat.$ac_objext"
@@ -22484,19 +13518,15 @@ 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5
+$as_echo_n "checking whether stat accepts an empty string... " >&6; }
+if test "${ac_cv_func_stat_empty_string_bug+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
- if test "$cross_compiling" = yes; then
+ 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
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
int
@@ -22508,42 +13538,18 @@ struct stat sbuf;
return 0;
}
_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; then :
ac_cv_func_stat_empty_string_bug=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_func_stat_empty_string_bug=yes
+ ac_cv_func_stat_empty_string_bug=yes
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam 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; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5
+$as_echo "$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 "* ) ;;
@@ -22558,111 +13564,24 @@ _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 { as_var=$as_ac_var; eval "test \"\${$as_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 <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-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
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_var'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
+do :
+ ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime"
+if test "x$ac_cv_func_strftime" = x""yes; then :
cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define HAVE_STRFTIME 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5
+$as_echo_n "checking for strftime in -lintl... " >&6; }
+if test "${ac_cv_lib_intl_strftime+set}" = set; then :
+ $as_echo_n "(cached) " >&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
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -22680,42 +13599,19 @@ return strftime ();
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; then
+if ac_fn_c_try_link "$LINENO"; 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
+ ac_cv_lib_intl_strftime=no
fi
-
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_strftime" >&5
+$as_echo "$ac_cv_lib_intl_strftime" >&6; }
+if test "x$ac_cv_lib_intl_strftime" = x""yes; then :
+ $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h
LIBS="-lintl $LIBS"
fi
@@ -22726,145 +13622,14 @@ done
-
-for ac_header in $ac_header_list
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&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 { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; 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 core 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 { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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 && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.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 ntfs-3g-devel@lists.sf.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 { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
- echo $ECHO_N "(cached) $ECHO_C" >&6
-else
- eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ for ac_header in $ac_header_list
+do :
+ as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
+ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
+"
+if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
@@ -22874,26 +13639,17 @@ 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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether utime accepts a null argument" >&5
+$as_echo_n "checking whether utime accepts a null argument... " >&6; }
+if test "${ac_cv_func_utime_null+set}" = set; then :
+ $as_echo_n "(cached) " >&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
+if test "$cross_compiling" = yes; then :
+ ac_cv_func_utime_null='guessing yes'
else
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
$ac_includes_default
#ifdef HAVE_UTIME_H
@@ -22912,228 +13668,38 @@ struct stat s, t;
return 0;
}
_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
- { (case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_try") 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_run "$LINENO"; 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
+ ac_cv_func_utime_null=no
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
+ conftest.$ac_objext conftest.beam conftest.$ac_ext
fi
-
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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_utime_null" >&5
+$as_echo "$ac_cv_func_utime_null" >&6; }
+if test "x$ac_cv_func_utime_null" != xno; then
+ ac_cv_func_utime_null=yes
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_UTIME_NULL 1
-_ACEOF
+$as_echo "#define HAVE_UTIME_NULL 1" >>confdefs.h
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 { as_var=$as_ac_var; eval "test \"\${$as_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 <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-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
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_var'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
+do :
+ ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf"
+if test "x$ac_cv_func_vprintf" = x""yes; then :
cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define HAVE_VPRINTF 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 <limits.h> declares _doprnt.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define _doprnt innocuous__doprnt
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char _doprnt (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
+ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt"
+if test "x$ac_cv_func__doprnt" = x""yes; then :
-#undef _doprnt
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-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
-#endif
-
-int
-main ()
-{
-return _doprnt ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; 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 core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- 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
+$as_echo "#define HAVE_DOPRNT 1" >>confdefs.h
fi
@@ -23141,144 +13707,34 @@ fi
done
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
for ac_func in \
atexit basename daemon dup2 fdatasync ffs getopt_long hasmntopt \
mbsinit memmove memset realpath regcomp setlocale setxattr \
strcasecmp strchr strdup strerror strnlen strsep strtol strtoul \
- sysconf utime utimensat gettimeofday clock_gettime fork \
-
-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 { as_var=$as_ac_var; eval "test \"\${$as_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 <limits.h> declares $ac_func.
- For example, HP-UX 11i <limits.h> 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 <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-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
-#endif
-
-int
-main ()
-{
-return $ac_func ();
- ;
- return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
- (eval "$ac_link") 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest$ac_exeext &&
- $as_test_x conftest$ac_exeext; 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
+ sysconf utime utimensat gettimeofday clock_gettime fork memcpy random snprintf \
-rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
- conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_var'}'`
- { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
+do :
+ as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
+ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
+if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
fi
done
# Check whether --enable-largefile was given.
-if test "${enable_largefile+set}" = set; then
+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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5
+$as_echo_n "checking for special C compiler options needed for large files... " >&6; }
+if test "${ac_cv_sys_largefile_CC+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
ac_cv_sys_largefile_CC=no
if test "$GCC" != yes; then
@@ -23286,11 +13742,7 @@ else
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
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
@@ -23309,58 +13761,14 @@ main ()
return 0;
}
_ACEOF
- rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+ if ac_fn_c_try_compile "$LINENO"; then :
break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
fi
-
rm -f core conftest.err conftest.$ac_objext
CC="$CC -n32"
- rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+ if ac_fn_c_try_compile "$LINENO"; 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 core conftest.err conftest.$ac_objext
break
done
@@ -23368,23 +13776,19 @@ rm -f core conftest.err conftest.$ac_objext
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; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5
+$as_echo "$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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5
+$as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; }
+if test "${ac_cv_sys_file_offset_bits+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
@@ -23403,37 +13807,11 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_sys_file_offset_bits=no; break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
fi
-
rm -f core 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
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _FILE_OFFSET_BITS 64
#include <sys/types.h>
@@ -23453,38 +13831,16 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; 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 core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_sys_file_offset_bits=unknown
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; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5
+$as_echo "$ac_cv_sys_file_offset_bits" >&6; }
case $ac_cv_sys_file_offset_bits in #(
no | unknown) ;;
*)
@@ -23493,19 +13849,15 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
;;
esac
-rm -f conftest*
+rm -rf conftest*
if test $ac_cv_sys_file_offset_bits = unknown; then
- { 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
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5
+$as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; }
+if test "${ac_cv_sys_large_files+set}" = set; then :
+ $as_echo_n "(cached) " >&6
else
while :; do
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <sys/types.h>
/* Check that off_t can represent 2**63 - 1 correctly.
@@ -23524,37 +13876,11 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; then :
ac_cv_sys_large_files=no; break
-else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
fi
-
rm -f core 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
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#define _LARGE_FILES 1
#include <sys/types.h>
@@ -23574,38 +13900,16 @@ main ()
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
- *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
- *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&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); } && {
- test -z "$ac_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then
+if ac_fn_c_try_compile "$LINENO"; 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 core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_sys_large_files=unknown
break
done
fi
-{ echo "$as_me:$LINENO: result: $ac_cv_sys_large_files" >&5
-echo "${ECHO_T}$ac_cv_sys_large_files" >&6; }
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5
+$as_echo "$ac_cv_sys_large_files" >&6; }
case $ac_cv_sys_large_files in #(
no | unknown) ;;
*)
@@ -23614,7 +13918,7 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
;;
esac
-rm -f conftest*
+rm -rf conftest*
fi
fi
@@ -23636,27 +13940,22 @@ fi
if test "${enable_debug}" = "yes"; then
CFLAGS="${CFLAGS} -ggdb3 -DDEBUG"
-cat >>confdefs.h <<\_ACEOF
-#define ENABLE_DEBUG 1
-_ACEOF
+$as_echo "#define ENABLE_DEBUG 1" >>confdefs.h
fi
test "${enable_device_default_io_ops}" = "no" &&
-cat >>confdefs.h <<\_ACEOF
-#define NO_NTFS_DEVICE_DEFAULT_IO_OPS 1
-_ACEOF
+$as_echo "#define NO_NTFS_DEVICE_DEFAULT_IO_OPS 1" >>confdefs.h
test "${enable_mtab}" = "no" &&
-cat >>confdefs.h <<\_ACEOF
-#define IGNORE_MTAB 1
-_ACEOF
+$as_echo "#define IGNORE_MTAB 1" >>confdefs.h
test "${enable_posix_acls}" != "no" &&
-cat >>confdefs.h <<\_ACEOF
-#define POSIXACLS 1
-_ACEOF
+$as_echo "#define POSIXACLS 1" >>confdefs.h
+
+test "${enable_xattr_mappings}" != "no" &&
+$as_echo "#define XATTR_MAPPINGS 1" >>confdefs.h
test "${enable_really_static}" = "yes" && enable_library="no"
@@ -23691,6 +13990,12 @@ fi
+
+
+
+
+
+
if test "${with_fuse}" = "internal"; then
FUSE_INTERNAL_TRUE=
FUSE_INTERNAL_FALSE='#'
@@ -23755,6 +14060,30 @@ else
ENABLE_MOUNT_HELPER_FALSE=
fi
+ if test "${enable_ntfs_3g}" = "yes"; then
+ ENABLE_NTFS_3G_TRUE=
+ ENABLE_NTFS_3G_FALSE='#'
+else
+ ENABLE_NTFS_3G_TRUE='#'
+ ENABLE_NTFS_3G_FALSE=
+fi
+
+ if test "${enable_ntfsprogs}" = "yes"; then
+ ENABLE_NTFSPROGS_TRUE=
+ ENABLE_NTFSPROGS_FALSE='#'
+else
+ ENABLE_NTFSPROGS_TRUE='#'
+ ENABLE_NTFSPROGS_FALSE=
+fi
+
+ if test "${enable_extras}" = "yes"; then
+ ENABLE_EXTRAS_TRUE=
+ ENABLE_EXTRAS_FALSE='#'
+else
+ ENABLE_EXTRAS_TRUE='#'
+ ENABLE_EXTRAS_FALSE=
+fi
+
# workaround for <autoconf-2.60
if test -z "${docdir}"; then
@@ -23768,7 +14097,7 @@ if test -z "${MKDIR_P}"; then
fi
# generate files
-ac_config_files="$ac_config_files Makefile include/Makefile include/fuse-lite/Makefile include/ntfs-3g/Makefile libfuse-lite/Makefile libntfs-3g/Makefile libntfs-3g/libntfs-3g.pc libntfs-3g/libntfs-3g.script.so src/Makefile src/ntfs-3g.8 src/ntfs-3g.probe.8 src/ntfs-3g.usermap.8 src/ntfs-3g.secaudit.8"
+ac_config_files="$ac_config_files Makefile include/Makefile include/fuse-lite/Makefile include/ntfs-3g/Makefile libfuse-lite/Makefile libntfs-3g/Makefile libntfs-3g/libntfs-3g.pc libntfs-3g/libntfs-3g.script.so ntfsprogs/Makefile ntfsprogs/mkntfs.8 ntfsprogs/ntfscat.8 ntfsprogs/ntfsclone.8 ntfsprogs/ntfscluster.8 ntfsprogs/ntfscmp.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 src/Makefile src/ntfs-3g.8 src/ntfs-3g.probe.8 src/ntfs-3g.usermap.8 src/ntfs-3g.secaudit.8"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -23797,12 +14126,13 @@ _ACEOF
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
- *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
+ *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
+$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
- *) $as_unset $ac_var ;;
+ BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
+ *) { eval $ac_var=; unset $ac_var;} ;;
esac ;;
esac
done
@@ -23810,8 +14140,8 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
(set) 2>&1 |
case $as_nl`(ac_space=' '; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \).
+ # `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"
@@ -23834,12 +14164,12 @@ echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
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 "$as_me:$LINENO: updating cache $cache_file" >&5
-echo "$as_me: updating cache $cache_file" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
+$as_echo "$as_me: updating cache $cache_file" >&6;}
cat confcache >$cache_file
else
- { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
-echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
+$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
fi
fi
rm -f confcache
@@ -23852,111 +14182,103 @@ DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
+U=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
- ac_i=`echo "$ac_i" | sed "$ac_script"`
+ ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
# 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
# will be set to the directory where LIBOBJS objects are built.
- ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
- ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
+ as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
LTLIBOBJS=$ac_ltlibobjs
+ if test -n "$EXEEXT"; then
+ am__EXEEXT_TRUE=
+ am__EXEEXT_FALSE='#'
+else
+ am__EXEEXT_TRUE='#'
+ am__EXEEXT_FALSE=
+fi
+
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; }; }
+ as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
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; }; }
+ as_fn_error $? "conditional \"AMDEP\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
+ as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
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; }; }
+ as_fn_error $? "conditional \"am__fastdepCC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${ENABLE_CRYPTO_TRUE}" && test -z "${ENABLE_CRYPTO_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_CRYPTO\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
+
if test -z "${FUSE_INTERNAL_TRUE}" && test -z "${FUSE_INTERNAL_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"FUSE_INTERNAL\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"FUSE_INTERNAL\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "conditional \"FUSE_INTERNAL\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${GENERATE_LDSCRIPT_TRUE}" && test -z "${GENERATE_LDSCRIPT_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"GENERATE_LDSCRIPT\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"GENERATE_LDSCRIPT\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "conditional \"GENERATE_LDSCRIPT\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${WINDOWS_TRUE}" && test -z "${WINDOWS_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"WINDOWS\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"WINDOWS\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "conditional \"WINDOWS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${NTFS_DEVICE_DEFAULT_IO_OPS_TRUE}" && test -z "${NTFS_DEVICE_DEFAULT_IO_OPS_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"NTFS_DEVICE_DEFAULT_IO_OPS\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"NTFS_DEVICE_DEFAULT_IO_OPS\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "conditional \"NTFS_DEVICE_DEFAULT_IO_OPS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${RUN_LDCONFIG_TRUE}" && test -z "${RUN_LDCONFIG_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"RUN_LDCONFIG\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"RUN_LDCONFIG\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "conditional \"RUN_LDCONFIG\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
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; }; }
+ as_fn_error $? "conditional \"REALLYSTATIC\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${INSTALL_LIBRARY_TRUE}" && test -z "${INSTALL_LIBRARY_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"INSTALL_LIBRARY\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"INSTALL_LIBRARY\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "conditional \"INSTALL_LIBRARY\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
if test -z "${ENABLE_MOUNT_HELPER_TRUE}" && test -z "${ENABLE_MOUNT_HELPER_FALSE}"; then
- { { echo "$as_me:$LINENO: error: conditional \"ENABLE_MOUNT_HELPER\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"ENABLE_MOUNT_HELPER\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "conditional \"ENABLE_MOUNT_HELPER\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${ENABLE_NTFS_3G_TRUE}" && test -z "${ENABLE_NTFS_3G_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_NTFS_3G\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${ENABLE_NTFSPROGS_TRUE}" && test -z "${ENABLE_NTFSPROGS_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_NTFSPROGS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
+if test -z "${ENABLE_EXTRAS_TRUE}" && test -z "${ENABLE_EXTRAS_FALSE}"; then
+ as_fn_error $? "conditional \"ENABLE_EXTRAS\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
: ${CONFIG_STATUS=./config.status}
+ac_write_fail=0
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
+{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
+$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
+as_write_fail=0
+cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
#! $SHELL
# Generated by $as_me.
# Run this file to recreate the current configuration.
@@ -23966,59 +14288,79 @@ cat >$CONFIG_STATUS <<_ACEOF
debug=false
ac_cs_recheck=false
ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-## --------------------- ##
-## M4sh Initialization. ##
-## --------------------- ##
+SHELL=\${CONFIG_SHELL-$SHELL}
+export SHELL
+_ASEOF
+cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
+## -------------------- ##
+## M4sh Initialization. ##
+## -------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+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
+ # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
- case `(set -o) 2>/dev/null` in
- *posix*) set -o posix ;;
+ case `(set -o) 2>/dev/null` in #(
+ *posix*) :
+ set -o posix ;; #(
+ *) :
+ ;;
esac
-
fi
-
-
-# PATH needs CR
-# 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=';'
+as_nl='
+'
+export as_nl
+# Printing a long string crashes Solaris 7 /usr/bin/printf.
+as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
+as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
+# Prefer a ksh shell builtin over an external printf program on Solaris,
+# but without wasting forks for bash or zsh.
+if test -z "$BASH_VERSION$ZSH_VERSION" \
+ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='print -r --'
+ as_echo_n='print -rn --'
+elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
+ as_echo='printf %s\n'
+ as_echo_n='printf %s'
+else
+ if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
+ as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
+ as_echo_n='/usr/ucb/echo -n'
else
- PATH_SEPARATOR=:
+ as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
+ as_echo_n_body='eval
+ arg=$1;
+ case $arg in #(
+ *"$as_nl"*)
+ expr "X$arg" : "X\\(.*\\)$as_nl";
+ arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
+ esac;
+ expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
+ '
+ export as_echo_n_body
+ as_echo_n='sh -c $as_echo_n_body as_echo'
fi
- rm -f conf$$.sh
+ export as_echo_body
+ as_echo='sh -c $as_echo_body as_echo'
fi
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- as_unset=unset
-else
- as_unset=false
+# The user is always right.
+if test "${PATH_SEPARATOR+set}" != set; then
+ PATH_SEPARATOR=:
+ (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
+ (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
+ PATH_SEPARATOR=';'
+ }
fi
@@ -24027,20 +14369,18 @@ fi
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
-as_nl='
-'
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
-case $0 in
+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
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+ done
IFS=$as_save_IFS
;;
@@ -24051,32 +14391,111 @@ if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
- echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- { (exit 1); exit 1; }
+ $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ exit 1
fi
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+# Unset variables that we do not need and which cause bugs (e.g. in
+# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
+# suppresses any "Segmentation fault" message there. '((' could
+# trigger a bug in pdksh 5.2.14.
+for as_var in BASH_ENV ENV MAIL MAILPATH
+do eval test x\${$as_var+set} = xset \
+ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
done
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) >/dev/null 2>&1 && $as_unset $as_var
+LC_ALL=C
+export LC_ALL
+LANGUAGE=C
+export LANGUAGE
+
+# CDPATH.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+
+# as_fn_error STATUS ERROR [LINENO LOG_FD]
+# ----------------------------------------
+# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
+# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
+# script with STATUS, using 1 if that was 0.
+as_fn_error ()
+{
+ as_status=$1; test $as_status -eq 0 && as_status=1
+ if test "$4"; then
+ as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
+ $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
fi
-done
+ $as_echo "$as_me: error: $2" >&2
+ as_fn_exit $as_status
+} # as_fn_error
+
+
+# as_fn_set_status STATUS
+# -----------------------
+# Set $? to STATUS, without forking.
+as_fn_set_status ()
+{
+ return $1
+} # as_fn_set_status
+
+# as_fn_exit STATUS
+# -----------------
+# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
+as_fn_exit ()
+{
+ set +e
+ as_fn_set_status $1
+ exit $1
+} # as_fn_exit
+
+# as_fn_unset VAR
+# ---------------
+# Portably unset VAR.
+as_fn_unset ()
+{
+ { eval $1=; unset $1;}
+}
+as_unset=as_fn_unset
+# as_fn_append VAR VALUE
+# ----------------------
+# Append the text in VALUE to the end of the definition contained in VAR. Take
+# advantage of any shell optimizations that allow amortized linear growth over
+# repeated appends, instead of the typical quadratic growth present in naive
+# implementations.
+if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
+ eval 'as_fn_append ()
+ {
+ eval $1+=\$2
+ }'
+else
+ as_fn_append ()
+ {
+ eval $1=\$$1\$2
+ }
+fi # as_fn_append
+
+# as_fn_arith ARG...
+# ------------------
+# Perform arithmetic evaluation on the ARGs, and store the result in the
+# global $as_val. Take advantage of shells that can avoid forks. The arguments
+# must be portable across $(()) and expr.
+if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
+ eval 'as_fn_arith ()
+ {
+ as_val=$(( $* ))
+ }'
+else
+ as_fn_arith ()
+ {
+ as_val=`expr "$@" || test $? -eq 1`
+ }
+fi # as_fn_arith
+
-# Required to use basename.
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
@@ -24090,13 +14509,17 @@ else
as_basename=false
fi
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=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" |
+$as_echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
@@ -24111,104 +14534,103 @@ echo X/"$0" |
}
s/.*/./; q'`
-# CDPATH.
-$as_unset CDPATH
-
-
-
- as_lineno_1=$LINENO
- as_lineno_2=$LINENO
- test "x$as_lineno_1" != "x$as_lineno_2" &&
- test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
- # 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 after each line using $LINENO; the second 'sed'
- # does the real work. The second script uses 'N' to pair each
- # line-number line with the line containing $LINENO, 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
- # scripts with optimization help from Paolo Bonzini. Blame Lee
- # E. McMahon (1931-1989) for sed's syntax. :-)
- sed -n '
- p
- /[$]LINENO/=
- ' <$as_myself |
- sed '
- s/[$]LINENO.*/&-/
- t lineno
- b
- :lineno
- N
- :loop
- s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
- t loop
- s/-\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 sensitive to this).
- . "./$as_me.lineno"
- # Exit status is that of the last command.
- exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
+# 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
ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
+case `echo -n x` in #(((((
-n*)
- case `echo 'x\c'` in
+ case `echo 'xy\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
- *) ECHO_C='\c';;
+ xy) ECHO_C='\c';;
+ *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
+ ECHO_T=' ';;
esac;;
*)
ECHO_N='-n';;
esac
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
-else
- as_expr=false
-fi
-
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
- mkdir conf$$.dir
-fi
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
- as_ln_s='ln -s'
- # ... but there are two gotchas:
- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -p'.
- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ mkdir conf$$.dir 2>/dev/null
+fi
+if (echo >conf$$.file) 2>/dev/null; then
+ if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+ elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+ else
as_ln_s='cp -p'
-elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
+ fi
else
as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
+
+# as_fn_mkdir_p
+# -------------
+# Create "$as_dir" as a directory, including parents if necessary.
+as_fn_mkdir_p ()
+{
+
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || eval $as_mkdir_p || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+$as_echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+
+
+} # as_fn_mkdir_p
if mkdir -p . 2>/dev/null; then
- as_mkdir_p=:
+ as_mkdir_p='mkdir -p "$as_dir"'
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
@@ -24225,12 +14647,12 @@ else
as_test_x='
eval sh -c '\''
if test -d "$1"; then
- test -d "$1/.";
+ test -d "$1/.";
else
- case $1 in
- -*)set "./$1";;
+ case $1 in #(
+ -*)set "./$1";;
esac;
- case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
???[sx]*):;;*)false;;esac;fi
'\'' sh
'
@@ -24245,13 +14667,19 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
exec 6>&1
+## ----------------------------------- ##
+## Main body of $CONFIG_STATUS script. ##
+## ----------------------------------- ##
+_ASEOF
+test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
-# Save the log message, to keep $[0] and so on meaningful, and to
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# Save the log message, to keep $0 and so on meaningful, and to
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by ntfs-3g $as_me 2010.5.16, which was
-generated by GNU Autoconf 2.61. Invocation command line was
+This file was extended by ntfs-3g $as_me 2014.2.15, which was
+generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -24264,7 +14692,16 @@ on `(hostname || uname -n) 2>/dev/null | sed 1q`
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+case $ac_config_files in *"
+"*) set x $ac_config_files; shift; ac_config_files=$*;;
+esac
+
+case $ac_config_headers in *"
+"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
+esac
+
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
# Files that config.status was made for.
config_files="$ac_config_files"
config_headers="$ac_config_headers"
@@ -24272,22 +14709,25 @@ config_commands="$ac_config_commands"
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
+\`$as_me' instantiates files and other configuration actions
+from templates according to the current configuration. Unless the files
+and actions are specified as TAGs, all are instantiated by default.
-Usage: $0 [OPTIONS] [FILE]...
+Usage: $0 [OPTION]... [TAG]...
-h, --help print this help, then exit
-V, --version print version number and configuration settings, then exit
- -q, --quiet do not print progress messages
+ --config print configuration, then exit
+ -q, --quiet, --silent
+ 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
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
Configuration files:
$config_files
@@ -24298,16 +14738,17 @@ $config_headers
Configuration commands:
$config_commands
-Report bugs to <bug-autoconf@gnu.org>."
+Report bugs to <ntfs-3g-devel@lists.sf.net>."
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-ntfs-3g config.status 2010.5.16
-configured by $0, generated by GNU Autoconf 2.61,
- with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
+ntfs-3g config.status 2014.2.15
+configured by $0, generated by GNU Autoconf 2.67,
+ with options \\"\$ac_cs_config\\"
-Copyright (C) 2006 Free Software Foundation, Inc.
+Copyright (C) 2010 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
@@ -24315,20 +14756,26 @@ ac_pwd='$ac_pwd'
srcdir='$srcdir'
INSTALL='$INSTALL'
MKDIR_P='$MKDIR_P'
+AWK='$AWK'
+test -n "\$AWK" || AWK=awk
_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.
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+# The default lists apply if the user does not specify any file.
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=`expr "X$1" : 'X\([^=]*\)='`
+ ac_optarg=
+ ac_shift=:
+ ;;
*)
ac_option=$1
ac_optarg=$2
@@ -24341,34 +14788,41 @@ do
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
--version | --versio | --versi | --vers | --ver | --ve | --v | -V )
- echo "$ac_cs_version"; exit ;;
+ $as_echo "$ac_cs_version"; exit ;;
+ --config | --confi | --conf | --con | --co | --c )
+ $as_echo "$ac_cs_config"; exit ;;
--debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
- CONFIG_FILES="$CONFIG_FILES $ac_optarg"
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ '') as_fn_error $? "missing file argument" ;;
+ esac
+ as_fn_append CONFIG_FILES " '$ac_optarg'"
ac_need_defaults=false;;
--header | --heade | --head | --hea )
$ac_shift
- CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
+ case $ac_optarg in
+ *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ esac
+ as_fn_append CONFIG_HEADERS " '$ac_optarg'"
ac_need_defaults=false;;
--he | --h)
# Conflict between --help and --header
- { echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; };;
+ as_fn_error $? "ambiguous option: \`$1'
+Try \`$0 --help' for more information.";;
--help | --hel | -h )
- echo "$ac_cs_usage"; exit ;;
+ $as_echo "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
- -*) { echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2
- { (exit 1); exit 1; }; } ;;
+ -*) as_fn_error $? "unrecognized option: \`$1'
+Try \`$0 --help' for more information." ;;
- *) ac_config_targets="$ac_config_targets $1"
+ *) as_fn_append ac_config_targets " $1"
ac_need_defaults=false ;;
esac
@@ -24383,35 +14837,292 @@ if $ac_cs_silent; then
fi
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
if \$ac_cs_recheck; then
- echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
- CONFIG_SHELL=$SHELL
+ set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ shift
+ \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
+ CONFIG_SHELL='$SHELL'
export CONFIG_SHELL
- exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+ exec "\$@"
fi
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
exec 5>>config.log
{
echo
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
- echo "$ac_log"
+ $as_echo "$ac_log"
} >&5
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
#
# INIT-COMMANDS
#
AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
+
+# 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
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+macro_version='`$ECHO "X$macro_version" | $Xsed -e "$delay_single_quote_subst"`'
+macro_revision='`$ECHO "X$macro_revision" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared='`$ECHO "X$enable_shared" | $Xsed -e "$delay_single_quote_subst"`'
+enable_static='`$ECHO "X$enable_static" | $Xsed -e "$delay_single_quote_subst"`'
+pic_mode='`$ECHO "X$pic_mode" | $Xsed -e "$delay_single_quote_subst"`'
+enable_fast_install='`$ECHO "X$enable_fast_install" | $Xsed -e "$delay_single_quote_subst"`'
+host_alias='`$ECHO "X$host_alias" | $Xsed -e "$delay_single_quote_subst"`'
+host='`$ECHO "X$host" | $Xsed -e "$delay_single_quote_subst"`'
+host_os='`$ECHO "X$host_os" | $Xsed -e "$delay_single_quote_subst"`'
+build_alias='`$ECHO "X$build_alias" | $Xsed -e "$delay_single_quote_subst"`'
+build='`$ECHO "X$build" | $Xsed -e "$delay_single_quote_subst"`'
+build_os='`$ECHO "X$build_os" | $Xsed -e "$delay_single_quote_subst"`'
+SED='`$ECHO "X$SED" | $Xsed -e "$delay_single_quote_subst"`'
+Xsed='`$ECHO "X$Xsed" | $Xsed -e "$delay_single_quote_subst"`'
+GREP='`$ECHO "X$GREP" | $Xsed -e "$delay_single_quote_subst"`'
+EGREP='`$ECHO "X$EGREP" | $Xsed -e "$delay_single_quote_subst"`'
+FGREP='`$ECHO "X$FGREP" | $Xsed -e "$delay_single_quote_subst"`'
+LD='`$ECHO "X$LD" | $Xsed -e "$delay_single_quote_subst"`'
+NM='`$ECHO "X$NM" | $Xsed -e "$delay_single_quote_subst"`'
+LN_S='`$ECHO "X$LN_S" | $Xsed -e "$delay_single_quote_subst"`'
+max_cmd_len='`$ECHO "X$max_cmd_len" | $Xsed -e "$delay_single_quote_subst"`'
+ac_objext='`$ECHO "X$ac_objext" | $Xsed -e "$delay_single_quote_subst"`'
+exeext='`$ECHO "X$exeext" | $Xsed -e "$delay_single_quote_subst"`'
+lt_unset='`$ECHO "X$lt_unset" | $Xsed -e "$delay_single_quote_subst"`'
+lt_SP2NL='`$ECHO "X$lt_SP2NL" | $Xsed -e "$delay_single_quote_subst"`'
+lt_NL2SP='`$ECHO "X$lt_NL2SP" | $Xsed -e "$delay_single_quote_subst"`'
+reload_flag='`$ECHO "X$reload_flag" | $Xsed -e "$delay_single_quote_subst"`'
+reload_cmds='`$ECHO "X$reload_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+OBJDUMP='`$ECHO "X$OBJDUMP" | $Xsed -e "$delay_single_quote_subst"`'
+deplibs_check_method='`$ECHO "X$deplibs_check_method" | $Xsed -e "$delay_single_quote_subst"`'
+file_magic_cmd='`$ECHO "X$file_magic_cmd" | $Xsed -e "$delay_single_quote_subst"`'
+AR='`$ECHO "X$AR" | $Xsed -e "$delay_single_quote_subst"`'
+AR_FLAGS='`$ECHO "X$AR_FLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+STRIP='`$ECHO "X$STRIP" | $Xsed -e "$delay_single_quote_subst"`'
+RANLIB='`$ECHO "X$RANLIB" | $Xsed -e "$delay_single_quote_subst"`'
+old_postinstall_cmds='`$ECHO "X$old_postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_postuninstall_cmds='`$ECHO "X$old_postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_cmds='`$ECHO "X$old_archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+CC='`$ECHO "X$CC" | $Xsed -e "$delay_single_quote_subst"`'
+CFLAGS='`$ECHO "X$CFLAGS" | $Xsed -e "$delay_single_quote_subst"`'
+compiler='`$ECHO "X$compiler" | $Xsed -e "$delay_single_quote_subst"`'
+GCC='`$ECHO "X$GCC" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_pipe='`$ECHO "X$lt_cv_sys_global_symbol_pipe" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_cdecl='`$ECHO "X$lt_cv_sys_global_symbol_to_cdecl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "X$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
+objdir='`$ECHO "X$objdir" | $Xsed -e "$delay_single_quote_subst"`'
+SHELL='`$ECHO "X$SHELL" | $Xsed -e "$delay_single_quote_subst"`'
+ECHO='`$ECHO "X$ECHO" | $Xsed -e "$delay_single_quote_subst"`'
+MAGIC_CMD='`$ECHO "X$MAGIC_CMD" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_no_builtin_flag='`$ECHO "X$lt_prog_compiler_no_builtin_flag" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_wl='`$ECHO "X$lt_prog_compiler_wl" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_pic='`$ECHO "X$lt_prog_compiler_pic" | $Xsed -e "$delay_single_quote_subst"`'
+lt_prog_compiler_static='`$ECHO "X$lt_prog_compiler_static" | $Xsed -e "$delay_single_quote_subst"`'
+lt_cv_prog_compiler_c_o='`$ECHO "X$lt_cv_prog_compiler_c_o" | $Xsed -e "$delay_single_quote_subst"`'
+need_locks='`$ECHO "X$need_locks" | $Xsed -e "$delay_single_quote_subst"`'
+DSYMUTIL='`$ECHO "X$DSYMUTIL" | $Xsed -e "$delay_single_quote_subst"`'
+NMEDIT='`$ECHO "X$NMEDIT" | $Xsed -e "$delay_single_quote_subst"`'
+LIPO='`$ECHO "X$LIPO" | $Xsed -e "$delay_single_quote_subst"`'
+OTOOL='`$ECHO "X$OTOOL" | $Xsed -e "$delay_single_quote_subst"`'
+OTOOL64='`$ECHO "X$OTOOL64" | $Xsed -e "$delay_single_quote_subst"`'
+libext='`$ECHO "X$libext" | $Xsed -e "$delay_single_quote_subst"`'
+shrext_cmds='`$ECHO "X$shrext_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+extract_expsyms_cmds='`$ECHO "X$extract_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds_need_lc='`$ECHO "X$archive_cmds_need_lc" | $Xsed -e "$delay_single_quote_subst"`'
+enable_shared_with_static_runtimes='`$ECHO "X$enable_shared_with_static_runtimes" | $Xsed -e "$delay_single_quote_subst"`'
+export_dynamic_flag_spec='`$ECHO "X$export_dynamic_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+whole_archive_flag_spec='`$ECHO "X$whole_archive_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+compiler_needs_object='`$ECHO "X$compiler_needs_object" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_new_cmds='`$ECHO "X$old_archive_from_new_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+old_archive_from_expsyms_cmds='`$ECHO "X$old_archive_from_expsyms_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_cmds='`$ECHO "X$archive_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+archive_expsym_cmds='`$ECHO "X$archive_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_cmds='`$ECHO "X$module_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+module_expsym_cmds='`$ECHO "X$module_expsym_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+with_gnu_ld='`$ECHO "X$with_gnu_ld" | $Xsed -e "$delay_single_quote_subst"`'
+allow_undefined_flag='`$ECHO "X$allow_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+no_undefined_flag='`$ECHO "X$no_undefined_flag" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec='`$ECHO "X$hardcode_libdir_flag_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_flag_spec_ld='`$ECHO "X$hardcode_libdir_flag_spec_ld" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_libdir_separator='`$ECHO "X$hardcode_libdir_separator" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct='`$ECHO "X$hardcode_direct" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_direct_absolute='`$ECHO "X$hardcode_direct_absolute" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_minus_L='`$ECHO "X$hardcode_minus_L" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_shlibpath_var='`$ECHO "X$hardcode_shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_automatic='`$ECHO "X$hardcode_automatic" | $Xsed -e "$delay_single_quote_subst"`'
+inherit_rpath='`$ECHO "X$inherit_rpath" | $Xsed -e "$delay_single_quote_subst"`'
+link_all_deplibs='`$ECHO "X$link_all_deplibs" | $Xsed -e "$delay_single_quote_subst"`'
+fix_srcfile_path='`$ECHO "X$fix_srcfile_path" | $Xsed -e "$delay_single_quote_subst"`'
+always_export_symbols='`$ECHO "X$always_export_symbols" | $Xsed -e "$delay_single_quote_subst"`'
+export_symbols_cmds='`$ECHO "X$export_symbols_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+exclude_expsyms='`$ECHO "X$exclude_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+include_expsyms='`$ECHO "X$include_expsyms" | $Xsed -e "$delay_single_quote_subst"`'
+prelink_cmds='`$ECHO "X$prelink_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+file_list_spec='`$ECHO "X$file_list_spec" | $Xsed -e "$delay_single_quote_subst"`'
+variables_saved_for_relink='`$ECHO "X$variables_saved_for_relink" | $Xsed -e "$delay_single_quote_subst"`'
+need_lib_prefix='`$ECHO "X$need_lib_prefix" | $Xsed -e "$delay_single_quote_subst"`'
+need_version='`$ECHO "X$need_version" | $Xsed -e "$delay_single_quote_subst"`'
+version_type='`$ECHO "X$version_type" | $Xsed -e "$delay_single_quote_subst"`'
+runpath_var='`$ECHO "X$runpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_var='`$ECHO "X$shlibpath_var" | $Xsed -e "$delay_single_quote_subst"`'
+shlibpath_overrides_runpath='`$ECHO "X$shlibpath_overrides_runpath" | $Xsed -e "$delay_single_quote_subst"`'
+libname_spec='`$ECHO "X$libname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+library_names_spec='`$ECHO "X$library_names_spec" | $Xsed -e "$delay_single_quote_subst"`'
+soname_spec='`$ECHO "X$soname_spec" | $Xsed -e "$delay_single_quote_subst"`'
+postinstall_cmds='`$ECHO "X$postinstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+postuninstall_cmds='`$ECHO "X$postuninstall_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_cmds='`$ECHO "X$finish_cmds" | $Xsed -e "$delay_single_quote_subst"`'
+finish_eval='`$ECHO "X$finish_eval" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_into_libs='`$ECHO "X$hardcode_into_libs" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_search_path_spec='`$ECHO "X$sys_lib_search_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+sys_lib_dlsearch_path_spec='`$ECHO "X$sys_lib_dlsearch_path_spec" | $Xsed -e "$delay_single_quote_subst"`'
+hardcode_action='`$ECHO "X$hardcode_action" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen='`$ECHO "X$enable_dlopen" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self='`$ECHO "X$enable_dlopen_self" | $Xsed -e "$delay_single_quote_subst"`'
+enable_dlopen_self_static='`$ECHO "X$enable_dlopen_self_static" | $Xsed -e "$delay_single_quote_subst"`'
+old_striplib='`$ECHO "X$old_striplib" | $Xsed -e "$delay_single_quote_subst"`'
+striplib='`$ECHO "X$striplib" | $Xsed -e "$delay_single_quote_subst"`'
+
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# Quote evaled strings.
+for var in SED \
+GREP \
+EGREP \
+FGREP \
+LD \
+NM \
+LN_S \
+lt_SP2NL \
+lt_NL2SP \
+reload_flag \
+OBJDUMP \
+deplibs_check_method \
+file_magic_cmd \
+AR \
+AR_FLAGS \
+STRIP \
+RANLIB \
+CC \
+CFLAGS \
+compiler \
+lt_cv_sys_global_symbol_pipe \
+lt_cv_sys_global_symbol_to_cdecl \
+lt_cv_sys_global_symbol_to_c_name_address \
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
+SHELL \
+ECHO \
+lt_prog_compiler_no_builtin_flag \
+lt_prog_compiler_wl \
+lt_prog_compiler_pic \
+lt_prog_compiler_static \
+lt_cv_prog_compiler_c_o \
+need_locks \
+DSYMUTIL \
+NMEDIT \
+LIPO \
+OTOOL \
+OTOOL64 \
+shrext_cmds \
+export_dynamic_flag_spec \
+whole_archive_flag_spec \
+compiler_needs_object \
+with_gnu_ld \
+allow_undefined_flag \
+no_undefined_flag \
+hardcode_libdir_flag_spec \
+hardcode_libdir_flag_spec_ld \
+hardcode_libdir_separator \
+fix_srcfile_path \
+exclude_expsyms \
+include_expsyms \
+file_list_spec \
+variables_saved_for_relink \
+libname_spec \
+library_names_spec \
+soname_spec \
+finish_eval \
+old_striplib \
+striplib; do
+ case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Double-quote double-evaled strings.
+for var in reload_cmds \
+old_postinstall_cmds \
+old_postuninstall_cmds \
+old_archive_cmds \
+extract_expsyms_cmds \
+old_archive_from_new_cmds \
+old_archive_from_expsyms_cmds \
+archive_cmds \
+archive_expsym_cmds \
+module_cmds \
+module_expsym_cmds \
+export_symbols_cmds \
+prelink_cmds \
+postinstall_cmds \
+postuninstall_cmds \
+finish_cmds \
+sys_lib_search_path_spec \
+sys_lib_dlsearch_path_spec; do
+ case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+ *[\\\\\\\`\\"\\\$]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Fix-up fallback echo if it was mangled by the above quoting rules.
+case \$lt_ECHO in
+*'\\\$0 --fallback-echo"') lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\$0 --fallback-echo"\$/\$0 --fallback-echo"/'\`
+ ;;
+esac
+
+ac_aux_dir='$ac_aux_dir'
+xsi_shell='$xsi_shell'
+lt_shell_append='$lt_shell_append'
+
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+
+ PACKAGE='$PACKAGE'
+ VERSION='$VERSION'
+ TIMESTAMP='$TIMESTAMP'
+ RM='$RM'
+ ofile='$ofile'
+
+
+
+
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# Handling of arguments.
for ac_config_target in $ac_config_targets
@@ -24419,6 +15130,7 @@ do
case $ac_config_target in
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
"depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
+ "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
"include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;;
"include/fuse-lite/Makefile") CONFIG_FILES="$CONFIG_FILES include/fuse-lite/Makefile" ;;
@@ -24427,15 +15139,27 @@ do
"libntfs-3g/Makefile") CONFIG_FILES="$CONFIG_FILES libntfs-3g/Makefile" ;;
"libntfs-3g/libntfs-3g.pc") CONFIG_FILES="$CONFIG_FILES libntfs-3g/libntfs-3g.pc" ;;
"libntfs-3g/libntfs-3g.script.so") CONFIG_FILES="$CONFIG_FILES libntfs-3g/libntfs-3g.script.so" ;;
+ "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/ntfscmp.8") CONFIG_FILES="$CONFIG_FILES ntfsprogs/ntfscmp.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/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" ;;
"src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;;
"src/ntfs-3g.8") CONFIG_FILES="$CONFIG_FILES src/ntfs-3g.8" ;;
"src/ntfs-3g.probe.8") CONFIG_FILES="$CONFIG_FILES src/ntfs-3g.probe.8" ;;
"src/ntfs-3g.usermap.8") CONFIG_FILES="$CONFIG_FILES src/ntfs-3g.usermap.8" ;;
"src/ntfs-3g.secaudit.8") CONFIG_FILES="$CONFIG_FILES src/ntfs-3g.secaudit.8" ;;
- *) { { 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; }; };;
+ *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5 ;;
esac
done
@@ -24462,7 +15186,7 @@ $debug ||
trap 'exit_status=$?
{ test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
' 0
- trap '{ (exit 1); exit 1; }' 1 2 13 15
+ trap 'as_fn_exit 1' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
@@ -24473,281 +15197,285 @@ $debug ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
-} ||
-{
- echo "$me: cannot create a temporary directory in ." >&2
- { (exit 1); exit 1; }
-}
+} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
-#
-# Set up the sed scripts for CONFIG_FILES section.
-#
-
-# No need to generate the scripts if there are no CONFIG_FILES.
-# This happens for instance when ./config.status config.h
+# Set up the scripts for CONFIG_FILES section.
+# No need to generate them if there are no CONFIG_FILES.
+# This happens for instance with `./config.status config.h'.
if test -n "$CONFIG_FILES"; then
-_ACEOF
-
-
-ac_delim='%!_!# '
-for ac_last_try in false false false false false :; do
- cat >conf$$subs.sed <<_ACEOF
-SHELL!$SHELL$ac_delim
-PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
-PACKAGE_NAME!$PACKAGE_NAME$ac_delim
-PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
-PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
-PACKAGE_STRING!$PACKAGE_STRING$ac_delim
-PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
-exec_prefix!$exec_prefix$ac_delim
-prefix!$prefix$ac_delim
-program_transform_name!$program_transform_name$ac_delim
-bindir!$bindir$ac_delim
-sbindir!$sbindir$ac_delim
-libexecdir!$libexecdir$ac_delim
-datarootdir!$datarootdir$ac_delim
-datadir!$datadir$ac_delim
-sysconfdir!$sysconfdir$ac_delim
-sharedstatedir!$sharedstatedir$ac_delim
-localstatedir!$localstatedir$ac_delim
-includedir!$includedir$ac_delim
-oldincludedir!$oldincludedir$ac_delim
-docdir!$docdir$ac_delim
-infodir!$infodir$ac_delim
-htmldir!$htmldir$ac_delim
-dvidir!$dvidir$ac_delim
-pdfdir!$pdfdir$ac_delim
-psdir!$psdir$ac_delim
-libdir!$libdir$ac_delim
-localedir!$localedir$ac_delim
-mandir!$mandir$ac_delim
-DEFS!$DEFS$ac_delim
-ECHO_C!$ECHO_C$ac_delim
-ECHO_N!$ECHO_N$ac_delim
-ECHO_T!$ECHO_T$ac_delim
-LIBS!$LIBS$ac_delim
-build_alias!$build_alias$ac_delim
-host_alias!$host_alias$ac_delim
-target_alias!$target_alias$ac_delim
-build!$build$ac_delim
-build_cpu!$build_cpu$ac_delim
-build_vendor!$build_vendor$ac_delim
-build_os!$build_os$ac_delim
-host!$host$ac_delim
-host_cpu!$host_cpu$ac_delim
-host_vendor!$host_vendor$ac_delim
-host_os!$host_os$ac_delim
-target!$target$ac_delim
-target_cpu!$target_cpu$ac_delim
-target_vendor!$target_vendor$ac_delim
-target_os!$target_os$ac_delim
-INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
-INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
-INSTALL_DATA!$INSTALL_DATA$ac_delim
-am__isrc!$am__isrc$ac_delim
-CYGPATH_W!$CYGPATH_W$ac_delim
-PACKAGE!$PACKAGE$ac_delim
-VERSION!$VERSION$ac_delim
-ACLOCAL!$ACLOCAL$ac_delim
-AUTOCONF!$AUTOCONF$ac_delim
-AUTOMAKE!$AUTOMAKE$ac_delim
-AUTOHEADER!$AUTOHEADER$ac_delim
-MAKEINFO!$MAKEINFO$ac_delim
-install_sh!$install_sh$ac_delim
-STRIP!$STRIP$ac_delim
-INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
-mkdir_p!$mkdir_p$ac_delim
-AWK!$AWK$ac_delim
-SET_MAKE!$SET_MAKE$ac_delim
-am__leading_dot!$am__leading_dot$ac_delim
-AMTAR!$AMTAR$ac_delim
-am__tar!$am__tar$ac_delim
-am__untar!$am__untar$ac_delim
-MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim
-MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim
-MAINT!$MAINT$ac_delim
-CC!$CC$ac_delim
-CFLAGS!$CFLAGS$ac_delim
-LDFLAGS!$LDFLAGS$ac_delim
-CPPFLAGS!$CPPFLAGS$ac_delim
-ac_ct_CC!$ac_ct_CC$ac_delim
-EXEEXT!$EXEEXT$ac_delim
-OBJEXT!$OBJEXT$ac_delim
-DEPDIR!$DEPDIR$ac_delim
-am__include!$am__include$ac_delim
-am__quote!$am__quote$ac_delim
-AMDEP_TRUE!$AMDEP_TRUE$ac_delim
-AMDEP_FALSE!$AMDEP_FALSE$ac_delim
-AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
-CCDEPMODE!$CCDEPMODE$ac_delim
-am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
-am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
-LN_S!$LN_S$ac_delim
-SED!$SED$ac_delim
-GREP!$GREP$ac_delim
-EGREP!$EGREP$ac_delim
-ECHO!$ECHO$ac_delim
-AR!$AR$ac_delim
-RANLIB!$RANLIB$ac_delim
-_ACEOF
-
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
- break
- elif $ac_last_try; then
- { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
- else
- ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
- fi
-done
-
-ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
-if test -n "$ac_eof"; then
- ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
- ac_eof=`expr $ac_eof + 1`
+ac_cr=`echo X | tr X '\015'`
+# On cygwin, bash can eat \r inside `` if the user requested igncr.
+# But we know of no other shell where ac_cr would be empty at this
+# point, so we can use a bashism as a fallback.
+if test "x$ac_cr" = x; then
+ eval ac_cr=\$\'\\r\'
+fi
+ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
+if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
+ ac_cs_awk_cr='\\r'
+else
+ ac_cs_awk_cr=$ac_cr
fi
-cat >>$CONFIG_STATUS <<_ACEOF
-cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-_ACEOF
-sed '
-s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
-s/^/s,@/; s/!/@,|#_!!_#|/
-:n
-t n
-s/'"$ac_delim"'$/,g/; t
-s/$/\\/; p
-N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
-' >>$CONFIG_STATUS <conf$$subs.sed
-rm -f conf$$subs.sed
-cat >>$CONFIG_STATUS <<_ACEOF
-CEOF$ac_eof
+echo 'BEGIN {' >"$tmp/subs1.awk" &&
_ACEOF
+{
+ echo "cat >conf$$subs.awk <<_ACEOF" &&
+ echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
+ echo "_ACEOF"
+} >conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
- cat >conf$$subs.sed <<_ACEOF
-DSYMUTIL!$DSYMUTIL$ac_delim
-NMEDIT!$NMEDIT$ac_delim
-CPP!$CPP$ac_delim
-CXX!$CXX$ac_delim
-CXXFLAGS!$CXXFLAGS$ac_delim
-ac_ct_CXX!$ac_ct_CXX$ac_delim
-CXXDEPMODE!$CXXDEPMODE$ac_delim
-am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim
-am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim
-CXXCPP!$CXXCPP$ac_delim
-F77!$F77$ac_delim
-FFLAGS!$FFLAGS$ac_delim
-ac_ct_F77!$ac_ct_F77$ac_delim
-LIBTOOL!$LIBTOOL$ac_delim
-MV!$MV$ac_delim
-RM!$RM$ac_delim
-LDCONFIG!$LDCONFIG$ac_delim
-PKG_CONFIG!$PKG_CONFIG$ac_delim
-FUSE_MODULE_CFLAGS!$FUSE_MODULE_CFLAGS$ac_delim
-FUSE_MODULE_LIBS!$FUSE_MODULE_LIBS$ac_delim
-LIBOBJS!$LIBOBJS$ac_delim
-pkgconfigdir!$pkgconfigdir$ac_delim
-ntfs3gincludedir!$ntfs3gincludedir$ac_delim
-rootbindir!$rootbindir$ac_delim
-rootsbindir!$rootsbindir$ac_delim
-rootlibdir!$rootlibdir$ac_delim
-LIBNTFS_3G_VERSION!$LIBNTFS_3G_VERSION$ac_delim
-LIBFUSE_LITE_LIBS!$LIBFUSE_LITE_LIBS$ac_delim
-OUTPUT_FORMAT!$OUTPUT_FORMAT$ac_delim
-FUSE_INTERNAL_TRUE!$FUSE_INTERNAL_TRUE$ac_delim
-FUSE_INTERNAL_FALSE!$FUSE_INTERNAL_FALSE$ac_delim
-GENERATE_LDSCRIPT_TRUE!$GENERATE_LDSCRIPT_TRUE$ac_delim
-GENERATE_LDSCRIPT_FALSE!$GENERATE_LDSCRIPT_FALSE$ac_delim
-WINDOWS_TRUE!$WINDOWS_TRUE$ac_delim
-WINDOWS_FALSE!$WINDOWS_FALSE$ac_delim
-NTFS_DEVICE_DEFAULT_IO_OPS_TRUE!$NTFS_DEVICE_DEFAULT_IO_OPS_TRUE$ac_delim
-NTFS_DEVICE_DEFAULT_IO_OPS_FALSE!$NTFS_DEVICE_DEFAULT_IO_OPS_FALSE$ac_delim
-RUN_LDCONFIG_TRUE!$RUN_LDCONFIG_TRUE$ac_delim
-RUN_LDCONFIG_FALSE!$RUN_LDCONFIG_FALSE$ac_delim
-REALLYSTATIC_TRUE!$REALLYSTATIC_TRUE$ac_delim
-REALLYSTATIC_FALSE!$REALLYSTATIC_FALSE$ac_delim
-INSTALL_LIBRARY_TRUE!$INSTALL_LIBRARY_TRUE$ac_delim
-INSTALL_LIBRARY_FALSE!$INSTALL_LIBRARY_FALSE$ac_delim
-ENABLE_MOUNT_HELPER_TRUE!$ENABLE_MOUNT_HELPER_TRUE$ac_delim
-ENABLE_MOUNT_HELPER_FALSE!$ENABLE_MOUNT_HELPER_FALSE$ac_delim
-MKDIR_P!$MKDIR_P$ac_delim
-LTLIBOBJS!$LTLIBOBJS$ac_delim
-_ACEOF
+ . ./conf$$subs.sh ||
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
- if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 47; then
+ ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
+ if test $ac_delim_n = $ac_delim_num; then
break
elif $ac_last_try; then
- { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
- { (exit 1); exit 1; }; }
+ as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
+rm -f conf$$subs.sh
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>"\$tmp/subs1.awk" <<\\_ACAWK &&
+_ACEOF
+sed -n '
+h
+s/^/S["/; s/!.*/"]=/
+p
+g
+s/^[^!]*!//
+:repl
+t repl
+s/'"$ac_delim"'$//
+t delim
+:nl
+h
+s/\(.\{148\}\)..*/\1/
+t more1
+s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
+p
+n
+b repl
+:more1
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t nl
+:delim
+h
+s/\(.\{148\}\)..*/\1/
+t more2
+s/["\\]/\\&/g; s/^/"/; s/$/"/
+p
+b
+:more2
+s/["\\]/\\&/g; s/^/"/; s/$/"\\/
+p
+g
+s/.\{148\}//
+t delim
+' <conf$$subs.awk | sed '
+/^[^""]/{
+ N
+ s/\n//
+}
+' >>$CONFIG_STATUS || ac_write_fail=1
+rm -f conf$$subs.awk
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+_ACAWK
+cat >>"\$tmp/subs1.awk" <<_ACAWK &&
+ for (key in S) S_is_set[key] = 1
+ FS = ""
-ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
-if test -n "$ac_eof"; then
- ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
- ac_eof=`expr $ac_eof + 1`
-fi
+}
+{
+ line = $ 0
+ nfields = split(line, field, "@")
+ substed = 0
+ len = length(field[1])
+ for (i = 2; i < nfields; i++) {
+ key = field[i]
+ keylen = length(key)
+ if (S_is_set[key]) {
+ value = S[key]
+ line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
+ len += length(value) + length(field[++i])
+ substed = 1
+ } else
+ len += 1 + keylen
+ }
+
+ print line
+}
-cat >>$CONFIG_STATUS <<_ACEOF
-cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACAWK
_ACEOF
-sed '
-s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
-s/^/s,@/; s/!/@,|#_!!_#|/
-:n
-t n
-s/'"$ac_delim"'$/,g/; t
-s/$/\\/; p
-N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
-' >>$CONFIG_STATUS <conf$$subs.sed
-rm -f conf$$subs.sed
-cat >>$CONFIG_STATUS <<_ACEOF
-:end
-s/|#_!!_#|//g
-CEOF$ac_eof
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
+ sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
+else
+ cat
+fi < "$tmp/subs1.awk" > "$tmp/subs.awk" \
+ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
_ACEOF
-
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
+# ${srcdir} and @srcdir@ entries 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/
+ ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
+h
+s///
+s/^/:/
+s/[ ]*$/:/
+s/:\$(srcdir):/:/g
+s/:\${srcdir}:/:/g
+s/:@srcdir@:/:/g
+s/^:*//
s/:*$//
+x
+s/\(=[ ]*\).*/\1/
+G
+s/\n//
s/^[^=]*=[ ]*$//
}'
fi
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
fi # test -n "$CONFIG_FILES"
+# Set up the scripts for CONFIG_HEADERS section.
+# No need to generate them if there are no CONFIG_HEADERS.
+# This happens for instance with `./config.status Makefile'.
+if test -n "$CONFIG_HEADERS"; then
+cat >"$tmp/defines.awk" <<\_ACAWK ||
+BEGIN {
+_ACEOF
-for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS
+# Transform confdefs.h into an awk script `defines.awk', embedded as
+# here-document in config.status, that substitutes the proper values into
+# config.h.in to produce config.h.
+
+# Create a delimiter string that does not exist in confdefs.h, to ease
+# handling of long lines.
+ac_delim='%!_!# '
+for ac_last_try in false false :; do
+ ac_t=`sed -n "/$ac_delim/p" confdefs.h`
+ if test -z "$ac_t"; then
+ break
+ elif $ac_last_try; then
+ as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+ else
+ ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
+ fi
+done
+
+# For the awk script, D is an array of macro values keyed by name,
+# likewise P contains macro parameters if any. Preserve backslash
+# newline sequences.
+
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+sed -n '
+s/.\{148\}/&'"$ac_delim"'/g
+t rset
+:rset
+s/^[ ]*#[ ]*define[ ][ ]*/ /
+t def
+d
+:def
+s/\\$//
+t bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3"/p
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
+d
+:bsnl
+s/["\\]/\\&/g
+s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
+D["\1"]=" \3\\\\\\n"\\/p
+t cont
+s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
+t cont
+d
+:cont
+n
+s/.\{148\}/&'"$ac_delim"'/g
+t clear
+:clear
+s/\\$//
+t bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/"/p
+d
+:bsnlc
+s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
+b cont
+' <confdefs.h | sed '
+s/'"$ac_delim"'/"\\\
+"/g' >>$CONFIG_STATUS || ac_write_fail=1
+
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ for (key in D) D_is_set[key] = 1
+ FS = ""
+}
+/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
+ line = \$ 0
+ split(line, arg, " ")
+ if (arg[1] == "#") {
+ defundef = arg[2]
+ mac1 = arg[3]
+ } else {
+ defundef = substr(arg[1], 2)
+ mac1 = arg[2]
+ }
+ split(mac1, mac2, "(") #)
+ macro = mac2[1]
+ prefix = substr(line, 1, index(line, defundef) - 1)
+ if (D_is_set[macro]) {
+ # Preserve the white space surrounding the "#".
+ print prefix "define", macro P[macro] D[macro]
+ next
+ } else {
+ # Replace #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.
+ if (defundef == "undef") {
+ print "/*", prefix defundef, macro, "*/"
+ next
+ }
+ }
+}
+{ print }
+_ACAWK
+_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+ as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
+fi # test -n "$CONFIG_HEADERS"
+
+
+eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS"
+shift
+for ac_tag
do
case $ac_tag in
:[FHLC]) ac_mode=$ac_tag; continue;;
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
- :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
-echo "$as_me: error: Invalid tag $ac_tag." >&2;}
- { (exit 1); exit 1; }; };;
+ :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5 ;;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
@@ -24775,26 +15503,34 @@ echo "$as_me: error: Invalid tag $ac_tag." >&2;}
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
- { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-echo "$as_me: error: cannot find input file: $ac_f" >&2;}
- { (exit 1); exit 1; }; };;
+ as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5 ;;
esac
- ac_file_inputs="$ac_file_inputs $ac_f"
+ case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
+ as_fn_append ac_file_inputs " '$ac_f'"
done
# 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. */
- configure_input="Generated from "`IFS=:
- echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
+ configure_input='Generated from '`
+ $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
+ `' by configure.'
if test x"$ac_file" != x-; then
configure_input="$ac_file. $configure_input"
- { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
+$as_echo "$as_me: creating $ac_file" >&6;}
fi
+ # Neutralize special characters interpreted by sed in replacement strings.
+ case $configure_input in #(
+ *\&* | *\|* | *\\* )
+ ac_sed_conf_input=`$as_echo "$configure_input" |
+ sed 's/[\\\\&|]/\\\\&/g'`;; #(
+ *) ac_sed_conf_input=$configure_input;;
+ esac
case $ac_tag in
- *:-:* | *:-) cat >"$tmp/stdin";;
+ *:-:* | *:-) cat >"$tmp/stdin" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
esac
;;
esac
@@ -24804,7 +15540,7 @@ $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" |
+$as_echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
@@ -24822,55 +15558,15 @@ echo X"$ac_file" |
q
}
s/.*/./; q'`
- { as_dir="$ac_dir"
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
- as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
-$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'`
- test -d "$as_dir" && break
- done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
- { (exit 1); exit 1; }; }; }
+ as_dir="$ac_dir"; as_fn_mkdir_p
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
- ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
+ ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
# A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
+ ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
@@ -24915,12 +15611,12 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
esac
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# If the template does not know about datarootdir, expand it.
# FIXME: This hack should be removed a few years after 2.60.
ac_datarootdir_hack=; ac_datarootdir_seen=
-
-case `sed -n '/datarootdir/ {
+ac_sed_dataroot='
+/datarootdir/ {
p
q
}
@@ -24928,36 +15624,37 @@ case `sed -n '/datarootdir/ {
/@docdir@/p
/@infodir@/p
/@localedir@/p
-/@mandir@/p
-' $ac_file_inputs` in
+/@mandir@/p'
+case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
*datarootdir*) ac_datarootdir_seen=yes;;
*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
- { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_datarootdir_hack='
s&@datadir@&$datadir&g
s&@docdir@&$docdir&g
s&@infodir@&$infodir&g
s&@localedir@&$localedir&g
s&@mandir@&$mandir&g
- s&\\\${datarootdir}&$datarootdir&g' ;;
+ s&\\\${datarootdir}&$datarootdir&g' ;;
esac
_ACEOF
# Neutralize VPATH when `$srcdir' = `.'.
# Shell code in configure.ac might set extrasub.
# FIXME: do we really want to maintain this feature?
-cat >>$CONFIG_STATUS <<_ACEOF
- sed "$ac_vpsub
+cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+ac_sed_extra="$ac_vpsub
$extrasub
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
+cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s&@configure_input@&$configure_input&;t t
+s|@configure_input@|$ac_sed_conf_input|;t t
s&@top_builddir@&$ac_top_builddir_sub&;t t
+s&@top_build_prefix@&$ac_top_build_prefix&;t t
s&@srcdir@&$ac_srcdir&;t t
s&@abs_srcdir@&$ac_abs_srcdir&;t t
s&@top_srcdir@&$ac_top_srcdir&;t t
@@ -24968,121 +15665,50 @@ s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
s&@INSTALL@&$ac_INSTALL&;t t
s&@MKDIR_P@&$ac_MKDIR_P&;t t
$ac_datarootdir_hack
-" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
+"
+eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$tmp/subs.awk" >$tmp/out \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
{ ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
{ ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
- { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&5
-echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined." >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&5
+$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined" >&2;}
rm -f "$tmp/stdin"
case $ac_file in
- -) cat "$tmp/out"; rm -f "$tmp/out";;
- *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
- esac
+ -) cat "$tmp/out" && rm -f "$tmp/out";;
+ *) rm -f "$ac_file" && mv "$tmp/out" "$ac_file";;
+ esac \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
;;
:H)
#
# CONFIG_HEADER
#
-_ACEOF
-
-# Transform confdefs.h into a sed script `conftest.defines', that
-# substitutes the proper values into config.h.in to produce config.h.
-rm -f conftest.defines conftest.tail
-# First, append a space to every undef/define line, to ease matching.
-echo 's/$/ /' >conftest.defines
-# Then, protect against being on the right side of a sed subst, or in
-# an unquoted here document, in config.status. If some macros were
-# called several times there might be several #defines for the same
-# symbol, which is useless. But do not sort them, since the last
-# AC_DEFINE must be honored.
-ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
-# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
-# NAME is the cpp macro being defined, VALUE is the value it is being given.
-# PARAMS is the parameter list in the macro definition--in most cases, it's
-# just an empty string.
-ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*'
-ac_dB='\\)[ (].*,\\1define\\2'
-ac_dC=' '
-ac_dD=' ,'
-
-uniq confdefs.h |
- sed -n '
- t rset
- :rset
- s/^[ ]*#[ ]*define[ ][ ]*//
- t ok
- d
- :ok
- s/[\\&,]/\\&/g
- s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
- s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
- ' >>conftest.defines
-
-# Remove the space that was appended to ease matching.
-# Then replace #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.
-# (The regexp can be short, since the line contains either #define or #undef.)
-echo 's/ $//
-s,^[ #]*u.*,/* & */,' >>conftest.defines
-
-# Break up conftest.defines:
-ac_max_sed_lines=50
-
-# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1"
-# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2"
-# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1"
-# et cetera.
-ac_in='$ac_file_inputs'
-ac_out='"$tmp/out1"'
-ac_nxt='"$tmp/out2"'
-
-while :
-do
- # Write a here document:
- cat >>$CONFIG_STATUS <<_ACEOF
- # First, check the format of the line:
- cat >"\$tmp/defines.sed" <<\\CEOF
-/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def
-/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def
-b
-:def
-_ACEOF
- sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
- echo 'CEOF
- sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
- ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
- sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
- grep . conftest.tail >/dev/null || break
- rm -f conftest.defines
- mv conftest.tail conftest.defines
-done
-rm -f conftest.defines conftest.tail
-
-echo "ac_result=$ac_in" >>$CONFIG_STATUS
-cat >>$CONFIG_STATUS <<\_ACEOF
if test x"$ac_file" != x-; then
- echo "/* $configure_input */" >"$tmp/config.h"
- cat "$ac_result" >>"$tmp/config.h"
- 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;}
+ {
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs"
+ } >"$tmp/config.h" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ if diff "$ac_file" "$tmp/config.h" >/dev/null 2>&1; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
+$as_echo "$as_me: $ac_file is unchanged" >&6;}
else
- rm -f $ac_file
- mv "$tmp/config.h" $ac_file
+ rm -f "$ac_file"
+ mv "$tmp/config.h" "$ac_file" \
+ || as_fn_error $? "could not create $ac_file" "$LINENO" 5
fi
else
- echo "/* $configure_input */"
- cat "$ac_result"
+ $as_echo "/* $configure_input */" \
+ && eval '$AWK -f "$tmp/defines.awk"' "$ac_file_inputs" \
+ || as_fn_error $? "could not create -" "$LINENO" 5
fi
- rm -f "$tmp/out12"
-# Compute $ac_file's index in $config_headers.
-_am_arg=$ac_file
+# Compute "$ac_file"'s index in $config_headers.
+_am_arg="$ac_file"
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
@@ -25097,7 +15723,7 @@ $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$_am_arg" : 'X\(//\)[^/]' \| \
X"$_am_arg" : 'X\(//\)$' \| \
X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$_am_arg" |
+$as_echo X"$_am_arg" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
@@ -25117,30 +15743,40 @@ echo X"$_am_arg" |
s/.*/./; q'`/stamp-h$_am_stamp_count
;;
- :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5
-echo "$as_me: executing $ac_file commands" >&6;}
+ :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
+$as_echo "$as_me: executing $ac_file commands" >&6;}
;;
esac
case $ac_file$ac_mode in
- "depfiles":C) 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.
- # Grep'ing the whole file is not good either: AIX grep has a line
- # limit of 2048, but all sed's we know have understand at least 4000.
- if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
- dirpart=`$as_dirname -- "$mf" ||
+ "depfiles":C) test x"$AMDEP_TRUE" != x"" || {
+ # Autoconf 2.62 quotes --file arguments for eval, but not when files
+ # are listed without --file. Let's play safe and only enable the eval
+ # if we detect the quoting.
+ case $CONFIG_FILES in
+ *\'*) eval set x "$CONFIG_FILES" ;;
+ *) set x $CONFIG_FILES ;;
+ esac
+ shift
+ for mf
+ 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.
+ # Grep'ing the whole file is not good either: AIX grep has a line
+ # limit of 2048, but all sed's we know have understand at least 4000.
+ if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then
+ dirpart=`$as_dirname -- "$mf" ||
$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$mf" : 'X\(//\)[^/]' \| \
X"$mf" : 'X\(//\)$' \| \
X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$mf" |
+$as_echo X"$mf" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
@@ -25158,33 +15794,33 @@ echo X"$mf" |
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=`$as_dirname -- "$file" ||
+ 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_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$file" : 'X\(//\)[^/]' \| \
X"$file" : 'X\(//\)$' \| \
X"$file" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$file" |
+$as_echo X"$file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
@@ -25202,62 +15838,660 @@ echo X"$file" |
q
}
s/.*/./; q'`
- { as_dir=$dirpart/$fdir
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
- as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
-$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'`
- test -d "$as_dir" && break
+ as_dir=$dirpart/$fdir; as_fn_mkdir_p
+ # echo "creating $dirpart/$file"
+ echo '# dummy' > "$dirpart/$file"
done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
- { (exit 1); exit 1; }; }; }
- # echo "creating $dirpart/$file"
- echo '# dummy' > "$dirpart/$file"
done
-done
+}
+ ;;
+ "libtool":C)
+
+ # 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
+
+ cfgfile="${ofile}T"
+ trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+ $RM "$cfgfile"
+
+ cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+
+
+# The names of the tagged configurations supported by this script.
+available_tags=""
+
+# ### BEGIN LIBTOOL CONFIG
+
+# Which release of libtool.m4 was used?
+macro_version=$macro_version
+macro_revision=$macro_revision
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# What type of objects to build.
+pic_mode=$pic_mode
+
+# 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
+
+# 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 1s/^X//"
+
+# A grep program that handles long lines.
+GREP=$lt_GREP
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# A literal string matcher.
+FGREP=$lt_FGREP
+
+# A BSD- or MS-compatible name lister.
+NM=$lt_NM
+
+# Whether we need soft or hard links.
+LN_S=$lt_LN_S
+
+# What is the maximum length of a command?
+max_cmd_len=$max_cmd_len
+
+# Object file suffix (normally "o").
+objext=$ac_objext
+
+# Executable file suffix (normally "").
+exeext=$exeext
+
+# whether the shell understands "unset".
+lt_unset=$lt_unset
+
+# turn spaces into newlines.
+SP2NL=$lt_lt_SP2NL
+
+# turn newlines into spaces.
+NL2SP=$lt_lt_NL2SP
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# An object symbol dumper.
+OBJDUMP=$lt_OBJDUMP
+
+# 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
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A symbol stripping program.
+STRIP=$lt_STRIP
+
+# Commands used to install an old-style archive.
+RANLIB=$lt_RANLIB
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# A C compiler.
+LTCC=$lt_CC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_CFLAGS
+
+# 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
+
+# Transform the output of nm in a C name address pair when lib prefix is needed.
+global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# An echo program that does not interpret backslashes.
+ECHO=$lt_ECHO
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=$MAGIC_CMD
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
+DSYMUTIL=$lt_DSYMUTIL
+
+# Tool to change global to local symbols on Mac OS X.
+NMEDIT=$lt_NMEDIT
+
+# Tool to manipulate fat objects and archives on Mac OS X.
+LIPO=$lt_LIPO
+
+# ldd/readelf like tool for Mach-O binaries on Mac OS X.
+OTOOL=$lt_OTOOL
+
+# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
+OTOOL64=$lt_OTOOL64
+
+# Old archive suffix (normally "a").
+libext=$libext
+
+# Shared library suffix (normally ".so").
+shrext_cmds=$lt_shrext_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink=$lt_variables_saved_for_relink
+
+# 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
+
+# Library versioning type.
+version_type=$version_type
+
+# Shared library runtime path variable.
+runpath_var=$runpath_var
+
+# Shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# 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
+
+# Command to use after installation of a shared archive.
+postinstall_cmds=$lt_postinstall_cmds
+
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=$lt_finish_eval
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# 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
+
+# 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
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+
+# The linker used to build libraries.
+LD=$lt_LD
+
+# Commands used to build an old-style archive.
+old_archive_cmds=$lt_old_archive_cmds
+
+# A language specific compiler.
+CC=$lt_compiler
+
+# Is the compiler the GNU compiler?
+with_gcc=$GCC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# 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
+
+# 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
+
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object=$lt_compiler_needs_object
+
+# 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 a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Whether we are building with GNU ld or not.
+with_gnu_ld=$lt_with_gnu_ld
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# 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 DIR/libNAME\${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting \${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=$hardcode_direct_absolute
+
+# 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
+
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=$inherit_rpath
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_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
+
+# 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
+
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=$lt_prelink_cmds
+
+# Specify filename containing input files.
+file_list_spec=$lt_file_list_spec
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+ case $host_os in
+ aix3*)
+ cat <<\_LT_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
+_LT_EOF
+ ;;
+ esac
+
+
+ltmain="$ac_aux_dir/ltmain.sh"
+
+
+ # 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 '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ case $xsi_shell in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result="${1##*/}"
+}
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+# dirname: Compute the dirname of FILE. If nonempty,
+# add APPEND to the result, otherwise set result
+# to NONDIR_REPLACEMENT.
+# value returned in "$func_dirname_result"
+# basename: Compute filename of FILE.
+# value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+ func_basename_result="${1##*/}"
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+ # positional parameters, so assign one to ordinary parameter first.
+ func_stripname_result=${3}
+ func_stripname_result=${func_stripname_result#"${1}"}
+ func_stripname_result=${func_stripname_result%"${2}"}
+}
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=${1%%=*}
+ func_opt_split_arg=${1#*=}
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ case ${1} in
+ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+ *) func_lo2o_result=${1} ;;
+ esac
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=${1%.*}.lo
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=$(( $* ))
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=${#1}
+}
+
+_LT_EOF
+ ;;
+ *) # Bourne compatible functions.
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ # Extract subdirectory from the argument.
+ func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
+
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "X${3}" \
+ | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "X${3}" \
+ | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
+ esac
+}
+
+# sed scripts:
+my_sed_long_opt='1s/^\(-[^=]*\)=.*/\1/;q'
+my_sed_long_arg='1s/^-[^=]*=//'
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
+ func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[^.]*$/.lo/'`
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=`expr "$@"`
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
+}
+
+_LT_EOF
+esac
+
+case $lt_shell_append in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$1+=\$2"
+}
+_LT_EOF
+ ;;
+ *)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$1=\$$1\$2"
+}
+
+_LT_EOF
+ ;;
+ esac
+
+
+ sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ mv -f "$cfgfile" "$ofile" ||
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+
;;
esac
done # for ac_tag
-{ (exit 0); exit 0; }
+as_fn_exit 0
_ACEOF
-chmod +x $CONFIG_STATUS
ac_clean_files=$ac_clean_files_save
+test $ac_write_fail = 0 ||
+ as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
+
# configure is writing to config.log, and then calls config.status.
# config.status does its own redirection, appending to config.log.
@@ -25277,7 +16511,11 @@ if test "$no_create" != yes; then
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; }
+ $ac_cs_success || as_fn_exit 1
+fi
+if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
+$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
fi
diff --git a/configure.ac b/configure.ac
index 2b578af..830c5fb 100755
--- a/configure.ac
+++ b/configure.ac
@@ -2,7 +2,8 @@
# configure.ac - Source file to generate "./configure" to prepare package for
# compilation.
#
-# Copyright (c) 2000-2006 Anton Altaparmakov
+# Copyright (c) 2000-2013 Anton Altaparmakov
+# Copyright (c) 2003 Jan Kratochvil
# Copyright (c) 2005-2009 Szabolcs Szakacsits
# Copyright (C) 2007-2008 Alon Bar-Lev
#
@@ -23,8 +24,8 @@
# Autoconf
AC_PREREQ(2.59)
-AC_INIT([ntfs-3g],[2010.5.16],[ntfs-3g-devel@lists.sf.net])
-LIBNTFS_3G_VERSION="76"
+AC_INIT([ntfs-3g],[2014.2.15],[ntfs-3g-devel@lists.sf.net])
+LIBNTFS_3G_VERSION="85"
AC_CONFIG_SRCDIR([src/ntfs-3g.c])
# Environment
@@ -114,6 +115,13 @@ AC_ARG_ENABLE(
)
AC_ARG_ENABLE(
+ [xattr-mappings],
+ [AS_HELP_STRING([--enable-xattr-mappings],[enable system extended attributes mappings])],
+ ,
+ [enable_xattr_mappings="no"]
+)
+
+AC_ARG_ENABLE(
[device-default-io-ops],
[AS_HELP_STRING([--disable-device-default-io-ops],[install default IO ops])],
,
@@ -121,6 +129,35 @@ AC_ARG_ENABLE(
)
AC_ARG_ENABLE(
+ [ntfs-3g],
+ [AS_HELP_STRING([--disable-ntfs-3g],[disable the ntfs-3g FUSE driver])],
+ ,
+ [enable_ntfs_3g="yes"]
+)
+
+AC_ARG_ENABLE(
+ [ntfsprogs],
+ [AS_HELP_STRING([--disable-ntfsprogs],[disable ntfsprogs utilities
+ (default=no)])],
+ ,
+ [enable_ntfsprogs="yes"]
+)
+
+AC_ARG_ENABLE(crypto,
+ AS_HELP_STRING(--enable-crypto,enable crypto related code and utilities
+ (default=no)), ,
+ enable_crypto=no
+)
+
+AC_ARG_ENABLE(
+ [extras],
+ [AS_HELP_STRING([--enable-extras],[enable extra ntfsprogs utilities
+ (default=no)])],
+ ,
+ [enable_extras="no"]
+)
+
+AC_ARG_ENABLE(
[nfconv],
[AS_HELP_STRING([--disable-nfconv],[disable the 'nfconv' patch, which adds support for Unicode normalization form conversion when built on Mac OS X @<:@default=enabled for Mac OS X@:>@])],
[enable_nfconv="no"],
@@ -146,6 +183,9 @@ ifdef(
[AC_PROG_LIBTOOL]
)
+AC_PROG_INSTALL
+PKG_PROG_PKG_CONFIG
+
AC_PATH_PROG([MV], [mv])
AC_PATH_PROG([RM], [rm])
AC_PATH_PROG([SED], [sed])
@@ -170,27 +210,31 @@ case "${target}" in
;;
esac
-AC_MSG_CHECKING([fuse compatibility])
-case "${target_os}" in
-linux*)
- AC_ARG_WITH(
- [fuse],
- [AS_HELP_STRING([--with-fuse=<internal|external>],[Select FUSE library: internal or external @<:@default=internal@:>@])],
- ,
- [with_fuse="internal"]
- )
- ;;
-darwin*|netbsd*|solaris*)
- with_fuse="external"
- ;;
-freebsd*)
- AC_MSG_ERROR([Please see FreeBSD support at http://www.freshports.org/sysutils/fusefs-ntfs])
- ;;
-*)
- AC_MSG_ERROR([ntfs-3g can be built for Linux, FreeBSD, Mac OS X, NetBSD, and Solaris only.])
- ;;
-esac
-AC_MSG_RESULT([${with_fuse}])
+if test "x${enable_ntfs_3g}" = "xyes"; then
+ AC_MSG_CHECKING([fuse compatibility])
+ case "${target_os}" in
+ linux*|solaris*)
+ AC_ARG_WITH(
+ [fuse],
+ [AS_HELP_STRING([--with-fuse=<internal|external>],[Select FUSE library: internal or external @<:@default=internal@:>@])],
+ ,
+ [with_fuse="internal"]
+ )
+ ;;
+ darwin*|netbsd*|kfreebsd*-gnu)
+ with_fuse="external"
+ ;;
+ freebsd*)
+ AC_MSG_ERROR([Please see FreeBSD support at http://www.freshports.org/sysutils/fusefs-ntfs])
+ ;;
+ *)
+ AC_MSG_ERROR([ntfs-3g can be built for Linux, FreeBSD, Mac OS X, NetBSD, and Solaris only.])
+ ;;
+ esac
+ AC_MSG_RESULT([${with_fuse}])
+else
+ with_fuse="none"
+fi
case "${target_os}" in
solaris*)
@@ -230,7 +274,28 @@ if test "${with_fuse}" = "internal"; then
[1],
[Define to 1 if using internal fuse]
)
-else
+
+ AC_MSG_CHECKING([Solaris OS])
+ AC_LANG_PUSH([C])
+ AC_COMPILE_IFELSE(
+ [
+ AC_LANG_SOURCE(
+ [[#if !((defined(sun) || defined(__sun)) && (defined(__SVR4) || defined(__svr4__)))]]
+ [[#error "Not a Solaris system."]]
+ [[#endif]]
+ )
+ ],
+ [
+ AC_MSG_RESULT([yes])
+ LIBFUSE_LITE_CFLAGS="${LIBFUSE_LITE_CFLAGS} -std=c99 -D__SOLARIS__ -D_XOPEN_SOURCE=600 -D__EXTENSIONS__"
+ LIBFUSE_LITE_LIBS="${LIBFUSE_LITE_LIBS} -lxnet"
+ ],
+ [
+ AC_MSG_RESULT([no])
+ ]
+ )
+ AC_LANG_POP([C])
+elif test "${with_fuse}" = "external"; then
if test -z "$PKG_CONFIG"; then
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
fi
@@ -249,15 +314,156 @@ else
FUSE_LIB_PATH=`$PKG_CONFIG --libs-only-L fuse | sed -e 's,/[/]*,/,g' -e 's,[ ]*$,,'`
fi
+# Autodetect whether we can build crypto stuff or not.
+compile_crypto=false
+if test "$enable_crypto" != "no"; then
+ have_libgcrypt=false
+ AM_PATH_LIBGCRYPT(1.2.2, [ have_libgcrypt=true ],
+ [
+ if test "$enable_crypto" = "yes"; then
+ AC_MSG_ERROR([ntfsprogs crypto code requires the gcrypt library.])
+ else
+ AC_MSG_WARN([ntfsprogs crypto code requires the gcrypt library.])
+ fi
+ ])
+ have_libgnutls=false
+ PKG_CHECK_MODULES(GNUTLS, gnutls >= 1.4.4, [ have_libgnutls=true ],
+ if test "$enable_crypto" = "yes"; then
+ AC_MSG_ERROR([ntfsprogs crypto code requires the gnutls library.])
+ else
+ AC_MSG_WARN([ntfsprogs crypto code requires the gnutls library.])
+ fi
+ )
+ if test "$have_libgcrypt" = "true"; then
+ if test "$have_libgnutls" = "true"; then
+ compile_crypto=true
+ AC_DEFINE([ENABLE_CRYPTO], 1,
+ [Define this to 1 if you want to enable support of
+ encrypted files in libntfs and utilities.])
+ fi
+ 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"
+AC_SUBST(all_includes)
+AC_SUBST(all_libraries)
+
+# Specify support for generating DCE compliant UUIDs (aka GUIDs). We check if
+# uuid/uuid.h header is present and the uuid library is present that goes with
+# it and then check if uuid_generate() is present and usable.
+#
+# DCE UUIDs are enabled by default and can be disabled with the --disable-uuid
+# option to the configure script.
+AC_ARG_WITH(uuid, [
+ --with-uuid@<:@=PFX@:>@ generate DCE compliant UUIDs, with optional prefix
+ to uuid library and headers @<:@default=detect@:>@
+ --without-uuid do not generate DCE compliant UUIDs],
+ if test "$with_uuid" = "yes"; then
+ extrapath=default
+ elif test "$with_uuid" = "no"; then
+ extrapath=
+ else
+ extrapath=$with_uuid
+ fi,
+ extrapath=default
+)
+if test "x$extrapath" != "x"; then
+ if test "x$extrapath" != "xdefault"; then
+ MKNTFS_CPPFLAGS="$MKNTFS_CPPFLAGS -I$extrapath/include"
+ MKNTFS_LIBS="$MKNTFS_LIBS -L$extrapath/lib"
+ fi
+
+ search_for_luuid="yes"
+ AC_CHECK_HEADER([uuid/uuid.h],
+ [],
+ [
+ AC_MSG_WARN([ntfsprogs DCE compliant UUID generation code requires the uuid library.])
+ search_for_luuid="no"
+ ],
+ )
+
+ if test "x$search_for_luuid" != "xno"; then
+ # Look for uuid_generate in the standard C library.
+ AC_CHECK_FUNC([uuid_generate],
+ [
+ AC_DEFINE([ENABLE_UUID], 1,
+ [Define this to 1 if you want to enable
+ generation of DCE compliant UUIDs.])
+ search_for_luuid="no"
+ ],
+ [],
+ )
+ fi
+
+ if test "x$search_for_luuid" != "xno"; then
+ # Look for uuid_generate in the 'uuid' library.
+ AC_CHECK_LIB([uuid], [uuid_generate],
+ [
+ AC_DEFINE([ENABLE_UUID], 1,
+ [Define this to 1 if you want to enable
+ generation of DCE compliant UUIDs.])
+ MKNTFS_LIBS="$MKNTFS_LIBS -luuid"
+ search_for_luuid="no"
+ ],
+ [],
+ )
+ fi
+
+ if test "x$search_for_luuid" != "xno"; then
+ AC_MSG_WARN([ntfsprogs DCE compliant UUID generation code requires the uuid library.])
+ fi
+fi
+
+# Specify support for obtaining the correct BIOS legacy geometry needed for
+# Windows to boot in CHS mode. We check if hd.h header is present and the hd
+# library is present that goes with it and then check if the hd_list() function
+# is present and usable.
+#
+# Using the hd library is enabled by default and can be disabled with the
+# --disable-hd option to the configure script.
+AC_ARG_WITH(hd, [
+ --with-hd@<:@=PFX@:>@ use Windows compliant disk geometry, with optional
+ prefix to hd library and headers @<:@default=detect@:>@
+ --without-hd do not use Windows compliant disk geometry],
+ if test "$with_hd" = "yes"; then
+ extrapath2=default
+ elif test "$with_hd" = "no"; then
+ extrapath2=
+ else
+ extrapath2=$with_hd
+ fi,
+ extrapath2=default
+)
+if test "x$extrapath2" != "x"; then
+ if test "x$extrapath2" != "xdefault"; then
+ LIBNTFS_CPPFLAGS="$LIBNTFS_CPPFLAGS -I$extrapath2/include"
+ LIBNTFS_LIBS="$LIBNTFS_LIBS -L$extrapath2/lib"
+ fi
+ AC_CHECK_HEADER([hd.h],
+ AC_CHECK_LIB([hd], [hd_list],
+ AC_DEFINE([ENABLE_HD], 1,
+ [Define this to 1 if you want to enable use of Windows
+ compliant disk geometry.])
+ LIBNTFS_LIBS="$LIBNTFS_LIBS -lhd"
+ NTFSPROGS_STATIC_LIBS="$NTFSPROGS_STATIC_LIBS -lhd",
+ AC_MSG_WARN([ntfsprogs Windows compliant geometry code requires the hd library.]),
+ ),
+ AC_MSG_WARN([ntfsprogs Windows compliant geometry code requires the hd library.]),
+ )
+fi
+
# Checks for header files.
AC_HEADER_STDC
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/mkdev.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 windows.h syslog.h])
+ regex.h endian.h byteswap.h sys/byteorder.h sys/disk.h sys/endian.h \
+ sys/param.h sys/ioctl.h sys/mkdev.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 windows.h syslog.h pwd.h malloc.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
@@ -273,6 +479,7 @@ AC_C_BIGENDIAN(
]
,
)
+AC_C_CONST
AC_C_INLINE
AC_TYPE_OFF_T
AC_TYPE_SIZE_T
@@ -314,7 +521,7 @@ AC_CHECK_FUNCS([ \
atexit basename daemon dup2 fdatasync ffs getopt_long hasmntopt \
mbsinit memmove memset realpath regcomp setlocale setxattr \
strcasecmp strchr strdup strerror strnlen strsep strtol strtoul \
- sysconf utime utimensat gettimeofday clock_gettime fork \
+ sysconf utime utimensat gettimeofday clock_gettime fork memcpy random snprintf \
])
AC_SYS_LARGEFILE
@@ -349,6 +556,7 @@ test "${enable_device_default_io_ops}" = "no" && AC_DEFINE(
test "${enable_mtab}" = "no" && AC_DEFINE([IGNORE_MTAB], [1], [Don't update /etc/mtab])
test "${enable_posix_acls}" != "no" && AC_DEFINE([POSIXACLS], [1], [POSIX ACL support])
+test "${enable_xattr_mappings}" != "no" && AC_DEFINE([XATTR_MAPPINGS], [1], [system extended attributes mappings])
test "${enable_really_static}" = "yes" && enable_library="no"
test "${enable_library}" = "no" && enable_ldconfig="no"
@@ -380,7 +588,13 @@ AC_SUBST([rootbindir])
AC_SUBST([rootsbindir])
AC_SUBST([rootlibdir])
AC_SUBST([LIBNTFS_3G_VERSION])
+AC_SUBST([LIBFUSE_LITE_CFLAGS])
AC_SUBST([LIBFUSE_LITE_LIBS])
+AC_SUBST([MKNTFS_CPPFLAGS])
+AC_SUBST([MKNTFS_LIBS])
+AC_SUBST([LIBNTFS_CPPFLAGS])
+AC_SUBST([LIBNTFS_LIBS])
+AC_SUBST([NTFSPROGS_STATIC_LIBS])
AC_SUBST([OUTPUT_FORMAT])
AM_CONDITIONAL([FUSE_INTERNAL], [test "${with_fuse}" = "internal"])
AM_CONDITIONAL([GENERATE_LDSCRIPT], [test "${enable_ldscript}" = "yes"])
@@ -390,6 +604,9 @@ AM_CONDITIONAL([RUN_LDCONFIG], [test "${enable_ldconfig}" = "yes"])
AM_CONDITIONAL([REALLYSTATIC], [test "${enable_really_static}" = "yes"])
AM_CONDITIONAL([INSTALL_LIBRARY], [test "${enable_library}" = "yes"])
AM_CONDITIONAL([ENABLE_MOUNT_HELPER], [test "${enable_mount_helper}" = "yes"])
+AM_CONDITIONAL([ENABLE_NTFS_3G], [test "${enable_ntfs_3g}" = "yes"])
+AM_CONDITIONAL([ENABLE_NTFSPROGS], [test "${enable_ntfsprogs}" = "yes"])
+AM_CONDITIONAL([ENABLE_EXTRAS], [test "${enable_extras}" = "yes"])
# workaround for <autoconf-2.60
if test -z "${docdir}"; then
@@ -412,6 +629,20 @@ AC_CONFIG_FILES([
libntfs-3g/Makefile
libntfs-3g/libntfs-3g.pc
libntfs-3g/libntfs-3g.script.so
+ ntfsprogs/Makefile
+ ntfsprogs/mkntfs.8
+ ntfsprogs/ntfscat.8
+ ntfsprogs/ntfsclone.8
+ ntfsprogs/ntfscluster.8
+ ntfsprogs/ntfscmp.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
src/Makefile
src/ntfs-3g.8
src/ntfs-3g.probe.8
diff --git a/depcomp b/depcomp
index e5f9736..df8eea7 100755
--- a/depcomp
+++ b/depcomp
@@ -1,10 +1,10 @@
#! /bin/sh
# depcomp - compile a program generating dependencies as side-effects
-scriptversion=2007-03-29.01
+scriptversion=2009-04-28.21; # UTC
-# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007 Free Software
-# Foundation, Inc.
+# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 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
@@ -17,9 +17,7 @@ scriptversion=2007-03-29.01
# 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., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -87,6 +85,15 @@ if test "$depmode" = dashXmstdout; then
depmode=dashmstdout
fi
+cygpath_u="cygpath -u -f -"
+if test "$depmode" = msvcmsys; then
+ # This is just like msvisualcpp but w/o cygpath translation.
+ # Just convert the backslash-escaped backslashes to single forward
+ # slashes to satisfy depend.m4
+ cygpath_u="sed s,\\\\\\\\,/,g"
+ depmode=msvisualcpp
+fi
+
case "$depmode" in
gcc3)
## gcc 3 implements dependency tracking that does exactly what
@@ -192,14 +199,14 @@ sgi)
' < "$tmpdepfile" \
| sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
tr '
-' ' ' >> $depfile
- echo >> $depfile
+' ' ' >> "$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
+ >> "$depfile"
else
# The sourcefile does not contain any dependencies, so just
# store a dummy comment line, to avoid errors with the Makefile
@@ -328,7 +335,12 @@ hp2)
if test -f "$tmpdepfile"; then
sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
# Add `dependent.h:' lines.
- sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile"
+ sed -ne '2,${
+ s/^ *//
+ s/ \\*$//
+ s/$/:/
+ p
+ }' "$tmpdepfile" >> "$depfile"
else
echo "#dummy" > "$depfile"
fi
@@ -404,7 +416,7 @@ dashmstdout)
# Remove the call to Libtool.
if test "$libtool" = yes; then
- while test $1 != '--mode=compile'; do
+ while test "X$1" != 'X--mode=compile'; do
shift
done
shift
@@ -455,32 +467,39 @@ makedepend)
"$@" || exit $?
# Remove any Libtool call
if test "$libtool" = yes; then
- while test $1 != '--mode=compile'; do
+ while test "X$1" != 'X--mode=compile'; do
shift
done
shift
fi
# X makedepend
shift
- cleared=no
- for arg in "$@"; do
+ cleared=no eat=no
+ for arg
+ do
case $cleared in
no)
set ""; shift
cleared=yes ;;
esac
+ if test $eat = yes; then
+ eat=no
+ continue
+ fi
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.
+ -arch)
+ eat=yes ;;
-*|$object)
;;
*)
set fnord "$@" "$arg"; shift ;;
esac
done
- obj_suffix="`echo $object | sed 's/^.*\././'`"
+ obj_suffix=`echo "$object" | sed 's/^.*\././'`
touch "$tmpdepfile"
${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
rm -f "$depfile"
@@ -500,7 +519,7 @@ cpp)
# Remove the call to Libtool.
if test "$libtool" = yes; then
- while test $1 != '--mode=compile'; do
+ while test "X$1" != 'X--mode=compile'; do
shift
done
shift
@@ -538,13 +557,27 @@ cpp)
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.
+ # always write the preprocessed file to stdout.
"$@" || exit $?
+
+ # Remove the call to Libtool.
+ if test "$libtool" = yes; then
+ while test "X$1" != 'X--mode=compile'; do
+ shift
+ done
+ shift
+ fi
+
IFS=" "
for arg
do
case "$arg" in
+ -o)
+ shift
+ ;;
+ $object)
+ shift
+ ;;
"-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
set fnord "$@"
shift
@@ -557,16 +590,23 @@ msvisualcpp)
;;
esac
done
- "$@" -E |
- sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
+ "$@" -E 2>/dev/null |
+ sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
rm -f "$depfile"
echo "$object : \\" > "$depfile"
- . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile"
echo " " >> "$depfile"
- . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
+ sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
rm -f "$tmpdepfile"
;;
+msvcmsys)
+ # 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
+ ;;
+
none)
exec "$@"
;;
@@ -585,5 +625,6 @@ exit 0
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
# End:
diff --git a/include/Makefile.in b/include/Makefile.in
index afadcc5..f8bebd8 100755
--- a/include/Makefile.in
+++ b/include/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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.
@@ -15,8 +16,9 @@
@SET_MAKE@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
@@ -35,12 +37,16 @@ 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__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
@@ -52,10 +58,38 @@ RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
ps-recursive uninstall-recursive
RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
distclean-recursive maintainer-clean-recursive
+AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
+ $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
+ distdir
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+am__relativize = \
+ dir0=`pwd`; \
+ sed_first='s,^\([^/]*\)/.*$$,\1,'; \
+ sed_rest='s,^[^/]*/*,,'; \
+ sed_last='s,^.*/\([^/]*\)$$,\1,'; \
+ sed_butlast='s,/*[^/]*$$,,'; \
+ while test -n "$$dir1"; do \
+ first=`echo "$$dir1" | sed -e "$$sed_first"`; \
+ if test "$$first" != "."; then \
+ if test "$$first" = ".."; then \
+ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
+ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
+ else \
+ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
+ if test "$$first2" = "$$first"; then \
+ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
+ else \
+ dir2="../$$dir2"; \
+ fi; \
+ dir0="$$dir0"/"$$first"; \
+ fi; \
+ fi; \
+ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
+ done; \
+ reldir="$$dir2"
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
AR = @AR@
@@ -68,54 +102,69 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FGREP = @FGREP@
FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@
FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
LDCONFIG = @LDCONFIG@
LDFLAGS = @LDFLAGS@
+LIBFUSE_LITE_CFLAGS = @LIBFUSE_LITE_CFLAGS@
LIBFUSE_LITE_LIBS = @LIBFUSE_LITE_LIBS@
+LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
LIBNTFS_3G_VERSION = @LIBNTFS_3G_VERSION@
+LIBNTFS_CPPFLAGS = @LIBNTFS_CPPFLAGS@
+LIBNTFS_LIBS = @LIBNTFS_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MKNTFS_CPPFLAGS = @MKNTFS_CPPFLAGS@
+MKNTFS_LIBS = @MKNTFS_LIBS@
MV = @MV@
+NM = @NM@
NMEDIT = @NMEDIT@
+NTFSPROGS_STATIC_LIBS = @NTFSPROGS_STATIC_LIBS@
+OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
OUTPUT_FORMAT = @OUTPUT_FORMAT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
RM = @RM@
SED = @SED@
@@ -128,8 +177,9 @@ abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+all_includes = @all_includes@
+all_libraries = @all_libraries@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -160,6 +210,7 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
ntfs3gincludedir = @ntfs3gincludedir@
@@ -181,6 +232,7 @@ target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
@@ -192,14 +244,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu include/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu include/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -217,6 +269,7 @@ $(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
+$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
@@ -231,7 +284,7 @@ clean-libtool:
# (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'; \
+ @fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
@@ -248,7 +301,7 @@ $(RECURSIVE_TARGETS):
else \
local_target="$$target"; \
fi; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
|| eval $$failcom; \
done; \
if test "$$dot_seen" = "no"; then \
@@ -256,7 +309,7 @@ $(RECURSIVE_TARGETS):
fi; test -z "$$fail"
$(RECURSIVE_CLEAN_TARGETS):
- @failcom='exit 1'; \
+ @fail= failcom='exit 1'; \
for f in x $$MAKEFLAGS; do \
case $$f in \
*=* | --[!k]*);; \
@@ -282,16 +335,16 @@ $(RECURSIVE_CLEAN_TARGETS):
else \
local_target="$$target"; \
fi; \
- (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ ($(am__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); \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@@ -299,14 +352,14 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
+ set x; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
@@ -318,7 +371,7 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
test ! -f $$subdir/TAGS || \
- tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
+ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@@ -327,29 +380,34 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
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; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
+ $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -370,29 +428,44 @@ distdir: $(DISTFILES)
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
- list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ @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 && \
+ fi; \
+ done
+ @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ if test "$$subdir" = .; then :; else \
+ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
+ $(am__relativize); \
+ new_distdir=$$reldir; \
+ dir1=$$subdir; dir2="$(top_distdir)"; \
+ $(am__relativize); \
+ new_top_distdir=$$reldir; \
+ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
+ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
+ ($(am__cd) $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$$top_distdir" \
- distdir="$$distdir/$$subdir" \
+ top_distdir="$$new_top_distdir" \
+ distdir="$$new_distdir" \
am__remove_distdir=: \
am__skip_length_check=: \
+ am__skip_mode_fix=: \
distdir) \
|| exit 1; \
fi; \
@@ -422,6 +495,7 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -441,6 +515,8 @@ dvi-am:
html: html-recursive
+html-am:
+
info: info-recursive
info-am:
@@ -449,18 +525,28 @@ install-data-am:
install-dvi: install-dvi-recursive
+install-dvi-am:
+
install-exec-am:
install-html: install-html-recursive
+install-html-am:
+
install-info: install-info-recursive
+install-info-am:
+
install-man:
install-pdf: install-pdf-recursive
+install-pdf-am:
+
install-ps: install-ps-recursive
+install-ps-am:
+
installcheck-am:
maintainer-clean: maintainer-clean-recursive
@@ -481,8 +567,8 @@ ps-am:
uninstall-am:
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \
- install-strip
+.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
+ install-am install-strip tags-recursive
.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
all all-am check check-am clean clean-generic clean-libtool \
@@ -498,6 +584,7 @@ uninstall-am:
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
uninstall uninstall-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/fuse-lite/Makefile.in b/include/fuse-lite/Makefile.in
index e9fece0..0949aeb 100755
--- a/include/fuse-lite/Makefile.in
+++ b/include/fuse-lite/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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.
@@ -16,8 +17,9 @@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
@@ -37,12 +39,16 @@ subdir = include/fuse-lite
DIST_COMMON = $(noinst_HEADERS) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
HEADERS = $(noinst_HEADERS)
@@ -61,54 +67,69 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FGREP = @FGREP@
FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@
FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
LDCONFIG = @LDCONFIG@
LDFLAGS = @LDFLAGS@
+LIBFUSE_LITE_CFLAGS = @LIBFUSE_LITE_CFLAGS@
LIBFUSE_LITE_LIBS = @LIBFUSE_LITE_LIBS@
+LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
LIBNTFS_3G_VERSION = @LIBNTFS_3G_VERSION@
+LIBNTFS_CPPFLAGS = @LIBNTFS_CPPFLAGS@
+LIBNTFS_LIBS = @LIBNTFS_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MKNTFS_CPPFLAGS = @MKNTFS_CPPFLAGS@
+MKNTFS_LIBS = @MKNTFS_LIBS@
MV = @MV@
+NM = @NM@
NMEDIT = @NMEDIT@
+NTFSPROGS_STATIC_LIBS = @NTFSPROGS_STATIC_LIBS@
+OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
OUTPUT_FORMAT = @OUTPUT_FORMAT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
RM = @RM@
SED = @SED@
@@ -121,8 +142,9 @@ abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+all_includes = @all_includes@
+all_libraries = @all_libraries@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -153,6 +175,7 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
ntfs3gincludedir = @ntfs3gincludedir@
@@ -174,6 +197,7 @@ target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = Makefile.in
@@ -192,14 +216,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/fuse-lite/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu include/fuse-lite/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/fuse-lite/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu include/fuse-lite/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -217,6 +241,7 @@ $(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
+$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
@@ -229,14 +254,14 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
+ set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -244,29 +269,34 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
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; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
+ $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -287,13 +317,17 @@ distdir: $(DISTFILES)
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@@ -321,6 +355,7 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -340,6 +375,8 @@ dvi-am:
html: html-am
+html-am:
+
info: info-am
info-am:
@@ -348,18 +385,28 @@ install-data-am:
install-dvi: install-dvi-am
+install-dvi-am:
+
install-exec-am:
install-html: install-html-am
+install-html-am:
+
install-info: install-info-am
+install-info-am:
+
install-man:
install-pdf: install-pdf-am
+install-pdf-am:
+
install-ps: install-ps-am
+install-ps-am:
+
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -395,6 +442,7 @@ uninstall-am:
mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
uninstall-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/fuse-lite/fuse.h b/include/fuse-lite/fuse.h
index 6e7087e..8e468a7 100755
--- a/include/fuse-lite/fuse.h
+++ b/include/fuse-lite/fuse.h
@@ -19,14 +19,10 @@
#include <fcntl.h>
#include <time.h>
#include <utime.h>
-#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
-#endif
-
#include <sys/stat.h>
-
#if HAVE_SYS_STATVFS_H
-#include <sys/statfs.h>
+#include <sys/statvfs.h>
#endif
#ifdef __cplusplus
@@ -191,9 +187,7 @@ struct fuse_operations {
* version 2.5
*/
#if HAVE_SYS_STATVFS_H
-
- int (*statfs) (const char *, struct statfs *);
-
+ int (*statfs) (const char *, struct statvfs *);
#endif
/** Possibly flush cached data
*
@@ -431,12 +425,6 @@ struct fuse_operations {
int (*bmap) (const char *, size_t blocksize, uint64_t *idx);
unsigned int flag_nullpath_ok : 1;
- /**
- * Flag indicating that the filesystem accepts special
- * UTIME_NOW and UTIME_OMIT values in its utimens operation.
- */
- unsigned int flag_utime_omit_ok : 1;
-
/**
* Reserved flags, don't set
*/
@@ -579,11 +567,9 @@ int fuse_fs_fsync(struct fuse_fs *fs, const char *path, int datasync,
struct fuse_file_info *fi);
int fuse_fs_flush(struct fuse_fs *fs, const char *path,
struct fuse_file_info *fi);
-
#if HAVE_SYS_STATVFS_H
-int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statfs *buf);
+int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statvfs *buf);
#endif
-
int fuse_fs_opendir(struct fuse_fs *fs, const char *path,
struct fuse_file_info *fi);
int fuse_fs_readdir(struct fuse_fs *fs, const char *path, void *buf,
@@ -637,6 +623,47 @@ void fuse_fs_destroy(struct fuse_fs *fs);
struct fuse_fs *fuse_fs_new(const struct fuse_operations *op, size_t op_size,
void *user_data);
+#ifdef __SOLARIS__
+
+/**
+ * Filesystem module
+ *
+ * Filesystem modules are registered with the FUSE_REGISTER_MODULE()
+ * macro.
+ *
+ * If the "-omodules=modname:..." option is present, filesystem
+ * objects are created and pushed onto the stack with the 'factory'
+ * function.
+ */
+struct fuse_module {
+ /**
+ * Name of filesystem
+ */
+ const char *name;
+
+ /**
+ * Factory for creating filesystem objects
+ *
+ * The function may use and remove options from 'args' that belong
+ * to this module.
+ *
+ * For now the 'fs' vector always contains exactly one filesystem.
+ * This is the filesystem which will be below the newly created
+ * filesystem in the stack.
+ *
+ * @param args the command line arguments
+ * @param fs NULL terminated filesystem object vector
+ * @return the new filesystem object
+ */
+ struct fuse_fs *(*factory)(struct fuse_args *args, struct fuse_fs *fs[]);
+
+ struct fuse_module *next;
+ struct fusemod_so *so;
+ int ctr;
+};
+
+#endif /* __SOLARIS__ */
+
/* ----------------------------------------------------------- *
* Advanced API for event handling, don't worry about this... *
* ----------------------------------------------------------- */
diff --git a/include/fuse-lite/fuse_common.h b/include/fuse-lite/fuse_common.h
index 819bb8d..69d3c97 100755
--- a/include/fuse-lite/fuse_common.h
+++ b/include/fuse-lite/fuse_common.h
@@ -32,6 +32,11 @@
#define FUSE_MAKE_VERSION(maj, min) ((maj) * 10 + (min))
#define FUSE_VERSION FUSE_MAKE_VERSION(FUSE_MAJOR_VERSION, FUSE_MINOR_VERSION)
+/* This interface uses 64 bit off_t */
+#if defined(__SOLARIS__) && !defined(__x86_64__) && (_FILE_OFFSET_BITS != 64)
+#error Please add -D_FILE_OFFSET_BITS=64 to your compile flags!
+#endif
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -43,6 +48,8 @@ extern "C" {
#define FUSE_CAP_DONT_MASK (1 << 6)
#endif
+#define FUSE_CAP_BIG_WRITES (1 << 5)
+
/**
* Information about open files
*
@@ -116,19 +123,12 @@ struct fuse_conn_info {
*/
unsigned max_readahead;
-#ifdef POSIXACLS
unsigned capable;
unsigned want;
/**
* For future use.
*/
unsigned reserved[25];
-#else
- /**
- * For future use.
- */
- unsigned reserved[27];
-#endif
};
struct fuse_session;
@@ -154,6 +154,41 @@ struct fuse_chan *fuse_mount(const char *mountpoint, struct fuse_args *args);
*/
void fuse_unmount(const char *mountpoint, struct fuse_chan *ch);
+#ifdef __SOLARIS__
+/**
+ * Parse common options
+ *
+ * The following options are parsed:
+ *
+ * '-f' foreground
+ * '-d' '-odebug' foreground, but keep the debug option
+ * '-s' single threaded
+ * '-h' '--help' help
+ * '-ho' help without header
+ * '-ofsname=..' file system name, if not present, then set to the program
+ * name
+ *
+ * All parameters may be NULL
+ *
+ * @param args argument vector
+ * @param mountpoint the returned mountpoint, should be freed after use
+ * @param multithreaded set to 1 unless the '-s' option is present
+ * @param foreground set to 1 if one of the relevant options is present
+ * @return 0 on success, -1 on failure
+ */
+int fuse_parse_cmdline(struct fuse_args *args, char **mountpoint,
+ int *multithreaded, int *foreground);
+
+/**
+ * Go into the background
+ *
+ * @param foreground if true, stay in the foreground
+ * @return 0 on success, -1 on failure
+ */
+int fuse_daemonize(int foreground);
+
+#endif /* __SOLARIS__ */
+
/**
* Get the version of the library
*
diff --git a/include/fuse-lite/fuse_kernel.h b/include/fuse-lite/fuse_kernel.h
index 696de77..69641b6 100755
--- a/include/fuse-lite/fuse_kernel.h
+++ b/include/fuse-lite/fuse_kernel.h
@@ -36,10 +36,7 @@
*/
#ifndef linux
-#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
-#endif
-
#define __u64 uint64_t
#define __u32 uint32_t
#define __s32 int32_t
@@ -133,12 +130,13 @@ struct fuse_file_lock {
/**
* INIT request/reply flags
+ * FUSE_BIG_WRITES: allow big writes to be issued to the file system
* FUSE_DONT_MASK: don't apply umask to file mode on create operations
*/
#define FUSE_ASYNC_READ (1 << 0)
#define FUSE_POSIX_LOCKS (1 << 1)
-#define FUSE_DONT_MASK (1 << 6)
#define FUSE_BIG_WRITES (1 << 5)
+#define FUSE_DONT_MASK (1 << 6)
/**
* Release flags
diff --git a/include/fuse-lite/fuse_lowlevel.h b/include/fuse-lite/fuse_lowlevel.h
index e921d15..77ac6b3 100755
--- a/include/fuse-lite/fuse_lowlevel.h
+++ b/include/fuse-lite/fuse_lowlevel.h
@@ -18,17 +18,11 @@
#include <utime.h>
#include <fcntl.h>
-#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
-#endif
-
#include <sys/stat.h>
-
#if HAVE_SYS_STATVFS_H
-
-#include <sys/statfs.h>
+#include <sys/statvfs.h>
#endif
-
#include <sys/uio.h>
#ifdef __cplusplus
@@ -960,11 +954,10 @@ int fuse_reply_iov(fuse_req_t req, const struct iovec *iov, int count);
* @param stbuf filesystem statistics
* @return zero for success, -errno for failure to send reply
*/
-#if HAVE_SYS_STATVFS_H
-int fuse_reply_statfs(fuse_req_t req, const struct statfs *stbuf);
+#if HAVE_SYS_STATVFS_H
+int fuse_reply_statfs(fuse_req_t req, const struct statvfs *stbuf);
#endif
-
/**
* Reply with needed buffer size
*
@@ -1090,6 +1083,13 @@ int fuse_req_interrupted(fuse_req_t req);
* Filesystem setup *
* ----------------------------------------------------------- */
+#ifdef __SOLARIS__
+
+/* Deprecated, don't use */
+int fuse_lowlevel_is_lib_option(const char *opt);
+
+#endif /* __SOLARIS__ */
+
/**
* Create a low level session
*
diff --git a/include/ntfs-3g/Makefile.am b/include/ntfs-3g/Makefile.am
index f4f72d6..33343df 100755
--- a/include/ntfs-3g/Makefile.am
+++ b/include/ntfs-3g/Makefile.am
@@ -29,13 +29,15 @@ headers = \
ntfstime.h \
object_id.h \
param.h \
+ realpath.h \
reparse.h \
runlist.h \
security.h \
support.h \
types.h \
unistr.h \
- volume.h
+ volume.h \
+ xattrs.h
if INSTALL_LIBRARY
ntfs3ginclude_HEADERS = $(headers)
diff --git a/include/ntfs-3g/Makefile.in b/include/ntfs-3g/Makefile.in
index fc65201..5c3f704 100755
--- a/include/ntfs-3g/Makefile.in
+++ b/include/ntfs-3g/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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.
@@ -16,8 +17,9 @@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
@@ -38,34 +40,52 @@ DIST_COMMON = $(am__noinst_HEADERS_DIST) \
$(am__ntfs3ginclude_HEADERS_DIST) $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__noinst_HEADERS_DIST = acls.h attrib.h attrlist.h bitmap.h \
bootsect.h cache.h collate.h compat.h compress.h debug.h \
device.h device_io.h dir.h efs.h endians.h index.h inode.h \
layout.h lcnalloc.h logfile.h logging.h mft.h misc.h mst.h \
- ntfstime.h object_id.h param.h reparse.h runlist.h security.h \
- support.h types.h unistr.h volume.h
+ ntfstime.h object_id.h param.h realpath.h reparse.h runlist.h \
+ security.h support.h types.h unistr.h volume.h xattrs.h
am__ntfs3ginclude_HEADERS_DIST = acls.h attrib.h attrlist.h bitmap.h \
bootsect.h cache.h collate.h compat.h compress.h debug.h \
device.h device_io.h dir.h efs.h endians.h index.h inode.h \
layout.h lcnalloc.h logfile.h logging.h mft.h misc.h mst.h \
- ntfstime.h object_id.h param.h reparse.h runlist.h security.h \
- support.h types.h unistr.h volume.h
+ ntfstime.h object_id.h param.h realpath.h reparse.h runlist.h \
+ security.h support.h types.h unistr.h volume.h xattrs.h
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__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(ntfs3gincludedir)"
-ntfs3gincludeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(noinst_HEADERS) $(ntfs3ginclude_HEADERS)
ETAGS = etags
CTAGS = ctags
@@ -82,54 +102,69 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FGREP = @FGREP@
FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@
FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
LDCONFIG = @LDCONFIG@
LDFLAGS = @LDFLAGS@
+LIBFUSE_LITE_CFLAGS = @LIBFUSE_LITE_CFLAGS@
LIBFUSE_LITE_LIBS = @LIBFUSE_LITE_LIBS@
+LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
LIBNTFS_3G_VERSION = @LIBNTFS_3G_VERSION@
+LIBNTFS_CPPFLAGS = @LIBNTFS_CPPFLAGS@
+LIBNTFS_LIBS = @LIBNTFS_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MKNTFS_CPPFLAGS = @MKNTFS_CPPFLAGS@
+MKNTFS_LIBS = @MKNTFS_LIBS@
MV = @MV@
+NM = @NM@
NMEDIT = @NMEDIT@
+NTFSPROGS_STATIC_LIBS = @NTFSPROGS_STATIC_LIBS@
+OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
OUTPUT_FORMAT = @OUTPUT_FORMAT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
RM = @RM@
SED = @SED@
@@ -142,8 +177,9 @@ abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+all_includes = @all_includes@
+all_libraries = @all_libraries@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -174,6 +210,7 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
ntfs3gincludedir = @ntfs3gincludedir@
@@ -195,6 +232,7 @@ target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
@@ -226,13 +264,15 @@ headers = \
ntfstime.h \
object_id.h \
param.h \
+ realpath.h \
reparse.h \
runlist.h \
security.h \
support.h \
types.h \
unistr.h \
- volume.h
+ volume.h \
+ xattrs.h
@INSTALL_LIBRARY_TRUE@ntfs3ginclude_HEADERS = $(headers)
@INSTALL_LIBRARY_FALSE@noinst_HEADERS = $(headers)
@@ -243,14 +283,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/ntfs-3g/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu include/ntfs-3g/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/ntfs-3g/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu include/ntfs-3g/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -268,6 +308,7 @@ $(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
+$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
@@ -277,34 +318,37 @@ clean-libtool:
install-ntfs3gincludeHEADERS: $(ntfs3ginclude_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(ntfs3gincludedir)" || $(MKDIR_P) "$(DESTDIR)$(ntfs3gincludedir)"
- @list='$(ntfs3ginclude_HEADERS)'; for p in $$list; do \
+ @list='$(ntfs3ginclude_HEADERS)'; test -n "$(ntfs3gincludedir)" || list=; \
+ for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- f=$(am__strip_dir) \
- echo " $(ntfs3gincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(ntfs3gincludedir)/$$f'"; \
- $(ntfs3gincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(ntfs3gincludedir)/$$f"; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(ntfs3gincludedir)'"; \
+ $(INSTALL_HEADER) $$files "$(DESTDIR)$(ntfs3gincludedir)" || exit $$?; \
done
uninstall-ntfs3gincludeHEADERS:
@$(NORMAL_UNINSTALL)
- @list='$(ntfs3ginclude_HEADERS)'; for p in $$list; do \
- f=$(am__strip_dir) \
- echo " rm -f '$(DESTDIR)$(ntfs3gincludedir)/$$f'"; \
- rm -f "$(DESTDIR)$(ntfs3gincludedir)/$$f"; \
- done
+ @list='$(ntfs3ginclude_HEADERS)'; test -n "$(ntfs3gincludedir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(ntfs3gincludedir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(ntfs3gincludedir)" && rm -f $$files
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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
+ set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -312,29 +356,34 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
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; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
+ $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -355,13 +404,17 @@ distdir: $(DISTFILES)
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@@ -392,6 +445,7 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -411,6 +465,8 @@ dvi-am:
html: html-am
+html-am:
+
info: info-am
info-am:
@@ -419,18 +475,28 @@ install-data-am: install-ntfs3gincludeHEADERS
install-dvi: install-dvi-am
+install-dvi-am:
+
install-exec-am:
install-html: install-html-am
+install-html-am:
+
install-info: install-info-am
+install-info-am:
+
install-man:
install-pdf: install-pdf-am
+install-pdf-am:
+
install-ps: install-ps-am
+install-ps-am:
+
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -466,6 +532,7 @@ uninstall-am: uninstall-ntfs3gincludeHEADERS
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-ntfs3gincludeHEADERS
+
# 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-3g/acls.h b/include/ntfs-3g/acls.h
index 8a83d32..4b08388 100755
--- a/include/ntfs-3g/acls.h
+++ b/include/ntfs-3g/acls.h
@@ -185,7 +185,8 @@ char *ntfs_build_descr_posix(struct MAPPING* const mapping[],
#endif /* POSIXACLS */
int ntfs_inherit_acl(const ACL *oldacl, ACL *newacl,
- const SID *usid, const SID *gsid, BOOL fordir);
+ const SID *usid, const SID *gsid,
+ BOOL fordir, le16 inherited);
int ntfs_build_permissions(const char *securattr,
const SID *usid, const SID *gsid, BOOL isdir);
char *ntfs_build_descr(mode_t mode,
diff --git a/include/ntfs-3g/attrib.h b/include/ntfs-3g/attrib.h
index bcdb011..a0bee26 100755
--- a/include/ntfs-3g/attrib.h
+++ b/include/ntfs-3g/attrib.h
@@ -4,6 +4,7 @@
* Copyright (c) 2000-2004 Anton Altaparmakov
* Copyright (c) 2004-2005 Yura Pakhuchiy
* Copyright (c) 2006-2007 Szabolcs Szakacsits
+ * Copyright (c) 2010 Jean-Pierre Andre
*
* This program/include file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
@@ -57,6 +58,13 @@ typedef enum {
LCN_EIO = -5,
} ntfs_lcn_special_values;
+typedef enum { /* ways of processing holes when expanding */
+ HOLES_NO,
+ HOLES_OK,
+ HOLES_DELAY,
+ HOLES_NONRES
+} hole_type;
+
/**
* struct ntfs_attr_search_ctx - search context used in attribute search functions
* @mrec: buffer containing mft record to search
@@ -189,6 +197,7 @@ struct _ntfs_attr {
u32 compression_block_size;
u8 compression_block_size_bits;
u8 compression_block_clusters;
+ s8 unused_runs; /* pre-reserved entries available */
};
/**
@@ -198,6 +207,10 @@ struct _ntfs_attr {
typedef enum {
NA_Initialized, /* 1: structure is initialized. */
NA_NonResident, /* 1: Attribute is not resident. */
+ NA_BeingNonResident, /* 1: Attribute is being made not resident. */
+ NA_FullyMapped, /* 1: Attribute has been fully mapped */
+ NA_DataAppending, /* 1: Attribute is being appended to */
+ NA_ComprClosing, /* 1: Compressed attribute is being closed */
} ntfs_attr_state_bits;
#define test_nattr_flag(na, flag) test_bit(NA_##flag, (na)->state)
@@ -212,6 +225,22 @@ typedef enum {
#define NAttrSetNonResident(na) set_nattr_flag(na, NonResident)
#define NAttrClearNonResident(na) clear_nattr_flag(na, NonResident)
+#define NAttrBeingNonResident(na) test_nattr_flag(na, BeingNonResident)
+#define NAttrSetBeingNonResident(na) set_nattr_flag(na, BeingNonResident)
+#define NAttrClearBeingNonResident(na) clear_nattr_flag(na, BeingNonResident)
+
+#define NAttrFullyMapped(na) test_nattr_flag(na, FullyMapped)
+#define NAttrSetFullyMapped(na) set_nattr_flag(na, FullyMapped)
+#define NAttrClearFullyMapped(na) clear_nattr_flag(na, FullyMapped)
+
+#define NAttrDataAppending(na) test_nattr_flag(na, DataAppending)
+#define NAttrSetDataAppending(na) set_nattr_flag(na, DataAppending)
+#define NAttrClearDataAppending(na) clear_nattr_flag(na, DataAppending)
+
+#define NAttrComprClosing(na) test_nattr_flag(na, ComprClosing)
+#define NAttrSetComprClosing(na) set_nattr_flag(na, ComprClosing)
+#define NAttrClearComprClosing(na) clear_nattr_flag(na, ComprClosing)
+
#define GenNAttrIno(func_name, flag) \
extern int NAttr##func_name(ntfs_attr *na); \
extern void NAttrSet##func_name(ntfs_attr *na); \
@@ -288,20 +317,22 @@ extern int ntfs_attr_can_be_resident(const ntfs_volume *vol,
const ATTR_TYPES type);
int ntfs_attr_make_non_resident(ntfs_attr *na,
ntfs_attr_search_ctx *ctx);
+int ntfs_attr_force_non_resident(ntfs_attr *na);
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, u8 *val, u32 size,
+ const ntfschar *name, u8 name_len, const 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);
+ const 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_attr_add(ntfs_inode *ni, ATTR_TYPES type,
- ntfschar *name, u8 name_len, u8 *val, s64 size);
+ ntfschar *name, u8 name_len, const u8 *val, s64 size);
extern int ntfs_attr_set_flags(ntfs_inode *ni, ATTR_TYPES type,
- ntfschar *name, u8 name_len, ATTR_FLAGS flags, ATTR_FLAGS mask);
+ const ntfschar *name, u8 name_len, ATTR_FLAGS flags,
+ ATTR_FLAGS mask);
extern int ntfs_attr_rm(ntfs_attr *na);
extern int ntfs_attr_record_resize(MFT_RECORD *m, ATTR_RECORD *a, u32 new_size);
@@ -315,6 +346,7 @@ extern int ntfs_attr_record_move_away(ntfs_attr_search_ctx *ctx, int extra);
extern int ntfs_attr_update_mapping_pairs(ntfs_attr *na, VCN from_vcn);
extern int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize);
+extern int ntfs_attr_truncate_solid(ntfs_attr *na, const s64 newsize);
/**
* get_attribute_value_length - return the length of the value of an attribute
@@ -349,10 +381,16 @@ extern s64 ntfs_get_attribute_value(const ntfs_volume *vol,
extern void ntfs_attr_name_free(char **name);
extern char *ntfs_attr_name_get(const ntfschar *uname, const int uname_len);
extern int ntfs_attr_exist(ntfs_inode *ni, const ATTR_TYPES type,
- ntfschar *name, u32 name_len);
+ const ntfschar *name, u32 name_len);
extern int ntfs_attr_remove(ntfs_inode *ni, const ATTR_TYPES type,
ntfschar *name, u32 name_len);
extern s64 ntfs_attr_get_free_bits(ntfs_attr *na);
+extern int ntfs_attr_data_read(ntfs_inode *ni,
+ ntfschar *stream_name, int stream_name_len,
+ char *buf, size_t size, off_t offset);
+extern int ntfs_attr_data_write(ntfs_inode *ni,
+ ntfschar *stream_name, int stream_name_len,
+ const char *buf, size_t size, off_t offset);
#endif /* defined _NTFS_ATTRIB_H */
diff --git a/include/ntfs-3g/cache.h b/include/ntfs-3g/cache.h
index 67c3325..be63b1a 100755
--- a/include/ntfs-3g/cache.h
+++ b/include/ntfs-3g/cache.h
@@ -1,7 +1,7 @@
/*
* cache.h : deal with indexed LRU caches
*
- * Copyright (c) 2008-2009 Jean-Pierre Andre
+ * Copyright (c) 2008-2010 Jean-Pierre Andre
*
* This program/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 +29,7 @@ struct CACHED_GENERIC {
struct CACHED_GENERIC *previous;
void *variable;
size_t varsize;
- void *fixed[0];
+ union ALIGNMENT payload[0];
} ;
struct CACHED_INODE {
@@ -37,6 +37,7 @@ struct CACHED_INODE {
struct CACHED_INODE *previous;
const char *pathname;
size_t varsize;
+ union ALIGNMENT payload[0];
/* above fields must match "struct CACHED_GENERIC" */
u64 inum;
} ;
@@ -46,6 +47,7 @@ struct CACHED_NIDATA {
struct CACHED_NIDATA *previous;
const char *pathname; /* not used */
size_t varsize; /* not used */
+ union ALIGNMENT payload[0];
/* above fields must match "struct CACHED_GENERIC" */
u64 inum;
ntfs_inode *ni;
@@ -56,6 +58,7 @@ struct CACHED_LOOKUP {
struct CACHED_LOOKUP *previous;
const char *name;
size_t namesize;
+ union ALIGNMENT payload[0];
/* above fields must match "struct CACHED_GENERIC" */
u64 parent;
u64 inum;
diff --git a/include/ntfs-3g/compat.h b/include/ntfs-3g/compat.h
index d662059..ece7ba8 100755
--- a/include/ntfs-3g/compat.h
+++ b/include/ntfs-3g/compat.h
@@ -31,6 +31,12 @@
#include <sys/param.h>
#endif
+#include <errno.h> /* ENODATA */
+
+#ifndef ENODATA
+#define ENODATA ENOENT
+#endif
+
#ifndef PATH_MAX
#define PATH_MAX 4096
#endif
diff --git a/include/ntfs-3g/compress.h b/include/ntfs-3g/compress.h
index 809c3c9..c256932 100755
--- a/include/ntfs-3g/compress.h
+++ b/include/ntfs-3g/compress.h
@@ -31,9 +31,11 @@ extern s64 ntfs_compressed_attr_pread(ntfs_attr *na, s64 pos, s64 count,
extern s64 ntfs_compressed_pwrite(ntfs_attr *na, runlist_element *brl, s64 wpos,
s64 offs, s64 to_write, s64 rounded,
- const void *b, int compressed_part);
+ const void *b, int compressed_part,
+ VCN *update_from);
-extern int ntfs_compressed_close(ntfs_attr *na, runlist_element *brl, s64 offs);
+extern int ntfs_compressed_close(ntfs_attr *na, runlist_element *brl,
+ s64 offs, VCN *update_from);
#endif /* defined _NTFS_COMPRESS_H */
diff --git a/include/ntfs-3g/debug.h b/include/ntfs-3g/debug.h
index cf39b62..f7f3c6f 100755
--- a/include/ntfs-3g/debug.h
+++ b/include/ntfs-3g/debug.h
@@ -38,10 +38,10 @@ static __inline__ void ntfs_debug_runlist_dump(const struct _runlist_element *rl
#define NTFS_BUG(msg) \
{ \
- int ___i; \
+ int ___i = 1; \
ntfs_log_critical("Bug in %s(): %s\n", __FUNCTION__, msg); \
ntfs_log_debug("Forcing segmentation fault!"); \
- ___i = ((int*)NULL)[1]; \
+ ___i = ((int*)NULL)[___i]; \
}
#endif /* defined _NTFS_DEBUG_H */
diff --git a/include/ntfs-3g/device.h b/include/ntfs-3g/device.h
index a19d29c..c7cc9b6 100755
--- a/include/ntfs-3g/device.h
+++ b/include/ntfs-3g/device.h
@@ -1,7 +1,8 @@
/*
* device.h - Exports for low level device io. Originated from the Linux-NTFS project.
*
- * Copyright (c) 2000-2006 Anton Altaparmakov
+ * Copyright (c) 2000-2013 Anton Altaparmakov
+ * Copyright (c) 2008-2013 Tuxera Inc.
*
* This program/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,6 +42,7 @@ typedef enum {
ND_ReadOnly, /* 1: Device is read-only. */
ND_Dirty, /* 1: Device is dirty, needs sync. */
ND_Block, /* 1: Device is a block device. */
+ ND_Sync, /* 1: Device is mounted with "-o sync" */
} ntfs_device_state_bits;
#define test_ndev_flag(nd, flag) test_bit(ND_##flag, (nd)->d_state)
@@ -63,11 +65,20 @@ typedef enum {
#define NDevSetBlock(nd) set_ndev_flag(nd, Block)
#define NDevClearBlock(nd) clear_ndev_flag(nd, Block)
+#define NDevSync(nd) test_ndev_flag(nd, Sync)
+#define NDevSetSync(nd) set_ndev_flag(nd, Sync)
+#define NDevClearSync(nd) clear_ndev_flag(nd, Sync)
+
/**
* struct ntfs_device -
*
* The ntfs device structure defining all operations needed to access the low
* level device underlying the ntfs volume.
+ *
+ * Note d_heads and d_sectors_per_track are only set as a result of a call to
+ * either ntfs_device_heads_get() or ntfs_device_sectors_per_track_get() (both
+ * calls will set up both fields or if getting them failed they will be left at
+ * -1).
*/
struct ntfs_device {
struct ntfs_device_operations *d_ops; /* Device operations. */
@@ -75,6 +86,10 @@ struct ntfs_device {
char *d_name; /* Name of device. */
void *d_private; /* Private data used by the
device operations. */
+ int d_heads; /* Disk geometry: number of
+ heads or -1. */
+ int d_sectors_per_track; /* Disk geometry: number of
+ sectors per track or -1. */
};
struct stat;
@@ -102,6 +117,7 @@ struct ntfs_device_operations {
extern struct ntfs_device *ntfs_device_alloc(const char *name, const long state,
struct ntfs_device_operations *dops, void *priv_data);
extern int ntfs_device_free(struct ntfs_device *dev);
+extern int ntfs_device_sync(struct ntfs_device *dev);
extern s64 ntfs_pread(struct ntfs_device *dev, const s64 pos, s64 count,
void *b);
diff --git a/include/ntfs-3g/device_io.h b/include/ntfs-3g/device_io.h
index 8437cc2..24f8d9b 100755
--- a/include/ntfs-3g/device_io.h
+++ b/include/ntfs-3g/device_io.h
@@ -28,12 +28,18 @@
#ifndef NO_NTFS_DEVICE_DEFAULT_IO_OPS
-#ifndef __CYGWIN32__
+#if defined(linux) || defined(__uClinux__) || defined(__sun) \
+ || defined(__APPLE__) || defined(__DARWIN__)
+ /* Make sure the presence of <windows.h> means compiling for Windows */
+#undef HAVE_WINDOWS_H
+#endif
+
+#ifndef HAVE_WINDOWS_H
-/* Not on Cygwin; use standard Unix style low level device operations. */
+/* Not for Windows use standard Unix style low level device operations. */
#define ntfs_device_default_io_ops ntfs_device_unix_io_ops
-#else /* __CYGWIN32__ */
+#else /* HAVE_WINDOWS_H */
#ifndef HDIO_GETGEO
# define HDIO_GETGEO 0x301
@@ -60,10 +66,15 @@ struct hd_geometry {
# define BLKBSZSET 0x40041271
#endif
-/* On Cygwin; use Win32 low level device operations. */
+/* On Windows (and Cygwin) : use Win32 low level device operations. */
#define ntfs_device_default_io_ops ntfs_device_win32_io_ops
-#endif /* __CYGWIN32__ */
+/* A few useful functions */
+int ntfs_win32_set_sparse(int);
+int ntfs_win32_ftruncate(int fd, s64 size);
+int ntfs_win32_device_ftruncate(struct ntfs_device*, s64);
+
+#endif /* HAVE_WINDOWS_H */
/* Forward declaration. */
diff --git a/include/ntfs-3g/dir.h b/include/ntfs-3g/dir.h
index 56e76fe..a99c1ae 100755
--- a/include/ntfs-3g/dir.h
+++ b/include/ntfs-3g/dir.h
@@ -68,17 +68,18 @@ extern void ntfs_inode_update_mbsname(ntfs_inode *dir_ni, const char *name,
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, le32 securid,
- ntfschar *name, u8 name_len, mode_t type);
+ const ntfschar *name, u8 name_len, mode_t type);
extern ntfs_inode *ntfs_create_device(ntfs_inode *dir_ni, le32 securid,
- ntfschar *name, u8 name_len, mode_t type, dev_t dev);
+ const ntfschar *name, u8 name_len, mode_t type, dev_t dev);
extern ntfs_inode *ntfs_create_symlink(ntfs_inode *dir_ni, le32 securid,
- ntfschar *name, u8 name_len, ntfschar *target, int target_len);
+ const ntfschar *name, u8 name_len, const ntfschar *target,
+ int target_len);
extern int ntfs_check_empty_dir(ntfs_inode *ni);
extern int ntfs_delete(ntfs_volume *vol, const char *path,
- ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name,
+ ntfs_inode *ni, ntfs_inode *dir_ni, const ntfschar *name,
u8 name_len);
-extern int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name,
+extern int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, const ntfschar *name,
u8 name_len);
/*
diff --git a/include/ntfs-3g/layout.h b/include/ntfs-3g/layout.h
index 8670557..427f152 100755
--- a/include/ntfs-3g/layout.h
+++ b/include/ntfs-3g/layout.h
@@ -311,6 +311,7 @@ typedef enum {
#define MFT_REF_MASK_LE const_cpu_to_le64(MFT_REF_MASK_CPU)
typedef u64 MFT_REF;
+typedef le64 leMFT_REF; /* a little-endian MFT_MREF */
#define MK_MREF(m, s) ((MFT_REF)(((MFT_REF)(s) << 48) | \
((MFT_REF)(m) & MFT_REF_MASK_CPU)))
@@ -2222,11 +2223,11 @@ typedef struct {
/* The below field is NOT present for the quota defaults entry. */
SID sid; /* The SID of the user/object associated with
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
+ then the INDEX_ENTRY is padded to a multiple
+ of 8 with zeros 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
+ a multiple of 8 and the padding is counted in
the INDEX_ENTRY's data_length. */
} __attribute__((__packed__)) QUOTA_CONTROL_ENTRY;
@@ -2397,18 +2398,19 @@ typedef enum {
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),
+ IO_REPARSE_TAG_CSV = const_cpu_to_le32(0x80000009),
+ IO_REPARSE_TAG_DEDUP = const_cpu_to_le32(0x80000013),
+ IO_REPARSE_TAG_DFS = const_cpu_to_le32(0x8000000A),
+ IO_REPARSE_TAG_DFSR = const_cpu_to_le32(0x80000012),
+ IO_REPARSE_TAG_HSM = const_cpu_to_le32(0xC0000004),
+ IO_REPARSE_TAG_HSM2 = const_cpu_to_le32(0x80000006),
+ IO_REPARSE_TAG_MOUNT_POINT = const_cpu_to_le32(0xA0000003),
+ IO_REPARSE_TAG_NFS = const_cpu_to_le32(0x80000014),
+ IO_REPARSE_TAG_SIS = const_cpu_to_le32(0x80000007),
+ IO_REPARSE_TAG_SYMLINK = const_cpu_to_le32(0xA000000C),
+ IO_REPARSE_TAG_WIM = const_cpu_to_le32(0x80000008),
+
+ IO_REPARSE_TAG_VALID_VALUES = const_cpu_to_le32(0xf000ffff),
} PREDEFINED_REPARSE_TAGS;
/**
diff --git a/include/ntfs-3g/lcnalloc.h b/include/ntfs-3g/lcnalloc.h
index e87ca43..cbf4c5c 100755
--- a/include/ntfs-3g/lcnalloc.h
+++ b/include/ntfs-3g/lcnalloc.h
@@ -42,6 +42,7 @@ 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);
+extern int ntfs_cluster_free_basic(ntfs_volume *vol, s64 lcn, s64 count);
extern int ntfs_cluster_free(ntfs_volume *vol, ntfs_attr *na, VCN start_vcn,
s64 count);
diff --git a/include/ntfs-3g/logging.h b/include/ntfs-3g/logging.h
index 401f5c9..82f39fe 100755
--- a/include/ntfs-3g/logging.h
+++ b/include/ntfs-3g/logging.h
@@ -114,5 +114,8 @@ int ntfs_log_redirect(const char *function, const char *file, int line,
#define ntfs_log_leave(FORMAT, ARGS...)do {} while (0)
#endif /* DEBUG */
+void ntfs_log_early_error(const char *format, ...)
+ __attribute__((format(printf, 1, 2)));
+
#endif /* _LOGGING_H_ */
diff --git a/include/ntfs-3g/mst.h b/include/ntfs-3g/mst.h
index ca81382..d6ca6f2 100755
--- a/include/ntfs-3g/mst.h
+++ b/include/ntfs-3g/mst.h
@@ -25,8 +25,11 @@
#include "types.h"
#include "layout.h"
+#include "volume.h"
extern int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size);
+extern int ntfs_mst_post_read_fixup_warn(NTFS_RECORD *b, const u32 size,
+ BOOL warn);
extern int ntfs_mst_pre_write_fixup(NTFS_RECORD *b, const u32 size);
extern void ntfs_mst_post_write_fixup(NTFS_RECORD *b);
diff --git a/include/ntfs-3g/ntfstime.h b/include/ntfs-3g/ntfstime.h
index 2225d39..99311e2 100755
--- a/include/ntfs-3g/ntfstime.h
+++ b/include/ntfs-3g/ntfstime.h
@@ -39,12 +39,12 @@
/*
* assume "struct timespec" is not defined if st_mtime is not defined
*/
-#if !defined(st_mtime) & !defined(__timespec_defined)
-/*struct timespec {
- time_t tv_sec;
- long tv_nsec;
-} */;
-#endif
+//#if !defined(st_mtime) & !defined(__timespec_defined)
+//struct timespec {
+// time_t tv_sec;
+// long tv_nsec;
+//} ;
+//#endif
/*
* There are four times more conversions of internal representation
diff --git a/include/ntfs-3g/param.h b/include/ntfs-3g/param.h
index b309e30..da794ab 100755
--- a/include/ntfs-3g/param.h
+++ b/include/ntfs-3g/param.h
@@ -1,7 +1,7 @@
/*
* param.h - Parameter values for ntfs-3g
*
- * Copyright (c) 2009 Jean-Pierre Andre
+ * Copyright (c) 2009-2010 Jean-Pierre Andre
*
* This program/include file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
@@ -31,6 +31,63 @@
#define FORCE_FORMAT_v1x 0 /* Insert security data as in NTFS v1.x */
#define OWNERFROMACL 1 /* Get the owner from ACL (not Windows owner) */
+ /* default security sub-authorities */
+enum {
+ DEFSECAUTH1 = -1153374643, /* 3141592653 */
+ DEFSECAUTH2 = 589793238,
+ DEFSECAUTH3 = 462843383,
+ DEFSECBASE = 10000
+};
+
+/*
+ * Parameters for compression
+ */
+
+ /* default option for compression */
+#define DEFAULT_COMPRESSION 1
+ /* (log2 of) number of clusters in a compression block for new files */
+#define STANDARD_COMPRESSION_UNIT 4
+ /* maximum cluster size for allowing compression for new files */
+#define MAX_COMPRESSION_CLUSTER_SIZE 4096
+
+/*
+ * Parameters for default options
+ */
+
+#define DEFAULT_DMTIME 60 /* default 1mn for delay_mtime */
+
+/*
+ * Use of big write buffers
+ *
+ * With small volumes, the cluster allocator may fail to allocate
+ * enough clusters when the volume is nearly full. At most a run
+ * can be allocated per bitmap chunk. So, there is a danger when the
+ * number of chunks (capacity/(32768*clsiz)) is less than the number
+ * of clusters in the biggest write buffer (131072/clsiz). Hence
+ * a safe minimal capacity is 4GB
+ */
+
+#define SAFE_CAPACITY_FOR_BIG_WRITES 0x100000000LL
+
+/*
+ * Parameters for runlists
+ */
+
+ /* only update the final extent of a runlist when appending data */
+#define PARTIAL_RUNLIST_UPDATING 1
+
+/*
+ * Parameters for user and xattr mappings
+ */
+
+#define XATTRMAPPINGFILE ".NTFS-3G/XattrMapping" /* default mapping file */
+
+/*
+ * Parameters for path canonicalization
+ */
+
+#define MAPPERNAMELTH 256
+
/*
* Permission checking modes for high level and low level
*
@@ -39,7 +96,8 @@
*
* Stick to the recommended values unless you understand the consequences
* on protection and performances. Use of cacheing is good for
- * performances, but bad on security.
+ * performances, but bad on security with internal fuse or external
+ * fuse older than 2.8
*
* Possible values for high level :
* 1 : no cache, kernel control (recommended)
@@ -48,7 +106,7 @@
*
* Possible values for low level :
* 2 : no cache, kernel control
- * 3 : use kernel/fuse cache, kernel control
+ * 3 : use kernel/fuse cache, kernel control (external fuse >= 2.8)
* 5 : no cache, file system control (recommended)
* 8 : no cache, kernel control for ACLs
*
@@ -57,7 +115,15 @@
* of 6 is added in the mount report.
*/
+#if defined(__sun) && defined(__SVR4)
+#define HPERMSCONFIG 4 /* access control by kernel is broken on OpenIndiana */
+#else
#define HPERMSCONFIG 1
+#endif
+#if defined(FUSE_INTERNAL) || !defined(FUSE_VERSION) || (FUSE_VERSION < 28)
#define LPERMSCONFIG 5
+#else
+#define LPERMSCONFIG 3
+#endif
#endif /* defined _NTFS_PARAM_H */
diff --git a/include/ntfs-3g/realpath.h b/include/ntfs-3g/realpath.h
new file mode 100755
index 0000000..970d2af
--- a/dev/null
+++ b/include/ntfs-3g/realpath.h
@@ -0,0 +1,24 @@
+/*
+ * realpath.h - realpath() aware of device mapper
+ */
+
+#ifndef REALPATH_H
+#define REALPATH_H
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_REALPATH
+#define ntfs_realpath realpath
+#else
+extern char *ntfs_realpath(const char *path, char *resolved_path);
+#endif
+
+#ifdef linux
+extern char *ntfs_realpath_canonicalize(const char *path, char *resolved_path);
+#else
+#define ntfs_realpath_canonicalize ntfs_realpath
+#endif
+
+#endif /* REALPATH_H */
diff --git a/include/ntfs-3g/runlist.h b/include/ntfs-3g/runlist.h
index 43de53c..4b73af9 100755
--- a/include/ntfs-3g/runlist.h
+++ b/include/ntfs-3g/runlist.h
@@ -49,7 +49,8 @@ struct _runlist_element {/* In memory vcn to lcn mapping structure element. */
s64 length; /* Run length in clusters. */
};
-extern runlist_element *ntfs_rl_extend(runlist_element *rl, int more_entries);
+extern runlist_element *ntfs_rl_extend(ntfs_attr *na, runlist_element *rl,
+ int more_entries);
extern LCN ntfs_rl_vcn_to_lcn(const runlist_element *rl, const VCN vcn);
diff --git a/include/ntfs-3g/security.h b/include/ntfs-3g/security.h
index f95c331..8875c9c 100755
--- a/include/ntfs-3g/security.h
+++ b/include/ntfs-3g/security.h
@@ -4,7 +4,7 @@
*
* Copyright (c) 2004 Anton Altaparmakov
* Copyright (c) 2005-2006 Szabolcs Szakacsits
- * Copyright (c) 2007-2008 Jean-Pierre Andre
+ * Copyright (c) 2007-2010 Jean-Pierre Andre
*
* This program/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,6 +34,9 @@
#define POSIXACLS 0
#endif
+typedef u16 be16;
+typedef u32 be32;
+
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define const_cpu_to_be16(x) ((((x) & 255L) << 8) + (((x) >> 8) & 255L))
#define const_cpu_to_be32(x) ((((x) & 255L) << 24) + (((x) & 0xff00L) << 8) \
@@ -82,6 +85,7 @@ struct CACHED_PERMISSIONS_LEGACY {
struct CACHED_PERMISSIONS_LEGACY *previous;
void *variable;
size_t varsize;
+ union ALIGNMENT payload[0];
/* above fields must match "struct CACHED_GENERIC" */
u64 mft_no;
struct CACHED_PERMISSIONS perm;
@@ -96,6 +100,7 @@ struct CACHED_SECURID {
struct CACHED_SECURID *previous;
void *variable;
size_t varsize;
+ union ALIGNMENT payload[0];
/* above fields must match "struct CACHED_GENERIC" */
uid_t uid;
gid_t gid;
@@ -132,6 +137,7 @@ struct PERMISSIONS_CACHE {
enum {
SECURITY_DEFAULT, /* rely on fuse for permissions checking */
SECURITY_RAW, /* force same ownership/permissions on files */
+ SECURITY_ACL, /* enable Posix ACLs (when compiled in) */
SECURITY_ADDSECURIDS, /* upgrade old security descriptors */
SECURITY_STATICGRPS, /* use static groups for access control */
SECURITY_WANTED /* a security related option was present */
@@ -163,14 +169,14 @@ struct POSIX_ACE {
u16 tag;
u16 perms;
s32 id;
-} ;
+} __attribute__((__packed__));
struct POSIX_ACL {
u8 version;
u8 flags;
u16 filler;
struct POSIX_ACE ace[0];
-} ;
+} __attribute__((__packed__));
struct POSIX_SECURITY {
mode_t mode;
@@ -178,6 +184,7 @@ struct POSIX_SECURITY {
int defcnt;
int firstdef;
u16 tagsset;
+ s32 alignment[0];
struct POSIX_ACL acl;
} ;
@@ -240,13 +247,16 @@ extern int ntfs_sd_add_everyone(ntfs_inode *ni);
extern le32 ntfs_security_hash(const SECURITY_DESCRIPTOR_RELATIVE *sd,
const u32 len);
-int ntfs_build_mapping(struct SECURITY_CONTEXT *scx, const char *usermap_path);
+int ntfs_build_mapping(struct SECURITY_CONTEXT *scx, const char *usermap_path,
+ BOOL allowdef);
int ntfs_get_owner_mode(struct SECURITY_CONTEXT *scx,
ntfs_inode *ni, struct stat*);
int ntfs_set_mode(struct SECURITY_CONTEXT *scx, ntfs_inode *ni, mode_t mode);
BOOL ntfs_allowed_as_owner(struct SECURITY_CONTEXT *scx, ntfs_inode *ni);
int ntfs_allowed_access(struct SECURITY_CONTEXT *scx,
ntfs_inode *ni, int accesstype);
+int ntfs_allowed_create(struct SECURITY_CONTEXT *scx,
+ ntfs_inode *ni, gid_t *pgid, mode_t *pdsetgid);
BOOL old_ntfs_allowed_dir_access(struct SECURITY_CONTEXT *scx,
const char *path, int accesstype);
@@ -342,7 +352,7 @@ INDEX_ENTRY *ntfs_read_sii(struct SECURITY_API *scapi,
INDEX_ENTRY *ntfs_read_sdh(struct SECURITY_API *scapi,
INDEX_ENTRY *entry);
struct SECURITY_API *ntfs_initialize_file_security(const char *device,
- int flags);
+ unsigned long flags);
BOOL ntfs_leave_file_security(struct SECURITY_API *scx);
int ntfs_get_usid(struct SECURITY_API *scapi, uid_t uid, char *buf);
diff --git a/include/ntfs-3g/types.h b/include/ntfs-3g/types.h
index 8b7f3f5..a64f12f 100755
--- a/include/ntfs-3g/types.h
+++ b/include/ntfs-3g/types.h
@@ -120,5 +120,13 @@ typedef enum {
#define STATUS_KEEP_SEARCHING (-3)
#define STATUS_NOT_FOUND (-4)
+/*
+ * Force alignment in a struct if required by processor
+ */
+union ALIGNMENT {
+ u64 u64align;
+ void *ptralign;
+} ;
+
#endif /* defined _NTFS_TYPES_H */
diff --git a/include/ntfs-3g/unistr.h b/include/ntfs-3g/unistr.h
index 5f0b467..8cadc3c 100755
--- a/include/ntfs-3g/unistr.h
+++ b/include/ntfs-3g/unistr.h
@@ -47,19 +47,22 @@ 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);
-extern void ntfs_file_value_upcase(FILE_NAME_ATTR *file_name_attr,
- const ntfschar *upcase, const u32 upcase_len);
+extern void ntfs_name_locase(ntfschar *name, u32 name_len,
+ const ntfschar *locase, const u32 locase_len);
-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,
+extern void ntfs_file_value_upcase(FILE_NAME_ATTR *file_name_attr,
const ntfschar *upcase, const u32 upcase_len);
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);
+extern char *ntfs_uppercase_mbs(const char *low,
+ const ntfschar *upcase, u32 upcase_len);
+
extern void ntfs_upcase_table_build(ntfschar *uc, u32 uc_len);
+extern u32 ntfs_upcase_build_default(ntfschar **upcase);
+extern ntfschar *ntfs_locase_table_build(const ntfschar *uc, u32 uc_cnt);
extern ntfschar *ntfs_str2ucs(const char *s, int *len);
diff --git a/include/ntfs-3g/volume.h b/include/ntfs-3g/volume.h
index 253e482..a181ccc 100755
--- a/include/ntfs-3g/volume.h
+++ b/include/ntfs-3g/volume.h
@@ -5,6 +5,7 @@
* Copyright (c) 2004-2005 Richard Russon
* Copyright (c) 2005-2006 Yura Pakhuchiy
* Copyright (c) 2005-2009 Szabolcs Szakacsits
+ * Copyright (c) 2010 Jean-Pierre Andre
*
* This program/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,22 +43,6 @@
#include <mntent.h>
#endif
-/*
- * Under Cygwin, DJGPP and FreeBSD we do not have MS_RDONLY,
- * so we define them ourselves.
- */
-#ifndef MS_RDONLY
-#define MS_RDONLY 1
-#endif
-
-#define MS_EXCLUSIVE 0x08000000
-
-#ifndef MS_RECOVER
-#define MS_RECOVER 0x10000000
-#endif
-
-#define MS_IGNORE_HIBERFILE 0x20000000
-
/* Forward declaration */
typedef struct _ntfs_volume ntfs_volume;
@@ -72,13 +57,29 @@ typedef struct _ntfs_volume ntfs_volume;
/**
* enum ntfs_mount_flags -
*
+ * Flags for the ntfs_mount() function.
+ */
+enum {
+ NTFS_MNT_NONE = 0x00000000,
+ NTFS_MNT_RDONLY = 0x00000001,
+ NTFS_MNT_FORENSIC = 0x04000000, /* No modification during
+ * mount. */
+ NTFS_MNT_EXCLUSIVE = 0x08000000,
+ NTFS_MNT_RECOVER = 0x10000000,
+ NTFS_MNT_IGNORE_HIBERFILE = 0x20000000,
+};
+typedef unsigned long ntfs_mount_flags;
+
+/**
+ * enum ntfs_mounted_flags -
+ *
* 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;
+} ntfs_mounted_flags;
extern int ntfs_check_if_mounted(const char *file, unsigned long *mnt_flags);
@@ -107,6 +108,11 @@ 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_ShowSysFiles, /* 1: Show NTFS metafiles. */
+ NV_ShowHidFiles, /* 1: Show files marked hidden. */
+ NV_HideDotFiles, /* 1: Set hidden flag on dot files */
+ NV_Compression, /* 1: allow compression */
+ NV_NoFixupWarn, /* 1: Do not log fixup errors */
} ntfs_volume_state_bits;
#define test_nvol_flag(nv, flag) test_bit(NV_##flag, (nv)->state)
@@ -125,6 +131,26 @@ typedef enum {
#define NVolSetLogFileEmpty(nv) set_nvol_flag(nv, LogFileEmpty)
#define NVolClearLogFileEmpty(nv) clear_nvol_flag(nv, LogFileEmpty)
+#define NVolShowSysFiles(nv) test_nvol_flag(nv, ShowSysFiles)
+#define NVolSetShowSysFiles(nv) set_nvol_flag(nv, ShowSysFiles)
+#define NVolClearShowSysFiles(nv) clear_nvol_flag(nv, ShowSysFiles)
+
+#define NVolShowHidFiles(nv) test_nvol_flag(nv, ShowHidFiles)
+#define NVolSetShowHidFiles(nv) set_nvol_flag(nv, ShowHidFiles)
+#define NVolClearShowHidFiles(nv) clear_nvol_flag(nv, ShowHidFiles)
+
+#define NVolHideDotFiles(nv) test_nvol_flag(nv, HideDotFiles)
+#define NVolSetHideDotFiles(nv) set_nvol_flag(nv, HideDotFiles)
+#define NVolClearHideDotFiles(nv) clear_nvol_flag(nv, HideDotFiles)
+
+#define NVolCompression(nv) test_nvol_flag(nv, Compression)
+#define NVolSetCompression(nv) set_nvol_flag(nv, Compression)
+#define NVolClearCompression(nv) clear_nvol_flag(nv, Compression)
+
+#define NVolNoFixupWarn(nv) test_nvol_flag(nv, NoFixupWarn)
+#define NVolSetNoFixupWarn(nv) set_nvol_flag(nv, NoFixupWarn)
+#define NVolClearNoFixupWarn(nv) clear_nvol_flag(nv, NoFixupWarn)
+
/*
* NTFS version 1.1 and 1.2 are used by Windows NT4.
* NTFS version 2.x is used by Windows 2000 Beta
@@ -217,6 +243,9 @@ struct _ntfs_volume {
FILE_UpCase. */
u32 upcase_len; /* Length in Unicode characters of the upcase
table. */
+ ntfschar *locase; /* Lower case equivalents of all 65536 2-byte
+ Unicode characters. Only if option
+ case_ignore is set. */
ATTR_DEF *attrdef; /* Attribute definitions. Obtained from
FILE_AttrDef. */
@@ -228,7 +257,9 @@ struct _ntfs_volume {
s64 free_mft_records; /* Same for free mft records (see above) */
BOOL efs_raw; /* volume is mounted for raw access to
efs-encrypted files */
-
+#ifdef XATTR_MAPPINGS
+ struct XATTRMAPPING *xattr_mapping;
+#endif /* XATTR_MAPPINGS */
#if CACHE_INODE_SIZE
struct CACHE_HEADER *xinode_cache;
#endif
@@ -252,12 +283,12 @@ extern const char *ntfs_home;
extern ntfs_volume *ntfs_volume_alloc(void);
extern ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev,
- unsigned long flags);
+ ntfs_mount_flags flags);
extern ntfs_volume *ntfs_device_mount(struct ntfs_device *dev,
- unsigned long flags);
+ ntfs_mount_flags flags);
-extern ntfs_volume *ntfs_mount(const char *name, unsigned long flags);
+extern ntfs_volume *ntfs_mount(const char *name, ntfs_mount_flags flags);
extern int ntfs_umount(ntfs_volume *vol, const BOOL force);
extern int ntfs_version_is_supported(ntfs_volume *vol);
@@ -270,8 +301,13 @@ extern int ntfs_volume_error(int err);
extern void ntfs_mount_error(const char *vol, const char *mntpoint, int err);
extern int ntfs_volume_get_free_space(ntfs_volume *vol);
+extern int ntfs_volume_rename(ntfs_volume *vol, const ntfschar *label,
+ int label_len);
+extern int ntfs_set_shown_files(ntfs_volume *vol,
+ BOOL show_sys_files, BOOL show_hid_files, BOOL hide_dot_files);
extern int ntfs_set_locale(void);
+extern int ntfs_set_ignore_case(ntfs_volume *vol);
#endif /* defined _NTFS_VOLUME_H */
diff --git a/include/ntfs-3g/xattrs.h b/include/ntfs-3g/xattrs.h
new file mode 100755
index 0000000..5158311
--- a/dev/null
+++ b/include/ntfs-3g/xattrs.h
@@ -0,0 +1,75 @@
+/*
+ * xattrs.h : definitions related to system extended attributes
+ *
+ * Copyright (c) 2010 Jean-Pierre Andre
+ *
+ * This program/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 NTFS-3G
+ * 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_XATTR_H_
+#define _NTFS_XATTR_H_
+
+/*
+ * Identification of data mapped to the system name space
+ */
+
+enum SYSTEMXATTRS {
+ XATTR_UNMAPPED,
+ XATTR_NTFS_ACL,
+ XATTR_NTFS_ATTRIB,
+ XATTR_NTFS_ATTRIB_BE,
+ XATTR_NTFS_EFSINFO,
+ XATTR_NTFS_REPARSE_DATA,
+ XATTR_NTFS_OBJECT_ID,
+ XATTR_NTFS_DOS_NAME,
+ XATTR_NTFS_TIMES,
+ XATTR_NTFS_TIMES_BE,
+ XATTR_NTFS_CRTIME,
+ XATTR_NTFS_CRTIME_BE,
+ XATTR_POSIX_ACC,
+ XATTR_POSIX_DEF
+} ;
+
+struct XATTRMAPPING {
+ struct XATTRMAPPING *next;
+ enum SYSTEMXATTRS xattr;
+ char name[1]; /* variable length */
+} ;
+
+#ifdef XATTR_MAPPINGS
+
+struct XATTRMAPPING *ntfs_xattr_build_mapping(ntfs_volume *vol,
+ const char *path);
+void ntfs_xattr_free_mapping(struct XATTRMAPPING*);
+
+#endif /* XATTR_MAPPINGS */
+
+enum SYSTEMXATTRS ntfs_xattr_system_type(const char *name,
+ ntfs_volume *vol);
+
+int ntfs_xattr_system_getxattr(struct SECURITY_CONTEXT *scx,
+ enum SYSTEMXATTRS attr,
+ ntfs_inode *ni, ntfs_inode *dir_ni,
+ char *value, size_t size);
+int ntfs_xattr_system_setxattr(struct SECURITY_CONTEXT *scx,
+ enum SYSTEMXATTRS attr,
+ ntfs_inode *ni, ntfs_inode *dir_ni,
+ const char *value, size_t size, int flags);
+int ntfs_xattr_system_removexattr(struct SECURITY_CONTEXT *scx,
+ enum SYSTEMXATTRS attr,
+ ntfs_inode *ni, ntfs_inode *dir_ni);
+
+#endif /* _NTFS_XATTR_H_ */
diff --git a/install-sh b/install-sh
index a5897de..6781b98 100755
--- a/install-sh
+++ b/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2006-12-25.00
+scriptversion=2009-04-28.21; # UTC
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -515,5 +515,6 @@ done
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
# End:
diff --git a/libfuse-lite/Makefile.am b/libfuse-lite/Makefile.am
index c09e8d7..d9591ec 100755
--- a/libfuse-lite/Makefile.am
+++ b/libfuse-lite/Makefile.am
@@ -7,6 +7,7 @@ endif
libfuse_lite_la_CFLAGS= \
$(AM_CFLAGS) \
+ $(LIBFUSE_LITE_CFLAGS) \
-I$(top_srcdir)/include/fuse-lite
libfuse_lite_la_LIBADD = $(LIBFUSE_LITE_LIBS)
@@ -26,3 +27,5 @@ libfuse_lite_la_SOURCES = \
mount.c \
mount_util.c \
mount_util.h
+
+libs: libfuse-lite.la
diff --git a/libfuse-lite/Makefile.in b/libfuse-lite/Makefile.in
index 155b477..e4c8bd9 100755
--- a/libfuse-lite/Makefile.in
+++ b/libfuse-lite/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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.
@@ -16,8 +17,9 @@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
@@ -36,12 +38,16 @@ target_triplet = @target@
subdir = libfuse-lite
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
+CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
am__DEPENDENCIES_1 =
libfuse_lite_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
@@ -60,6 +66,7 @@ libfuse_lite_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
+am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
@@ -86,54 +93,69 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FGREP = @FGREP@
FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@
FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
LDCONFIG = @LDCONFIG@
LDFLAGS = @LDFLAGS@
+LIBFUSE_LITE_CFLAGS = @LIBFUSE_LITE_CFLAGS@
LIBFUSE_LITE_LIBS = @LIBFUSE_LITE_LIBS@
+LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
LIBNTFS_3G_VERSION = @LIBNTFS_3G_VERSION@
+LIBNTFS_CPPFLAGS = @LIBNTFS_CPPFLAGS@
+LIBNTFS_LIBS = @LIBNTFS_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MKNTFS_CPPFLAGS = @MKNTFS_CPPFLAGS@
+MKNTFS_LIBS = @MKNTFS_LIBS@
MV = @MV@
+NM = @NM@
NMEDIT = @NMEDIT@
+NTFSPROGS_STATIC_LIBS = @NTFSPROGS_STATIC_LIBS@
+OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
OUTPUT_FORMAT = @OUTPUT_FORMAT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
RM = @RM@
SED = @SED@
@@ -146,8 +168,9 @@ abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+all_includes = @all_includes@
+all_libraries = @all_libraries@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -178,6 +201,7 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
ntfs3gincludedir = @ntfs3gincludedir@
@@ -199,12 +223,14 @@ target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
@FUSE_INTERNAL_TRUE@noinst_LTLIBRARIES = libfuse-lite.la
libfuse_lite_la_CFLAGS = \
$(AM_CFLAGS) \
+ $(LIBFUSE_LITE_CFLAGS) \
-I$(top_srcdir)/include/fuse-lite
libfuse_lite_la_LIBADD = $(LIBFUSE_LITE_LIBS)
@@ -232,14 +258,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libfuse-lite/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu libfuse-lite/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libfuse-lite/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu libfuse-lite/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -257,6 +283,7 @@ $(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
+$(am__aclocal_m4_deps):
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@@ -289,101 +316,101 @@ distclean-compile:
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@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@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@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 $@ $<
libfuse_lite_la-fuse.lo: fuse.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-fuse.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-fuse.Tpo -c -o libfuse_lite_la-fuse.lo `test -f 'fuse.c' || echo '$(srcdir)/'`fuse.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libfuse_lite_la-fuse.Tpo $(DEPDIR)/libfuse_lite_la-fuse.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-fuse.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-fuse.Tpo -c -o libfuse_lite_la-fuse.lo `test -f 'fuse.c' || echo '$(srcdir)/'`fuse.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libfuse_lite_la-fuse.Tpo $(DEPDIR)/libfuse_lite_la-fuse.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fuse.c' object='libfuse_lite_la-fuse.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-fuse.lo `test -f 'fuse.c' || echo '$(srcdir)/'`fuse.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-fuse.lo `test -f 'fuse.c' || echo '$(srcdir)/'`fuse.c
libfuse_lite_la-fuse_kern_chan.lo: fuse_kern_chan.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-fuse_kern_chan.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-fuse_kern_chan.Tpo -c -o libfuse_lite_la-fuse_kern_chan.lo `test -f 'fuse_kern_chan.c' || echo '$(srcdir)/'`fuse_kern_chan.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libfuse_lite_la-fuse_kern_chan.Tpo $(DEPDIR)/libfuse_lite_la-fuse_kern_chan.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-fuse_kern_chan.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-fuse_kern_chan.Tpo -c -o libfuse_lite_la-fuse_kern_chan.lo `test -f 'fuse_kern_chan.c' || echo '$(srcdir)/'`fuse_kern_chan.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libfuse_lite_la-fuse_kern_chan.Tpo $(DEPDIR)/libfuse_lite_la-fuse_kern_chan.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fuse_kern_chan.c' object='libfuse_lite_la-fuse_kern_chan.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-fuse_kern_chan.lo `test -f 'fuse_kern_chan.c' || echo '$(srcdir)/'`fuse_kern_chan.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-fuse_kern_chan.lo `test -f 'fuse_kern_chan.c' || echo '$(srcdir)/'`fuse_kern_chan.c
libfuse_lite_la-fuse_loop.lo: fuse_loop.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-fuse_loop.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-fuse_loop.Tpo -c -o libfuse_lite_la-fuse_loop.lo `test -f 'fuse_loop.c' || echo '$(srcdir)/'`fuse_loop.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libfuse_lite_la-fuse_loop.Tpo $(DEPDIR)/libfuse_lite_la-fuse_loop.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-fuse_loop.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-fuse_loop.Tpo -c -o libfuse_lite_la-fuse_loop.lo `test -f 'fuse_loop.c' || echo '$(srcdir)/'`fuse_loop.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libfuse_lite_la-fuse_loop.Tpo $(DEPDIR)/libfuse_lite_la-fuse_loop.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fuse_loop.c' object='libfuse_lite_la-fuse_loop.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-fuse_loop.lo `test -f 'fuse_loop.c' || echo '$(srcdir)/'`fuse_loop.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-fuse_loop.lo `test -f 'fuse_loop.c' || echo '$(srcdir)/'`fuse_loop.c
libfuse_lite_la-fuse_lowlevel.lo: fuse_lowlevel.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-fuse_lowlevel.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-fuse_lowlevel.Tpo -c -o libfuse_lite_la-fuse_lowlevel.lo `test -f 'fuse_lowlevel.c' || echo '$(srcdir)/'`fuse_lowlevel.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libfuse_lite_la-fuse_lowlevel.Tpo $(DEPDIR)/libfuse_lite_la-fuse_lowlevel.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-fuse_lowlevel.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-fuse_lowlevel.Tpo -c -o libfuse_lite_la-fuse_lowlevel.lo `test -f 'fuse_lowlevel.c' || echo '$(srcdir)/'`fuse_lowlevel.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libfuse_lite_la-fuse_lowlevel.Tpo $(DEPDIR)/libfuse_lite_la-fuse_lowlevel.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fuse_lowlevel.c' object='libfuse_lite_la-fuse_lowlevel.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-fuse_lowlevel.lo `test -f 'fuse_lowlevel.c' || echo '$(srcdir)/'`fuse_lowlevel.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-fuse_lowlevel.lo `test -f 'fuse_lowlevel.c' || echo '$(srcdir)/'`fuse_lowlevel.c
libfuse_lite_la-fuse_opt.lo: fuse_opt.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-fuse_opt.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-fuse_opt.Tpo -c -o libfuse_lite_la-fuse_opt.lo `test -f 'fuse_opt.c' || echo '$(srcdir)/'`fuse_opt.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libfuse_lite_la-fuse_opt.Tpo $(DEPDIR)/libfuse_lite_la-fuse_opt.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-fuse_opt.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-fuse_opt.Tpo -c -o libfuse_lite_la-fuse_opt.lo `test -f 'fuse_opt.c' || echo '$(srcdir)/'`fuse_opt.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libfuse_lite_la-fuse_opt.Tpo $(DEPDIR)/libfuse_lite_la-fuse_opt.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fuse_opt.c' object='libfuse_lite_la-fuse_opt.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-fuse_opt.lo `test -f 'fuse_opt.c' || echo '$(srcdir)/'`fuse_opt.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-fuse_opt.lo `test -f 'fuse_opt.c' || echo '$(srcdir)/'`fuse_opt.c
libfuse_lite_la-fuse_session.lo: fuse_session.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-fuse_session.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-fuse_session.Tpo -c -o libfuse_lite_la-fuse_session.lo `test -f 'fuse_session.c' || echo '$(srcdir)/'`fuse_session.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libfuse_lite_la-fuse_session.Tpo $(DEPDIR)/libfuse_lite_la-fuse_session.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-fuse_session.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-fuse_session.Tpo -c -o libfuse_lite_la-fuse_session.lo `test -f 'fuse_session.c' || echo '$(srcdir)/'`fuse_session.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libfuse_lite_la-fuse_session.Tpo $(DEPDIR)/libfuse_lite_la-fuse_session.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fuse_session.c' object='libfuse_lite_la-fuse_session.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-fuse_session.lo `test -f 'fuse_session.c' || echo '$(srcdir)/'`fuse_session.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-fuse_session.lo `test -f 'fuse_session.c' || echo '$(srcdir)/'`fuse_session.c
libfuse_lite_la-fuse_signals.lo: fuse_signals.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-fuse_signals.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-fuse_signals.Tpo -c -o libfuse_lite_la-fuse_signals.lo `test -f 'fuse_signals.c' || echo '$(srcdir)/'`fuse_signals.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libfuse_lite_la-fuse_signals.Tpo $(DEPDIR)/libfuse_lite_la-fuse_signals.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-fuse_signals.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-fuse_signals.Tpo -c -o libfuse_lite_la-fuse_signals.lo `test -f 'fuse_signals.c' || echo '$(srcdir)/'`fuse_signals.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libfuse_lite_la-fuse_signals.Tpo $(DEPDIR)/libfuse_lite_la-fuse_signals.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fuse_signals.c' object='libfuse_lite_la-fuse_signals.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-fuse_signals.lo `test -f 'fuse_signals.c' || echo '$(srcdir)/'`fuse_signals.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-fuse_signals.lo `test -f 'fuse_signals.c' || echo '$(srcdir)/'`fuse_signals.c
libfuse_lite_la-fusermount.lo: fusermount.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-fusermount.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-fusermount.Tpo -c -o libfuse_lite_la-fusermount.lo `test -f 'fusermount.c' || echo '$(srcdir)/'`fusermount.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libfuse_lite_la-fusermount.Tpo $(DEPDIR)/libfuse_lite_la-fusermount.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-fusermount.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-fusermount.Tpo -c -o libfuse_lite_la-fusermount.lo `test -f 'fusermount.c' || echo '$(srcdir)/'`fusermount.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libfuse_lite_la-fusermount.Tpo $(DEPDIR)/libfuse_lite_la-fusermount.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='fusermount.c' object='libfuse_lite_la-fusermount.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-fusermount.lo `test -f 'fusermount.c' || echo '$(srcdir)/'`fusermount.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-fusermount.lo `test -f 'fusermount.c' || echo '$(srcdir)/'`fusermount.c
libfuse_lite_la-helper.lo: helper.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-helper.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-helper.Tpo -c -o libfuse_lite_la-helper.lo `test -f 'helper.c' || echo '$(srcdir)/'`helper.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libfuse_lite_la-helper.Tpo $(DEPDIR)/libfuse_lite_la-helper.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-helper.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-helper.Tpo -c -o libfuse_lite_la-helper.lo `test -f 'helper.c' || echo '$(srcdir)/'`helper.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libfuse_lite_la-helper.Tpo $(DEPDIR)/libfuse_lite_la-helper.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='helper.c' object='libfuse_lite_la-helper.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-helper.lo `test -f 'helper.c' || echo '$(srcdir)/'`helper.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-helper.lo `test -f 'helper.c' || echo '$(srcdir)/'`helper.c
libfuse_lite_la-mount.lo: mount.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-mount.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-mount.Tpo -c -o libfuse_lite_la-mount.lo `test -f 'mount.c' || echo '$(srcdir)/'`mount.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libfuse_lite_la-mount.Tpo $(DEPDIR)/libfuse_lite_la-mount.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-mount.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-mount.Tpo -c -o libfuse_lite_la-mount.lo `test -f 'mount.c' || echo '$(srcdir)/'`mount.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libfuse_lite_la-mount.Tpo $(DEPDIR)/libfuse_lite_la-mount.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mount.c' object='libfuse_lite_la-mount.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-mount.lo `test -f 'mount.c' || echo '$(srcdir)/'`mount.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-mount.lo `test -f 'mount.c' || echo '$(srcdir)/'`mount.c
libfuse_lite_la-mount_util.lo: mount_util.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-mount_util.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-mount_util.Tpo -c -o libfuse_lite_la-mount_util.lo `test -f 'mount_util.c' || echo '$(srcdir)/'`mount_util.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libfuse_lite_la-mount_util.Tpo $(DEPDIR)/libfuse_lite_la-mount_util.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -MT libfuse_lite_la-mount_util.lo -MD -MP -MF $(DEPDIR)/libfuse_lite_la-mount_util.Tpo -c -o libfuse_lite_la-mount_util.lo `test -f 'mount_util.c' || echo '$(srcdir)/'`mount_util.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libfuse_lite_la-mount_util.Tpo $(DEPDIR)/libfuse_lite_la-mount_util.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mount_util.c' object='libfuse_lite_la-mount_util.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-mount_util.lo `test -f 'mount_util.c' || echo '$(srcdir)/'`mount_util.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libfuse_lite_la_CFLAGS) $(CFLAGS) -c -o libfuse_lite_la-mount_util.lo `test -f 'mount_util.c' || echo '$(srcdir)/'`mount_util.c
mostlyclean-libtool:
-rm -f *.lo
@@ -396,14 +423,14 @@ ID: $(HEADERS) $(SOURCES) $(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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
+ set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -411,29 +438,34 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
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; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
+ $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -454,13 +486,17 @@ distdir: $(DISTFILES)
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@@ -488,6 +524,7 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -510,6 +547,8 @@ dvi-am:
html: html-am
+html-am:
+
info: info-am
info-am:
@@ -518,18 +557,28 @@ install-data-am:
install-dvi: install-dvi-am
+install-dvi-am:
+
install-exec-am:
install-html: install-html-am
+install-html-am:
+
install-info: install-info-am
+install-info-am:
+
install-man:
install-pdf: install-pdf-am
+install-pdf-am:
+
install-ps: install-ps-am
+install-ps-am:
+
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -567,6 +616,9 @@ uninstall-am:
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am
+
+libs: libfuse-lite.la
+
# 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/libfuse-lite/fuse.c b/libfuse-lite/fuse.c
index a60717b..a5bf6bd 100755
--- a/libfuse-lite/fuse.c
+++ b/libfuse-lite/fuse.c
@@ -6,6 +6,11 @@
See the file COPYING.LIB
*/
+#ifdef __SOLARIS__
+/* For pthread_rwlock_t */
+#define _GNU_SOURCE
+#endif /* __SOLARIS__ */
+
#include "config.h"
#include "fuse_i.h"
#include "fuse_lowlevel.h"
@@ -28,6 +33,10 @@
#include <sys/uio.h>
#include <sys/time.h>
+#ifdef __SOLARIS__
+#define FUSE_MAX_PATH 4096
+#endif /* __SOLARIS__ */
+
#define FUSE_DEFAULT_INTR_SIGNAL SIGUSR1
#define FUSE_UNKNOWN_INO 0xffffffff
@@ -54,13 +63,27 @@ struct fuse_config {
int intr;
int intr_signal;
int help;
+#ifdef __SOLARIS__
+ int auto_cache;
+ char *modules;
+#endif /* __SOLARIS__ */
};
struct fuse_fs {
struct fuse_operations op;
void *user_data;
+#ifdef __SOLARIS__
+ struct fuse_module *m;
+#endif /* __SOLARIS__ */
};
+#ifdef __SOLARIS__
+struct fusemod_so {
+ void *handle;
+ int ctr;
+};
+#endif /* __SOLARIS__ */
+
struct fuse {
struct fuse_session *se;
struct node **name_table;
@@ -75,7 +98,6 @@ struct fuse {
struct fuse_config conf;
int intr_installed;
struct fuse_fs *fs;
- int utime_omit_ok;
};
struct lock {
@@ -98,6 +120,12 @@ struct node {
uint64_t nlookup;
int open_count;
int is_hidden;
+#ifdef __SOLARIS__
+ struct timespec stat_updated;
+ struct timespec mtime;
+ off_t size;
+ int cache_valid;
+#endif /* __SOLARIS__ */
struct lock *locks;
};
@@ -125,6 +153,107 @@ static pthread_key_t fuse_context_key;
static pthread_mutex_t fuse_context_lock = PTHREAD_MUTEX_INITIALIZER;
static int fuse_context_ref;
+#ifdef __SOLARIS__
+
+static struct fusemod_so *fuse_current_so;
+static struct fuse_module *fuse_modules;
+
+static int fuse_load_so_name(const char *soname)
+{
+ struct fusemod_so *so;
+
+ so = calloc(1, sizeof(struct fusemod_so));
+ if (!so) {
+ fprintf(stderr, "fuse: memory allocation failed\n");
+ return -1;
+ }
+
+ fuse_current_so = so;
+ so->handle = dlopen(soname, RTLD_NOW);
+ fuse_current_so = NULL;
+ if (!so->handle) {
+ fprintf(stderr, "fuse: %s\n", dlerror());
+ goto err;
+ }
+ if (!so->ctr) {
+ fprintf(stderr, "fuse: %s did not register any modules", soname);
+ goto err;
+ }
+ return 0;
+
+ err:
+ if (so->handle)
+ dlclose(so->handle);
+ free(so);
+ return -1;
+}
+
+static int fuse_load_so_module(const char *module)
+{
+ int res;
+ char *soname = malloc(strlen(module) + 64);
+ if (!soname) {
+ fprintf(stderr, "fuse: memory allocation failed\n");
+ return -1;
+ }
+ sprintf(soname, "libfusemod_%s.so", module);
+ res = fuse_load_so_name(soname);
+ free(soname);
+ return res;
+}
+
+static struct fuse_module *fuse_find_module(const char *module)
+{
+ struct fuse_module *m;
+ for (m = fuse_modules; m; m = m->next) {
+ if (strcmp(module, m->name) == 0) {
+ m->ctr++;
+ break;
+ }
+ }
+ return m;
+}
+
+static struct fuse_module *fuse_get_module(const char *module)
+{
+ struct fuse_module *m;
+
+ pthread_mutex_lock(&fuse_context_lock);
+ m = fuse_find_module(module);
+ if (!m) {
+ int err = fuse_load_so_module(module);
+ if (!err)
+ m = fuse_find_module(module);
+ }
+ pthread_mutex_unlock(&fuse_context_lock);
+ return m;
+}
+
+static void fuse_put_module(struct fuse_module *m)
+{
+ pthread_mutex_lock(&fuse_context_lock);
+ assert(m->ctr > 0);
+ m->ctr--;
+ if (!m->ctr && m->so) {
+ struct fusemod_so *so = m->so;
+ assert(so->ctr > 0);
+ so->ctr--;
+ if (!so->ctr) {
+ struct fuse_module **mp;
+ for (mp = &fuse_modules; *mp;) {
+ if ((*mp)->so == so)
+ *mp = (*mp)->next;
+ else
+ mp = &(*mp)->next;
+ }
+ dlclose(so->handle);
+ free(so);
+ }
+ }
+ pthread_mutex_unlock(&fuse_context_lock);
+}
+#endif /* __SOLARIS__ */
+
static struct node *get_node_nocheck(struct fuse *f, fuse_ino_t nodeid)
{
size_t hash = nodeid % f->id_table_size;
@@ -297,10 +426,15 @@ static struct node *find_node(struct fuse *f, fuse_ino_t parent,
return node;
}
+#ifndef __SOLARIS__
static char *add_name(char **buf, unsigned *bufsize, char *s, const char *name)
+#else /* __SOLARIS__ */
+static char *add_name(char *buf, char *s, const char *name)
+#endif /* __SOLARIS__ */
{
size_t len = strlen(name);
+#ifndef __SOLARIS__
if (s - len <= *buf) {
unsigned pathlen = *bufsize - (s - *buf);
unsigned newbufsize = *bufsize;
@@ -323,6 +457,13 @@ static char *add_name(char **buf, unsigned *bufsize, char *s, const char *name)
*bufsize = newbufsize;
}
s -= len;
+#else /* ! __SOLARIS__ */
+ s -= len;
+ if (s <= buf) {
+ fprintf(stderr, "fuse: path too long: ...%s\n", s + len);
+ return NULL;
+ }
+#endif /* __SOLARIS__ */
strncpy(s, name, len);
s--;
*s = '/';
@@ -332,6 +473,42 @@ static char *add_name(char **buf, unsigned *bufsize, char *s, const char *name)
static char *get_path_name(struct fuse *f, fuse_ino_t nodeid, const char *name)
{
+#ifdef __SOLARIS__
+ char buf[FUSE_MAX_PATH];
+ char *s = buf + FUSE_MAX_PATH - 1;
+ struct node *node;
+
+ *s = '\0';
+
+ if (name != NULL) {
+ s = add_name(buf, s, name);
+ if (s == NULL)
+ return NULL;
+ }
+
+ pthread_mutex_lock(&f->lock);
+ for (node = get_node(f, nodeid); node && node->nodeid != FUSE_ROOT_ID;
+ node = node->parent) {
+ if (node->name == NULL) {
+ s = NULL;
+ break;
+ }
+
+ s = add_name(buf, s, node->name);
+ if (s == NULL)
+ break;
+ }
+ pthread_mutex_unlock(&f->lock);
+
+ if (node == NULL || s == NULL)
+ return NULL;
+ else if (*s == '\0')
+ return strdup("/");
+ else
+ return strdup(s);
+
+#else /* __SOLARIS__ */
+
unsigned bufsize = 256;
char *buf;
char *s;
@@ -376,6 +553,7 @@ static char *get_path_name(struct fuse *f, fuse_ino_t nodeid, const char *name)
out_free:
free(buf);
return NULL;
+#endif /* __SOLARIS__ */
}
static char *get_path(struct fuse *f, fuse_ino_t nodeid)
@@ -678,13 +856,13 @@ int fuse_fs_flush(struct fuse_fs *fs, const char *path,
}
#if HAVE_SYS_STATVFS_H
-int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statfs *buf)
+int fuse_fs_statfs(struct fuse_fs *fs, const char *path, struct statvfs *buf)
{
fuse_get_context()->private_data = fs->user_data;
if (fs->op.statfs)
return fs->op.statfs(path, buf);
else {
- buf->f_namelen = 255;
+ buf->f_namemax = 255;
buf->f_bsize = 512;
return 0;
}
@@ -932,6 +1110,44 @@ static int hide_node(struct fuse *f, const char *oldpath,
return err;
}
+#ifdef __SOLARIS__
+
+static int mtime_eq(const struct stat *stbuf, const struct timespec *ts)
+{
+ return stbuf->st_mtime == ts->tv_sec && ST_MTIM_NSEC(stbuf) == ts->tv_nsec;
+}
+
+#ifndef CLOCK_MONOTONIC
+#define CLOCK_MONOTONIC CLOCK_REALTIME
+#endif
+
+static void curr_time(struct timespec *now)
+{
+ static clockid_t clockid = CLOCK_MONOTONIC;
+ int res = clock_gettime(clockid, now);
+ if (res == -1 && errno == EINVAL) {
+ clockid = CLOCK_REALTIME;
+ res = clock_gettime(clockid, now);
+ }
+ if (res == -1) {
+ perror("fuse: clock_gettime");
+ abort();
+ }
+}
+
+static void update_stat(struct node *node, const struct stat *stbuf)
+{
+ if (node->cache_valid && (!mtime_eq(stbuf, &node->mtime) ||
+ stbuf->st_size != node->size))
+ node->cache_valid = 0;
+ node->mtime.tv_sec = stbuf->st_mtime;
+ node->mtime.tv_nsec = ST_MTIM_NSEC(stbuf);
+ node->size = stbuf->st_size;
+ curr_time(&node->stat_updated);
+}
+
+#endif /* __SOLARIS__ */
+
static int lookup_path(struct fuse *f, fuse_ino_t nodeid,
const char *name, const char *path,
struct fuse_entry_param *e, struct fuse_file_info *fi)
@@ -954,6 +1170,13 @@ static int lookup_path(struct fuse *f, fuse_ino_t nodeid,
e->generation = node->generation;
e->entry_timeout = f->conf.entry_timeout;
e->attr_timeout = f->conf.attr_timeout;
+#ifdef __SOLARIS__
+ if (f->conf.auto_cache) {
+ pthread_mutex_lock(&f->lock);
+ update_stat(node, &e->attr);
+ pthread_mutex_unlock(&f->lock);
+ }
+#endif /* __SOLARIS__ */
set_stat(f, e->ino, &e->attr);
if (f->conf.debug)
fprintf(stderr, " NODEID: %lu\n", (unsigned long) e->ino);
@@ -1030,7 +1253,11 @@ static struct fuse *req_fuse_prepare(fuse_req_t req)
return c->ctx.fuse;
}
+#ifndef __SOLARIS__
static void reply_err(fuse_req_t req, int err)
+#else /* __SOLARIS__ */
+static inline void reply_err(fuse_req_t req, int err)
+#endif /* __SOLARIS__ */
{
/* fuse_reply_err() uses non-negated errno values */
fuse_reply_err(req, -err);
@@ -1069,6 +1296,10 @@ void fuse_fs_destroy(struct fuse_fs *fs)
fuse_get_context()->private_data = fs->user_data;
if (fs->op.destroy)
fs->op.destroy(fs->user_data);
+#ifdef __SOLARIS__
+ if (fs->m)
+ fuse_put_module(fs->m);
+#endif /* __SOLARIS__ */
free(fs);
}
@@ -1145,6 +1376,13 @@ static void fuse_lib_getattr(fuse_req_t req, fuse_ino_t ino,
}
pthread_rwlock_unlock(&f->tree_lock);
if (!err) {
+#ifdef __SOLARIS__
+ if (f->conf.auto_cache) {
+ pthread_mutex_lock(&f->lock);
+ update_stat(get_node(f, ino), &buf);
+ pthread_mutex_unlock(&f->lock);
+ }
+#endif /* __SOLARIS__ */
set_stat(f, ino, &buf);
fuse_reply_attr(req, &buf, f->conf.attr_timeout);
} else
@@ -1191,7 +1429,7 @@ static void fuse_lib_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
err = fuse_fs_truncate(f->fs, path, attr->st_size);
}
#ifdef HAVE_UTIMENSAT
- if (!err && f->utime_omit_ok &&
+ if (!err &&
(valid & (FUSE_SET_ATTR_ATIME | FUSE_SET_ATTR_MTIME))) {
struct timespec tv[2];
@@ -1229,6 +1467,13 @@ static void fuse_lib_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
}
pthread_rwlock_unlock(&f->tree_lock);
if (!err) {
+#ifdef __SOLARIS__
+ if (f->conf.auto_cache) {
+ pthread_mutex_lock(&f->lock);
+ update_stat(get_node(f, ino), &buf);
+ pthread_mutex_unlock(&f->lock);
+ }
+#endif /* __SOLARIS__ */
set_stat(f, ino, &buf);
fuse_reply_attr(req, &buf, f->conf.attr_timeout);
} else
@@ -1573,6 +1818,47 @@ static void fuse_lib_create(fuse_req_t req, fuse_ino_t parent,
pthread_rwlock_unlock(&f->tree_lock);
}
+#ifdef __SOLARIS__
+
+static double diff_timespec(const struct timespec *t1,
+ const struct timespec *t2)
+{
+ return (t1->tv_sec - t2->tv_sec) +
+ ((double) t1->tv_nsec - (double) t2->tv_nsec) / 1000000000.0;
+}
+
+static void open_auto_cache(struct fuse *f, fuse_ino_t ino, const char *path,
+ struct fuse_file_info *fi)
+{
+ struct node *node;
+
+ pthread_mutex_lock(&f->lock);
+ node = get_node(f, ino);
+ if (node->cache_valid) {
+ struct timespec now;
+
+ curr_time(&now);
+ if (diff_timespec(&now, &node->stat_updated) > f->conf.ac_attr_timeout) {
+ struct stat stbuf;
+ int err;
+ pthread_mutex_unlock(&f->lock);
+ err = fuse_fs_fgetattr(f->fs, path, &stbuf, fi);
+ pthread_mutex_lock(&f->lock);
+ if (!err)
+ update_stat(node, &stbuf);
+ else
+ node->cache_valid = 0;
+ }
+ }
+ if (node->cache_valid)
+ fi->keep_cache = 1;
+
+ node->cache_valid = 1;
+ pthread_mutex_unlock(&f->lock);
+}
+
+#endif /* __SOLARIS__ */
+
static void fuse_lib_open(fuse_req_t req, fuse_ino_t ino,
struct fuse_file_info *fi)
{
@@ -1592,6 +1878,11 @@ static void fuse_lib_open(fuse_req_t req, fuse_ino_t ino,
fi->direct_io = 1;
if (f->conf.kernel_cache)
fi->keep_cache = 1;
+#ifdef __SOLARIS__
+
+ if (f->conf.auto_cache)
+ open_auto_cache(f, ino, path, fi);
+#endif /* __SOLARIS__ */
}
fuse_finish_interrupt(f, req, &d);
}
@@ -1777,7 +2068,9 @@ static void fuse_lib_opendir(fuse_req_t req, fuse_ino_t ino,
}
} else {
reply_err(req, err);
+#ifndef __SOLARIS__
pthread_mutex_destroy(&dh->lock);
+#endif /* ! __SOLARIS__ */
free(dh);
}
free(path);
@@ -1791,12 +2084,17 @@ static int extend_contents(struct fuse_dh *dh, unsigned minsize)
unsigned newsize = dh->size;
if (!newsize)
newsize = 1024;
+#ifndef __SOLARIS__
while (newsize < minsize) {
if (newsize >= 0x80000000)
newsize = 0xffffffff;
else
newsize *= 2;
}
+#else /* __SOLARIS__ */
+ while (newsize < minsize)
+ newsize *= 2;
+#endif /* __SOLARIS__ */
newptr = (char *) realloc(dh->contents, newsize);
if (!newptr) {
@@ -1971,12 +2269,11 @@ static void fuse_lib_fsyncdir(fuse_req_t req, fuse_ino_t ino, int datasync,
reply_err(req, err);
}
+#if HAVE_SYS_STATVFS_H
static void fuse_lib_statfs(fuse_req_t req, fuse_ino_t ino)
{
struct fuse *f = req_fuse_prepare(req);
-
-#if HAVE_SYS_STATVFS_H
- struct statfs buf;
+ struct statvfs buf;
char *path;
int err;
@@ -2002,8 +2299,8 @@ static void fuse_lib_statfs(fuse_req_t req, fuse_ino_t ino)
fuse_reply_statfs(req, &buf);
else
reply_err(req, err);
-#endif
}
+#endif
static void fuse_lib_setxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
const char *value, size_t size, int flags)
@@ -2450,7 +2747,9 @@ static struct fuse_lowlevel_ops fuse_path_ops = {
.readdir = fuse_lib_readdir,
.releasedir = fuse_lib_releasedir,
.fsyncdir = fuse_lib_fsyncdir,
+#if HAVE_SYS_STATVFS_H
.statfs = fuse_lib_statfs,
+#endif
.setxattr = fuse_lib_setxattr,
.getxattr = fuse_lib_getxattr,
.listxattr = fuse_lib_listxattr,
@@ -2506,6 +2805,10 @@ static const struct fuse_opt fuse_lib_opts[] = {
FUSE_LIB_OPT("readdir_ino", readdir_ino, 1),
FUSE_LIB_OPT("direct_io", direct_io, 1),
FUSE_LIB_OPT("kernel_cache", kernel_cache, 1),
+#ifdef __SOLARIS__
+ FUSE_LIB_OPT("auto_cache", auto_cache, 1),
+ FUSE_LIB_OPT("noauto_cache", auto_cache, 0),
+#endif /* __SOLARIS__ */
FUSE_LIB_OPT("umask=", set_mode, 1),
FUSE_LIB_OPT("umask=%o", umask, 0),
FUSE_LIB_OPT("uid=", set_uid, 1),
@@ -2519,6 +2822,9 @@ static const struct fuse_opt fuse_lib_opts[] = {
FUSE_LIB_OPT("negative_timeout=%lf", negative_timeout, 0),
FUSE_LIB_OPT("intr", intr, 1),
FUSE_LIB_OPT("intr_signal=%d", intr_signal, 0),
+#ifdef __SOLARIS__
+ FUSE_LIB_OPT("modules=%s", modules, 0),
+#endif /* __SOLARIS__ */
FUSE_OPT_END
};
@@ -2530,6 +2836,9 @@ static void fuse_lib_help(void)
" -o readdir_ino try to fill in d_ino in readdir\n"
" -o direct_io use direct I/O\n"
" -o kernel_cache cache files in kernel\n"
+#ifdef __SOLARIS__
+" -o [no]auto_cache enable caching based on modification times\n"
+#endif /* __SOLARIS__ */
" -o umask=M set file permissions (octal)\n"
" -o uid=N set file owner\n"
" -o gid=N set file group\n"
@@ -2539,9 +2848,42 @@ static void fuse_lib_help(void)
" -o ac_attr_timeout=T auto cache timeout for attributes (attr_timeout)\n"
" -o intr allow requests to be interrupted\n"
" -o intr_signal=NUM signal to send on interrupt (%i)\n"
+#ifdef __SOLARIS__
+" -o modules=M1[:M2...] names of modules to push onto filesystem stack\n"
+#endif /* __SOLARIS__ */
"\n", FUSE_DEFAULT_INTR_SIGNAL);
}
+#ifdef __SOLARIS__
+
+static void fuse_lib_help_modules(void)
+{
+ struct fuse_module *m;
+ fprintf(stderr, "\nModule options:\n");
+ pthread_mutex_lock(&fuse_context_lock);
+ for (m = fuse_modules; m; m = m->next) {
+ struct fuse_fs *fs = NULL;
+ struct fuse_fs *newfs;
+ struct fuse_args args = FUSE_ARGS_INIT(0, NULL);
+ if (fuse_opt_add_arg(&args, "") != -1 &&
+ fuse_opt_add_arg(&args, "-h") != -1) {
+ fprintf(stderr, "\n[%s]\n", m->name);
+ newfs = m->factory(&args, &fs);
+ assert(newfs == NULL);
+ }
+ fuse_opt_free_args(&args);
+ }
+ pthread_mutex_unlock(&fuse_context_lock);
+}
+
+int fuse_is_lib_option(const char *opt)
+{
+ return fuse_lowlevel_is_lib_option(opt) ||
+ fuse_opt_match(fuse_lib_opts, opt);
+}
+
+#endif /* __SOLARIS__ */
+
static int fuse_lib_opt_proc(void *data, const char *arg, int key,
struct fuse_args *outargs)
{
@@ -2590,6 +2932,32 @@ static void fuse_restore_intr_signal(int signum)
sigaction(signum, &sa, NULL);
}
+#ifdef __SOLARIS__
+
+static int fuse_push_module(struct fuse *f, const char *module,
+ struct fuse_args *args)
+{
+ struct fuse_fs *newfs;
+ struct fuse_module *m = fuse_get_module(module);
+ struct fuse_fs *fs[2];
+
+ fs[0] = f->fs;
+ fs[1] = NULL;
+ if (!m)
+ return -1;
+
+ newfs = m->factory(args, fs);
+ if (!newfs) {
+ fuse_put_module(m);
+ return -1;
+ }
+ newfs->m = m;
+ f->fs = newfs;
+ return 0;
+}
+
+#endif /* __SOLARIS__ */
+
struct fuse_fs *fuse_fs_new(const struct fuse_operations *op, size_t op_size,
void *user_data)
{
@@ -2635,7 +3003,6 @@ struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args,
goto out_free;
f->fs = fs;
- f->utime_omit_ok = fs->op.flag_utime_omit_ok;
/* Oh f**k, this is ugly! */
if (!fs->op.lock) {
@@ -2643,7 +3010,6 @@ struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args,
llop.setlk = NULL;
}
-// f->conf.direct_io = 1;
f->conf.entry_timeout = 1.0;
f->conf.attr_timeout = 1.0;
f->conf.negative_timeout = 0.0;
@@ -2652,10 +3018,26 @@ struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args,
if (fuse_opt_parse(args, &f->conf, fuse_lib_opts, fuse_lib_opt_proc) == -1)
goto out_free_fs;
+#ifdef __SOLARIS__
+ if (f->conf.modules) {
+ char *module;
+ char *next;
+
+ for (module = f->conf.modules; module; module = next) {
+ char *p;
+ for (p = module; *p && *p != ':'; p++);
+ next = *p ? p + 1 : NULL;
+ *p = '\0';
+ if (module[0] && fuse_push_module(f, module, args) == -1)
+ goto out_free_fs;
+ }
+ }
+#endif /* __SOLARIS__ */
+
if (!f->conf.ac_attr_timeout_set)
f->conf.ac_attr_timeout = f->conf.attr_timeout;
-#ifdef __FreeBSD__
+#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__)
/*
* In FreeBSD, we always use these settings as inode numbers are needed to
* make getcwd(3) work.
@@ -2664,14 +3046,17 @@ struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args,
#endif
f->se = fuse_lowlevel_new(args, &llop, sizeof(llop), f);
+
if (f->se == NULL) {
+#ifdef __SOLARIS__
+ if (f->conf.help)
+ fuse_lib_help_modules();
+#endif /* __SOLARIS__ */
goto out_free_fs;
}
fuse_session_add_chan(f->se, ch);
- if (f->conf.debug)
- fprintf(stderr, "utime_omit_ok: %i\n", f->utime_omit_ok);
f->ctr = 0;
f->generation = 0;
/* FIXME: Dynamic hash table */
@@ -2734,6 +3119,9 @@ struct fuse *fuse_new(struct fuse_chan *ch, struct fuse_args *args,
called on the filesystem without init being called first */
fs->op.destroy = NULL;
fuse_fs_destroy(f->fs);
+#ifdef __SOLARIS__
+ free(f->conf.modules);
+#endif /* __SOLARIS__ */
out_free:
free(f);
out_delete_context_key:
@@ -2783,7 +3171,9 @@ void fuse_destroy(struct fuse *f)
pthread_mutex_destroy(&f->lock);
pthread_rwlock_destroy(&f->tree_lock);
fuse_session_destroy(f->se);
+#ifdef __SOLARIS__
+ free(f->conf.modules);
+#endif /* __SOLARIS__ */
free(f);
fuse_delete_context_key();
}
-
diff --git a/libfuse-lite/fuse_kern_chan.c b/libfuse-lite/fuse_kern_chan.c
index 0afec4b..e9963b5 100755
--- a/libfuse-lite/fuse_kern_chan.c
+++ b/libfuse-lite/fuse_kern_chan.c
@@ -81,7 +81,7 @@ static void fuse_kern_chan_destroy(struct fuse_chan *ch)
close(fuse_chan_fd(ch));
}
-#define MIN_BUFSIZE 0x101000
+#define MIN_BUFSIZE 0x21000
struct fuse_chan *fuse_kern_chan_new(int fd)
{
diff --git a/libfuse-lite/fuse_lowlevel.c b/libfuse-lite/fuse_lowlevel.c
index 1457e6c..2ade0d3 100755
--- a/libfuse-lite/fuse_lowlevel.c
+++ b/libfuse-lite/fuse_lowlevel.c
@@ -192,6 +192,7 @@ static int send_reply(fuse_req_t req, int error, const void *arg,
return send_reply_iov(req, error, iov, count);
}
+#if 0 /* not used */
int fuse_reply_iov(fuse_req_t req, const struct iovec *iov, int count)
{
int res;
@@ -209,6 +210,7 @@ int fuse_reply_iov(fuse_req_t req, const struct iovec *iov, int count)
return res;
}
+#endif
size_t fuse_dirent_size(size_t namelen)
{
@@ -248,8 +250,7 @@ size_t fuse_add_direntry(fuse_req_t req, char *buf, size_t bufsize,
}
#if HAVE_SYS_STATVFS_H
-
-static void convert_statfs(const struct statfs *stbuf,
+static void convert_statfs(const struct statvfs *stbuf,
struct fuse_kstatfs *kstatfs)
{
kstatfs->bsize = stbuf->f_bsize;
@@ -259,11 +260,10 @@ static void convert_statfs(const struct statfs *stbuf,
kstatfs->bavail = stbuf->f_bavail;
kstatfs->files = stbuf->f_files;
kstatfs->ffree = stbuf->f_ffree;
- kstatfs->namelen = stbuf->f_namelen;
+ kstatfs->namelen = stbuf->f_namemax;
}
#endif
-
static int send_reply_ok(fuse_req_t req, const void *arg, size_t argsize)
{
return send_reply(req, 0, arg, argsize);
@@ -417,8 +417,7 @@ int fuse_reply_buf(fuse_req_t req, const char *buf, size_t size)
}
#if HAVE_SYS_STATVFS_H
-
-int fuse_reply_statfs(fuse_req_t req, const struct statfs *stbuf)
+int fuse_reply_statfs(fuse_req_t req, const struct statvfs *stbuf)
{
struct fuse_statfs_out arg;
size_t size = req->f->conn.proto_minor < 4 ? FUSE_COMPAT_STATFS_SIZE : sizeof(arg);
@@ -430,7 +429,6 @@ int fuse_reply_statfs(fuse_req_t req, const struct statfs *stbuf)
}
#endif
-
int fuse_reply_xattr(fuse_req_t req, size_t count)
{
struct fuse_getxattr_out arg;
@@ -552,7 +550,7 @@ static void do_mknod(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
name = (const char *) inarg + FUSE_COMPAT_MKNOD_IN_SIZE;
if (req->f->op.mknod)
- req->f->op.mknod(req, nodeid, name, arg->mode, arg->rdev);
+ req->f->op.mknod(req, nodeid, name, arg->mode, arg->rdev);
else
fuse_reply_err(req, ENOSYS);
}
@@ -627,7 +625,7 @@ static void do_link(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
static void do_create(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
{
- const struct fuse_create_in *arg = (const struct fuse_create_in *) inarg;
+ const struct fuse_create_in *arg = (const struct fuse_create_in *) inarg;
if (req->f->op.create) {
struct fuse_file_info fi;
@@ -816,6 +814,7 @@ static void do_fsyncdir(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
fuse_reply_err(req, ENOSYS);
}
+#if HAVE_SYS_STATVFS_H
static void do_statfs(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
{
(void) nodeid;
@@ -824,15 +823,14 @@ static void do_statfs(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
if (req->f->op.statfs)
req->f->op.statfs(req, nodeid);
else {
-#if HAVE_SYS_STATVFS_H
- struct statfs buf = {
- .f_namelen = 255,
+ struct statvfs buf = {
+ .f_namemax = 255,
.f_bsize = 512,
};
fuse_reply_statfs(req, &buf);
-#endif
}
}
+#endif
static void do_setxattr(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
{
@@ -1053,6 +1051,8 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
if (arg->flags & FUSE_DONT_MASK)
f->conn.capable |= FUSE_CAP_DONT_MASK;
#endif
+ if (arg->flags & FUSE_BIG_WRITES)
+ f->conn.capable |= FUSE_CAP_BIG_WRITES;
} else {
f->conn.async_read = 0;
f->conn.max_readahead = 0;
@@ -1097,7 +1097,8 @@ static void do_init(fuse_req_t req, fuse_ino_t nodeid, const void *inarg)
if (f->conn.want & FUSE_CAP_DONT_MASK)
outarg.flags |= FUSE_DONT_MASK;
#endif
- outarg.flags |= FUSE_BIG_WRITES ;
+ if (f->conn.want & FUSE_CAP_BIG_WRITES)
+ outarg.flags |= FUSE_BIG_WRITES;
outarg.max_readahead = f->conn.max_readahead;
outarg.max_write = f->conn.max_write;
@@ -1135,18 +1136,6 @@ const struct fuse_ctx *fuse_req_ctx(fuse_req_t req)
return &req->ctx;
}
-/*
- * The size of fuse_ctx got extended, so need to be careful about
- * incompatibility (i.e. a new binary cannot work with an old
- * library).
- */
-const struct fuse_ctx *fuse_req_ctx_compat24(fuse_req_t req);
-const struct fuse_ctx *fuse_req_ctx_compat24(fuse_req_t req)
-{
- return fuse_req_ctx(req);
-}
-//FUSE_SYMVER(".symver fuse_req_ctx_compat24,fuse_req_ctx@FUSE_2.4");
-
void fuse_req_interrupt_func(fuse_req_t req, fuse_interrupt_func_t func,
void *data)
{
@@ -1188,7 +1177,9 @@ static struct {
[FUSE_OPEN] = { do_open, "OPEN" },
[FUSE_READ] = { do_read, "READ" },
[FUSE_WRITE] = { do_write, "WRITE" },
+#if HAVE_SYS_STATVFS_H
[FUSE_STATFS] = { do_statfs, "STATFS" },
+#endif
[FUSE_RELEASE] = { do_release, "RELEASE" },
[FUSE_FSYNC] = { do_fsync, "FSYNC" },
[FUSE_SETXATTR] = { do_setxattr, "SETXATTR" },
@@ -1332,6 +1323,15 @@ static int fuse_ll_opt_proc(void *data, const char *arg, int key,
return -1;
}
+#ifdef __SOLARIS__
+
+int fuse_lowlevel_is_lib_option(const char *opt)
+{
+ return fuse_opt_match(fuse_ll_opts, opt);
+}
+
+#endif /* __SOLARIS__ */
+
static void fuse_ll_destroy(void *data)
{
struct fuse_ll *f = (struct fuse_ll *) data;
@@ -1392,4 +1392,3 @@ struct fuse_session *fuse_lowlevel_new(struct fuse_args *args,
out:
return NULL;
}
-
diff --git a/libfuse-lite/fuse_opt.c b/libfuse-lite/fuse_opt.c
index 7d76e02..80b0777 100755
--- a/libfuse-lite/fuse_opt.c
+++ b/libfuse-lite/fuse_opt.c
@@ -264,9 +264,23 @@ static int process_real_option_group(struct fuse_opt_context *ctx, char *opts)
do {
int res;
- sep = strchr(opts, ',');
- if (sep)
- *sep = '\0';
+#ifdef __SOLARIS__
+ /*
+ * On Solaris, the device name contains commas, so the
+ * option "fsname" has to be the last one and its commas
+ * should not be interpreted as option separators.
+ * This had to be hardcoded because the option "fsname"
+ * may be found though not present in option list.
+ */
+ if (!strncmp(opts,"fsname=",7))
+ sep = (char*)NULL;
+ else
+#endif /* __SOLARIS__ */
+ {
+ sep = strchr(opts, ',');
+ if (sep)
+ *sep = '\0';
+ }
res = process_gopt(ctx, opts, 1);
if (res == -1)
return -1;
diff --git a/libfuse-lite/fuse_session.c b/libfuse-lite/fuse_session.c
index c4e544d..3773303 100755
--- a/libfuse-lite/fuse_session.c
+++ b/libfuse-lite/fuse_session.c
@@ -165,9 +165,20 @@ struct fuse_session *fuse_chan_session(struct fuse_chan *ch)
int fuse_chan_recv(struct fuse_chan **chp, char *buf, size_t size)
{
struct fuse_chan *ch = *chp;
+
return ch->op.receive(chp, buf, size);
}
+#ifdef __SOLARIS__
+int fuse_chan_receive(struct fuse_chan *ch, char *buf, size_t size)
+{
+ int res;
+
+ res = fuse_chan_recv(&ch, buf, size);
+ return res >= 0 ? res : (res != -EINTR && res != -EAGAIN) ? -1 : 0;
+}
+#endif /* __SOLARIS__ */
+
int fuse_chan_send(struct fuse_chan *ch, const struct iovec iov[], size_t count)
{
return ch->op.send(ch, iov, count);
@@ -180,4 +191,3 @@ void fuse_chan_destroy(struct fuse_chan *ch)
ch->op.destroy(ch);
free(ch);
}
-
diff --git a/libfuse-lite/fusermount.c b/libfuse-lite/fusermount.c
index bfe057b..16b35a3 100755
--- a/libfuse-lite/fusermount.c
+++ b/libfuse-lite/fusermount.c
@@ -19,14 +19,20 @@
#include <errno.h>
#include <fcntl.h>
#include <pwd.h>
+
+#ifdef __SOLARIS__
+#include <sys/mnttab.h>
+#else /* __SOLARIS__ */
+#include <grp.h>
#include <mntent.h>
+#include <sys/fsuid.h>
+#endif /* __SOLARIS__ */
+
#include <sys/wait.h>
#include <sys/stat.h>
#include <sys/mount.h>
-#include <sys/fsuid.h>
#include <sys/socket.h>
#include <sys/utsname.h>
-#include <grp.h>
#define FUSE_DEV_NEW "/dev/fuse"
@@ -34,20 +40,25 @@
#define MS_DIRSYNC 128
#endif
+static const char *progname = "ntfs-3g-mount";
-struct mntent *getmntent_r (FILE *filep,
- struct mntent *mnt, char *buff, int bufsize)
-{
- static const char sep[] = " \t\n";
+static int mount_max = 1000;
- char *cp, *ptrptr;
+int drop_privs(void);
+int restore_privs(void);
+#ifdef HAVE_MNTENT_H
+struct mntent *getmntent_r (FILE *filep,struct mntent *mnt, char *buff, int bufsize)
+{
+ static const char sep[] = " /t/n";
+ char *cp, *ptrptr;
if (!filep || !mnt || !buff)
- return NULL;
+ return NULL;
/* Loop on the file, skipping comment lines. - FvK 03/07/93 */
- while ((cp = fgets(buff, bufsize, filep)) != NULL) {
- if (buff[0] == '#' || buff[0] == '\n')
+ while ((cp = fgets(buff, bufsize, filep)) != NULL)
+ {
+ if (buff[0] == '#' || buff[0] == '/n')
continue;
break;
}
@@ -57,7 +68,6 @@ struct mntent *getmntent_r (FILE *filep,
*/
if (cp == NULL)
return NULL;
-
ptrptr = 0;
mnt->mnt_fsname = strtok_r(buff, sep, &ptrptr);
if (mnt->mnt_fsname == NULL)
@@ -77,41 +87,33 @@ struct mntent *getmntent_r (FILE *filep,
cp = strtok_r(NULL, sep, &ptrptr);
mnt->mnt_freq = (cp != NULL) ? atoi(cp) : 0;
-
cp = strtok_r(NULL, sep, &ptrptr);
mnt->mnt_passno = (cp != NULL) ? atoi(cp) : 0;
return mnt;
}
-
-#if 0
struct mntent *getmntent(FILE * filep)
{
- struct mntent *tmp;
- static char *buff = NULL;
- static struct mntent mnt;
-// __UCLIBC_MUTEX_LOCK(mylock);
-
- if (!buff) {
- buff = malloc(BUFSIZ);
+ struct mntent *tmp;
+ static char *buff = NULL;
+ static struct mntent mnt;
+ if (!buff)
+ {
+ buff = malloc(BUFSIZ);
if (!buff)
- abort();
- }
-
- tmp = getmntent_r(filep, &mnt, buff, BUFSIZ);
-// __UCLIBC_MUTEX_UNLOCK(mylock);
- return(tmp);
+ abort();
+ }
+ tmp = getmntent_r(filep, &mnt, buff, BUFSIZ);
+ return(tmp);
}
-#endif
int addmntent(FILE * filep, const struct mntent *mnt)
{
if (fseek(filep, 0, SEEK_END) < 0)
return 1;
-
- return (fprintf (filep, "%s %s %s %s %d %d\n", mnt->mnt_fsname, mnt->mnt_dir,
- mnt->mnt_type, mnt->mnt_opts, mnt->mnt_freq, mnt->mnt_passno) < 0 ? 1 : 0);
+ return (fprintf (filep, "%s %s %s %s %d %d/n", mnt->mnt_fsname, mnt->mnt_dir,
+ mnt->mnt_type, mnt->mnt_opts, mnt->mnt_freq, mnt->mnt_passno) < 0 ? 1 : 0);
}
char *hasmntopt(const struct mntent *mnt, const char *opt)
@@ -124,22 +126,39 @@ FILE *setmntent(const char *name, const char *mode)
return fopen(name, mode);
}
-
int endmntent(FILE * filep)
{
if (filep != NULL)
fclose(filep);
return 1;
}
+#endif
+#ifdef __SOLARIS__
+/*
+ * fusermount is not implemented in fuse-lite for Solaris,
+ * only the minimal functions are provided.
+ */
-static const char *progname = "ntfs-3g-mount";
+/*
+ * Solaris doesn't have setfsuid/setfsgid.
+ * This doesn't really matter anyway as this program shouldn't be made
+ * suid on Solaris. It should instead be used via a profile with the
+ * sys_mount privilege.
+ */
-static int mount_max = 1000;
+int drop_privs(void)
+{
+ return (0);
+}
-int drop_privs(void);
-int restore_privs(void);
+int restore_privs(void)
+{
+ return (0);
+}
+
+#else /* __SOLARIS__ */
static const char *get_user_name(void)
{
@@ -233,8 +252,6 @@ static int add_mount(const char *source, const char *mnt, const char *type,
return fuse_mnt_add_mount(progname, source, mnt, type, opts);
}
-
-
static int count_fuse_fs(void)
{
struct mntent *entp;
@@ -514,7 +531,7 @@ static int do_mount(const char *mnt, char **typep, mode_t rootmode,
if (errno_save == EPERM)
fprintf(stderr, "User doesn't have privilege to mount. "
"For more information\nplease see: "
- "http://ntfs-3g.org/support.html#unprivileged\n");
+ "http://tuxera.com/community/ntfs-3g-faq/#unprivileged\n");
}
goto err;
} else {
@@ -770,3 +787,5 @@ out:
free(mnt);
return res;
}
+
+#endif /* __SOLARIS__ */
diff --git a/libfuse-lite/helper.c b/libfuse-lite/helper.c
index 6c640ae..ebd7d77 100755
--- a/libfuse-lite/helper.c
+++ b/libfuse-lite/helper.c
@@ -15,6 +15,18 @@ struct fuse_chan *fuse_mount(const char *mountpoint, struct fuse_args *args)
struct fuse_chan *ch;
int fd;
+#ifdef __SOLARIS__
+ /*
+ * Make sure file descriptors 0, 1 and 2 are open, otherwise chaos
+ * would ensue.
+ */
+ do {
+ fd = open("/dev/null", O_RDWR);
+ if (fd > 2)
+ close(fd);
+ } while (fd >= 0 && fd <= 2);
+#endif /* __SOLARIS__ */
+
fd = fuse_kern_mount(mountpoint, args);
if (fd == -1)
return NULL;
@@ -38,3 +50,12 @@ int fuse_version(void)
return FUSE_VERSION;
}
+#ifdef __SOLARIS__
+#undef fuse_main
+int fuse_main(void);
+int fuse_main(void)
+{
+ fprintf(stderr, "fuse_main(): This function does not exist\n");
+ return -1;
+}
+#endif /* __SOLARIS__ */
diff --git a/libfuse-lite/mount.c b/libfuse-lite/mount.c
index 0bb3aee..70454f4 100755
--- a/libfuse-lite/mount.c
+++ b/libfuse-lite/mount.c
@@ -12,6 +12,7 @@
#include "mount_util.h"
#include <stdio.h>
+#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <stddef.h>
@@ -23,6 +24,21 @@
#include <sys/wait.h>
#include <sys/mount.h>
+#ifdef __SOLARIS__
+
+#define FUSERMOUNT_PROG "fusermount"
+#define FUSE_COMMFD_ENV "_FUSE_COMMFD"
+
+#ifndef FUSERMOUNT_DIR
+#define FUSERMOUNT_DIR "/usr"
+#endif /* FUSERMOUNT_DIR */
+
+#ifndef HAVE_FORK
+#define fork() vfork()
+#endif
+
+#endif /* __SOLARIS__ */
+
#ifndef MS_DIRSYNC
#define MS_DIRSYNC 128
#endif
@@ -44,8 +60,16 @@ struct mount_opts {
int allow_root;
int ishelp;
int flags;
+#ifdef __SOLARIS__
+ int nonempty;
+ int blkdev;
+ char *fsname;
+ char *subtype;
+ char *subtype_opt;
+#else
int blkdev;
char *fsname;
+#endif
char *mtab_opts;
char *fusermount_opts;
char *kernel_opts;
@@ -54,14 +78,19 @@ struct mount_opts {
#define FUSE_MOUNT_OPT(t, p) { t, offsetof(struct mount_opts, p), 1 }
static const struct fuse_opt fuse_mount_opts[] = {
+#ifdef __SOLARIS__
FUSE_MOUNT_OPT("allow_other", allow_other),
FUSE_MOUNT_OPT("allow_root", allow_root),
+ FUSE_MOUNT_OPT("nonempty", nonempty),
FUSE_MOUNT_OPT("blkdev", blkdev),
FUSE_MOUNT_OPT("fsname=%s", fsname),
+ FUSE_MOUNT_OPT("subtype=%s", subtype),
FUSE_OPT_KEY("allow_other", KEY_KERN_OPT),
FUSE_OPT_KEY("allow_root", KEY_ALLOW_ROOT),
+ FUSE_OPT_KEY("nonempty", KEY_FUSERMOUNT_OPT),
FUSE_OPT_KEY("blkdev", KEY_FUSERMOUNT_OPT),
FUSE_OPT_KEY("fsname=", KEY_FUSERMOUNT_OPT),
+ FUSE_OPT_KEY("subtype=", KEY_SUBTYPE_OPT),
FUSE_OPT_KEY("large_read", KEY_KERN_OPT),
FUSE_OPT_KEY("blksize=", KEY_KERN_OPT),
FUSE_OPT_KEY("default_permissions", KEY_KERN_OPT),
@@ -73,6 +102,38 @@ static const struct fuse_opt fuse_mount_opts[] = {
FUSE_OPT_KEY("rw", KEY_KERN_FLAG),
FUSE_OPT_KEY("suid", KEY_KERN_FLAG),
FUSE_OPT_KEY("nosuid", KEY_KERN_FLAG),
+ FUSE_OPT_KEY("-g", KEY_KERN_FLAG),
+ FUSE_OPT_KEY("-m", KEY_KERN_FLAG),
+ FUSE_OPT_KEY("-O", KEY_KERN_FLAG),
+ FUSE_OPT_KEY("setuid", KEY_KERN_OPT),
+ FUSE_OPT_KEY("nosetuid", KEY_KERN_OPT),
+ FUSE_OPT_KEY("devices", KEY_KERN_OPT),
+ FUSE_OPT_KEY("nodevices", KEY_KERN_OPT),
+ FUSE_OPT_KEY("exec", KEY_KERN_OPT),
+ FUSE_OPT_KEY("noexec", KEY_KERN_OPT),
+ FUSE_OPT_KEY("nbmand", KEY_KERN_OPT),
+ FUSE_OPT_KEY("nonbmand", KEY_KERN_OPT),
+#else /* __SOLARIS__ */
+ FUSE_MOUNT_OPT("allow_other", allow_other),
+ FUSE_MOUNT_OPT("allow_root", allow_root),
+ FUSE_MOUNT_OPT("blkdev", blkdev),
+ FUSE_MOUNT_OPT("fsname=%s", fsname),
+ FUSE_OPT_KEY("allow_other", KEY_KERN_OPT),
+ FUSE_OPT_KEY("allow_root", KEY_ALLOW_ROOT),
+ FUSE_OPT_KEY("blkdev", KEY_FUSERMOUNT_OPT),
+ FUSE_OPT_KEY("fsname=", KEY_FUSERMOUNT_OPT),
+ FUSE_OPT_KEY("large_read", KEY_KERN_OPT),
+ FUSE_OPT_KEY("blksize=", KEY_KERN_OPT),
+ FUSE_OPT_KEY("default_permissions", KEY_KERN_OPT),
+ FUSE_OPT_KEY("context=", KEY_KERN_OPT),
+ FUSE_OPT_KEY("max_read=", KEY_KERN_OPT),
+ FUSE_OPT_KEY("max_read=", FUSE_OPT_KEY_KEEP),
+ FUSE_OPT_KEY("user=", KEY_MTAB_OPT),
+ FUSE_OPT_KEY("-r", KEY_RO),
+ FUSE_OPT_KEY("ro", KEY_KERN_FLAG),
+ FUSE_OPT_KEY("rw", KEY_KERN_FLAG),
+ FUSE_OPT_KEY("suid", KEY_KERN_FLAG),
+ FUSE_OPT_KEY("nosuid", KEY_KERN_FLAG),
FUSE_OPT_KEY("dev", KEY_KERN_FLAG),
FUSE_OPT_KEY("nodev", KEY_KERN_FLAG),
FUSE_OPT_KEY("exec", KEY_KERN_FLAG),
@@ -82,6 +143,7 @@ static const struct fuse_opt fuse_mount_opts[] = {
FUSE_OPT_KEY("dirsync", KEY_KERN_FLAG),
FUSE_OPT_KEY("atime", KEY_KERN_FLAG),
FUSE_OPT_KEY("noatime", KEY_KERN_FLAG),
+#endif /* __SOLARIS__ */
FUSE_OPT_KEY("-h", KEY_HELP),
FUSE_OPT_KEY("--help", KEY_HELP),
FUSE_OPT_KEY("-V", KEY_VERSION),
@@ -89,6 +151,42 @@ static const struct fuse_opt fuse_mount_opts[] = {
FUSE_OPT_END
};
+#ifdef __SOLARIS__
+
+static void mount_help(void)
+{
+ fprintf(stderr,
+ " -o allow_other allow access to other users\n"
+ " -o allow_root allow access to root\n"
+ " -o nonempty allow mounts over non-empty file/dir\n"
+ " -o default_permissions enable permission checking by kernel\n"
+ " -o fsname=NAME set filesystem name\n"
+ " -o subtype=NAME set filesystem type\n"
+ " -o large_read issue large read requests (2.4 only)\n"
+ " -o max_read=N set maximum size of read requests\n"
+ "\n"
+ );
+}
+
+static void exec_fusermount(const char *argv[])
+{
+ execv(FUSERMOUNT_DIR "/" FUSERMOUNT_PROG, (char **) argv);
+ execvp(FUSERMOUNT_PROG, (char **) argv);
+}
+
+static void mount_version(void)
+{
+ int pid = fork();
+ if (!pid) {
+ const char *argv[] = { FUSERMOUNT_PROG, "--version", NULL };
+ exec_fusermount(argv);
+ _exit(1);
+ } else if (pid != -1)
+ waitpid(pid, NULL, 0);
+}
+
+#endif /* __SOLARIS__ */
+
struct mount_flags {
const char *opt;
unsigned long flag;
@@ -100,6 +198,7 @@ static struct mount_flags mount_flags[] = {
{"ro", MS_RDONLY, 1},
{"suid", MS_NOSUID, 0},
{"nosuid", MS_NOSUID, 1},
+#ifndef __SOLARIS__
{"dev", MS_NODEV, 0},
{"nodev", MS_NODEV, 1},
{"exec", MS_NOEXEC, 0},
@@ -109,9 +208,42 @@ static struct mount_flags mount_flags[] = {
{"atime", MS_NOATIME, 0},
{"noatime", MS_NOATIME, 1},
{"dirsync", MS_DIRSYNC, 1},
+#else /* __SOLARIS__ */
+ {"-g", MS_GLOBAL, 1}, /* 1eaf4 */
+ {"-m", MS_NOMNTTAB, 1}, /* 1eb00 */
+ {"-O", MS_OVERLAY, 1}, /* 1eb0c */
+#endif /* __SOLARIS__ */
{NULL, 0, 0}
};
+#ifdef __SOLARIS__
+
+/*
+ * See comments in fuse_kern_mount()
+ */
+struct solaris_mount_opts {
+ int nosuid;
+ int setuid;
+ int nosetuid;
+ int devices;
+ int nodevices;
+};
+
+#define SOLARIS_MOUNT_OPT(t, p, n) \
+ { t, offsetof(struct solaris_mount_opts, p), n }
+static const struct fuse_opt solaris_mnt_opts[] = {
+ SOLARIS_MOUNT_OPT("suid", setuid, 1),
+ SOLARIS_MOUNT_OPT("suid", devices, 1),
+ SOLARIS_MOUNT_OPT("nosuid", nosuid, 1),
+ SOLARIS_MOUNT_OPT("setuid", setuid, 1),
+ SOLARIS_MOUNT_OPT("nosetuid", nosetuid, 1),
+ SOLARIS_MOUNT_OPT("devices", devices, 1),
+ SOLARIS_MOUNT_OPT("nodevices", nodevices, 1),
+ FUSE_OPT_END
+};
+
+#endif /* __SOLARIS__ */
+
static void set_mount_flag(const char *s, int *flags)
{
int i;
@@ -155,23 +287,85 @@ static int fuse_mount_opt_proc(void *data, const char *arg, int key,
case KEY_FUSERMOUNT_OPT:
return fuse_opt_add_opt(&mo->fusermount_opts, arg);
+#ifdef __SOLARIS__
+ case KEY_SUBTYPE_OPT:
+ return fuse_opt_add_opt(&mo->subtype_opt, arg);
+#endif /* __SOLARIS__ */
+
case KEY_MTAB_OPT:
return fuse_opt_add_opt(&mo->mtab_opts, arg);
case KEY_HELP:
+#ifdef __SOLARIS__
+ mount_help();
+#endif /* __SOLARIS__ */
mo->ishelp = 1;
break;
case KEY_VERSION:
+#ifdef __SOLARIS__
+ mount_version();
+#endif /* __SOLARIS__ */
mo->ishelp = 1;
break;
}
return 1;
}
+#ifdef __SOLARIS__
+
+/* return value:
+ * >= 0 => fd
+ * -1 => error
+ */
+static int receive_fd(int fd)
+{
+ struct msghdr msg;
+ struct iovec iov;
+ char buf[1];
+ int rv;
+ size_t ccmsg[CMSG_SPACE(sizeof(int)) / sizeof(size_t)];
+ struct cmsghdr *cmsg;
+
+ iov.iov_base = buf;
+ iov.iov_len = 1;
+
+ msg.msg_name = 0;
+ msg.msg_namelen = 0;
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 1;
+ /* old BSD implementations should use msg_accrights instead of
+ * msg_control; the interface is different. */
+ msg.msg_control = ccmsg;
+ msg.msg_controllen = sizeof(ccmsg);
+
+ while(((rv = recvmsg(fd, &msg, 0)) == -1) && errno == EINTR);
+ if (rv == -1) {
+ perror("recvmsg");
+ return -1;
+ }
+ if(!rv) {
+ /* EOF */
+ return -1;
+ }
+
+ cmsg = CMSG_FIRSTHDR(&msg);
+ if (!cmsg->cmsg_type == SCM_RIGHTS) {
+ fprintf(stderr, "got control message of unknown type %d\n",
+ cmsg->cmsg_type);
+ return -1;
+ }
+ return *(int*)CMSG_DATA(cmsg);
+}
+
+#endif /* __SOLARIS__ */
+
void fuse_kern_unmount(const char *mountpoint, int fd)
{
int res;
+#ifdef __SOLARIS__
+ int pid;
+#endif /* __SOLARIS__ */
if (!mountpoint)
return;
@@ -187,11 +381,214 @@ void fuse_kern_unmount(const char *mountpoint, int fd)
if (res == 1 && (pfd.revents & POLLERR))
return;
}
+#ifndef __SOLARIS__
close(fd);
fusermount(1, 0, 1, "", mountpoint);
+#else /* __SOLARIS__ */
+ if (geteuid() == 0) {
+ fuse_mnt_umount("fuse", mountpoint, 1);
+ return;
+ }
+
+ res = umount2(mountpoint, 2);
+ if (res == 0)
+ return;
+
+ pid = fork();
+ if(pid == -1)
+ return;
+
+ if(pid == 0) {
+ const char *argv[] =
+ { FUSERMOUNT_PROG, "-u", "-q", "-z", "--", mountpoint, NULL };
+
+ exec_fusermount(argv);
+ _exit(1);
+ }
+ waitpid(pid, NULL, 0);
+#endif /* __SOLARIS__ */
}
+#ifdef __SOLARIS__
+
+static int fuse_mount_fusermount(const char *mountpoint, const char *opts,
+ int quiet)
+{
+ int fds[2], pid;
+ int res;
+ int rv;
+
+ if (!mountpoint) {
+ fprintf(stderr, "fuse: missing mountpoint\n");
+ return -1;
+ }
+
+ res = socketpair(PF_UNIX, SOCK_STREAM, 0, fds);
+ if(res == -1) {
+ perror("fuse: socketpair() failed");
+ return -1;
+ }
+
+ pid = fork();
+ if(pid == -1) {
+ perror("fuse: fork() failed");
+ close(fds[0]);
+ close(fds[1]);
+ return -1;
+ }
+
+ if(pid == 0) {
+ char env[10];
+ const char *argv[32];
+ int a = 0;
+
+ if (quiet) {
+ int fd = open("/dev/null", O_RDONLY);
+ dup2(fd, 1);
+ dup2(fd, 2);
+ }
+
+ argv[a++] = FUSERMOUNT_PROG;
+ if (opts) {
+ argv[a++] = "-o";
+ argv[a++] = opts;
+ }
+ argv[a++] = "--";
+ argv[a++] = mountpoint;
+ argv[a++] = NULL;
+
+ close(fds[1]);
+ fcntl(fds[0], F_SETFD, 0);
+ snprintf(env, sizeof(env), "%i", fds[0]);
+ setenv(FUSE_COMMFD_ENV, env, 1);
+ exec_fusermount(argv);
+ perror("fuse: failed to exec fusermount");
+ _exit(1);
+ }
+
+ close(fds[0]);
+ rv = receive_fd(fds[1]);
+ close(fds[1]);
+ waitpid(pid, NULL, 0); /* bury zombie */
+
+ return rv;
+}
+
+static int fuse_mount_sys(const char *mnt, struct mount_opts *mo,
+ const char *mnt_opts)
+{
+ char tmp[128];
+ const char *devname = "/dev/fuse";
+ char *source = NULL;
+ char *type = NULL;
+ struct stat stbuf;
+ int fd;
+ int res;
+
+ if (!mnt) {
+ fprintf(stderr, "fuse: missing mountpoint\n");
+ return -1;
+ }
+
+ res = lstat(mnt, &stbuf);
+ if (res == -1) {
+ fprintf(stderr ,"fuse: failed to access mountpoint %s: %s\n",
+ mnt, strerror(errno));
+ return -1;
+ }
+
+ if (!mo->nonempty) {
+ res = fuse_mnt_check_empty("fuse", mnt, stbuf.st_mode, stbuf.st_size);
+ if (res == -1)
+ return -1;
+ }
+
+ fd = open(devname, O_RDWR);
+ if (fd == -1) {
+ if (errno == ENODEV || errno == ENOENT)
+ fprintf(stderr,
+ "fuse: device not found, try 'modprobe fuse' first\n");
+ else
+ fprintf(stderr, "fuse: failed to open %s: %s\n", devname,
+ strerror(errno));
+ return -1;
+ }
+
+ snprintf(tmp, sizeof(tmp), "fd=%i,rootmode=%o,user_id=%i,group_id=%i", fd,
+ stbuf.st_mode & S_IFMT, getuid(), getgid());
+
+ res = fuse_opt_add_opt(&mo->kernel_opts, tmp);
+ if (res == -1)
+ goto out_close;
+
+ source = malloc((mo->fsname ? strlen(mo->fsname) : 0) +
+ (mo->subtype ? strlen(mo->subtype) : 0) +
+ strlen(devname) + 32);
+
+ type = malloc((mo->subtype ? strlen(mo->subtype) : 0) + 32);
+ if (!type || !source) {
+ fprintf(stderr, "fuse: failed to allocate memory\n");
+ goto out_close;
+ }
+
+ strcpy(type, mo->blkdev ? "fuseblk" : "fuse");
+ if (mo->subtype) {
+ strcat(type, ".");
+ strcat(type, mo->subtype);
+ }
+ strcpy(source,
+ mo->fsname ? mo->fsname : (mo->subtype ? mo->subtype : devname));
+
+ /* JPA added two final zeroes */
+ res = mount(source, mnt, MS_OPTIONSTR|mo->flags, type, NULL, 0,
+ mo->kernel_opts, MAX_MNTOPT_STR, 0, 0);
+
+ if (res == -1 && errno == EINVAL && mo->subtype) {
+ /* Probably missing subtype support */
+ strcpy(type, mo->blkdev ? "fuseblk" : "fuse");
+ if (mo->fsname) {
+ if (!mo->blkdev)
+ sprintf(source, "%s#%s", mo->subtype, mo->fsname);
+ } else {
+ strcpy(source, type);
+ }
+ /* JPA two null args added */
+ res = mount(source, mnt, MS_OPTIONSTR|mo->flags, type, NULL, 0,
+ mo->kernel_opts, MAX_MNTOPT_STR, 0, 0);
+ }
+ if (res == -1) {
+ /*
+ * Maybe kernel doesn't support unprivileged mounts, in this
+ * case try falling back to fusermount
+ */
+ if (errno == EPERM) {
+ res = -2;
+ } else {
+ int errno_save = errno;
+ if (mo->blkdev && errno == ENODEV && !fuse_mnt_check_fuseblk())
+ fprintf(stderr, "fuse: 'fuseblk' support missing\n");
+ else
+ fprintf(stderr, "fuse: mount failed: %s\n",
+ strerror(errno_save));
+ }
+
+ goto out_close;
+ }
+
+ return fd;
+
+ out_umount:
+ umount2(mnt, 2); /* lazy umount */
+ out_close:
+ free(type);
+ free(source);
+ close(fd);
+ return res;
+}
+
+#endif /* __SOLARIS__ */
+
static int get_mnt_flag_opts(char **mnt_optsp, int flags)
{
int i;
@@ -201,8 +598,8 @@ static int get_mnt_flag_opts(char **mnt_optsp, int flags)
for (i = 0; mount_flags[i].opt != NULL; i++) {
if (mount_flags[i].on && (flags & mount_flags[i].flag) &&
- fuse_opt_add_opt(mnt_optsp, mount_flags[i].opt) == -1)
- return -1;
+ fuse_opt_add_opt(mnt_optsp, mount_flags[i].opt) == -1)
+ return -1;
}
return 0;
}
@@ -212,14 +609,59 @@ int fuse_kern_mount(const char *mountpoint, struct fuse_args *args)
struct mount_opts mo;
int res = -1;
char *mnt_opts = NULL;
+#ifdef __SOLARIS__
+ struct solaris_mount_opts smo;
+ struct fuse_args sa = FUSE_ARGS_INIT(0, NULL);
+#endif /* __SOLARIS__ */
memset(&mo, 0, sizeof(mo));
+#ifndef __SOLARIS__
if (getuid())
mo.flags = MS_NOSUID | MS_NODEV;
+#else /* __SOLARIS__ */
+ mo.flags = 0;
+ memset(&smo, 0, sizeof(smo));
+ if (args != NULL) {
+ while (args->argv[sa.argc] != NULL)
+ fuse_opt_add_arg(&sa, args->argv[sa.argc]);
+ }
+#endif /* __SOLARIS__ */
if (args &&
fuse_opt_parse(args, &mo, fuse_mount_opts, fuse_mount_opt_proc) == -1)
+#ifndef __SOLARIS__
return -1;
+#else /* __SOLARIS__ */
+ goto out; /* if SOLARIS, clean up 'sa' */
+
+ /*
+ * In Solaris, nosuid is equivalent to nosetuid + nodevices. We only
+ * have MS_NOSUID for mount flags (no MS_(NO)SETUID, etc.). But if
+ * we set that as a default, it restricts specifying just nosetuid
+ * or nodevices; there is no way for the user to specify setuid +
+ * nodevices or vice-verse. So we parse the existing options, then
+ * add restrictive defaults if needed.
+ */
+ if (fuse_opt_parse(&sa, &smo, solaris_mnt_opts, NULL) == -1)
+ goto out;
+ if (smo.nosuid || (!smo.nodevices && !smo.devices
+ && !smo.nosetuid && !smo.setuid)) {
+ mo.flags |= MS_NOSUID;
+ } else {
+ /*
+ * Defaults; if neither nodevices|devices,nosetuid|setuid has
+ * been specified, add the default negative option string. If
+ * both have been specified (i.e., -osuid,nosuid), leave them
+ * alone; the last option will have precedence.
+ */
+ if (!smo.nodevices && !smo.devices)
+ if (fuse_opt_add_opt(&mo.kernel_opts, "nodevices") == -1)
+ goto out;
+ if (!smo.nosetuid && !smo.setuid)
+ if (fuse_opt_add_opt(&mo.kernel_opts, "nosetuid") == -1)
+ goto out;
+ }
+#endif /* __SOLARIS__ */
if (mo.allow_other && mo.allow_root) {
fprintf(stderr, "fuse: 'allow_other' and 'allow_root' options are mutually exclusive\n");
@@ -232,6 +674,7 @@ int fuse_kern_mount(const char *mountpoint, struct fuse_args *args)
res = -1;
if (get_mnt_flag_opts(&mnt_opts, mo.flags) == -1)
goto out;
+#ifndef __SOLARIS__
if (!(mo.flags & MS_NODEV) && fuse_opt_add_opt(&mnt_opts, "dev") == -1)
goto out;
if (!(mo.flags & MS_NOSUID) && fuse_opt_add_opt(&mnt_opts, "suid") == -1)
@@ -242,15 +685,48 @@ int fuse_kern_mount(const char *mountpoint, struct fuse_args *args)
goto out;
if (mo.fusermount_opts && fuse_opt_add_opt(&mnt_opts, mo.fusermount_opts) < 0)
goto out;
-
res = fusermount(0, 0, 0, mnt_opts ? mnt_opts : "", mountpoint);
-
+#else /* __SOLARIS__ */
+ if (mo.kernel_opts && fuse_opt_add_opt(&mnt_opts, mo.kernel_opts) == -1)
+ goto out;
+ if (mo.mtab_opts && fuse_opt_add_opt(&mnt_opts, mo.mtab_opts) == -1)
+ goto out;
+ res = fuse_mount_sys(mountpoint, &mo, mnt_opts);
+ if (res == -2) {
+ if (mo.fusermount_opts &&
+ fuse_opt_add_opt(&mnt_opts, mo.fusermount_opts) == -1)
+ goto out;
+
+ if (mo.subtype) {
+ char *tmp_opts = NULL;
+
+ res = -1;
+ if (fuse_opt_add_opt(&tmp_opts, mnt_opts) == -1 ||
+ fuse_opt_add_opt(&tmp_opts, mo.subtype_opt) == -1) {
+ free(tmp_opts);
+ goto out;
+ }
+
+ res = fuse_mount_fusermount(mountpoint, tmp_opts, 1);
+ free(tmp_opts);
+ if (res == -1)
+ res = fuse_mount_fusermount(mountpoint, mnt_opts, 0);
+ } else {
+ res = fuse_mount_fusermount(mountpoint, mnt_opts, 0);
+ }
+ }
+#endif /* __SOLARIS__ */
+
out:
free(mnt_opts);
+#ifdef __SOLARIS__
+ fuse_opt_free_args(&sa);
+ free(mo.subtype);
+ free(mo.subtype_opt);
+#endif /* __SOLARIS__ */
free(mo.fsname);
free(mo.fusermount_opts);
free(mo.kernel_opts);
free(mo.mtab_opts);
return res;
}
-
diff --git a/libfuse-lite/mount_util.c b/libfuse-lite/mount_util.c
index 75a7ee6..1a7ac3c 100755
--- a/libfuse-lite/mount_util.c
+++ b/libfuse-lite/mount_util.c
@@ -15,11 +15,245 @@
#include <dirent.h>
#include <errno.h>
#include <limits.h>
-#include <mntent.h>
#include <sys/stat.h>
#include <sys/wait.h>
+#ifdef __SOLARIS__
+#else /* __SOLARIS__ */
+#include <mntent.h>
#include <sys/mount.h>
#include <sys/param.h>
+#endif /* __SOLARIS__ */
+
+#ifdef __SOLARIS__
+
+char *mkdtemp(char *template);
+
+#ifndef _PATH_MOUNTED
+#define _PATH_MOUNTED "/etc/mnttab"
+#endif /* _PATH_MOUNTED */
+
+#ifndef IGNORE_MTAB
+static int mtab_needs_update(const char *mnt)
+{
+ struct stat stbuf;
+
+ /* If mtab is within new mount, don't touch it */
+ if (strncmp(mnt, _PATH_MOUNTED, strlen(mnt)) == 0 &&
+ _PATH_MOUNTED[strlen(mnt)] == '/')
+ return 0;
+
+ if (lstat(_PATH_MOUNTED, &stbuf) != -1 && S_ISLNK(stbuf.st_mode))
+ return 0;
+
+ return 1;
+}
+#endif /* IGNORE_MTAB */
+
+int fuse_mnt_add_mount(const char *progname, const char *fsname,
+ const char *mnt, const char *type, const char *opts)
+{
+ int res;
+ int status;
+
+#ifndef IGNORE_MTAB
+ if (!mtab_needs_update(mnt))
+ return 0;
+#endif /* IGNORE_MTAB */
+
+ res = fork();
+ if (res == -1) {
+ fprintf(stderr, "%s: fork: %s\n", progname, strerror(errno));
+ return -1;
+ }
+ if (res == 0) {
+ char templ[] = "/tmp/fusermountXXXXXX";
+ char *tmp;
+
+ setuid(geteuid());
+
+ /*
+ * hide in a directory, where mount isn't able to resolve
+ * fsname as a valid path
+ */
+ tmp = mkdtemp(templ);
+ if (!tmp) {
+ fprintf(stderr, "%s: failed to create temporary directory\n",
+ progname);
+ exit(1);
+ }
+ if (chdir(tmp)) {
+ fprintf(stderr, "%s: failed to chdir to %s: %s\n",
+ progname, tmp, strerror(errno));
+ exit(1);
+ }
+ rmdir(tmp);
+ execl("/sbin/mount", "/sbin/mount", "-F", type, "-o", opts,
+ fsname, mnt, NULL);
+ fprintf(stderr, "%s: failed to execute /sbin/mount: %s\n", progname,
+ strerror(errno));
+ exit(1);
+ }
+ res = waitpid(res, &status, 0);
+ if (res == -1) {
+ fprintf(stderr, "%s: waitpid: %s\n", progname, strerror(errno));
+ return -1;
+ }
+ if (status != 0)
+ return -1;
+
+ return 0;
+}
+
+int fuse_mnt_umount(const char *progname, const char *mnt, int lazy)
+{
+ int res;
+ int status;
+
+#ifndef IGNORE_MTAB
+ if (!mtab_needs_update(mnt))
+ return 0;
+#endif /* IGNORE_MTAB */
+
+ res = fork();
+ if (res == -1) {
+ fprintf(stderr, "%s: fork: %s\n", progname, strerror(errno));
+ return -1;
+ }
+ if (res == 0) {
+ setuid(geteuid());
+ execl("/sbin/umount", "/sbin/umount", !lazy ? "-f" : NULL, mnt,
+ NULL);
+ fprintf(stderr, "%s: failed to execute /sbin/umount: %s\n", progname,
+ strerror(errno));
+ exit(1);
+ }
+ res = waitpid(res, &status, 0);
+ if (res == -1) {
+ fprintf(stderr, "%s: waitpid: %s\n", progname, strerror(errno));
+ return -1;
+ }
+ if (status != 0)
+ return -1;
+
+ return 0;
+}
+
+char *fuse_mnt_resolve_path(const char *progname, const char *orig)
+{
+ char buf[PATH_MAX];
+ char *copy;
+ char *dst;
+ char *end;
+ char *lastcomp;
+ const char *toresolv;
+
+ if (!orig[0]) {
+ fprintf(stderr, "%s: invalid mountpoint '%s'\n", progname, orig);
+ return NULL;
+ }
+
+ copy = strdup(orig);
+ if (copy == NULL) {
+ fprintf(stderr, "%s: failed to allocate memory\n", progname);
+ return NULL;
+ }
+
+ toresolv = copy;
+ lastcomp = NULL;
+ for (end = copy + strlen(copy) - 1; end > copy && *end == '/'; end --);
+ if (end[0] != '/') {
+ char *tmp;
+ end[1] = '\0';
+ tmp = strrchr(copy, '/');
+ if (tmp == NULL) {
+ lastcomp = copy;
+ toresolv = ".";
+ } else {
+ lastcomp = tmp + 1;
+ if (tmp == copy)
+ toresolv = "/";
+ }
+ if (strcmp(lastcomp, ".") == 0 || strcmp(lastcomp, "..") == 0) {
+ lastcomp = NULL;
+ toresolv = copy;
+ }
+ else if (tmp)
+ tmp[0] = '\0';
+ }
+ if (realpath(toresolv, buf) == NULL) {
+ fprintf(stderr, "%s: bad mount point %s: %s\n", progname, orig,
+ strerror(errno));
+ free(copy);
+ return NULL;
+ }
+ if (lastcomp == NULL)
+ dst = strdup(buf);
+ else {
+ dst = (char *) malloc(strlen(buf) + 1 + strlen(lastcomp) + 1);
+ if (dst) {
+ unsigned buflen = strlen(buf);
+ if (buflen && buf[buflen-1] == '/')
+ sprintf(dst, "%s%s", buf, lastcomp);
+ else
+ sprintf(dst, "%s/%s", buf, lastcomp);
+ }
+ }
+ free(copy);
+ if (dst == NULL)
+ fprintf(stderr, "%s: failed to allocate memory\n", progname);
+ return dst;
+}
+
+int fuse_mnt_check_empty(const char *progname, const char *mnt,
+ mode_t rootmode, off_t rootsize)
+{
+ int isempty = 1;
+
+ if (S_ISDIR(rootmode)) {
+ struct dirent *ent;
+ DIR *dp = opendir(mnt);
+ if (dp == NULL) {
+ fprintf(stderr, "%s: failed to open mountpoint for reading: %s\n",
+ progname, strerror(errno));
+ return -1;
+ }
+ while ((ent = readdir(dp)) != NULL) {
+ if (strcmp(ent->d_name, ".") != 0 &&
+ strcmp(ent->d_name, "..") != 0) {
+ isempty = 0;
+ break;
+ }
+ }
+ closedir(dp);
+ } else if (rootsize)
+ isempty = 0;
+
+ if (!isempty) {
+ fprintf(stderr, "%s: mountpoint is not empty\n", progname);
+ fprintf(stderr, "%s: if you are sure this is safe, use the 'nonempty' mount option\n", progname);
+ return -1;
+ }
+ return 0;
+}
+
+int fuse_mnt_check_fuseblk(void)
+{
+ char buf[256];
+ FILE *f = fopen("/proc/filesystems", "r");
+ if (!f)
+ return 1;
+
+ while (fgets(buf, sizeof(buf), f))
+ if (strstr(buf, "fuseblk\n")) {
+ fclose(f);
+ return 1;
+ }
+
+ fclose(f);
+ return 0;
+}
+
+#else /* __SOLARIS__ */
static int mtab_needs_update(const char *mnt)
{
@@ -71,7 +305,9 @@ int fuse_mnt_add_mount(const char *progname, const char *fsname,
char templ[] = "/tmp/fusermountXXXXXX";
char *tmp;
- setuid(geteuid());
+ if (setuid(geteuid()))
+ fprintf(stderr, "%s: failed to setuid : %s\n", progname,
+ strerror(errno));
/*
* hide in a directory, where mount isn't able to resolve
@@ -117,7 +353,9 @@ int fuse_mnt_umount(const char *progname, const char *mnt, int lazy)
return -1;
}
if (res == 0) {
- setuid(geteuid());
+ if (setuid(geteuid()))
+ fprintf(stderr, "%s: failed to setuid : %s\n", progname,
+ strerror(errno));
execl("/bin/umount", "/bin/umount", "-i", mnt, lazy ? "-l" : NULL,
NULL);
fprintf(stderr, "%s: failed to execute /bin/umount: %s\n", progname,
@@ -217,3 +455,5 @@ int fuse_mnt_check_fuseblk(void)
fclose(f);
return 0;
}
+
+#endif /* __SOLARIS__ */
diff --git a/libfuse-lite/mount_util.h b/libfuse-lite/mount_util.h
index d1b0899..0318385 100755
--- a/libfuse-lite/mount_util.h
+++ b/libfuse-lite/mount_util.h
@@ -6,10 +6,7 @@
See the file COPYING.LIB.
*/
-#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
-#endif
-
int fuse_mnt_add_mount(const char *progname, const char *fsname,
const char *mnt, const char *type, const char *opts);
@@ -17,6 +14,14 @@ int fuse_mnt_umount(const char *progname, const char *mnt, int lazy);
char *fuse_mnt_resolve_path(const char *progname, const char *orig);
int fuse_mnt_check_fuseblk(void);
+#ifdef __SOLARIS__
+
+int fuse_mnt_check_empty(const char *progname, const char *mnt,
+ mode_t rootmode, off_t rootsize);
+
+#else /* __SOLARIS__ */
+
int fusermount(int unmount, int quiet, int lazy, const char *opts,
const char *origmnt);
+#endif /* __SOLARIS__ */
diff --git a/libntfs-3g/Makefile.am b/libntfs-3g/Makefile.am
index fe2fb9d..045ca52 100755
--- a/libntfs-3g/Makefile.am
+++ b/libntfs-3g/Makefile.am
@@ -10,13 +10,10 @@ noinst_LTLIBRARIES = libntfs-3g.la
endif
libntfs_3g_la_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/include/ntfs-3g
-
+libntfs_3g_la_CPPFLAGS= $(AM_CPPFLAGS) $(LIBNTFS_CPPFLAGS)
+libntfs_3g_la_LIBADD = $(LIBNTFS_LIBS)
libntfs_3g_la_LDFLAGS = -version-info $(LIBNTFS_3G_VERSION) -no-undefined
-if FUSE_INTERNAL
-libntfs_3g_la_LIBADD = $(top_builddir)/libfuse-lite/libfuse-lite.la
-endif
-
libntfs_3g_la_SOURCES = \
acls.c \
attrib.c \
@@ -40,11 +37,13 @@ libntfs_3g_la_SOURCES = \
misc.c \
mst.c \
object_id.c \
+ realpath.c \
reparse.c \
runlist.c \
security.c \
unistr.c \
- volume.c
+ volume.c \
+ xattrs.c
if NTFS_DEVICE_DEFAULT_IO_OPS
if WINDOWS
@@ -77,3 +76,7 @@ if INSTALL_LIBRARY
$(RM) -f "$(DESTDIR)/$(rootlibdir)"/libntfs-3g.so*
endif
+if ENABLE_NTFSPROGS
+libs: $(lib_LTLIBRARIES)
+endif
+
diff --git a/libntfs-3g/Makefile.in b/libntfs-3g/Makefile.in
index 6f50edd..5a87679 100755
--- a/libntfs-3g/Makefile.in
+++ b/libntfs-3g/Makefile.in
@@ -1,8 +1,9 @@
-# Makefile.in generated by automake 1.10.1 from Makefile.am.
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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.
@@ -17,8 +18,9 @@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
@@ -40,30 +42,49 @@ subdir = libntfs-3g
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/libntfs-3g.pc.in $(srcdir)/libntfs-3g.script.so.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.ac
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = libntfs-3g.pc libntfs-3g.script.so
+CONFIG_CLEAN_VPATH_FILES =
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__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(rootlibdir)" \
"$(DESTDIR)$(pkgconfigdir)"
-libLTLIBRARIES_INSTALL = $(INSTALL)
-rootlibLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) \
$(rootlib_LTLIBRARIES)
-@FUSE_INTERNAL_TRUE@libntfs_3g_la_DEPENDENCIES = $(top_builddir)/libfuse-lite/libfuse-lite.la
+am__DEPENDENCIES_1 =
+libntfs_3g_la_DEPENDENCIES = $(am__DEPENDENCIES_1)
am__libntfs_3g_la_SOURCES_DIST = acls.c attrib.c attrlist.c bitmap.c \
bootsect.c cache.c collate.c compat.c compress.c debug.c \
device.c dir.c efs.c index.c inode.c lcnalloc.c logfile.c \
- logging.c mft.c misc.c mst.c object_id.c reparse.c runlist.c \
- security.c unistr.c volume.c win32_io.c unix_io.c
+ logging.c mft.c misc.c mst.c object_id.c realpath.c reparse.c \
+ runlist.c security.c unistr.c volume.c xattrs.c win32_io.c \
+ unix_io.c
@NTFS_DEVICE_DEFAULT_IO_OPS_TRUE@@WINDOWS_TRUE@am__objects_1 = libntfs_3g_la-win32_io.lo
@NTFS_DEVICE_DEFAULT_IO_OPS_TRUE@@WINDOWS_FALSE@am__objects_2 = libntfs_3g_la-unix_io.lo
am_libntfs_3g_la_OBJECTS = libntfs_3g_la-acls.lo \
@@ -77,9 +98,10 @@ am_libntfs_3g_la_OBJECTS = libntfs_3g_la-acls.lo \
libntfs_3g_la-lcnalloc.lo libntfs_3g_la-logfile.lo \
libntfs_3g_la-logging.lo libntfs_3g_la-mft.lo \
libntfs_3g_la-misc.lo libntfs_3g_la-mst.lo \
- libntfs_3g_la-object_id.lo libntfs_3g_la-reparse.lo \
- libntfs_3g_la-runlist.lo libntfs_3g_la-security.lo \
- libntfs_3g_la-unistr.lo libntfs_3g_la-volume.lo \
+ libntfs_3g_la-object_id.lo libntfs_3g_la-realpath.lo \
+ libntfs_3g_la-reparse.lo libntfs_3g_la-runlist.lo \
+ libntfs_3g_la-security.lo libntfs_3g_la-unistr.lo \
+ libntfs_3g_la-volume.lo libntfs_3g_la-xattrs.lo \
$(am__objects_1) $(am__objects_2)
libntfs_3g_la_OBJECTS = $(am_libntfs_3g_la_OBJECTS)
libntfs_3g_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
@@ -90,6 +112,7 @@ libntfs_3g_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
depcomp = $(SHELL) $(top_srcdir)/depcomp
am__depfiles_maybe = depfiles
+am__mv = mv -f
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
@@ -101,7 +124,6 @@ LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(libntfs_3g_la_SOURCES)
DIST_SOURCES = $(am__libntfs_3g_la_SOURCES_DIST)
-pkgconfigDATA_INSTALL = $(INSTALL_DATA)
DATA = $(pkgconfig_DATA)
ETAGS = etags
CTAGS = ctags
@@ -118,54 +140,69 @@ CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPP = @CPP@
CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
CYGPATH_W = @CYGPATH_W@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DSYMUTIL = @DSYMUTIL@
-ECHO = @ECHO@
+DUMPBIN = @DUMPBIN@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
EXEEXT = @EXEEXT@
-F77 = @F77@
-FFLAGS = @FFLAGS@
+FGREP = @FGREP@
FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@
FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
GREP = @GREP@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
LDCONFIG = @LDCONFIG@
LDFLAGS = @LDFLAGS@
+LIBFUSE_LITE_CFLAGS = @LIBFUSE_LITE_CFLAGS@
LIBFUSE_LITE_LIBS = @LIBFUSE_LITE_LIBS@
+LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
LIBNTFS_3G_VERSION = @LIBNTFS_3G_VERSION@
+LIBNTFS_CPPFLAGS = @LIBNTFS_CPPFLAGS@
+LIBNTFS_LIBS = @LIBNTFS_LIBS@
LIBOBJS = @LIBOBJS@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
MAINT = @MAINT@
MAKEINFO = @MAKEINFO@
MKDIR_P = @MKDIR_P@
+MKNTFS_CPPFLAGS = @MKNTFS_CPPFLAGS@
+MKNTFS_LIBS = @MKNTFS_LIBS@
MV = @MV@
+NM = @NM@
NMEDIT = @NMEDIT@
+NTFSPROGS_STATIC_LIBS = @NTFSPROGS_STATIC_LIBS@
+OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
OUTPUT_FORMAT = @OUTPUT_FORMAT@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
RANLIB = @RANLIB@
RM = @RM@
SED = @SED@
@@ -178,8 +215,9 @@ abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_F77 = @ac_ct_F77@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+all_includes = @all_includes@
+all_libraries = @all_libraries@
am__include = @am__include@
am__leading_dot = @am__leading_dot@
am__quote = @am__quote@
@@ -210,6 +248,7 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
ntfs3gincludedir = @ntfs3gincludedir@
@@ -231,6 +270,7 @@ target_alias = @target_alias@
target_cpu = @target_cpu@
target_os = @target_os@
target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
@@ -239,13 +279,15 @@ MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
@INSTALL_LIBRARY_TRUE@pkgconfig_DATA = libntfs-3g.pc
@INSTALL_LIBRARY_FALSE@noinst_LTLIBRARIES = libntfs-3g.la
libntfs_3g_la_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/include/ntfs-3g
+libntfs_3g_la_CPPFLAGS = $(AM_CPPFLAGS) $(LIBNTFS_CPPFLAGS)
+libntfs_3g_la_LIBADD = $(LIBNTFS_LIBS)
libntfs_3g_la_LDFLAGS = -version-info $(LIBNTFS_3G_VERSION) -no-undefined
-@FUSE_INTERNAL_TRUE@libntfs_3g_la_LIBADD = $(top_builddir)/libfuse-lite/libfuse-lite.la
libntfs_3g_la_SOURCES = acls.c attrib.c attrlist.c bitmap.c bootsect.c \
cache.c collate.c compat.c compress.c debug.c device.c dir.c \
efs.c index.c inode.c lcnalloc.c logfile.c logging.c mft.c \
- misc.c mst.c object_id.c reparse.c runlist.c security.c \
- unistr.c volume.c $(am__append_1) $(am__append_2)
+ misc.c mst.c object_id.c realpath.c reparse.c runlist.c \
+ security.c unistr.c volume.c xattrs.c $(am__append_1) \
+ $(am__append_2)
all: all-am
.SUFFIXES:
@@ -254,14 +296,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
- && exit 0; \
+ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libntfs-3g/Makefile'; \
- cd $(top_srcdir) && \
- $(AUTOMAKE) --gnu libntfs-3g/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu libntfs-3g/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu libntfs-3g/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -279,6 +321,7 @@ $(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
+$(am__aclocal_m4_deps):
libntfs-3g.pc: $(top_builddir)/config.status $(srcdir)/libntfs-3g.pc.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
libntfs-3g.script.so: $(top_builddir)/config.status $(srcdir)/libntfs-3g.script.so.in
@@ -286,20 +329,24 @@ libntfs-3g.script.so: $(top_builddir)/config.status $(srcdir)/libntfs-3g.script.
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)"
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ list2=; for p in $$list; do \
if test -f $$p; then \
- f=$(am__strip_dir) \
- echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
- $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
+ list2="$$list2 $$p"; \
else :; fi; \
- done
+ done; \
+ test -z "$$list2" || { \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
+ }
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- p=$(am__strip_dir) \
- echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
- $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
+ @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
done
clean-libLTLIBRARIES:
@@ -322,20 +369,24 @@ clean-noinstLTLIBRARIES:
install-rootlibLTLIBRARIES: $(rootlib_LTLIBRARIES)
@$(NORMAL_INSTALL)
test -z "$(rootlibdir)" || $(MKDIR_P) "$(DESTDIR)$(rootlibdir)"
- @list='$(rootlib_LTLIBRARIES)'; for p in $$list; do \
+ @list='$(rootlib_LTLIBRARIES)'; test -n "$(rootlibdir)" || list=; \
+ list2=; for p in $$list; do \
if test -f $$p; then \
- f=$(am__strip_dir) \
- echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(rootlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(rootlibdir)/$$f'"; \
- $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(rootlibLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(rootlibdir)/$$f"; \
+ list2="$$list2 $$p"; \
else :; fi; \
- done
+ done; \
+ test -z "$$list2" || { \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(rootlibdir)'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(rootlibdir)"; \
+ }
uninstall-rootlibLTLIBRARIES:
@$(NORMAL_UNINSTALL)
- @list='$(rootlib_LTLIBRARIES)'; for p in $$list; do \
- p=$(am__strip_dir) \
- echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(rootlibdir)/$$p'"; \
- $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(rootlibdir)/$$p"; \
+ @list='$(rootlib_LTLIBRARIES)'; test -n "$(rootlibdir)" || list=; \
+ for p in $$list; do \
+ $(am__strip_dir) \
+ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(rootlibdir)/$$f'"; \
+ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(rootlibdir)/$$f"; \
done
clean-rootlibLTLIBRARIES:
@@ -377,6 +428,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libntfs_3g_la-misc.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libntfs_3g_la-mst.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libntfs_3g_la-object_id.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libntfs_3g_la-realpath.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libntfs_3g_la-reparse.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libntfs_3g_la-runlist.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libntfs_3g_la-security.Plo@am__quote@
@@ -384,230 +436,245 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libntfs_3g_la-unix_io.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libntfs_3g_la-volume.Plo@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libntfs_3g_la-win32_io.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libntfs_3g_la-xattrs.Plo@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
@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@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@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_3g_la-acls.lo: acls.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-acls.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-acls.Tpo -c -o libntfs_3g_la-acls.lo `test -f 'acls.c' || echo '$(srcdir)/'`acls.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-acls.Tpo $(DEPDIR)/libntfs_3g_la-acls.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-acls.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-acls.Tpo -c -o libntfs_3g_la-acls.lo `test -f 'acls.c' || echo '$(srcdir)/'`acls.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-acls.Tpo $(DEPDIR)/libntfs_3g_la-acls.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='acls.c' object='libntfs_3g_la-acls.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-acls.lo `test -f 'acls.c' || echo '$(srcdir)/'`acls.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-acls.lo `test -f 'acls.c' || echo '$(srcdir)/'`acls.c
libntfs_3g_la-attrib.lo: attrib.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-attrib.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-attrib.Tpo -c -o libntfs_3g_la-attrib.lo `test -f 'attrib.c' || echo '$(srcdir)/'`attrib.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-attrib.Tpo $(DEPDIR)/libntfs_3g_la-attrib.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-attrib.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-attrib.Tpo -c -o libntfs_3g_la-attrib.lo `test -f 'attrib.c' || echo '$(srcdir)/'`attrib.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-attrib.Tpo $(DEPDIR)/libntfs_3g_la-attrib.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='attrib.c' object='libntfs_3g_la-attrib.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-attrib.lo `test -f 'attrib.c' || echo '$(srcdir)/'`attrib.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-attrib.lo `test -f 'attrib.c' || echo '$(srcdir)/'`attrib.c
libntfs_3g_la-attrlist.lo: attrlist.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-attrlist.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-attrlist.Tpo -c -o libntfs_3g_la-attrlist.lo `test -f 'attrlist.c' || echo '$(srcdir)/'`attrlist.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-attrlist.Tpo $(DEPDIR)/libntfs_3g_la-attrlist.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-attrlist.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-attrlist.Tpo -c -o libntfs_3g_la-attrlist.lo `test -f 'attrlist.c' || echo '$(srcdir)/'`attrlist.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-attrlist.Tpo $(DEPDIR)/libntfs_3g_la-attrlist.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='attrlist.c' object='libntfs_3g_la-attrlist.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-attrlist.lo `test -f 'attrlist.c' || echo '$(srcdir)/'`attrlist.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-attrlist.lo `test -f 'attrlist.c' || echo '$(srcdir)/'`attrlist.c
libntfs_3g_la-bitmap.lo: bitmap.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-bitmap.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-bitmap.Tpo -c -o libntfs_3g_la-bitmap.lo `test -f 'bitmap.c' || echo '$(srcdir)/'`bitmap.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-bitmap.Tpo $(DEPDIR)/libntfs_3g_la-bitmap.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-bitmap.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-bitmap.Tpo -c -o libntfs_3g_la-bitmap.lo `test -f 'bitmap.c' || echo '$(srcdir)/'`bitmap.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-bitmap.Tpo $(DEPDIR)/libntfs_3g_la-bitmap.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bitmap.c' object='libntfs_3g_la-bitmap.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-bitmap.lo `test -f 'bitmap.c' || echo '$(srcdir)/'`bitmap.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-bitmap.lo `test -f 'bitmap.c' || echo '$(srcdir)/'`bitmap.c
libntfs_3g_la-bootsect.lo: bootsect.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-bootsect.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-bootsect.Tpo -c -o libntfs_3g_la-bootsect.lo `test -f 'bootsect.c' || echo '$(srcdir)/'`bootsect.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-bootsect.Tpo $(DEPDIR)/libntfs_3g_la-bootsect.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-bootsect.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-bootsect.Tpo -c -o libntfs_3g_la-bootsect.lo `test -f 'bootsect.c' || echo '$(srcdir)/'`bootsect.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-bootsect.Tpo $(DEPDIR)/libntfs_3g_la-bootsect.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='bootsect.c' object='libntfs_3g_la-bootsect.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-bootsect.lo `test -f 'bootsect.c' || echo '$(srcdir)/'`bootsect.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-bootsect.lo `test -f 'bootsect.c' || echo '$(srcdir)/'`bootsect.c
libntfs_3g_la-cache.lo: cache.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-cache.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-cache.Tpo -c -o libntfs_3g_la-cache.lo `test -f 'cache.c' || echo '$(srcdir)/'`cache.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-cache.Tpo $(DEPDIR)/libntfs_3g_la-cache.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-cache.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-cache.Tpo -c -o libntfs_3g_la-cache.lo `test -f 'cache.c' || echo '$(srcdir)/'`cache.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-cache.Tpo $(DEPDIR)/libntfs_3g_la-cache.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='cache.c' object='libntfs_3g_la-cache.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-cache.lo `test -f 'cache.c' || echo '$(srcdir)/'`cache.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-cache.lo `test -f 'cache.c' || echo '$(srcdir)/'`cache.c
libntfs_3g_la-collate.lo: collate.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-collate.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-collate.Tpo -c -o libntfs_3g_la-collate.lo `test -f 'collate.c' || echo '$(srcdir)/'`collate.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-collate.Tpo $(DEPDIR)/libntfs_3g_la-collate.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-collate.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-collate.Tpo -c -o libntfs_3g_la-collate.lo `test -f 'collate.c' || echo '$(srcdir)/'`collate.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-collate.Tpo $(DEPDIR)/libntfs_3g_la-collate.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='collate.c' object='libntfs_3g_la-collate.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-collate.lo `test -f 'collate.c' || echo '$(srcdir)/'`collate.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-collate.lo `test -f 'collate.c' || echo '$(srcdir)/'`collate.c
libntfs_3g_la-compat.lo: compat.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-compat.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-compat.Tpo -c -o libntfs_3g_la-compat.lo `test -f 'compat.c' || echo '$(srcdir)/'`compat.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-compat.Tpo $(DEPDIR)/libntfs_3g_la-compat.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-compat.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-compat.Tpo -c -o libntfs_3g_la-compat.lo `test -f 'compat.c' || echo '$(srcdir)/'`compat.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-compat.Tpo $(DEPDIR)/libntfs_3g_la-compat.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='compat.c' object='libntfs_3g_la-compat.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-compat.lo `test -f 'compat.c' || echo '$(srcdir)/'`compat.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-compat.lo `test -f 'compat.c' || echo '$(srcdir)/'`compat.c
libntfs_3g_la-compress.lo: compress.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-compress.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-compress.Tpo -c -o libntfs_3g_la-compress.lo `test -f 'compress.c' || echo '$(srcdir)/'`compress.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-compress.Tpo $(DEPDIR)/libntfs_3g_la-compress.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-compress.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-compress.Tpo -c -o libntfs_3g_la-compress.lo `test -f 'compress.c' || echo '$(srcdir)/'`compress.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-compress.Tpo $(DEPDIR)/libntfs_3g_la-compress.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='compress.c' object='libntfs_3g_la-compress.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-compress.lo `test -f 'compress.c' || echo '$(srcdir)/'`compress.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-compress.lo `test -f 'compress.c' || echo '$(srcdir)/'`compress.c
libntfs_3g_la-debug.lo: debug.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-debug.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-debug.Tpo -c -o libntfs_3g_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-debug.Tpo $(DEPDIR)/libntfs_3g_la-debug.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-debug.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-debug.Tpo -c -o libntfs_3g_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-debug.Tpo $(DEPDIR)/libntfs_3g_la-debug.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='debug.c' object='libntfs_3g_la-debug.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-debug.lo `test -f 'debug.c' || echo '$(srcdir)/'`debug.c
libntfs_3g_la-device.lo: device.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-device.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-device.Tpo -c -o libntfs_3g_la-device.lo `test -f 'device.c' || echo '$(srcdir)/'`device.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-device.Tpo $(DEPDIR)/libntfs_3g_la-device.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-device.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-device.Tpo -c -o libntfs_3g_la-device.lo `test -f 'device.c' || echo '$(srcdir)/'`device.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-device.Tpo $(DEPDIR)/libntfs_3g_la-device.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='device.c' object='libntfs_3g_la-device.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-device.lo `test -f 'device.c' || echo '$(srcdir)/'`device.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-device.lo `test -f 'device.c' || echo '$(srcdir)/'`device.c
libntfs_3g_la-dir.lo: dir.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-dir.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-dir.Tpo -c -o libntfs_3g_la-dir.lo `test -f 'dir.c' || echo '$(srcdir)/'`dir.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-dir.Tpo $(DEPDIR)/libntfs_3g_la-dir.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-dir.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-dir.Tpo -c -o libntfs_3g_la-dir.lo `test -f 'dir.c' || echo '$(srcdir)/'`dir.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-dir.Tpo $(DEPDIR)/libntfs_3g_la-dir.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='dir.c' object='libntfs_3g_la-dir.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-dir.lo `test -f 'dir.c' || echo '$(srcdir)/'`dir.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-dir.lo `test -f 'dir.c' || echo '$(srcdir)/'`dir.c
libntfs_3g_la-efs.lo: efs.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-efs.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-efs.Tpo -c -o libntfs_3g_la-efs.lo `test -f 'efs.c' || echo '$(srcdir)/'`efs.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-efs.Tpo $(DEPDIR)/libntfs_3g_la-efs.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-efs.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-efs.Tpo -c -o libntfs_3g_la-efs.lo `test -f 'efs.c' || echo '$(srcdir)/'`efs.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-efs.Tpo $(DEPDIR)/libntfs_3g_la-efs.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='efs.c' object='libntfs_3g_la-efs.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-efs.lo `test -f 'efs.c' || echo '$(srcdir)/'`efs.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-efs.lo `test -f 'efs.c' || echo '$(srcdir)/'`efs.c
libntfs_3g_la-index.lo: index.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-index.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-index.Tpo -c -o libntfs_3g_la-index.lo `test -f 'index.c' || echo '$(srcdir)/'`index.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-index.Tpo $(DEPDIR)/libntfs_3g_la-index.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-index.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-index.Tpo -c -o libntfs_3g_la-index.lo `test -f 'index.c' || echo '$(srcdir)/'`index.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-index.Tpo $(DEPDIR)/libntfs_3g_la-index.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='index.c' object='libntfs_3g_la-index.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-index.lo `test -f 'index.c' || echo '$(srcdir)/'`index.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-index.lo `test -f 'index.c' || echo '$(srcdir)/'`index.c
libntfs_3g_la-inode.lo: inode.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-inode.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-inode.Tpo -c -o libntfs_3g_la-inode.lo `test -f 'inode.c' || echo '$(srcdir)/'`inode.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-inode.Tpo $(DEPDIR)/libntfs_3g_la-inode.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-inode.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-inode.Tpo -c -o libntfs_3g_la-inode.lo `test -f 'inode.c' || echo '$(srcdir)/'`inode.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-inode.Tpo $(DEPDIR)/libntfs_3g_la-inode.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='inode.c' object='libntfs_3g_la-inode.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-inode.lo `test -f 'inode.c' || echo '$(srcdir)/'`inode.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-inode.lo `test -f 'inode.c' || echo '$(srcdir)/'`inode.c
libntfs_3g_la-lcnalloc.lo: lcnalloc.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-lcnalloc.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-lcnalloc.Tpo -c -o libntfs_3g_la-lcnalloc.lo `test -f 'lcnalloc.c' || echo '$(srcdir)/'`lcnalloc.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-lcnalloc.Tpo $(DEPDIR)/libntfs_3g_la-lcnalloc.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-lcnalloc.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-lcnalloc.Tpo -c -o libntfs_3g_la-lcnalloc.lo `test -f 'lcnalloc.c' || echo '$(srcdir)/'`lcnalloc.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-lcnalloc.Tpo $(DEPDIR)/libntfs_3g_la-lcnalloc.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lcnalloc.c' object='libntfs_3g_la-lcnalloc.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-lcnalloc.lo `test -f 'lcnalloc.c' || echo '$(srcdir)/'`lcnalloc.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-lcnalloc.lo `test -f 'lcnalloc.c' || echo '$(srcdir)/'`lcnalloc.c
libntfs_3g_la-logfile.lo: logfile.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-logfile.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-logfile.Tpo -c -o libntfs_3g_la-logfile.lo `test -f 'logfile.c' || echo '$(srcdir)/'`logfile.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-logfile.Tpo $(DEPDIR)/libntfs_3g_la-logfile.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-logfile.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-logfile.Tpo -c -o libntfs_3g_la-logfile.lo `test -f 'logfile.c' || echo '$(srcdir)/'`logfile.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-logfile.Tpo $(DEPDIR)/libntfs_3g_la-logfile.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='logfile.c' object='libntfs_3g_la-logfile.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-logfile.lo `test -f 'logfile.c' || echo '$(srcdir)/'`logfile.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-logfile.lo `test -f 'logfile.c' || echo '$(srcdir)/'`logfile.c
libntfs_3g_la-logging.lo: logging.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-logging.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-logging.Tpo -c -o libntfs_3g_la-logging.lo `test -f 'logging.c' || echo '$(srcdir)/'`logging.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-logging.Tpo $(DEPDIR)/libntfs_3g_la-logging.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-logging.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-logging.Tpo -c -o libntfs_3g_la-logging.lo `test -f 'logging.c' || echo '$(srcdir)/'`logging.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-logging.Tpo $(DEPDIR)/libntfs_3g_la-logging.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='logging.c' object='libntfs_3g_la-logging.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-logging.lo `test -f 'logging.c' || echo '$(srcdir)/'`logging.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-logging.lo `test -f 'logging.c' || echo '$(srcdir)/'`logging.c
libntfs_3g_la-mft.lo: mft.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-mft.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-mft.Tpo -c -o libntfs_3g_la-mft.lo `test -f 'mft.c' || echo '$(srcdir)/'`mft.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-mft.Tpo $(DEPDIR)/libntfs_3g_la-mft.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-mft.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-mft.Tpo -c -o libntfs_3g_la-mft.lo `test -f 'mft.c' || echo '$(srcdir)/'`mft.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-mft.Tpo $(DEPDIR)/libntfs_3g_la-mft.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mft.c' object='libntfs_3g_la-mft.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-mft.lo `test -f 'mft.c' || echo '$(srcdir)/'`mft.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-mft.lo `test -f 'mft.c' || echo '$(srcdir)/'`mft.c
libntfs_3g_la-misc.lo: misc.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-misc.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-misc.Tpo -c -o libntfs_3g_la-misc.lo `test -f 'misc.c' || echo '$(srcdir)/'`misc.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-misc.Tpo $(DEPDIR)/libntfs_3g_la-misc.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-misc.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-misc.Tpo -c -o libntfs_3g_la-misc.lo `test -f 'misc.c' || echo '$(srcdir)/'`misc.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-misc.Tpo $(DEPDIR)/libntfs_3g_la-misc.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='misc.c' object='libntfs_3g_la-misc.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-misc.lo `test -f 'misc.c' || echo '$(srcdir)/'`misc.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-misc.lo `test -f 'misc.c' || echo '$(srcdir)/'`misc.c
libntfs_3g_la-mst.lo: mst.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-mst.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-mst.Tpo -c -o libntfs_3g_la-mst.lo `test -f 'mst.c' || echo '$(srcdir)/'`mst.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-mst.Tpo $(DEPDIR)/libntfs_3g_la-mst.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-mst.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-mst.Tpo -c -o libntfs_3g_la-mst.lo `test -f 'mst.c' || echo '$(srcdir)/'`mst.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-mst.Tpo $(DEPDIR)/libntfs_3g_la-mst.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mst.c' object='libntfs_3g_la-mst.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-mst.lo `test -f 'mst.c' || echo '$(srcdir)/'`mst.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-mst.lo `test -f 'mst.c' || echo '$(srcdir)/'`mst.c
libntfs_3g_la-object_id.lo: object_id.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-object_id.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-object_id.Tpo -c -o libntfs_3g_la-object_id.lo `test -f 'object_id.c' || echo '$(srcdir)/'`object_id.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-object_id.Tpo $(DEPDIR)/libntfs_3g_la-object_id.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-object_id.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-object_id.Tpo -c -o libntfs_3g_la-object_id.lo `test -f 'object_id.c' || echo '$(srcdir)/'`object_id.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-object_id.Tpo $(DEPDIR)/libntfs_3g_la-object_id.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='object_id.c' object='libntfs_3g_la-object_id.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-object_id.lo `test -f 'object_id.c' || echo '$(srcdir)/'`object_id.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-object_id.lo `test -f 'object_id.c' || echo '$(srcdir)/'`object_id.c
+
+libntfs_3g_la-realpath.lo: realpath.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-realpath.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-realpath.Tpo -c -o libntfs_3g_la-realpath.lo `test -f 'realpath.c' || echo '$(srcdir)/'`realpath.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-realpath.Tpo $(DEPDIR)/libntfs_3g_la-realpath.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='realpath.c' object='libntfs_3g_la-realpath.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-realpath.lo `test -f 'realpath.c' || echo '$(srcdir)/'`realpath.c
libntfs_3g_la-reparse.lo: reparse.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-reparse.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-reparse.Tpo -c -o libntfs_3g_la-reparse.lo `test -f 'reparse.c' || echo '$(srcdir)/'`reparse.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-reparse.Tpo $(DEPDIR)/libntfs_3g_la-reparse.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-reparse.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-reparse.Tpo -c -o libntfs_3g_la-reparse.lo `test -f 'reparse.c' || echo '$(srcdir)/'`reparse.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-reparse.Tpo $(DEPDIR)/libntfs_3g_la-reparse.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='reparse.c' object='libntfs_3g_la-reparse.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-reparse.lo `test -f 'reparse.c' || echo '$(srcdir)/'`reparse.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-reparse.lo `test -f 'reparse.c' || echo '$(srcdir)/'`reparse.c
libntfs_3g_la-runlist.lo: runlist.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-runlist.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-runlist.Tpo -c -o libntfs_3g_la-runlist.lo `test -f 'runlist.c' || echo '$(srcdir)/'`runlist.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-runlist.Tpo $(DEPDIR)/libntfs_3g_la-runlist.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-runlist.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-runlist.Tpo -c -o libntfs_3g_la-runlist.lo `test -f 'runlist.c' || echo '$(srcdir)/'`runlist.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-runlist.Tpo $(DEPDIR)/libntfs_3g_la-runlist.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='runlist.c' object='libntfs_3g_la-runlist.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-runlist.lo `test -f 'runlist.c' || echo '$(srcdir)/'`runlist.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-runlist.lo `test -f 'runlist.c' || echo '$(srcdir)/'`runlist.c
libntfs_3g_la-security.lo: security.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-security.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-security.Tpo -c -o libntfs_3g_la-security.lo `test -f 'security.c' || echo '$(srcdir)/'`security.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-security.Tpo $(DEPDIR)/libntfs_3g_la-security.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-security.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-security.Tpo -c -o libntfs_3g_la-security.lo `test -f 'security.c' || echo '$(srcdir)/'`security.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-security.Tpo $(DEPDIR)/libntfs_3g_la-security.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='security.c' object='libntfs_3g_la-security.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-security.lo `test -f 'security.c' || echo '$(srcdir)/'`security.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-security.lo `test -f 'security.c' || echo '$(srcdir)/'`security.c
libntfs_3g_la-unistr.lo: unistr.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-unistr.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-unistr.Tpo -c -o libntfs_3g_la-unistr.lo `test -f 'unistr.c' || echo '$(srcdir)/'`unistr.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-unistr.Tpo $(DEPDIR)/libntfs_3g_la-unistr.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-unistr.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-unistr.Tpo -c -o libntfs_3g_la-unistr.lo `test -f 'unistr.c' || echo '$(srcdir)/'`unistr.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-unistr.Tpo $(DEPDIR)/libntfs_3g_la-unistr.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='unistr.c' object='libntfs_3g_la-unistr.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-unistr.lo `test -f 'unistr.c' || echo '$(srcdir)/'`unistr.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-unistr.lo `test -f 'unistr.c' || echo '$(srcdir)/'`unistr.c
libntfs_3g_la-volume.lo: volume.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-volume.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-volume.Tpo -c -o libntfs_3g_la-volume.lo `test -f 'volume.c' || echo '$(srcdir)/'`volume.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-volume.Tpo $(DEPDIR)/libntfs_3g_la-volume.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-volume.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-volume.Tpo -c -o libntfs_3g_la-volume.lo `test -f 'volume.c' || echo '$(srcdir)/'`volume.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-volume.Tpo $(DEPDIR)/libntfs_3g_la-volume.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='volume.c' object='libntfs_3g_la-volume.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-volume.lo `test -f 'volume.c' || echo '$(srcdir)/'`volume.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-volume.lo `test -f 'volume.c' || echo '$(srcdir)/'`volume.c
+
+libntfs_3g_la-xattrs.lo: xattrs.c
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-xattrs.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-xattrs.Tpo -c -o libntfs_3g_la-xattrs.lo `test -f 'xattrs.c' || echo '$(srcdir)/'`xattrs.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-xattrs.Tpo $(DEPDIR)/libntfs_3g_la-xattrs.Plo
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='xattrs.c' object='libntfs_3g_la-xattrs.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-xattrs.lo `test -f 'xattrs.c' || echo '$(srcdir)/'`xattrs.c
libntfs_3g_la-win32_io.lo: win32_io.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-win32_io.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-win32_io.Tpo -c -o libntfs_3g_la-win32_io.lo `test -f 'win32_io.c' || echo '$(srcdir)/'`win32_io.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-win32_io.Tpo $(DEPDIR)/libntfs_3g_la-win32_io.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-win32_io.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-win32_io.Tpo -c -o libntfs_3g_la-win32_io.lo `test -f 'win32_io.c' || echo '$(srcdir)/'`win32_io.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-win32_io.Tpo $(DEPDIR)/libntfs_3g_la-win32_io.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='win32_io.c' object='libntfs_3g_la-win32_io.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-win32_io.lo `test -f 'win32_io.c' || echo '$(srcdir)/'`win32_io.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-win32_io.lo `test -f 'win32_io.c' || echo '$(srcdir)/'`win32_io.c
libntfs_3g_la-unix_io.lo: unix_io.c
-@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-unix_io.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-unix_io.Tpo -c -o libntfs_3g_la-unix_io.lo `test -f 'unix_io.c' || echo '$(srcdir)/'`unix_io.c
-@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/libntfs_3g_la-unix_io.Tpo $(DEPDIR)/libntfs_3g_la-unix_io.Plo
+@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -MT libntfs_3g_la-unix_io.lo -MD -MP -MF $(DEPDIR)/libntfs_3g_la-unix_io.Tpo -c -o libntfs_3g_la-unix_io.lo `test -f 'unix_io.c' || echo '$(srcdir)/'`unix_io.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libntfs_3g_la-unix_io.Tpo $(DEPDIR)/libntfs_3g_la-unix_io.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='unix_io.c' object='libntfs_3g_la-unix_io.lo' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-unix_io.lo `test -f 'unix_io.c' || echo '$(srcdir)/'`unix_io.c
+@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libntfs_3g_la_CPPFLAGS) $(CPPFLAGS) $(libntfs_3g_la_CFLAGS) $(CFLAGS) -c -o libntfs_3g_la-unix_io.lo `test -f 'unix_io.c' || echo '$(srcdir)/'`unix_io.c
mostlyclean-libtool:
-rm -f *.lo
@@ -617,34 +684,37 @@ clean-libtool:
install-pkgconfigDATA: $(pkgconfig_DATA)
@$(NORMAL_INSTALL)
test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)"
- @list='$(pkgconfig_DATA)'; for p in $$list; do \
+ @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+ for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- f=$(am__strip_dir) \
- echo " $(pkgconfigDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
- $(pkgconfigDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgconfigdir)/$$f"; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \
done
uninstall-pkgconfigDATA:
@$(NORMAL_UNINSTALL)
- @list='$(pkgconfig_DATA)'; for p in $$list; do \
- f=$(am__strip_dir) \
- echo " rm -f '$(DESTDIR)$(pkgconfigdir)/$$f'"; \
- rm -f "$(DESTDIR)$(pkgconfigdir)/$$f"; \
- done
+ @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files
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; nonemtpy = 1; } \
+ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
+ set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@@ -652,29 +722,34 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- tags=; \
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; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$tags $$unique
+ $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -695,13 +770,17 @@ distdir: $(DISTFILES)
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
+ test -f "$(distdir)/$$file" \
+ || cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@@ -732,6 +811,7 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -755,6 +835,8 @@ dvi-am:
html: html-am
+html-am:
+
info: info-am
info-am:
@@ -763,20 +845,29 @@ install-data-am: install-pkgconfigDATA install-rootlibLTLIBRARIES
install-dvi: install-dvi-am
+install-dvi-am:
+
install-exec-am: install-libLTLIBRARIES
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-exec-hook
-
install-html: install-html-am
+install-html-am:
+
install-info: install-info-am
+install-info-am:
+
install-man:
install-pdf: install-pdf-am
+install-pdf-am:
+
install-ps: install-ps-am
+install-ps-am:
+
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -836,6 +927,9 @@ install-exec-hook: install-rootlibLTLIBRARIES
uninstall-local:
@INSTALL_LIBRARY_TRUE@ $(RM) -f "$(DESTDIR)/$(rootlibdir)"/libntfs-3g.so*
+
+@ENABLE_NTFSPROGS_TRUE@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/libntfs-3g/acls.c b/libntfs-3g/acls.c
index 11054ba..e762310 100755
--- a/libntfs-3g/acls.c
+++ b/libntfs-3g/acls.c
@@ -4,7 +4,7 @@
* This module is part of ntfs-3g library, but may also be
* integrated in tools running over Linux or Windows
*
- * Copyright (c) 2007-2009 Jean-Pierre Andre
+ * Copyright (c) 2007-2012 Jean-Pierre Andre
*
* This program/include file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
@@ -76,10 +76,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdarg.h>
-#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
-#endif
-
#include <errno.h>
/*
@@ -108,7 +105,7 @@
#include <dlfcn.h>
#endif /* STSC */
#endif /* WIN32 */
-//#include "secaudit.h"
+#include "secaudit.h"
#endif /* HAVE_CONFIG_H */
/*
@@ -139,6 +136,19 @@ static const char worldsidbytes[] = {
0, 0, 0, 0 /* 1st level */
} ;
+/*
+ * SID for authenticated user (S-1-5-11)
+ */
+
+static const char authsidbytes[] = {
+ 1, /* revision */
+ 1, /* auth count */
+ 0, 0, 0, 0, 0, 5, /* base */
+ 11, 0, 0, 0 /* 1st level */
+};
+
+static const SID *authsid = (const SID*)authsidbytes;
+
const SID *worldsid = (const SID*)worldsidbytes;
/*
@@ -238,6 +248,12 @@ static int is_world_sid(const SID * usid)
&& (usid->identifier_authority.low_part == const_cpu_to_be32(5))
&& (usid->sub_authority[0] == const_cpu_to_le32(32))
&& (usid->sub_authority[1] == const_cpu_to_le32(545)))
+
+ /* check whether S-1-5-11 : authenticated user */
+ || ((usid->sub_authority_count == 1)
+ && (usid->identifier_authority.high_part == const_cpu_to_be16(0))
+ && (usid->identifier_authority.low_part == const_cpu_to_be32(5))
+ && (usid->sub_authority[0] == const_cpu_to_le32(11)))
);
}
@@ -525,9 +541,7 @@ gid_t ntfs_find_group(const struct MAPPING* groupmapping, const SID * gsid)
{
gid_t gid;
const struct MAPPING *p;
- int gsidsz;
- gsidsz = ntfs_sid_size(gsid);
p = groupmapping;
while (p && p->xid && !ntfs_same_sid(gsid, p->sid))
p = p->next;
@@ -618,7 +632,6 @@ BOOL ntfs_valid_descr(const char *securattr, unsigned int attrsz)
* old revision and no DACL though SE_DACL_PRESENT is set
*/
if ((attrsz >= sizeof(SECURITY_DESCRIPTOR_RELATIVE))
- && (ntfs_attr_size(securattr) <= attrsz)
&& (phead->revision == SECURITY_DESCRIPTOR_REVISION)
&& (offowner >= sizeof(SECURITY_DESCRIPTOR_RELATIVE))
&& ((offowner + 2) < attrsz)
@@ -626,14 +639,15 @@ BOOL ntfs_valid_descr(const char *securattr, unsigned int attrsz)
&& ((offgroup + 2) < attrsz)
&& (!offdacl
|| ((offdacl >= sizeof(SECURITY_DESCRIPTOR_RELATIVE))
- && (offdacl < attrsz)))
+ && (offdacl+sizeof(ACL) <= attrsz)))
&& (!offsacl
|| ((offsacl >= sizeof(SECURITY_DESCRIPTOR_RELATIVE))
- && (offsacl < attrsz)))
+ && (offsacl+sizeof(ACL) <= attrsz)))
&& !(phead->owner & const_cpu_to_le32(3))
&& !(phead->group & const_cpu_to_le32(3))
&& !(phead->dacl & const_cpu_to_le32(3))
&& !(phead->sacl & const_cpu_to_le32(3))
+ && (ntfs_attr_size(securattr) <= attrsz)
&& ntfs_valid_sid((const SID*)&securattr[offowner])
&& ntfs_valid_sid((const SID*)&securattr[offgroup])
/*
@@ -669,7 +683,8 @@ BOOL ntfs_valid_descr(const char *securattr, unsigned int attrsz)
*/
int ntfs_inherit_acl(const ACL *oldacl, ACL *newacl,
- const SID *usid, const SID *gsid, BOOL fordir)
+ const SID *usid, const SID *gsid, BOOL fordir,
+ le16 inherited)
{
unsigned int src;
unsigned int dst;
@@ -682,7 +697,9 @@ int ntfs_inherit_acl(const ACL *oldacl, ACL *newacl,
int gsidsz;
const ACCESS_ALLOWED_ACE *poldace;
ACCESS_ALLOWED_ACE *pnewace;
+ ACCESS_ALLOWED_ACE *pauthace;
+ pauthace = (ACCESS_ALLOWED_ACE*)NULL;
usidsz = ntfs_sid_size(usid);
gsidsz = ntfs_sid_size(gsid);
@@ -699,25 +716,19 @@ int ntfs_inherit_acl(const ACL *oldacl, ACL *newacl,
for (nace = 0; nace < oldcnt; nace++) {
poldace = (const ACCESS_ALLOWED_ACE*)((const char*)oldacl + src);
acesz = le16_to_cpu(poldace->size);
- /* inheritance for access */
- if (poldace->flags & selection) {
+ src += acesz;
+ /*
+ * Inheritance for access, unless this is inheriting
+ * an inherited ACL to a directory.
+ */
+ if ((poldace->flags & selection)
+ && !(fordir && inherited)
+ && !ntfs_same_sid(&poldace->sid, ownersid)
+ && !ntfs_same_sid(&poldace->sid, groupsid)) {
pnewace = (ACCESS_ALLOWED_ACE*)
((char*)newacl + dst);
memcpy(pnewace,poldace,acesz);
- /*
- * Replace generic creator-owner and
- * creator-group by owner and group
- */
- if (ntfs_same_sid(&pnewace->sid, ownersid)) {
- memcpy(&pnewace->sid, usid, usidsz);
- acesz = usidsz + 8;
- pnewace->size = cpu_to_le16(acesz);
- }
- if (ntfs_same_sid(&pnewace->sid, groupsid)) {
- memcpy(&pnewace->sid, gsid, gsidsz);
- acesz = gsidsz + 8;
- pnewace->size = cpu_to_le16(acesz);
- }
+ /* reencode GENERIC_ALL */
if (pnewace->mask & GENERIC_ALL) {
pnewace->mask &= ~GENERIC_ALL;
if (fordir)
@@ -736,16 +747,70 @@ int ntfs_inherit_acl(const ACL *oldacl, ACL *newacl,
| FILE_EXEC
| cpu_to_le32(0x40);
}
+ /* reencode GENERIC_READ (+ EXECUTE) */
+ if (pnewace->mask & GENERIC_READ) {
+ if (fordir)
+ pnewace->mask |= OWNER_RIGHTS
+ | DIR_READ
+ | DIR_EXEC;
+ else
+ pnewace->mask |= OWNER_RIGHTS
+ | FILE_READ
+ | FILE_EXEC;
+ pnewace->mask &= ~(GENERIC_READ
+ | GENERIC_EXECUTE
+ | WRITE_DAC
+ | WRITE_OWNER
+ | DELETE | FILE_WRITE_EA
+ | FILE_WRITE_ATTRIBUTES);
+ }
+ /* reencode GENERIC_WRITE */
+ if (pnewace->mask & GENERIC_WRITE) {
+ if (fordir)
+ pnewace->mask |= OWNER_RIGHTS
+ | DIR_WRITE;
+ else
+ pnewace->mask |= OWNER_RIGHTS
+ | FILE_WRITE;
+ pnewace->mask &= ~(GENERIC_WRITE
+ | WRITE_DAC
+ | WRITE_OWNER
+ | FILE_DELETE_CHILD);
+ }
/* remove inheritance flags */
pnewace->flags &= ~(OBJECT_INHERIT_ACE
| CONTAINER_INHERIT_ACE
| INHERIT_ONLY_ACE);
- dst += acesz;
- newcnt++;
+ /*
+ * Group similar ACE for authenticated users
+ * (should probably be done for other SIDs)
+ */
+ if (!fordir
+ && (poldace->type == ACCESS_ALLOWED_ACE_TYPE)
+ && ntfs_same_sid(&poldace->sid, authsid)) {
+ if (pauthace) {
+ pauthace->flags |= pnewace->flags;
+ pauthace->mask |= pnewace->mask;
+ } else {
+ pauthace = pnewace;
+ if (inherited)
+ pnewace->flags |= INHERITED_ACE;
+ dst += acesz;
+ newcnt++;
+ }
+ } else {
+ if (inherited)
+ pnewace->flags |= INHERITED_ACE;
+ dst += acesz;
+ newcnt++;
+ }
}
- /* inheritance for further inheritance */
- if (fordir
- && (poldace->flags
+ /*
+ * Inheritance for access, specific to
+ * creator-owner (and creator-group)
+ */
+ if (fordir || !inherited
+ || (poldace->flags
& (CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE))) {
pnewace = (ACCESS_ALLOWED_ACE*)
((char*)newacl + dst);
@@ -753,19 +818,46 @@ int ntfs_inherit_acl(const ACL *oldacl, ACL *newacl,
/*
* Replace generic creator-owner and
* creator-group by owner and group
+ * (but keep for further inheritance)
*/
if (ntfs_same_sid(&pnewace->sid, ownersid)) {
memcpy(&pnewace->sid, usid, usidsz);
- acesz = usidsz + 8;
+ pnewace->size = cpu_to_le16(usidsz + 8);
+ /* remove inheritance flags */
+ pnewace->flags &= ~(OBJECT_INHERIT_ACE
+ | CONTAINER_INHERIT_ACE
+ | INHERIT_ONLY_ACE);
+ if (inherited)
+ pnewace->flags |= INHERITED_ACE;
+ dst += usidsz + 8;
+ newcnt++;
}
if (ntfs_same_sid(&pnewace->sid, groupsid)) {
memcpy(&pnewace->sid, gsid, gsidsz);
- acesz = gsidsz + 8;
+ pnewace->size = cpu_to_le16(gsidsz + 8);
+ /* remove inheritance flags */
+ pnewace->flags &= ~(OBJECT_INHERIT_ACE
+ | CONTAINER_INHERIT_ACE
+ | INHERIT_ONLY_ACE);
+ if (inherited)
+ pnewace->flags |= INHERITED_ACE;
+ dst += gsidsz + 8;
+ newcnt++;
}
+ }
+
+ /* inheritance for further inheritance */
+ if (fordir
+ && (poldace->flags
+ & (CONTAINER_INHERIT_ACE | OBJECT_INHERIT_ACE))) {
+ pnewace = (ACCESS_ALLOWED_ACE*)
+ ((char*)newacl + dst);
+ memcpy(pnewace,poldace,acesz);
+ if (inherited)
+ pnewace->flags |= INHERITED_ACE;
dst += acesz;
newcnt++;
}
- src += acesz;
}
/*
* Adjust header if something was inherited
@@ -1904,7 +1996,6 @@ static int buildacls_posix(struct MAPPING* const mapping[],
const SID *sid;
int acecnt;
int usidsz;
- int gsidsz;
int wsidsz;
int asidsz;
int ssidsz;
@@ -1912,7 +2003,6 @@ static int buildacls_posix(struct MAPPING* const mapping[],
le32 grants;
usidsz = ntfs_sid_size(usid);
- gsidsz = ntfs_sid_size(gsid);
wsidsz = ntfs_sid_size(worldsid);
asidsz = ntfs_sid_size(adminsid);
ssidsz = ntfs_sid_size(systemsid);
@@ -3066,6 +3156,7 @@ static int build_owngrp_permissions(const char *securattr,
int nace;
le32 special;
BOOL grppresent;
+ BOOL ownpresent;
le32 allowown, allowgrp, allowall;
le32 denyown, denygrp, denyall;
@@ -3075,21 +3166,26 @@ static int build_owngrp_permissions(const char *securattr,
special = const_cpu_to_le32(0);
allowown = allowgrp = allowall = const_cpu_to_le32(0);
denyown = denygrp = denyall = const_cpu_to_le32(0);
+ ownpresent = FALSE;
grppresent = FALSE;
if (offdacl) {
acecnt = le16_to_cpu(pacl->ace_count);
offace = offdacl + sizeof(ACL);
- } else
+ } else {
acecnt = 0;
+ offace = 0;
+ }
for (nace = 0; nace < acecnt; nace++) {
pace = (const ACCESS_ALLOWED_ACE*)&securattr[offace];
if (!(pace->flags & INHERIT_ONLY_ACE)) {
if ((ntfs_same_sid(usid, &pace->sid)
|| ntfs_same_sid(ownersid, &pace->sid))
&& (pace->mask & WRITE_OWNER)) {
- if (pace->type == ACCESS_ALLOWED_ACE_TYPE)
+ if (pace->type == ACCESS_ALLOWED_ACE_TYPE) {
allowown |= pace->mask;
- } else
+ ownpresent = TRUE;
+ }
+ } else
if (ntfs_same_sid(usid, &pace->sid)
&& (!(pace->mask & WRITE_OWNER))) {
if (pace->type == ACCESS_ALLOWED_ACE_TYPE) {
@@ -3110,6 +3206,8 @@ static int build_owngrp_permissions(const char *securattr,
}
offace += le16_to_cpu(pace->size);
}
+ if (!ownpresent)
+ allowown = allowall;
if (!grppresent)
allowgrp = allowall;
return (merge_permissions(isdir,
@@ -3135,7 +3233,6 @@ static int norm_ownadmin_permissions_posix(struct POSIX_SECURITY *posix_desc,
u16 tag;
u16 tagsset;
struct POSIX_ACE *pxace;
- int acccnt;
mode_t denywrld;
mode_t allow;
mode_t deny;
@@ -3144,7 +3241,6 @@ static int norm_ownadmin_permissions_posix(struct POSIX_SECURITY *posix_desc,
mode = 0;
pxace = posix_desc->acl.ace;
- acccnt = posix_desc->acccnt;
tagsset = 0;
denywrld = 0;
/*
@@ -3714,7 +3810,7 @@ struct POSIX_SECURITY *ntfs_build_permissions_posix(
pxace->perms |= POSIX_PERM_DENIAL;
else
if (pxace->tag == POSIX_ACL_OTHER)
- pctx->permswrld = pxace->perms;
+ pctx->permswrld |= pxace->perms;
pctx->tagsset |= pxace->tag;
if (pace->flags & INHERIT_ONLY_ACE) {
l--;
@@ -3884,12 +3980,10 @@ struct POSIX_SECURITY *ntfs_build_permissions_posix(
int ntfs_build_permissions(const char *securattr,
const SID *usid, const SID *gsid, BOOL isdir)
{
- const SECURITY_DESCRIPTOR_RELATIVE *phead;
int perm;
BOOL adminowns;
BOOL groupowns;
- phead = (const SECURITY_DESCRIPTOR_RELATIVE*)securattr;
adminowns = ntfs_same_sid(usid,adminsid)
|| ntfs_same_sid(gsid,adminsid);
groupowns = !adminowns && ntfs_same_sid(gsid,usid);
@@ -3960,33 +4054,6 @@ static SID *encodesid(const char *sidstr)
}
/*
- * Early logging before the logs are redirected
- *
- * (not quite satisfactory : this appears before the ntfs-g banner,
- * and with a different pid)
- */
-
-static void log_early_error(const char *format, ...)
- __attribute__((format(printf, 1, 2)));
-
-static void log_early_error(const char *format, ...)
-{
- va_list args;
-
- va_start(args, format);
-#ifdef HAVE_SYSLOG_H
- openlog("ntfs-3g", LOG_PID, LOG_USER);
- ntfs_log_handler_syslog(NULL, NULL, 0,
- NTFS_LOG_LEVEL_ERROR, NULL,
- format, args);
-#else
- vfprintf(stderr,format,args);
-#endif
- va_end(args);
-}
-
-
-/*
* Get a single mapping item from buffer
*
* Always reads a full line, truncating long lines
@@ -3999,7 +4066,6 @@ static struct MAPLIST *getmappingitem(FILEREADER reader, void *fileid,
{
int src;
int dst;
- char *p;
char *q;
char *pu;
char *pg;
@@ -4033,7 +4099,6 @@ static struct MAPLIST *getmappingitem(FILEREADER reader, void *fileid,
if (gotend) {
pu = pg = (char*)NULL;
/* decompose into uid, gid and sid */
- p = item->maptext;
item->uidstr = item->maptext;
item->gidstr = strchr(item->uidstr, ':');
if (item->gidstr) {
@@ -4048,7 +4113,7 @@ static struct MAPLIST *getmappingitem(FILEREADER reader, void *fileid,
if (pu && pg)
*pu = *pg = '\0';
else {
- log_early_error("Bad mapping item \"%s\"\n",
+ ntfs_log_early_error("Bad mapping item \"%s\"\n",
item->maptext);
free(item);
item = (struct MAPLIST*)NULL;
@@ -4177,7 +4242,7 @@ struct MAPPING *ntfs_do_user_mapping(struct MAPLIST *firstitem)
if (pwd)
uid = pwd->pw_uid;
else
- log_early_error("Invalid user \"%s\"\n",
+ ntfs_log_early_error("Invalid user \"%s\"\n",
item->uidstr);
}
}
@@ -4257,7 +4322,7 @@ struct MAPPING *ntfs_do_group_mapping(struct MAPLIST *firstitem)
if (grp)
gid = grp->gr_gid;
else
- log_early_error("Invalid group \"%s\"\n",
+ ntfs_log_early_error("Invalid group \"%s\"\n",
item->gidstr);
}
}
diff --git a/libntfs-3g/attrib.c b/libntfs-3g/attrib.c
index 12ea369..1a9ef37 100755
--- a/libntfs-3g/attrib.c
+++ b/libntfs-3g/attrib.c
@@ -5,7 +5,7 @@
* Copyright (c) 2002-2005 Richard Russon
* Copyright (c) 2002-2008 Szabolcs Szakacsits
* Copyright (c) 2004-2007 Yura Pakhuchiy
- * Copyright (c) 2007-2010 Jean-Pierre Andre
+ * Copyright (c) 2007-2013 Jean-Pierre Andre
* Copyright (c) 2010 Erik Larsson
*
* This program/include file is free software; you can redistribute it and/or
@@ -65,9 +65,6 @@
#include "misc.h"
#include "efs.h"
-#define STANDARD_COMPRESSION_UNIT 4
-#define MAX_COMPRESSION_CLUSTER_SIZE 4096
-
ntfschar AT_UNNAMED[] = { const_cpu_to_le16('\0') };
ntfschar STREAM_SDS[] = { const_cpu_to_le16('$'),
const_cpu_to_le16('S'),
@@ -405,7 +402,7 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type,
ntfs_attr *na = NULL;
ntfschar *newname = NULL;
ATTR_RECORD *a;
- BOOL cs;
+ le16 cs;
ntfs_log_enter("Entering for inode %lld, attr 0x%x.\n",
(unsigned long long)ni->mft_no, type);
@@ -457,7 +454,8 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type,
if (type == AT_ATTRIBUTE_LIST)
a->flags = 0;
- if ((type == AT_DATA) && !a->initialized_size) {
+ if ((type == AT_DATA)
+ && (a->non_resident ? !a->initialized_size : !a->value_length)) {
/*
* Define/redefine the compression state if stream is
* empty, based on the compression mark on parent
@@ -465,17 +463,23 @@ ntfs_attr *ntfs_attr_open(ntfs_inode *ni, const ATTR_TYPES type,
* inode (for named data streams). The compression mark
* may change any time, the compression state can only
* change when stream is wiped out.
+ *
+ * Also prevent compression on NTFS version < 3.0
+ * or cluster size > 4K or compression is disabled
*/
a->flags &= ~ATTR_COMPRESSION_MASK;
- if ((na->ni->flags & FILE_ATTR_COMPRESSED)
+ if ((ni->flags & FILE_ATTR_COMPRESSED)
+ && (ni->vol->major_ver >= 3)
+ && NVolCompression(ni->vol)
&& (ni->vol->cluster_size <= MAX_COMPRESSION_CLUSTER_SIZE))
a->flags |= ATTR_IS_COMPRESSED;
}
cs = a->flags & (ATTR_IS_COMPRESSED | ATTR_IS_SPARSE);
-
+
+ /* a file may be sparse though its unnamed data is not (cf $UsnJrnl) */
if (na->type == AT_DATA && na->name == AT_UNNAMED &&
- ((!(a->flags & ATTR_IS_SPARSE) != !NAttrSparse(na)) ||
+ (((a->flags & ATTR_IS_SPARSE) && !NAttrSparse(na)) ||
(!(a->flags & ATTR_IS_ENCRYPTED) != !NAttrEncrypted(na)))) {
errno = EIO;
ntfs_log_perror("Inode %lld has corrupt attribute flags "
@@ -586,6 +590,82 @@ int ntfs_attr_map_runlist(ntfs_attr *na, VCN vcn)
return -1;
}
+#if PARTIAL_RUNLIST_UPDATING
+
+/*
+ * Map the runlist of an attribute from some point to the end
+ *
+ * Returns 0 if success,
+ * -1 if it failed (errno telling why)
+ */
+
+static int ntfs_attr_map_partial_runlist(ntfs_attr *na, VCN vcn)
+{
+ LCN lcn;
+ VCN last_vcn;
+ VCN highest_vcn;
+ VCN needed;
+ VCN existing_vcn;
+ runlist_element *rl;
+ ATTR_RECORD *a;
+ BOOL startseen;
+ ntfs_attr_search_ctx *ctx;
+
+ lcn = ntfs_rl_vcn_to_lcn(na->rl, vcn);
+ if (lcn >= 0 || lcn == LCN_HOLE || lcn == LCN_ENOENT)
+ return 0;
+
+ existing_vcn = (na->rl ? na->rl->vcn : -1);
+
+ ctx = ntfs_attr_get_search_ctx(na->ni, NULL);
+ if (!ctx)
+ return -1;
+
+ /* Get the last vcn in the attribute. */
+ last_vcn = na->allocated_size >> na->ni->vol->cluster_size_bits;
+
+ needed = vcn;
+ highest_vcn = 0;
+ startseen = FALSE;
+ do {
+ /* Find the attribute in the mft record. */
+ if (!ntfs_attr_lookup(na->type, na->name, na->name_len, CASE_SENSITIVE,
+ needed, NULL, 0, ctx)) {
+
+ a = ctx->attr;
+ /* Decode and merge the runlist. */
+ rl = ntfs_mapping_pairs_decompress(na->ni->vol, a,
+ na->rl);
+ if (rl) {
+ na->rl = rl;
+ highest_vcn = le64_to_cpu(a->highest_vcn);
+ /* corruption detection */
+ if (((highest_vcn + 1) < last_vcn)
+ && ((highest_vcn + 1) <= needed)) {
+ ntfs_log_error("Corrupt attribute list\n");
+ rl = (runlist_element*)NULL;
+ }
+ needed = highest_vcn + 1;
+ if (!a->lowest_vcn)
+ startseen = TRUE;
+ /* reaching a previously allocated part ? */
+ if ((existing_vcn >= 0)
+ && (needed >= existing_vcn)) {
+ needed = last_vcn;
+ }
+ }
+ } else
+ rl = (runlist_element*)NULL;
+ } while (rl && (needed < last_vcn));
+ ntfs_attr_put_search_ctx(ctx);
+ /* mark fully mapped if we did so */
+ if (rl && startseen)
+ NAttrSetFullyMapped(na);
+ return (rl ? 0 : -1);
+}
+
+#endif
+
/**
* ntfs_attr_map_whole_runlist - map the whole runlist of an ntfs attribute
* @na: ntfs attribute for which to map the runlist
@@ -609,6 +689,11 @@ int ntfs_attr_map_whole_runlist(ntfs_attr *na)
ntfs_log_enter("Entering for inode %llu, attr 0x%x.\n",
(unsigned long long)na->ni->mft_no, na->type);
+ /* avoid multiple full runlist mappings */
+ if (NAttrFullyMapped(na)) {
+ ret = 0;
+ goto out;
+ }
ctx = ntfs_attr_get_search_ctx(na->ni, NULL);
if (!ctx)
goto out;
@@ -682,8 +767,10 @@ int ntfs_attr_map_whole_runlist(ntfs_attr *na)
(long long)highest_vcn, (long long)last_vcn);
goto err_out;
}
- if (errno == ENOENT)
+ if (errno == ENOENT) {
+ NAttrSetFullyMapped(na);
ret = 0;
+ }
err_out:
ntfs_attr_put_search_ctx(ctx);
out:
@@ -1105,12 +1192,27 @@ static int ntfs_attr_fill_zero(ntfs_attr *na, s64 pos, s64 count)
rli++;
}
size = min(end - pos, NTFS_BUF_SIZE);
- written = ntfs_rl_pwrite(vol, rli, ofsi, pos, size, buf);
- if (written <= 0) {
- ntfs_log_perror("Failed to zero space");
- goto err_free;
+ /*
+ * If the zeroed block is fully within a hole,
+ * we need not write anything, so advance as far
+ * as possible within the hole.
+ */
+ if ((rli->lcn == (LCN)LCN_HOLE)
+ && (ofsi <= pos)
+ && (ofsi + (rli->length << vol->cluster_size_bits)
+ >= (pos + size))) {
+ size = min(end - pos, ofsi - pos
+ + (rli->length << vol->cluster_size_bits));
+ pos += size;
+ } else {
+ written = ntfs_rl_pwrite(vol, rli, ofsi, pos,
+ size, buf);
+ if (written <= 0) {
+ ntfs_log_perror("Failed to zero space");
+ goto err_free;
+ }
+ pos += written;
}
- pos += written;
}
ret = 0;
@@ -1140,9 +1242,27 @@ static int ntfs_attr_fill_hole(ntfs_attr *na, s64 count, s64 *ofs,
"%lld\n", (long long)count, (long long)cur_vcn,
(long long)from_vcn, (long long)to_write, (long long)*ofs);
- /* Map whole runlist to be able update mapping pairs later. */
+ /* Map the runlist to be able to update mapping pairs later. */
+#if PARTIAL_RUNLIST_UPDATING
+ if ((!na->rl
+ || !NAttrDataAppending(na))) {
+ if (ntfs_attr_map_whole_runlist(na))
+ goto err_out;
+ } else {
+ /* make sure the previous non-hole is mapped */
+ rlc = *rl;
+ rlc--;
+ if (((*rl)->lcn == LCN_HOLE)
+ && cur_vcn
+ && (rlc->vcn < 0)) {
+ if (ntfs_attr_map_partial_runlist(na, cur_vcn - 1))
+ goto err_out;
+ }
+ }
+#else
if (ntfs_attr_map_whole_runlist(na))
goto err_out;
+#endif
/* Restore @*rl, it probably get lost during runlist mapping. */
*rl = ntfs_attr_find_vcn(na, cur_vcn);
@@ -1190,24 +1310,49 @@ static int ntfs_attr_fill_hole(ntfs_attr *na, s64 count, s64 *ofs,
if ((na->data_flags & ATTR_COMPRESSION_MASK)
&& (need < na->compression_block_clusters)) {
/*
- * for a compressed file, be sure to allocate the full hole.
- * We may need space to decompress existing compressed data.
+ * for a compressed file, be sure to allocate the full
+ * compression block, as we may need space to decompress
+ * existing compressed data.
+ * So allocate the space common to compression block
+ * and existing hole.
*/
- rlc = ntfs_cluster_alloc(vol, (*rl)->vcn, (*rl)->length,
+ VCN alloc_vcn;
+
+ if ((from_vcn & -na->compression_block_clusters) <= (*rl)->vcn)
+ alloc_vcn = (*rl)->vcn;
+ else
+ alloc_vcn = from_vcn & -na->compression_block_clusters;
+ need = (alloc_vcn | (na->compression_block_clusters - 1))
+ + 1 - alloc_vcn;
+ if (need > (*rl)->length) {
+ ntfs_log_error("Cannot allocate %lld clusters"
+ " within a hole of %lld\n",
+ (long long)need,
+ (long long)(*rl)->length);
+ errno = EIO;
+ goto err_out;
+ }
+ rlc = ntfs_cluster_alloc(vol, alloc_vcn, need,
lcn_seek_from, DATA_ZONE);
} else
rlc = ntfs_cluster_alloc(vol, from_vcn, need,
lcn_seek_from, DATA_ZONE);
if (!rlc)
goto err_out;
+ if (na->data_flags & (ATTR_COMPRESSION_MASK | ATTR_IS_SPARSE))
+ na->compressed_size += need << vol->cluster_size_bits;
*rl = ntfs_runlists_merge(na->rl, rlc);
/*
- * For a compressed attribute, we must be sure there is an
- * available entry, so reserve it before it gets too late.
+ * For a compressed attribute, we must be sure there are two
+ * available entries, so reserve them before it gets too late.
*/
- if (*rl && (na->data_flags & ATTR_COMPRESSION_MASK))
- *rl = ntfs_rl_extend(*rl,1);
+ if (*rl && (na->data_flags & ATTR_COMPRESSION_MASK)) {
+ runlist_element *oldrl = na->rl;
+ na->rl = *rl;
+ *rl = ntfs_rl_extend(na,*rl,2);
+ if (!*rl) na->rl = oldrl; /* restore to original if failed */
+ }
if (!*rl) {
eo = errno;
ntfs_log_perror("Failed to merge runlists");
@@ -1218,8 +1363,9 @@ static int ntfs_attr_fill_hole(ntfs_attr *na, s64 count, s64 *ofs,
errno = eo;
goto err_out;
}
+ na->unused_runs = 2;
na->rl = *rl;
- if (*update_from == -1)
+ if ((*update_from == -1) || (from_vcn < *update_from))
*update_from = from_vcn;
*rl = ntfs_attr_find_vcn(na, cur_vcn);
if (!*rl) {
@@ -1269,6 +1415,330 @@ err_out:
static int stuff_hole(ntfs_attr *na, const s64 pos);
+/*
+ * Split an existing hole for overwriting with data
+ * The hole may have to be split into two or three parts, so
+ * that the overwritten part fits within a single compression block
+ *
+ * No cluster allocation is needed, this will be done later in
+ * standard hole filling, hence no need to reserve runs for
+ * future needs.
+ *
+ * Returns the number of clusters with existing compressed data
+ * in the compression block to be written to
+ * (or the full block, if it was a full hole)
+ * -1 if there were an error
+ */
+
+static int split_compressed_hole(ntfs_attr *na, runlist_element **prl,
+ s64 pos, s64 count, VCN *update_from)
+{
+ int compressed_part;
+ int cluster_size_bits = na->ni->vol->cluster_size_bits;
+ runlist_element *rl = *prl;
+
+ compressed_part
+ = na->compression_block_clusters;
+ /* reserve entries in runlist if we have to split */
+ if (rl->length > na->compression_block_clusters) {
+ *prl = ntfs_rl_extend(na,*prl,2);
+ if (!*prl) {
+ compressed_part = -1;
+ } else {
+ rl = *prl;
+ na->unused_runs = 2;
+ }
+ }
+ if (*prl && (rl->length > na->compression_block_clusters)) {
+ /*
+ * Locate the update part relative to beginning of
+ * current run
+ */
+ int beginwrite = (pos >> cluster_size_bits) - rl->vcn;
+ s32 endblock = (((pos + count - 1) >> cluster_size_bits)
+ | (na->compression_block_clusters - 1)) + 1 - rl->vcn;
+
+ compressed_part = na->compression_block_clusters
+ - (rl->length & (na->compression_block_clusters - 1));
+ if ((beginwrite + compressed_part) >= na->compression_block_clusters)
+ compressed_part = na->compression_block_clusters;
+ /*
+ * if the run ends beyond end of needed block
+ * we have to split the run
+ */
+ if (endblock < rl[0].length) {
+ runlist_element *xrl;
+ int n;
+
+ /*
+ * we have to split into three parts if the run
+ * does not end within the first compression block.
+ * This means the hole begins before the
+ * compression block.
+ */
+ if (endblock > na->compression_block_clusters) {
+ if (na->unused_runs < 2) {
+ntfs_log_error("No free run, case 1\n");
+ }
+ na->unused_runs -= 2;
+ xrl = rl;
+ n = 0;
+ while (xrl->length) {
+ xrl++;
+ n++;
+ }
+ do {
+ xrl[2] = *xrl;
+ xrl--;
+ } while (xrl != rl);
+ rl[1].length = na->compression_block_clusters;
+ rl[2].length = rl[0].length - endblock;
+ rl[0].length = endblock
+ - na->compression_block_clusters;
+ rl[1].lcn = LCN_HOLE;
+ rl[2].lcn = LCN_HOLE;
+ rl[1].vcn = rl[0].vcn + rl[0].length;
+ rl[2].vcn = rl[1].vcn
+ + na->compression_block_clusters;
+ rl = ++(*prl);
+ } else {
+ /*
+ * split into two parts and use the
+ * first one
+ */
+ if (!na->unused_runs) {
+ntfs_log_error("No free run, case 2\n");
+ }
+ na->unused_runs--;
+ xrl = rl;
+ n = 0;
+ while (xrl->length) {
+ xrl++;
+ n++;
+ }
+ do {
+ xrl[1] = *xrl;
+ xrl--;
+ } while (xrl != rl);
+ if (beginwrite < endblock) {
+ /* we will write into the first part of hole */
+ rl[1].length = rl[0].length - endblock;
+ rl[0].length = endblock;
+ rl[1].vcn = rl[0].vcn + rl[0].length;
+ rl[1].lcn = LCN_HOLE;
+ } else {
+ /* we will write into the second part of hole */
+// impossible ?
+ rl[1].length = rl[0].length - endblock;
+ rl[0].length = endblock;
+ rl[1].vcn = rl[0].vcn + rl[0].length;
+ rl[1].lcn = LCN_HOLE;
+ rl = ++(*prl);
+ }
+ }
+ } else {
+ if (rl[1].length) {
+ runlist_element *xrl;
+ int n;
+
+ /*
+ * split into two parts and use the
+ * last one
+ */
+ if (!na->unused_runs) {
+ntfs_log_error("No free run, case 4\n");
+ }
+ na->unused_runs--;
+ xrl = rl;
+ n = 0;
+ while (xrl->length) {
+ xrl++;
+ n++;
+ }
+ do {
+ xrl[1] = *xrl;
+ xrl--;
+ } while (xrl != rl);
+ } else {
+ rl[2].lcn = rl[1].lcn;
+ rl[2].vcn = rl[1].vcn;
+ rl[2].length = rl[1].length;
+ }
+ rl[1].vcn -= na->compression_block_clusters;
+ rl[1].lcn = LCN_HOLE;
+ rl[1].length = na->compression_block_clusters;
+ rl[0].length -= na->compression_block_clusters;
+ if (pos >= (rl[1].vcn << cluster_size_bits)) {
+ rl = ++(*prl);
+ }
+ }
+ if ((*update_from == -1) || ((*prl)->vcn < *update_from))
+ *update_from = (*prl)->vcn;
+ }
+ return (compressed_part);
+}
+
+/*
+ * Borrow space from adjacent hole for appending data
+ * The hole may have to be split so that the end of hole is not
+ * affected by cluster allocation and overwriting
+ * Cluster allocation is needed for the overwritten compression block
+ *
+ * Must always leave two unused entries in the runlist
+ *
+ * Returns the number of clusters with existing compressed data
+ * in the compression block to be written to
+ * -1 if there were an error
+ */
+
+static int borrow_from_hole(ntfs_attr *na, runlist_element **prl,
+ s64 pos, s64 count, VCN *update_from, BOOL wasnonresident)
+{
+ int compressed_part = 0;
+ int cluster_size_bits = na->ni->vol->cluster_size_bits;
+ runlist_element *rl = *prl;
+ s32 endblock;
+ long long allocated;
+ runlist_element *zrl;
+ int irl;
+ BOOL undecided;
+ BOOL nothole;
+
+ /* check whether the compression block is fully allocated */
+ endblock = (((pos + count - 1) >> cluster_size_bits) | (na->compression_block_clusters - 1)) + 1 - rl->vcn;
+ allocated = 0;
+ zrl = rl;
+ irl = 0;
+ while (zrl->length && (zrl->lcn >= 0) && (allocated < endblock)) {
+ allocated += zrl->length;
+ zrl++;
+ irl++;
+ }
+
+ undecided = (allocated < endblock) && (zrl->lcn == LCN_RL_NOT_MAPPED);
+ nothole = (allocated >= endblock) || (zrl->lcn != LCN_HOLE);
+
+ if (undecided || nothole) {
+ runlist_element *orl = na->rl;
+ s64 olcn = (*prl)->lcn;
+#if PARTIAL_RUNLIST_UPDATING
+ VCN prevblock;
+#endif
+ /*
+ * Map the runlist, unless it has not been created.
+ * If appending data, a partial mapping from the
+ * end of previous block will do.
+ */
+ irl = *prl - na->rl;
+#if PARTIAL_RUNLIST_UPDATING
+ prevblock = pos >> cluster_size_bits;
+ if (prevblock)
+ prevblock--;
+ if (!NAttrBeingNonResident(na)
+ && (NAttrDataAppending(na)
+ ? ntfs_attr_map_partial_runlist(na,prevblock)
+ : ntfs_attr_map_whole_runlist(na))) {
+#else
+ if (!NAttrBeingNonResident(na)
+ && ntfs_attr_map_whole_runlist(na)) {
+#endif
+ rl = (runlist_element*)NULL;
+ } else {
+ /*
+ * Mapping the runlist may cause its relocation,
+ * and relocation may be at the same place with
+ * relocated contents.
+ * Have to find the current run again when this
+ * happens.
+ */
+ if ((na->rl != orl) || ((*prl)->lcn != olcn)) {
+ zrl = &na->rl[irl];
+ while (zrl->length && (zrl->lcn != olcn))
+ zrl++;
+ *prl = zrl;
+ }
+ if (!(*prl)->length) {
+ ntfs_log_error("Mapped run not found,"
+ " inode %lld lcn 0x%llx\n",
+ (long long)na->ni->mft_no,
+ (long long)olcn);
+ rl = (runlist_element*)NULL;
+ } else {
+ rl = ntfs_rl_extend(na,*prl,2);
+ na->unused_runs = 2;
+ }
+ }
+ *prl = rl;
+ if (rl && undecided) {
+ allocated = 0;
+ zrl = rl;
+ irl = 0;
+ while (zrl->length && (zrl->lcn >= 0)
+ && (allocated < endblock)) {
+ allocated += zrl->length;
+ zrl++;
+ irl++;
+ }
+ }
+ }
+ /*
+ * compression block not fully allocated and followed
+ * by a hole : we must allocate in the hole.
+ */
+ if (rl && (allocated < endblock) && (zrl->lcn == LCN_HOLE)) {
+ s64 xofs;
+
+ /*
+ * split the hole if not fully needed
+ */
+ if ((allocated + zrl->length) > endblock) {
+ runlist_element *xrl;
+
+ *prl = ntfs_rl_extend(na,*prl,1);
+ if (*prl) {
+ /* beware : rl was reallocated */
+ rl = *prl;
+ zrl = &rl[irl];
+ na->unused_runs = 0;
+ xrl = zrl;
+ while (xrl->length) xrl++;
+ do {
+ xrl[1] = *xrl;
+ } while (xrl-- != zrl);
+ zrl->length = endblock - allocated;
+ zrl[1].length -= zrl->length;
+ zrl[1].vcn = zrl->vcn + zrl->length;
+ }
+ }
+ if (*prl) {
+ if (wasnonresident)
+ compressed_part = na->compression_block_clusters
+ - zrl->length;
+ xofs = 0;
+ if (ntfs_attr_fill_hole(na,
+ zrl->length << cluster_size_bits,
+ &xofs, &zrl, update_from))
+ compressed_part = -1;
+ else {
+ /* go back to initial cluster, now reallocated */
+ while (zrl->vcn > (pos >> cluster_size_bits))
+ zrl--;
+ *prl = zrl;
+ }
+ }
+ }
+ if (!*prl) {
+ ntfs_log_error("No elements to borrow from a hole\n");
+ compressed_part = -1;
+ } else
+ if ((*update_from == -1) || ((*prl)->vcn < *update_from))
+ *update_from = (*prl)->vcn;
+ return (compressed_part);
+}
+
+static int ntfs_attr_truncate_i(ntfs_attr *na, const s64 newsize,
+ hole_type holes);
+
/**
* ntfs_attr_pwrite - positioned write to an ntfs attribute
* @na: ntfs attribute to write to
@@ -1304,9 +1774,9 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
unsigned int undo_initialized_size : 1;
unsigned int undo_data_size : 1;
} need_to = { 0, 0 };
- BOOL makingnonresident = FALSE;
BOOL wasnonresident = FALSE;
BOOL compressed;
+ BOOL updatemap;
ntfs_log_enter("Entering for inode %lld, attr 0x%x, pos 0x%llx, count "
"0x%llx.\n", (long long)na->ni->mft_no, na->type,
@@ -1320,6 +1790,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
vol = na->ni->vol;
compressed = (na->data_flags & ATTR_COMPRESSION_MASK)
!= const_cpu_to_le16(0);
+ na->unused_runs = 0; /* prepare overflow checks */
/*
* Encrypted attributes are only supported in raw mode. We return
* access denied, which is what Windows NT4 does, too.
@@ -1341,23 +1812,14 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
goto errno_set;
/* If this is a compressed attribute it needs special treatment. */
wasnonresident = NAttrNonResident(na) != 0;
- makingnonresident = wasnonresident /* yes : already changed */
- && !pos && (count == na->initialized_size);
/*
- * Writing to compressed files is currently restricted
- * to appending data. However we have to accept
- * recursive write calls to make the attribute non resident.
- * These are writing at position 0 up to initialized_size.
- * Compression is also restricted to data streams.
- * Only ATTR_IS_COMPRESSED compression mode is supported.
+ * Compression is restricted to data streams and
+ * only ATTR_IS_COMPRESSED compression mode is supported.
*/
if (compressed
&& ((na->type != AT_DATA)
|| ((na->data_flags & ATTR_COMPRESSION_MASK)
- != ATTR_IS_COMPRESSED)
- || ((pos != na->initialized_size)
- && (pos || (count != na->initialized_size))))) {
- // TODO: Implement writing compressed attributes! (AIA)
+ != ATTR_IS_COMPRESSED))) {
errno = EOPNOTSUPP;
goto errno_set;
}
@@ -1368,11 +1830,39 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
fullcount = count;
/* If the write reaches beyond the end, extend the attribute. */
old_data_size = na->data_size;
+ /* identify whether this is appending to a non resident data attribute */
+ if ((na->type == AT_DATA) && (pos >= old_data_size)
+ && NAttrNonResident(na))
+ NAttrSetDataAppending(na);
if (pos + count > na->data_size) {
- if (ntfs_attr_truncate(na, pos + count)) {
+#if PARTIAL_RUNLIST_UPDATING
+ /*
+ * When appending data, the attribute is first extended
+ * before being filled with data. This may cause the
+ * attribute to be made temporarily sparse, which
+ * implies reformating the inode and reorganizing the
+ * full runlist. To avoid unnecessary reorganization,
+ * we avoid sparse testing until the data is filled in.
+ */
+ if (ntfs_attr_truncate_i(na, pos + count,
+ (NAttrDataAppending(na) ?
+ HOLES_DELAY : HOLES_OK))) {
+ ntfs_log_perror("Failed to enlarge attribute");
+ goto errno_set;
+ }
+ /*
+ * If we avoided updating the runlist, we must be sure
+ * to cancel the enlargement and put back the runlist to
+ * a clean state if we get into some error.
+ */
+ if (NAttrDataAppending(na))
+ need_to.undo_data_size = 1;
+#else
+ if (ntfs_attr_truncate_i(na, pos + count, HOLES_OK)) {
ntfs_log_perror("Failed to enlarge attribute");
goto errno_set;
}
+#endif
/* resizing may change the compression mode */
compressed = (na->data_flags & ATTR_COMPRESSION_MASK)
!= const_cpu_to_le16(0);
@@ -1387,7 +1877,7 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
* so truncate the requested count if needed (big buffers).
*/
if (compressed) {
- fullcount = na->data_size - pos;
+ fullcount = (pos | (na->compression_block_size - 1)) + 1 - pos;
if (count > fullcount)
count = fullcount;
}
@@ -1431,9 +1921,31 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
}
/* Handle writes beyond initialized_size. */
+
if (pos + count > na->initialized_size) {
- if (ntfs_attr_map_whole_runlist(na))
- goto err_out;
+#if PARTIAL_RUNLIST_UPDATING
+ /*
+ * When appending, we only need to map the end of the runlist,
+ * starting at the last previously allocated run, so that
+ * we are able a new one to it.
+ * However, for compressed file, we need the full compression
+ * block, which may be split in several extents.
+ */
+ if (NAttrDataAppending(na)) {
+ VCN block_begin = pos >> vol->cluster_size_bits;
+
+ if (compressed)
+ block_begin &= -na->compression_block_clusters;
+ if (block_begin)
+ block_begin--;
+ if (ntfs_attr_map_partial_runlist(na, block_begin))
+ goto err_out;
+ if ((update_from == -1) || (block_begin < update_from))
+ update_from = block_begin;
+ } else
+#endif
+ if (ntfs_attr_map_whole_runlist(na))
+ goto err_out;
/*
* For a compressed attribute, we must be sure there is an
* available entry, and, when reopening a compressed file,
@@ -1441,9 +1953,10 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
* before it gets too late.
*/
if (compressed) {
- na->rl = ntfs_rl_extend(na->rl,2);
+ na->rl = ntfs_rl_extend(na,na->rl,2);
if (!na->rl)
goto err_out;
+ na->unused_runs = 2;
}
/* Set initialized_size to @pos + @count. */
ctx = ntfs_attr_get_search_ctx(na->ni, NULL);
@@ -1461,8 +1974,10 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
ctx->attr->initialized_size = cpu_to_sle64(pos + count);
/* fix data_size for compressed files */
- if (compressed)
+ if (compressed) {
+ na->data_size = pos + count;
ctx->attr->data_size = ctx->attr->initialized_size;
+ }
if (ntfs_mft_record_write(vol, ctx->ntfs_ino->mft_no,
ctx->mrec)) {
/*
@@ -1481,7 +1996,11 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
? na->type == AT_INDEX_ROOT && na->name == NTFS_INDEX_I30
: na->type == AT_DATA && na->name == AT_UNNAMED) {
na->ni->data_size = na->data_size;
- na->ni->allocated_size = na->allocated_size;
+ if ((compressed || NAttrSparse(na))
+ && NAttrNonResident(na))
+ na->ni->allocated_size = na->compressed_size;
+ else
+ na->ni->allocated_size = na->allocated_size;
set_nino_flag(na->ni,KnownSize);
}
#endif
@@ -1509,7 +2028,6 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
}
goto err_out;
}
- ofs = pos - (rl->vcn << vol->cluster_size_bits);
/*
* Determine if there is compressed data in the current
* compression block (when appending to an existing file).
@@ -1530,49 +2048,51 @@ s64 ntfs_attr_pwrite(ntfs_attr *na, const s64 pos, s64 count, const void *b)
if ((rl->lcn == (LCN)LCN_HOLE)
&& wasnonresident) {
if (rl->length < na->compression_block_clusters)
+ /*
+ * the needed block is in a hole smaller
+ * than the compression block : we can use
+ * it fully
+ */
compressed_part
= na->compression_block_clusters
- rl->length;
else {
- compressed_part
- = na->compression_block_clusters;
- if (rl->length > na->compression_block_clusters) {
- rl[2].lcn = rl[1].lcn;
- rl[2].vcn = rl[1].vcn;
- rl[2].length = rl[1].length;
- rl[1].vcn -= compressed_part;
- rl[1].lcn = LCN_HOLE;
- rl[1].length = compressed_part;
- rl[0].length -= compressed_part;
- ofs -= rl->length << vol->cluster_size_bits;
- rl++;
- }
+ /*
+ * the needed block is in a hole bigger
+ * than the compression block : we must
+ * split the hole and use it partially
+ */
+ compressed_part = split_compressed_hole(na,
+ &rl, pos, count, &update_from);
}
- /* normal hole filling will do later */
- } else
- if ((rl->lcn >= 0) && (rl[1].lcn == (LCN)LCN_HOLE)) {
- s64 xofs;
-
- if (wasnonresident)
- compressed_part = na->compression_block_clusters
- - rl[1].length;
- rl++;
- xofs = 0;
- if (ntfs_attr_fill_hole(na,
- rl->length << vol->cluster_size_bits,
- &xofs, &rl, &update_from))
- goto err_out;
- /* the fist allocated cluster was not merged */
- if (!xofs)
- rl--;
+ } else {
+ if (rl->lcn >= 0) {
+ /*
+ * the needed block contains data, make
+ * sure the full compression block is
+ * allocated. Borrow from hole if needed
+ */
+ compressed_part = borrow_from_hole(na,
+ &rl, pos, count, &update_from,
+ wasnonresident);
}
+ }
+
+ if (compressed_part < 0)
+ goto err_out;
+
+ /* just making non-resident, so not yet compressed */
+ if (NAttrBeingNonResident(na)
+ && (compressed_part < na->compression_block_clusters))
+ compressed_part = 0;
}
+ ofs = pos - (rl->vcn << vol->cluster_size_bits);
/*
* 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.
*/
- for (hole_end = 0; count; rl++, ofs = 0, hole_end = 0) {
+ for (hole_end = 0; count; rl++, ofs = 0) {
if (rl->lcn == LCN_RL_NOT_MAPPED) {
rl = ntfs_attr_find_vcn(na, rl->vcn);
if (!rl) {
@@ -1653,7 +2173,8 @@ retry:
if (compressed) {
written = ntfs_compressed_pwrite(na,
rl, wpos, ofs, to_write,
- rounding, b, compressed_part);
+ rounding, cb, compressed_part,
+ &update_from);
} else {
written = ntfs_pwrite(vol->dev, wpos,
rounding, cb);
@@ -1666,7 +2187,8 @@ retry:
if (compressed) {
written = ntfs_compressed_pwrite(na,
rl, wpos, ofs, to_write,
- to_write, b, compressed_part);
+ to_write, b, compressed_part,
+ &update_from);
} else
written = ntfs_pwrite(vol->dev, wpos,
to_write, b);
@@ -1694,10 +2216,21 @@ retry:
done:
if (ctx)
ntfs_attr_put_search_ctx(ctx);
- /* Update mapping pairs if needed. */
- if ((update_from != -1)
- || (compressed && !makingnonresident))
- if (ntfs_attr_update_mapping_pairs(na, 0 /*update_from*/)) {
+ /*
+ * Update mapping pairs if needed.
+ * For a compressed file, we try to make a partial update
+ * of the mapping list. This makes a difference only if
+ * inode extents were needed.
+ */
+#if PARTIAL_RUNLIST_UPDATING
+ updatemap = NAttrFullyMapped(na) || NAttrDataAppending(na);
+#else
+ updatemap = (compressed
+ ? NAttrFullyMapped(na) != 0 : update_from != -1);
+#endif
+ if (updatemap) {
+ if (ntfs_attr_update_mapping_pairs(na,
+ (update_from < 0 ? 0 : update_from))) {
/*
* FIXME: trying to recover by goto rl_err_out;
* could cause driver hang by infinite looping.
@@ -1705,6 +2238,10 @@ done:
total = -1;
goto out;
}
+ if (!wasnonresident)
+ NAttrClearBeingNonResident(na);
+ NAttrClearDataAppending(na);
+ }
out:
ntfs_log_leave("\n");
return total;
@@ -1761,10 +2298,13 @@ err_out:
if (ctx)
ntfs_attr_put_search_ctx(ctx);
/* Update mapping pairs if needed. */
- if (update_from != -1)
- ntfs_attr_update_mapping_pairs(na, 0 /*update_from*/);
+ updatemap = (compressed
+ ? NAttrFullyMapped(na) != 0 : update_from != -1);
+ if (updatemap)
+ ntfs_attr_update_mapping_pairs(na, 0);
/* 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_i(na, old_data_size, HOLES_OK))
ntfs_log_perror("Failed to restore data_size");
errno = eo;
errno_set:
@@ -1782,7 +2322,6 @@ int ntfs_attr_pclose(ntfs_attr *na)
ntfs_attr_search_ctx *ctx = NULL;
runlist_element *rl;
int eo;
- s64 hole;
int compressed_part;
BOOL compressed;
@@ -1795,6 +2334,7 @@ int ntfs_attr_pclose(ntfs_attr *na)
goto errno_set;
}
vol = na->ni->vol;
+ na->unused_runs = 0;
compressed = (na->data_flags & ATTR_COMPRESSION_MASK)
!= const_cpu_to_le16(0);
/*
@@ -1810,15 +2350,25 @@ int ntfs_attr_pclose(ntfs_attr *na)
if (!compressed || !NAttrNonResident(na))
goto out;
+ /* safety check : no recursion on close */
+ if (NAttrComprClosing(na)) {
+ errno = EIO;
+ ntfs_log_error("Bad ntfs_attr_pclose"
+ " recursion on inode %lld\n",
+ (long long)na->ni->mft_no);
+ goto out;
+ }
+ NAttrSetComprClosing(na);
/*
- * For a compressed attribute, we must be sure there is an
- * available entry, so reserve it before it gets too late.
+ * For a compressed attribute, we must be sure there are two
+ * available entries, so reserve them before it gets too late.
*/
if (ntfs_attr_map_whole_runlist(na))
goto err_out;
- na->rl = ntfs_rl_extend(na->rl,1);
+ na->rl = ntfs_rl_extend(na,na->rl,2);
if (!na->rl)
goto err_out;
+ na->unused_runs = 2;
/* Find the runlist element containing the terminal vcn. */
rl = ntfs_attr_find_vcn(na, (na->initialized_size - 1) >> vol->cluster_size_bits);
if (!rl) {
@@ -1839,10 +2389,16 @@ int ntfs_attr_pclose(ntfs_attr *na)
* length.
*/
compressed_part = 0;
- if ((rl->lcn >= 0) && (rl[1].lcn == (LCN)LCN_HOLE))
- compressed_part
- = na->compression_block_clusters - rl[1].length;
- else
+ if (rl->lcn >= 0) {
+ runlist_element *xrl;
+
+ xrl = rl;
+ do {
+ xrl++;
+ } while (xrl->lcn >= 0);
+ compressed_part = (-xrl->length)
+ & (na->compression_block_clusters - 1);
+ } else
if (rl->lcn == (LCN)LCN_HOLE) {
if (rl->length < na->compression_block_clusters)
compressed_part
@@ -1877,7 +2433,6 @@ int ntfs_attr_pclose(ntfs_attr *na)
goto rl_err_out;
}
if (rl->lcn < (LCN)0) {
- hole = rl->vcn + rl->length;
if (rl->lcn != (LCN)LCN_HOLE) {
errno = EIO;
ntfs_log_perror("%s: Unexpected LCN (%lld)",
@@ -1897,14 +2452,15 @@ int ntfs_attr_pclose(ntfs_attr *na)
retry:
failed = 0;
+ if (update_from < 0) update_from = 0;
if (!NVolReadOnly(vol)) {
- failed = ntfs_compressed_close(na, rl, ofs);
+ failed = ntfs_compressed_close(na, rl, ofs, &update_from);
#if CACHE_NIDATA_SIZE
if (na->ni->mrec->flags & MFT_RECORD_IS_DIRECTORY
? na->type == AT_INDEX_ROOT && na->name == NTFS_INDEX_I30
: na->type == AT_DATA && na->name == AT_UNNAMED) {
na->ni->data_size = na->data_size;
- na->ni->allocated_size = na->allocated_size;
+ na->ni->allocated_size = na->compressed_size;
set_nino_flag(na->ni,KnownSize);
}
#endif
@@ -1919,7 +2475,8 @@ retry:
if (ctx)
ntfs_attr_put_search_ctx(ctx);
/* Update mapping pairs if needed. */
- if (ntfs_attr_update_mapping_pairs(na, 0 /*update_from*/)) {
+ if (NAttrFullyMapped(na))
+ if (ntfs_attr_update_mapping_pairs(na, update_from)) {
/*
* FIXME: trying to recover by goto rl_err_out;
* could cause driver hang by infinite looping.
@@ -1928,6 +2485,7 @@ retry:
goto out;
}
out:
+ NAttrClearComprClosing(na);
ntfs_log_leave("\n");
return (!ok);
rl_err_out:
@@ -1942,7 +2500,8 @@ err_out:
if (ctx)
ntfs_attr_put_search_ctx(ctx);
/* Update mapping pairs if needed. */
- ntfs_attr_update_mapping_pairs(na, 0 /*update_from*/);
+ if (NAttrFullyMapped(na))
+ ntfs_attr_update_mapping_pairs(na, 0);
errno = eo;
errno_set:
ok = FALSE;
@@ -1983,6 +2542,7 @@ s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, const s64 bk_cnt,
{
s64 br;
u8 *end;
+ BOOL warn;
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,
@@ -1996,9 +2556,11 @@ s64 ntfs_attr_mst_pread(ntfs_attr *na, const s64 pos, const s64 bk_cnt,
if (br <= 0)
return br;
br /= bk_size;
+ /* log errors unless silenced */
+ warn = !na->ni || !na->ni->vol || !NVolNoFixupWarn(na->ni->vol);
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);
+ ntfs_mst_post_read_fixup_warn((NTFS_RECORD*)dst, bk_size, warn);
/* Finally, return the number of blocks read. */
return br;
}
@@ -2996,6 +3558,14 @@ int ntfs_attr_size_bounds_check(const ntfs_volume *vol, const ATTR_TYPES type,
min_size = sle64_to_cpu(ad->min_size);
max_size = sle64_to_cpu(ad->max_size);
+
+ /* The $AttrDef generated by Windows specifies 2 as min_size for the
+ * volume name attribute, but in reality Windows sets it to 0 when
+ * clearing the volume name. If we want to be able to clear the volume
+ * name we must also accept 0 as min_size, despite the $AttrDef
+ * definition. */
+ if(type == AT_VOLUME_NAME)
+ min_size = 0;
if ((min_size && (size < min_size)) ||
((max_size > 0) && (size > max_size))) {
@@ -3170,8 +3740,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, u8 *val, u32 size,
- ATTR_FLAGS data_flags)
+ const ntfschar *name, u8 name_len, const u8 *val,
+ u32 size, ATTR_FLAGS data_flags)
{
ntfs_attr_search_ctx *ctx;
u32 length;
@@ -3302,7 +3872,7 @@ put_err_out:
* 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,
+ const ntfschar *name, u8 name_len, VCN lowest_vcn, int dataruns_size,
ATTR_FLAGS flags)
{
ntfs_attr_search_ctx *ctx;
@@ -3585,7 +4155,7 @@ int ntfs_attr_record_rm(ntfs_attr_search_ctx *ctx)
* On success return 0. On error return -1 with errno set to the error code.
*/
int ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type,
- ntfschar *name, u8 name_len, u8 *val, s64 size)
+ ntfschar *name, u8 name_len, const u8 *val, s64 size)
{
u32 attr_rec_size;
int err, i, offset;
@@ -3704,6 +4274,8 @@ int ntfs_attr_add(ntfs_inode *ni, ATTR_TYPES type,
add_attr_record:
if ((ni->flags & FILE_ATTR_COMPRESSED)
+ && (ni->vol->major_ver >= 3)
+ && NVolCompression(ni->vol)
&& (ni->vol->cluster_size <= MAX_COMPRESSION_CLUSTER_SIZE)
&& ((type == AT_DATA)
|| ((type == AT_INDEX_ROOT) && (name == NTFS_INDEX_I30))))
@@ -3746,7 +4318,7 @@ add_non_resident:
goto rm_attr_err_out;
}
/* Resize and set attribute value. */
- if (ntfs_attr_truncate(na, size) ||
+ if (ntfs_attr_truncate_i(na, size, HOLES_OK) ||
(val && (ntfs_attr_pwrite(na, 0, size, val) != size))) {
err = errno;
ntfs_log_perror("Failed to initialize just added attribute");
@@ -3778,8 +4350,8 @@ err_out:
* Change an attribute flag
*/
-int ntfs_attr_set_flags(ntfs_inode *ni, ATTR_TYPES type,
- ntfschar *name, u8 name_len, ATTR_FLAGS flags, ATTR_FLAGS mask)
+int ntfs_attr_set_flags(ntfs_inode *ni, ATTR_TYPES type, const ntfschar *name,
+ u8 name_len, ATTR_FLAGS flags, ATTR_FLAGS mask)
{
ntfs_attr_search_ctx *ctx;
int res;
@@ -4189,6 +4761,13 @@ int ntfs_attr_make_non_resident(ntfs_attr *na,
- 1) & ~(vol->cluster_size - 1);
if (new_allocated_size > 0) {
+ if ((a->flags & ATTR_COMPRESSION_MASK)
+ == ATTR_IS_COMPRESSED) {
+ /* must allocate full compression blocks */
+ new_allocated_size = ((new_allocated_size - 1)
+ | ((1L << (STANDARD_COMPRESSION_UNIT
+ + vol->cluster_size_bits)) - 1)) + 1;
+ }
/* Start by allocating clusters to hold the attribute value. */
rl = ntfs_cluster_alloc(vol, 0, new_allocated_size >>
vol->cluster_size_bits, -1, DATA_ZONE);
@@ -4201,6 +4780,7 @@ int ntfs_attr_make_non_resident(ntfs_attr *na,
* we can use ntfs_attr_pwrite().
*/
NAttrSetNonResident(na);
+ NAttrSetBeingNonResident(na);
na->rl = rl;
na->allocated_size = new_allocated_size;
na->data_size = na->initialized_size = le32_to_cpu(a->value_length);
@@ -4319,6 +4899,7 @@ cluster_free_err_out:
ntfs_log_trace("Eeek! Failed to release allocated clusters in error "
"code path. Leaving inconsistent metadata...\n");
NAttrClearNonResident(na);
+ NAttrClearFullyMapped(na);
na->allocated_size = na->data_size;
na->rl = NULL;
free(rl);
@@ -4335,6 +4916,8 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize);
* @newsize: new size (in bytes) to which to resize the attribute
*
* Change the size of a resident, open ntfs attribute @na to @newsize bytes.
+ * Can also be used to force an attribute non-resident. In this case, the
+ * size cannot be changed.
*
* On success return 0
* On error return values are:
@@ -4345,7 +4928,8 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize);
* 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_i(ntfs_attr *na, const s64 newsize)
+static int ntfs_resident_attr_resize_i(ntfs_attr *na, const s64 newsize,
+ hole_type holes)
{
ntfs_attr_search_ctx *ctx;
ntfs_volume *vol;
@@ -4383,7 +4967,7 @@ static int ntfs_resident_attr_resize_i(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 < vol->mft_record_size) {
+ if ((newsize < vol->mft_record_size) && (holes != HOLES_NONRES)) {
/* Perform the resize of the attribute record. */
if (!(ret = ntfs_resident_attr_value_resize(ctx->mrec, ctx->attr,
newsize))) {
@@ -4397,7 +4981,14 @@ static int ntfs_resident_attr_resize_i(ntfs_attr *na, const s64 newsize)
? na->type == AT_INDEX_ROOT && na->name == NTFS_INDEX_I30
: na->type == AT_DATA && na->name == AT_UNNAMED) {
na->ni->data_size = na->data_size;
- na->ni->allocated_size = na->allocated_size;
+ if (((na->data_flags & ATTR_COMPRESSION_MASK)
+ || NAttrSparse(na))
+ && NAttrNonResident(na))
+ na->ni->allocated_size
+ = na->compressed_size;
+ else
+ na->ni->allocated_size
+ = na->allocated_size;
set_nino_flag(na->ni,KnownSize);
if (na->type == AT_DATA)
NInoFileNameSetDirty(na->ni);
@@ -4416,8 +5007,23 @@ static int ntfs_resident_attr_resize_i(ntfs_attr *na, const s64 newsize)
if (!ntfs_attr_make_non_resident(na, ctx)) {
ntfs_inode_mark_dirty(ctx->ntfs_ino);
ntfs_attr_put_search_ctx(ctx);
+ /*
+ * do not truncate when forcing non-resident, this
+ * could cause the attribute to be made resident again,
+ * so size changes are not allowed.
+ */
+ if (holes == HOLES_NONRES) {
+ ret = 0;
+ if (newsize != na->data_size) {
+ ntfs_log_error("Cannot change size when"
+ " forcing non-resident\n");
+ errno = EIO;
+ ret = STATUS_ERROR;
+ }
+ return (ret);
+ }
/* Resize non-resident attribute */
- return ntfs_attr_truncate(na, newsize);
+ return ntfs_attr_truncate_i(na, newsize, holes);
} else if (errno != ENOSPC && errno != EPERM) {
err = errno;
ntfs_log_perror("Failed to make attribute non-resident");
@@ -4454,10 +5060,26 @@ static int ntfs_resident_attr_resize_i(ntfs_attr *na, const s64 newsize)
ntfs_attr_close(tna);
continue;
}
+ if ((tna->type == AT_DATA) && !tna->name_len) {
+ /*
+ * If we had to make the unnamed data attribute
+ * non-resident, propagate its new allocated size
+ * to all name attributes and directory indexes
+ */
+ tna->ni->allocated_size = tna->allocated_size;
+ NInoFileNameSetDirty(tna->ni);
+ }
+ if (((tna->data_flags & ATTR_COMPRESSION_MASK)
+ == ATTR_IS_COMPRESSED)
+ && ntfs_attr_pclose(tna)) {
+ err = errno;
+ ntfs_attr_close(tna);
+ goto put_err_out;
+ }
ntfs_inode_mark_dirty(tna->ni);
ntfs_attr_close(tna);
ntfs_attr_put_search_ctx(ctx);
- return ntfs_resident_attr_resize(na, newsize);
+ return ntfs_resident_attr_resize_i(na, newsize, holes);
}
/* Check whether error occurred. */
if (errno != ENOENT) {
@@ -4477,7 +5099,7 @@ static int ntfs_resident_attr_resize_i(ntfs_attr *na, const s64 newsize)
ntfs_log_perror("Could not free space in MFT record");
return -1;
}
- return ntfs_resident_attr_resize(na, newsize);
+ return ntfs_resident_attr_resize_i(na, newsize, holes);
}
/*
@@ -4516,7 +5138,7 @@ static int ntfs_resident_attr_resize_i(ntfs_attr *na, const s64 newsize)
ntfs_attr_put_search_ctx(ctx);
if (ntfs_inode_add_attrlist(ni))
return -1;
- return ntfs_resident_attr_resize(na, newsize);
+ return ntfs_resident_attr_resize_i(na, newsize, holes);
}
/* Allocate new mft record. */
ni = ntfs_mft_record_alloc(vol, ni);
@@ -4537,7 +5159,7 @@ static int ntfs_resident_attr_resize_i(ntfs_attr *na, const s64 newsize)
ntfs_attr_put_search_ctx(ctx);
/* Try to perform resize once again. */
- return ntfs_resident_attr_resize(na, newsize);
+ return ntfs_resident_attr_resize_i(na, newsize, holes);
resize_done:
/*
@@ -4558,11 +5180,39 @@ static int ntfs_resident_attr_resize(ntfs_attr *na, const s64 newsize)
int ret;
ntfs_log_enter("Entering\n");
- ret = ntfs_resident_attr_resize_i(na, newsize);
+ ret = ntfs_resident_attr_resize_i(na, newsize, HOLES_OK);
ntfs_log_leave("\n");
return ret;
}
+/*
+ * Force an attribute to be made non-resident without
+ * changing its size.
+ *
+ * This is particularly needed when the attribute has no data,
+ * as the non-resident variant requires more space in the MFT
+ * record, and may imply expelling some other attribute.
+ *
+ * As a consequence the existing ntfs_attr_search_ctx's have to
+ * be closed or reinitialized.
+ *
+ * returns 0 if successful,
+ * < 0 if failed, with errno telling why
+ */
+
+int ntfs_attr_force_non_resident(ntfs_attr *na)
+{
+ int res;
+
+ res = ntfs_resident_attr_resize_i(na, na->data_size, HOLES_NONRES);
+ if (!res && !NAttrNonResident(na)) {
+ res = -1;
+ errno = EIO;
+ ntfs_log_error("Failed to force non-resident\n");
+ }
+ return (res);
+}
+
/**
* ntfs_attr_make_resident - convert a non-resident to a resident attribute
* @na: open ntfs attribute to make resident
@@ -4673,6 +5323,8 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx)
*/
if (!na->data_size
&& (na->type == AT_DATA)
+ && (na->ni->vol->major_ver >= 3)
+ && NVolCompression(na->ni->vol)
&& (na->ni->vol->cluster_size <= MAX_COMPRESSION_CLUSTER_SIZE)
&& (na->ni->flags & FILE_ATTR_COMPRESSED)) {
a->flags |= ATTR_IS_COMPRESSED;
@@ -4719,7 +5371,6 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx)
* record is in a transiently corrupted state at this moment in time.
*/
if (ntfs_cluster_free(vol, na, 0, -1) < 0) {
- err = errno;
ntfs_log_perror("Eeek! Failed to release allocated clusters");
ntfs_log_trace("Ignoring error and leaving behind wasted "
"clusters.\n");
@@ -4731,6 +5382,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx)
/* Update in-memory struct ntfs_attr. */
NAttrClearNonResident(na);
+ NAttrClearFullyMapped(na);
NAttrClearSparse(na);
NAttrClearEncrypted(na);
na->initialized_size = na->data_size;
@@ -4745,7 +5397,7 @@ static int ntfs_attr_make_resident(ntfs_attr *na, ntfs_attr_search_ctx *ctx)
* update allocated and compressed size.
*/
static int ntfs_attr_update_meta(ATTR_RECORD *a, ntfs_attr *na, MFT_RECORD *m,
- ntfs_attr_search_ctx *ctx)
+ hole_type holes, ntfs_attr_search_ctx *ctx)
{
int sparse, ret = 0;
@@ -4757,15 +5409,21 @@ static int ntfs_attr_update_meta(ATTR_RECORD *a, ntfs_attr *na, MFT_RECORD *m,
a->allocated_size = cpu_to_sle64(na->allocated_size);
- /* Update sparse bit. */
- sparse = ntfs_rl_sparse(na->rl);
- if (sparse == -1) {
- errno = EIO;
- goto error;
+ /* Update sparse bit, unless this is an intermediate state */
+ if (holes == HOLES_DELAY)
+ sparse = (a->flags & ATTR_IS_SPARSE) != const_cpu_to_le16(0);
+ else {
+ sparse = ntfs_rl_sparse(na->rl);
+ if (sparse == -1) {
+ errno = EIO;
+ goto error;
+ }
}
- /* Attribute become sparse. */
- if (sparse && !(a->flags & (ATTR_IS_SPARSE | ATTR_IS_COMPRESSED))) {
+ /* Check whether attribute becomes sparse, unless check is delayed. */
+ if ((holes != HOLES_DELAY)
+ && sparse
+ && !(a->flags & (ATTR_IS_SPARSE | ATTR_IS_COMPRESSED))) {
/*
* Move attribute to another mft record, if attribute is too
* small to add compressed_size field to it and we have no
@@ -4798,6 +5456,7 @@ static int ntfs_attr_update_meta(ATTR_RECORD *a, ntfs_attr *na, MFT_RECORD *m,
NAttrSetSparse(na);
a->flags |= ATTR_IS_SPARSE;
+ na->data_flags = a->flags;
a->compression_unit = STANDARD_COMPRESSION_UNIT; /* Windows
set it so, even if attribute is not actually compressed. */
@@ -4817,6 +5476,7 @@ static int ntfs_attr_update_meta(ATTR_RECORD *a, ntfs_attr *na, MFT_RECORD *m,
NAttrClearSparse(na);
a->flags &= ~ATTR_IS_SPARSE;
+ na->data_flags = a->flags;
a->compression_unit = 0;
memmove((u8*)a + le16_to_cpu(a->name_offset) - 8,
@@ -4831,7 +5491,8 @@ static int ntfs_attr_update_meta(ATTR_RECORD *a, ntfs_attr *na, MFT_RECORD *m,
}
/* Update compressed size if required. */
- if (sparse || (na->data_flags & ATTR_COMPRESSION_MASK)) {
+ if (NAttrFullyMapped(na)
+ && (sparse || (na->data_flags & ATTR_COMPRESSION_MASK))) {
s64 new_compr_size;
new_compr_size = ntfs_rl_get_compressed_size(na->ni->vol, na->rl);
@@ -4846,7 +5507,7 @@ static int ntfs_attr_update_meta(ATTR_RECORD *a, ntfs_attr *na, MFT_RECORD *m,
* allocated size in the index.
*/
if (na->type == AT_DATA && na->name == AT_UNNAMED) {
- if (sparse)
+ if (sparse || (na->data_flags & ATTR_COMPRESSION_MASK))
na->ni->allocated_size = na->compressed_size;
else
na->ni->allocated_size = na->allocated_size;
@@ -4863,7 +5524,8 @@ error: ret = -3; goto out;
/**
* ntfs_attr_update_mapping_pairs_i - see ntfs_attr_update_mapping_pairs
*/
-static int ntfs_attr_update_mapping_pairs_i(ntfs_attr *na, VCN from_vcn)
+static int ntfs_attr_update_mapping_pairs_i(ntfs_attr *na, VCN from_vcn,
+ hole_type holes)
{
ntfs_attr_search_ctx *ctx;
ntfs_inode *ni, *base_ni;
@@ -4873,9 +5535,10 @@ static int ntfs_attr_update_mapping_pairs_i(ntfs_attr *na, VCN from_vcn)
const runlist_element *stop_rl;
int err, mp_size, cur_max_mp_size, exp_max_mp_size, ret = -1;
BOOL finished_build;
+ BOOL first_updated = FALSE;
retry:
- if (!na || !na->rl || from_vcn) {
+ if (!na || !na->rl) {
errno = EINVAL;
ntfs_log_perror("%s: na=%p", __FUNCTION__, na);
return -1;
@@ -4890,6 +5553,67 @@ retry:
return -1;
}
+#if PARTIAL_RUNLIST_UPDATING
+ /*
+ * For a file just been made sparse, we will have
+ * to reformat the first extent, so be sure the
+ * runlist is fully mapped and fully processed.
+ * Same if the file was sparse and is not any more.
+ * Note : not needed if the full runlist is to be processed
+ */
+ if ((holes != HOLES_DELAY)
+ && (!NAttrFullyMapped(na) || from_vcn)
+ && !(na->data_flags & ATTR_IS_COMPRESSED)) {
+ BOOL changed;
+
+ if (!(na->data_flags & ATTR_IS_SPARSE)) {
+ int sparse = 0;
+ runlist_element *xrl;
+
+ /*
+ * If attribute was not sparse, we only
+ * have to check whether there is a hole
+ * in the updated region.
+ */
+ for (xrl = na->rl; xrl->length; xrl++) {
+ if (xrl->lcn < 0) {
+ if (xrl->lcn == LCN_HOLE) {
+ sparse = 1;
+ break;
+ }
+ if (xrl->lcn != LCN_RL_NOT_MAPPED) {
+ sparse = -1;
+ break;
+ }
+ }
+ }
+ if (sparse < 0) {
+ ntfs_log_error("Could not check whether sparse\n");
+ errno = EIO;
+ return (-1);
+ }
+ changed = sparse > 0;
+ } else {
+ /*
+ * If attribute was sparse, the compressed
+ * size has been maintained, and it gives
+ * and easy way to check whether the
+ * attribute is still sparse.
+ */
+ changed = (((na->data_size - 1)
+ | (na->ni->vol->cluster_size - 1)) + 1)
+ == na->compressed_size;
+ }
+ if (changed) {
+ if (ntfs_attr_map_whole_runlist(na)) {
+ ntfs_log_error("Could not map whole for sparse change\n");
+ errno = EIO;
+ return (-1);
+ }
+ from_vcn = 0;
+ }
+ }
+#endif
if (na->ni->nr_extents == -1)
base_ni = na->ni->base_ni;
else
@@ -4907,6 +5631,8 @@ retry:
CASE_SENSITIVE, from_vcn, NULL, 0, ctx)) {
a = ctx->attr;
m = ctx->mrec;
+ if (!a->lowest_vcn)
+ first_updated = TRUE;
/*
* If runlist is updating not from the beginning, then set
* @stop_vcn properly, i.e. to the lowest vcn of record that
@@ -4949,7 +5675,7 @@ retry:
continue;
}
- switch (ntfs_attr_update_meta(a, na, m, ctx)) {
+ switch (ntfs_attr_update_meta(a, na, m, holes, ctx)) {
case -1: return -1;
case -2: goto retry;
case -3: goto put_err_out;
@@ -5056,6 +5782,34 @@ retry:
ntfs_log_perror("%s: Attribute lookup failed", __FUNCTION__);
goto put_err_out;
}
+ /*
+ * If the base extent was skipped in the above process,
+ * we still may have to update the sizes.
+ */
+ if (!first_updated) {
+ le16 spcomp;
+
+ ntfs_attr_reinit_search_ctx(ctx);
+ if (!ntfs_attr_lookup(na->type, na->name, na->name_len,
+ CASE_SENSITIVE, 0, NULL, 0, ctx)) {
+ a = ctx->attr;
+ a->allocated_size = cpu_to_sle64(na->allocated_size);
+ spcomp = na->data_flags
+ & (ATTR_IS_COMPRESSED | ATTR_IS_SPARSE);
+ if (spcomp)
+ a->compressed_size = cpu_to_sle64(na->compressed_size);
+ if ((na->type == AT_DATA) && (na->name == AT_UNNAMED)) {
+ na->ni->allocated_size
+ = (spcomp
+ ? na->compressed_size
+ : na->allocated_size);
+ NInoFileNameSetDirty(na->ni);
+ }
+ } else {
+ ntfs_log_error("Failed to update sizes in base extent\n");
+ goto put_err_out;
+ }
+ }
/* Deallocate not used attribute extents and return with success. */
if (finished_build) {
@@ -5189,7 +5943,7 @@ int ntfs_attr_update_mapping_pairs(ntfs_attr *na, VCN from_vcn)
int ret;
ntfs_log_enter("Entering\n");
- ret = ntfs_attr_update_mapping_pairs_i(na, from_vcn);
+ ret = ntfs_attr_update_mapping_pairs_i(na, from_vcn, HOLES_OK);
ntfs_log_leave("\n");
return ret;
}
@@ -5233,8 +5987,19 @@ 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;
+ if (na->data_flags & ATTR_COMPRESSION_MASK)
+ /*
+ * For compressed files we must keep full compressions blocks,
+ * but currently we do not decompress/recompress the last
+ * block to truncate the data, so we may leave more allocated
+ * clusters than really needed.
+ */
+ first_free_vcn = (((newsize - 1)
+ | (na->compression_block_size - 1)) + 1)
+ >> vol->cluster_size_bits;
+ else
+ 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.
@@ -5348,7 +6113,8 @@ put_err_out:
* 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_i(ntfs_attr *na, const s64 newsize)
+static int ntfs_non_resident_attr_expand_i(ntfs_attr *na, const s64 newsize,
+ hole_type holes)
{
LCN lcn_seek_from;
VCN first_free_vcn;
@@ -5375,6 +6141,8 @@ static int ntfs_non_resident_attr_expand_i(ntfs_attr *na, const s64 newsize)
return -1;
}
+ if (na->type == AT_DATA)
+ NAttrSetDataAppending(na);
/* Save for future use. */
org_alloc_size = na->allocated_size;
/* The first cluster outside the new allocation. */
@@ -5385,16 +6153,33 @@ static int ntfs_non_resident_attr_expand_i(ntfs_attr *na, const s64 newsize)
* clusters if there is a change.
*/
if ((na->allocated_size >> vol->cluster_size_bits) < first_free_vcn) {
+#if PARTIAL_RUNLIST_UPDATING
+ s64 start_update;
+
+ /*
+ * Update from the last previously allocated run,
+ * as we may have to expand an existing hole.
+ */
+ start_update = na->allocated_size >> vol->cluster_size_bits;
+ if (start_update)
+ start_update--;
+ if (ntfs_attr_map_partial_runlist(na, start_update)) {
+ ntfs_log_perror("failed to map partial runlist");
+ return -1;
+ }
+#else
if (ntfs_attr_map_whole_runlist(na)) {
ntfs_log_perror("ntfs_attr_map_whole_runlist failed");
return -1;
}
+#endif
/*
* If we extend $DATA attribute on NTFS 3+ volume, we can add
* sparse runs instead of real allocation of clusters.
*/
- if (na->type == AT_DATA && vol->major_ver >= 3) {
+ if ((na->type == AT_DATA) && (vol->major_ver >= 3)
+ && (holes != HOLES_NO)) {
rl = ntfs_malloc(0x1000);
if (!rl)
return -1;
@@ -5463,9 +6248,20 @@ static int ntfs_non_resident_attr_expand_i(ntfs_attr *na, const s64 newsize)
/* Prepare to mapping pairs update. */
na->allocated_size = first_free_vcn << vol->cluster_size_bits;
+#if PARTIAL_RUNLIST_UPDATING
+ /*
+ * Write mapping pairs for new runlist, unless this is
+ * a temporary state before appending data.
+ * If the update is not done, we must be sure to do
+ * it later, and to get to a clean state even on errors.
+ */
+ if ((holes != HOLES_DELAY)
+ && ntfs_attr_update_mapping_pairs_i(na, start_update,
+ holes)) {
+#else
/* Write mapping pairs for new runlist. */
- if (ntfs_attr_update_mapping_pairs(na, 0 /*na->allocated_size >>
- vol->cluster_size_bits*/)) {
+ if (ntfs_attr_update_mapping_pairs(na, 0)) {
+#endif
err = errno;
ntfs_log_perror("Mapping pairs update failed");
goto rollback;
@@ -5551,12 +6347,13 @@ put_err_out:
}
-static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize)
+static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize,
+ hole_type holes)
{
int ret;
ntfs_log_enter("Entering\n");
- ret = ntfs_non_resident_attr_expand_i(na, newsize);
+ ret = ntfs_non_resident_attr_expand_i(na, newsize, holes);
ntfs_log_leave("\n");
return ret;
}
@@ -5565,6 +6362,7 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize)
* ntfs_attr_truncate - resize an ntfs attribute
* @na: open ntfs attribute to resize
* @newsize: new size (in bytes) to which to resize the attribute
+ * @holes: how to create a hole if expanding
*
* 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
@@ -5581,7 +6379,8 @@ static int ntfs_non_resident_attr_expand(ntfs_attr *na, const s64 newsize)
* EOPNOTSUPP - The desired resize is not implemented yet.
* EACCES - Encrypted attribute.
*/
-int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize)
+static int ntfs_attr_truncate_i(ntfs_attr *na, const s64 newsize,
+ hole_type holes)
{
int ret = STATUS_ERROR;
s64 fullsize;
@@ -5623,8 +6422,7 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize)
!= const_cpu_to_le16(0);
if (compressed
&& NAttrNonResident(na)
- && (((na->data_flags & ATTR_COMPRESSION_MASK) != ATTR_IS_COMPRESSED)
- || (newsize && (newsize < na->data_size)))) {
+ && ((na->data_flags & ATTR_COMPRESSION_MASK) != ATTR_IS_COMPRESSED)) {
errno = EOPNOTSUPP;
ntfs_log_perror("Failed to truncate compressed attribute");
goto out;
@@ -5632,31 +6430,55 @@ int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize)
if (NAttrNonResident(na)) {
/*
* For compressed data, the last block must be fully
- * allocated, and we do not known the size of compression
+ * allocated, and we do not know the size of compression
* block until the attribute has been made non-resident.
* Moreover we can only process a single compression
* block at a time (from where we are about to write),
* so we silently do not allocate more.
*
- * Note : do not request truncate on compressed files
+ * Note : do not request upsizing of compressed files
* unless being able to face the consequences !
*/
- if (compressed && newsize)
+ if (compressed && newsize && (newsize > na->data_size))
fullsize = (na->initialized_size
| (na->compression_block_size - 1)) + 1;
else
fullsize = newsize;
if (fullsize > na->data_size)
- ret = ntfs_non_resident_attr_expand(na, fullsize);
+ ret = ntfs_non_resident_attr_expand(na, fullsize,
+ holes);
else
ret = ntfs_non_resident_attr_shrink(na, fullsize);
} else
- ret = ntfs_resident_attr_resize(na, newsize);
+ ret = ntfs_resident_attr_resize_i(na, newsize, holes);
out:
ntfs_log_leave("Return status %d\n", ret);
return ret;
}
-
+
+/*
+ * Resize an attribute, creating a hole if relevant
+ */
+
+int ntfs_attr_truncate(ntfs_attr *na, const s64 newsize)
+{
+ int r;
+
+ r = ntfs_attr_truncate_i(na, newsize, HOLES_OK);
+ NAttrClearDataAppending(na);
+ NAttrClearBeingNonResident(na);
+ return (r);
+}
+
+/*
+ * Resize an attribute, avoiding hole creation
+ */
+
+int ntfs_attr_truncate_solid(ntfs_attr *na, const s64 newsize)
+{
+ return (ntfs_attr_truncate_i(na, newsize, HOLES_NO));
+}
+
/*
* Stuff a hole in a compressed file
*
@@ -5717,7 +6539,7 @@ static int stuff_hole(ntfs_attr *na, const s64 pos)
if (!ret
&& ((na->initialized_size + end_size) < pos)
&& ntfs_non_resident_attr_expand(na,
- pos - end_size))
+ pos - end_size, HOLES_OK))
ret = -1;
else
na->initialized_size
@@ -5774,7 +6596,8 @@ void *ntfs_attr_readall(ntfs_inode *ni, const ATTR_TYPES type,
na = ntfs_attr_open(ni, type, name, name_len);
if (!na) {
- ntfs_log_perror("ntfs_attr_open failed");
+ ntfs_log_perror("ntfs_attr_open failed, inode %lld attr 0x%lx",
+ (long long)ni->mft_no,(long)le32_to_cpu(type));
goto err_exit;
}
data = ntfs_malloc(na->data_size);
@@ -5797,9 +6620,91 @@ err_exit:
return ret;
}
+/*
+ * Read some data from a data attribute
+ *
+ * Returns the amount of data read, negative if there was an error
+ */
+
+int ntfs_attr_data_read(ntfs_inode *ni,
+ ntfschar *stream_name, int stream_name_len,
+ char *buf, size_t size, off_t offset)
+{
+ ntfs_attr *na = NULL;
+ int res, total = 0;
+
+ na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len);
+ if (!na) {
+ res = -errno;
+ goto exit;
+ }
+ if ((size_t)offset < (size_t)na->data_size) {
+ if (offset + size > (size_t)na->data_size)
+ size = na->data_size - offset;
+ while (size) {
+ res = ntfs_attr_pread(na, offset, size, buf + total);
+ if ((off_t)res < (off_t)size)
+ ntfs_log_perror("ntfs_attr_pread partial read "
+ "(%lld : %lld <> %d)",
+ (long long)offset,
+ (long long)size, res);
+ if (res <= 0) {
+ res = -errno;
+ goto exit;
+ }
+ size -= res;
+ offset += res;
+ total += res;
+ }
+ }
+ res = total;
+exit:
+ if (na)
+ ntfs_attr_close(na);
+ return res;
+}
+
+
+/*
+ * Write some data into a data attribute
+ *
+ * Returns the amount of data written, negative if there was an error
+ */
+
+int ntfs_attr_data_write(ntfs_inode *ni, ntfschar *stream_name,
+ int stream_name_len, const char *buf, size_t size, off_t offset)
+{
+ ntfs_attr *na = NULL;
+ int res, total = 0;
+
+ na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len);
+ if (!na) {
+ res = -errno;
+ goto exit;
+ }
+ while (size) {
+ res = ntfs_attr_pwrite(na, offset, size, buf + total);
+ if (res < (s64)size)
+ ntfs_log_perror("ntfs_attr_pwrite partial write (%lld: "
+ "%lld <> %d)", (long long)offset,
+ (long long)size, res);
+ if (res <= 0) {
+ res = -errno;
+ goto exit;
+ }
+ size -= res;
+ offset += res;
+ total += res;
+ }
+ res = total;
+exit:
+ if (na)
+ ntfs_attr_close(na);
+ return res;
+}
-int ntfs_attr_exist(ntfs_inode *ni, const ATTR_TYPES type, ntfschar *name,
+int ntfs_attr_exist(ntfs_inode *ni, const ATTR_TYPES type, const ntfschar *name,
u32 name_len)
{
ntfs_attr_search_ctx *ctx;
diff --git a/libntfs-3g/bootsect.c b/libntfs-3g/bootsect.c
index e9bea37..e9be072 100755
--- a/libntfs-3g/bootsect.c
+++ b/libntfs-3g/bootsect.c
@@ -215,8 +215,8 @@ int ntfs_boot_sector_parse(ntfs_volume *vol, const NTFS_BOOT_SECTOR *bs)
vol->mftmirr_lcn = sle64_to_cpu(bs->mftmirr_lcn);
ntfs_log_debug("MFT LCN = %lld\n", (long long)vol->mft_lcn);
ntfs_log_debug("MFTMirr LCN = %lld\n", (long long)vol->mftmirr_lcn);
- if (vol->mft_lcn > vol->nr_clusters ||
- vol->mftmirr_lcn > vol->nr_clusters) {
+ if ((vol->mft_lcn < 0 || vol->mft_lcn > vol->nr_clusters) ||
+ (vol->mftmirr_lcn < 0 || vol->mftmirr_lcn > vol->nr_clusters)) {
ntfs_log_error("$MFT LCN (%lld) or $MFTMirr LCN (%lld) is "
"greater than the number of clusters (%lld).\n",
(long long)vol->mft_lcn, (long long)vol->mftmirr_lcn,
diff --git a/libntfs-3g/cache.c b/libntfs-3g/cache.c
index dd14767..2ad8d35 100755
--- a/libntfs-3g/cache.c
+++ b/libntfs-3g/cache.c
@@ -1,7 +1,7 @@
/**
* cache.c : deal with LRU caches
*
- * Copyright (c) 2008-2009 Jean-Pierre Andre
+ * Copyright (c) 2008-2010 Jean-Pierre Andre
*
* This program/include file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
@@ -298,7 +298,7 @@ struct CACHED_GENERIC *ntfs_enter_cache(struct CACHE_HEADER *cache,
if (cache->most_recent_entry)
cache->most_recent_entry->previous = current;
cache->most_recent_entry = current;
- memcpy(current->fixed, item->fixed, cache->fixed_size);
+ memcpy(current->payload, item->payload, cache->fixed_size);
if (item->varsize) {
if (current->variable) {
memcpy(current->variable,
@@ -376,7 +376,6 @@ int ntfs_invalidate_cache(struct CACHE_HEADER *cache,
int flags)
{
struct CACHED_GENERIC *current;
- struct CACHED_GENERIC *previous;
struct CACHED_GENERIC *next;
struct HASH_ENTRY *link;
int count;
@@ -412,7 +411,6 @@ int ntfs_invalidate_cache(struct CACHE_HEADER *cache,
* Search sequentially in LRU list
*/
current = cache->most_recent_entry;
- previous = (struct CACHED_GENERIC*)NULL;
while (current) {
if (!compare(current, item)) {
next = current->next;
@@ -423,7 +421,6 @@ int ntfs_invalidate_cache(struct CACHE_HEADER *cache,
current = next;
count++;
} else {
- previous = current;
current = current->next;
}
}
diff --git a/libntfs-3g/compress.c b/libntfs-3g/compress.c
index 14471b8..69b39ed 100755
--- a/libntfs-3g/compress.c
+++ b/libntfs-3g/compress.c
@@ -5,7 +5,7 @@
* Copyright (c) 2004-2005 Anton Altaparmakov
* Copyright (c) 2004-2006 Szabolcs Szakacsits
* Copyright (c) 2005 Yura Pakhuchiy
- * Copyright (c) 2009 Jean-Pierre Andre
+ * Copyright (c) 2009-2013 Jean-Pierre Andre
*
* This program/include file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
@@ -62,6 +62,10 @@
#include "logging.h"
#include "misc.h"
+#undef le16_to_cpup
+/* the standard le16_to_cpup() crashes for unaligned data on some processors */
+#define le16_to_cpup(p) (*(u8*)(p) + (((u8*)(p))[1] << 8))
+
/**
* enum ntfs_compression_constants - constants used in the compression code
*/
@@ -77,249 +81,215 @@ typedef enum {
NTFS_SB_IS_COMPRESSED = 0x8000,
} ntfs_compression_constants;
-#define THRESHOLD 3 /* minimal match length for compression */
-#define NIL NTFS_SB_SIZE /* End of tree's node */
-
struct COMPRESS_CONTEXT {
const unsigned char *inbuf;
- unsigned int len;
- unsigned int nbt;
- int match_position;
- unsigned int match_length;
- u16 lson[NTFS_SB_SIZE + 1];
- u16 rson[NTFS_SB_SIZE + 257];
- u16 dad[NTFS_SB_SIZE + 1];
+ int bufsize;
+ int size;
+ int rel;
+ int mxsz;
+ s16 head[256];
+ s16 lson[NTFS_SB_SIZE];
+ s16 rson[NTFS_SB_SIZE];
} ;
/*
- * Initialize the match tree
- */
-
-static void ntfs_init_compress_tree(struct COMPRESS_CONTEXT *pctx)
-{
- int i;
-
- for (i = NTFS_SB_SIZE + 1; i <= NTFS_SB_SIZE + 256; i++)
- pctx->rson[i] = NIL; /* root */
- for (i = 0; i < NTFS_SB_SIZE; i++)
- pctx->dad[i] = NIL; /* node */
-}
-
-/*
- * Insert a new node into match tree for quickly locating
- * further similar strings
+ * Search for the longest sequence matching current position
+ *
+ * A binary tree is maintained to locate all previously met sequences,
+ * and this function has to be called for all of them.
+ *
+ * This function is heavily used, it has to be optimized carefully
+ *
+ * Returns the size of the longest match,
+ * zero if no match is found.
*/
-static void ntfs_new_node (struct COMPRESS_CONTEXT *pctx,
- unsigned int r)
+static int ntfs_best_match(struct COMPRESS_CONTEXT *pctx, int i)
{
- unsigned int pp;
- BOOL less;
- BOOL done;
- const unsigned char *key;
- int c;
- unsigned int mxi;
- unsigned int mxl;
+ s16 *prev;
+ int node;
+ register long j;
+ long maxpos;
+ long startj;
+ long bestj;
+ int bufsize;
+ int bestnode;
+ register const unsigned char *p1,*p2;
- mxl = (1 << (16 - pctx->nbt)) + 2;
- less = FALSE;
- done = FALSE;
- key = &pctx->inbuf[r];
- pp = NTFS_SB_SIZE + 1 + key[0];
- pctx->rson[r] = pctx->lson[r] = NIL;
- pctx->match_length = 0;
- do {
- if (!less) {
- if (pctx->rson[pp] != NIL)
- pp = pctx->rson[pp];
- else {
- pctx->rson[pp] = r;
- pctx->dad[r] = pp;
- done = TRUE;
- }
- } else {
- if (pctx->lson[pp] != NIL)
- pp = pctx->lson[pp];
- else {
- pctx->lson[pp] = r;
- pctx->dad[r] = pp;
- done = TRUE;
- }
- }
- if (!done) {
- register unsigned int i;
- register const unsigned char *p1,*p2;
-
- i = 1;
- p1 = key;
- p2 = &pctx->inbuf[pp];
- mxi = NTFS_SB_SIZE - r;
+ p1 = pctx->inbuf;
+ node = pctx->head[p1[i] & 255];
+ if (node >= 0) {
+ /* search the best match at current position */
+ bestnode = node;
+ bufsize = pctx->bufsize;
+ /* restrict matches to the longest allowed sequence */
+ maxpos = bufsize;
+ if ((i + pctx->mxsz) < maxpos)
+ maxpos = i + pctx->mxsz;
+ startj = i + 1 - maxpos;
+ bestj = startj;
+ /* make indexes relative to end of allowed position */
+ p1 = &p1[maxpos];
+ if (startj < 0) {
do {
- } while ((p1[i] == p2[i]) && (++i < mxi));
- less = (i < mxi) && (p1[i] < p2[i]);
- if (i >= THRESHOLD) {
- if (i > pctx->match_length) {
- pctx->match_position =
- r - pp + 2*NTFS_SB_SIZE - 1;
- if ((pctx->match_length = i) > mxl) {
- i = pctx->rson[pp];
- pctx->rson[r] = i;
- pctx->dad[i] = r;
- i = pctx->lson[pp];
- pctx->lson[r] = i;
- pctx->dad[i] = r;
- i = pctx->dad[pp];
- pctx->dad[r] = i;
- if (pctx->rson[i] == pp)
- pctx->rson[i] = r;
- else
- pctx->lson[i] = r;
- pctx->dad[pp] = NIL; /* remove pp */
- done = TRUE;
- pctx->match_length = mxl;
+ /* indexes are negative */
+ p2 = &p1[node - i];
+ /* no need to compare the first byte */
+ j = startj;
+ /* the second byte cannot lead to useful compression */
+ if (p1[j] == p2[j]) {
+ j++;
+ if (j < 0) {
+ do {
+ } while ((p1[j] == p2[j])
+ && (++j < 0));
}
- } else
- if ((i == pctx->match_length)
- && ((c = (r - pp + 2*NTFS_SB_SIZE - 1))
- < pctx->match_position))
- pctx->match_position = c;
- }
- }
- } while (!done);
-}
-
-/*
- * Search for the longest previous string matching the
- * current one
- *
- * Returns the end of the longest current string which matched
- * or zero if there was a bug
- */
-
-static unsigned int ntfs_nextmatch(struct COMPRESS_CONTEXT *pctx, unsigned int rr, int dd)
-{
- unsigned int bestlen = 0;
-
- do {
- rr++;
- if (pctx->match_length > 0)
- pctx->match_length--;
- if (!pctx->len) {
- ntfs_log_error("compress bug : void run\n");
- goto bug;
- }
- if (--pctx->len) {
- if (rr >= NTFS_SB_SIZE) {
- ntfs_log_error("compress bug : buffer overflow\n");
- goto bug;
- }
- if (((rr + bestlen) < NTFS_SB_SIZE)) {
- while ((unsigned int)(1 << pctx->nbt) <= (rr - 1))
- pctx->nbt++;
- ntfs_new_node(pctx,rr);
- if (pctx->match_length > bestlen)
- bestlen = pctx->match_length;
- } else
- if (dd > 0) {
- rr += dd;
- if ((int)pctx->match_length > dd)
- pctx->match_length -= dd;
- else
- pctx->match_length = 0;
- if ((int)pctx->len < dd) {
- ntfs_log_error("compress bug : run overflows\n");
- goto bug;
+ /* remember the match, if better */
+ if (j > bestj) {
+ bestj = j;
+ bestnode = node;
}
- pctx->len -= dd;
- dd = 0;
}
+ /* walk in the tree in the right direction */
+ if ((j < 0) && (p1[j] < p2[j]))
+ prev = &pctx->lson[node];
+ else
+ prev = &pctx->rson[node];
+ node = *prev;
+ /* stop if reaching a leaf or maximum length */
+ } while ((node >= 0) && (j < 0));
+ /* put the node into the tree if we reached a leaf */
+ if (node < 0)
+ *prev = i;
}
- } while (dd-- > 0);
- return (rr);
-bug :
- return (0);
+ /* done, return the best match */
+ pctx->size = bestj + maxpos - i;
+ pctx->rel = bestnode - i;
+ } else {
+ pctx->head[p1[i] & 255] = i;
+ pctx->size = 0;
+ pctx->rel = 0;
+ }
+ return (pctx->size);
}
/*
- * Compress an input block
+ * Compress a 4096-byte block
+ *
+ * Returns a header of two bytes followed by the compressed data.
+ * If compression is not effective, the header and an uncompressed
+ * block is returned.
*
- * Returns the size of the compressed block (including header)
- * or zero if there was an error
+ * Note : two bytes may be output before output buffer overflow
+ * is detected, so a 4100-bytes output buffer must be reserved.
+ *
+ * Returns the size of the compressed block, including the
+ * header (minimal size is 2, maximum size is 4098)
+ * 0 if an error has been met.
*/
-static unsigned int ntfs_compress_block(const char *inbuf, unsigned int size, char *outbuf)
+static unsigned int ntfs_compress_block(const char *inbuf, int bufsize,
+ char *outbuf)
{
struct COMPRESS_CONTEXT *pctx;
- char *ptag;
- int dd;
- unsigned int rr;
- unsigned int last_match_length;
- unsigned int q;
+ int i; /* current position */
+ int j; /* end of best match from current position */
+ int k; /* end of best match from next position */
+ int offs; /* offset to best match */
+ int n;
+ int bp; /* bits to store offset */
+ int mxoff; /* max match offset : 1 << bp */
+ int mxsz2;
unsigned int xout;
- unsigned int ntag;
+ unsigned int q; /* aggregated offset and size */
+ int done;
+ char *ptag; /* location reserved for a tag */
+ int tag; /* current value of tag */
+ int ntag; /* count of bits still undefined in tag */
- pctx = (struct COMPRESS_CONTEXT*)malloc(sizeof(struct COMPRESS_CONTEXT));
+ pctx = (struct COMPRESS_CONTEXT*)ntfs_malloc(sizeof(struct COMPRESS_CONTEXT));
if (pctx) {
+ for (n=0; n<NTFS_SB_SIZE; n++)
+ pctx->lson[n] = pctx->rson[n] = -1;
+ for (n=0; n<256; n++)
+ pctx->head[n] = -1;
pctx->inbuf = (const unsigned char*)inbuf;
- ntfs_init_compress_tree(pctx);
+ pctx->bufsize = bufsize;
xout = 2;
- ntag = 0;
+ n = 0;
+ i = 0;
+ bp = 4;
+ mxoff = 1 << bp;
+ pctx->mxsz = (1 << (16 - bp)) + 2;
+ tag = 0;
+ done = -1;
+ ntag = 8;
ptag = &outbuf[xout++];
- *ptag = 0;
- rr = 0;
- pctx->nbt = 4;
- pctx->len = size;
- pctx->match_length = 0;
- ntfs_new_node(pctx,0);
- do {
- if (pctx->match_length > pctx->len)
- pctx->match_length = pctx->len;
- if (pctx->match_length < THRESHOLD) {
- pctx->match_length = 1;
- if (ntag >= 8) {
- ntag = 0;
- ptag = &outbuf[xout++];
- *ptag = 0;
+ while ((i < bufsize) && (xout < (NTFS_SB_SIZE + 2))) {
+ /* adjust the longest match we can output */
+ while (mxoff < i) {
+ bp++;
+ mxoff <<= 1;
+ pctx->mxsz = (pctx->mxsz + 2) >> 1;
+ }
+ /* search the best match at current position */
+ if (done < i)
+ do {
+ ntfs_best_match(pctx,++done);
+ } while (done < i);
+ j = i + pctx->size;
+ if ((j - i) > pctx->mxsz)
+ j = i + pctx->mxsz;
+
+ if ((j - i) > 2) {
+ offs = pctx->rel;
+ /* check whether there is a better run at i+1 */
+ ntfs_best_match(pctx,i+1);
+ done = i+1;
+ k = i + 1 + pctx->size;
+ mxsz2 = pctx->mxsz;
+ if (mxoff <= i)
+ mxsz2 = (pctx->mxsz + 2) >> 1;
+ if ((k - i) > mxsz2)
+ k = i + mxsz2;
+ if (k > (j + 1)) {
+ /* issue a single byte */
+ outbuf[xout++] = inbuf[i];
+ i++;
+ } else {
+ q = (~offs << (16 - bp))
+ + (j - i - 3);
+ outbuf[xout++] = q & 255;
+ outbuf[xout++] = (q >> 8) & 255;
+ tag |= (1 << (8 - ntag));
+ i = j;
}
- outbuf[xout++] = inbuf[rr];
- ntag++;
} else {
- while ((unsigned int)(1 << pctx->nbt) <= (rr - 1))
- pctx->nbt++;
- q = (pctx->match_position << (16 - pctx->nbt))
- + pctx->match_length - THRESHOLD;
- if (ntag >= 8) {
- ntag = 0;
- ptag = &outbuf[xout++];
- *ptag = 0;
- }
- *ptag |= 1 << ntag++;
- outbuf[xout++] = q & 255;
- outbuf[xout++] = (q >> 8) & 255;
+ outbuf[xout++] = inbuf[i];
+ i++;
}
- last_match_length = pctx->match_length;
- dd = last_match_length;
- if (dd-- > 0) {
- rr = ntfs_nextmatch(pctx,rr,dd);
- if (!rr)
- goto bug;
+ /* store the tag if fully used */
+ if (!--ntag) {
+ *ptag = tag;
+ ntag = 8;
+ ptag = &outbuf[xout++];
+ tag = 0;
}
- /*
- * stop if input is exhausted or output has exceeded
- * the maximum size. Two extra bytes have to be
- * reserved in output buffer, as 3 bytes may be
- * output in a loop.
- */
- } while ((pctx->len > 0)
- && (rr < size) && (xout < (NTFS_SB_SIZE + 2)));
- /* uncompressed must be full size, so accept if better */
- if (xout < (NTFS_SB_SIZE + 2)) {
+ }
+ /* store the last tag, if partially used */
+ if (ntag == 8)
+ xout--;
+ else
+ *ptag = tag;
+ /* uncompressed must be full size, accept if better */
+ if ((i >= bufsize) && (xout < (NTFS_SB_SIZE + 2))) {
outbuf[0] = (xout - 3) & 255;
outbuf[1] = 0xb0 + (((xout - 3) >> 8) & 15);
} else {
- memcpy(&outbuf[2],inbuf,size);
- if (size < NTFS_SB_SIZE)
- memset(&outbuf[size+2],0,NTFS_SB_SIZE - size);
+ memcpy(&outbuf[2],inbuf,bufsize);
+ if (bufsize < NTFS_SB_SIZE)
+ memset(&outbuf[bufsize+2], 0,
+ NTFS_SB_SIZE - bufsize);
outbuf[0] = 0xff;
outbuf[1] = 0x3f;
xout = NTFS_SB_SIZE + 2;
@@ -329,9 +299,7 @@ static unsigned int ntfs_compress_block(const char *inbuf, unsigned int size, ch
xout = 0;
errno = ENOMEM;
}
- return (xout); /* 0 for an error, > size if cannot compress */
-bug :
- return (0);
+ return (xout);
}
/**
@@ -732,7 +700,15 @@ do_next_cb:
na->data_size = na->initialized_size = na->allocated_size;
do {
br = ntfs_attr_pread(na, ofs, to_read, b);
- if (br < 0) {
+ if (br <= 0) {
+ if (!br) {
+ ntfs_log_error("Failed to read an"
+ " uncompressed cluster,"
+ " inode %lld offs 0x%llx\n",
+ (long long)na->ni->mft_no,
+ (long long)ofs);
+ errno = EIO;
+ }
err = errno;
na->data_size = tdata_size;
na->initialized_size = tinitialized_size;
@@ -758,6 +734,7 @@ do_next_cb:
ofs = 0;
} else {
s64 tdata_size, tinitialized_size;
+ u32 decompsz;
/*
* Compressed cb, decompress it into the temporary buffer, then
@@ -783,7 +760,15 @@ do_next_cb:
br = ntfs_attr_pread(na,
(vcn << vol->cluster_size_bits) +
(cb_pos - cb), to_read, cb_pos);
- if (br < 0) {
+ if (br <= 0) {
+ if (!br) {
+ ntfs_log_error("Failed to read a"
+ " compressed cluster, "
+ " inode %lld offs 0x%llx\n",
+ (long long)na->ni->mft_no,
+ (long long)(vcn << vol->cluster_size_bits));
+ errno = EIO;
+ }
err = errno;
na->data_size = tdata_size;
na->initialized_size = tinitialized_size;
@@ -807,7 +792,10 @@ do_next_cb:
if (cb_pos + 2 <= cb_end)
*(u16*)cb_pos = 0;
ntfs_log_debug("Successfully read the compression block.\n");
- if (ntfs_decompress(dest, cb_size, cb, cb_size) < 0) {
+ /* Do not decompress beyond the requested block */
+ to_read = min(count, cb_size - ofs);
+ decompsz = ((ofs + to_read - 1) | (NTFS_SB_SIZE - 1)) + 1;
+ if (ntfs_decompress(dest, decompsz, cb, cb_size) < 0) {
err = errno;
free(cb);
free(dest);
@@ -816,7 +804,6 @@ do_next_cb:
errno = err;
return -1;
}
- to_read = min(count, cb_size - ofs);
memcpy(b, dest + ofs, to_read);
total += to_read;
count -= to_read;
@@ -881,11 +868,11 @@ static u32 read_clusters(ntfs_volume *vol, const runlist_element *rl,
* Returns the amount of data written
*/
-static int write_clusters(ntfs_volume *vol, const runlist_element *rl,
- s64 offs, int to_write, const char *outbuf)
+static s32 write_clusters(ntfs_volume *vol, const runlist_element *rl,
+ s64 offs, s32 to_write, const char *outbuf)
{
- int count;
- int put, xput;
+ s32 count;
+ s32 put, xput;
s64 xpos;
BOOL first;
const char *xoutbuf;
@@ -926,17 +913,17 @@ static int write_clusters(ntfs_volume *vol, const runlist_element *rl,
* or -2 if there were an irrecoverable error (errno set)
*/
-static int ntfs_comp_set(ntfs_attr *na, runlist_element *rl,
- s64 offs, unsigned int insz, const char *inbuf)
+static s32 ntfs_comp_set(ntfs_attr *na, runlist_element *rl,
+ s64 offs, u32 insz, const char *inbuf)
{
ntfs_volume *vol;
char *outbuf;
char *pbuf;
- unsigned int compsz;
- int written;
- int rounded;
+ u32 compsz;
+ s32 written;
+ s32 rounded;
unsigned int clsz;
- unsigned int p;
+ u32 p;
unsigned int sz;
unsigned int bsz;
BOOL fail;
@@ -1002,7 +989,10 @@ static int ntfs_comp_set(ntfs_attr *na, runlist_element *rl,
rounded = ((compsz - 1) | (clsz - 1)) + 1;
written = write_clusters(vol, rl, offs, rounded, outbuf);
if (written != rounded) {
-// previously written text has been spoilt, should return a specific error
+ /*
+ * TODO : previously written text has been
+ * spoilt, should return a specific error
+ */
ntfs_log_error("error writing compressed data\n");
errno = EIO;
written = -2;
@@ -1016,25 +1006,298 @@ static int ntfs_comp_set(ntfs_attr *na, runlist_element *rl,
}
/*
+ * Check the validity of a compressed runlist
+ * The check starts at the beginning of current run and ends
+ * at the end of runlist
+ * errno is set if the runlist is not valid
+ */
+
+static BOOL valid_compressed_run(ntfs_attr *na, runlist_element *rl,
+ BOOL fullcheck, const char *text)
+{
+ runlist_element *xrl;
+ const char *err;
+ BOOL ok = TRUE;
+
+ xrl = rl;
+ while (xrl->vcn & (na->compression_block_clusters - 1))
+ xrl--;
+ err = (const char*)NULL;
+ while (xrl->length) {
+ if ((xrl->vcn + xrl->length) != xrl[1].vcn)
+ err = "Runs not adjacent";
+ if (xrl->lcn == LCN_HOLE) {
+ if ((xrl->vcn + xrl->length)
+ & (na->compression_block_clusters - 1)) {
+ err = "Invalid hole";
+ }
+ if (fullcheck && (xrl[1].lcn == LCN_HOLE)) {
+ err = "Adjacent holes";
+ }
+ }
+ if (err) {
+ ntfs_log_error("%s at %s index %ld inode %lld\n",
+ err, text, (long)(xrl - na->rl),
+ (long long)na->ni->mft_no);
+ errno = EIO;
+ ok = FALSE;
+ err = (const char*)NULL;
+ }
+ xrl++;
+ }
+ return (ok);
+}
+
+/*
+ * Free unneeded clusters after overwriting compressed data
+ *
+ * This generally requires one or two empty slots at the end of runlist,
+ * but we do not want to reallocate the runlist here because
+ * there are many pointers to it.
+ * So the empty slots have to be reserved beforehand
+ *
+ * Returns zero unless some error occurred (described by errno)
+ *
+ * +======= start of block =====+
+ * 0 |A chunk may overflow | <-- rl usedcnt : A + B
+ * |A on previous block | then B
+ * |A |
+ * +-- end of allocated chunk --+ freelength : C
+ * |B | (incl overflow)
+ * +== end of compressed data ==+
+ * |C | <-- freerl freecnt : C + D
+ * |C chunk may overflow |
+ * |C on next block |
+ * +-- end of allocated chunk --+
+ * |D |
+ * |D chunk may overflow |
+ * 15 |D on next block |
+ * +======== end of block ======+
+ *
+ */
+
+static int ntfs_compress_overwr_free(ntfs_attr *na, runlist_element *rl,
+ s32 usedcnt, s32 freecnt, VCN *update_from)
+{
+ BOOL beginhole;
+ BOOL mergeholes;
+ s32 oldlength;
+ s32 freelength;
+ s64 freelcn;
+ s64 freevcn;
+ runlist_element *freerl;
+ ntfs_volume *vol;
+ s32 carry;
+ int res;
+
+ vol = na->ni->vol;
+ res = 0;
+ freelcn = rl->lcn + usedcnt;
+ freevcn = rl->vcn + usedcnt;
+ freelength = rl->length - usedcnt;
+ beginhole = !usedcnt && !rl->vcn;
+ /* can merge with hole before ? */
+ mergeholes = !usedcnt
+ && rl[0].vcn
+ && (rl[-1].lcn == LCN_HOLE);
+ /* truncate current run, carry to subsequent hole */
+ carry = freelength;
+ oldlength = rl->length;
+ if (mergeholes) {
+ /* merging with a hole before */
+ freerl = rl;
+ } else {
+ rl->length -= freelength; /* warning : can be zero */
+ freerl = ++rl;
+ }
+ if (!mergeholes && (usedcnt || beginhole)) {
+ s32 freed;
+ runlist_element *frl;
+ runlist_element *erl;
+ int holes = 0;
+ BOOL threeparts;
+
+ /* free the unneeded clusters from initial run, then freerl */
+ threeparts = (freelength > freecnt);
+ freed = 0;
+ frl = freerl;
+ if (freelength) {
+ res = ntfs_cluster_free_basic(vol,freelcn,
+ (threeparts ? freecnt : freelength));
+ if (!res)
+ freed += (threeparts ? freecnt : freelength);
+ if (!usedcnt) {
+ holes++;
+ freerl--;
+ freerl->length += (threeparts
+ ? freecnt : freelength);
+ if (freerl->vcn < *update_from)
+ *update_from = freerl->vcn;
+ }
+ }
+ while (!res && frl->length && (freed < freecnt)) {
+ if (frl->length <= (freecnt - freed)) {
+ res = ntfs_cluster_free_basic(vol, frl->lcn,
+ frl->length);
+ if (!res) {
+ freed += frl->length;
+ frl->lcn = LCN_HOLE;
+ frl->length += carry;
+ carry = 0;
+ holes++;
+ }
+ } else {
+ res = ntfs_cluster_free_basic(vol, frl->lcn,
+ freecnt - freed);
+ if (!res) {
+ frl->lcn += freecnt - freed;
+ frl->vcn += freecnt - freed;
+ frl->length -= freecnt - freed;
+ freed = freecnt;
+ }
+ }
+ frl++;
+ }
+ na->compressed_size -= freed << vol->cluster_size_bits;
+ switch (holes) {
+ case 0 :
+ /* there are no hole, must insert one */
+ /* space for hole has been prereserved */
+ if (freerl->lcn == LCN_HOLE) {
+ if (threeparts) {
+ erl = freerl;
+ while (erl->length)
+ erl++;
+ do {
+ erl[2] = *erl;
+ } while (erl-- != freerl);
+
+ freerl[1].length = freelength - freecnt;
+ freerl->length = freecnt;
+ freerl[1].lcn = freelcn + freecnt;
+ freerl[1].vcn = freevcn + freecnt;
+ freerl[2].lcn = LCN_HOLE;
+ freerl[2].vcn = freerl[1].vcn
+ + freerl[1].length;
+ freerl->vcn = freevcn;
+ } else {
+ freerl->vcn = freevcn;
+ freerl->length += freelength;
+ }
+ } else {
+ erl = freerl;
+ while (erl->length)
+ erl++;
+ if (threeparts) {
+ do {
+ erl[2] = *erl;
+ } while (erl-- != freerl);
+ freerl[1].lcn = freelcn + freecnt;
+ freerl[1].vcn = freevcn + freecnt;
+ freerl[1].length = oldlength - usedcnt - freecnt;
+ } else {
+ do {
+ erl[1] = *erl;
+ } while (erl-- != freerl);
+ }
+ freerl->lcn = LCN_HOLE;
+ freerl->vcn = freevcn;
+ freerl->length = freecnt;
+ }
+ break;
+ case 1 :
+ /* there is a single hole, may have to merge */
+ freerl->vcn = freevcn;
+ freerl->length = freecnt;
+ if (freerl[1].lcn == LCN_HOLE) {
+ freerl->length += freerl[1].length;
+ erl = freerl;
+ do {
+ erl++;
+ *erl = erl[1];
+ } while (erl->length);
+ }
+ break;
+ default :
+ /* there were several holes, must merge them */
+ freerl->lcn = LCN_HOLE;
+ freerl->vcn = freevcn;
+ freerl->length = freecnt;
+ if (freerl[holes].lcn == LCN_HOLE) {
+ freerl->length += freerl[holes].length;
+ holes++;
+ }
+ erl = freerl;
+ do {
+ erl++;
+ *erl = erl[holes - 1];
+ } while (erl->length);
+ break;
+ }
+ } else {
+ s32 freed;
+ runlist_element *frl;
+ runlist_element *xrl;
+
+ freed = 0;
+ frl = freerl--;
+ if (freerl->vcn < *update_from)
+ *update_from = freerl->vcn;
+ while (!res && frl->length && (freed < freecnt)) {
+ if (frl->length <= (freecnt - freed)) {
+ freerl->length += frl->length;
+ freed += frl->length;
+ res = ntfs_cluster_free_basic(vol, frl->lcn,
+ frl->length);
+ frl++;
+ } else {
+ freerl->length += freecnt - freed;
+ res = ntfs_cluster_free_basic(vol, frl->lcn,
+ freecnt - freed);
+ frl->lcn += freecnt - freed;
+ frl->vcn += freecnt - freed;
+ frl->length -= freecnt - freed;
+ freed = freecnt;
+ }
+ }
+ /* remove unneded runlist entries */
+ xrl = freerl;
+ /* group with next run if also a hole */
+ if (frl->length && (frl->lcn == LCN_HOLE)) {
+ xrl->length += frl->length;
+ frl++;
+ }
+ while (frl->length) {
+ *++xrl = *frl++;
+ }
+ *++xrl = *frl; /* terminator */
+ na->compressed_size -= freed << vol->cluster_size_bits;
+ }
+ return (res);
+}
+
+
+/*
* Free unneeded clusters after compression
*
- * This generally requires an empty slot at the end of runlist,
+ * This generally requires one or two empty slots at the end of runlist,
* but we do not want to reallocate the runlist here because
* there are many pointers to it.
- * So the empty slot has to be reserved beforehand
+ * So the empty slots have to be reserved beforehand
*
* Returns zero unless some error occurred (described by errno)
*/
static int ntfs_compress_free(ntfs_attr *na, runlist_element *rl,
- s64 used, s64 reserved)
+ s64 used, s64 reserved, BOOL appending,
+ VCN *update_from)
{
- int freecnt;
- int usedcnt;
+ s32 freecnt;
+ s32 usedcnt;
int res;
s64 freelcn;
s64 freevcn;
- int freelength;
+ s32 freelength;
BOOL mergeholes;
BOOL beginhole;
ntfs_volume *vol;
@@ -1044,9 +1307,11 @@ static int ntfs_compress_free(ntfs_attr *na, runlist_element *rl,
vol = na->ni->vol;
freecnt = (reserved - used) >> vol->cluster_size_bits;
usedcnt = (reserved >> vol->cluster_size_bits) - freecnt;
+ if (rl->vcn < *update_from)
+ *update_from = rl->vcn;
/* skip entries fully used, if any */
while (rl->length && (rl->length < usedcnt)) {
- usedcnt -= rl->length;
+ usedcnt -= rl->length; /* must be > 0 */
rl++;
}
if (rl->length) {
@@ -1056,62 +1321,93 @@ static int ntfs_compress_free(ntfs_attr *na, runlist_element *rl,
* The required entry has been prereserved when
* mapping the runlist.
*/
+ /* get the free part in initial run */
freelcn = rl->lcn + usedcnt;
freevcn = rl->vcn + usedcnt;
- freelength = rl->length - usedcnt;
/* new count of allocated clusters */
- rl->length = usedcnt; /* warning : can be zero */
if (!((freevcn + freecnt)
& (na->compression_block_clusters - 1))) {
- beginhole = !usedcnt && !rl->vcn;
- mergeholes = !usedcnt
- && rl[0].vcn
- && (rl[-1].lcn == LCN_HOLE);
- if (mergeholes) {
- freerl = rl;
- freerl->length = freecnt;
- } else
- freerl = ++rl;
- if ((freelength > 0)
- && !mergeholes
- && (usedcnt || beginhole)) {
+ if (!appending)
+ res = ntfs_compress_overwr_free(na,rl,
+ usedcnt,freecnt,update_from);
+ else {
+ freelength = rl->length - usedcnt;
+ beginhole = !usedcnt && !rl->vcn;
+ mergeholes = !usedcnt
+ && rl[0].vcn
+ && (rl[-1].lcn == LCN_HOLE);
+ if (mergeholes) {
+ s32 carry;
+
+ /* shorten the runs which have free space */
+ carry = freecnt;
+ freerl = rl;
+ while (freerl->length < carry) {
+ carry -= freerl->length;
+ freerl++;
+ }
+ freerl->length = carry;
+ freerl = rl;
+ } else {
+ rl->length = usedcnt; /* can be zero ? */
+ freerl = ++rl;
+ }
+ if ((freelength > 0)
+ && !mergeholes
+ && (usedcnt || beginhole)) {
/*
* move the unused part to the end. Doing so,
* the vcn will be out of order. This does
* not harm, the vcn are meaningless now, and
* only the lcn are meaningful for freeing.
*/
- /* locate current end */
- while (rl->length)
- rl++;
- /* new terminator relocated */
- rl[1].vcn = rl->vcn;
- rl[1].lcn = LCN_ENOENT;
- rl[1].length = 0;
- /* hole, currently allocated */
- rl->vcn = freevcn;
- rl->lcn = freelcn;
- rl->length = freelength;
- }
+ /* locate current end */
+ while (rl->length)
+ rl++;
+ /* new terminator relocated */
+ rl[1].vcn = rl->vcn;
+ rl[1].lcn = LCN_ENOENT;
+ rl[1].length = 0;
+ /* hole, currently allocated */
+ rl->vcn = freevcn;
+ rl->lcn = freelcn;
+ rl->length = freelength;
+ } else {
+ /* why is this different from the begin hole case ? */
+ if ((freelength > 0)
+ && !mergeholes
+ && !usedcnt) {
+ freerl--;
+ freerl->length = freelength;
+ if (freerl->vcn < *update_from)
+ *update_from
+ = freerl->vcn;
+ }
+ }
/* free the hole */
- res = ntfs_cluster_free_from_rl(vol,freerl);
- if (!res) {
- if (mergeholes) {
+ res = ntfs_cluster_free_from_rl(vol,freerl);
+ if (!res) {
+ na->compressed_size -= freecnt
+ << vol->cluster_size_bits;
+ if (mergeholes) {
/* merge with adjacent hole */
- freerl--;
- freerl->length += freecnt;
- } else {
- if (beginhole)
freerl--;
+ freerl->length += freecnt;
+ } else {
+ if (beginhole)
+ freerl--;
/* mark hole as free */
- freerl->lcn = LCN_HOLE;
- freerl->vcn = freevcn;
- freerl->length = freecnt;
+ freerl->lcn = LCN_HOLE;
+ freerl->vcn = freevcn;
+ freerl->length = freecnt;
+ }
+ if (freerl->vcn < *update_from)
+ *update_from = freerl->vcn;
+ /* and set up the new end */
+ freerl[1].lcn = LCN_ENOENT;
+ freerl[1].vcn = freevcn + freecnt;
+ freerl[1].length = 0;
}
- /* and set up the new end */
- freerl[1].lcn = LCN_ENOENT;
- freerl[1].vcn = freevcn + freecnt;
- freerl[1].length = 0;
}
} else {
ntfs_log_error("Bad end of a compression block set\n");
@@ -1130,7 +1426,7 @@ static int ntfs_compress_free(ntfs_attr *na, runlist_element *rl,
*/
static int ntfs_read_append(ntfs_attr *na, const runlist_element *rl,
- s64 offs, u32 compsz, int pos,
+ s64 offs, u32 compsz, s32 pos, BOOL appending,
char *outbuf, s64 to_write, const void *b)
{
int fail = 1;
@@ -1147,7 +1443,10 @@ static int ntfs_read_append(ntfs_attr *na, const runlist_element *rl,
compbuf = (char*)ntfs_malloc(compsz);
if (compbuf) {
/* must align to full block for decompression */
- decompsz = ((pos - 1) | (NTFS_SB_SIZE - 1)) + 1;
+ if (appending)
+ decompsz = ((pos - 1) | (NTFS_SB_SIZE - 1)) + 1;
+ else
+ decompsz = na->compression_block_size;
got = read_clusters(na->ni->vol, rl, offs,
compsz, compbuf);
if ((got == compsz)
@@ -1170,11 +1469,12 @@ static int ntfs_read_append(ntfs_attr *na, const runlist_element *rl,
* or -1 if there were an irrecoverable error (errno set)
*/
-static int ntfs_flush(ntfs_attr *na, runlist_element *rl, s64 offs,
- const char *outbuf, int count, BOOL compress)
+static s32 ntfs_flush(ntfs_attr *na, runlist_element *rl, s64 offs,
+ const char *outbuf, s32 count, BOOL compress,
+ BOOL appending, VCN *update_from)
{
- int rounded;
- int written;
+ s32 rounded;
+ s32 written;
int clsz;
if (compress) {
@@ -1183,7 +1483,8 @@ static int ntfs_flush(ntfs_attr *na, runlist_element *rl, s64 offs,
compress = FALSE;
if ((written >= 0)
&& ntfs_compress_free(na,rl,offs + written,
- offs + na->compression_block_size))
+ offs + na->compression_block_size, appending,
+ update_from))
written = -1;
} else
written = 0;
@@ -1205,32 +1506,55 @@ static int ntfs_flush(ntfs_attr *na, runlist_element *rl, s64 offs,
* it has to be reserved beforehand.
*
* Returns the size of uncompressed data written,
- * or zero if an error occurred.
+ * or negative if an error occurred.
* When the returned size is less than requested, new clusters have
* to be allocated before the function is called again.
*/
s64 ntfs_compressed_pwrite(ntfs_attr *na, runlist_element *wrl, s64 wpos,
s64 offs, s64 to_write, s64 rounded,
- const void *b, int compressed_part)
+ const void *b, int compressed_part,
+ VCN *update_from)
{
ntfs_volume *vol;
runlist_element *brl; /* entry containing the beginning of block */
int compression_length;
s64 written;
s64 to_read;
+ s64 to_flush;
s64 roffs;
s64 got;
s64 start_vcn;
s64 nextblock;
+ s64 endwrite;
u32 compsz;
char *inbuf;
char *outbuf;
BOOL fail;
BOOL done;
BOOL compress;
+ BOOL appending;
- written = 0; /* default return */
+ if (!valid_compressed_run(na,wrl,FALSE,"begin compressed write")) {
+ return (-1);
+ }
+ if ((*update_from < 0)
+ || (compressed_part < 0)
+ || (compressed_part > (int)na->compression_block_clusters)) {
+ ntfs_log_error("Bad update vcn or compressed_part %d for compressed write\n",
+ compressed_part);
+ errno = EIO;
+ return (-1);
+ }
+ /* make sure there are two unused entries in runlist */
+ if (na->unused_runs < 2) {
+ ntfs_log_error("No unused runs for compressed write\n");
+ errno = EIO;
+ return (-1);
+ }
+ if (wrl->vcn < *update_from)
+ *update_from = wrl->vcn;
+ written = -1; /* default return */
vol = na->ni->vol;
compression_length = na->compression_block_clusters;
compress = FALSE;
@@ -1244,8 +1568,10 @@ s64 ntfs_compressed_pwrite(ntfs_attr *na, runlist_element *wrl, s64 wpos,
*/
nextblock = ((offs + (wrl->vcn << vol->cluster_size_bits))
| (na->compression_block_size - 1)) + 1;
- if ((offs + to_write + (wrl->vcn << vol->cluster_size_bits))
- >= nextblock) {
+ /* determine whether we are appending to file */
+ endwrite = offs + to_write + (wrl->vcn << vol->cluster_size_bits);
+ appending = endwrite >= na->initialized_size;
+ if (endwrite >= nextblock) {
/* it is time to compress */
compress = TRUE;
/* only process what we can */
@@ -1266,6 +1592,8 @@ s64 ntfs_compressed_pwrite(ntfs_attr *na, runlist_element *wrl, s64 wpos,
/* find the beginning of block */
start_vcn = (wrl->vcn + (offs >> vol->cluster_size_bits))
& -compression_length;
+ if (start_vcn < *update_from)
+ *update_from = start_vcn;
while (brl->vcn && (brl->vcn > start_vcn)) {
/* jumping back a hole means big trouble */
if (brl->lcn == (LCN)LCN_HOLE) {
@@ -1284,15 +1612,25 @@ s64 ntfs_compressed_pwrite(ntfs_attr *na, runlist_element *wrl, s64 wpos,
* (we are reopening an existing file to append to it)
* Decompress the data and append
*/
- compsz = compressed_part << vol->cluster_size_bits;
-// improve the needed size
+ compsz = (s32)compressed_part << vol->cluster_size_bits;
outbuf = (char*)ntfs_malloc(na->compression_block_size);
if (outbuf) {
- to_read = offs - roffs;
+ if (appending) {
+ to_read = offs - roffs;
+ to_flush = to_read + to_write;
+ } else {
+ to_read = na->data_size
+ - (brl->vcn << vol->cluster_size_bits);
+ if (to_read > na->compression_block_size)
+ to_read = na->compression_block_size;
+ to_flush = to_read;
+ }
if (!ntfs_read_append(na, brl, roffs, compsz,
- to_read, outbuf, to_write, b)) {
+ (s32)(offs - roffs), appending,
+ outbuf, to_write, b)) {
written = ntfs_flush(na, brl, roffs,
- outbuf, to_read + to_write, compress);
+ outbuf, to_flush, compress, appending,
+ update_from);
if (written >= 0) {
written = to_write;
done = TRUE;
@@ -1303,9 +1641,9 @@ s64 ntfs_compressed_pwrite(ntfs_attr *na, runlist_element *wrl, s64 wpos,
} else {
if (compress && !fail) {
/*
- * we are filling up a block, read the full set of blocks
- * and compress it
- */
+ * we are filling up a block, read the full set
+ * of blocks and compress it
+ */
inbuf = (char*)ntfs_malloc(na->compression_block_size);
if (inbuf) {
to_read = offs - roffs;
@@ -1327,7 +1665,8 @@ s64 ntfs_compressed_pwrite(ntfs_attr *na, runlist_element *wrl, s64 wpos,
&& !ntfs_compress_free(na,brl,
written + roffs,
na->compression_block_size
- + roffs)) {
+ + roffs,
+ appending, update_from)) {
done = TRUE;
written = to_write;
}
@@ -1355,18 +1694,22 @@ s64 ntfs_compressed_pwrite(ntfs_attr *na, runlist_element *wrl, s64 wpos,
}
}
}
+ if ((written >= 0)
+ && !valid_compressed_run(na,wrl,TRUE,"end compressed write"))
+ written = -1;
return (written);
}
/*
* Close a file written compressed.
* This compresses the last partial compression block of the file.
- * An empty runlist slot has to be reserved beforehand.
+ * Two empty runlist slots have to be reserved beforehand.
*
* Returns zero if closing is successful.
*/
-int ntfs_compressed_close(ntfs_attr *na, runlist_element *wrl, s64 offs)
+int ntfs_compressed_close(ntfs_attr *na, runlist_element *wrl, s64 offs,
+ VCN *update_from)
{
ntfs_volume *vol;
runlist_element *brl; /* entry containing the beginning of block */
@@ -1380,6 +1723,18 @@ int ntfs_compressed_close(ntfs_attr *na, runlist_element *wrl, s64 offs)
BOOL fail;
BOOL done;
+ if (na->unused_runs < 2) {
+ ntfs_log_error("No unused runs for compressed close\n");
+ errno = EIO;
+ return (-1);
+ }
+ if (*update_from < 0) {
+ ntfs_log_error("Bad update vcn for compressed close\n");
+ errno = EIO;
+ return (-1);
+ }
+ if (wrl->vcn < *update_from)
+ *update_from = wrl->vcn;
vol = na->ni->vol;
compression_length = na->compression_block_clusters;
done = FALSE;
@@ -1391,7 +1746,10 @@ int ntfs_compressed_close(ntfs_attr *na, runlist_element *wrl, s64 offs)
if (inbuf) {
start_vcn = (wrl->vcn + (offs >> vol->cluster_size_bits))
& -compression_length;
- to_read = offs + ((wrl->vcn - start_vcn) << vol->cluster_size_bits);
+ if (start_vcn < *update_from)
+ *update_from = start_vcn;
+ to_read = offs + ((wrl->vcn - start_vcn)
+ << vol->cluster_size_bits);
brl = wrl;
fail = FALSE;
while (brl->vcn && (brl->vcn > start_vcn)) {
@@ -1404,7 +1762,8 @@ int ntfs_compressed_close(ntfs_attr *na, runlist_element *wrl, s64 offs)
}
if (!fail) {
/* roffs can be an offset from another uncomp block */
- roffs = (start_vcn - brl->vcn) << vol->cluster_size_bits;
+ roffs = (start_vcn - brl->vcn)
+ << vol->cluster_size_bits;
if (to_read) {
got = read_clusters(vol, brl, roffs, to_read,
inbuf);
@@ -1415,7 +1774,8 @@ int ntfs_compressed_close(ntfs_attr *na, runlist_element *wrl, s64 offs)
/* free the unused clusters */
&& !ntfs_compress_free(na,brl,
written + roffs,
- na->compression_block_size + roffs)) {
+ na->compression_block_size + roffs,
+ TRUE, update_from)) {
done = TRUE;
} else
/* if compression failed, leave uncompressed */
@@ -1427,5 +1787,7 @@ int ntfs_compressed_close(ntfs_attr *na, runlist_element *wrl, s64 offs)
free(inbuf);
}
}
+ if (done && !valid_compressed_run(na,wrl,TRUE,"end compressed close"))
+ done = FALSE;
return (!done);
}
diff --git a/libntfs-3g/device.c b/libntfs-3g/device.c
index c77d8f9..a5c32f4 100755
--- a/libntfs-3g/device.c
+++ b/libntfs-3g/device.c
@@ -1,8 +1,10 @@
/**
* device.c - Low level device io functions. Originated from the Linux-NTFS project.
*
- * Copyright (c) 2004-2006 Anton Altaparmakov
+ * Copyright (c) 2004-2013 Anton Altaparmakov
* Copyright (c) 2004-2006 Szabolcs Szakacsits
+ * Copyright (c) 2010 Jean-Pierre Andre
+ * Copyright (c) 2008-2013 Tuxera Inc.
*
* This program/include file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
@@ -57,12 +59,18 @@
#ifdef HAVE_SYS_MOUNT_H
#include <sys/mount.h>
#endif
+#ifdef HAVE_SYS_DISK_H
+#include <sys/disk.h>
+#endif
#ifdef HAVE_LINUX_FD_H
#include <linux/fd.h>
#endif
#ifdef HAVE_LINUX_HDREG_H
#include <linux/hdreg.h>
#endif
+#ifdef ENABLE_HD
+#include <hd.h>
+#endif
#include "types.h"
#include "mst.h"
@@ -124,6 +132,8 @@ struct ntfs_device *ntfs_device_alloc(const char *name, const long state,
dev->d_ops = dops;
dev->d_state = state;
dev->d_private = priv_data;
+ dev->d_heads = -1;
+ dev->d_sectors_per_track = -1;
}
return dev;
}
@@ -154,6 +164,25 @@ int ntfs_device_free(struct ntfs_device *dev)
return 0;
}
+/*
+ * Sync the device
+ *
+ * returns zero if successful.
+ */
+
+int ntfs_device_sync(struct ntfs_device *dev)
+{
+ int ret;
+ struct ntfs_device_operations *dops;
+
+ if (NDevDirty(dev)) {
+ dops = dev->d_ops;
+ ret = dops->sync(dev);
+ } else
+ ret = 0;
+ return ret;
+}
+
/**
* ntfs_pread - positioned read from disk
* @dev: device to read from
@@ -260,6 +289,9 @@ s64 ntfs_pwrite(struct ntfs_device *dev, const s64 pos, s64 count,
total = written;
break;
}
+ if (NDevSync(dev) && total && dops->sync(dev)) {
+ total--; /* on sync error, return partially written */
+ }
ret = total;
out:
return ret;
@@ -534,6 +566,36 @@ s64 ntfs_device_size_get(struct ntfs_device *dev, int block_size)
}
}
#endif
+#ifdef DIOCGMEDIASIZE
+ {
+ /* FreeBSD */
+ off_t size;
+
+ if (dev->d_ops->ioctl(dev, DIOCGMEDIASIZE, &size) >= 0) {
+ ntfs_log_debug("DIOCGMEDIASIZE nr bytes = %llu (0x%llx)\n",
+ (unsigned long long)size,
+ (unsigned long long)size);
+ return (s64)size / block_size;
+ }
+ }
+#endif
+#ifdef DKIOCGETBLOCKCOUNT
+ {
+ /* Mac OS X */
+ uint64_t blocks;
+ int sector_size;
+
+ sector_size = ntfs_device_sector_size_get(dev);
+ if (sector_size >= 0 && dev->d_ops->ioctl(dev,
+ DKIOCGETBLOCKCOUNT, &blocks) >= 0)
+ {
+ ntfs_log_debug("DKIOCGETBLOCKCOUNT nr blocks = %llu (0x%llx)\n",
+ (unsigned long long) blocks,
+ (unsigned long long) blocks);
+ return blocks * sector_size / 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.
@@ -586,6 +648,132 @@ s64 ntfs_device_partition_start_sector_get(struct ntfs_device *dev)
return -1;
}
+static int ntfs_device_get_geo(struct ntfs_device *dev)
+{
+ int err;
+
+ if (!dev) {
+ errno = EINVAL;
+ return -1;
+ }
+ err = EOPNOTSUPP;
+#ifdef ENABLE_HD
+ {
+ hd_data_t *hddata;
+ hd_t *hd, *devlist, *partlist = NULL;
+ str_list_t *names;
+ hd_res_t *res;
+ const int d_name_len = strlen(dev->d_name) + 1;
+ int done = 0;
+
+ hddata = calloc(1, sizeof(*hddata));
+ if (!hddata) {
+ err = ENOMEM;
+ goto skip_hd;
+ }
+ /* List all "disk" class devices on the system. */
+ devlist = hd_list(hddata, hw_disk, 1, NULL);
+ if (!devlist) {
+ free(hddata);
+ err = ENOMEM;
+ goto skip_hd;
+ }
+ /*
+ * Loop over each disk device looking for the device with the
+ * same unix name as @dev.
+ */
+ for (hd = devlist; hd; hd = hd->next) {
+ if (hd->unix_dev_name && !strncmp(dev->d_name,
+ hd->unix_dev_name, d_name_len))
+ goto got_hd;
+ if (hd->unix_dev_name2 && !strncmp(dev->d_name,
+ hd->unix_dev_name2, d_name_len))
+ goto got_hd;
+ for (names = hd->unix_dev_names; names;
+ names = names->next) {
+ if (names->str && !strncmp(dev->d_name,
+ names->str, d_name_len))
+ goto got_hd;
+ }
+ }
+ /*
+ * Device was not a whole disk device. Unless it is a file it
+ * is likely to be a partition device. List all "partition"
+ * class devices on the system.
+ */
+ partlist = hd_list(hddata, hw_partition, 1, NULL);
+ for (hd = partlist; hd; hd = hd->next) {
+ if (hd->unix_dev_name && !strncmp(dev->d_name,
+ hd->unix_dev_name, d_name_len))
+ goto got_part_hd;
+ if (hd->unix_dev_name2 && !strncmp(dev->d_name,
+ hd->unix_dev_name2, d_name_len))
+ goto got_part_hd;
+ for (names = hd->unix_dev_names; names;
+ names = names->next) {
+ if (names->str && !strncmp(dev->d_name,
+ names->str, d_name_len))
+ goto got_part_hd;
+ }
+ }
+ /* Failed to find the device. Stop trying and clean up. */
+ goto end_hd;
+got_part_hd:
+ /* Get the whole block device the partition device is on. */
+ hd = hd_get_device_by_idx(hddata, hd->attached_to);
+ if (!hd)
+ goto end_hd;
+got_hd:
+ /*
+ * @hd is now the whole block device either being formatted or
+ * that the partition being formatted is on.
+ *
+ * Loop over each resource of the disk device looking for the
+ * BIOS legacy geometry obtained from EDD which is what Windows
+ * needs to boot.
+ */
+ for (res = hd->res; res; res = res->next) {
+ /* geotype 3 is BIOS legacy. */
+ if (res->any.type != res_disk_geo ||
+ res->disk_geo.geotype != 3)
+ continue;
+ dev->d_heads = res->disk_geo.heads;
+ dev->d_sectors_per_track = res->disk_geo.sectors;
+ done = 1;
+ }
+end_hd:
+ if (partlist)
+ hd_free_hd_list(partlist);
+ hd_free_hd_list(devlist);
+ hd_free_hd_data(hddata);
+ free(hddata);
+ if (done) {
+ ntfs_log_debug("EDD/BIOD legacy heads = %u, sectors "
+ "per track = %u\n", dev->d_heads,
+ dev->d_sectors_per_track);
+ return 0;
+ }
+ }
+skip_hd:
+#endif
+#ifdef HDIO_GETGEO
+ { struct hd_geometry geo;
+
+ if (!dev->d_ops->ioctl(dev, HDIO_GETGEO, &geo)) {
+ dev->d_heads = geo.heads;
+ dev->d_sectors_per_track = geo.sectors;
+ ntfs_log_debug("HDIO_GETGEO heads = %u, sectors per "
+ "track = %u\n", dev->d_heads,
+ dev->d_sectors_per_track);
+ return 0;
+ }
+ err = errno;
+ }
+#endif
+ errno = err;
+ return -1;
+}
+
/**
* ntfs_device_heads_get - get number of heads of device
* @dev: open device
@@ -597,6 +785,7 @@ s64 ntfs_device_partition_start_sector_get(struct ntfs_device *dev)
* EINVAL Input parameter error
* EOPNOTSUPP System does not support HDIO_GETGEO ioctl
* ENOTTY @dev is a file or a device not supporting HDIO_GETGEO
+ * ENOMEM Not enough memory to complete the request
*/
int ntfs_device_heads_get(struct ntfs_device *dev)
{
@@ -604,20 +793,15 @@ int ntfs_device_heads_get(struct ntfs_device *dev)
errno = EINVAL;
return -1;
}
-#ifdef HDIO_GETGEO
- { struct hd_geometry geo;
-
- if (!dev->d_ops->ioctl(dev, HDIO_GETGEO, &geo)) {
- ntfs_log_debug("HDIO_GETGEO heads = %u (0x%x)\n",
- (unsigned)geo.heads,
- (unsigned)geo.heads);
- return geo.heads;
+ if (dev->d_heads == -1) {
+ if (ntfs_device_get_geo(dev) == -1)
+ return -1;
+ if (dev->d_heads == -1) {
+ errno = EINVAL;
+ return -1;
}
}
-#else
- errno = EOPNOTSUPP;
-#endif
- return -1;
+ return dev->d_heads;
}
/**
@@ -631,6 +815,7 @@ int ntfs_device_heads_get(struct ntfs_device *dev)
* EINVAL Input parameter error
* EOPNOTSUPP System does not support HDIO_GETGEO ioctl
* ENOTTY @dev is a file or a device not supporting HDIO_GETGEO
+ * ENOMEM Not enough memory to complete the request
*/
int ntfs_device_sectors_per_track_get(struct ntfs_device *dev)
{
@@ -638,20 +823,15 @@ int ntfs_device_sectors_per_track_get(struct ntfs_device *dev)
errno = EINVAL;
return -1;
}
-#ifdef HDIO_GETGEO
- { struct hd_geometry geo;
-
- if (!dev->d_ops->ioctl(dev, HDIO_GETGEO, &geo)) {
- ntfs_log_debug("HDIO_GETGEO sectors_per_track = %u (0x%x)\n",
- (unsigned)geo.sectors,
- (unsigned)geo.sectors);
- return geo.sectors;
+ if (dev->d_sectors_per_track == -1) {
+ if (ntfs_device_get_geo(dev) == -1)
+ return -1;
+ if (dev->d_sectors_per_track == -1) {
+ errno = EINVAL;
+ return -1;
}
}
-#else
- errno = EOPNOTSUPP;
-#endif
- return -1;
+ return dev->d_sectors_per_track;
}
/**
@@ -682,6 +862,28 @@ int ntfs_device_sector_size_get(struct ntfs_device *dev)
return sect_size;
}
}
+#elif defined(DIOCGSECTORSIZE)
+ {
+ /* FreeBSD */
+ size_t sect_size = 0;
+
+ if (!dev->d_ops->ioctl(dev, DIOCGSECTORSIZE, &sect_size)) {
+ ntfs_log_debug("DIOCGSECTORSIZE sector size = %d bytes\n",
+ (int) sect_size);
+ return sect_size;
+ }
+ }
+#elif defined(DKIOCGETBLOCKSIZE)
+ {
+ /* Mac OS X */
+ uint32_t sect_size = 0;
+
+ if (!dev->d_ops->ioctl(dev, DKIOCGETBLOCKSIZE, &sect_size)) {
+ ntfs_log_debug("DKIOCGETBLOCKSIZE sector size = %d bytes\n",
+ (int) sect_size);
+ return sect_size;
+ }
+ }
#else
errno = EOPNOTSUPP;
#endif
diff --git a/libntfs-3g/dir.c b/libntfs-3g/dir.c
index 9c82765..2539586 100755
--- a/libntfs-3g/dir.c
+++ b/libntfs-3g/dir.c
@@ -253,10 +253,11 @@ u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni,
INDEX_ROOT *ir;
INDEX_ENTRY *ie;
INDEX_ALLOCATION *ia;
+ IGNORE_CASE_BOOL case_sensitivity;
u8 *index_end;
ntfs_attr *ia_na;
int eo, rc;
- u32 index_block_size, index_vcn_size;
+ u32 index_block_size;
u8 index_vcn_size_bits;
ntfs_log_trace("Entering\n");
@@ -277,6 +278,7 @@ u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni,
"%lld", (unsigned long long)dir_ni->mft_no);
goto put_err_out;
}
+ case_sensitivity = (NVolCaseSensitive(vol) ? CASE_SENSITIVE : IGNORE_CASE);
/* Get to the index root value. */
ir = (INDEX_ROOT*)((u8*)ctx->attr +
le16_to_cpu(ctx->attr->value_offset));
@@ -324,7 +326,7 @@ u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni,
rc = ntfs_names_full_collate(uname, uname_len,
(ntfschar*)&ie->key.file_name.file_name,
ie->key.file_name.file_name_length,
- CASE_SENSITIVE, vol->upcase, vol->upcase_len);
+ case_sensitivity, 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
@@ -354,7 +356,7 @@ u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni,
ntfs_attr_put_search_ctx(ctx);
if (mref)
return mref;
- ntfs_log_debug("Entry not found.\n");
+ ntfs_log_debug("Entry not found - between root entries.\n");
errno = ENOENT;
return -1;
} /* Child node present, descend into it. */
@@ -376,11 +378,9 @@ u64 ntfs_inode_lookup_by_name(ntfs_inode *dir_ni,
/* 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;
+ index_vcn_size_bits = NTFS_BLOCK_SIZE_BITS;
}
/* Get the starting vcn of the index_block holding the child node. */
@@ -466,7 +466,7 @@ descend_into_child_node:
rc = ntfs_names_full_collate(uname, uname_len,
(ntfschar*)&ie->key.file_name.file_name,
ie->key.file_name.file_name_length,
- CASE_SENSITIVE, vol->upcase, vol->upcase_len);
+ case_sensitivity, 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
@@ -545,51 +545,68 @@ u64 ntfs_inode_lookup_by_mbsname(ntfs_inode *dir_ni, const char *name)
int uname_len;
ntfschar *uname = (ntfschar*)NULL;
u64 inum;
+ char *cached_name;
+ const char *const_name;
+
+ if (!NVolCaseSensitive(dir_ni->vol)) {
+ cached_name = ntfs_uppercase_mbs(name,
+ dir_ni->vol->upcase, dir_ni->vol->upcase_len);
+ const_name = cached_name;
+ } else {
+ cached_name = (char*)NULL;
+ const_name = name;
+ }
+ if (const_name) {
#if CACHE_LOOKUP_SIZE
- struct CACHED_LOOKUP item;
- struct CACHED_LOOKUP *cached;
/*
* fetch inode from cache
*/
- if (dir_ni->vol->lookup_cache) {
- item.name = name;
- item.namesize = strlen(name) + 1;
- item.parent = dir_ni->mft_no;
- cached = (struct CACHED_LOOKUP*)ntfs_fetch_cache(
- dir_ni->vol->lookup_cache, GENERIC(&item),
- lookup_cache_compare);
- if (cached) {
- inum = cached->inum;
- if (inum == (u64)-1)
- errno = ENOENT;
- } else {
- /* Generate unicode name. */
- uname_len = ntfs_mbstoucs(name, &uname);
- if (uname_len >= 0) {
- inum = ntfs_inode_lookup_by_name(dir_ni,
- uname, uname_len);
- item.inum = inum;
+ if (dir_ni->vol->lookup_cache) {
+ struct CACHED_LOOKUP item;
+ struct CACHED_LOOKUP *cached;
+
+ item.name = const_name;
+ item.namesize = strlen(const_name) + 1;
+ item.parent = dir_ni->mft_no;
+ cached = (struct CACHED_LOOKUP*)ntfs_fetch_cache(
+ dir_ni->vol->lookup_cache,
+ GENERIC(&item), lookup_cache_compare);
+ if (cached) {
+ inum = cached->inum;
+ if (inum == (u64)-1)
+ errno = ENOENT;
+ } else {
+ /* Generate unicode name. */
+ uname_len = ntfs_mbstoucs(name, &uname);
+ if (uname_len >= 0) {
+ inum = ntfs_inode_lookup_by_name(dir_ni,
+ uname, uname_len);
+ item.inum = inum;
/* enter into cache, even if not found */
- ntfs_enter_cache(dir_ni->vol->lookup_cache,
+ ntfs_enter_cache(dir_ni->vol->lookup_cache,
GENERIC(&item),
lookup_cache_compare);
- free(uname);
- } else
+ free(uname);
+ } else
+ inum = (s64)-1;
+ }
+ } else
+#endif
+ {
+ /* Generate unicode name. */
+ uname_len = ntfs_mbstoucs(cached_name, &uname);
+ if (uname_len >= 0)
+ inum = ntfs_inode_lookup_by_name(dir_ni,
+ uname, uname_len);
+ else
inum = (s64)-1;
}
+ if (cached_name)
+ free(cached_name);
} else
-#endif
- {
- /* Generate unicode name. */
- uname_len = ntfs_mbstoucs(name, &uname);
- if (uname_len >= 0)
- inum = ntfs_inode_lookup_by_name(dir_ni,
- uname, uname_len);
- else
- inum = (s64)-1;
- }
+ inum = (s64)-1;
return (inum);
}
@@ -604,17 +621,29 @@ void ntfs_inode_update_mbsname(ntfs_inode *dir_ni, const char *name, u64 inum)
#if CACHE_LOOKUP_SIZE
struct CACHED_LOOKUP item;
struct CACHED_LOOKUP *cached;
+ char *cached_name;
if (dir_ni->vol->lookup_cache) {
- item.name = name;
- item.namesize = strlen(name) + 1;
- item.parent = dir_ni->mft_no;
- item.inum = inum;
- cached = (struct CACHED_LOOKUP*)ntfs_enter_cache(
+ if (!NVolCaseSensitive(dir_ni->vol)) {
+ cached_name = ntfs_uppercase_mbs(name,
+ dir_ni->vol->upcase, dir_ni->vol->upcase_len);
+ item.name = cached_name;
+ } else {
+ cached_name = (char*)NULL;
+ item.name = name;
+ }
+ if (item.name) {
+ item.namesize = strlen(item.name) + 1;
+ item.parent = dir_ni->mft_no;
+ item.inum = inum;
+ cached = (struct CACHED_LOOKUP*)ntfs_enter_cache(
dir_ni->vol->lookup_cache,
GENERIC(&item), lookup_cache_compare);
- if (cached)
- cached->inum = inum;
+ if (cached)
+ cached->inum = inum;
+ if (cached_name)
+ free(cached_name);
+ }
}
#endif
}
@@ -838,6 +867,87 @@ typedef enum {
INDEX_TYPE_ALLOCATION, /* index allocation */
} INDEX_TYPE;
+/*
+ * Decode Interix file types
+ *
+ * Non-Interix types are returned as plain files, because a
+ * Windows user may force patterns very similar to Interix,
+ * and most metadata files have such similar patters.
+ */
+
+static u32 ntfs_interix_types(ntfs_inode *ni)
+{
+ ntfs_attr *na;
+ u32 dt_type;
+ le64 magic;
+
+ dt_type = NTFS_DT_UNKNOWN;
+ na = ntfs_attr_open(ni, AT_DATA, NULL, 0);
+ if (na) {
+ /* Unrecognized patterns (eg HID + SYST) are plain files */
+ dt_type = NTFS_DT_REG;
+ if (na->data_size <= 1) {
+ if (!(ni->flags & FILE_ATTR_HIDDEN))
+ dt_type = (na->data_size ?
+ NTFS_DT_SOCK : NTFS_DT_FIFO);
+ } else {
+ if ((na->data_size >= (s64)sizeof(magic))
+ && (ntfs_attr_pread(na, 0, sizeof(magic), &magic)
+ == sizeof(magic))) {
+ if (magic == INTX_SYMBOLIC_LINK)
+ dt_type = NTFS_DT_LNK;
+ else if (magic == INTX_BLOCK_DEVICE)
+ dt_type = NTFS_DT_BLK;
+ else if (magic == INTX_CHARACTER_DEVICE)
+ dt_type = NTFS_DT_CHR;
+ }
+ }
+ ntfs_attr_close(na);
+ }
+ return (dt_type);
+}
+
+/*
+ * Decode file types
+ *
+ * Better only use for Interix types and junctions,
+ * unneeded complexity when used for plain files or directories
+ *
+ * Error cases are logged and returned as unknown.
+ */
+
+static u32 ntfs_dir_entry_type(ntfs_inode *dir_ni, MFT_REF mref,
+ FILE_ATTR_FLAGS attributes)
+{
+ ntfs_inode *ni;
+ u32 dt_type;
+
+ dt_type = NTFS_DT_UNKNOWN;
+ ni = ntfs_inode_open(dir_ni->vol, mref);
+ if (ni) {
+ if ((attributes & FILE_ATTR_REPARSE_POINT)
+ && ntfs_possible_symlink(ni))
+ dt_type = NTFS_DT_LNK;
+ else
+ if ((attributes & FILE_ATTR_SYSTEM)
+ && !(attributes & FILE_ATTR_I30_INDEX_PRESENT))
+ dt_type = ntfs_interix_types(ni);
+ else
+ dt_type = (attributes
+ & FILE_ATTR_I30_INDEX_PRESENT
+ ? NTFS_DT_DIR : NTFS_DT_REG);
+ if (ntfs_inode_close(ni)) {
+ /* anything special worth doing ? */
+ ntfs_log_error("Failed to close inode %lld\n",
+ (long long)MREF(mref));
+ }
+ }
+ if (dt_type == NTFS_DT_UNKNOWN)
+ ntfs_log_error("Could not decode the type of inode %lld\n",
+ (long long)MREF(mref));
+ return (dt_type);
+}
+
/**
* ntfs_filldir - ntfs specific filldir method
* @dir_ni: ntfs inode of current directory
@@ -858,6 +968,10 @@ static int ntfs_filldir(ntfs_inode *dir_ni, s64 *pos, u8 ivcn_bits,
{
FILE_NAME_ATTR *fn = &ie->key.file_name;
unsigned dt_type;
+ BOOL metadata;
+ ntfschar *loname;
+ int res;
+ MFT_REF mref;
ntfs_log_trace("Entering.\n");
@@ -868,18 +982,51 @@ static int ntfs_filldir(ntfs_inode *dir_ni, s64 *pos, u8 ivcn_bits,
dir_ni->vol->mft_record_size;
else /* if (index_type == INDEX_TYPE_ROOT) */
*pos = (u8*)ie - (u8*)iu.ir;
+ mref = le64_to_cpu(ie->indexed_file);
+ metadata = (MREF(mref) != FILE_root) && (MREF(mref) < FILE_first_user);
/* 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_I30_INDEX_PRESENT)
+ if ((ie->key.file_name.file_attributes
+ & (FILE_ATTR_REPARSE_POINT | FILE_ATTR_SYSTEM))
+ && !metadata)
+ dt_type = ntfs_dir_entry_type(dir_ni, mref,
+ ie->key.file_name.file_attributes);
+ else if (ie->key.file_name.file_attributes
+ & FILE_ATTR_I30_INDEX_PRESENT)
dt_type = NTFS_DT_DIR;
- else if (fn->file_attributes & FILE_ATTR_SYSTEM)
- dt_type = NTFS_DT_UNKNOWN;
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);
+
+ /* return metadata files and hidden files if requested */
+ if ((!metadata && (NVolShowHidFiles(dir_ni->vol)
+ || !(fn->file_attributes & FILE_ATTR_HIDDEN)))
+ || (NVolShowSysFiles(dir_ni->vol) && (NVolShowHidFiles(dir_ni->vol)
+ || metadata))) {
+ if (NVolCaseSensitive(dir_ni->vol)) {
+ res = filldir(dirent, fn->file_name,
+ fn->file_name_length,
+ fn->file_name_type, *pos,
+ mref, dt_type);
+ } else {
+ loname = (ntfschar*)ntfs_malloc(2*fn->file_name_length);
+ if (loname) {
+ memcpy(loname, fn->file_name,
+ 2*fn->file_name_length);
+ ntfs_name_locase(loname, fn->file_name_length,
+ dir_ni->vol->locase,
+ dir_ni->vol->upcase_len);
+ res = filldir(dirent, loname,
+ fn->file_name_length,
+ fn->file_name_type, *pos,
+ mref, dt_type);
+ free(loname);
+ } else
+ res = -1;
+ }
+ } else
+ res = 0;
+ return (res);
}
/**
@@ -975,7 +1122,7 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos,
INDEX_ENTRY *ie;
INDEX_ALLOCATION *ia = NULL;
int rc, ir_pos, bmp_buf_size, bmp_buf_pos, eo;
- u32 index_block_size, index_vcn_size;
+ u32 index_block_size;
u8 index_block_size_bits, index_vcn_size_bits;
ntfs_log_trace("Entering.\n");
@@ -1067,11 +1214,9 @@ int ntfs_readdir(ntfs_inode *dir_ni, s64 *pos,
}
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;
+ index_vcn_size_bits = NTFS_BLOCK_SIZE_BITS;
}
/* Are we jumping straight into the index allocation attribute? */
@@ -1337,8 +1482,8 @@ err_out:
* on error with errno set to the error code.
*/
static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, le32 securid,
- ntfschar *name, u8 name_len, mode_t type, dev_t dev,
- ntfschar *target, int target_len)
+ const ntfschar *name, u8 name_len, mode_t type, dev_t dev,
+ const ntfschar *target, int target_len)
{
ntfs_inode *ni;
int rollback_data = 0, rollback_sd = 0;
@@ -1397,7 +1542,20 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, le32 securid,
ni->flags = FILE_ATTR_SYSTEM;
}
ni->flags |= FILE_ATTR_ARCHIVE;
+ if (NVolHideDotFiles(dir_ni->vol)
+ && (name_len > 1)
+ && (name[0] == const_cpu_to_le16('.'))
+ && (name[1] != const_cpu_to_le16('.')))
+ ni->flags |= FILE_ATTR_HIDDEN;
+ /*
+ * Set compression flag according to parent directory
+ * unless NTFS version < 3.0 or cluster size > 4K
+ * or compression has been disabled
+ */
if ((dir_ni->flags & FILE_ATTR_COMPRESSED)
+ && (dir_ni->vol->major_ver >= 3)
+ && NVolCompression(dir_ni->vol)
+ && (dir_ni->vol->cluster_size <= MAX_COMPRESSION_CLUSTER_SIZE)
&& (S_ISREG(type) || S_ISDIR(type)))
ni->flags |= FILE_ATTR_COMPRESSED;
/* Add STANDARD_INFORMATION to inode. */
@@ -1440,7 +1598,7 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, le32 securid,
else
ir->clusters_per_index_block =
ni->vol->indx_record_size >>
- ni->vol->sector_size_bits;
+ NTFS_BLOCK_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);
@@ -1527,6 +1685,7 @@ static ntfs_inode *__ntfs_create(ntfs_inode *dir_ni, le32 securid,
else
fn->file_attributes |= ni->flags & FILE_ATTR_COMPRESSED;
fn->file_attributes |= FILE_ATTR_ARCHIVE;
+ fn->file_attributes |= ni->flags & FILE_ATTR_HIDDEN;
fn->creation_time = ni->creation_time;
fn->last_data_change_time = ni->last_data_change_time;
fn->last_mft_change_time = ni->last_mft_change_time;
@@ -1593,7 +1752,7 @@ err_out:
* Some wrappers around __ntfs_create() ...
*/
-ntfs_inode *ntfs_create(ntfs_inode *dir_ni, le32 securid, ntfschar *name,
+ntfs_inode *ntfs_create(ntfs_inode *dir_ni, le32 securid, const ntfschar *name,
u8 name_len, mode_t type)
{
if (type != S_IFREG && type != S_IFDIR && type != S_IFIFO &&
@@ -1605,7 +1764,7 @@ ntfs_inode *ntfs_create(ntfs_inode *dir_ni, le32 securid, ntfschar *name,
}
ntfs_inode *ntfs_create_device(ntfs_inode *dir_ni, le32 securid,
- ntfschar *name, u8 name_len, mode_t type, dev_t dev)
+ const ntfschar *name, u8 name_len, mode_t type, dev_t dev)
{
if (type != S_IFCHR && type != S_IFBLK) {
ntfs_log_error("Invalid arguments.\n");
@@ -1615,7 +1774,8 @@ ntfs_inode *ntfs_create_device(ntfs_inode *dir_ni, le32 securid,
}
ntfs_inode *ntfs_create_symlink(ntfs_inode *dir_ni, le32 securid,
- ntfschar *name, u8 name_len, ntfschar *target, int target_len)
+ const ntfschar *name, u8 name_len, const ntfschar *target,
+ int target_len)
{
if (!target || !target_len) {
ntfs_log_error("%s: Invalid argument (%p, %d)\n", __FUNCTION__,
@@ -1690,7 +1850,8 @@ no_hardlink:
* Return 0 on success or -1 on error with errno set to the error code.
*/
int ntfs_delete(ntfs_volume *vol, const char *pathname,
- ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len)
+ ntfs_inode *ni, ntfs_inode *dir_ni, const ntfschar *name,
+ u8 name_len)
{
ntfs_attr_search_ctx *actx = NULL;
FILE_NAME_ATTR *fn = NULL;
@@ -1734,7 +1895,7 @@ search:
while (!ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, CASE_SENSITIVE,
0, NULL, 0, actx)) {
char *s;
- BOOL case_sensitive = IGNORE_CASE;
+ IGNORE_CASE_BOOL case_sensitive = IGNORE_CASE;
errno = 0;
fn = (FILE_NAME_ATTR*)((u8*)actx->attr +
@@ -1766,8 +1927,9 @@ search:
(long long unsigned)MREF_LE(fn->parent_directory));
continue;
}
-
- if (fn->file_name_type == FILE_NAME_POSIX || case_sensitive_match)
+ if (case_sensitive_match
+ || ((fn->file_name_type == FILE_NAME_POSIX)
+ && NVolCaseSensitive(ni->vol)))
case_sensitive = CASE_SENSITIVE;
if (ntfs_names_are_equal(fn->file_name, fn->file_name_length,
@@ -1803,8 +1965,18 @@ search:
if (ntfs_index_remove(dir_ni, ni, fn, le32_to_cpu(actx->attr->value_length)))
goto err_out;
- if (ntfs_attr_record_rm(actx))
- goto err_out;
+ /*
+ * Keep the last name in place, this is useful for undeletion
+ * (Windows also does so), however delete the name if it were
+ * in an extent, to avoid leaving an attribute list.
+ */
+ if ((ni->mrec->link_count == cpu_to_le16(1)) && !actx->base_ntfs_ino) {
+ /* make sure to not loop to another search */
+ looking_for_dos_name = FALSE;
+ } else {
+ if (ntfs_attr_record_rm(actx))
+ goto err_out;
+ }
ni->mrec->link_count = cpu_to_le16(le16_to_cpu(
ni->mrec->link_count) - 1);
@@ -1927,6 +2099,7 @@ search:
"Leaving inconsistent metadata.\n");
}
#endif
+ debug_double_inode(ni->mft_no,0);
if (ntfs_mft_record_free(ni->vol, ni)) {
err = errno;
ntfs_log_error("Failed to free base MFT record. "
@@ -1969,7 +2142,7 @@ err_out:
*
* Return 0 on success or -1 on error with errno set to the error code.
*/
-static int ntfs_link_i(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name,
+static int ntfs_link_i(ntfs_inode *ni, ntfs_inode *dir_ni, const ntfschar *name,
u8 name_len, FILE_NAME_TYPE_FLAGS nametype)
{
FILE_NAME_ATTR *fn = NULL;
@@ -1989,6 +2162,15 @@ static int ntfs_link_i(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name,
err = EOPNOTSUPP;
goto err_out;
}
+ if (NVolHideDotFiles(dir_ni->vol)) {
+ /* Set hidden flag according to the latest name */
+ if ((name_len > 1)
+ && (name[0] == const_cpu_to_le16('.'))
+ && (name[1] != const_cpu_to_le16('.')))
+ ni->flags |= FILE_ATTR_HIDDEN;
+ else
+ ni->flags &= ~FILE_ATTR_HIDDEN;
+ }
/* Create FILE_NAME attribute. */
fn_len = sizeof(FILE_NAME_ATTR) + name_len * sizeof(ntfschar);
@@ -2046,7 +2228,8 @@ err_out:
return -1;
}
-int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, ntfschar *name, u8 name_len)
+int ntfs_link(ntfs_inode *ni, ntfs_inode *dir_ni, const ntfschar *name,
+ u8 name_len)
{
return (ntfs_link_i(ni, dir_ni, name, name_len, FILE_NAME_POSIX));
}
@@ -2097,6 +2280,8 @@ ntfs_inode *ntfs_dir_parent_inode(ntfs_inode *ni)
/*
* Get a DOS name for a file in designated directory
*
+ * Not allowed if there are several non-dos names (EMLINK)
+ *
* Returns size if found
* 0 if not found
* -1 if there was an error (described by errno)
@@ -2105,6 +2290,7 @@ ntfs_inode *ntfs_dir_parent_inode(ntfs_inode *ni)
static int get_dos_name(ntfs_inode *ni, u64 dnum, ntfschar *dosname)
{
size_t outsize = 0;
+ int namecount = 0;
FILE_NAME_ATTR *fn;
ntfs_attr_search_ctx *ctx;
@@ -2119,6 +2305,8 @@ static int get_dos_name(ntfs_inode *ni, u64 dnum, ntfschar *dosname)
fn = (FILE_NAME_ATTR*)((u8*)ctx->attr +
le16_to_cpu(ctx->attr->value_offset));
+ if (fn->file_name_type != FILE_NAME_DOS)
+ namecount++;
if ((fn->file_name_type & FILE_NAME_DOS)
&& (MREF_LE(fn->parent_directory) == dnum)) {
/*
@@ -2133,6 +2321,10 @@ static int get_dos_name(ntfs_inode *ni, u64 dnum, ntfschar *dosname)
}
}
ntfs_attr_put_search_ctx(ctx);
+ if ((outsize > 0) && (namecount > 1)) {
+ outsize = -1;
+ errno = EMLINK; /* this error implies there is a dos name */
+ }
return (outsize);
}
@@ -2140,6 +2332,8 @@ static int get_dos_name(ntfs_inode *ni, u64 dnum, ntfschar *dosname)
/*
* Get a long name for a file in designated directory
*
+ * Not allowed if there are several non-dos names (EMLINK)
+ *
* Returns size if found
* 0 if not found
* -1 if there was an error (described by errno)
@@ -2148,6 +2342,7 @@ static int get_dos_name(ntfs_inode *ni, u64 dnum, ntfschar *dosname)
static int get_long_name(ntfs_inode *ni, u64 dnum, ntfschar *longname)
{
size_t outsize = 0;
+ int namecount = 0;
FILE_NAME_ATTR *fn;
ntfs_attr_search_ctx *ctx;
@@ -2163,6 +2358,8 @@ static int get_long_name(ntfs_inode *ni, u64 dnum, ntfschar *longname)
fn = (FILE_NAME_ATTR*)((u8*)ctx->attr +
le16_to_cpu(ctx->attr->value_offset));
+ if (fn->file_name_type != FILE_NAME_DOS)
+ namecount++;
if ((fn->file_name_type & FILE_NAME_WIN32)
&& (MREF_LE(fn->parent_directory) == dnum)) {
/*
@@ -2173,6 +2370,11 @@ static int get_long_name(ntfs_inode *ni, u64 dnum, ntfschar *longname)
memcpy(longname,fn->file_name,outsize*sizeof(ntfschar));
}
}
+ if (namecount > 1) {
+ ntfs_attr_put_search_ctx(ctx);
+ errno = EMLINK;
+ return -1;
+ }
/* if not found search for POSIX names */
if (!outsize) {
ntfs_attr_reinit_search_ctx(ctx);
@@ -2249,7 +2451,7 @@ int ntfs_get_ntfs_dos_name(ntfs_inode *ni, ntfs_inode *dir_ni,
*/
static int set_namespace(ntfs_inode *ni, ntfs_inode *dir_ni,
- ntfschar *name, int len,
+ const ntfschar *name, int len,
FILE_NAME_TYPE_FLAGS nametype)
{
ntfs_attr_search_ctx *actx;
@@ -2323,9 +2525,9 @@ static int set_namespace(ntfs_inode *ni, ntfs_inode *dir_ni,
*/
static int set_dos_name(ntfs_inode *ni, ntfs_inode *dir_ni,
- ntfschar *shortname, int shortlen,
- ntfschar *longname, int longlen,
- ntfschar *deletename, int deletelen, BOOL existed)
+ const ntfschar *shortname, int shortlen,
+ const ntfschar *longname, int longlen,
+ const ntfschar *deletename, int deletelen, BOOL existed)
{
unsigned int linkcount;
ntfs_volume *vol;
@@ -2429,24 +2631,24 @@ int ntfs_set_ntfs_dos_name(ntfs_inode *ni, ntfs_inode *dir_ni,
int res = 0;
int longlen = 0;
int shortlen = 0;
- char newname[MAX_DOS_NAME_LENGTH + 1];
+ char newname[3*MAX_DOS_NAME_LENGTH + 1];
ntfschar oldname[MAX_DOS_NAME_LENGTH];
int oldlen;
- ntfs_volume *vol;
- u64 fnum;
u64 dnum;
BOOL closed = FALSE;
ntfschar *shortname = NULL;
ntfschar longname[NTFS_MAX_NAME_LEN];
- vol = ni->vol;
- fnum = ni->mft_no;
- /* convert the string to the NTFS wide chars */
- if (size > MAX_DOS_NAME_LENGTH)
- size = MAX_DOS_NAME_LENGTH;
+ /* copy the string to insert a null char, and truncate */
+ if (size > 3*MAX_DOS_NAME_LENGTH)
+ size = 3*MAX_DOS_NAME_LENGTH;
strncpy(newname, value, size);
+ /* a long name may be truncated badly and be untranslatable */
newname[size] = 0;
+ /* convert the string to the NTFS wide chars, and truncate */
shortlen = ntfs_mbstoucs(newname, &shortname);
+ if (shortlen > MAX_DOS_NAME_LENGTH)
+ shortlen = MAX_DOS_NAME_LENGTH;
/* make sure the short name has valid chars */
if ((shortlen < 0) || ntfs_forbidden_chars(shortname,shortlen)) {
ntfs_inode_close_in_dir(ni,dir_ni);
@@ -2493,7 +2695,8 @@ int ntfs_set_ntfs_dos_name(ntfs_inode *ni, ntfs_inode *dir_ni,
res = -1;
} else {
res = -1;
- errno = ENOENT;
+ if (!longlen)
+ errno = ENOENT;
}
free(shortname);
if (!closed) {
@@ -2569,7 +2772,8 @@ int ntfs_remove_ntfs_dos_name(ntfs_inode *ni, ntfs_inode *dir_ni)
}
}
} else {
- errno = ENOENT;
+ if (!longlen)
+ errno = ENOENT;
res = -1;
}
if (!deleted) {
diff --git a/libntfs-3g/efs.c b/libntfs-3g/efs.c
index 0af1a4d..7957005 100755
--- a/libntfs-3g/efs.c
+++ b/libntfs-3g/efs.c
@@ -4,7 +4,7 @@
* This module is part of ntfs-3g library
*
* Copyright (c) 2009 Martin Bene
- * Copyright (c) 2009 Jean-Pierre Andre
+ * Copyright (c) 2009-2010 Jean-Pierre Andre
*
* This program/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,6 +121,91 @@ int ntfs_get_efs_info(ntfs_inode *ni, char *value, size_t size)
}
/*
+ * Fix all encrypted AT_DATA attributes of an inode
+ *
+ * The fix may require making an attribute non resident, which
+ * requires more space in the MFT record, and may cause some
+ * attribute to be expelled and the full record to be reorganized.
+ * When this happens, the search for data attributes has to be
+ * reinitialized.
+ *
+ * Returns zero if successful.
+ * -1 if there is a problem.
+ */
+
+static int fixup_loop(ntfs_inode *ni)
+{
+ ntfs_attr_search_ctx *ctx;
+ ntfs_attr *na;
+ ATTR_RECORD *a;
+ BOOL restart;
+ int cnt;
+ int maxcnt;
+ int res = 0;
+
+ maxcnt = 0;
+ do {
+ restart = FALSE;
+ ctx = ntfs_attr_get_search_ctx(ni, NULL);
+ if (!ctx) {
+ ntfs_log_error("Failed to get ctx for efs\n");
+ res = -1;
+ }
+ cnt = 0;
+ while (!restart && !res
+ && !ntfs_attr_lookup(AT_DATA, NULL, 0,
+ CASE_SENSITIVE, 0, NULL, 0, ctx)) {
+ cnt++;
+ a = ctx->attr;
+ na = ntfs_attr_open(ctx->ntfs_ino, AT_DATA,
+ (ntfschar*)((u8*)a + le16_to_cpu(a->name_offset)),
+ a->name_length);
+ if (!na) {
+ ntfs_log_error("can't open DATA Attribute\n");
+ res = -1;
+ }
+ if (na && !(ctx->attr->flags & ATTR_IS_ENCRYPTED)) {
+ if (!NAttrNonResident(na)
+ && ntfs_attr_make_non_resident(na, ctx)) {
+ /*
+ * ntfs_attr_make_non_resident fails if there
+ * is not enough space in the MFT record.
+ * When this happens, force making non-resident
+ * so that some other attribute is expelled.
+ */
+ if (ntfs_attr_force_non_resident(na)) {
+ res = -1;
+ } else {
+ /* make sure there is some progress */
+ if (cnt <= maxcnt) {
+ errno = EIO;
+ ntfs_log_error("Multiple failure"
+ " making non resident\n");
+ res = -1;
+ } else {
+ ntfs_attr_put_search_ctx(ctx);
+ ctx = (ntfs_attr_search_ctx*)NULL;
+ restart = TRUE;
+ maxcnt = cnt;
+ }
+ }
+ }
+ if (!restart && !res
+ && ntfs_efs_fixup_attribute(ctx, na)) {
+ ntfs_log_error("Error in efs fixup of AT_DATA Attribute\n");
+ res = -1;
+ }
+ }
+ if (na)
+ ntfs_attr_close(na);
+ }
+ } while (restart && !res);
+ if (ctx)
+ ntfs_attr_put_search_ctx(ctx);
+ return (res);
+}
+
+/*
* Set the efs data from an extended attribute
* Warning : the new data is not checked
* Returns 0, or -1 if there is a problem
@@ -134,7 +219,6 @@ int ntfs_set_efs_info(ntfs_inode *ni, const char *value, size_t size,
int written;
ntfs_attr *na;
const EFS_ATTR_HEADER *info_header;
- ntfs_attr_search_ctx *ctx;
res = 0;
if (ni && value && size) {
@@ -210,20 +294,8 @@ int ntfs_set_efs_info(ntfs_inode *ni, const char *value, size_t size,
/* iterate over AT_DATA attributes */
/* set encrypted flag, truncate attribute to match padding bytes */
- ctx = ntfs_attr_get_search_ctx(ni, NULL);
- if (!ctx) {
- ntfs_log_error("Failed to get ctx for efs\n");
- return (-1);
- }
- while (!ntfs_attr_lookup(AT_DATA, NULL, 0,
- CASE_SENSITIVE, 0, NULL, 0, ctx)) {
- if (ntfs_efs_fixup_attribute(ctx, NULL)) {
- ntfs_log_error("Error in efs fixup of AT_DATA Attribute\n");
- ntfs_attr_put_search_ctx(ctx);
- return(-1);
- }
- }
- ntfs_attr_put_search_ctx(ctx);
+ if (fixup_loop(ni))
+ return -1;
}
ni->flags |= FILE_ATTR_ENCRYPTED;
NInoSetDirty(ni);
@@ -250,15 +322,14 @@ int ntfs_set_efs_info(ntfs_inode *ni, const char *value, size_t size,
int ntfs_efs_fixup_attribute(ntfs_attr_search_ctx *ctx, ntfs_attr *na)
{
u64 newsize;
+ u64 oldsize;
le16 appended_bytes;
u16 padding_length;
- ATTR_RECORD *a;
ntfs_inode *ni;
- BOOL close_na = FALSE;
BOOL close_ctx = FALSE;
- if (!ctx && !na) {
- ntfs_log_error("neither ctx nor na specified for efs_fixup_attribute\n");
+ if (!na) {
+ ntfs_log_error("no na specified for efs_fixup_attribute\n");
goto err_out;
}
if (!ctx) {
@@ -267,55 +338,79 @@ int ntfs_efs_fixup_attribute(ntfs_attr_search_ctx *ctx, ntfs_attr *na)
ntfs_log_error("Failed to get ctx for efs\n");
goto err_out;
}
- close_ctx=TRUE;
+ close_ctx = TRUE;
if (ntfs_attr_lookup(AT_DATA, na->name, na->name_len,
CASE_SENSITIVE, 0, NULL, 0, ctx)) {
ntfs_log_error("attr lookup for AT_DATA attribute failed in efs fixup\n");
goto err_out;
}
- }
-
- a = ctx->attr;
- if (!na) {
- na = ntfs_attr_open(ctx->ntfs_ino, AT_DATA,
- (ntfschar*)((u8*)a + le16_to_cpu(a->name_offset)),
- a->name_length);
- if (!na) {
- ntfs_log_error("can't open DATA Attribute\n");
- return (-1);
+ } else {
+ if (!NAttrNonResident(na)) {
+ ntfs_log_error("Cannot make non resident"
+ " when a context has been allocated\n");
+ goto err_out;
}
- close_na = TRUE;
}
+
+ /* no extra bytes are added to void attributes */
+ oldsize = na->data_size;
+ if (oldsize) {
/* make sure size is valid for a raw encrypted stream */
- if ((na->data_size & 511) != 2) {
- ntfs_log_error("Bad raw encrypted stream\n");
- goto err_out;
- }
- /* read padding length from last two bytes of attribute */
- if (ntfs_attr_pread(na, na->data_size-2, 2, &appended_bytes) != 2) {
- ntfs_log_error("Error reading padding length\n");
- goto err_out;
- }
- padding_length = le16_to_cpu(appended_bytes);
- if (padding_length > 511 || padding_length > na->data_size-2) {
- errno = EINVAL;
- ntfs_log_error("invalid padding length %d for data_size %lld\n",
- padding_length, (long long)na->data_size);
- goto err_out;
- }
- newsize = na->data_size - padding_length - 2;
- /* truncate attribute to possibly free clusters allocated
- for the last two bytes */
- if (ntfs_attr_truncate(na, na->data_size-2)) {
- ntfs_log_error("Error truncating attribute\n");
- goto err_out;
- }
+ if ((oldsize & 511) != 2) {
+ ntfs_log_error("Bad raw encrypted stream\n");
+ goto err_out;
+ }
+ /* read padding length from last two bytes of attribute */
+ if (ntfs_attr_pread(na, oldsize - 2, 2, &appended_bytes) != 2) {
+ ntfs_log_error("Error reading padding length\n");
+ goto err_out;
+ }
+ padding_length = le16_to_cpu(appended_bytes);
+ if (padding_length > 511 || padding_length > na->data_size-2) {
+ errno = EINVAL;
+ ntfs_log_error("invalid padding length %d for data_size %lld\n",
+ padding_length, (long long)oldsize);
+ goto err_out;
+ }
+ newsize = oldsize - padding_length - 2;
+ /*
+ * truncate attribute to possibly free clusters allocated
+ * for the last two bytes, but do not truncate to new size
+ * to avoid losing useful data
+ */
+ if (ntfs_attr_truncate(na, oldsize - 2)) {
+ ntfs_log_error("Error truncating attribute\n");
+ goto err_out;
+ }
+ } else
+ newsize = 0;
- /* Encrypted AT_DATA Attributes MUST be non-resident */
+ /*
+ * Encrypted AT_DATA Attributes MUST be non-resident
+ * This has to be done after the attribute is resized, as
+ * resizing down to zero may cause the attribute to be made
+ * resident.
+ */
if (!NAttrNonResident(na)
- && ntfs_attr_make_non_resident(na, ctx)) {
- ntfs_log_error("Error making DATA attribute non-resident\n");
- goto err_out;
+ && ntfs_attr_make_non_resident(na, ctx)) {
+ if (!close_ctx
+ || ntfs_attr_force_non_resident(na)) {
+ ntfs_log_error("Error making DATA attribute non-resident\n");
+ goto err_out;
+ } else {
+ /*
+ * must reinitialize context after forcing
+ * non-resident. We need a context for updating
+ * the state, and at this point, we are sure
+ * the context is not used elsewhere.
+ */
+ ntfs_attr_reinit_search_ctx(ctx);
+ if (ntfs_attr_lookup(AT_DATA, na->name, na->name_len,
+ CASE_SENSITIVE, 0, NULL, 0, ctx)) {
+ ntfs_log_error("attr lookup for AT_DATA attribute failed in efs fixup\n");
+ goto err_out;
+ }
+ }
}
ni = na->ni;
if (!na->name_len) {
@@ -324,8 +419,6 @@ int ntfs_efs_fixup_attribute(ntfs_attr_search_ctx *ctx, ntfs_attr *na)
}
NInoSetDirty(ni);
NInoFileNameSetDirty(ni);
- if (close_na)
- ntfs_attr_close(na);
ctx->attr->data_size = cpu_to_le64(newsize);
if (le64_to_cpu(ctx->attr->initialized_size) > newsize)
@@ -336,8 +429,6 @@ int ntfs_efs_fixup_attribute(ntfs_attr_search_ctx *ctx, ntfs_attr *na)
return (0);
err_out:
- if (close_na && na)
- ntfs_attr_close(na);
if (close_ctx && ctx)
ntfs_attr_put_search_ctx(ctx);
return (-1);
diff --git a/libntfs-3g/index.c b/libntfs-3g/index.c
index 7df0dee..d498dde 100755
--- a/libntfs-3g/index.c
+++ b/libntfs-3g/index.c
@@ -701,7 +701,7 @@ int ntfs_index_lookup(const void *key, const int key_len, ntfs_index_context *ic
if (ni->vol->cluster_size <= icx->block_size)
icx->vcn_size_bits = ni->vol->cluster_size_bits;
else
- icx->vcn_size_bits = ni->vol->sector_size_bits;
+ icx->vcn_size_bits = NTFS_BLOCK_SIZE_BITS;
/* get the appropriate collation function */
icx->collate = ntfs_get_collate_function(ir->collation_rule);
if (!icx->collate) {
@@ -1121,6 +1121,7 @@ static int ntfs_ir_reparent(ntfs_index_context *icx)
INDEX_ENTRY *ie;
INDEX_BLOCK *ib = NULL;
VCN new_ib_vcn;
+ int ix_root_size;
int ret = STATUS_ERROR;
ntfs_log_trace("Entering\n");
@@ -1150,6 +1151,7 @@ static int ntfs_ir_reparent(ntfs_index_context *icx)
if (ntfs_ib_write(icx, ib))
goto clear_bmp;
+retry :
ir = ntfs_ir_lookup(icx->ni, icx->name, icx->name_len, &ctx);
if (!ir)
goto clear_bmp;
@@ -1164,12 +1166,32 @@ static int ntfs_ir_reparent(ntfs_index_context *icx)
ir->index.index_length = cpu_to_le32(le32_to_cpu(ir->index.entries_offset)
+ le16_to_cpu(ie->length));
ir->index.allocated_size = ir->index.index_length;
-
+ ix_root_size = sizeof(INDEX_ROOT) - sizeof(INDEX_HEADER)
+ + le32_to_cpu(ir->index.allocated_size);
if (ntfs_resident_attr_value_resize(ctx->mrec, ctx->attr,
- sizeof(INDEX_ROOT) - sizeof(INDEX_HEADER) +
- le32_to_cpu(ir->index.allocated_size)))
+ ix_root_size)) {
+ /*
+ * When there is no space to build a non-resident
+ * index, we may have to move the root to an extent
+ */
+ if ((errno == ENOSPC)
+ && !ctx->al_entry
+ && !ntfs_inode_add_attrlist(icx->ni)) {
+ ntfs_attr_put_search_ctx(ctx);
+ ctx = (ntfs_attr_search_ctx*)NULL;
+ ir = ntfs_ir_lookup(icx->ni, icx->name, icx->name_len,
+ &ctx);
+ if (ir
+ && !ntfs_attr_record_move_away(ctx, ix_root_size
+ - le32_to_cpu(ctx->attr->value_length))) {
+ ntfs_attr_put_search_ctx(ctx);
+ ctx = (ntfs_attr_search_ctx*)NULL;
+ goto retry;
+ }
+ }
/* FIXME: revert index root */
goto clear_bmp;
+ }
/*
* FIXME: do it earlier if we have enough space in IR (should always),
* so in error case we wouldn't lose the IB.
diff --git a/libntfs-3g/inode.c b/libntfs-3g/inode.c
index 6f3fa06..a4a0134 100755
--- a/libntfs-3g/inode.c
+++ b/libntfs-3g/inode.c
@@ -437,13 +437,12 @@ static int idata_cache_compare(const struct CACHED_GENERIC *cached,
void ntfs_inode_invalidate(ntfs_volume *vol, const MFT_REF mref)
{
struct CACHED_NIDATA item;
- int count;
item.inum = MREF(mref);
item.ni = (ntfs_inode*)NULL;
item.pathname = (const char*)NULL;
item.varsize = 0;
- count = ntfs_invalidate_cache(vol->nidata_cache,
+ ntfs_invalidate_cache(vol->nidata_cache,
GENERIC(&item),idata_cache_compare,CACHE_FREE);
}
@@ -481,6 +480,9 @@ ntfs_inode *ntfs_inode_open(ntfs_volume *vol, const MFT_REF mref)
} else {
ni = ntfs_inode_real_open(vol, mref);
}
+ if (!ni) {
+ debug_double_inode(item.inum, 0);
+ }
#else
ni = ntfs_inode_real_open(vol, mref);
#endif
@@ -571,6 +573,9 @@ int ntfs_inode_close(ntfs_inode *ni)
ntfs_inode *ntfs_extent_inode_open(ntfs_inode *base_ni, const MFT_REF mref)
{
u64 mft_no = MREF_LE(mref);
+ VCN extent_vcn;
+ runlist_element *rl;
+ ntfs_volume *vol;
ntfs_inode *ni = NULL;
ntfs_inode **extent_nis;
int i;
@@ -585,6 +590,37 @@ ntfs_inode *ntfs_extent_inode_open(ntfs_inode *base_ni, const MFT_REF mref)
(unsigned long long)mft_no,
(unsigned long long)base_ni->mft_no);
+ if (!base_ni->mft_no) {
+ /*
+ * When getting extents of MFT, we must be sure
+ * they are in the MFT part which has already
+ * been mapped, otherwise we fall into an endless
+ * recursion.
+ * Situations have been met where extents locations
+ * are described in themselves.
+ * This is a severe error which chkdsk cannot fix.
+ */
+ vol = base_ni->vol;
+ extent_vcn = mft_no << vol->mft_record_size_bits
+ >> vol->cluster_size_bits;
+ rl = vol->mft_na->rl;
+ if (rl) {
+ while (rl->length
+ && ((rl->vcn + rl->length) <= extent_vcn))
+ rl++;
+ }
+ if (!rl || (rl->lcn < 0)) {
+ ntfs_log_error("MFT is corrupt, cannot read"
+ " its unmapped extent record %lld\n",
+ (long long)mft_no);
+ ntfs_log_error("Note : chkdsk cannot fix this,"
+ " try ntfsfix\n");
+ errno = EIO;
+ ni = (ntfs_inode*)NULL;
+ goto out;
+ }
+ }
+
/* Is the extent inode already open and attached to the base inode? */
if (base_ni->nr_extents > 0) {
extent_nis = base_ni->extent_nis;
@@ -842,6 +878,12 @@ static int ntfs_inode_sync_file_name(ntfs_inode *ni, ntfs_inode *dir_ni)
else {
fnx->allocated_size = cpu_to_sle64(ni->allocated_size);
fnx->data_size = cpu_to_sle64(ni->data_size);
+ /*
+ * The file name record has also to be fixed if some
+ * attribute update implied the unnamed data to be
+ * made non-resident
+ */
+ fn->allocated_size = fnx->allocated_size;
}
/* update or clear the reparse tag in the index */
fnx->reparse_point_tag = reparse_tag;
diff --git a/libntfs-3g/lcnalloc.c b/libntfs-3g/lcnalloc.c
index 9eb907c..e84d243 100755
--- a/libntfs-3g/lcnalloc.c
+++ b/libntfs-3g/lcnalloc.c
@@ -609,6 +609,42 @@ out:
return ret;
}
+/*
+ * Basic cluster run free
+ * Returns 0 if successful
+ */
+
+int ntfs_cluster_free_basic(ntfs_volume *vol, s64 lcn, s64 count)
+{
+ s64 nr_freed = 0;
+ int ret = -1;
+
+ ntfs_log_trace("Entering.\n");
+ ntfs_log_trace("Dealloc lcn 0x%llx, len 0x%llx.\n",
+ (long long)lcn, (long long)count);
+
+ if (lcn >= 0) {
+ update_full_status(vol,lcn);
+ if (ntfs_bitmap_clear_run(vol->lcnbmp_na, lcn,
+ count)) {
+ ntfs_log_perror("Cluster deallocation failed "
+ "(%lld, %lld)",
+ (long long)lcn,
+ (long long)count);
+ goto out;
+ }
+ nr_freed += count;
+ }
+ ret = 0;
+out:
+ vol->free_clusters += nr_freed;
+ if (vol->free_clusters > vol->nr_clusters)
+ ntfs_log_error("Too many free clusters (%lld > %lld)!",
+ (long long)vol->free_clusters,
+ (long long)vol->nr_clusters);
+ return ret;
+}
+
/**
* ntfs_cluster_free - free clusters on an ntfs volume
* @vol: mounted ntfs volume on which to free the clusters
diff --git a/libntfs-3g/libntfs-3g.pc b/libntfs-3g/libntfs-3g.pc
new file mode 100644
index 0000000..efe2eb0
--- a/dev/null
+++ b/libntfs-3g/libntfs-3g.pc
@@ -0,0 +1,10 @@
+prefix=/usr/local
+exec_prefix=${prefix}
+libdir=${exec_prefix}/lib
+includedir=${prefix}/include
+
+Name: libntfs-3g
+Description: NTFS-3G Read/Write Driver Library
+Version: 2014.2.15
+Cflags: -I${includedir}
+Libs: -lpthread -L${libdir} -lntfs-3g
diff --git a/libntfs-3g/libntfs-3g.script.so b/libntfs-3g/libntfs-3g.script.so
new file mode 100644
index 0000000..736d8eb
--- a/dev/null
+++ b/libntfs-3g/libntfs-3g.script.so
@@ -0,0 +1,2 @@
+
+GROUP ( /lib/libntfs-3g.so )
diff --git a/libntfs-3g/logfile.c b/libntfs-3g/logfile.c
index 277ad14..336bdd2 100755
--- a/libntfs-3g/logfile.c
+++ b/libntfs-3g/logfile.c
@@ -84,13 +84,21 @@ static BOOL ntfs_check_restart_page_header(RESTART_PAGE_HEADER *rp, s64 pos)
"position in $LogFile.\n");
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) {
+ /*
+ * We only know how to handle version 1.1 and 2.0, though
+ * version 2.0 is probably related to cached metadata in
+ * Windows 8, and we will refuse to mount.
+ * Nevertheless, do all the relevant checks before rejecting.
+ */
+ if (((rp->major_ver != const_cpu_to_le16(1))
+ || (rp->minor_ver != const_cpu_to_le16(1)))
+ && ((rp->major_ver != const_cpu_to_le16(2))
+ || (rp->minor_ver != const_cpu_to_le16(0)))) {
ntfs_log_error("$LogFile version %i.%i is not "
- "supported. (This driver supports version "
- "1.1 only.)\n", (int)sle16_to_cpu(rp->major_ver),
- (int)sle16_to_cpu(rp->minor_ver));
+ "supported.\n (This driver supports version "
+ "1.1 and 2.0 only.)\n",
+ (int)sle16_to_cpu(rp->major_ver),
+ (int)sle16_to_cpu(rp->minor_ver));
return FALSE;
}
/*
@@ -468,7 +476,7 @@ BOOL ntfs_check_logfile(ntfs_attr *log_na, RESTART_PAGE_HEADER **rp)
u8 *kaddr = NULL;
RESTART_PAGE_HEADER *rstr1_ph = NULL;
RESTART_PAGE_HEADER *rstr2_ph = NULL;
- int log_page_size, log_page_mask, err;
+ int log_page_size, err;
BOOL logfile_is_empty = TRUE;
u8 log_page_bits;
@@ -481,7 +489,6 @@ BOOL ntfs_check_logfile(ntfs_attr *log_na, RESTART_PAGE_HEADER **rp)
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.
diff --git a/libntfs-3g/logging.c b/libntfs-3g/logging.c
index 385bcaa..ccccbb8 100755
--- a/libntfs-3g/logging.c
+++ b/libntfs-3g/logging.c
@@ -3,6 +3,7 @@
*
* Copyright (c) 2005 Richard Russon
* Copyright (c) 2005-2008 Szabolcs Szakacsits
+ * Copyright (c) 2010 Jean-Pierre Andre
*
* This program/include file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
@@ -388,6 +389,29 @@ out:
}
#endif
+/*
+ * Early logging before the logs are redirected
+ *
+ * (not quite satisfactory : this appears before the ntfs-g banner,
+ * and with a different pid)
+ */
+
+void ntfs_log_early_error(const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+#ifdef HAVE_SYSLOG_H
+ openlog("ntfs-3g", LOG_PID, LOG_USER);
+ ntfs_log_handler_syslog(NULL, NULL, 0,
+ NTFS_LOG_LEVEL_ERROR, NULL,
+ format, args);
+#else
+ vfprintf(stderr,format,args);
+#endif
+ va_end(args);
+}
+
/**
* ntfs_log_handler_fprintf - Basic logging handler
* @function: Function in which the log line occurred
diff --git a/libntfs-3g/mft.c b/libntfs-3g/mft.c
index e93c664..0640efe 100755
--- a/libntfs-3g/mft.c
+++ b/libntfs-3g/mft.c
@@ -216,8 +216,10 @@ int ntfs_mft_record_check(const ntfs_volume *vol, const MFT_REF mref,
int ret = -1;
if (!ntfs_is_file_record(m->magic)) {
- ntfs_log_error("Record %llu has no FILE magic (0x%x)\n",
- (unsigned long long)MREF(mref), *(le32 *)m);
+ if (!NVolNoFixupWarn(vol))
+ ntfs_log_error("Record %llu has no FILE magic (0x%x)\n",
+ (unsigned long long)MREF(mref),
+ (int)le32_to_cpu(*(le32*)m));
goto err_out;
}
@@ -1190,7 +1192,7 @@ undo_alloc:
static int ntfs_mft_record_init(ntfs_volume *vol, s64 size)
{
int ret = -1;
- ntfs_attr *mft_na, *mftbmp_na;
+ ntfs_attr *mft_na;
s64 old_data_initialized, old_data_size;
ntfs_attr_search_ctx *ctx;
@@ -1199,7 +1201,6 @@ static int ntfs_mft_record_init(ntfs_volume *vol, s64 size)
/* NOTE: Caller must sanity check vol, vol->mft_na and vol->mftbmp_na */
mft_na = vol->mft_na;
- mftbmp_na = vol->mftbmp_na;
/*
* The mft record is outside the initialized data. Extend the mft data
@@ -1295,14 +1296,13 @@ undo_data_init:
static int ntfs_mft_rec_init(ntfs_volume *vol, s64 size)
{
int ret = -1;
- ntfs_attr *mft_na, *mftbmp_na;
+ ntfs_attr *mft_na;
s64 old_data_initialized, old_data_size;
ntfs_attr_search_ctx *ctx;
ntfs_log_enter("Entering\n");
mft_na = vol->mft_na;
- mftbmp_na = vol->mftbmp_na;
if (size > mft_na->allocated_size || size > mft_na->initialized_size) {
errno = EIO;
diff --git a/libntfs-3g/mst.c b/libntfs-3g/mst.c
index 470942d..b7937b7 100755
--- a/libntfs-3g/mst.c
+++ b/libntfs-3g/mst.c
@@ -47,7 +47,8 @@
* 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)
+int ntfs_mst_post_read_fixup_warn(NTFS_RECORD *b, const u32 size,
+ BOOL warn)
{
u16 usa_ofs, usa_count, usn;
u16 *usa_pos, *data_pos;
@@ -63,9 +64,14 @@ int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size)
(u32)(usa_ofs + (usa_count * 2)) > size ||
(size >> NTFS_BLOCK_SIZE_BITS) != usa_count) {
errno = EINVAL;
- ntfs_log_perror("%s: magic: 0x%08x size: %d usa_ofs: %d "
- "usa_count: %d", __FUNCTION__, *(le32 *)b,
- size, usa_ofs, usa_count);
+ if (warn) {
+ ntfs_log_perror("%s: magic: 0x%08lx size: %ld "
+ " usa_ofs: %d usa_count: %u",
+ __FUNCTION__,
+ (long)le32_to_cpu(*(le32 *)b),
+ (long)size, (int)usa_ofs,
+ (unsigned int)usa_count);
+ }
return -1;
}
/* Position of usn in update sequence array. */
@@ -118,6 +124,16 @@ int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size)
return 0;
}
+/*
+ * Deprotect multi sector transfer protected data
+ * with a warning if an error is found.
+ */
+
+int ntfs_mst_post_read_fixup(NTFS_RECORD *b, const u32 size)
+{
+ return (ntfs_mst_post_read_fixup_warn(b,size,TRUE));
+}
+
/**
* ntfs_mst_pre_write_fixup - apply multi sector transfer protection
* @b: pointer to the data to protect
diff --git a/libntfs-3g/object_id.c b/libntfs-3g/object_id.c
index 555dd13..299357e 100755
--- a/libntfs-3g/object_id.c
+++ b/libntfs-3g/object_id.c
@@ -46,6 +46,7 @@
#include <sys/sysmacros.h>
#endif
+#include "compat.h"
#include "types.h"
#include "debug.h"
#include "attrib.h"
@@ -107,7 +108,11 @@
*/
typedef struct {
- GUID object_id;
+ union {
+ /* alignment may be needed to evaluate collations */
+ u32 alignment;
+ GUID guid;
+ } object_id;
} OBJECT_ID_INDEX_KEY;
typedef struct {
@@ -283,7 +288,6 @@ static int remove_object_id_index(ntfs_attr *na, ntfs_index_context *xo,
if (size >= (s64)sizeof(GUID)) {
memcpy(&key.object_id,
&old_attr->object_id,sizeof(GUID));
- size = sizeof(GUID);
if (!ntfs_index_lookup(&key,
sizeof(OBJECT_ID_INDEX_KEY), xo)) {
entry = (struct OBJECT_ID_INDEX*)xo->entry;
@@ -296,7 +300,6 @@ static int remove_object_id_index(ntfs_attr *na, ntfs_index_context *xo,
memcpy(&old_attr->domain_id,
&entry->data.domain_id,
sizeof(GUID));
- size = sizeof(OBJECT_ID_ATTR);
if (ntfs_index_rm(xo))
ret = -1;
}
diff --git a/libntfs-3g/realpath.c b/libntfs-3g/realpath.c
new file mode 100755
index 0000000..a93bc69
--- a/dev/null
+++ b/libntfs-3g/realpath.c
@@ -0,0 +1,103 @@
+/*
+ * realpath.c - realpath() aware of device mapper
+ * Originated from the util-linux project.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_CTYPE_H
+#include <ctype.h>
+#endif
+
+#include "param.h"
+#include "realpath.h"
+
+/* If there is no realpath() on the system, provide a dummy one. */
+#ifndef HAVE_REALPATH
+char *ntfs_realpath(const char *path, char *resolved_path)
+{
+ strncpy(resolved_path, path, PATH_MAX);
+ resolved_path[PATH_MAX] = '\0';
+ return resolved_path;
+}
+#endif
+
+
+#ifdef linux
+
+/*
+ * Converts private "dm-N" names to "/dev/mapper/<name>"
+ *
+ * Since 2.6.29 (patch 784aae735d9b0bba3f8b9faef4c8b30df3bf0128) kernel sysfs
+ * provides the real DM device names in /sys/block/<ptname>/dm/name
+ */
+static char *
+canonicalize_dm_name(const char *ptname, char *canonical)
+{
+ FILE *f;
+ size_t sz;
+ char path[MAPPERNAMELTH + 24];
+ char name[MAPPERNAMELTH + 16];
+ char *res = NULL;
+
+ snprintf(path, sizeof(path), "/sys/block/%s/dm/name", ptname);
+ if (!(f = fopen(path, "r")))
+ return NULL;
+
+ /* read "<name>\n" from sysfs */
+ if (fgets(name, sizeof(name), f) && (sz = strlen(name)) > 1) {
+ name[sz - 1] = '\0';
+ snprintf(path, sizeof(path), "/dev/mapper/%s", name);
+ res = strcpy(canonical, path);
+ }
+ fclose(f);
+ return res;
+}
+
+/*
+ * Canonicalize a device path
+ *
+ * Workaround from "basinilya" for fixing device mapper paths.
+ *
+ * Background (Phillip Susi, 2011-04-09)
+ * - ntfs-3g canonicalizes the device name so that if you mount with
+ * /dev/mapper/foo, the device name listed in mtab is /dev/dm-n,
+ * so you can not umount /dev/mapper/foo
+ * - umount won't even recognize and translate /dev/dm-n to the mount
+ * point, apparently because of the '-' involved. Editing mtab and
+ * removing the '-' allows you to umount /dev/dmn successfully.
+ *
+ * This code restores the devmapper name after canonicalization,
+ * until a proper fix is implemented.
+ */
+
+char *ntfs_realpath_canonicalize(const char *path, char *canonical)
+{
+ char *p;
+
+ if (path == NULL)
+ return NULL;
+
+ if (!ntfs_realpath(path, canonical))
+ return NULL;
+
+ p = strrchr(canonical, '/');
+ if (p && strncmp(p, "/dm-", 4) == 0 && isdigit(*(p + 4))) {
+ p = canonicalize_dm_name(p+1, canonical);
+ if (p)
+ return p;
+ }
+
+ return canonical;
+}
+
+#endif
diff --git a/libntfs-3g/reparse.c b/libntfs-3g/reparse.c
index 0f6360e..cdabadd 100755
--- a/libntfs-3g/reparse.c
+++ b/libntfs-3g/reparse.c
@@ -3,7 +3,7 @@
*
* This module is part of ntfs-3g library
*
- * Copyright (c) 2008-2009 Jean-Pierre Andre
+ * Copyright (c) 2008-2013 Jean-Pierre Andre
*
* This program/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,8 +46,10 @@
#include <sys/sysmacros.h>
#endif
+#include "compat.h"
#include "types.h"
#include "debug.h"
+#include "layout.h"
#include "attrib.h"
#include "inode.h"
#include "dir.h"
@@ -59,18 +61,6 @@
#include "misc.h"
#include "reparse.h"
-/* the definitions in layout.h are wrong, we use names defined in
- http://msdn.microsoft.com/en-us/library/aa365740(VS.85).aspx
-*/
-
-#define IO_REPARSE_TAG_DFS const_cpu_to_le32(0x8000000A)
-#define IO_REPARSE_TAG_DFSR const_cpu_to_le32(0x80000012)
-#define IO_REPARSE_TAG_HSM const_cpu_to_le32(0xC0000004)
-#define IO_REPARSE_TAG_HSM2 const_cpu_to_le32(0x80000006)
-#define IO_REPARSE_TAG_MOUNT_POINT const_cpu_to_le32(0xA0000003)
-#define IO_REPARSE_TAG_SIS const_cpu_to_le32(0x80000007)
-#define IO_REPARSE_TAG_SYMLINK const_cpu_to_le32(0xA000000C)
-
struct MOUNT_POINT_REPARSE_DATA { /* reparse data for junctions */
le16 subst_name_offset;
le16 subst_name_length;
@@ -200,8 +190,13 @@ static u64 ntfs_fix_file_name(ntfs_inode *dir_ni, ntfschar *uname,
*/
lemref = entry->indexed_file;
mref = le64_to_cpu(lemref);
- for (i=0; i<found->file_name_length; i++)
- uname[i] = found->file_name[i];
+ if (NVolCaseSensitive(vol) || !vol->locase) {
+ for (i=0; i<found->file_name_length; i++)
+ uname[i] = found->file_name[i];
+ } else {
+ for (i=0; i<found->file_name_length; i++)
+ uname[i] = vol->locase[found->file_name[i]];
+ }
}
}
ntfs_index_ctx_put(icx);
@@ -230,6 +225,17 @@ static char *search_absolute(ntfs_volume *vol, ntfschar *path,
ni = ntfs_inode_open(vol, (MFT_REF)FILE_root);
if (ni) {
start = 0;
+ /*
+ * Examine and translate the path, until we reach either
+ * - the end,
+ * - an unknown item
+ * - a non-directory
+ * - another reparse point,
+ * A reparse point is not dereferenced, it will be
+ * examined later when the translated path is dereferenced,
+ * however the final part of the path will not be adjusted
+ * to correct case.
+ */
do {
len = 0;
while (((start + len) < count)
@@ -247,9 +253,11 @@ static char *search_absolute(ntfs_volume *vol, ntfschar *path,
}
} while (ni
&& (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY)
+ && !(ni->flags & FILE_ATTR_REPARSE_POINT)
&& (start < count));
if (ni
- && (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY ? isdir : !isdir))
+ && ((ni->mrec->flags & MFT_RECORD_IS_DIRECTORY ? isdir : !isdir)
+ || (ni->flags & FILE_ATTR_REPARSE_POINT)))
if (ntfs_ucstombs(path, count, &target, 0) < 0) {
if (target) {
free(target);
@@ -283,23 +291,36 @@ static char *search_relative(ntfs_inode *ni, ntfschar *path, int count)
int pos;
int lth;
BOOL ok;
+ BOOL morelinks;
int max = 32; /* safety */
pos = 0;
ok = TRUE;
+ morelinks = FALSE;
curni = ntfs_dir_parent_inode(ni);
- while (curni && ok && (pos < (count - 1)) && --max) {
+ /*
+ * Examine and translate the path, until we reach either
+ * - the end,
+ * - an unknown item
+ * - a non-directory
+ * - another reparse point,
+ * A reparse point is not dereferenced, it will be
+ * examined later when the translated path is dereferenced,
+ * however the final part of the path will not be adjusted
+ * to correct case.
+ */
+ while (curni && ok && !morelinks && (pos < (count - 1)) && --max) {
if ((count >= (pos + 2))
&& (path[pos] == const_cpu_to_le16('.'))
&& (path[pos+1] == const_cpu_to_le16('\\'))) {
- path[1] = const_cpu_to_le16('/');
+ path[pos+1] = const_cpu_to_le16('/');
pos += 2;
} else {
if ((count >= (pos + 3))
&& (path[pos] == const_cpu_to_le16('.'))
&&(path[pos+1] == const_cpu_to_le16('.'))
&& (path[pos+2] == const_cpu_to_le16('\\'))) {
- path[2] = const_cpu_to_le16('/');
+ path[pos+2] = const_cpu_to_le16('/');
pos += 3;
newni = ntfs_dir_parent_inode(curni);
if (curni != ni)
@@ -326,12 +347,18 @@ static char *search_relative(ntfs_inode *ni, ntfschar *path, int count)
if (!curni)
ok = FALSE;
else {
+ if (curni->flags & FILE_ATTR_REPARSE_POINT)
+ morelinks = TRUE;
if (ok && ((pos + lth) < count)) {
path[pos + lth] = const_cpu_to_le16('/');
pos += lth + 1;
+ if (morelinks
+ && ntfs_inode_close(curni))
+ ok = FALSE;
} else {
pos += lth;
- if ((ni->mrec->flags ^ curni->mrec->flags)
+ if (!morelinks
+ && (ni->mrec->flags ^ curni->mrec->flags)
& MFT_RECORD_IS_DIRECTORY)
ok = FALSE;
if (ntfs_inode_close(curni))
diff --git a/libntfs-3g/runlist.c b/libntfs-3g/runlist.c
index 6c99e8e..7e158d4 100755
--- a/libntfs-3g/runlist.c
+++ b/libntfs-3g/runlist.c
@@ -5,7 +5,7 @@
* Copyright (c) 2002-2005 Richard Russon
* Copyright (c) 2002-2008 Szabolcs Szakacsits
* Copyright (c) 2004 Yura Pakhuchiy
- * Copyright (c) 2007-2009 Jean-Pierre Andre
+ * Copyright (c) 2007-2010 Jean-Pierre Andre
*
* This program/include file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
@@ -117,18 +117,34 @@ static runlist_element *ntfs_rl_realloc(runlist_element *rl, int old_size,
*
* Returns the reallocated runlist
* or NULL if reallocation was not possible (with errno set)
+ * the runlist is left unchanged if the reallocation fails
*/
-runlist_element *ntfs_rl_extend(runlist_element *rl, int more_entries)
+runlist_element *ntfs_rl_extend(ntfs_attr *na, runlist_element *rl,
+ int more_entries)
{
+ runlist_element *newrl;
int last;
-
- last = 0;
- while (rl[last].length)
- last++;
- rl = ntfs_rl_realloc(rl,last+1,last+more_entries+1);
- if (!rl)
- errno = ENOMEM;
+ int irl;
+
+ if (na->rl && rl) {
+ irl = (int)(rl - na->rl);
+ last = irl;
+ while (na->rl[last].length)
+ last++;
+ newrl = ntfs_rl_realloc(na->rl,last+1,last+more_entries+1);
+ if (!newrl) {
+ errno = ENOMEM;
+ rl = (runlist_element*)NULL;
+ } else {
+ na->rl = newrl;
+ rl = &newrl[irl];
+ }
+ } else {
+ ntfs_log_error("Cannot extend unmapped runlist");
+ errno = EIO;
+ rl = (runlist_element*)NULL;
+ }
return (rl);
}
@@ -1403,28 +1419,18 @@ int ntfs_write_significant_bytes(u8 *dst, const u8 *dst_max, const s64 n)
{
s64 l = n;
int i;
- s8 j;
i = 0;
- do {
+ if (dst > dst_max)
+ goto err_out;
+ *dst++ = l;
+ i++;
+ while ((l > 0x7f) || (l < -0x80)) {
if (dst > dst_max)
goto err_out;
- *dst++ = l & 0xffLL;
l >>= 8;
+ *dst++ = l;
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 = (u8)-1;
- } else if (n > 0LL && j < 0) {
- if (dst > dst_max)
- goto err_out;
- i++;
- *dst = 0;
}
return i;
err_out:
@@ -1618,7 +1624,7 @@ errno_set:
int ntfs_rl_truncate(runlist **arl, const VCN start_vcn)
{
runlist *rl;
- BOOL is_end = FALSE;
+ /* BOOL is_end = FALSE; */
if (!arl || !*arl) {
errno = EINVAL;
@@ -1661,8 +1667,10 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn)
*/
if (rl->length) {
++rl;
+/*
if (!rl->length)
is_end = TRUE;
+*/
rl->vcn = start_vcn;
rl->length = 0;
}
@@ -1670,7 +1678,7 @@ int ntfs_rl_truncate(runlist **arl, const VCN start_vcn)
/**
* Reallocate memory if necessary.
* FIXME: Below code is broken, because runlist allocations must be
- * a multiply of 4096. The code caused crashes and corruptions.
+ * a multiple of 4096. The code caused crashes and corruptions.
*/
/*
if (!is_end) {
diff --git a/libntfs-3g/security.c b/libntfs-3g/security.c
index 2d5905a..c731509 100755
--- a/libntfs-3g/security.c
+++ b/libntfs-3g/security.c
@@ -4,7 +4,7 @@
* Copyright (c) 2004 Anton Altaparmakov
* Copyright (c) 2005-2006 Szabolcs Szakacsits
* Copyright (c) 2006 Yura Pakhuchiy
- * Copyright (c) 2007-2009 Jean-Pierre Andre
+ * Copyright (c) 2007-2012 Jean-Pierre Andre
*
* This program/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,6 +52,7 @@
#include <pwd.h>
#include <grp.h>
+#include "compat.h"
#include "param.h"
#include "types.h"
#include "layout.h"
@@ -366,6 +367,8 @@ void ntfs_generate_guid(GUID *guid)
unsigned int i;
u8 *p = (u8 *)guid;
+ /* this is called at most once from mkntfs */
+ srandom(time((time_t*)NULL) ^ (getpid() << 16));
for (i = 0; i < sizeof(GUID); i++) {
p[i] = (u8)(random() & 0xFF);
if (i == 7)
@@ -405,91 +408,6 @@ le32 ntfs_security_hash(const SECURITY_DESCRIPTOR_RELATIVE *sd, const u32 len)
}
/*
- * Internal read
- * copied and pasted from ntfs_fuse_read() and made independent
- * of fuse context
- */
-
-static int ntfs_local_read(ntfs_inode *ni,
- ntfschar *stream_name, int stream_name_len,
- char *buf, size_t size, off_t offset)
-{
- ntfs_attr *na = NULL;
- int res, total = 0;
-
- na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len);
- if (!na) {
- res = -errno;
- goto exit;
- }
- if ((size_t)offset < (size_t)na->data_size) {
- if (offset + size > (size_t)na->data_size)
- size = na->data_size - offset;
- while (size) {
- res = ntfs_attr_pread(na, offset, size, buf);
- if ((off_t)res < (off_t)size)
- ntfs_log_perror("ntfs_attr_pread partial read "
- "(%lld : %lld <> %d)",
- (long long)offset,
- (long long)size, res);
- if (res <= 0) {
- res = -errno;
- goto exit;
- }
- size -= res;
- offset += res;
- total += res;
- }
- }
- res = total;
-exit:
- if (na)
- ntfs_attr_close(na);
- return res;
-}
-
-
-/*
- * Internal write
- * copied and pasted from ntfs_fuse_write() and made independent
- * of fuse context
- */
-
-static int ntfs_local_write(ntfs_inode *ni,
- ntfschar *stream_name, int stream_name_len,
- char *buf, size_t size, off_t offset)
-{
- ntfs_attr *na = NULL;
- int res, total = 0;
-
- na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len);
- if (!na) {
- res = -errno;
- goto exit;
- }
- while (size) {
- res = ntfs_attr_pwrite(na, offset, size, buf);
- if (res < (s64)size)
- ntfs_log_perror("ntfs_attr_pwrite partial write (%lld: "
- "%lld <> %d)", (long long)offset,
- (long long)size, res);
- if (res <= 0) {
- res = -errno;
- goto exit;
- }
- size -= res;
- offset += res;
- total += res;
- }
- res = total;
-exit:
- if (na)
- ntfs_attr_close(na);
- return res;
-}
-
-
-/*
* Get the first entry of current index block
* cut and pasted form ntfs_ie_get_first() in index.c
*/
@@ -531,7 +449,7 @@ static int entersecurity_stuff(ntfs_volume *vol, off_t offs)
if (stuff) {
memset(stuff, 0, STUFFSZ);
do {
- written = ntfs_local_write(vol->secure_ni,
+ written = ntfs_attr_data_write(vol->secure_ni,
STREAM_SDS, 4, stuff, STUFFSZ, offs);
if (written == STUFFSZ) {
total += STUFFSZ;
@@ -589,10 +507,10 @@ static int entersecurity_data(ntfs_volume *vol,
phsds->security_id = keyid;
phsds->offset = cpu_to_le64(offs);
phsds->length = cpu_to_le32(fullsz - gap);
- written1 = ntfs_local_write(vol->secure_ni,
+ written1 = ntfs_attr_data_write(vol->secure_ni,
STREAM_SDS, 4, fullattr, fullsz,
offs - gap);
- written2 = ntfs_local_write(vol->secure_ni,
+ written2 = ntfs_attr_data_write(vol->secure_ni,
STREAM_SDS, 4, fullattr, fullsz,
offs - gap + ALIGN_SDS_BLOCK);
if ((written1 == fullsz)
@@ -950,7 +868,7 @@ static le32 setsecurityattr(ntfs_volume *vol,
+ sizeof(SECURITY_DESCRIPTOR_HEADER);
oldattr = (char*)ntfs_malloc(size);
if (oldattr) {
- rdsize = ntfs_local_read(
+ rdsize = ntfs_attr_data_read(
vol->secure_ni,
STREAM_SDS, 4,
oldattr, size, offs);
@@ -1101,7 +1019,6 @@ static int update_secur_descr(ntfs_volume *vol,
/* mark node as dirty */
NInoSetDirty(ni);
- ntfs_inode_sync(ni); /* useful ? */
return (res);
}
@@ -1150,7 +1067,6 @@ static int upgrade_secur_desc(ntfs_volume *vol,
na = ntfs_attr_open(ni, AT_STANDARD_INFORMATION,
AT_UNNAMED, 0);
if (na) {
- res = 0;
/* expand standard information attribute to v3.x */
res = ntfs_attr_truncate(na,
(s64)sizeof(STANDARD_INFORMATION));
@@ -1170,9 +1086,8 @@ static int upgrade_secur_desc(ntfs_volume *vol,
}
} else
res = -1;
- /* mark node as dirty */
- NInoSetDirty(ni);
- ntfs_inode_sync(ni); /* useful ? */
+ /* mark node as dirty */
+ NInoSetDirty(ni);
} else
res = 1;
@@ -1216,10 +1131,86 @@ static BOOL staticgroupmember(struct SECURITY_CONTEXT *scx, uid_t uid, gid_t gid
return (ingroup);
}
+#if defined(__sun) && defined (__SVR4)
/*
* Check whether current thread owner is member of file group
+ * Solaris/OpenIndiana version
+ * Should not be called for user root, however the group may be root
*
+ * The group list is available in "/proc/$PID/cred"
+ *
+ */
+
+static BOOL groupmember(struct SECURITY_CONTEXT *scx, uid_t uid, gid_t gid)
+{
+ typedef struct prcred {
+ uid_t pr_euid; /* effective user id */
+ uid_t pr_ruid; /* real user id */
+ uid_t pr_suid; /* saved user id (from exec) */
+ gid_t pr_egid; /* effective group id */
+ gid_t pr_rgid; /* real group id */
+ gid_t pr_sgid; /* saved group id (from exec) */
+ int pr_ngroups; /* number of supplementary groups */
+ gid_t pr_groups[1]; /* array of supplementary groups */
+ } prcred_t;
+ enum { readset = 16 };
+
+ prcred_t basecreds;
+ gid_t groups[readset];
+ char filename[64];
+ int fd;
+ int k;
+ int cnt;
+ gid_t *p;
+ BOOL ismember;
+ int got;
+ pid_t tid;
+
+ if (scx->vol->secure_flags & (1 << SECURITY_STATICGRPS))
+ ismember = staticgroupmember(scx, uid, gid);
+ else {
+ ismember = FALSE; /* default return */
+ tid = scx->tid;
+ sprintf(filename,"/proc/%u/cred",tid);
+ fd = open(filename,O_RDONLY);
+ if (fd >= 0) {
+ got = read(fd, &basecreds, sizeof(prcred_t));
+ if (got == sizeof(prcred_t)) {
+ if (basecreds.pr_egid == gid)
+ ismember = TRUE;
+ p = basecreds.pr_groups;
+ cnt = 1;
+ k = 0;
+ while (!ismember
+ && (k < basecreds.pr_ngroups)
+ && (cnt > 0)
+ && (*p != gid)) {
+ k++;
+ cnt--;
+ p++;
+ if (cnt <= 0) {
+ got = read(fd, groups,
+ readset*sizeof(gid_t));
+ cnt = got/sizeof(gid_t);
+ p = groups;
+ }
+ }
+ if ((cnt > 0)
+ && (k < basecreds.pr_ngroups))
+ ismember = TRUE;
+ }
+ close(fd);
+ }
+ }
+ return (ismember);
+}
+
+#else /* defined(__sun) && defined (__SVR4) */
+
+/*
+ * Check whether current thread owner is member of file group
+ * Linux version
* Should not be called for user root, however the group may be root
*
* As indicated by Miklos Szeredi :
@@ -1322,6 +1313,8 @@ static BOOL groupmember(struct SECURITY_CONTEXT *scx, uid_t uid, gid_t gid)
return (ismember);
}
+#endif /* defined(__sun) && defined (__SVR4) */
+
/*
* Cacheing is done two-way :
* - from uid, gid and perm to securid (CACHED_SECURID)
@@ -1774,7 +1767,7 @@ static char *retrievesecurityattr(ntfs_volume *vol, SII_INDEX_KEY id)
securattr = (char*)ntfs_malloc(size);
if (securattr) {
- rdsize = ntfs_local_read(
+ rdsize = ntfs_attr_data_read(
ni, STREAM_SDS, 4,
securattr, size, offs);
if ((rdsize != size)
@@ -1885,7 +1878,7 @@ static int access_check_posix(struct SECURITY_CONTEXT *scx,
if (!scx->uid) {
/* root access if owner or other execution */
if (perms & 0101)
- perms = 07777;
+ perms |= 01777;
else {
/* root access if some group execution */
groupperms = 0;
@@ -1987,7 +1980,7 @@ static int access_check_posix(struct SECURITY_CONTEXT *scx,
*
* returns -1 if there is a problem
*/
-#if 0
+#if 0
static int ntfs_get_perm(struct SECURITY_CONTEXT *scx,
ntfs_inode * ni, mode_t request)
{
@@ -2081,6 +2074,7 @@ static int ntfs_get_perm(struct SECURITY_CONTEXT *scx,
return (perm);
}
#endif
+
/*
* Get a Posix ACL
*
@@ -2100,7 +2094,6 @@ int ntfs_get_posix_acl(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
const SID *gsid; /* group of file/directory */
uid_t uid;
gid_t gid;
- int perm;
BOOL isdir;
size_t outsize;
@@ -2135,7 +2128,6 @@ int ntfs_get_posix_acl(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
* fetch owner and group for cacheing
*/
if (pxdesc) {
- perm = pxdesc->mode & 07777;
/*
* Create a security id if there were none
* and upgrade option is selected
@@ -2149,11 +2141,10 @@ int ntfs_get_posix_acl(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
#if OWNERFROMACL
uid = ntfs_find_user(scx->mapping[MAPUSERS],usid);
#else
- if (!perm && ntfs_same_sid(usid, adminsid)) {
+ if (!(pxdesc->mode & 07777)
+ && ntfs_same_sid(usid, adminsid)) {
uid = find_tenant(scx,
securattr);
- if (uid)
- perm = 0700;
} else
uid = ntfs_find_user(scx->mapping[MAPUSERS],usid);
#endif
@@ -2223,7 +2214,7 @@ int ntfs_get_posix_acl(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
*
* returns -1 if there is a problem
*/
-#if 0
+#if 0
static int ntfs_get_perm(struct SECURITY_CONTEXT *scx,
ntfs_inode *ni, mode_t request)
{
@@ -2304,7 +2295,7 @@ static int ntfs_get_perm(struct SECURITY_CONTEXT *scx,
if (!scx->uid) {
/* root access and execution */
if (perm & 0111)
- perm = 07777;
+ perm |= 01777;
else
perm = 0;
} else
@@ -2328,6 +2319,7 @@ static int ntfs_get_perm(struct SECURITY_CONTEXT *scx,
return (perm);
}
#endif
+
#endif /* POSIXACLS */
/*
@@ -2980,7 +2972,6 @@ int ntfs_set_posix_acl(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
uid_t uid;
uid_t gid;
int res;
- mode_t mode;
BOOL isdir;
BOOL deflt;
BOOL exist;
@@ -2997,14 +2988,15 @@ int ntfs_set_posix_acl(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
count = 0;
isdir = (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) != const_cpu_to_le16(0);
newpxdesc = (struct POSIX_SECURITY*)NULL;
- if (!deflt || isdir || !size) {
+ if ((!value
+ || (((const struct POSIX_ACL*)value)->version == POSIX_VERSION))
+ && (!deflt || isdir || (!size && !value))) {
cached = fetch_cache(scx, ni);
if (cached) {
uid = cached->uid;
gid = cached->gid;
oldpxdesc = cached->pxdesc;
if (oldpxdesc) {
- mode = oldpxdesc->mode;
newpxdesc = ntfs_replace_acl(oldpxdesc,
(const struct POSIX_ACL*)value,count,deflt);
}
@@ -3031,7 +3023,6 @@ int ntfs_set_posix_acl(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
|| (!exist && (flags & XATTR_REPLACE))) {
errno = (exist ? EEXIST : ENODATA);
} else {
- mode = oldpxdesc->mode;
newpxdesc = ntfs_replace_acl(oldpxdesc,
(const struct POSIX_ACL*)value,count,deflt);
}
@@ -3338,9 +3329,7 @@ int ntfs_allowed_access(struct SECURITY_CONTEXT *scx,
ntfs_inode *ni,
int accesstype) /* access type required (S_Ixxx values) */
{
- return 1;
-
-#if 0
+#if 0
int perm;
int res;
int allow;
@@ -3409,7 +3398,61 @@ int ntfs_allowed_access(struct SECURITY_CONTEXT *scx,
allow = 0;
}
return (allow);
-#endif
+#endif
+ return (1);
+}
+
+/*
+ * Check whether user can create a file (or directory)
+ *
+ * Returns TRUE if access is allowed,
+ * Also returns the gid and dsetgid applicable to the created file
+ */
+
+int ntfs_allowed_create(struct SECURITY_CONTEXT *scx,
+ ntfs_inode *dir_ni, gid_t *pgid, mode_t *pdsetgid)
+{
+#if 0
+ int perm;
+ int res;
+ int allow;
+ struct stat stbuf;
+
+ /*
+ * Always allow for root.
+ * Also always allow if no mapping has been defined
+ */
+ if (!scx->mapping[MAPUSERS])
+ perm = 0777;
+ else
+ perm = ntfs_get_perm(scx, dir_ni, S_IWRITE + S_IEXEC);
+ if (!scx->mapping[MAPUSERS]
+ || !scx->uid) {
+ allow = 1;
+ } else {
+ perm = ntfs_get_perm(scx, dir_ni, S_IWRITE + S_IEXEC);
+ if (perm >= 0) {
+ res = EACCES;
+ allow = ((perm & (S_IWUSR | S_IWGRP | S_IWOTH)) != 0)
+ && ((perm & (S_IXUSR | S_IXGRP | S_IXOTH)) != 0);
+ if (!allow)
+ errno = res;
+ } else
+ allow = 0;
+ }
+ *pgid = scx->gid;
+ *pdsetgid = 0;
+ /* return directory group if S_ISGID is set */
+ if (allow && (perm & S_ISGID)) {
+ if (ntfs_get_owner_mode(scx, dir_ni, &stbuf) >= 0) {
+ *pdsetgid = stbuf.st_mode & S_ISGID;
+ if (perm & S_ISGID)
+ *pgid = stbuf.st_gid;
+ }
+ }
+ return (allow);
+#endif
+ return (1);
}
#if 0 /* not needed any more */
@@ -3563,10 +3606,12 @@ int ntfs_set_owner(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
uid = fileuid;
if ((int)gid < 0)
gid = filegid;
+#if !defined(__sun) || !defined (__SVR4)
/* clear setuid and setgid if owner has changed */
/* unless request originated by root */
if (uid && (fileuid != uid))
mode &= 01777;
+#endif
#if POSIXACLS
res = ntfs_set_owner_mode(scx, ni, uid, gid,
mode, pxdesc);
@@ -3602,16 +3647,16 @@ int ntfs_set_owner(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
int ntfs_set_ownmod(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
uid_t uid, gid_t gid, const mode_t mode)
{
- const SECURITY_DESCRIPTOR_RELATIVE *phead;
const struct CACHED_PERMISSIONS *cached;
char *oldattr;
- const SID *usid;
- const SID *gsid;
uid_t fileuid;
uid_t filegid;
- BOOL isdir;
int res;
#if POSIXACLS
+ const SECURITY_DESCRIPTOR_RELATIVE *phead;
+ const SID *usid;
+ const SID *gsid;
+ BOOL isdir;
const struct POSIX_SECURITY *oldpxdesc;
struct POSIX_SECURITY *newpxdesc = (struct POSIX_SECURITY*)NULL;
int pxsize;
@@ -3644,6 +3689,7 @@ int ntfs_set_ownmod(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
filegid = 0;
oldattr = getsecurityattr(scx->vol, ni);
if (oldattr) {
+#if POSIXACLS
isdir = (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY)
!= const_cpu_to_le16(0);
phead = (const SECURITY_DESCRIPTOR_RELATIVE*)
@@ -3656,7 +3702,6 @@ int ntfs_set_ownmod(struct SECURITY_CONTEXT *scx, ntfs_inode *ni,
usid = (const SID*)
&oldattr[le32_to_cpu(phead->owner)];
#endif
-#if POSIXACLS
newpxdesc = ntfs_build_permissions_posix(scx->mapping, oldattr,
usid, gsid, isdir);
if (!newpxdesc || ntfs_merge_mode_posix(newpxdesc, mode))
@@ -3775,7 +3820,9 @@ static le32 build_inherited_id(struct SECURITY_CONTEXT *scx,
pnhead = (SECURITY_DESCRIPTOR_RELATIVE*)newattr;
pnhead->revision = SECURITY_DESCRIPTOR_REVISION;
pnhead->alignment = 0;
- pnhead->control = SE_SELF_RELATIVE;
+ pnhead->control = (pphead->control
+ & (SE_DACL_AUTO_INHERITED | SE_SACL_AUTO_INHERITED))
+ | SE_SELF_RELATIVE;
pos = sizeof(SECURITY_DESCRIPTOR_RELATIVE);
/*
* locate and inherit DACL
@@ -3786,7 +3833,9 @@ static le32 build_inherited_id(struct SECURITY_CONTEXT *scx,
offpacl = le32_to_cpu(pphead->dacl);
ppacl = (const ACL*)&parentattr[offpacl];
pnacl = (ACL*)&newattr[pos];
- aclsz = ntfs_inherit_acl(ppacl, pnacl, usid, gsid, fordir);
+ aclsz = ntfs_inherit_acl(ppacl, pnacl, usid, gsid,
+ fordir, pphead->control
+ & SE_DACL_AUTO_INHERITED);
if (aclsz) {
pnhead->dacl = cpu_to_le32(pos);
pos += aclsz;
@@ -3801,7 +3850,9 @@ static le32 build_inherited_id(struct SECURITY_CONTEXT *scx,
offpacl = le32_to_cpu(pphead->sacl);
ppacl = (const ACL*)&parentattr[offpacl];
pnacl = (ACL*)&newattr[pos];
- aclsz = ntfs_inherit_acl(ppacl, pnacl, usid, gsid, fordir);
+ aclsz = ntfs_inherit_acl(ppacl, pnacl, usid, gsid,
+ fordir, pphead->control
+ & SE_SACL_AUTO_INHERITED);
if (aclsz) {
pnhead->sacl = cpu_to_le32(pos);
pos += aclsz;
@@ -3819,7 +3870,7 @@ static le32 build_inherited_id(struct SECURITY_CONTEXT *scx,
*/
memcpy(&newattr[pos],gsid,gsidsz);
pnhead->group = cpu_to_le32(pos);
- pos += usidsz;
+ pos += gsidsz;
securid = setsecurityattr(scx->vol,
(SECURITY_DESCRIPTOR_RELATIVE*)newattr, pos);
free(newattr);
@@ -3974,14 +4025,13 @@ static int link_group_members(struct SECURITY_CONTEXT *scx)
return (res);
}
-
/*
* Apply default single user mapping
* returns zero if successful
*/
static int ntfs_do_default_mapping(struct SECURITY_CONTEXT *scx,
- const SID *usid)
+ uid_t uid, gid_t gid, const SID *usid)
{
struct MAPPING *usermapping;
struct MAPPING *groupmapping;
@@ -3999,10 +4049,10 @@ static int ntfs_do_default_mapping(struct SECURITY_CONTEXT *scx,
groupmapping = (struct MAPPING*)ntfs_malloc(sizeof(struct MAPPING));
if (groupmapping) {
usermapping->sid = sid;
- usermapping->xid = scx->uid;
+ usermapping->xid = uid;
usermapping->next = (struct MAPPING*)NULL;
groupmapping->sid = sid;
- groupmapping->xid = scx->uid;
+ groupmapping->xid = gid;
groupmapping->next = (struct MAPPING*)NULL;
scx->mapping[MAPUSERS] = usermapping;
scx->mapping[MAPGROUPS] = groupmapping;
@@ -4011,7 +4061,6 @@ static int ntfs_do_default_mapping(struct SECURITY_CONTEXT *scx,
}
}
return (res);
-
}
/*
@@ -4053,6 +4102,8 @@ static BOOL check_mapping(const struct MAPPING *usermapping,
#endif
+#if 0 /* not used any more */
+
/*
* Try and apply default single user mapping
* returns zero if successful
@@ -4074,7 +4125,8 @@ static int ntfs_default_mapping(struct SECURITY_CONTEXT *scx)
phead = (const SECURITY_DESCRIPTOR_RELATIVE*)securattr;
usid = (SID*)&securattr[le32_to_cpu(phead->owner)];
if (ntfs_is_user_sid(usid))
- res = ntfs_do_default_mapping(scx,usid);
+ res = ntfs_do_default_mapping(scx,
+ scx->uid, scx->gid, usid);
free(securattr);
}
ntfs_inode_close(ni);
@@ -4082,6 +4134,8 @@ static int ntfs_default_mapping(struct SECURITY_CONTEXT *scx)
return (res);
}
+#endif
+
/*
* Basic read from a user mapping file on another volume
*/
@@ -4098,7 +4152,7 @@ static int basicread(void *fileid, char *buf, size_t size, off_t offs __attribut
static int localread(void *fileid, char *buf, size_t size, off_t offs)
{
- return (ntfs_local_read((ntfs_inode*)fileid,
+ return (ntfs_attr_data_read((ntfs_inode*)fileid,
AT_UNNAMED, 0, buf, size, offs));
}
@@ -4114,7 +4168,8 @@ static int localread(void *fileid, char *buf, size_t size, off_t offs)
* (failure should not be interpreted as an error)
*/
-int ntfs_build_mapping(struct SECURITY_CONTEXT *scx, const char *usermap_path)
+int ntfs_build_mapping(struct SECURITY_CONTEXT *scx, const char *usermap_path,
+ BOOL allowdef)
{
struct MAPLIST *item;
struct MAPLIST *firstitem;
@@ -4122,6 +4177,22 @@ int ntfs_build_mapping(struct SECURITY_CONTEXT *scx, const char *usermap_path)
struct MAPPING *groupmapping;
ntfs_inode *ni;
int fd;
+ static struct {
+ u8 revision;
+ u8 levels;
+ be16 highbase;
+ be32 lowbase;
+ le32 level1;
+ le32 level2;
+ le32 level3;
+ le32 level4;
+ le32 level5;
+ } defmap = {
+ 1, 5, const_cpu_to_be16(0), const_cpu_to_be32(5),
+ const_cpu_to_le32(21),
+ const_cpu_to_le32(DEFSECAUTH1), const_cpu_to_le32(DEFSECAUTH2),
+ const_cpu_to_le32(DEFSECAUTH3), const_cpu_to_le32(DEFSECBASE)
+ } ;
/* be sure not to map anything until done */
scx->mapping[MAPUSERS] = (struct MAPPING*)NULL;
@@ -4161,9 +4232,10 @@ int ntfs_build_mapping(struct SECURITY_CONTEXT *scx, const char *usermap_path)
firstitem = item;
}
} else {
- /* no mapping file, try default mapping */
- if (scx->uid && scx->gid) {
- if (!ntfs_default_mapping(scx))
+ /* no mapping file, try a default mapping */
+ if (allowdef) {
+ if (!ntfs_do_default_mapping(scx,
+ 0, 0, (const SID*)&defmap))
ntfs_log_info("Using default user mapping\n");
}
}
@@ -4852,6 +4924,7 @@ BOOL ntfs_set_file_attributes(struct SECURITY_API *scapi,
ni->flags = (ni->flags & ~settable)
| (cpu_to_le32(attrib) & settable);
NInoSetDirty(ni);
+ NInoFileNameSetDirty(ni);
}
if (!ntfs_inode_close(ni))
res = -1;
@@ -4902,7 +4975,7 @@ int ntfs_read_sds(struct SECURITY_API *scapi,
got = -1; /* default return */
if (scapi && (scapi->magic == MAGIC_API)) {
if (scapi->security.vol->secure_ni)
- got = ntfs_local_read(scapi->security.vol->secure_ni,
+ got = ntfs_attr_data_read(scapi->security.vol->secure_ni,
STREAM_SDS, 4, buf, size, offset);
else
errno = EOPNOTSUPP;
@@ -5098,7 +5171,7 @@ int ntfs_get_group(struct SECURITY_API *scapi, const SID *gsid)
*/
struct SECURITY_API *ntfs_initialize_file_security(const char *device,
- int flags)
+ unsigned long flags)
{
ntfs_volume *vol;
unsigned long mntflag;
@@ -5124,7 +5197,7 @@ struct SECURITY_API *ntfs_initialize_file_security(const char *device,
scx->pseccache = &scapi->seccache;
scx->vol->secure_flags = 0;
/* accept no mapping and no $Secure */
- ntfs_build_mapping(scx,(const char*)NULL);
+ ntfs_build_mapping(scx,(const char*)NULL,TRUE);
ntfs_open_secure(vol);
} else {
if (scapi)
diff --git a/libntfs-3g/unistr.c b/libntfs-3g/unistr.c
index e65df99..9a23801 100755
--- a/libntfs-3g/unistr.c
+++ b/libntfs-3g/unistr.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2004 Anton Altaparmakov
* Copyright (c) 2002-2009 Szabolcs Szakacsits
- * Copyright (c) 2008-2009 Jean-Pierre Andre
+ * Copyright (c) 2008-2011 Jean-Pierre Andre
* Copyright (c) 2008 Bernhard Kaindl
*
* This program/include file is free software; you can redistribute it and/or
@@ -166,24 +166,22 @@ int ntfs_names_full_collate(const ntfschar *name1, const u32 name1_len,
cnt = min(name1_len, name2_len);
if (cnt > 0) {
if (ic == CASE_SENSITIVE) {
- do {
- c1 = le16_to_cpu(*name1);
+ while (--cnt && (*name1 == *name2)) {
name1++;
- c2 = le16_to_cpu(*name2);
name2++;
- } while (--cnt && (c1 == c2));
- u1 = c1;
- u2 = c2;
+ }
+ u1 = c1 = le16_to_cpu(*name1);
+ u2 = c2 = le16_to_cpu(*name2);
if (u1 < upcase_len)
u1 = le16_to_cpu(upcase[u1]);
if (u2 < upcase_len)
u2 = le16_to_cpu(upcase[u2]);
if ((u1 == u2) && cnt)
do {
- u1 = le16_to_cpu(*name1);
name1++;
- u2 = le16_to_cpu(*name2);
+ u1 = le16_to_cpu(*name1);
name2++;
+ u2 = le16_to_cpu(*name2);
if (u1 < upcase_len)
u1 = le16_to_cpu(upcase[u1]);
if (u2 < upcase_len)
@@ -390,6 +388,21 @@ void ntfs_name_upcase(ntfschar *name, u32 name_len, const ntfschar *upcase,
}
/**
+ * ntfs_name_locase - Map a Unicode name to its lowercase equivalent
+ */
+void ntfs_name_locase(ntfschar *name, u32 name_len, const ntfschar *locase,
+ const u32 locase_len)
+{
+ u32 i;
+ u16 u;
+
+ if (locase)
+ for (i = 0; i < name_len; i++)
+ if ((u = le16_to_cpu(name[i])) < locase_len)
+ name[i] = locase[u];
+}
+
+/**
* ntfs_file_value_upcase - Convert a filename to upper case
* @file_name_attr:
* @upcase:
@@ -697,9 +710,9 @@ static int utf8_to_unicode(u32 *wc, const char *s)
| ((u32)(s[1] & 0x3F) << 12)
| ((u32)(s[2] & 0x3F) << 6)
| ((u32)(s[3] & 0x3F));
- /* Check valid ranges */
- if ((*wc <= 0x10ffff) && (*wc >= 0x10000))
- return 4;
+ /* Check valid ranges */
+ if ((*wc <= 0x10ffff) && (*wc >= 0x10000))
+ return 4;
}
goto fail;
}
@@ -815,12 +828,15 @@ int ntfs_ucstombs(const ntfschar *ins, const int ins_len, char **outs,
int outs_len)
{
char *mbs;
+ int mbs_len;
+#ifdef MB_CUR_MAX
wchar_t wc;
- int i, o, mbs_len;
+ int i, o;
int cnt = 0;
#ifdef HAVE_MBSINIT
mbstate_t mbstate;
#endif
+#endif /* MB_CUR_MAX */
if (!ins || !outs) {
errno = EINVAL;
@@ -834,6 +850,7 @@ int ntfs_ucstombs(const ntfschar *ins, const int ins_len, char **outs,
}
if (use_utf8)
return ntfs_utf16_to_utf8(ins, ins_len, outs, outs_len);
+#ifdef MB_CUR_MAX
if (!mbs) {
mbs_len = (ins_len + 1) * MB_CUR_MAX;
mbs = ntfs_malloc(mbs_len);
@@ -899,6 +916,9 @@ err_out:
free(mbs);
errno = eo;
}
+#else /* MB_CUR_MAX */
+ errno = EILSEQ;
+#endif /* MB_CUR_MAX */
return -1;
}
@@ -927,6 +947,7 @@ err_out:
*/
int ntfs_mbstoucs(const char *ins, ntfschar **outs)
{
+#ifdef MB_CUR_MAX
ntfschar *ucs;
const char *s;
wchar_t wc;
@@ -934,6 +955,7 @@ int ntfs_mbstoucs(const char *ins, ntfschar **outs)
#ifdef HAVE_MBSINIT
mbstate_t mbstate;
#endif
+#endif /* MB_CUR_MAX */
if (!ins || !outs) {
errno = EINVAL;
@@ -943,6 +965,7 @@ int ntfs_mbstoucs(const char *ins, ntfschar **outs)
if (use_utf8)
return ntfs_utf8_to_utf16(ins, outs);
+#ifdef MB_CUR_MAX
/* Determine the size of the multi-byte string in bytes. */
ins_size = strlen(ins);
/* Determine the length of the multi-byte string. */
@@ -1032,9 +1055,67 @@ int ntfs_mbstoucs(const char *ins, ntfschar **outs)
return o;
err_out:
free(ucs);
+#else /* MB_CUR_MAX */
+ errno = EILSEQ;
+#endif /* MB_CUR_MAX */
return -1;
}
+/*
+ * Turn a UTF8 name uppercase
+ *
+ * Returns an allocated uppercase name which has to be freed by caller
+ * or NULL if there is an error (described by errno)
+ */
+
+char *ntfs_uppercase_mbs(const char *low,
+ const ntfschar *upcase, u32 upcase_size)
+{
+ int size;
+ char *upp;
+ u32 wc;
+ int n;
+ const char *s;
+ char *t;
+
+ size = strlen(low);
+ upp = (char*)ntfs_malloc(3*size + 1);
+ if (upp) {
+ s = low;
+ t = upp;
+ do {
+ n = utf8_to_unicode(&wc, s);
+ if (n > 0) {
+ if (wc < upcase_size)
+ wc = le16_to_cpu(upcase[wc]);
+ if (wc < 0x80)
+ *t++ = wc;
+ else if (wc < 0x800) {
+ *t++ = (0xc0 | ((wc >> 6) & 0x3f));
+ *t++ = 0x80 | (wc & 0x3f);
+ } else if (wc < 0x10000) {
+ *t++ = 0xe0 | (wc >> 12);
+ *t++ = 0x80 | ((wc >> 6) & 0x3f);
+ *t++ = 0x80 | (wc & 0x3f);
+ } else {
+ *t++ = 0xf0 | ((wc >> 18) & 7);
+ *t++ = 0x80 | ((wc >> 12) & 63);
+ *t++ = 0x80 | ((wc >> 6) & 0x3f);
+ *t++ = 0x80 | (wc & 0x3f);
+ }
+ s += n;
+ }
+ } while (n > 0);
+ if (n < 0) {
+ free(upp);
+ upp = (char*)NULL;
+ errno = EILSEQ;
+ }
+ *t = 0;
+ }
+ return (upp);
+}
+
/**
* ntfs_upcase_table_build - build the default upcase table for NTFS
* @uc: destination buffer where to store the built table
@@ -1047,6 +1128,69 @@ err_out:
*/
void ntfs_upcase_table_build(ntfschar *uc, u32 uc_len)
{
+#if 1 /* Vista */
+ /*
+ * This is the table as defined by Vista
+ */
+ /*
+ * "Start" is inclusive and "End" is exclusive, every value has the
+ * value of "Add" added to it.
+ */
+ static int uc_run_table[][3] = { /* Start, End, Add */
+ {0x0061, 0x007b, -32}, {0x00e0, 0x00f7, -32}, {0x00f8, 0x00ff, -32},
+ {0x0256, 0x0258, -205}, {0x028a, 0x028c, -217}, {0x037b, 0x037e, 130},
+ {0x03ac, 0x03ad, -38}, {0x03ad, 0x03b0, -37}, {0x03b1, 0x03c2, -32},
+ {0x03c2, 0x03c3, -31}, {0x03c3, 0x03cc, -32}, {0x03cc, 0x03cd, -64},
+ {0x03cd, 0x03cf, -63}, {0x0430, 0x0450, -32}, {0x0450, 0x0460, -80},
+ {0x0561, 0x0587, -48}, {0x1f00, 0x1f08, 8}, {0x1f10, 0x1f16, 8},
+ {0x1f20, 0x1f28, 8}, {0x1f30, 0x1f38, 8}, {0x1f40, 0x1f46, 8},
+ {0x1f51, 0x1f52, 8}, {0x1f53, 0x1f54, 8}, {0x1f55, 0x1f56, 8},
+ {0x1f57, 0x1f58, 8}, {0x1f60, 0x1f68, 8}, {0x1f70, 0x1f72, 74},
+ {0x1f72, 0x1f76, 86}, {0x1f76, 0x1f78, 100}, {0x1f78, 0x1f7a, 128},
+ {0x1f7a, 0x1f7c, 112}, {0x1f7c, 0x1f7e, 126}, {0x1f80, 0x1f88, 8},
+ {0x1f90, 0x1f98, 8}, {0x1fa0, 0x1fa8, 8}, {0x1fb0, 0x1fb2, 8},
+ {0x1fb3, 0x1fb4, 9}, {0x1fcc, 0x1fcd, -9}, {0x1fd0, 0x1fd2, 8},
+ {0x1fe0, 0x1fe2, 8}, {0x1fe5, 0x1fe6, 7}, {0x1ffc, 0x1ffd, -9},
+ {0x2170, 0x2180, -16}, {0x24d0, 0x24ea, -26}, {0x2c30, 0x2c5f, -48},
+ {0x2d00, 0x2d26, -7264}, {0xff41, 0xff5b, -32}, {0}
+ };
+ /*
+ * "Start" is exclusive and "End" is inclusive, every second value is
+ * decremented by one.
+ */
+ static int uc_dup_table[][2] = { /* Start, End */
+ {0x0100, 0x012f}, {0x0132, 0x0137}, {0x0139, 0x0149}, {0x014a, 0x0178},
+ {0x0179, 0x017e}, {0x01a0, 0x01a6}, {0x01b3, 0x01b7}, {0x01cd, 0x01dd},
+ {0x01de, 0x01ef}, {0x01f4, 0x01f5}, {0x01f8, 0x01f9}, {0x01fa, 0x0220},
+ {0x0222, 0x0234}, {0x023b, 0x023c}, {0x0241, 0x0242}, {0x0246, 0x024f},
+ {0x03d8, 0x03ef}, {0x03f7, 0x03f8}, {0x03fa, 0x03fb}, {0x0460, 0x0481},
+ {0x048a, 0x04bf}, {0x04c1, 0x04c4}, {0x04c5, 0x04c8}, {0x04c9, 0x04ce},
+ {0x04ec, 0x04ed}, {0x04d0, 0x04eb}, {0x04ee, 0x04f5}, {0x04f6, 0x0513},
+ {0x1e00, 0x1e95}, {0x1ea0, 0x1ef9}, {0x2183, 0x2184}, {0x2c60, 0x2c61},
+ {0x2c67, 0x2c6c}, {0x2c75, 0x2c76}, {0x2c80, 0x2ce3}, {0}
+ };
+ /*
+ * Set the Unicode character at offset "Offset" to "Value". Note,
+ * "Value" is host endian.
+ */
+ static int uc_byte_table[][2] = { /* Offset, Value */
+ {0x00ff, 0x0178}, {0x0180, 0x0243}, {0x0183, 0x0182}, {0x0185, 0x0184},
+ {0x0188, 0x0187}, {0x018c, 0x018b}, {0x0192, 0x0191}, {0x0195, 0x01f6},
+ {0x0199, 0x0198}, {0x019a, 0x023d}, {0x019e, 0x0220}, {0x01a8, 0x01a7},
+ {0x01ad, 0x01ac}, {0x01b0, 0x01af}, {0x01b9, 0x01b8}, {0x01bd, 0x01bc},
+ {0x01bf, 0x01f7}, {0x01c6, 0x01c4}, {0x01c9, 0x01c7}, {0x01cc, 0x01ca},
+ {0x01dd, 0x018e}, {0x01f3, 0x01f1}, {0x023a, 0x2c65}, {0x023e, 0x2c66},
+ {0x0253, 0x0181}, {0x0254, 0x0186}, {0x0259, 0x018f}, {0x025b, 0x0190},
+ {0x0260, 0x0193}, {0x0263, 0x0194}, {0x0268, 0x0197}, {0x0269, 0x0196},
+ {0x026b, 0x2c62}, {0x026f, 0x019c}, {0x0272, 0x019d}, {0x0275, 0x019f},
+ {0x027d, 0x2c64}, {0x0280, 0x01a6}, {0x0283, 0x01a9}, {0x0288, 0x01ae},
+ {0x0289, 0x0244}, {0x028c, 0x0245}, {0x0292, 0x01b7}, {0x03f2, 0x03f9},
+ {0x04cf, 0x04c0}, {0x1d7d, 0x2c63}, {0x214e, 0x2132}, {0}
+ };
+#else /* Vista */
+ /*
+ * This is the table as defined by Windows XP
+ */
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},
@@ -1083,6 +1227,7 @@ void ntfs_upcase_table_build(ntfschar *uc, u32 uc_len)
{0x01A8, 0x01A7}, {0x01DD, 0x018E}, {0x0268, 0x0197},
{0}
};
+#endif /* Vista */
int i, r;
int k, off;
@@ -1106,6 +1251,59 @@ void ntfs_upcase_table_build(ntfschar *uc, u32 uc_len)
}
}
+/*
+ * Allocate and build the default upcase table
+ *
+ * Returns the number of entries
+ * 0 if failed
+ */
+
+#define UPCASE_LEN 65536 /* default number of entries in upcase */
+
+u32 ntfs_upcase_build_default(ntfschar **upcase)
+{
+ u32 upcase_len = 0;
+
+ *upcase = (ntfschar*)ntfs_malloc(UPCASE_LEN*2);
+ if (*upcase) {
+ ntfs_upcase_table_build(*upcase, UPCASE_LEN*2);
+ upcase_len = UPCASE_LEN;
+ }
+ return (upcase_len);
+}
+
+/*
+ * Build a table for converting to lower case
+ *
+ * This is only meaningful when there is a single lower case
+ * character leading to an upper case one, and currently the
+ * only exception is the greek letter sigma which has a single
+ * upper case glyph (code U+03A3), but two lower case glyphs
+ * (code U+03C3 and U+03C2, the latter to be used at the end
+ * of a word). In the following implementation the upper case
+ * sigma will be lowercased as U+03C3.
+ */
+
+ntfschar *ntfs_locase_table_build(const ntfschar *uc, u32 uc_cnt)
+{
+ ntfschar *lc;
+ u32 upp;
+ u32 i;
+
+ lc = (ntfschar*)ntfs_malloc(uc_cnt*sizeof(ntfschar));
+ if (lc) {
+ for (i=0; i<uc_cnt; i++)
+ lc[i] = cpu_to_le16(i);
+ for (i=0; i<uc_cnt; i++) {
+ upp = le16_to_cpu(uc[i]);
+ if ((upp != i) && (upp < uc_cnt))
+ lc[upp] = cpu_to_le16(i);
+ }
+ } else
+ ntfs_log_error("Could not build the locase table\n");
+ return (lc);
+}
+
/**
* ntfs_str2ucs - convert a string to a valid NTFS file name
* @s: input string
@@ -1177,7 +1375,9 @@ BOOL ntfs_forbidden_chars(const ntfschar *name, int len)
| (1L << ('>' - 0x20))
| (1L << ('?' - 0x20));
- forbidden = (len == 0) || (le16_to_cpu(name[len-1]) == ' ');
+ forbidden = (len == 0)
+ || (le16_to_cpu(name[len-1]) == ' ')
+ || (le16_to_cpu(name[len-1]) == '.');
for (i=0; i<len; i++) {
ch = le16_to_cpu(name[i]);
if ((ch < 0x20)
@@ -1206,16 +1406,18 @@ BOOL ntfs_collapsible_chars(ntfs_volume *vol,
{
BOOL collapsible;
unsigned int ch;
+ unsigned int cs;
int i;
collapsible = shortlen == longlen;
- if (collapsible)
- for (i=0; i<shortlen; i++) {
- ch = le16_to_cpu(longname[i]);
- if ((ch >= vol->upcase_len)
- || ((shortname[i] != longname[i])
- && (shortname[i] != vol->upcase[ch])))
- collapsible = FALSE;
+ for (i=0; collapsible && (i<shortlen); i++) {
+ ch = le16_to_cpu(longname[i]);
+ cs = le16_to_cpu(shortname[i]);
+ if ((cs != ch)
+ && ((ch >= vol->upcase_len)
+ || (cs >= vol->upcase_len)
+ || (vol->upcase[cs] != vol->upcase[ch])))
+ collapsible = FALSE;
}
return (collapsible);
}
diff --git a/libntfs-3g/unix_io.c b/libntfs-3g/unix_io.c
index c24f00b..4f2c18b 100755
--- a/libntfs-3g/unix_io.c
+++ b/libntfs-3g/unix_io.c
@@ -61,19 +61,12 @@
#include "logging.h"
#include "misc.h"
-
+#define DEV_FD(dev) (*(int *)dev->d_private)
#ifdef __USE_FILE_OFFSET64
#include <unistd.h>
-#define lseek lseek64
-#define pread pread64
-#define pwrite pwrite64
-#define fcntl __fcntl64
#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
@@ -234,7 +227,7 @@ static int ntfs_device_unix_io_close(struct ntfs_device *dev)
static s64 ntfs_device_unix_io_seek(struct ntfs_device *dev, s64 offset,
int whence)
{
- return lseek(DEV_FD(dev), offset, whence);
+ return lseek64(DEV_FD(dev), offset, whence);
}
/**
@@ -288,7 +281,7 @@ static s64 ntfs_device_unix_io_write(struct ntfs_device *dev, const void *buf,
static s64 ntfs_device_unix_io_pread(struct ntfs_device *dev, void *buf,
s64 count, s64 offset)
{
- return pread(DEV_FD(dev), buf, count, offset);
+ return pread64(DEV_FD(dev), buf, count, offset);
}
/**
@@ -310,7 +303,7 @@ static s64 ntfs_device_unix_io_pwrite(struct ntfs_device *dev, const void *buf,
return -1;
}
NDevSetDirty(dev);
- return pwrite(DEV_FD(dev), buf, count, offset);
+ return pwrite64(DEV_FD(dev), buf, count, offset);
}
/**
@@ -365,10 +358,6 @@ static int ntfs_device_unix_io_ioctl(struct ntfs_device *dev, int request,
return ioctl(DEV_FD(dev), request, argp);
}
-#ifdef __USE_FILE_OFFSET64
-#define pread pread
-#define pwrite pwrite
-#endif
/**
* Device operations for working with unix style devices and files.
*/
diff --git a/libntfs-3g/volume.c b/libntfs-3g/volume.c
index ecacb18..edd7697 100755
--- a/libntfs-3g/volume.c
+++ b/libntfs-3g/volume.c
@@ -54,6 +54,11 @@
#include <locale.h>
#endif
+#if defined(__sun) && defined (__SVR4)
+#include <sys/mnttab.h>
+#endif
+
+#include "param.h"
#include "compat.h"
#include "volume.h"
#include "attrib.h"
@@ -67,10 +72,11 @@
#include "dir.h"
#include "logging.h"
#include "cache.h"
+#include "realpath.h"
#include "misc.h"
const char *ntfs_home =
-"Ntfs-3g news, support and information: http://ntfs-3g.org\n";
+"News, support and information: http://tuxera.com\n";
static const char *invalid_ntfs_msg =
"The device '%s' doesn't seem to have a valid NTFS.\n"
@@ -87,13 +93,9 @@ static const char *corrupt_volume_msg =
"for more details.\n";
static const char *hibernated_volume_msg =
-"The NTFS partition is hibernated. Please resume and shutdown Windows\n"
-"properly, or mount the volume read-only with the 'ro' mount option, or\n"
-"mount the volume read-write with the 'remove_hiberfile' mount option.\n"
-"For example type on the command line:\n"
-"\n"
-" mount -t ntfs-3g -o remove_hiberfile %s %s\n"
-"\n";
+"The NTFS partition is in an unsafe state. Please resume and shutdown\n"
+"Windows fully (no hibernation or fast restarting), or mount the volume\n"
+"read-only with the 'ro' mount option.\n";
static const char *unclean_journal_msg =
"Write access is denied because the disk wasn't safely powered\n"
@@ -113,7 +115,7 @@ static const char *fakeraid_msg =
static const char *access_denied_msg =
"Please check '%s' and the ntfs-3g binary permissions,\n"
"and the mounting user ID. More explanation is provided at\n"
-"http://ntfs-3g.org/support.html#unprivileged\n";
+"http://tuxera.com/community/ntfs-3g-faq/#unprivileged\n";
/**
* ntfs_volume_alloc - Create an NTFS volume object and initialise it
@@ -202,6 +204,7 @@ static int __ntfs_volume_release(ntfs_volume *v)
ntfs_free_lru_caches(v);
free(v->vol_name);
free(v->upcase);
+ if (v->locase) free(v->locase);
free(v->attrdef);
free(v);
@@ -372,6 +375,12 @@ mft_has_no_attr_list:
/* Done with the $Mft mft record. */
ntfs_attr_put_search_ctx(ctx);
ctx = NULL;
+
+ /* Update the size fields in the inode. */
+ vol->mft_ni->data_size = vol->mft_na->data_size;
+ vol->mft_ni->allocated_size = vol->mft_na->allocated_size;
+ set_nino_flag(vol->mft_ni, KnownSize);
+
/*
* The volume is now setup so we can use all read access functions.
*/
@@ -457,7 +466,8 @@ 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 flags)
+ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev,
+ ntfs_mount_flags flags)
{
LCN mft_zone_size, mft_lcn;
s64 br;
@@ -481,21 +491,43 @@ ntfs_volume *ntfs_volume_startup(struct ntfs_device *dev, unsigned long flags)
goto error_exit;
/* Create the default upcase table. */
- vol->upcase_len = 65536;
- vol->upcase = ntfs_malloc(vol->upcase_len * sizeof(ntfschar));
- if (!vol->upcase)
+ vol->upcase_len = ntfs_upcase_build_default(&vol->upcase);
+ if (!vol->upcase_len || !vol->upcase)
goto error_exit;
+
+ /* Default with no locase table and case sensitive file names */
+ vol->locase = (ntfschar*)NULL;
+ NVolSetCaseSensitive(vol);
- ntfs_upcase_table_build(vol->upcase,
- vol->upcase_len * sizeof(ntfschar));
-
- if (flags & MS_RDONLY)
+ /* by default, all files are shown and not marked hidden */
+ NVolSetShowSysFiles(vol);
+ NVolSetShowHidFiles(vol);
+ NVolClearHideDotFiles(vol);
+ /* set default compression */
+#if DEFAULT_COMPRESSION
+ NVolSetCompression(vol);
+#else
+ NVolClearCompression(vol);
+#endif
+ if (flags & NTFS_MNT_RDONLY)
NVolSetReadOnly(vol);
/* ...->open needs bracketing to compile with glibc 2.7 */
if ((dev->d_ops->open)(dev, NVolReadOnly(vol) ? O_RDONLY: O_RDWR)) {
- ntfs_log_perror("Error opening '%s'", dev->d_name);
- goto error_exit;
+ if (!NVolReadOnly(vol) && (errno == EROFS)) {
+ if ((dev->d_ops->open)(dev, O_RDONLY)) {
+ ntfs_log_perror("Error opening read-only '%s'",
+ dev->d_name);
+ goto error_exit;
+ } else {
+ ntfs_log_info("Can only open '%s' as read-only\n",
+ dev->d_name);
+ NVolSetReadOnly(vol);
+ }
+ } else {
+ ntfs_log_perror("Error opening '%s'", dev->d_name);
+ goto error_exit;
+ }
}
/* Attach the device to the volume. */
vol->dev = dev;
@@ -630,6 +662,24 @@ static int ntfs_volume_check_logfile(ntfs_volume *vol)
if (!ntfs_check_logfile(na, &rp) || !ntfs_is_logfile_clean(na, rp))
err = EOPNOTSUPP;
+ /*
+ * If the latest restart page was identified as version
+ * 2.0, then Windows may have kept a cached copy of
+ * metadata for fast restarting, and we should not mount.
+ * Hibernation will be seen the same way on a non
+ * Windows-system partition, so we have to use the same
+ * error code (EPERM).
+ * The restart page may also be identified as version 2.0
+ * when access to the file system is terminated abruptly
+ * by unplugging or power cut, so mounting is also rejected
+ * after such an event.
+ */
+ if (rp
+ && (rp->major_ver == const_cpu_to_le16(2))
+ && (rp->minor_ver == const_cpu_to_le16(0))) {
+ ntfs_log_error("Metadata kept in Windows cache, refused to mount.\n");
+ err = EPERM;
+ }
free(rp);
ntfs_attr_close(na);
out:
@@ -743,7 +793,8 @@ int ntfs_volume_check_hiberfile(ntfs_volume *vol, int verbose)
errno = EPERM;
goto out;
}
- if (memcmp(buf, "hibr", 4) == 0) {
+ if ((memcmp(buf, "hibr", 4) == 0)
+ || (memcmp(buf, "HIBR", 4) == 0)) {
if (verbose)
ntfs_log_error("Windows is hibernated, refused to mount.\n");
errno = EPERM;
@@ -837,7 +888,7 @@ static int fix_txf_data(ntfs_volume *vol)
* @flags 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
+ * NTFS_MNT_RDONLY - mount volume read-only
*
* The function opens the device @dev and verifies that it contains a valid
* bootsector. Then, it allocates an ntfs_volume structure and initializes
@@ -848,7 +899,7 @@ static int fix_txf_data(ntfs_volume *vol)
* 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 flags)
+ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, ntfs_mount_flags flags)
{
s64 l;
ntfs_volume *vol;
@@ -860,6 +911,7 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long flags)
VOLUME_INFORMATION *vinf;
ntfschar *vname;
int i, j, eo;
+ unsigned int k;
u32 u;
vol = ntfs_volume_startup(dev, flags);
@@ -1017,6 +1069,17 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long flags)
ntfs_log_perror("Failed to close $UpCase");
goto error_exit;
}
+ /* Consistency check of $UpCase, restricted to plain ASCII chars */
+ k = 0x20;
+ while ((k < vol->upcase_len)
+ && (k < 0x7f)
+ && (le16_to_cpu(vol->upcase[k])
+ == ((k < 'a') || (k > 'z') ? k : k + 'A' - 'a')))
+ k++;
+ if (k < 0x7f) {
+ ntfs_log_error("Corrupted file $UpCase\n");
+ goto io_error_exit;
+ }
/*
* Now load $Volume and set the version information and flags in the
@@ -1164,22 +1227,23 @@ ntfs_volume *ntfs_device_mount(struct ntfs_device *dev, unsigned long flags)
* Check for dirty logfile and hibernated Windows.
* We care only about read-write mounts.
*/
- if (!(flags & MS_RDONLY)) {
- if (!(flags & MS_IGNORE_HIBERFILE) &&
+ if (!(flags & (NTFS_MNT_RDONLY | NTFS_MNT_FORENSIC))) {
+ if (!(flags & NTFS_MNT_IGNORE_HIBERFILE) &&
ntfs_volume_check_hiberfile(vol, 1) < 0)
goto error_exit;
if (ntfs_volume_check_logfile(vol) < 0) {
- if (!(flags & MS_RECOVER))
+ /* Always reject cached metadata for now */
+ if (!(flags & NTFS_MNT_RECOVER) || (errno == EPERM))
goto error_exit;
ntfs_log_info("The file system wasn't safely "
"closed on Windows. Fixing.\n");
if (ntfs_logfile_reset(vol))
goto error_exit;
}
- }
/* make $TXF_DATA resident if present on the root directory */
- if (!NVolReadOnly(vol) && fix_txf_data(vol))
- goto error_exit;
+ if (fix_txf_data(vol))
+ goto error_exit;
+ }
return vol;
io_error_exit:
@@ -1195,6 +1259,58 @@ error_exit:
return NULL;
}
+/*
+ * Set appropriate flags for showing NTFS metafiles
+ * or files marked as hidden.
+ * Not set in ntfs_mount() to avoid breaking existing tools.
+ */
+
+int ntfs_set_shown_files(ntfs_volume *vol,
+ BOOL show_sys_files, BOOL show_hid_files,
+ BOOL hide_dot_files)
+{
+ int res;
+
+ res = -1;
+ if (vol) {
+ NVolClearShowSysFiles(vol);
+ NVolClearShowHidFiles(vol);
+ NVolClearHideDotFiles(vol);
+ if (show_sys_files)
+ NVolSetShowSysFiles(vol);
+ if (show_hid_files)
+ NVolSetShowHidFiles(vol);
+ if (hide_dot_files)
+ NVolSetHideDotFiles(vol);
+ res = 0;
+ }
+ if (res)
+ ntfs_log_error("Failed to set file visibility\n");
+ return (res);
+}
+
+/*
+ * Set ignore case mode
+ */
+
+int ntfs_set_ignore_case(ntfs_volume *vol)
+{
+ int res;
+
+ res = -1;
+ if (vol && vol->upcase) {
+ vol->locase = ntfs_locase_table_build(vol->upcase,
+ vol->upcase_len);
+ if (vol->locase) {
+ NVolClearCaseSensitive(vol);
+ res = 0;
+ }
+ }
+ if (res)
+ ntfs_log_error("Failed to set ignore_case mode\n");
+ return (res);
+}
+
/**
* ntfs_mount - open ntfs volume
* @name: name of device/file to open
@@ -1206,7 +1322,7 @@ error_exit:
* @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
* is implemented:
- * MS_RDONLY - mount volume read-only
+ * NTFS_MNT_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
@@ -1221,7 +1337,7 @@ error_exit:
* soon as the function returns.
*/
ntfs_volume *ntfs_mount(const char *name __attribute__((unused)),
- unsigned long flags __attribute__((unused)))
+ ntfs_mount_flags flags __attribute__((unused)))
{
#ifndef NO_NTFS_DEVICE_DEFAULT_IO_OPS
struct ntfs_device *dev;
@@ -1290,18 +1406,6 @@ int ntfs_umount(ntfs_volume *vol, const BOOL force __attribute__((unused)))
#ifdef HAVE_MNTENT_H
-#ifndef HAVE_REALPATH
-/**
- * realpath - If there is no realpath on the system
- */
-static char *realpath(const char *path, char *resolved_path)
-{
- strncpy(resolved_path, path, PATH_MAX);
- resolved_path[PATH_MAX] = '\0';
- return resolved_path;
-}
-#endif
-
/**
* ntfs_mntent_check - desc
*
@@ -1325,16 +1429,17 @@ static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags)
err = errno;
goto exit;
}
- if (!realpath(file, real_file)) {
+ if (!ntfs_realpath_canonicalize(file, real_file)) {
err = errno;
goto exit;
}
- if (!(f = setmntent(MOUNTED, "r"))) {
+ f = setmntent("/proc/mounts", "r");
+ if (!f && !(f = setmntent(MOUNTED, "r"))) {
err = errno;
goto exit;
}
while ((mnt = getmntent(f))) {
- if (!realpath(mnt->mnt_fsname, real_fsname))
+ if (!ntfs_realpath_canonicalize(mnt->mnt_fsname, real_fsname))
continue;
if (!strcmp(real_file, real_fsname))
break;
@@ -1358,6 +1463,60 @@ exit:
}
return 0;
}
+
+#else /* HAVE_MNTENT_H */
+
+#if defined(__sun) && defined (__SVR4)
+
+static int ntfs_mntent_check(const char *file, unsigned long *mnt_flags)
+{
+ struct mnttab *mnt = NULL;
+ char *real_file = NULL, *real_fsname = NULL;
+ FILE *f;
+ int err = 0;
+
+ real_file = (char*)ntfs_malloc(PATH_MAX + 1);
+ if (!real_file)
+ return -1;
+ real_fsname = (char*)ntfs_malloc(PATH_MAX + 1);
+ mnt = (struct mnttab*)ntfs_malloc(MNT_LINE_MAX + 1);
+ if (!real_fsname || !mnt) {
+ err = errno;
+ goto exit;
+ }
+ if (!ntfs_realpath_canonicalize(file, real_file)) {
+ err = errno;
+ goto exit;
+ }
+ if (!(f = fopen(MNTTAB, "r"))) {
+ err = errno;
+ goto exit;
+ }
+ while (!getmntent(f, mnt)) {
+ if (!ntfs_realpath_canonicalize(mnt->mnt_special, real_fsname))
+ continue;
+ if (!strcmp(real_file, real_fsname)) {
+ *mnt_flags = NTFS_MF_MOUNTED;
+ if (!strcmp(mnt->mnt_mountp, "/"))
+ *mnt_flags |= NTFS_MF_ISROOT;
+ if (hasmntopt(mnt, "ro") && !hasmntopt(mnt, "rw"))
+ *mnt_flags |= NTFS_MF_READONLY;
+ break;
+ }
+ }
+ fclose(f);
+exit:
+ free(mnt);
+ free(real_file);
+ free(real_fsname);
+ if (err) {
+ errno = err;
+ return -1;
+ }
+ return 0;
+}
+
+#endif /* defined(__sun) && defined (__SVR4) */
#endif /* HAVE_MNTENT_H */
/**
@@ -1389,7 +1548,7 @@ int ntfs_check_if_mounted(const char *file __attribute__((unused)),
unsigned long *mnt_flags)
{
*mnt_flags = 0;
-#ifdef HAVE_MNTENT_H
+#if defined(HAVE_MNTENT_H) || (defined(__sun) && defined (__SVR4))
return ntfs_mntent_check(file, mnt_flags);
#else
return 0;
@@ -1571,6 +1730,10 @@ int ntfs_volume_error(int err)
ret = NTFS_VOLUME_CORRUPT;
break;
case EPERM:
+ /*
+ * Hibernation and fast restarting are seen the
+ * same way on a non Windows-system partition.
+ */
ret = NTFS_VOLUME_HIBERNATED;
break;
case EOPNOTSUPP:
@@ -1661,3 +1824,113 @@ int ntfs_volume_get_free_space(ntfs_volume *vol)
}
return (ret);
}
+
+/**
+ * ntfs_volume_rename - change the current label on a volume
+ * @vol: volume to change the label on
+ * @label: the new label
+ * @label_len: the length of @label in ntfschars including the terminating NULL
+ * character, which is mandatory (the value can not exceed 128)
+ *
+ * Change the label on the volume @vol to @label.
+ */
+int ntfs_volume_rename(ntfs_volume *vol, const ntfschar *label, int label_len)
+{
+ ntfs_attr *na;
+ char *old_vol_name;
+ char *new_vol_name = NULL;
+ int new_vol_name_len;
+ int err;
+
+ if (NVolReadOnly(vol)) {
+ ntfs_log_error("Refusing to change label on read-only mounted "
+ "volume.\n");
+ errno = EROFS;
+ return -1;
+ }
+
+ label_len *= sizeof(ntfschar);
+ if (label_len > 0x100) {
+ ntfs_log_error("New label is too long. Maximum %u characters "
+ "allowed.\n",
+ (unsigned)(0x100 / sizeof(ntfschar)));
+ errno = ERANGE;
+ return -1;
+ }
+
+ na = ntfs_attr_open(vol->vol_ni, AT_VOLUME_NAME, AT_UNNAMED, 0);
+ if (!na) {
+ if (errno != ENOENT) {
+ err = errno;
+ ntfs_log_perror("Lookup of $VOLUME_NAME attribute "
+ "failed");
+ goto err_out;
+ }
+
+ /* The volume name attribute does not exist. Need to add it. */
+ if (ntfs_attr_add(vol->vol_ni, AT_VOLUME_NAME, AT_UNNAMED, 0,
+ (const u8*) label, label_len))
+ {
+ err = errno;
+ ntfs_log_perror("Encountered error while adding "
+ "$VOLUME_NAME attribute");
+ goto err_out;
+ }
+ }
+ else {
+ s64 written;
+
+ if (NAttrNonResident(na)) {
+ err = errno;
+ ntfs_log_error("Error: Attribute $VOLUME_NAME must be "
+ "resident.\n");
+ goto err_out;
+ }
+
+ if (na->data_size != label_len) {
+ if (ntfs_attr_truncate(na, label_len)) {
+ err = errno;
+ ntfs_log_perror("Error resizing resident "
+ "attribute");
+ goto err_out;
+ }
+ }
+
+ if (label_len) {
+ written = ntfs_attr_pwrite(na, 0, label_len, label);
+ if (written == -1) {
+ err = errno;
+ ntfs_log_perror("Error when writing "
+ "$VOLUME_NAME data");
+ goto err_out;
+ }
+ else if (written != label_len) {
+ err = EIO;
+ ntfs_log_error("Partial write when writing "
+ "$VOLUME_NAME data.");
+ goto err_out;
+
+ }
+ }
+ }
+
+ new_vol_name_len =
+ ntfs_ucstombs(label, label_len, &new_vol_name, 0);
+ if (new_vol_name_len == -1) {
+ err = errno;
+ ntfs_log_perror("Error while decoding new volume name");
+ goto err_out;
+ }
+
+ old_vol_name = vol->vol_name;
+ vol->vol_name = new_vol_name;
+ free(old_vol_name);
+
+ err = 0;
+err_out:
+ if (na)
+ ntfs_attr_close(na);
+ if (err)
+ errno = err;
+ return err ? -1 : 0;
+}
diff --git a/libntfs-3g/win32_io.c b/libntfs-3g/win32_io.c
index ed9fa52..437a3fc 100755
--- a/libntfs-3g/win32_io.c
+++ b/libntfs-3g/win32_io.c
@@ -6,6 +6,7 @@
* Copyright (c) 2003-2004 Lode Leroy
* Copyright (c) 2003-2006 Anton Altaparmakov
* Copyright (c) 2004-2005 Yuval Fledel
+ * Copyright (c) 2012-2013 Jean-Pierre Andre
*
* This program/include file is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as published
@@ -26,8 +27,33 @@
#include "config.h"
#ifdef HAVE_WINDOWS_H
+#define BOOL WINBOOL /* avoid conflicting definitions of BOOL */
#include <windows.h>
+#undef BOOL
#endif
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+/*
+ * Definitions needed for <winioctl.h>
+ */
+#ifndef _ANONYMOUS_UNION
+#define _ANONYMOUS_UNION
+#define _ANONYMOUS_STRUCT
+typedef unsigned long long DWORD64;
+#endif
+
+typedef struct {
+ DWORD data1; /* The first eight hexadecimal digits of the GUID. */
+ WORD data2; /* The first group of four hexadecimal digits. */
+ WORD data3; /* The second group of four hexadecimal digits. */
+ char data4[8]; /* The first two bytes are the third group of four
+ hexadecimal digits. The remaining six bytes are the
+ final 12 hexadecimal digits. */
+} GUID;
+
#include <winioctl.h>
#ifdef HAVE_STDIO_H
@@ -42,6 +68,11 @@
#ifdef HAVE_FCNTL_H
#include <fcntl.h>
#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#define stat stat64
+#define st_blocks st_rdev /* emulate st_blocks, missing in Windows */
+#endif
/* Prevent volume.h from being be loaded, as it conflicts with winnt.h. */
#define _NTFS_VOLUME_H
@@ -51,6 +82,10 @@ typedef struct ntfs_volume ntfs_volume;
#include "debug.h"
#include "types.h"
#include "device.h"
+#include "misc.h"
+
+#define cpu_to_le16(x) (x)
+#define const_cpu_to_le16(x) (x)
#ifndef MAX_PATH
#define MAX_PATH 1024
@@ -61,10 +96,26 @@ typedef struct ntfs_volume ntfs_volume;
#define NTFS_BLOCK_SIZE_BITS 9
#endif
+#ifndef INVALID_SET_FILE_POINTER
+#define INVALID_SET_FILE_POINTER ((DWORD)-1)
+#endif
+
#ifndef IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS
#define IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS 5636096
#endif
+#ifndef IOCTL_DISK_GET_DRIVE_GEOMETRY
+#define IOCTL_DISK_GET_DRIVE_GEOMETRY 0x70000
+#endif
+
+#ifndef IOCTL_GET_DISK_LENGTH_INFO
+#define IOCTL_GET_DISK_LENGTH_INFO 0x7405c
+#endif
+
+#ifndef FSCTL_ALLOW_EXTENDED_DASD_IO
+#define FSCTL_ALLOW_EXTENDED_DASD_IO 0x90083
+#endif
+
/* Windows 2k+ imports. */
typedef HANDLE (WINAPI *LPFN_FINDFIRSTVOLUME)(LPTSTR, DWORD);
typedef BOOL (WINAPI *LPFN_FINDNEXTVOLUME)(HANDLE, LPTSTR, DWORD);
@@ -83,6 +134,146 @@ static LPFN_SETFILEPOINTEREX fnSetFilePointerEx = NULL;
#define FNPOSTFIX "A"
#endif
+enum { /* see http://msdn.microsoft.com/en-us/library/cc704588(v=prot.10).aspx */
+ STATUS_UNKNOWN = -1,
+ STATUS_SUCCESS = 0x00000000,
+ STATUS_BUFFER_OVERFLOW = 0x80000005,
+ STATUS_INVALID_HANDLE = 0xC0000008,
+ STATUS_INVALID_PARAMETER = 0xC000000D,
+ STATUS_INVALID_DEVICE_REQUEST = 0xC0000010,
+ STATUS_END_OF_FILE = 0xC0000011,
+ STATUS_CONFLICTING_ADDRESSES = 0xC0000018,
+ STATUS_NO_MATCH = 0xC000001E,
+ STATUS_ACCESS_DENIED = 0xC0000022,
+ STATUS_BUFFER_TOO_SMALL = 0xC0000023,
+ STATUS_OBJECT_TYPE_MISMATCH = 0xC0000024,
+ STATUS_FILE_NOT_FOUND = 0xC0000028,
+ STATUS_OBJECT_NAME_INVALID = 0xC0000033,
+ STATUS_OBJECT_NAME_NOT_FOUND = 0xC0000034,
+ STATUS_INVALID_PARAMETER_1 = 0xC00000EF,
+ STATUS_IO_DEVICE_ERROR = 0xC0000185,
+ STATUS_GUARD_PAGE_VIOLATION = 0x80000001
+ } ;
+
+typedef u32 NTSTATUS; /* do not let the compiler choose the size */
+#ifdef __x86_64__
+typedef unsigned long long ULONG_PTR; /* an integer the same size as a pointer */
+#else
+typedef unsigned long ULONG_PTR; /* an integer the same size as a pointer */
+#endif
+
+HANDLE get_osfhandle(int); /* from msvcrt.dll */
+
+/*
+ * A few needed definitions not included in <windows.h>
+ */
+
+typedef struct _IO_STATUS_BLOCK {
+ union {
+ NTSTATUS Status;
+ PVOID Pointer;
+ };
+ ULONG_PTR Information;
+} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
+
+typedef struct _UNICODE_STRING {
+ USHORT Length;
+ USHORT MaximumLength;
+#ifdef __x86_64__
+ u32 padding;
+#endif
+ PWSTR Buffer;
+} UNICODE_STRING, *PUNICODE_STRING;
+
+typedef struct _OBJECT_ATTRIBUTES {
+ ULONG Length;
+#ifdef __x86_64__
+ u32 padding1;
+ HANDLE RootDirectory;
+ PUNICODE_STRING ObjectName;
+ ULONG Attributes;
+ u32 padding2;
+#else
+ HANDLE RootDirectory;
+ PUNICODE_STRING ObjectName;
+ ULONG Attributes;
+#endif
+ PVOID SecurityDescriptor;
+ PVOID SecurityQualityOfService;
+} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;
+
+#define FILE_OPEN 1
+#define FILE_CREATE 2
+#define FILE_OVERWRITE 4
+#define FILE_SYNCHRONOUS_IO_ALERT 0x10
+#define FILE_SYNCHRONOUS_IO_NONALERT 0x20
+#define OBJ_CASE_INSENSITIVE 0x40
+
+typedef void (WINAPI *PIO_APC_ROUTINE)(void*, PIO_STATUS_BLOCK, ULONG);
+
+extern WINAPI NTSTATUS NtOpenFile(
+ PHANDLE FileHandle,
+ ACCESS_MASK DesiredAccess,
+ POBJECT_ATTRIBUTES ObjectAttributes,
+ PIO_STATUS_BLOCK IoStatusBlock,
+ ULONG ShareAccess,
+ ULONG OpenOptions
+);
+
+extern WINAPI NTSTATUS NtReadFile(
+ HANDLE FileHandle,
+ HANDLE Event,
+ PIO_APC_ROUTINE ApcRoutine,
+ PVOID ApcContext,
+ PIO_STATUS_BLOCK IoStatusBlock,
+ PVOID Buffer,
+ ULONG Length,
+ PLARGE_INTEGER ByteOffset,
+ PULONG Key
+);
+
+extern WINAPI NTSTATUS NtWriteFile(
+ HANDLE FileHandle,
+ HANDLE Event,
+ PIO_APC_ROUTINE ApcRoutine,
+ PVOID ApcContext,
+ PIO_STATUS_BLOCK IoStatusBlock,
+ LPCVOID Buffer,
+ ULONG Length,
+ PLARGE_INTEGER ByteOffset,
+ PULONG Key
+);
+
+extern NTSTATUS WINAPI NtClose(
+ HANDLE Handle
+);
+
+extern NTSTATUS WINAPI NtDeviceIoControlFile(
+ HANDLE FileHandle,
+ HANDLE Event,
+ PIO_APC_ROUTINE ApcRoutine,
+ PVOID ApcContext,
+ PIO_STATUS_BLOCK IoStatusBlock,
+ ULONG IoControlCode,
+ PVOID InputBuffer,
+ ULONG InputBufferLength,
+ PVOID OutputBuffer,
+ ULONG OutputBufferLength
+);
+
+extern NTSTATUS WINAPI NtFsControlFile(
+ HANDLE FileHandle,
+ HANDLE Event,
+ PIO_APC_ROUTINE ApcRoutine,
+ PVOID ApcContext,
+ PIO_STATUS_BLOCK IoStatusBlock,
+ ULONG FsControlCode,
+ PVOID InputBuffer,
+ ULONG InputBufferLength,
+ PVOID OutputBuffer,
+ ULONG OutputBufferLength
+);
+
/**
* struct win32_fd -
*/
@@ -93,8 +284,11 @@ typedef struct {
s64 part_length;
int part_hidden_sectors;
s64 geo_size, geo_cylinders;
+ s32 geo_sector_size;
+ s64 volume_size;
DWORD geo_sectors, geo_heads;
HANDLE vol_handle;
+ BOOL ntdll;
} win32_fd;
/**
@@ -146,6 +340,26 @@ static int ntfs_w32error_to_errno(unsigned int w32error)
}
}
+static int ntfs_ntstatus_to_errno(NTSTATUS status)
+{
+ ntfs_log_trace("Converting w32error 0x%x.\n",w32error);
+ switch (status) {
+ case STATUS_INVALID_HANDLE :
+ case STATUS_INVALID_PARAMETER :
+ case STATUS_OBJECT_NAME_INVALID :
+ case STATUS_INVALID_DEVICE_REQUEST :
+ return (EINVAL);
+ case STATUS_ACCESS_DENIED :
+ return (EACCES);
+ case STATUS_IO_DEVICE_ERROR :
+ case STATUS_END_OF_FILE :
+ return (EIO);
+ default:
+ /* generic message */
+ return ENOMSG;
+ }
+}
+
/**
* libntfs_SetFilePointerEx - emulation for SetFilePointerEx()
*
@@ -156,10 +370,11 @@ 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 &&
+ liDistanceToMove.u.LowPart = SetFilePointer(hFile,
+ liDistanceToMove.u.LowPart,
+ &liDistanceToMove.u.HighPart, dwMoveMethod);
+ SetLastError(NO_ERROR);
+ if (liDistanceToMove.u.LowPart == INVALID_SET_FILE_POINTER &&
GetLastError() != NO_ERROR) {
if (lpNewFilePointer)
lpNewFilePointer->QuadPart = -1;
@@ -199,7 +414,7 @@ static void ntfs_device_win32_init_imports(void)
* SetFilePointerEx().
*/
if (!fnSetFilePointerEx) {
- ntfs_log_debug("SetFilePonterEx() not found in "
+ ntfs_log_debug("SetFilePointerEx() not found in "
"kernel32.dll: Enabling emulation.\n");
fnSetFilePointerEx = libntfs_SetFilePointerEx;
}
@@ -232,13 +447,13 @@ static __inline__ int ntfs_device_unix_status_flags_to_win32(int flags)
switch (flags & O_ACCMODE) {
case O_RDONLY:
- win_mode = FILE_READ_DATA;
+ win_mode = GENERIC_READ;
break;
case O_WRONLY:
- win_mode = FILE_WRITE_DATA;
+ win_mode = GENERIC_WRITE;
break;
case O_RDWR:
- win_mode = FILE_READ_DATA | FILE_WRITE_DATA;
+ win_mode = GENERIC_READ | GENERIC_WRITE;
break;
default:
/* error */
@@ -267,7 +482,8 @@ 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, (flags & O_CREAT ? OPEN_ALWAYS : OPEN_EXISTING),
+ 0, NULL);
if (*handle == INVALID_HANDLE_VALUE) {
errno = ntfs_w32error_to_errno(GetLastError());
ntfs_log_trace("CreateFile(%s) failed.\n", filename);
@@ -321,6 +537,22 @@ static int ntfs_device_win32_unlock(HANDLE handle)
return 0;
}
+static int ntfs_device_win32_setlock(HANDLE handle, ULONG code)
+{
+ IO_STATUS_BLOCK io_status;
+ NTSTATUS res;
+
+ io_status.Status = STATUS_SUCCESS;
+ io_status.Information = 0;
+ res = NtFsControlFile(handle,(HANDLE)NULL,
+ (PIO_APC_ROUTINE)NULL,(void*)NULL,
+ &io_status, code,
+ (char*)NULL,0,(char*)NULL,0);
+ if (res != STATUS_SUCCESS)
+ errno = ntfs_ntstatus_to_errno(res);
+ return (res == STATUS_SUCCESS ? 0 : -1);
+}
+
/**
* ntfs_device_win32_dismount - dismount a volume
* @handle: a win32 HANDLE for a volume to dismount
@@ -359,15 +591,18 @@ static int ntfs_device_win32_dismount(HANDLE handle)
*/
static s64 ntfs_device_win32_getsize(HANDLE handle)
{
- DWORD loword, hiword;
+ LONG loword, hiword;
- loword = GetFileSize(handle, &hiword);
- if (loword == INVALID_FILE_SIZE) {
+ SetLastError(NO_ERROR);
+ hiword = 0;
+ loword = SetFilePointer(handle, 0, &hiword, 2);
+ if ((loword == INVALID_SET_FILE_POINTER)
+ && (GetLastError() != NO_ERROR)) {
errno = ntfs_w32error_to_errno(GetLastError());
ntfs_log_trace("Couldn't get file size.\n");
return -1;
}
- return ((s64)hiword << 32) + loword;
+ return ((s64)hiword << 32) + (ULONG)loword;
}
/**
@@ -467,6 +702,7 @@ static int ntfs_device_win32_getgeo(HANDLE handle, win32_fd *fd)
fd->geo_cylinders = ((DISK_GEOMETRY*)&b)->Cylinders.QuadPart;
fd->geo_sectors = ((DISK_GEOMETRY*)&b)->SectorsPerTrack;
fd->geo_size = ((DISK_GEOMETRY_EX*)&b)->DiskSize.QuadPart;
+ fd->geo_sector_size = NTFS_BLOCK_SIZE;
switch (ddi->DetectionType) {
case DetectInt13:
fd->geo_cylinders = ddi->Int13.MaxCylinders;
@@ -493,6 +729,7 @@ static int ntfs_device_win32_getgeo(HANDLE handle, win32_fd *fd)
fd->geo_size = fd->geo_cylinders * fd->geo_sectors *
((DISK_GEOMETRY*)&b)->TracksPerCylinder *
((DISK_GEOMETRY*)&b)->BytesPerSector;
+ fd->geo_sector_size = ((DISK_GEOMETRY*)&b)->BytesPerSector;
return 0;
}
errno = ntfs_w32error_to_errno(GetLastError());
@@ -500,9 +737,51 @@ static int ntfs_device_win32_getgeo(HANDLE handle, win32_fd *fd)
fd->geo_cylinders = -1;
fd->geo_sectors = -1;
fd->geo_size = -1;
+ fd->geo_sector_size = NTFS_BLOCK_SIZE;
return -1;
}
+static int ntfs_device_win32_getntgeo(HANDLE handle, win32_fd *fd)
+{
+ DISK_GEOMETRY geo;
+ NTSTATUS st;
+ IO_STATUS_BLOCK status;
+ u64 bytes;
+ int res;
+
+ res = -1;
+ fd->geo_cylinders = 0;
+ fd->geo_sectors = 0;
+ fd->geo_size = 1073741824;
+ fd->geo_sectors = fd->geo_size >> 9;
+ fd->geo_sector_size = NTFS_BLOCK_SIZE;
+
+ st = NtDeviceIoControlFile(handle, (HANDLE)NULL,
+ (PIO_APC_ROUTINE)NULL, (void*)NULL,
+ &status, IOCTL_DISK_GET_DRIVE_GEOMETRY, (void*)NULL, 0,
+ (void*)&geo, sizeof(geo));
+ if (st == STATUS_SUCCESS) {
+ /* over-estimate the (rounded) number of cylinders */
+ fd->geo_cylinders = geo.Cylinders.QuadPart + 1;
+ fd->geo_sectors = fd->geo_cylinders
+ *geo.TracksPerCylinder*geo.SectorsPerTrack;
+ fd->geo_size = fd->geo_sectors*geo.BytesPerSector;
+ fd->geo_sector_size = geo.BytesPerSector;
+ res = 0;
+ /* try to get the exact sector count */
+ st = NtDeviceIoControlFile(handle, (HANDLE)NULL,
+ (PIO_APC_ROUTINE)NULL, (void*)NULL,
+ &status, IOCTL_GET_DISK_LENGTH_INFO,
+ (void*)NULL, 0,
+ (void*)&bytes, sizeof(bytes));
+ if (st == STATUS_SUCCESS) {
+ fd->geo_size = bytes;
+ fd->geo_sectors = bytes/geo.BytesPerSector;
+ }
+ }
+ return (res);
+}
+
/**
* ntfs_device_win32_open_file - open a file via win32 API
* @filename: name of the file to open
@@ -516,12 +795,22 @@ static __inline__ int ntfs_device_win32_open_file(char *filename, win32_fd *fd,
int flags)
{
HANDLE handle;
+ int mode;
if (ntfs_device_win32_simple_open_file(filename, &handle, flags,
FALSE)) {
/* open error */
return -1;
}
+ mode = flags & O_ACCMODE;
+ if ((mode == O_RDWR) || (mode == O_WRONLY)) {
+ DWORD bytes;
+
+ /* try making sparse (but ignore errors) */
+ DeviceIoControl(handle, FSCTL_SET_SPARSE,
+ (void*)NULL, 0, (void*)NULL, 0,
+ &bytes, (LPOVERLAPPED)NULL);
+ }
/* fill fd */
fd->handle = handle;
fd->part_start = 0;
@@ -530,6 +819,8 @@ static __inline__ int ntfs_device_win32_open_file(char *filename, win32_fd *fd,
fd->part_hidden_sectors = -1;
fd->geo_size = -1; /* used as a marker that this is a file */
fd->vol_handle = INVALID_HANDLE_VALUE;
+ fd->geo_sector_size = 512; /* will be adjusted from the boot sector */
+ fd->ntdll = FALSE;
return 0;
}
@@ -561,6 +852,90 @@ static __inline__ int ntfs_device_win32_open_drive(int drive_id, win32_fd *fd,
if (fd->geo_size == -1)
fd->geo_size = ntfs_device_win32_getdisklength(handle);
/* fill fd */
+ fd->ntdll = FALSE;
+ fd->handle = handle;
+ fd->part_start = 0;
+ fd->part_length = fd->geo_size;
+ fd->pos = 0;
+ fd->part_hidden_sectors = -1;
+ fd->vol_handle = INVALID_HANDLE_VALUE;
+ return 0;
+}
+
+/**
+ * ntfs_device_win32_open_lowlevel - open a drive via low level 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.
+ * -1 if not, and errno set.
+ */
+static __inline__ int ntfs_device_win32_open_lowlevel(int drive_id,
+ win32_fd *fd, int flags)
+{
+ HANDLE handle;
+ NTSTATUS st;
+ ACCESS_MASK access;
+ ULONG share;
+ OBJECT_ATTRIBUTES attr;
+ IO_STATUS_BLOCK io_status;
+ UNICODE_STRING unicode_name;
+ ntfschar unicode_buffer[7];
+ int mode;
+ static const ntfschar unicode_init[] = {
+ const_cpu_to_le16('\\'), const_cpu_to_le16('?'),
+ const_cpu_to_le16('?'), const_cpu_to_le16('\\'),
+ const_cpu_to_le16(' '), const_cpu_to_le16(':'),
+ const_cpu_to_le16(0)
+ };
+
+ memcpy(unicode_buffer, unicode_init, sizeof(unicode_buffer));
+ unicode_buffer[4] = cpu_to_le16(drive_id + 'A');
+ unicode_name.Buffer = unicode_buffer;
+ unicode_name.Length = 6*sizeof(ntfschar);
+ unicode_name.MaximumLength = 6*sizeof(ntfschar);
+
+ attr.Length = sizeof(OBJECT_ATTRIBUTES);
+ attr.RootDirectory = (HANDLE*)NULL;
+ attr.ObjectName = &unicode_name;
+ attr.Attributes = OBJ_CASE_INSENSITIVE;
+ attr.SecurityDescriptor = (void*)NULL;
+ attr.SecurityQualityOfService = (void*)NULL;
+
+ io_status.Status = 0;
+ io_status.Information = 0;
+ mode = flags & O_ACCMODE;
+ share = (mode == O_RDWR ?
+ 0 : FILE_SHARE_READ | FILE_SHARE_WRITE);
+ access = (mode == O_RDWR ?
+ FILE_READ_DATA | FILE_WRITE_DATA | SYNCHRONIZE
+ : FILE_READ_DATA | SYNCHRONIZE);
+
+ st = NtOpenFile(&handle, access,
+ &attr, &io_status,
+ share,
+ FILE_SYNCHRONOUS_IO_ALERT);
+ if (st != STATUS_SUCCESS) {
+ errno = ntfs_ntstatus_to_errno(st);
+ return (-1);
+ }
+ ntfs_device_win32_setlock(handle,FSCTL_LOCK_VOLUME);
+ /* store the drive geometry */
+ ntfs_device_win32_getntgeo(handle, fd);
+ fd->ntdll = TRUE;
+ /* allow accessing the full partition */
+ st = NtFsControlFile(handle, (HANDLE)NULL,
+ (PIO_APC_ROUTINE)NULL,
+ (PVOID)NULL, &io_status,
+ FSCTL_ALLOW_EXTENDED_DASD_IO,
+ NULL, 0, NULL, 0);
+ if (st != STATUS_SUCCESS) {
+ errno = ntfs_ntstatus_to_errno(st);
+ NtClose(handle);
+ return (-1);
+ }
+ /* fill fd */
fd->handle = handle;
fd->part_start = 0;
fd->part_length = fd->geo_size;
@@ -694,7 +1069,7 @@ static BOOL ntfs_device_win32_find_partition(HANDLE handle, DWORD partition_id,
do {
buf_size = sizeof(DRIVE_LAYOUT_INFORMATION) +
part_count * sizeof(PARTITION_INFORMATION);
- drive_layout = malloc(buf_size);
+ drive_layout = (DRIVE_LAYOUT_INFORMATION*)ntfs_malloc(buf_size);
if (!drive_layout) {
errno = ENOMEM;
return FALSE;
@@ -775,6 +1150,8 @@ static int ntfs_device_win32_open_partition(int drive_id,
fd->part_start = part_start;
fd->part_length = part_length;
fd->part_hidden_sectors = hidden_sectors;
+ fd->geo_sector_size = 512;
+ fd->ntdll = FALSE;
tmp = ntfs_device_win32_getntfssize(vol_handle);
if (tmp > 0)
fd->geo_size = tmp;
@@ -837,7 +1214,13 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags)
}
ntfs_device_win32_init_imports();
numparams = sscanf(dev->d_name, "/dev/hd%c%u", &drive_char, &part);
- drive_id = toupper(drive_char) - 'A';
+ if (!numparams
+ && (dev->d_name[1] == ':')
+ && (dev->d_name[2] == '\0')) {
+ drive_char = dev->d_name[0];
+ numparams = 3;
+ drive_id = toupper(drive_char) - 'A';
+ }
switch (numparams) {
case 0:
ntfs_log_debug("win32_open(%s) -> file.\n", dev->d_name);
@@ -854,6 +1237,12 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags)
err = ntfs_device_win32_open_partition(drive_id, part, &fd,
flags);
break;
+ case 3:
+ ntfs_log_debug("win32_open(%s) -> drive %c:\n",
+ dev->d_name, drive_char);
+ err = ntfs_device_win32_open_lowlevel(drive_id, &fd,
+ flags);
+ break;
default:
ntfs_log_debug("win32_open(%s) -> unknwon file format.\n",
dev->d_name);
@@ -866,7 +1255,7 @@ static int ntfs_device_win32_open(struct ntfs_device *dev, int flags)
/* Setup our read-only flag. */
if ((flags & O_RDWR) != O_RDWR)
NDevSetReadOnly(dev);
- dev->d_private = malloc(sizeof(win32_fd));
+ dev->d_private = (win32_fd*)ntfs_malloc(sizeof(win32_fd));
memcpy(dev->d_private, &fd, sizeof(win32_fd));
NDevSetOpen(dev);
NDevClearDirty(dev);
@@ -916,7 +1305,8 @@ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset,
errno = EINVAL;
return -1;
}
- if (abs_ofs < 0 || abs_ofs > fd->part_length) {
+ if ((abs_ofs < 0)
+ || (fd->ntdll && (abs_ofs > fd->part_length))) {
ntfs_log_trace("Seeking outsize seekable area.\n");
errno = EINVAL;
return -1;
@@ -937,18 +1327,19 @@ static s64 ntfs_device_win32_seek(struct ntfs_device *dev, s64 offset,
* error returns -1 and errno set. Transfer starts from position @pos on @fd.
*
* Notes:
- * - @pos, @buf, and @count must be aligned to NTFS_BLOCK_SIZE.
+ * - @pos, @buf, and @count must be aligned to geo_sector_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_pio(win32_fd *fd, const s64 pos,
- const s64 count, void *b, const BOOL write)
+ const s64 count, void *rbuf, const void *wbuf)
{
LARGE_INTEGER li;
HANDLE handle;
DWORD bt;
BOOL res;
+ s64 bytes;
ntfs_log_trace("pos = 0x%llx, count = 0x%llx, direction = %s.\n",
(long long)pos, (long long)count, write ? "write" :
@@ -962,21 +1353,57 @@ static s64 ntfs_device_win32_pio(win32_fd *fd, const s64 pos,
handle = fd->handle;
li.QuadPart += fd->part_start;
}
- if (!fnSetFilePointerEx(handle, li, NULL, FILE_BEGIN)) {
- errno = ntfs_w32error_to_errno(GetLastError());
- ntfs_log_trace("SetFilePointer failed.\n");
- return -1;
- }
- 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());
- ntfs_log_trace("%sFile() failed.\n", write ? "Write" : "Read");
- return -1;
+
+ if (fd->ntdll) {
+ IO_STATUS_BLOCK io_status;
+ NTSTATUS res;
+ LARGE_INTEGER offset;
+
+ io_status.Status = STATUS_SUCCESS;
+ io_status.Information = 0;
+ offset.QuadPart = pos;
+ if (wbuf) {
+ res = NtWriteFile(fd->handle,(HANDLE)NULL,
+ (PIO_APC_ROUTINE)NULL,(void*)NULL,
+ &io_status, wbuf, count,
+ &offset, (PULONG)NULL);
+ } else {
+ res = NtReadFile(fd->handle,(HANDLE)NULL,
+ (PIO_APC_ROUTINE)NULL,(void*)NULL,
+ &io_status, rbuf, count,
+ &offset, (PULONG)NULL);
+ }
+ if (res == STATUS_SUCCESS) {
+ bytes = io_status.Information;
+ } else {
+ bytes = -1;
+ errno = ntfs_ntstatus_to_errno(res);
+ }
+ } else {
+ if (!fnSetFilePointerEx(handle, li, NULL, FILE_BEGIN)) {
+ errno = ntfs_w32error_to_errno(GetLastError());
+ ntfs_log_trace("SetFilePointer failed.\n");
+ return -1;
+ }
+ if (wbuf)
+ res = WriteFile(handle, wbuf, count, &bt, NULL);
+ else
+ res = ReadFile(handle, rbuf, count, &bt, NULL);
+ bytes = bt;
+ if (!res) {
+ errno = ntfs_w32error_to_errno(GetLastError());
+ ntfs_log_trace("%sFile() failed.\n", write ?
+ "Write" : "Read");
+ return -1;
+ }
+ if (rbuf && !pos) {
+ /* get the sector size from the boot sector */
+ char *boot = (char*)rbuf;
+ fd->geo_sector_size = (boot[11] & 255)
+ + ((boot[12] & 255) << 8);
+ }
}
- return bt;
+ return bytes;
}
/**
@@ -990,7 +1417,7 @@ static s64 ntfs_device_win32_pio(win32_fd *fd, const s64 pos,
* returns -1 and errno set. Read starts from position @pos.
*
* Notes:
- * - @pos, @buf, and @count must be aligned to NTFS_BLOCK_SIZE.
+ * - @pos, @buf, and @count must be aligned to geo_sector_size.
* - When dealing with volumes, a single call must not span both volume
* and disk extents.
* - Does not use/set @fd->pos.
@@ -998,7 +1425,7 @@ static s64 ntfs_device_win32_pio(win32_fd *fd, const s64 pos,
static inline s64 ntfs_device_win32_pread_simple(win32_fd *fd, const s64 pos,
const s64 count, void *b)
{
- return ntfs_device_win32_pio(fd, pos, count, b, FALSE);
+ return ntfs_device_win32_pio(fd, pos, count, b, (void*)NULL);
}
/**
@@ -1018,9 +1445,9 @@ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *b, s64 count)
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);
+ old_ofs = ofs = old_pos & (fd->geo_sector_size - 1);
+ to_read = (ofs + count + fd->geo_sector_size - 1) &
+ ~(s64)(fd->geo_sector_size - 1);
/* Impose maximum of 2GB to be on the safe side. */
if (to_read > 0x80000000) {
int delta = to_read - count;
@@ -1031,8 +1458,8 @@ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *b, s64 count)
"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 &&
- !(count & (NTFS_BLOCK_SIZE - 1)))
+ if (!((unsigned long)b & (fd->geo_sector_size - 1)) && !old_ofs &&
+ !(count & (fd->geo_sector_size - 1)))
alignedbuffer = b;
else {
alignedbuffer = (BYTE *)VirtualAlloc(NULL, to_read, MEM_COMMIT,
@@ -1047,7 +1474,7 @@ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *b, s64 count)
s64 vol_to_read = fd->geo_size - old_pos;
if (count > vol_to_read) {
br = ntfs_device_win32_pread_simple(fd,
- old_pos & ~(s64)(NTFS_BLOCK_SIZE - 1),
+ old_pos & ~(s64)(fd->geo_sector_size - 1),
ofs + vol_to_read, alignedbuffer);
if (br == -1)
goto read_error;
@@ -1058,13 +1485,13 @@ static s64 ntfs_device_win32_read(struct ntfs_device *dev, void *b, s64 count)
}
br -= ofs;
fd->pos += br;
- ofs = fd->pos & (NTFS_BLOCK_SIZE - 1);
+ ofs = fd->pos & (fd->geo_sector_size - 1);
if (br != vol_to_read)
goto read_partial;
}
}
i = ntfs_device_win32_pread_simple(fd,
- fd->pos & ~(s64)(NTFS_BLOCK_SIZE - 1), to_read,
+ fd->pos & ~(s64)(fd->geo_sector_size - 1), to_read,
alignedbuffer + br);
if (i == -1) {
if (br)
@@ -1115,11 +1542,18 @@ static int ntfs_device_win32_close(struct ntfs_device *dev)
if (!CloseHandle(fd->vol_handle))
ntfs_log_trace("CloseHandle() failed for volume.\n");
}
- rvl = CloseHandle(fd->handle);
+ if (fd->ntdll) {
+ ntfs_device_win32_setlock(fd->handle,FSCTL_UNLOCK_VOLUME);
+ rvl = NtClose(fd->handle) == STATUS_SUCCESS;
+ } else
+ rvl = CloseHandle(fd->handle);
free(fd);
if (!rvl) {
errno = ntfs_w32error_to_errno(GetLastError());
- ntfs_log_trace("CloseHandle() failed.\n");
+ if (fd->ntdll)
+ ntfs_log_trace("NtClose() failed.\n");
+ else
+ ntfs_log_trace("CloseHandle() failed.\n");
return -1;
}
return 0;
@@ -1174,7 +1608,7 @@ static int ntfs_device_win32_sync(struct ntfs_device *dev)
* errno set. Write starts from position @pos.
*
* Notes:
- * - @pos, @buf, and @count must be aligned to NTFS_BLOCK_SIZE.
+ * - @pos, @buf, and @count must be aligned to geo_sector_size.
* - When dealing with volumes, a single call must not span both volume
* and disk extents.
* - Does not use/set @fd->pos.
@@ -1182,7 +1616,7 @@ static int ntfs_device_win32_sync(struct ntfs_device *dev)
static inline s64 ntfs_device_win32_pwrite_simple(win32_fd *fd, const s64 pos,
const s64 count, const void *b)
{
- return ntfs_device_win32_pio(fd, pos, count, (void *)b, TRUE);
+ return ntfs_device_win32_pio(fd, pos, count, (void*)NULL, b);
}
/**
@@ -1203,9 +1637,9 @@ static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *b,
int old_ofs, ofs;
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);
+ old_ofs = ofs = old_pos & (fd->geo_sector_size - 1);
+ to_write = (ofs + count + fd->geo_sector_size - 1) &
+ ~(s64)(fd->geo_sector_size - 1);
/* Impose maximum of 2GB to be on the safe side. */
if (to_write > 0x80000000) {
int delta = to_write - count;
@@ -1224,8 +1658,8 @@ static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *b,
if (!count)
return 0;
NDevSetDirty(dev);
- if (!((unsigned long)b & (NTFS_BLOCK_SIZE - 1)) && !old_ofs &&
- !(count & (NTFS_BLOCK_SIZE - 1)))
+ if (!((unsigned long)b & (fd->geo_sector_size - 1)) && !old_ofs &&
+ !(count & (fd->geo_sector_size - 1)))
alignedbuffer = (BYTE *)b;
else {
s64 end;
@@ -1240,9 +1674,9 @@ static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *b,
/* Read first sector if start of write not sector aligned. */
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) {
+ old_pos & ~(s64)(fd->geo_sector_size - 1),
+ fd->geo_sector_size, alignedbuffer);
+ if (i != fd->geo_sector_size) {
if (i >= 0)
errno = EIO;
goto write_error;
@@ -1255,13 +1689,13 @@ static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *b,
* 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)) {
+ if ((end & (fd->geo_sector_size - 1)) &&
+ ((to_write > fd->geo_sector_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) {
+ end & ~(s64)(fd->geo_sector_size - 1),
+ fd->geo_sector_size, alignedbuffer +
+ to_write - fd->geo_sector_size);
+ if (i != fd->geo_sector_size) {
if (i >= 0)
errno = EIO;
goto write_error;
@@ -1274,7 +1708,7 @@ static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *b,
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),
+ old_pos & ~(s64)(fd->geo_sector_size - 1),
ofs + vol_to_write, alignedbuffer);
if (bw == -1)
goto write_error;
@@ -1285,13 +1719,13 @@ static s64 ntfs_device_win32_write(struct ntfs_device *dev, const void *b,
}
bw -= ofs;
fd->pos += bw;
- ofs = fd->pos & (NTFS_BLOCK_SIZE - 1);
+ ofs = fd->pos & (fd->geo_sector_size - 1);
if (bw != vol_to_write)
goto write_partial;
}
}
i = ntfs_device_win32_pwrite_simple(fd,
- fd->pos & ~(s64)(NTFS_BLOCK_SIZE - 1), to_write,
+ fd->pos & ~(s64)(fd->geo_sector_size - 1), to_write,
alignedbuffer + bw);
if (i == -1) {
if (bw)
@@ -1329,19 +1763,22 @@ static int ntfs_device_win32_stat(struct ntfs_device *dev, struct stat *buf)
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:
+ if ((dev->d_name[1] == ':') && (dev->d_name[2] == '\0'))
st_mode = S_IFBLK;
- break;
- case FILE_TYPE_PIPE:
- st_mode = S_IFIFO;
- break;
- default:
- st_mode = 0;
- }
+ else
+ switch (GetFileType(fd->handle)) {
+ case FILE_TYPE_CHAR:
+ st_mode = S_IFCHR;
+ break;
+ case FILE_TYPE_DISK:
+ st_mode = S_IFREG;
+ break;
+ case FILE_TYPE_PIPE:
+ st_mode = S_IFIFO;
+ break;
+ default:
+ st_mode = 0;
+ }
memset(buf, 0, sizeof(struct stat));
buf->st_mode = st_mode;
buf->st_size = fd->part_length;
@@ -1352,6 +1789,7 @@ static int ntfs_device_win32_stat(struct ntfs_device *dev, struct stat *buf)
return 0;
}
+#ifdef HDIO_GETGEO
/**
* ntfs_win32_hdio_getgeo - get drive geometry
* @dev: ntfs device obtained via ->open
@@ -1373,6 +1811,7 @@ static __inline__ int ntfs_win32_hdio_getgeo(struct ntfs_device *dev,
argp->start = fd->part_hidden_sectors;
return 0;
}
+#endif
/**
* ntfs_win32_blksszget - get block device sector size
@@ -1404,7 +1843,9 @@ static __inline__ int ntfs_win32_blksszget(struct ntfs_device *dev,int *argp)
static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request,
void *argp)
{
+#if defined(BLKGETSIZE) | defined(BLKGETSIZE64)
win32_fd *fd = (win32_fd *)dev->d_private;
+#endif
ntfs_log_trace("win32_ioctl(%d) called.\n", request);
switch (request) {
@@ -1454,13 +1895,40 @@ static int ntfs_device_win32_ioctl(struct ntfs_device *dev, int request,
static s64 ntfs_device_win32_pread(struct ntfs_device *dev, void *b,
s64 count, s64 offset)
{
- return ntfs_pread(dev, offset, count, b);
+ s64 got;
+ win32_fd *fd;
+
+ /* read the fast way if sector aligned */
+ fd = (win32_fd*)dev->d_private;
+ if (!((count | offset) & (fd->geo_sector_size - 1))) {
+ got = ntfs_device_win32_pio(fd, offset, count, b, (void*)NULL);
+ } else {
+ if (ntfs_device_win32_seek(dev, offset, 0) == -1)
+ got = 0;
+ else
+ got = ntfs_device_win32_read(dev, b, count);
+ }
+
+ return (got);
}
static s64 ntfs_device_win32_pwrite(struct ntfs_device *dev, const void *b,
s64 count, s64 offset)
{
- return ntfs_pwrite(dev, offset, count, b);
+ s64 put;
+ win32_fd *fd;
+
+ /* write the fast way if sector aligned */
+ fd = (win32_fd*)dev->d_private;
+ if (!((count | offset) & (fd->geo_sector_size - 1))) {
+ put = ntfs_device_win32_pio(fd, offset, count, (void*)NULL, b);
+ } else {
+ if (ntfs_device_win32_seek(dev, offset, 0) == -1)
+ put = 0;
+ else
+ put = ntfs_device_win32_write(dev, b, count);
+ }
+ return (put);
}
struct ntfs_device_operations ntfs_device_win32_io_ops = {
@@ -1475,3 +1943,87 @@ struct ntfs_device_operations ntfs_device_win32_io_ops = {
.stat = ntfs_device_win32_stat,
.ioctl = ntfs_device_win32_ioctl
};
+
+/*
+ * Mark an open file as sparse
+ *
+ * This is only called by ntfsclone when cloning a volume to a file.
+ * The argument is the target file, not a volume.
+ *
+ * Returns 0 if successful.
+ */
+
+int ntfs_win32_set_sparse(int fd)
+{
+ BOOL ok;
+ HANDLE handle;
+ DWORD bytes;
+
+ handle = get_osfhandle(fd);
+ if (handle == INVALID_HANDLE_VALUE)
+ ok = FALSE;
+ else
+ ok = DeviceIoControl(handle, FSCTL_SET_SPARSE,
+ (void*)NULL, 0, (void*)NULL, 0,
+ &bytes, (LPOVERLAPPED)NULL);
+ return (!ok);
+}
+
+/*
+ * Resize an open file
+ *
+ * This is only called by ntfsclone when cloning a volume to a file.
+ * The argument must designate a file, not a volume.
+ *
+ * Returns 0 if successful.
+ */
+
+static int win32_ftruncate(HANDLE handle, s64 size)
+{
+ BOOL ok;
+ LONG hsize, lsize;
+ LONG ohsize, olsize;
+
+ if (handle == INVALID_HANDLE_VALUE)
+ ok = FALSE;
+ else {
+ SetLastError(NO_ERROR);
+ /* save original position */
+ ohsize = 0;
+ olsize = SetFilePointer(handle, 0, &ohsize, 1);
+ hsize = size >> 32;
+ lsize = size & 0xffffffff;
+ ok = (SetFilePointer(handle, lsize, &hsize, 0) == (DWORD)lsize)
+ && (GetLastError() == NO_ERROR)
+ && SetEndOfFile(handle);
+ /* restore original position, even if above failed */
+ SetFilePointer(handle, olsize, &ohsize, 0);
+ if (GetLastError() != NO_ERROR)
+ ok = FALSE;
+ }
+ if (!ok)
+ errno = EINVAL;
+ return (ok ? 0 : -1);
+}
+
+int ntfs_device_win32_ftruncate(struct ntfs_device *dev, s64 size)
+{
+ win32_fd *fd;
+ int ret;
+
+ ret = -1;
+ fd = (win32_fd*)dev->d_private;
+ if (fd && !fd->ntdll)
+ ret = win32_ftruncate(fd->handle, size);
+ return (ret);
+}
+
+int ntfs_win32_ftruncate(int fd, s64 size)
+{
+ int ret;
+ HANDLE handle;
+
+ handle = get_osfhandle(fd);
+ ret = win32_ftruncate(handle, size);
+ return (ret);
+}
diff --git a/libntfs-3g/xattrs.c b/libntfs-3g/xattrs.c
new file mode 100755
index 0000000..5be2c06
--- a/dev/null
+++ b/libntfs-3g/xattrs.c
@@ -0,0 +1,791 @@
+/**
+ * xattrs.c : common functions to deal with system extended attributes
+ *
+ * Copyright (c) 2010 Jean-Pierre Andre
+ *
+ * This program/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 NTFS-3G
+ * 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
+
+#ifdef HAVE_SETXATTR /* extended attributes support required */
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
+#include "types.h"
+#include "param.h"
+#include "layout.h"
+#include "attrib.h"
+#include "index.h"
+#include "dir.h"
+#include "security.h"
+#include "acls.h"
+#include "efs.h"
+#include "reparse.h"
+#include "object_id.h"
+#include "misc.h"
+#include "logging.h"
+#include "xattrs.h"
+
+#if POSIXACLS
+#if __BYTE_ORDER == __BIG_ENDIAN
+
+/*
+ * Posix ACL structures
+ */
+
+struct LE_POSIX_ACE {
+ le16 tag;
+ le16 perms;
+ le32 id;
+} __attribute__((__packed__));
+
+struct LE_POSIX_ACL {
+ u8 version;
+ u8 flags;
+ le16 filler;
+ struct LE_POSIX_ACE ace[0];
+} __attribute__((__packed__));
+
+#endif
+#endif
+
+static const char xattr_ntfs_3g[] = "ntfs-3g.";
+static const char nf_ns_user_prefix[] = "user.";
+static const int nf_ns_user_prefix_len = sizeof(nf_ns_user_prefix) - 1;
+
+static const char nf_ns_xattr_ntfs_acl[] = "system.ntfs_acl";
+static const char nf_ns_xattr_attrib[] = "system.ntfs_attrib";
+static const char nf_ns_xattr_attrib_be[] = "system.ntfs_attrib_be";
+static const char nf_ns_xattr_efsinfo[] = "system.ntfs_efsinfo";
+static const char nf_ns_xattr_reparse[] = "system.ntfs_reparse_data";
+static const char nf_ns_xattr_object_id[] = "system.ntfs_object_id";
+static const char nf_ns_xattr_dos_name[] = "system.ntfs_dos_name";
+static const char nf_ns_xattr_times[] = "system.ntfs_times";
+static const char nf_ns_xattr_times_be[] = "system.ntfs_times_be";
+static const char nf_ns_xattr_crtime[] = "system.ntfs_crtime";
+static const char nf_ns_xattr_crtime_be[] = "system.ntfs_crtime_be";
+static const char nf_ns_xattr_posix_access[] = "system.posix_acl_access";
+static const char nf_ns_xattr_posix_default[] = "system.posix_acl_default";
+
+static const char nf_ns_alt_xattr_efsinfo[] = "user.ntfs.efsinfo";
+
+struct XATTRNAME {
+ enum SYSTEMXATTRS xattr;
+ const char *name;
+} ;
+
+static struct XATTRNAME nf_ns_xattr_names[] = {
+ { XATTR_NTFS_ACL, nf_ns_xattr_ntfs_acl },
+ { XATTR_NTFS_ATTRIB, nf_ns_xattr_attrib },
+ { XATTR_NTFS_ATTRIB_BE, nf_ns_xattr_attrib_be },
+ { XATTR_NTFS_EFSINFO, nf_ns_xattr_efsinfo },
+ { XATTR_NTFS_REPARSE_DATA, nf_ns_xattr_reparse },
+ { XATTR_NTFS_OBJECT_ID, nf_ns_xattr_object_id },
+ { XATTR_NTFS_DOS_NAME, nf_ns_xattr_dos_name },
+ { XATTR_NTFS_TIMES, nf_ns_xattr_times },
+ { XATTR_NTFS_TIMES_BE, nf_ns_xattr_times_be },
+ { XATTR_NTFS_CRTIME, nf_ns_xattr_crtime },
+ { XATTR_NTFS_CRTIME_BE, nf_ns_xattr_crtime_be },
+ { XATTR_POSIX_ACC, nf_ns_xattr_posix_access },
+ { XATTR_POSIX_DEF, nf_ns_xattr_posix_default },
+ { XATTR_UNMAPPED, (char*)NULL } /* terminator */
+};
+
+/*
+ * Make an integer big-endian
+ *
+ * Swap bytes on a small-endian computer and does nothing on a
+ * big-endian computer.
+ */
+
+static void fix_big_endian(char *p, int size)
+{
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+ int i,j;
+ int c;
+
+ i = 0;
+ j = size - 1;
+ while (i < j) {
+ c = p[i];
+ p[i++] = p[j];
+ p[j--] = c;
+ }
+#endif
+}
+
+#if POSIXACLS
+#if __BYTE_ORDER == __BIG_ENDIAN
+
+/*
+ * Make a Posix ACL CPU endian
+ */
+
+static int le_acl_to_cpu(const struct LE_POSIX_ACL *le_acl, size_t size,
+ struct POSIX_ACL *acl)
+{
+ int i;
+ int cnt;
+
+ acl->version = le_acl->version;
+ acl->flags = le_acl->flags;
+ acl->filler = 0;
+ cnt = (size - sizeof(struct LE_POSIX_ACL)) / sizeof(struct LE_POSIX_ACE);
+ for (i=0; i<cnt; i++) {
+ acl->ace[i].tag = le16_to_cpu(le_acl->ace[i].tag);
+ acl->ace[i].perms = le16_to_cpu(le_acl->ace[i].perms);
+ acl->ace[i].id = le32_to_cpu(le_acl->ace[i].id);
+ }
+ return (0);
+}
+
+/*
+ * Make a Posix ACL little endian
+ */
+
+int cpu_to_le_acl(const struct POSIX_ACL *acl, size_t size,
+ struct LE_POSIX_ACL *le_acl)
+{
+ int i;
+ int cnt;
+
+ le_acl->version = acl->version;
+ le_acl->flags = acl->flags;
+ le_acl->filler = const_cpu_to_le16(0);
+ cnt = (size - sizeof(struct POSIX_ACL)) / sizeof(struct POSIX_ACE);
+ for (i=0; i<cnt; i++) {
+ le_acl->ace[i].tag = cpu_to_le16(acl->ace[i].tag);
+ le_acl->ace[i].perms = cpu_to_le16(acl->ace[i].perms);
+ le_acl->ace[i].id = cpu_to_le32(acl->ace[i].id);
+ }
+ return (0);
+}
+
+#endif
+#endif
+
+/*
+ * Determine whether an extended attribute is mapped to
+ * internal data (original name in system namespace, or renamed)
+ */
+
+enum SYSTEMXATTRS ntfs_xattr_system_type(const char *name,
+ ntfs_volume *vol)
+{
+ struct XATTRNAME *p;
+ enum SYSTEMXATTRS ret;
+#ifdef XATTR_MAPPINGS
+ const struct XATTRMAPPING *q;
+#endif /* XATTR_MAPPINGS */
+
+ p = nf_ns_xattr_names;
+ while (p->name && strcmp(p->name,name))
+ p++;
+ ret = p->xattr;
+#ifdef XATTR_MAPPINGS
+ if (!p->name && vol && vol->xattr_mapping) {
+ q = vol->xattr_mapping;
+ while (q && strcmp(q->name,name))
+ q = q->next;
+ if (q)
+ ret = q->xattr;
+ }
+#else /* XATTR_MAPPINGS */
+ if (!p->name
+ && vol
+ && vol->efs_raw
+ && !strcmp(nf_ns_alt_xattr_efsinfo,name))
+ ret = XATTR_NTFS_EFSINFO;
+#endif /* XATTR_MAPPINGS */
+ return (ret);
+}
+
+#ifdef XATTR_MAPPINGS
+
+/*
+ * Basic read from a user mapping file on another volume
+ */
+
+static int basicread(void *fileid, char *buf, size_t size, off_t offs __attribute__((unused)))
+{
+ return (read(*(int*)fileid, buf, size));
+}
+
+
+/*
+ * Read from a user mapping file on current NTFS partition
+ */
+
+static int localread(void *fileid, char *buf, size_t size, off_t offs)
+{
+ return (ntfs_attr_data_read((ntfs_inode*)fileid,
+ AT_UNNAMED, 0, buf, size, offs));
+}
+
+/*
+ * Get a single mapping item from buffer
+ *
+ * Always reads a full line, truncating long lines
+ * Refills buffer when exhausted
+ * Returns pointer to item, or NULL when there is no more
+ * Note : errors are logged, but not returned
+// TODO partially share with acls.c
+ */
+
+static struct XATTRMAPPING *getmappingitem(FILEREADER reader, void *fileid,
+ off_t *poffs, char *buf, int *psrc, s64 *psize)
+{
+ int src;
+ int dst;
+ char *pe;
+ char *ps;
+ char *pu;
+ enum SYSTEMXATTRS xattr;
+ int gotend;
+ char maptext[LINESZ];
+ struct XATTRMAPPING *item;
+
+ src = *psrc;
+ dst = 0;
+ do {
+ gotend = 0;
+ while ((src < *psize)
+ && (buf[src] != '\n')) {
+ /* ignore spaces */
+ if ((dst < LINESZ)
+ && (buf[src] != '\r')
+ && (buf[src] != '\t')
+ && (buf[src] != ' '))
+ maptext[dst++] = buf[src];
+ src++;
+ }
+ if (src >= *psize) {
+ *poffs += *psize;
+ *psize = reader(fileid, buf, (size_t)BUFSZ, *poffs);
+ src = 0;
+ } else {
+ gotend = 1;
+ src++;
+ maptext[dst] = '\0';
+ dst = 0;
+ }
+ } while (*psize && ((maptext[0] == '#') || !gotend));
+ item = (struct XATTRMAPPING*)NULL;
+ if (gotend) {
+ /* decompose into system name and user name */
+ ps = maptext;
+ pu = strchr(maptext,':');
+ if (pu) {
+ *pu++ = 0;
+ pe = strchr(pu,':');
+ if (pe)
+ *pe = 0;
+ /* check name validity */
+ if ((strlen(pu) < 6) || strncmp(pu,"user.",5))
+ pu = (char*)NULL;
+ xattr = ntfs_xattr_system_type(ps,
+ (ntfs_volume*)NULL);
+ if (xattr == XATTR_UNMAPPED)
+ pu = (char*)NULL;
+ }
+ if (pu) {
+ item = (struct XATTRMAPPING*)ntfs_malloc(
+ sizeof(struct XATTRMAPPING)
+ + strlen(pu));
+ if (item) {
+ item->xattr = xattr;
+ strcpy(item->name,pu);
+ item->next = (struct XATTRMAPPING*)NULL;
+ }
+ } else {
+ ntfs_log_early_error("Bad xattr mapping item, aborting\n");
+ }
+ }
+ *psrc = src;
+ return (item);
+}
+
+/*
+ * Read xattr mapping file and split into their attribute.
+ * Parameters are kept in a chained list.
+ * Returns the head of list, if any
+ * Errors are logged, but not returned
+ *
+ * If an absolute path is provided, the mapping file is assumed
+ * to be located in another mounted file system, and plain read()
+ * are used to get its contents.
+ * If a relative path is provided, the mapping file is assumed
+ * to be located on the current file system, and internal IO
+ * have to be used since we are still mounting and we have not
+ * entered the fuse loop yet.
+ */
+
+static struct XATTRMAPPING *ntfs_read_xattr_mapping(FILEREADER reader,
+ void *fileid)
+{
+ char buf[BUFSZ];
+ struct XATTRMAPPING *item;
+ struct XATTRMAPPING *current;
+ struct XATTRMAPPING *firstitem;
+ struct XATTRMAPPING *lastitem;
+ BOOL duplicated;
+ int src;
+ off_t offs;
+ s64 size;
+
+ firstitem = (struct XATTRMAPPING*)NULL;
+ lastitem = (struct XATTRMAPPING*)NULL;
+ offs = 0;
+ size = reader(fileid, buf, (size_t)BUFSZ, (off_t)0);
+ if (size > 0) {
+ src = 0;
+ do {
+ item = getmappingitem(reader, fileid, &offs,
+ buf, &src, &size);
+ if (item) {
+ /* check no double mapping */
+ duplicated = FALSE;
+ for (current=firstitem; current; current=current->next)
+ if ((current->xattr == item->xattr)
+ || !strcmp(current->name,item->name))
+ duplicated = TRUE;
+ if (duplicated) {
+ free(item);
+ ntfs_log_early_error("Conflicting xattr mapping ignored\n");
+ } else {
+ item->next = (struct XATTRMAPPING*)NULL;
+ if (lastitem)
+ lastitem->next = item;
+ else
+ firstitem = item;
+ lastitem = item;
+ }
+ }
+ } while (item);
+ }
+ return (firstitem);
+}
+
+/*
+ * Build the extended attribute mappings to user namespace
+ *
+ * Note : no error is returned. If we refused mounting when there
+ * is an error it would be too difficult to fix the offending file
+ */
+
+struct XATTRMAPPING *ntfs_xattr_build_mapping(ntfs_volume *vol,
+ const char *xattrmap_path)
+{
+ struct XATTRMAPPING *firstmapping;
+ struct XATTRMAPPING *mapping;
+ BOOL user_efs;
+ BOOL notfound;
+ ntfs_inode *ni;
+ int fd;
+
+ firstmapping = (struct XATTRMAPPING*)NULL;
+ notfound = FALSE;
+ if (!xattrmap_path)
+ xattrmap_path = XATTRMAPPINGFILE;
+ if (xattrmap_path[0] == '/') {
+ fd = open(xattrmap_path,O_RDONLY);
+ if (fd > 0) {
+ firstmapping = ntfs_read_xattr_mapping(basicread, (void*)&fd);
+ close(fd);
+ } else
+ notfound = TRUE;
+ } else {
+ ni = ntfs_pathname_to_inode(vol, NULL, xattrmap_path);
+ if (ni) {
+ firstmapping = ntfs_read_xattr_mapping(localread, ni);
+ ntfs_inode_close(ni);
+ } else
+ notfound = TRUE;
+ }
+ if (notfound && strcmp(xattrmap_path, XATTRMAPPINGFILE)) {
+ ntfs_log_early_error("Could not open \"%s\"\n",xattrmap_path);
+ }
+ if (vol->efs_raw) {
+ user_efs = TRUE;
+ for (mapping=firstmapping; mapping; mapping=mapping->next)
+ if (mapping->xattr == XATTR_NTFS_EFSINFO)
+ user_efs = FALSE;
+ } else
+ user_efs = FALSE;
+ if (user_efs) {
+ mapping = (struct XATTRMAPPING*)ntfs_malloc(
+ sizeof(struct XATTRMAPPING)
+ + strlen(nf_ns_alt_xattr_efsinfo));
+ if (mapping) {
+ mapping->next = firstmapping;
+ mapping->xattr = XATTR_NTFS_EFSINFO;
+ strcpy(mapping->name,nf_ns_alt_xattr_efsinfo);
+ firstmapping = mapping;
+ }
+ }
+ return (firstmapping);
+}
+
+void ntfs_xattr_free_mapping(struct XATTRMAPPING *mapping)
+{
+ struct XATTRMAPPING *p, *q;
+
+ p = mapping;
+ while (p) {
+ q = p->next;
+ free(p);
+ p = q;
+ }
+}
+
+#endif /* XATTR_MAPPINGS */
+
+
+int ntfs_xattr_system_getxattr(struct SECURITY_CONTEXT *scx,
+ enum SYSTEMXATTRS attr,
+ ntfs_inode *ni, ntfs_inode *dir_ni,
+ char *value, size_t size)
+{
+ int res;
+ int i;
+#if POSIXACLS
+#if __BYTE_ORDER == __BIG_ENDIAN
+ struct POSIX_ACL *acl;
+#endif
+#endif
+
+ /*
+ * the returned value is the needed
+ * size. If it is too small, no copy
+ * is done, and the caller has to
+ * issue a new call with correct size.
+ */
+ switch (attr) {
+ case XATTR_NTFS_ACL :
+ res = ntfs_get_ntfs_acl(scx, ni, value, size);
+ break;
+#if POSIXACLS
+#if __BYTE_ORDER == __BIG_ENDIAN
+ case XATTR_POSIX_ACC :
+ acl = (struct POSIX_ACL*)ntfs_malloc(size);
+ if (acl) {
+ res = ntfs_get_posix_acl(scx, ni,
+ nf_ns_xattr_posix_access, (char*)acl, size);
+ if (res > 0) {
+ if (cpu_to_le_acl(acl,res,
+ (struct LE_POSIX_ACL*)value))
+ res = -errno;
+ }
+ free(acl);
+ } else
+ res = -errno;
+ break;
+ case XATTR_POSIX_DEF :
+ acl = (struct POSIX_ACL*)ntfs_malloc(size);
+ if (acl) {
+ res = ntfs_get_posix_acl(scx, ni,
+ nf_ns_xattr_posix_default, (char*)acl, size);
+ if (res > 0) {
+ if (cpu_to_le_acl(acl,res,
+ (struct LE_POSIX_ACL*)value))
+ res = -errno;
+ }
+ free(acl);
+ } else
+ res = -errno;
+ break;
+#else
+ case XATTR_POSIX_ACC :
+ res = ntfs_get_posix_acl(scx, ni, nf_ns_xattr_posix_access,
+ value, size);
+ break;
+ case XATTR_POSIX_DEF :
+ res = ntfs_get_posix_acl(scx, ni, nf_ns_xattr_posix_default,
+ value, size);
+ break;
+#endif
+#endif
+ case XATTR_NTFS_ATTRIB :
+ res = ntfs_get_ntfs_attrib(ni, value, size);
+ break;
+ case XATTR_NTFS_ATTRIB_BE :
+ res = ntfs_get_ntfs_attrib(ni, value, size);
+ if ((res == 4) && value) {
+ if (size >= 4)
+ fix_big_endian(value,4);
+ else
+ res = -EINVAL;
+ }
+ break;
+ case XATTR_NTFS_EFSINFO :
+ if (ni->vol->efs_raw)
+ res = ntfs_get_efs_info(ni, value, size);
+ else
+ res = -EPERM;
+ break;
+ case XATTR_NTFS_REPARSE_DATA :
+ res = ntfs_get_ntfs_reparse_data(ni, value, size);
+ break;
+ case XATTR_NTFS_OBJECT_ID :
+ res = ntfs_get_ntfs_object_id(ni, value, size);
+ break;
+ case XATTR_NTFS_DOS_NAME:
+ if (dir_ni)
+ res = ntfs_get_ntfs_dos_name(ni, dir_ni, value, size);
+ else
+ res = -errno;
+ break;
+ case XATTR_NTFS_TIMES:
+ res = ntfs_inode_get_times(ni, value, size);
+ break;
+ case XATTR_NTFS_TIMES_BE:
+ res = ntfs_inode_get_times(ni, value, size);
+ if ((res > 0) && value) {
+ for (i=0; (i+1)*sizeof(u64)<=(unsigned int)res; i++)
+ fix_big_endian(&value[i*sizeof(u64)],
+ sizeof(u64));
+ }
+ break;
+ case XATTR_NTFS_CRTIME:
+ res = ntfs_inode_get_times(ni, value,
+ (size >= sizeof(u64) ? sizeof(u64) : size));
+ break;
+ case XATTR_NTFS_CRTIME_BE:
+ res = ntfs_inode_get_times(ni, value,
+ (size >= sizeof(u64) ? sizeof(u64) : size));
+ if ((res >= (int)sizeof(u64)) && value)
+ fix_big_endian(value,sizeof(u64));
+ break;
+ default :
+ errno = EOPNOTSUPP;
+ res = -errno;
+ break;
+ }
+ return (res);
+}
+
+int ntfs_xattr_system_setxattr(struct SECURITY_CONTEXT *scx,
+ enum SYSTEMXATTRS attr,
+ ntfs_inode *ni, ntfs_inode *dir_ni,
+ const char *value, size_t size, int flags)
+{
+ int res;
+ int i;
+ char buf[4*sizeof(u64)];
+#if POSIXACLS
+#if __BYTE_ORDER == __BIG_ENDIAN
+ struct POSIX_ACL *acl;
+#endif
+#endif
+
+ switch (attr) {
+ case XATTR_NTFS_ACL :
+ res = ntfs_set_ntfs_acl(scx, ni, value, size, flags);
+ break;
+#if POSIXACLS
+#if __BYTE_ORDER == __BIG_ENDIAN
+ case XATTR_POSIX_ACC :
+ acl = (struct POSIX_ACL*)ntfs_malloc(size);
+ if (acl) {
+ if (!le_acl_to_cpu((const struct LE_POSIX_ACL*)value,
+ size, acl)) {
+ res = ntfs_set_posix_acl(scx ,ni ,
+ nf_ns_xattr_posix_access,
+ (char*)acl, size, flags);
+ } else
+ res = -errno;
+ free(acl);
+ } else
+ res = -errno;
+ break;
+ case XATTR_POSIX_DEF :
+ acl = (struct POSIX_ACL*)ntfs_malloc(size);
+ if (acl) {
+ if (!le_acl_to_cpu((const struct LE_POSIX_ACL*)value,
+ size, acl)) {
+ res = ntfs_set_posix_acl(scx ,ni ,
+ nf_ns_xattr_posix_default,
+ (char*)acl, size, flags);
+ } else
+ res = -errno;
+ free(acl);
+ } else
+ res = -errno;
+ break;
+#else
+ case XATTR_POSIX_ACC :
+ res = ntfs_set_posix_acl(scx ,ni , nf_ns_xattr_posix_access,
+ value, size, flags);
+ break;
+ case XATTR_POSIX_DEF :
+ res = ntfs_set_posix_acl(scx, ni, nf_ns_xattr_posix_default,
+ value, size, flags);
+ break;
+#endif
+#endif
+ case XATTR_NTFS_ATTRIB :
+ res = ntfs_set_ntfs_attrib(ni, value, size, flags);
+ break;
+ case XATTR_NTFS_ATTRIB_BE :
+ if (value && (size >= 4)) {
+ memcpy(buf,value,4);
+ fix_big_endian(buf,4);
+ res = ntfs_set_ntfs_attrib(ni, buf, 4, flags);
+ } else
+ res = ntfs_set_ntfs_attrib(ni, value, size, flags);
+ break;
+ case XATTR_NTFS_EFSINFO :
+ if (ni->vol->efs_raw)
+ res = ntfs_set_efs_info(ni, value, size, flags);
+ else
+ res = -EPERM;
+ break;
+ case XATTR_NTFS_REPARSE_DATA :
+ res = ntfs_set_ntfs_reparse_data(ni, value, size, flags);
+ break;
+ case XATTR_NTFS_OBJECT_ID :
+ res = ntfs_set_ntfs_object_id(ni, value, size, flags);
+ break;
+ case XATTR_NTFS_DOS_NAME:
+ if (dir_ni)
+ /* warning : this closes both inodes */
+ res = ntfs_set_ntfs_dos_name(ni, dir_ni, value,
+ size, flags);
+ else
+ res = -errno;
+ break;
+ case XATTR_NTFS_TIMES:
+ res = ntfs_inode_set_times(ni, value, size, flags);
+ break;
+ case XATTR_NTFS_TIMES_BE:
+ if (value && (size > 0) && (size <= 4*sizeof(u64))) {
+ memcpy(buf,value,size);
+ for (i=0; (i+1)*sizeof(u64)<=size; i++)
+ fix_big_endian(&buf[i*sizeof(u64)],
+ sizeof(u64));
+ res = ntfs_inode_set_times(ni, buf, size, flags);
+ } else
+ res = ntfs_inode_set_times(ni, value, size, flags);
+ break;
+ case XATTR_NTFS_CRTIME:
+ res = ntfs_inode_set_times(ni, value,
+ (size >= sizeof(u64) ? sizeof(u64) : size), flags);
+ break;
+ case XATTR_NTFS_CRTIME_BE:
+ if (value && (size >= sizeof(u64))) {
+ memcpy(buf,value,sizeof(u64));
+ fix_big_endian(buf,sizeof(u64));
+ res = ntfs_inode_set_times(ni, buf, sizeof(u64), flags);
+ } else
+ res = ntfs_inode_set_times(ni, value, size, flags);
+ break;
+ default :
+ errno = EOPNOTSUPP;
+ res = -errno;
+ break;
+ }
+ return (res);
+}
+
+int ntfs_xattr_system_removexattr(struct SECURITY_CONTEXT *scx,
+ enum SYSTEMXATTRS attr,
+ ntfs_inode *ni, ntfs_inode *dir_ni)
+{
+ int res;
+
+ res = 0;
+ switch (attr) {
+ /*
+ * Removal of NTFS ACL, ATTRIB, EFSINFO or TIMES
+ * is never allowed
+ */
+ case XATTR_NTFS_ACL :
+ case XATTR_NTFS_ATTRIB :
+ case XATTR_NTFS_ATTRIB_BE :
+ case XATTR_NTFS_EFSINFO :
+ case XATTR_NTFS_TIMES :
+ case XATTR_NTFS_TIMES_BE :
+ case XATTR_NTFS_CRTIME :
+ case XATTR_NTFS_CRTIME_BE :
+ res = -EPERM;
+ break;
+#if POSIXACLS
+ case XATTR_POSIX_ACC :
+ case XATTR_POSIX_DEF :
+ if (ni) {
+ if (!ntfs_allowed_as_owner(scx, ni)
+ || ntfs_remove_posix_acl(scx, ni,
+ (attr == XATTR_POSIX_ACC ?
+ nf_ns_xattr_posix_access :
+ nf_ns_xattr_posix_default)))
+ res = -errno;
+ } else
+ res = -errno;
+ break;
+#endif
+ case XATTR_NTFS_REPARSE_DATA :
+ if (ni) {
+ if (!ntfs_allowed_as_owner(scx, ni)
+ || ntfs_remove_ntfs_reparse_data(ni))
+ res = -errno;
+ } else
+ res = -errno;
+ break;
+ case XATTR_NTFS_OBJECT_ID :
+ if (ni) {
+ if (!ntfs_allowed_as_owner(scx, ni)
+ || ntfs_remove_ntfs_object_id(ni))
+ res = -errno;
+ } else
+ res = -errno;
+ break;
+ case XATTR_NTFS_DOS_NAME:
+ if (ni && dir_ni) {
+ if (ntfs_remove_ntfs_dos_name(ni,dir_ni))
+ res = -errno;
+ /* ni and dir_ni have been closed */
+ } else
+ res = -errno;
+ break;
+ default :
+ errno = EOPNOTSUPP;
+ res = -errno;
+ break;
+ }
+ return (res);
+}
+
+#endif /* HAVE_SETXATTR */
diff --git a/libtool b/libtool
index d9bbcad..c6e6f06 100755
--- a/libtool
+++ b/libtool
@@ -1,53 +1,46 @@
#! /bin/bash
-# libtoolT - Provide generalized library-building support services.
-# Generated automatically by (GNU ntfs-3g 2010.5.16)
+# libtool - Provide generalized library-building support services.
+# Generated automatically by config.status (ntfs-3g) 2014.2.15
+# Libtool was configured on host droid11-sz:
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
#
-# This file is part of GNU Libtool:
-# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+# 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.
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General 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.
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
#
-# 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.
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# 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="/bin/sed"
-
-# Sed that helps us avoid accidentally triggering echo(1) options like -n.
-Xsed="/bin/sed -e 1s/^X//"
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-# 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=" CXX"
+available_tags=""
# ### BEGIN LIBTOOL CONFIG
-# Libtool was configured on host announce:
-
-# Shell to use when invoking shell scripts.
-SHELL="/bin/bash"
+# Which release of libtool.m4 was used?
+macro_version=2.2.6b
+macro_revision=1.3017
# Whether or not to build shared libraries.
build_libtool_libs=yes
@@ -55,354 +48,427 @@ build_libtool_libs=yes
# Whether or not to build static libraries.
build_old_libs=yes
-# Whether or not to add -lc for building shared libraries.
-build_libtool_need_lc=no
-
-# Whether or not to disallow shared libs when runtime libs are static
-allow_libtool_libs_with_static_runtimes=no
+# What type of objects to build.
+pic_mode=default
# Whether or not to optimize for fast installation.
fast_install=yes
# The host system.
-host_alias=arc-linux-uclibc
-host=arc-unknown-linux-uclibc
-host_os=linux-uclibc
+host_alias=
+host=x86_64-unknown-linux-gnu
+host_os=linux-gnu
# The build system.
build_alias=
-build=i686-pc-linux-gnu
+build=x86_64-unknown-linux-gnu
build_os=linux-gnu
-# An echo program that does not interpret backslashes.
-echo="echo"
-
-# The archiver.
-AR="arc-linux-uclibc-ar"
-AR_FLAGS="cru"
-
-# A C compiler.
-LTCC="arc-linux-uclibc-gcc"
-
-# LTCC compiler flags.
-LTCFLAGS="-mA7 -g"
+# A sed program that does not truncate output.
+SED="/bin/sed"
-# A language-specific compiler.
-CC="arc-linux-uclibc-gcc"
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e 1s/^X//"
-# Is the compiler the GNU C compiler?
-with_gcc=yes
+# A grep program that handles long lines.
+GREP="/bin/grep"
# An ERE matcher.
EGREP="/bin/grep -E"
-# The linker used to build libraries.
-LD="/opt/gnutools/arc2.3-p0/uclibc-4.2.1/arc-linux-uclibc/bin/ld"
+# A literal string matcher.
+FGREP="/bin/grep -F"
-# Whether we need hard or soft links.
-LN_S="ln -s"
+# A BSD- or MS-compatible name lister.
+NM="/usr/bin/nm -B"
-# A BSD-compatible nm program.
-NM="/opt/gnutools/arc2.3-p0/uclibc-4.2.1/bin/arc-linux-uclibc-nm -B"
+# Whether we need soft or hard links.
+LN_S="ln -s"
-# A symbol stripping program
-STRIP="arc-linux-uclibc-strip"
+# What is the maximum length of a command?
+max_cmd_len=1572864
-# Used to examine libraries when file_magic_cmd begins "file"
-MAGIC_CMD=file
+# Object file suffix (normally "o").
+objext=o
-# Used on cygwin: DLL creation program.
-DLLTOOL="dlltool"
+# Executable file suffix (normally "").
+exeext=
-# Used on cygwin: object dumper.
-OBJDUMP="objdump"
+# whether the shell understands "unset".
+lt_unset=unset
-# Used on cygwin: assembler.
-AS="as"
+# turn spaces into newlines.
+SP2NL="tr \\040 \\012"
-# The name of the directory that contains temporary libtool files.
-objdir=.libs
+# turn newlines into spaces.
+NL2SP="tr \\015\\012 \\040\\040"
# How to create reloadable object files.
reload_flag=" -r"
reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
-# How to pass a linker flag through the compiler.
-wl="-Wl,"
+# An object symbol dumper.
+OBJDUMP="objdump"
-# Object file suffix (normally "o").
-objext="o"
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method="pass_all"
-# Old archive suffix (normally "a").
-libext="a"
+# Command to use when deplibs_check_method == "file_magic".
+file_magic_cmd="\$MAGIC_CMD"
-# Shared library suffix (normally ".so").
-shrext_cmds='.so'
+# The archiver.
+AR="ar"
+AR_FLAGS="cru"
-# Executable file suffix (normally "").
-exeext=""
+# A symbol stripping program.
+STRIP="strip"
-# Additional compiler flags for building library objects.
-pic_flag=" -fPIC -DPIC"
-pic_mode=default
+# Commands used to install an old-style archive.
+RANLIB="ranlib"
+old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
+old_postuninstall_cmds=""
-# What is the maximum length of a command?
-max_cmd_len=805306365
+# A C compiler.
+LTCC="gcc"
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o="yes"
+# LTCC compiler flags.
+LTCFLAGS="-g -O2 -Wall"
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
+
+# Transform the output of nm in a proper C declaration.
+global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
+
+# Transform the output of nm in a C name address pair.
+global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p'"
+
+# Transform the output of nm in a C name address pair when lib prefix is needed.
+global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (void *) 0},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\(lib[^ ]*\\)\$/ {\"\\2\", (void *) \\&\\2},/p' -e 's/^[ABCDGIRSTW]* \\([^ ]*\\) \\([^ ]*\\)\$/ {\"lib\\2\", (void *) \\&\\2},/p'"
+
+# The name of the directory that contains temporary libtool files.
+objdir=.libs
+
+# Shell to use when invoking shell scripts.
+SHELL="/bin/bash"
+
+# An echo program that does not interpret backslashes.
+ECHO="echo"
+
+# Used to examine libraries when file_magic_cmd begins with "file".
+MAGIC_CMD=file
# Must we lock files when doing compilation?
need_locks="no"
-# Do we need the lib prefix for modules?
-need_lib_prefix=no
+# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
+DSYMUTIL=""
-# Do we need a version for libraries?
-need_version=no
+# Tool to change global to local symbols on Mac OS X.
+NMEDIT=""
-# Whether dlopen is supported.
-dlopen_support=unknown
+# Tool to manipulate fat objects and archives on Mac OS X.
+LIPO=""
-# Whether dlopen of programs is supported.
-dlopen_self=unknown
+# ldd/readelf like tool for Mach-O binaries on Mac OS X.
+OTOOL=""
-# Whether dlopen of statically linked programs is supported.
-dlopen_self_static=unknown
+# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
+OTOOL64=""
-# Compiler flag to prevent dynamic linking.
-link_static_flag="-static"
+# Old archive suffix (normally "a").
+libext=a
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=" -fno-builtin"
+# Shared library suffix (normally ".so").
+shrext_cmds=".so"
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec="\${wl}--export-dynamic"
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=""
-# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at link time.
+variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
-# Compiler flag to generate thread-safe objects.
-thread_safe_flag_spec=""
+# Do we need the "lib" prefix for modules?
+need_lib_prefix=no
+
+# Do we need a version for libraries?
+need_version=no
# Library versioning type.
version_type=linux
+# Shared library runtime path variable.
+runpath_var=LD_RUN_PATH
+
+# Shared library path variable.
+shlibpath_var=LD_LIBRARY_PATH
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=no
+
# Format of library name prefix.
libname_spec="lib\$name"
# 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.
+# The last name is the one that the linker finds with -lNAME
library_names_spec="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
# The coded name of the library, if different from the real name.
soname_spec="\${libname}\${release}\${shared_ext}\$major"
-# Commands used to build and install an old-style archive.
-RANLIB="arc-linux-uclibc-ranlib"
-old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
-old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
-old_postuninstall_cmds=""
+# Command to use after installation of a shared archive.
+postinstall_cmds=""
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds=""
+# Command to use after uninstallation of a shared archive.
+postuninstall_cmds=""
-# Create a temporary old-style archive to link instead of a shared archive.
-old_archive_from_expsyms_cmds=""
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
-# Commands used to build and install a shared archive.
-archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
-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"
-postinstall_cmds=""
-postuninstall_cmds=""
+# As "finish_cmds", except a single script fragment to be evaled but
+# not shown.
+finish_eval=""
-# Commands used to build a loadable module (assumed same as above if empty)
-module_cmds=""
-module_expsym_cmds=""
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=yes
+
+# Compile-time system search path for libraries.
+sys_lib_search_path_spec="/usr/lib/gcc/x86_64-linux-gnu/4.4.7 /usr/lib/x86_64-linux-gnu /usr/lib /lib/x86_64-linux-gnu /lib"
+
+# Run-time system search path for libraries.
+sys_lib_dlsearch_path_spec="/lib /usr/lib /usr/lib/i386-linux-gnu/mesa /lib/i386-linux-gnu /usr/lib/i386-linux-gnu /lib/i686-linux-gnu /usr/lib/i686-linux-gnu /usr/local/lib /lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu /usr/lib/x86_64-linux-gnu/mesa /lib32 /usr/lib32 "
+
+# Whether dlopen is supported.
+dlopen_support=unknown
+
+# Whether dlopen of programs is supported.
+dlopen_self=unknown
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=unknown
# Commands to strip libraries.
-old_striplib="arc-linux-uclibc-strip --strip-debug"
-striplib="arc-linux-uclibc-strip --strip-unneeded"
+old_striplib="strip --strip-debug"
+striplib="strip --strip-unneeded"
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predep_objects=""
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdep_objects=""
+# The linker used to build libraries.
+LD="/usr/bin/ld -m elf_x86_64"
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predeps=""
+# Commands used to build an old-style archive.
+old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdeps=""
+# A language specific compiler.
+CC="gcc"
-# The directories searched by this compiler when creating a shared
-# library
-compiler_lib_search_dirs=""
+# Is the compiler the GNU compiler?
+with_gcc=yes
-# The library search path used internally by the compiler when linking
-# a shared library.
-compiler_lib_search_path=""
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=" -fno-builtin"
-# Method to check whether dependent libraries are shared objects.
-deplibs_check_method="pass_all"
+# How to pass a linker flag through the compiler.
+wl="-Wl,"
-# Command to use when deplibs_check_method == file_magic.
-file_magic_cmd="\$MAGIC_CMD"
+# Additional compiler flags for building library objects.
+pic_flag=" -fPIC -DPIC"
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=""
+# Compiler flag to prevent dynamic linking.
+link_static_flag="-static"
-# Flag that forces no undefined symbols.
-no_undefined_flag=""
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o="yes"
-# Commands used to finish a libtool library installation in a directory.
-finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=no
-# Same as above, but a single script fragment to be evaled but not shown.
-finish_eval=""
+# Whether or not to disallow shared libs when runtime libs are static.
+allow_libtool_libs_with_static_runtimes=no
-# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec="\${wl}--export-dynamic"
-# Transform the output of nm in a proper C declaration
-global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'"
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
-# Transform the output of nm in a C name address pair
-global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'"
+# Whether the compiler copes with passing no objects directly.
+compiler_needs_object="no"
-# This is the shared library runtime path variable.
-runpath_var=LD_RUN_PATH
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=""
-# This is the shared library path variable.
-shlibpath_var=LD_LIBRARY_PATH
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=""
-# Is shlibpath searched before the hard-coded library search path?
-shlibpath_overrides_runpath=no
+# Commands used to build a shared archive.
+archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
+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"
-# How to hardcode a shared library path into an executable.
-hardcode_action=immediate
+# Commands used to build a loadable module if different from building
+# a shared archive.
+module_cmds=""
+module_expsym_cmds=""
-# Whether we should hardcode library paths into libraries.
-hardcode_into_libs=yes
+# Whether we are building with GNU ld or not.
+with_gnu_ld="yes"
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=""
+
+# Flag that enforces no undefined symbols.
+no_undefined_flag=""
# Flag to hardcode $libdir into a binary during linking.
-# This must work even if $libdir does not exist.
-hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir"
+# This must work even if $libdir does not exist
+hardcode_libdir_flag_spec="\${wl}-rpath \${wl}\$libdir"
-# If ld is used when linking, flag to hardcode $libdir into
-# a binary during linking. This must work even if $libdir does
-# not exist.
+# 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=""
-# Whether we need a single -rpath flag with a separated argument.
+# Whether we need a single "-rpath" flag with a separated argument.
hardcode_libdir_separator=""
-# Set to yes if using DIR/libNAME during linking hardcodes DIR into the
-# resulting binary.
+# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+# DIR into the resulting binary.
hardcode_direct=no
-# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
-# resulting binary.
+# Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+# DIR into the resulting binary and the resulting library dependency is
+# "absolute",i.e impossible to change by setting ${shlibpath_var} if the
+# library is relocated.
+hardcode_direct_absolute=no
+
+# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+# into the resulting binary.
hardcode_minus_L=no
-# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
-# the resulting binary.
+# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+# into the resulting binary.
hardcode_shlibpath_var=unsupported
-# Set to yes if building a shared library automatically hardcodes DIR into the library
-# and all subsequent libraries and executables linked against it.
+# 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=no
-# Variables whose values should be saved in libtool wrapper scripts and
-# restored at relink time.
-variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
+# Set to yes if linker adds runtime paths of dependent libraries
+# to runtime path list.
+inherit_rpath=no
# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=unknown
-
-# Compile-time system search path for libraries
-sys_lib_search_path_spec="/opt/gnutools/arc2.3-p0/uclibc-4.2.1/lib/gcc/arc-linux-uclibc/4.2.1 /opt/gnutools/arc2.3-p0/uclibc-4.2.1/arc-linux-uclibc/lib"
-
-# Run-time system search path for libraries
-sys_lib_dlsearch_path_spec="/lib /usr/lib /lib/i486-linux-gnu /usr/lib/i486-linux-gnu /usr/lib/alsa-lib /usr/local/lib "
+link_all_deplibs=no
# Fix the shell variable $srcfile for the compiler.
fix_srcfile_path=""
-# Set to yes if exported symbols are required.
+# Set to "yes" if exported symbols are required.
always_export_symbols=no
# The commands to list exported symbols.
export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
-# The commands to extract the exported symbol list from a shared archive.
-extract_expsyms_cmds=""
-
# Symbols that should not be listed in the preloaded symbols.
exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
# Symbols that must always be exported.
include_expsyms=""
+# Commands necessary for linking programs (against libraries) with templates.
+prelink_cmds=""
+
+# Specify filename containing input files.
+file_list_spec=""
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=immediate
+
# ### END LIBTOOL CONFIG
-# 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, 2006,
-# 2007, 2008 Free Software Foundation, Inc.
-# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-#
-# This program is free software; you can redistribute it and/or modify
+# Generated from ltmain.m4sh.
+
+# ltmain.sh (GNU libtool) 2.2.6b
+# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 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.
+
+# GNU Libtool is free software; you can redistribute it and/or modify
# it under the terms of the GNU General 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
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 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., 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"
+# along with GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-# Global variables:
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
+# Usage: $progname [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
+# --mode=MODE use operation mode MODE
+# --preserve-dup-deps don't remove duplicate dependency libraries
+# --quiet, --silent don't print informational messages
+# --tag=TAG use configuration variables from tag TAG
+# -v, --verbose print informational messages (default)
+# --version print version information
+# -h, --help print short or long help message
+#
+# 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 `$progname --help --mode=MODE' for a more detailed description of MODE.
+#
+# When reporting a bug, please describe a test case to reproduce it and
+# include the following information:
+#
+# host-triplet: $host
+# shell: $SHELL
+# compiler: $LTCC
+# compiler flags: $LTCFLAGS
+# linker: $LD (gnu? $with_gnu_ld)
+# $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2
+# automake: $automake_version
+# autoconf: $autoconf_version
+#
+# Report bugs to <bug-libtool@gnu.org>.
PROGRAM=ltmain.sh
PACKAGE=libtool
-VERSION=1.5.26
-TIMESTAMP=" (1.1220.2.492 2008/01/30 06:40:56)"
+VERSION="2.2.6b Debian-2.2.6b-2"
+TIMESTAMP=""
+package_revision=1.3017
-# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
@@ -416,104 +482,357 @@ fi
BIN_SH=xpg4; export BIN_SH # for Tru64
DUALCASE=1; export DUALCASE # for MKS sh
-# 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 <<EOF
-$*
-EOF
- exit $EXIT_SUCCESS
-fi
-
-default_mode=
-help="Try \`$progname --help' for more information."
-magic="%%%MAGIC variable%%%"
-mkdir="mkdir"
-mv="mv -f"
-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//'
-sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
-# test EBCDIC or ASCII
-case `echo X|tr X '\101'` in
- A) # ASCII based system
- # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
- SP2NL='tr \040 \012'
- NL2SP='tr \015\012 \040\040'
- ;;
- *) # EBCDIC based system
- SP2NL='tr \100 \n'
- NL2SP='tr \r\n \100\100'
- ;;
-esac
-
-# NLS nuisances.
+# NLS nuisances: We save the old values to restore during execute mode.
# 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).
-# We save the old values to restore during execute mode.
-lt_env=
+lt_user_locale=
+lt_safe_locale=
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
do
eval "if test \"\${$lt_var+set}\" = set; then
- save_$lt_var=\$$lt_var
- lt_env=\"$lt_var=\$$lt_var \$lt_env\"
- $lt_var=C
+ save_$lt_var=\$$lt_var
+ $lt_var=C
export $lt_var
+ lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
+ lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
fi"
done
-if test -n "$lt_env"; then
- lt_env="env $lt_env"
-fi
+$lt_unset CDPATH
+
+
+
+
+
+: ${CP="cp -f"}
+: ${ECHO="echo"}
+: ${EGREP="/bin/grep -E"}
+: ${FGREP="/bin/grep -F"}
+: ${GREP="/bin/grep"}
+: ${LN_S="ln -s"}
+: ${MAKE="make"}
+: ${MKDIR="mkdir"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+: ${SED="/bin/sed"}
+: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
+: ${Xsed="$SED -e 1s/^X//"}
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
+EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
+
+exit_status=$EXIT_SUCCESS
# Make sure IFS has a sensible default
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
- $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit $EXIT_FAILURE
-fi
+dirname="s,/[^/]*$,,"
+basename="s,^.*/,,"
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+# dirname: Compute the dirname of FILE. If nonempty,
+# add APPEND to the result, otherwise set result
+# to NONDIR_REPLACEMENT.
+# value returned in "$func_dirname_result"
+# basename: Compute filename of FILE.
+# value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+ # Extract subdirectory from the argument.
+ func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+ func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
-# Global variables.
-mode=$default_mode
-nonopt=
-prev=
-prevopt=
-run=
-show="$echo"
-show_help=
-execute_dlfiles=
-duplicate_deps=no
-preserve_args=
-lo2o="s/\\.lo\$/.${objext}/"
-o2lo="s/\\.${objext}\$/.lo/"
-extracted_archives=
-extracted_serial=0
+# Generated shell functions inserted here.
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result="${1##*/}"
+}
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+# dirname: Compute the dirname of FILE. If nonempty,
+# add APPEND to the result, otherwise set result
+# to NONDIR_REPLACEMENT.
+# value returned in "$func_dirname_result"
+# basename: Compute filename of FILE.
+# value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+ func_basename_result="${1##*/}"
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+ # positional parameters, so assign one to ordinary parameter first.
+ func_stripname_result=${3}
+ func_stripname_result=${func_stripname_result#"${1}"}
+ func_stripname_result=${func_stripname_result%"${2}"}
+}
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=${1%%=*}
+ func_opt_split_arg=${1#*=}
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ case ${1} in
+ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+ *) func_lo2o_result=${1} ;;
+ esac
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=${1%.*}.lo
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=$(( $* ))
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=${#1}
+}
+
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$1+=\$2"
+}
+# Generated shell functions inserted here.
+
+# 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:
+# In the unlikely event $progname began with a '-', it would play havoc with
+# func_echo (imagine progname=-n), so we prepend ./ in that case:
+func_dirname_and_basename "$progpath"
+progname=$func_basename_result
+case $progname in
+ -*) progname=./$progname ;;
+esac
+
+# Make sure we have an absolute path for reexecution:
+case $progpath in
+ [\\/]*|[A-Za-z]:\\*) ;;
+ *[\\/]*)
+ progdir=$func_dirname_result
+ progdir=`cd "$progdir" && pwd`
+ progpath="$progdir/$progname"
+ ;;
+ *)
+ save_IFS="$IFS"
+ IFS=:
+ for progdir in $PATH; do
+ IFS="$save_IFS"
+ test -x "$progdir/$progname" && break
+ done
+ IFS="$save_IFS"
+ test -n "$progdir" || progdir=`pwd`
+ progpath="$progdir/$progname"
+ ;;
+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'
+
+# Re-`\' parameter expansions in output of double_quote_subst that were
+# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
+# in input to double_quote_subst, that '$' was protected from expansion.
+# Since each input `\' is now two `\'s, look for any number of runs of
+# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
+bs='\\'
+bs2='\\\\'
+bs4='\\\\\\\\'
+dollar='\$'
+sed_double_backslash="\
+ s/$bs4/&\\
+/g
+ s/^$bs2$dollar/$bs&/
+ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
+ s/\n//g"
+
+# Standard options:
+opt_dry_run=false
+opt_help=false
+opt_quiet=false
+opt_verbose=false
+opt_warning=:
+
+# func_echo arg...
+# Echo program name prefixed message, along with the current mode
+# name if it has been set yet.
+func_echo ()
+{
+ $ECHO "$progname${mode+: }$mode: $*"
+}
+
+# func_verbose arg...
+# Echo program name prefixed message in verbose mode only.
+func_verbose ()
+{
+ $opt_verbose && func_echo ${1+"$@"}
+
+ # A bug in bash halts the script if the last line of a function
+ # fails when set -e is in force, so we need another command to
+ # work around that:
+ :
+}
+
+# func_error arg...
+# Echo program name prefixed message to standard error.
+func_error ()
+{
+ $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
+}
+
+# func_warning arg...
+# Echo program name prefixed warning message to standard error.
+func_warning ()
+{
+ $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
+
+ # bash bug again:
+ :
+}
+
+# func_fatal_error arg...
+# Echo program name prefixed message to standard error, and exit.
+func_fatal_error ()
+{
+ func_error ${1+"$@"}
+ exit $EXIT_FAILURE
+}
+
+# func_fatal_help arg...
+# Echo program name prefixed message to standard error, followed by
+# a help hint, and exit.
+func_fatal_help ()
+{
+ func_error ${1+"$@"}
+ func_fatal_error "$help"
+}
+help="Try \`$progname --help' for more information." ## default
+
+
+# func_grep expression filename
+# Check whether EXPRESSION matches any line of FILENAME, without output.
+func_grep ()
+{
+ $GREP "$1" "$2" >/dev/null 2>&1
+}
+
+
+# func_mkdir_p directory-path
+# Make sure the entire path to DIRECTORY-PATH is available.
+func_mkdir_p ()
+{
+ my_directory_path="$1"
+ my_dir_list=
+
+ if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
+
+ # Protect directory names starting with `-'
+ case $my_directory_path in
+ -*) my_directory_path="./$my_directory_path" ;;
+ esac
+
+ # While some portion of DIR does not yet exist...
+ while test ! -d "$my_directory_path"; do
+ # ...make a list in topmost first order. Use a colon delimited
+ # list incase some portion of path contains whitespace.
+ my_dir_list="$my_directory_path:$my_dir_list"
+
+ # If the last portion added has no slash in it, the list is done
+ case $my_directory_path in */*) ;; *) break ;; esac
+
+ # ...otherwise throw away the child directory and loop
+ my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
+ done
+ my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
+
+ save_mkdir_p_IFS="$IFS"; IFS=':'
+ for my_dir in $my_dir_list; do
+ IFS="$save_mkdir_p_IFS"
+ # mkdir can fail with a `File exist' error if two processes
+ # try to create one of the directories concurrently. Don't
+ # stop in that case!
+ $MKDIR "$my_dir" 2>/dev/null || :
+ done
+ IFS="$save_mkdir_p_IFS"
+
+ # Bail out if we (or some other process) failed to create a directory.
+ test -d "$my_directory_path" || \
+ func_fatal_error "Failed to create \`$1'"
+ fi
+}
-#####################################
-# Shell function definitions:
-# This seems to be the best place for them
# func_mktempdir [string]
# Make a temporary directory that won't clash with other running
@@ -523,7 +842,7 @@ func_mktempdir ()
{
my_template="${TMPDIR-/tmp}/${1-$progname}"
- if test "$run" = ":"; then
+ if test "$opt_dry_run" = ":"; then
# Return a directory name, but don't create it in dry-run mode
my_tmpdir="${my_template}-$$"
else
@@ -532,486 +851,743 @@ func_mktempdir ()
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
if test ! -d "$my_tmpdir"; then
- # Failing that, at least try and use $RANDOM to avoid a race
- my_tmpdir="${my_template}-${RANDOM-0}$$"
+ # Failing that, at least try and use $RANDOM to avoid a race
+ my_tmpdir="${my_template}-${RANDOM-0}$$"
- save_mktempdir_umask=`umask`
- umask 0077
- $mkdir "$my_tmpdir"
- umask $save_mktempdir_umask
+ save_mktempdir_umask=`umask`
+ umask 0077
+ $MKDIR "$my_tmpdir"
+ umask $save_mktempdir_umask
fi
# If we're not in dry-run mode, bomb out on failure
- test -d "$my_tmpdir" || {
- $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
- exit $EXIT_FAILURE
- }
+ test -d "$my_tmpdir" || \
+ func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
fi
- $echo "X$my_tmpdir" | $Xsed
+ $ECHO "X$my_tmpdir" | $Xsed
}
-# 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 ()
+# func_quote_for_eval arg
+# Aesthetically quote ARG to be evaled later.
+# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
+# is double-quoted, suitable for a subsequent eval, whereas
+# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
+# which are still active within double quotes backslashified.
+func_quote_for_eval ()
{
- 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 /{
- s,.*,import,
- p
- q
- }
- }'`
- case $win32_nmres in
- import*) win32_libid_type="x86 archive import";;
- *) win32_libid_type="x86 archive static";;
- esac
- 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"
- ;;
+ case $1 in
+ *[\\\`\"\$]*)
+ func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
+ *)
+ func_quote_for_eval_unquoted_result="$1" ;;
+ esac
+
+ case $func_quote_for_eval_unquoted_result in
+ # Double-quote args containing shell metacharacters to delay
+ # word splitting, command substitution and and variable
+ # expansion for a subsequent eval.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
+ ;;
+ *)
+ func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
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 ()
+# func_quote_for_expand arg
+# Aesthetically quote ARG to be evaled later; same as above,
+# but do not quote variable references.
+func_quote_for_expand ()
{
- 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.
+ case $1 in
+ *[\\\`\"]*)
+ my_arg=`$ECHO "X$1" | $Xsed \
+ -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
*)
- 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
+ my_arg="$1" ;;
+ esac
+
+ case $my_arg in
+ # Double-quote args containing shell metacharacters to delay
+ # word splitting and command substitution for a subsequent eval.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ my_arg="\"$my_arg\""
+ ;;
+ esac
+
+ func_quote_for_expand_result="$my_arg"
}
-# func_extract_an_archive dir oldlib
-func_extract_an_archive ()
+# func_show_eval cmd [fail_exp]
+# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
+# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.
+func_show_eval ()
{
- f_ex_an_ar_dir="$1"; shift
- f_ex_an_ar_oldlib="$1"
+ my_cmd="$1"
+ my_fail_exp="${2-:}"
- $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
+ ${opt_silent-false} || {
+ func_quote_for_expand "$my_cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+
+ if ${opt_dry_run-false}; then :; else
+ eval "$my_cmd"
+ my_status=$?
+ if test "$my_status" -eq 0; then :; else
+ eval "(exit $my_status); $my_fail_exp"
+ fi
fi
}
-# func_extract_archives gentop oldlib ...
-func_extract_archives ()
+
+# func_show_eval_locale cmd [fail_exp]
+# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
+# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it. Use the saved locale for evaluation.
+func_show_eval_locale ()
{
- 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
+ my_cmd="$1"
+ my_fail_exp="${2-:}"
- 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_xlib_u=$my_xlib
- while :; do
- case " $extracted_archives " in
- *" $my_xlib_u "*)
- extracted_serial=`expr $extracted_serial + 1`
- my_xlib_u=lt$extracted_serial-$my_xlib ;;
- *) break ;;
- esac
- done
- extracted_archives="$extracted_archives $my_xlib_u"
- my_xdir="$my_gentop/$my_xlib_u"
+ ${opt_silent-false} || {
+ func_quote_for_expand "$my_cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
- $show "${rm}r $my_xdir"
- $run ${rm}r "$my_xdir"
- $show "$mkdir $my_xdir"
- $run $mkdir "$my_xdir"
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
- exit $exit_status
+ if ${opt_dry_run-false}; then :; else
+ eval "$lt_user_locale
+ $my_cmd"
+ my_status=$?
+ eval "$lt_safe_locale"
+ if test "$my_status" -eq 0; then :; else
+ eval "(exit $my_status); $my_fail_exp"
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"
+ fi
}
-# End of Shell function definitions
-#####################################
-# Darwin sucks
-eval std_shrext=\"$shrext_cmds\"
-disable_libs=no
-# Parse our command line options once, thoroughly.
-while test "$#" -gt 0
-do
- arg="$1"
+
+
+# func_version
+# Echo version message to standard output and exit.
+func_version ()
+{
+ $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
+ s/^# //
+ s/^# *$//
+ s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
+ p
+ }' < "$progpath"
+ exit $?
+}
+
+# func_usage
+# Echo short help message to standard output and exit.
+func_usage ()
+{
+ $SED -n '/^# Usage:/,/# -h/ {
+ s/^# //
+ s/^# *$//
+ s/\$progname/'$progname'/
+ p
+ }' < "$progpath"
+ $ECHO
+ $ECHO "run \`$progname --help | more' for full usage"
+ exit $?
+}
+
+# func_help
+# Echo long help message to standard output and exit.
+func_help ()
+{
+ $SED -n '/^# Usage:/,/# Report bugs to/ {
+ s/^# //
+ s/^# *$//
+ s*\$progname*'$progname'*
+ s*\$host*'"$host"'*
+ s*\$SHELL*'"$SHELL"'*
+ s*\$LTCC*'"$LTCC"'*
+ s*\$LTCFLAGS*'"$LTCFLAGS"'*
+ s*\$LD*'"$LD"'*
+ s/\$with_gnu_ld/'"$with_gnu_ld"'/
+ s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
+ s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
+ p
+ }' < "$progpath"
+ exit $?
+}
+
+# func_missing_arg argname
+# Echo program name prefixed message to standard error and set global
+# exit_cmd.
+func_missing_arg ()
+{
+ func_error "missing argument for $1"
+ exit_cmd=exit
+}
+
+exit_cmd=:
+
+
+
+
+
+# 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
- case $arg in
- -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit $EXIT_SUCCESS
+fi
- # 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
+magic="%%%MAGIC variable%%%"
+magic_exe="%%%MAGIC EXE variable%%%"
- 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
+# Global variables.
+# $mode is unset
+nonopt=
+execute_dlfiles=
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
- prev=
- prevopt=
- continue
- fi
+opt_dry_run=false
+opt_duplicate_deps=false
+opt_silent=false
+opt_debug=:
- # Have we seen a non-optional argument yet?
- case $arg in
- --help)
- show_help=yes
- ;;
+# 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=
- --version)
- echo "\
-$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
+# func_fatal_configuration arg...
+# Echo program name prefixed message to standard error, followed by
+# a configuration failure hint, and exit.
+func_fatal_configuration ()
+{
+ func_error ${1+"$@"}
+ func_error "See the $PACKAGE documentation for more information."
+ func_fatal_error "Fatal configuration error."
+}
-Copyright (C) 2008 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."
- exit $?
- ;;
- --config)
- ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
+# func_config
+# Display the configuration for all the tags in this script.
+func_config ()
+{
+ re_begincf='^# ### BEGIN LIBTOOL'
+ re_endcf='^# ### END LIBTOOL'
+
+ # Default configuration.
+ $SED "1,/$re_begincf CONFIG/d;/$re_endcf 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"
+ $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf 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=:
- ;;
+ exit $?
+}
- --features)
- $echo "host: $host"
+# func_features
+# Display the features supported by this script.
+func_features ()
+{
+ $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 $?
- ;;
+}
+
+# func_enable_tag tagname
+# Verify that TAGNAME is valid, and either flag an error and exit, or
+# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
+# variable here.
+func_enable_tag ()
+{
+ # Global variable:
+ tagname="$1"
- --finish) mode="finish" ;;
+ re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
+ re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
+ sed_extractcf="/$re_begincf/,/$re_endcf/p"
- --mode) prevopt="--mode" prev=mode ;;
- --mode=*) mode="$optarg" ;;
+ # Validate tagname.
+ case $tagname in
+ *[!-_A-Za-z0-9,/]*)
+ func_fatal_error "invalid tag name: $tagname"
+ ;;
+ esac
- --preserve-dup-deps) duplicate_deps="yes" ;;
+ # Don't test for the "default" C tag, as we know it's
+ # there but not specially marked.
+ case $tagname in
+ CC) ;;
+ *)
+ if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
+ taglist="$taglist $tagname"
+
+ # Evaluate the configuration. Be careful to quote the path
+ # and the sed script, to avoid splitting on whitespace, but
+ # also don't use non-portable quotes within backquotes within
+ # quotes we have to do it in 2 steps:
+ extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
+ eval "$extractedcf"
+ else
+ func_error "ignoring unknown tag $tagname"
+ fi
+ ;;
+ esac
+}
- --quiet | --silent)
- show=:
- preserve_args="$preserve_args $arg"
- ;;
+# Parse options once, thoroughly. This comes as soon as possible in
+# the script to make things like `libtool --version' happen quickly.
+{
- --tag)
- prevopt="--tag"
- prev=tag
- preserve_args="$preserve_args --tag"
+ # Shorthand for --mode=foo, only valid as the first argument
+ case $1 in
+ clean|clea|cle|cl)
+ shift; set dummy --mode clean ${1+"$@"}; shift
;;
- --tag=*)
- set tag "$optarg" ${1+"$@"}
- shift
- prev=tag
- preserve_args="$preserve_args --tag"
+ compile|compil|compi|comp|com|co|c)
+ shift; set dummy --mode compile ${1+"$@"}; shift
;;
-
- -dlopen)
- prevopt="-dlopen"
- prev=execute_dlfiles
+ execute|execut|execu|exec|exe|ex|e)
+ shift; set dummy --mode execute ${1+"$@"}; shift
;;
-
- -*)
- $echo "$modename: unrecognized option \`$arg'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
+ finish|finis|fini|fin|fi|f)
+ shift; set dummy --mode finish ${1+"$@"}; shift
;;
-
- *)
- nonopt="$arg"
- break
+ install|instal|insta|inst|ins|in|i)
+ shift; set dummy --mode install ${1+"$@"}; shift
+ ;;
+ link|lin|li|l)
+ shift; set dummy --mode link ${1+"$@"}; shift
+ ;;
+ uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+ shift; set dummy --mode uninstall ${1+"$@"}; shift
;;
esac
-done
-if test -n "$prevopt"; then
- $echo "$modename: option \`$prevopt' requires an argument" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
-fi
+ # Parse non-mode specific arguments:
+ while test "$#" -gt 0; do
+ opt="$1"
+ shift
-case $disable_libs in
-no)
- ;;
-shared)
- build_libtool_libs=no
- build_old_libs=yes
- ;;
-static)
- build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
- ;;
-esac
+ case $opt in
+ --config) func_config ;;
-# 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=
+ --debug) preserve_args="$preserve_args $opt"
+ func_echo "enabling shell trace mode"
+ opt_debug='set -x'
+ $opt_debug
+ ;;
-if test -z "$show_help"; then
+ -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
+ execute_dlfiles="$execute_dlfiles $1"
+ shift
+ ;;
- # 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
+ --dry-run | -n) opt_dry_run=: ;;
+ --features) func_features ;;
+ --finish) mode="finish" ;;
+
+ --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
+ case $1 in
+ # Valid mode arguments:
+ clean) ;;
+ compile) ;;
+ execute) ;;
+ finish) ;;
+ install) ;;
+ link) ;;
+ relink) ;;
+ uninstall) ;;
+
+ # Catch anything else as an error
+ *) func_error "invalid argument for $opt"
+ exit_cmd=exit
+ break
+ ;;
+ esac
+
+ mode="$1"
+ shift
+ ;;
+
+ --preserve-dup-deps)
+ opt_duplicate_deps=: ;;
+
+ --quiet|--silent) preserve_args="$preserve_args $opt"
+ opt_silent=:
+ ;;
+
+ --verbose| -v) preserve_args="$preserve_args $opt"
+ opt_silent=false
+ ;;
+
+ --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
+ preserve_args="$preserve_args $opt $1"
+ func_enable_tag "$1" # tagname is set here
+ shift
+ ;;
+
+ # Separate optargs to long options:
+ -dlopen=*|--mode=*|--tag=*)
+ func_opt_split "$opt"
+ set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
+ shift
+ ;;
+
+ -\?|-h) func_usage ;;
+ --help) opt_help=: ;;
+ --version) func_version ;;
+
+ -*) func_fatal_help "unrecognized option \`$opt'" ;;
+
+ *) nonopt="$opt"
+ break
+ ;;
+ esac
+ done
+
+
+ case $host in
+ *cygwin* | *mingw* | *pw32* | *cegcc*)
+ # don't eliminate duplications in $postdeps and $predeps
+ opt_duplicate_compiler_generated_deps=:
;;
*)
- # If we have no mode, but dlfiles were specified, then do execute mode.
- test -n "$execute_dlfiles" && mode=execute
+ opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
+ ;;
+ esac
- # 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
+ # Having warned about all mis-specified options, bail out if
+ # anything was wrong.
+ $exit_cmd $EXIT_FAILURE
+}
+
+# func_check_version_match
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
+{
+ if test "$package_revision" != "$macro_revision"; then
+ if test "$VERSION" != "$macro_version"; then
+ if test -z "$macro_version"; then
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+ else
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
fi
- ;;
- esac
+ else
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
+ fi
+
+ exit $EXIT_MISMATCH
+ fi
+}
+
+
+## ----------- ##
+## Main. ##
+## ----------- ##
+
+$opt_help || {
+ # Sanity checks first:
+ func_check_version_match
+
+ if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ func_fatal_configuration "not configured to build any kind of library"
fi
+ test -z "$mode" && func_fatal_error "error: you must specify a MODE."
+
+
+ # Darwin sucks
+ eval std_shrext=\"$shrext_cmds\"
+
+
# 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
+ func_error "unrecognized option \`-dlopen'"
+ $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."
+ help="Try \`$progname --help --mode=$mode' for more information."
+}
+
+
+# func_lalib_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_lalib_p ()
+{
+ test -f "$1" &&
+ $SED -e 4q "$1" 2>/dev/null \
+ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+}
+
+# func_lalib_unsafe_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function implements the same check as func_lalib_p without
+# resorting to external programs. To this end, it redirects stdin and
+# closes it afterwards, without saving the original file descriptor.
+# As a safety measure, use it only where a negative result would be
+# fatal anyway. Works if `file' does not exist.
+func_lalib_unsafe_p ()
+{
+ lalib_p=no
+ if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
+ for lalib_p_l in 1 2 3 4
+ do
+ read lalib_p_line
+ case "$lalib_p_line" in
+ \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
+ esac
+ done
+ exec 0<&5 5<&-
+ fi
+ test "$lalib_p" = yes
+}
+
+# func_ltwrapper_script_p file
+# True iff FILE is a libtool wrapper script
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_script_p ()
+{
+ func_lalib_p "$1"
+}
+
+# func_ltwrapper_executable_p file
+# True iff FILE is a libtool wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_executable_p ()
+{
+ func_ltwrapper_exec_suffix=
+ case $1 in
+ *.exe) ;;
+ *) func_ltwrapper_exec_suffix=.exe ;;
+ esac
+ $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
+}
+
+# func_ltwrapper_scriptname file
+# Assumes file is an ltwrapper_executable
+# uses $file to determine the appropriate filename for a
+# temporary ltwrapper_script.
+func_ltwrapper_scriptname ()
+{
+ func_ltwrapper_scriptname_result=""
+ if func_ltwrapper_executable_p "$1"; then
+ func_dirname_and_basename "$1" "" "."
+ func_stripname '' '.exe' "$func_basename_result"
+ func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+ fi
+}
+
+# func_ltwrapper_p file
+# True iff FILE is a libtool wrapper script or wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_p ()
+{
+ func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
+}
+
+
+# func_execute_cmds commands fail_cmd
+# Execute tilde-delimited COMMANDS.
+# If FAIL_CMD is given, eval that upon failure.
+# FAIL_CMD may read-access the current command in variable CMD!
+func_execute_cmds ()
+{
+ $opt_debug
+ save_ifs=$IFS; IFS='~'
+ for cmd in $1; do
+ IFS=$save_ifs
+ eval cmd=\"$cmd\"
+ func_show_eval "$cmd" "${2-:}"
+ done
+ IFS=$save_ifs
+}
+
+
+# func_source file
+# Source FILE, adding directory component if necessary.
+# Note that it is not necessary on cygwin/mingw to append a dot to
+# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
+# behavior happens only for exec(3), not for open(2)! Also, sourcing
+# `FILE.' does not work on cygwin managed mounts.
+func_source ()
+{
+ $opt_debug
+ case $1 in
+ */* | *\\*) . "$1" ;;
+ *) . "./$1" ;;
+ esac
+}
+
+
+# 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 ()
+{
+ $opt_debug
+ if test -n "$available_tags" && test -z "$tagname"; then
+ CC_quoted=
+ for arg in $CC; do
+ func_quote_for_eval "$arg"
+ CC_quoted="$CC_quoted $func_quote_for_eval_result"
+ 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.
+ func_quote_for_eval "$arg"
+ CC_quoted="$CC_quoted $func_quote_for_eval_result"
+ 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
+ func_echo "unable to infer tagged configuration"
+ func_fatal_error "specify a tag with \`--tag'"
+# else
+# func_verbose "using $tagname tagged configuration"
+ fi
+ ;;
+ esac
+ fi
+}
+
+
+
+# func_write_libtool_object output_name pic_name nonpic_name
+# Create a libtool object file (analogous to a ".la" file),
+# but don't create it if we're doing a dry run.
+func_write_libtool_object ()
+{
+ write_libobj=${1}
+ if test "$build_libtool_libs" = yes; then
+ write_lobj=\'${2}\'
+ else
+ write_lobj=none
+ fi
+
+ if test "$build_old_libs" = yes; then
+ write_oldobj=\'${3}\'
+ else
+ write_oldobj=none
+ fi
+
+ $opt_dry_run || {
+ cat >${write_libobj}T <<EOF
+# $write_libobj - a libtool object file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object=$write_lobj
+
+# Name of the non-PIC object
+non_pic_object=$write_oldobj
- # These modes are in order of execution frequency so that they run quickly.
- case $mode in
- # libtool compile mode
- compile)
- modename="$modename: compile"
+EOF
+ $MV "${write_libobj}T" "${write_libobj}"
+ }
+}
+
+# func_mode_compile arg...
+func_mode_compile ()
+{
+ $opt_debug
# Get the compilation command and the source file.
base_compile=
srcfile="$nonopt" # always keep a non-empty value in "srcfile"
@@ -1020,6 +1596,7 @@ if test -z "$show_help"; then
arg_mode=normal
libobj=
later=
+ pie_flag=
for arg
do
@@ -1040,15 +1617,18 @@ if test -z "$show_help"; then
# 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
+ test -n "$libobj" && \
+ func_fatal_error "you cannot specify \`-o' more than once"
arg_mode=target
continue
;;
- -static | -prefer-pic | -prefer-non-pic)
+ -pie | -fpie | -fPIE)
+ pie_flag="$pie_flag $arg"
+ continue
+ ;;
+
+ -shared | -static | -prefer-pic | -prefer-non-pic)
later="$later $arg"
continue
;;
@@ -1064,31 +1644,25 @@ if test -z "$show_help"; then
;; # replaced later. I would guess that would be a bug.
-Wc,*)
- args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+ func_stripname '-Wc,' '' "$arg"
+ args=$func_stripname_result
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.
- # 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"
+ func_quote_for_eval "$arg"
+ lastarg="$lastarg $func_quote_for_eval_result"
done
IFS="$save_ifs"
- lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+ func_stripname ' ' '' "$lastarg"
+ lastarg=$func_stripname_result
# 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.
#
@@ -1100,66 +1674,42 @@ if test -z "$show_help"; then
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.
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- lastarg="\"$lastarg\""
- ;;
- esac
-
- base_compile="$base_compile $lastarg"
+ func_quote_for_eval "$lastarg"
+ base_compile="$base_compile $func_quote_for_eval_result"
done # for arg
case $arg_mode in
arg)
- $echo "$modename: you must specify an argument for -Xcompile"
- exit $EXIT_FAILURE
+ func_fatal_error "you must specify an argument for -Xcompile"
;;
target)
- $echo "$modename: you must specify a target with \`-o'" 1>&2
- exit $EXIT_FAILURE
+ func_fatal_error "you must specify a target with \`-o'"
;;
*)
# Get the name of the library object.
- [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+ test -z "$libobj" && {
+ func_basename "$srcfile"
+ libobj="$func_basename_result"
+ }
;;
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 ;;
- *.[fF][09]?) xform=[fF][09]. ;;
- *.for) xform=for ;;
- *.java) xform=java ;;
- *.obj) xform=obj ;;
- *.sx) xform=sx ;;
+ *.[cCFSifmso] | \
+ *.ada | *.adb | *.ads | *.asm | \
+ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
+ *.[fF][09]? | *.for | *.java | *.obj | *.sx)
+ func_xform "$libobj"
+ libobj=$func_xform_result
+ ;;
esac
- libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
-
case $libobj in
- *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+ *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
*)
- $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
- exit $EXIT_FAILURE
+ func_fatal_error "cannot determine name of library object from \`$libobj'"
;;
esac
@@ -1167,7 +1717,15 @@ if test -z "$show_help"; then
for arg in $later; do
case $arg in
+ -shared)
+ test "$build_libtool_libs" != yes && \
+ func_fatal_configuration "can not build a shared library"
+ build_old_libs=no
+ continue
+ ;;
+
-static)
+ build_libtool_libs=no
build_old_libs=yes
continue
;;
@@ -1184,28 +1742,17 @@ if test -z "$show_help"; then
esac
done
- qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
- case $qlibobj in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- qlibobj="\"$qlibobj\"" ;;
- esac
- test "X$libobj" != "X$qlibobj" \
- && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
- && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
- 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
+ func_quote_for_eval "$libobj"
+ test "X$libobj" != "X$func_quote_for_eval_result" \
+ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
+ && func_warning "libobj name \`$libobj' may not contain shell special characters."
+ func_dirname_and_basename "$obj" "/" ""
+ objname="$func_basename_result"
+ xdir="$func_dirname_result"
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
+ test -z "$base_compile" && \
+ func_fatal_help "you must specify a compilation command"
# Delete any leftover library objects.
if test "$build_old_libs" = yes; then
@@ -1214,12 +1761,9 @@ if test -z "$show_help"; then
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*)
+ cygwin* | mingw* | pw32* | os2* | cegcc*)
pic_mode=default
;;
esac
@@ -1231,10 +1775,8 @@ if test -z "$show_help"; then
# 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}
+ 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
@@ -1244,13 +1786,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
- $show "Waiting for $lockfile to be removed"
+ until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+ func_echo "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`
@@ -1261,34 +1803,22 @@ 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
+ $opt_dry_run || $RM $removelist
exit $EXIT_FAILURE
fi
- $echo "$srcfile" > "$lockfile"
+ removelist="$removelist $output_obj"
+ $ECHO "$srcfile" > "$lockfile"
fi
+ $opt_dry_run || $RM $removelist
+ removelist="$removelist $lockfile"
+ trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
+
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
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- 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 <<EOF
-# $libobj - a libtool object file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# Name of the PIC object.
-EOF
+ func_quote_for_eval "$srcfile"
+ qsrcfile=$func_quote_for_eval_result
# Only build a PIC object if we are building libtool libraries.
if test "$build_libtool_libs" = yes; then
@@ -1302,32 +1832,19 @@ EOF
command="$base_compile $qsrcfile"
fi
- if test ! -d "${xdir}$objdir"; then
- $show "$mkdir ${xdir}$objdir"
- $run $mkdir ${xdir}$objdir
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
- exit $exit_status
- fi
- fi
+ func_mkdir_p "$xdir$objdir"
if test -z "$output_obj"; then
# Place PIC objects in $objdir
command="$command -o $lobj"
fi
- $run $rm "$lobj" "$output_obj"
-
- $show "$command"
- if $run eval $lt_env "$command"; then :
- else
- test -n "$output_obj" && $run $rm $removelist
- exit $EXIT_FAILURE
- fi
+ func_show_eval_locale "$command" \
+ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
if test "$need_locks" = warn &&
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
- $echo "\
+ $ECHO "\
*** ERROR, $lockfile contains:
`cat $lockfile 2>/dev/null`
@@ -1341,45 +1858,27 @@ 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
+ $opt_dry_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
+ func_show_eval '$MV "$output_obj" "$lobj"' \
+ 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
fi
- # Append the name of the PIC object to the libtool object file.
- test -z "$run" && cat >> ${libobj}T <<EOF
-pic_object='$objdir/$objname'
-
-EOF
-
# Allow error messages only from the first compilation.
if test "$suppress_opt" = yes; then
- suppress_output=' >/dev/null 2>&1'
+ suppress_output=' >/dev/null 2>&1'
fi
- else
- # No PIC object so indicate it doesn't exist in the libtool
- # object file.
- test -z "$run" && cat >> ${libobj}T <<EOF
-pic_object=none
-
-EOF
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 $qsrcfile"
+ command="$base_compile $qsrcfile$pie_flag"
else
command="$base_compile $qsrcfile $pic_flag"
fi
@@ -1389,17 +1888,12 @@ EOF
# Suppress compiler output if we already did a PIC compilation.
command="$command$suppress_output"
- $run $rm "$obj" "$output_obj"
- $show "$command"
- if $run eval $lt_env "$command"; then :
- else
- $run $rm $removelist
- exit $EXIT_FAILURE
- fi
+ func_show_eval_locale "$command" \
+ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
if test "$need_locks" = warn &&
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
- $echo "\
+ $ECHO "\
*** ERROR, $lockfile contains:
`cat $lockfile 2>/dev/null`
@@ -1413,53 +1907,2620 @@ 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
+ $opt_dry_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 :
+ func_show_eval '$MV "$output_obj" "$obj"' \
+ 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+ fi
+ fi
+
+ $opt_dry_run || {
+ func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
+
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ removelist=$lockfile
+ $RM "$lockfile"
+ fi
+ }
+
+ exit $EXIT_SUCCESS
+}
+
+$opt_help || {
+test "$mode" = compile && func_mode_compile ${1+"$@"}
+}
+
+func_mode_help ()
+{
+ # We need to display help for each of the modes.
+ case $mode in
+ "")
+ # Generic help is extracted from the usage comments
+ # at the start of this file.
+ func_help
+ ;;
+
+ clean)
+ $ECHO \
+"Usage: $progname [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: $progname [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
+ -no-suppress do not suppress compiler output for multiple passes
+ -prefer-pic try to building PIC objects only
+ -prefer-non-pic try to building non-PIC objects only
+ -shared do not build a \`.o' file suitable for static linking
+ -static only 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: $progname [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: $progname [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: $progname [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 following components of INSTALL-COMMAND are treated specially:
+
+ -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+ link)
+ $ECHO \
+"Usage: $progname [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
+ -shared only do dynamic linking of libtool libraries
+ -shrext SUFFIX override the standard shared library file extension
+ -static do not do any dynamic linking of uninstalled libtool libraries
+ -static-libtool-libs
+ do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+ -weak LIBNAME declare that the target provides the LIBNAME interface
+
+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: $progname [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."
+ ;;
+
+ *)
+ func_fatal_help "invalid operation mode \`$mode'"
+ ;;
+ esac
+
+ $ECHO
+ $ECHO "Try \`$progname --help' for more information about other modes."
+
+ exit $?
+}
+
+ # Now that we've collected a possible --mode arg, show help if necessary
+ $opt_help && func_mode_help
+
+
+# func_mode_execute arg...
+func_mode_execute ()
+{
+ $opt_debug
+ # The first argument is the command name.
+ cmd="$nonopt"
+ test -z "$cmd" && \
+ func_fatal_help "you must specify a COMMAND"
+
+ # Handle -dlopen flags immediately.
+ for file in $execute_dlfiles; do
+ test -f "$file" \
+ || func_fatal_help "\`$file' is not a file"
+
+ dir=
+ case $file in
+ *.la)
+ # Check to see that this really is a libtool archive.
+ func_lalib_unsafe_p "$file" \
+ || func_fatal_help "\`$lib' is not a valid libtool archive"
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+ func_source "$file"
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && \
+ func_warning "\`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+
+ if test -f "$dir/$objdir/$dlname"; then
+ dir="$dir/$objdir"
else
- error=$?
- $run $rm $removelist
- exit $error
+ if test ! -f "$dir/$dlname"; then
+ func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
+ fi
fi
+ ;;
+
+ *.lo)
+ # Just add the directory containing the .lo file.
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+ ;;
+
+ *)
+ func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
+ 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
- # 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 <<EOF
-# Name of the non-PIC object.
-non_pic_object='$objname'
+ # This variable tells wrapper scripts just to set shlibpath_var
+ # rather than running their programs.
+ libtool_execute_magic="$magic"
-EOF
+ # 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 func_ltwrapper_script_p "$file"; then
+ func_source "$file"
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ elif func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ func_source "$func_ltwrapper_scriptname_result"
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ fi
+ ;;
+ esac
+ # Quote arguments (to preserve shell metacharacters).
+ func_quote_for_eval "$file"
+ args="$args $func_quote_for_eval_result"
+ done
+
+ if test "X$opt_dry_run" = Xfalse; then
+ if test -n "$shlibpath_var"; then
+ # Export the shlibpath_var.
+ eval "export $shlibpath_var"
+ fi
+
+ # Restore saved environment variables
+ for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+ do
+ eval "if test \"\${save_$lt_var+set}\" = set; then
+ $lt_var=\$save_$lt_var; export $lt_var
+ else
+ $lt_unset $lt_var
+ fi"
+ done
+
+ # Now prepare to actually exec the command.
+ exec_cmd="\$cmd$args"
else
- # 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 <<EOF
-# Name of the non-PIC object.
-non_pic_object=none
+ # 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 $EXIT_SUCCESS
+ fi
+}
-EOF
+test "$mode" = execute && func_mode_execute ${1+"$@"}
+
+
+# func_mode_finish arg...
+func_mode_finish ()
+{
+ $opt_debug
+ 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.
+ func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
+'"$cmd"'"'
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $opt_dry_run || eval "$cmds" || admincmds="$admincmds
+ $cmds"
+ fi
+ done
fi
- $run $mv "${libobj}T" "${libobj}"
+ # Exit here if they wanted silent mode.
+ $opt_silent && exit $EXIT_SUCCESS
+
+ $ECHO "X----------------------------------------------------------------------" | $Xsed
+ $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\"
- # Unlock the critical section if it was locked
- if test "$need_locks" != no; then
- $run $rm "$lockfile"
+ $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"
+ case $host in
+ solaris2.[6789]|solaris2.1[0-9])
+ $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+ $ECHO "pages."
+ ;;
+ *)
+ $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
+ ;;
+ esac
+ $ECHO "X----------------------------------------------------------------------" | $Xsed
exit $EXIT_SUCCESS
+}
+
+test "$mode" = finish && func_mode_finish ${1+"$@"}
+
+
+# func_mode_install arg...
+func_mode_install ()
+{
+ $opt_debug
+ # 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" | $GREP shtool >/dev/null; then
+ # Aesthetically quote it.
+ func_quote_for_eval "$nonopt"
+ install_prog="$func_quote_for_eval_result "
+ arg=$1
+ shift
+ else
+ install_prog=
+ arg=$nonopt
+ fi
+
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ func_quote_for_eval "$arg"
+ install_prog="$install_prog$func_quote_for_eval_result"
+
+ # 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)
+ case " $install_prog " in
+ *[\\\ /]cp\ *) ;;
+ *) prev=$arg ;;
+ esac
+ ;;
+ -g | -m | -o)
+ prev=$arg
+ ;;
+ -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.
+ func_quote_for_eval "$arg"
+ install_prog="$install_prog $func_quote_for_eval_result"
+ done
+
+ test -z "$install_prog" && \
+ func_fatal_help "you must specify an install program"
+
+ test -n "$prev" && \
+ func_fatal_help "the \`$prev' option requires an argument"
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ func_fatal_help "no file or destination specified"
+ else
+ func_fatal_help "you must specify a destination"
+ fi
+ fi
+
+ # Strip any trailing slash from the destination.
+ func_stripname '' '/' "$dest"
+ dest=$func_stripname_result
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ func_dirname_and_basename "$dest" "" "."
+ destdir="$func_dirname_result"
+ destname="$func_basename_result"
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files; shift
+ test "$#" -gt 1 && \
+ func_fatal_help "\`$dest' is not a directory"
+ fi
+ case $destdir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case $file in
+ *.lo) ;;
+ *)
+ func_fatal_help "\`$destdir' must be an absolute directory name"
+ ;;
+ 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.
+ func_lalib_unsafe_p "$file" \
+ || func_fatal_help "\`$file' is not a valid libtool archive"
+
+ library_names=
+ old_library=
+ relink_command=
+ func_source "$file"
+
+ # 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
+
+ func_dirname "$file" "/" ""
+ dir="$func_dirname_result"
+ dir="$dir$objdir"
+
+ if test -n "$relink_command"; then
+ # Determine the prefix the user has applied to our future dir.
+ inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "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.
+ test "$inst_prefix_dir" = "$destdir" && \
+ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
+
+ if test -n "$inst_prefix_dir"; then
+ # Stick the inst_prefix_dir data into the link command.
+ relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+ else
+ relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
+ fi
+
+ func_warning "relinking \`$file'"
+ func_show_eval "$relink_command" \
+ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
+ fi
+
+ # See the names of the shared library.
+ set dummy $library_names; shift
+ if test -n "$1"; then
+ realname="$1"
+ shift
+
+ srcname="$realname"
+ test -n "$relink_command" && srcname="$realname"T
+
+ # Install the shared library and build the symlinks.
+ func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
+ 'exit $?'
+ tstripme="$stripme"
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ case $realname in
+ *.dll.a)
+ tstripme=""
+ ;;
+ esac
+ ;;
+ esac
+ if test -n "$tstripme" && test -n "$striplib"; then
+ func_show_eval "$striplib $destdir/$realname" 'exit $?'
+ fi
+
+ if test "$#" -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ # Try `ln -sf' first, because the `ln' binary might depend on
+ # the symlink we replace! Solaris /bin/ln does not understand -f,
+ # so we also need to try rm && ln -s.
+ for linkname
+ do
+ test "$linkname" != "$realname" \
+ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ func_execute_cmds "$postinstall_cmds" 'exit $?'
+ fi
+
+ # Install the pseudo-library for information purposes.
+ func_basename "$file"
+ name="$func_basename_result"
+ instname="$dir/$name"i
+ func_show_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
+ func_basename "$file"
+ destfile="$func_basename_result"
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case $destfile in
+ *.lo)
+ func_lo2o "$destfile"
+ staticdest=$func_lo2o_result
+ ;;
+ *.$objext)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ func_fatal_help "cannot copy a libtool object to \`$destfile'"
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ test -n "$destfile" && \
+ func_show_eval "$install_prog $file $destfile" 'exit $?'
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ func_lo2o "$file"
+ staticobj=$func_lo2o_result
+ func_show_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
+ func_basename "$file"
+ destfile="$func_basename_result"
+ 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
+ func_stripname '' '.exe' "$file"
+ file=$func_stripname_result
+ stripped_ext=".exe"
+ fi
+ ;;
+ esac
+
+ # Do a test to see if this is really a libtool program.
+ case $host in
+ *cygwin* | *mingw*)
+ if func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ wrapper=$func_ltwrapper_scriptname_result
+ else
+ func_stripname '' '.exe' "$file"
+ wrapper=$func_stripname_result
+ fi
+ ;;
+ *)
+ wrapper=$file
+ ;;
+ esac
+ if func_ltwrapper_script_p "$wrapper"; then
+ notinst_deplibs=
+ relink_command=
+
+ func_source "$wrapper"
+
+ # Check the variables that should have been set.
+ test -z "$generated_by_libtool_version" && \
+ func_fatal_error "invalid libtool wrapper script \`$wrapper'"
+
+ finalize=yes
+ for lib in $notinst_deplibs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ func_source "$lib"
+ fi
+ libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ func_warning "\`$lib' has not been installed in \`$libdir'"
+ finalize=no
+ fi
+ done
+
+ relink_command=
+ func_source "$wrapper"
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ $opt_dry_run || {
+ if test "$finalize" = yes; then
+ tmpdir=`func_mktempdir`
+ func_basename "$file$stripped_ext"
+ file="$func_basename_result"
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+ $opt_silent || {
+ func_quote_for_expand "$relink_command"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ if eval "$relink_command"; then :
+ else
+ func_error "error: relink \`$file' with the above command before installing it"
+ $opt_dry_run || ${RM}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ func_warning "cannot relink \`$file'"
+ 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 anyway
+ case $install_prog,$host in
+ */usr/bin/install*,*cygwin*)
+ case $file:$destfile in
+ *.exe:*.exe)
+ # this is ok
+ ;;
+ *.exe:*)
+ destfile=$destfile.exe
+ ;;
+ *:*.exe)
+ func_stripname '' '.exe' "$destfile"
+ destfile=$func_stripname_result
+ ;;
+ esac
+ ;;
+ esac
+ func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
+ $opt_dry_run || if test -n "$outputname"; then
+ ${RM}r "$tmpdir"
+ fi
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ func_basename "$file"
+ name="$func_basename_result"
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+
+ func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
+
+ if test -n "$stripme" && test -n "$old_striplib"; then
+ func_show_eval "$old_striplib $oldlib" 'exit $?'
+ fi
+
+ # Do each command in the postinstall commands.
+ func_execute_cmds "$old_postinstall_cmds" 'exit $?'
+ done
+
+ test -n "$future_libdirs" && \
+ func_warning "remember to run \`$progname --finish$future_libdirs'"
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ $opt_dry_run && current_libdirs=" -n$current_libdirs"
+ exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+ else
+ exit $EXIT_SUCCESS
+ fi
+}
+
+test "$mode" = install && func_mode_install ${1+"$@"}
+
+
+# func_generate_dlsyms outputname originator pic_p
+# Extract symbols from dlprefiles and create ${outputname}S.o with
+# a dlpreopen symbol table.
+func_generate_dlsyms ()
+{
+ $opt_debug
+ my_outputname="$1"
+ my_originator="$2"
+ my_pic_p="${3-no}"
+ my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
+ my_dlsyms=
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ my_dlsyms="${my_outputname}S.c"
+ else
+ func_error "not configured to extract global symbols from dlpreopened files"
+ fi
+ fi
+
+ if test -n "$my_dlsyms"; then
+ case $my_dlsyms in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${my_outputname}.nm"
+
+ func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
+
+ # Parse the name list into a source file.
+ func_verbose "creating $output_objdir/$my_dlsyms"
+
+ $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
+/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
+/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ func_verbose "generating symbol list for \`$output'"
+
+ $opt_dry_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 progfile in $progfiles; do
+ func_verbose "extracting global C symbols from \`$progfile'"
+ $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $opt_dry_run || {
+ eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ }
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $opt_dry_run || {
+ eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ }
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$outputname.exp"
+ $opt_dry_run || {
+ $RM $export_symbols
+ eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ }
+ else
+ $opt_dry_run || {
+ eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+ eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ case $host in
+ *cygwin | *mingw* | *cegcc* )
+ eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ }
+ fi
+ fi
+
+ for dlprefile in $dlprefiles; do
+ func_verbose "extracting global C symbols from \`$dlprefile'"
+ func_basename "$dlprefile"
+ name="$func_basename_result"
+ $opt_dry_run || {
+ eval '$ECHO ": $name " >> "$nlist"'
+ eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+ }
+ done
+
+ $opt_dry_run || {
+ # 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 >/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/$my_dlsyms"'
+ else
+ $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
+ fi
+
+ $ECHO >> "$output_objdir/$my_dlsyms" "\
+
+/* The mapping between symbol names and symbols. */
+typedef struct {
+ const char *name;
+ void *address;
+} lt_dlsymlist;
+"
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ $ECHO >> "$output_objdir/$my_dlsyms" "\
+/* DATA imports from DLLs on WIN32 con't be const, because
+ runtime relocations are performed -- see ld's documentation
+ on pseudo-relocs. */"
+ lt_dlsym_const= ;;
+ *osf5*)
+ echo >> "$output_objdir/$my_dlsyms" "\
+/* This system does not cope well with relocations in const data */"
+ lt_dlsym_const= ;;
+ *)
+ lt_dlsym_const=const ;;
+ esac
+
+ $ECHO >> "$output_objdir/$my_dlsyms" "\
+extern $lt_dlsym_const lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[];
+$lt_dlsym_const lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[] =
+{\
+ { \"$my_originator\", (void *) 0 },"
+
+ case $need_lib_prefix in
+ no)
+ eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
+ ;;
+ *)
+ eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
+ ;;
+ esac
+ $ECHO >> "$output_objdir/$my_dlsyms" "\
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_${my_prefix}_LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ } # !$opt_dry_run
+
+ pic_flag_for_symtable=
+ case "$compile_command " in
+ *" -static "*) ;;
+ *)
+ 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*)
+ pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
+ *-*-hpux*)
+ pic_flag_for_symtable=" $pic_flag" ;;
+ *)
+ if test "X$my_pic_p" != Xno; then
+ pic_flag_for_symtable=" $pic_flag"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ symtab_cflags=
+ for arg in $LTCFLAGS; do
+ case $arg in
+ -pie | -fpie | -fPIE) ;;
+ *) symtab_cflags="$symtab_cflags $arg" ;;
+ esac
+ done
+
+ # Now compile the dynamic symbol file.
+ func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
+
+ # Clean up the generated files.
+ func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
+
+ # Transform the symbol file into the correct name.
+ symfileobj="$output_objdir/${my_outputname}S.$objext"
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ if test -f "$output_objdir/$my_outputname.def"; then
+ compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+ finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+ else
+ compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+ finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+ fi
+ ;;
+ *)
+ compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+ finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+ ;;
+ esac
+ ;;
+ *)
+ func_fatal_error "unknown suffix for \`$my_dlsyms'"
+ ;;
+ 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
+}
+
+# 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 ()
+{
+ $opt_debug
+ 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 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+ win32_nmres=`eval $NM -f posix -A $1 |
+ $SED -n -e '
+ 1,100{
+ / I /{
+ s,.*,import,
+ p
+ q
+ }
+ }'`
+ case $win32_nmres in
+ import*) win32_libid_type="x86 archive import";;
+ *) win32_libid_type="x86 archive static";;
+ esac
+ 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_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+ $opt_debug
+ f_ex_an_ar_dir="$1"; shift
+ f_ex_an_ar_oldlib="$1"
+ func_show_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
+ func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
+ fi
+}
+
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+ $opt_debug
+ my_gentop="$1"; shift
+ my_oldlibs=${1+"$@"}
+ my_oldobjs=""
+ my_xlib=""
+ my_xabs=""
+ my_xdir=""
+
+ 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
+ func_basename "$my_xlib"
+ my_xlib="$func_basename_result"
+ my_xlib_u=$my_xlib
+ while :; do
+ case " $extracted_archives " in
+ *" $my_xlib_u "*)
+ func_arith $extracted_serial + 1
+ extracted_serial=$func_arith_result
+ my_xlib_u=lt$extracted_serial-$my_xlib ;;
+ *) break ;;
+ esac
+ done
+ extracted_archives="$extracted_archives $my_xlib_u"
+ my_xdir="$my_gentop/$my_xlib_u"
+
+ func_mkdir_p "$my_xdir"
+
+ case $host in
+ *-darwin*)
+ func_verbose "Extracting $my_xabs"
+ # Do not bother doing anything if just a dry run
+ $opt_dry_run || {
+ 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 | $GREP Architectures 2>/dev/null || true`
+ if test -n "$darwin_arches"; then
+ darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
+ darwin_arch=
+ func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
+ for darwin_arch in $darwin_arches ; do
+ func_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've a bunch of thin objects, gotta fatten them up :)
+ darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
+ 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
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ fi # $darwin_arches
+ } # !$opt_dry_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"
+}
+
+
+
+# func_emit_wrapper_part1 [arg=no]
+#
+# Emit the first part of a libtool wrapper script on stdout.
+# For more information, see the description associated with
+# func_emit_wrapper(), below.
+func_emit_wrapper_part1 ()
+{
+ func_emit_wrapper_part1_arg1=no
+ if test -n "$1" ; then
+ func_emit_wrapper_part1_arg1=$1
+ fi
+
+ $ECHO "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# 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'
+
+# 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+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# 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 variables:
+ generated_by_libtool_version='$macro_version'
+ 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 "\
+
+ # 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
+"
+}
+# end: func_emit_wrapper_part1
+
+# func_emit_wrapper_part2 [arg=no]
+#
+# Emit the second part of a libtool wrapper script on stdout.
+# For more information, see the description associated with
+# func_emit_wrapper(), below.
+func_emit_wrapper_part2 ()
+{
+ func_emit_wrapper_part2_arg1=no
+ if test -n "$1" ; then
+ func_emit_wrapper_part2_arg1=$1
+ fi
+
+ $ECHO "\
+
+ # Usually 'no', except on cygwin/mingw when embedded into
+ # the cwrapper.
+ WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
+ if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
+ # special case for '.'
+ if test \"\$thisdir\" = \".\"; then
+ thisdir=\`pwd\`
+ fi
+ # remove .libs from thisdir
+ case \"\$thisdir\" in
+ *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
+ $objdir ) thisdir=. ;;
+ esac
+ fi
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ $ECHO "\
+ 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 "\
+
+ # 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 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 "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ $ECHO "\
- # libtool link mode
- link | relink)
- modename="$modename: link"
+ 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 "\
+ # 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 "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ $ECHO "\
+ 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* | *-cegcc*)
+ $ECHO "\
+ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+ ;;
+
+ *)
+ $ECHO "\
+ exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $ECHO "\
+ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+ 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\
+"
+}
+# end: func_emit_wrapper_part2
+
+
+# func_emit_wrapper [arg=no]
+#
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable. Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take. If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory. This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
+{
+ func_emit_wrapper_arg1=no
+ if test -n "$1" ; then
+ func_emit_wrapper_arg1=$1
+ fi
+
+ # split this up so that func_emit_cwrapperexe_src
+ # can call each part independently.
+ func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
+ func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
+}
+
+
+# func_to_host_path arg
+#
+# Convert paths to host format when used with build tools.
+# Intended for use with "native" mingw (where libtool itself
+# is running under the msys shell), or in the following cross-
+# build environments:
+# $build $host
+# mingw (msys) mingw [e.g. native]
+# cygwin mingw
+# *nix + wine mingw
+# where wine is equipped with the `winepath' executable.
+# In the native mingw case, the (msys) shell automatically
+# converts paths for any non-msys applications it launches,
+# but that facility isn't available from inside the cwrapper.
+# Similar accommodations are necessary for $host mingw and
+# $build cygwin. Calling this function does no harm for other
+# $host/$build combinations not listed above.
+#
+# ARG is the path (on $build) that should be converted to
+# the proper representation for $host. The result is stored
+# in $func_to_host_path_result.
+func_to_host_path ()
+{
+ func_to_host_path_result="$1"
+ if test -n "$1" ; then
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ *mingw* )
+ lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+ case $build in
+ *mingw* ) # actually, msys
+ # awkward: cmd appends spaces to result
+ lt_sed_strip_trailing_spaces="s/[ ]*\$//"
+ func_to_host_path_tmp1=`( cmd //c echo "$1" |\
+ $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
+ func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+ $SED -e "$lt_sed_naive_backslashify"`
+ ;;
+ *cygwin* )
+ func_to_host_path_tmp1=`cygpath -w "$1"`
+ func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+ $SED -e "$lt_sed_naive_backslashify"`
+ ;;
+ * )
+ # Unfortunately, winepath does not exit with a non-zero
+ # error code, so we are forced to check the contents of
+ # stdout. On the other hand, if the command is not
+ # found, the shell will set an exit code of 127 and print
+ # *an error message* to stdout. So we must check for both
+ # error code of zero AND non-empty stdout, which explains
+ # the odd construction:
+ func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
+ if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
+ func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+ $SED -e "$lt_sed_naive_backslashify"`
+ else
+ # Allow warning below.
+ func_to_host_path_result=""
+ fi
+ ;;
+ esac
+ if test -z "$func_to_host_path_result" ; then
+ func_error "Could not determine host path corresponding to"
+ func_error " '$1'"
+ func_error "Continuing, but uninstalled executables may not work."
+ # Fallback:
+ func_to_host_path_result="$1"
+ fi
+ ;;
+ esac
+ fi
+}
+# end: func_to_host_path
+
+# func_to_host_pathlist arg
+#
+# Convert pathlists to host format when used with build tools.
+# See func_to_host_path(), above. This function supports the
+# following $build/$host combinations (but does no harm for
+# combinations not listed here):
+# $build $host
+# mingw (msys) mingw [e.g. native]
+# cygwin mingw
+# *nix + wine mingw
+#
+# Path separators are also converted from $build format to
+# $host format. If ARG begins or ends with a path separator
+# character, it is preserved (but converted to $host format)
+# on output.
+#
+# ARG is a pathlist (on $build) that should be converted to
+# the proper representation on $host. The result is stored
+# in $func_to_host_pathlist_result.
+func_to_host_pathlist ()
+{
+ func_to_host_pathlist_result="$1"
+ if test -n "$1" ; then
+ case $host in
+ *mingw* )
+ lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+ # Remove leading and trailing path separator characters from
+ # ARG. msys behavior is inconsistent here, cygpath turns them
+ # into '.;' and ';.', and winepath ignores them completely.
+ func_to_host_pathlist_tmp2="$1"
+ # Once set for this call, this variable should not be
+ # reassigned. It is used in tha fallback case.
+ func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
+ $SED -e 's|^:*||' -e 's|:*$||'`
+ case $build in
+ *mingw* ) # Actually, msys.
+ # Awkward: cmd appends spaces to result.
+ lt_sed_strip_trailing_spaces="s/[ ]*\$//"
+ func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
+ $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
+ func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
+ $SED -e "$lt_sed_naive_backslashify"`
+ ;;
+ *cygwin* )
+ func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
+ func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
+ $SED -e "$lt_sed_naive_backslashify"`
+ ;;
+ * )
+ # unfortunately, winepath doesn't convert pathlists
+ func_to_host_pathlist_result=""
+ func_to_host_pathlist_oldIFS=$IFS
+ IFS=:
+ for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
+ IFS=$func_to_host_pathlist_oldIFS
+ if test -n "$func_to_host_pathlist_f" ; then
+ func_to_host_path "$func_to_host_pathlist_f"
+ if test -n "$func_to_host_path_result" ; then
+ if test -z "$func_to_host_pathlist_result" ; then
+ func_to_host_pathlist_result="$func_to_host_path_result"
+ else
+ func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
+ fi
+ fi
+ fi
+ IFS=:
+ done
+ IFS=$func_to_host_pathlist_oldIFS
+ ;;
+ esac
+ if test -z "$func_to_host_pathlist_result" ; then
+ func_error "Could not determine the host path(s) corresponding to"
+ func_error " '$1'"
+ func_error "Continuing, but uninstalled executables may not work."
+ # Fallback. This may break if $1 contains DOS-style drive
+ # specifications. The fix is not to complicate the expression
+ # below, but for the user to provide a working wine installation
+ # with winepath so that path translation in the cross-to-mingw
+ # case works properly.
+ lt_replace_pathsep_nix_to_dos="s|:|;|g"
+ func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
+ $SED -e "$lt_replace_pathsep_nix_to_dos"`
+ fi
+ # Now, add the leading and trailing path separators back
+ case "$1" in
+ :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
+ ;;
+ esac
+ case "$1" in
+ *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+}
+# end: func_to_host_pathlist
+
+# func_emit_cwrapperexe_src
+# emit the source code for a wrapper executable on stdout
+# Must ONLY be called from within func_mode_link because
+# it depends on a number of variable set therein.
+func_emit_cwrapperexe_src ()
+{
+ cat <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+ Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+
+ The $output program cannot be directly executed until all the libtool
+ libraries that it depends on are installed.
+
+ This wrapper executable should never be moved out of the build directory.
+ If it is, it will not operate correctly.
+
+ Currently, it simply execs the wrapper *script* "$SHELL $output",
+ but could eventually absorb all of the scripts functionality and
+ exec $objdir/$outputname directly.
+*/
+EOF
+ cat <<"EOF"
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef _MSC_VER
+# include <direct.h>
+# include <process.h>
+# include <io.h>
+# define setmode _setmode
+#else
+# include <unistd.h>
+# include <stdint.h>
+# ifdef __CYGWIN__
+# include <io.h>
+# define HAVE_SETENV
+# ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+# endif
+# endif
+#endif
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef S_IXOTH
+# define S_IXOTH 0
+#endif
+#ifndef S_IXGRP
+# define S_IXGRP 0
+#endif
+
+#ifdef _MSC_VER
+# define S_IXUSR _S_IEXEC
+# define stat _stat
+# ifndef _INTPTR_T_DEFINED
+# define intptr_t int
+# endif
+#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
+# define FOPEN_WB "wb"
+# 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 */
+
+#ifdef __CYGWIN__
+# define FOPEN_WB "wb"
+#endif
+
+#ifndef FOPEN_WB
+# define FOPEN_WB "w"
+#endif
+#ifndef _O_BINARY
+# define _O_BINARY 0
+#endif
+
+#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+ if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+#undef LTWRAPPER_DEBUGPRINTF
+#if defined DEBUGWRAPPER
+# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
+static void
+ltwrapper_debugprintf (const char *fmt, ...)
+{
+ va_list args;
+ va_start (args, fmt);
+ (void) vfprintf (stderr, fmt, args);
+ va_end (args);
+}
+#else
+# define LTWRAPPER_DEBUGPRINTF(args)
+#endif
+
+const char *program_name = NULL;
+
+void *xmalloc (size_t num);
+char *xstrdup (const char *string);
+const char *base_name (const char *name);
+char *find_executable (const char *wrapper);
+char *chase_symlinks (const char *pathspec);
+int make_executable (const char *path);
+int check_executable (const char *path);
+char *strendzap (char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+void lt_setenv (const char *name, const char *value);
+char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_opt_process_env_set (const char *arg);
+void lt_opt_process_env_prepend (const char *arg);
+void lt_opt_process_env_append (const char *arg);
+int lt_split_name_value (const char *arg, char** name, char** value);
+void lt_update_exe_path (const char *name, const char *value);
+void lt_update_lib_path (const char *name, const char *value);
+
+static const char *script_text_part1 =
+EOF
+
+ func_emit_wrapper_part1 yes |
+ $SED -e 's/\([\\"]\)/\\\1/g' \
+ -e 's/^/ "/' -e 's/$/\\n"/'
+ echo ";"
+ cat <<EOF
+
+static const char *script_text_part2 =
+EOF
+ func_emit_wrapper_part2 yes |
+ $SED -e 's/\([\\"]\)/\\\1/g' \
+ -e 's/^/ "/' -e 's/$/\\n"/'
+ echo ";"
+
+ cat <<EOF
+const char * MAGIC_EXE = "$magic_exe";
+const char * LIB_PATH_VARNAME = "$shlibpath_var";
+EOF
+
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ func_to_host_pathlist "$temp_rpath"
+ cat <<EOF
+const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
+EOF
+ else
+ cat <<"EOF"
+const char * LIB_PATH_VALUE = "";
+EOF
+ fi
+
+ if test -n "$dllsearchpath"; then
+ func_to_host_pathlist "$dllsearchpath:"
+ cat <<EOF
+const char * EXE_PATH_VARNAME = "PATH";
+const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
+EOF
+ else
+ cat <<"EOF"
+const char * EXE_PATH_VARNAME = "";
+const char * EXE_PATH_VALUE = "";
+EOF
+ fi
+
+ if test "$fast_install" = yes; then
+ cat <<EOF
+const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
+EOF
+ else
+ cat <<EOF
+const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
+EOF
+ fi
+
+
+ cat <<"EOF"
+
+#define LTWRAPPER_OPTION_PREFIX "--lt-"
+#define LTWRAPPER_OPTION_PREFIX_LENGTH 5
+
+static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
+static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+
+static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
+
+static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
+static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set";
+ /* argument is putenv-style "foo=bar", value of foo is set to bar */
+
+static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
+static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend";
+ /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
+
+static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
+static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append";
+ /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
+
+int
+main (int argc, char *argv[])
+{
+ char **newargz;
+ int newargc;
+ char *tmp_pathspec;
+ char *actual_cwrapper_path;
+ char *actual_cwrapper_name;
+ char *target_name;
+ char *lt_argv_zero;
+ intptr_t rval = 127;
+
+ int i;
+
+ program_name = (char *) xstrdup (base_name (argv[0]));
+ LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
+ LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
+
+ /* very simple arg parsing; don't want to rely on getopt */
+ for (i = 1; i < argc; i++)
+ {
+ if (strcmp (argv[i], dumpscript_opt) == 0)
+ {
+EOF
+ case "$host" in
+ *mingw* | *cygwin* )
+ # make stdout use "unix" line endings
+ echo " setmode(1,_O_BINARY);"
+ ;;
+ esac
+
+ cat <<"EOF"
+ printf ("%s", script_text_part1);
+ printf ("%s", script_text_part2);
+ return 0;
+ }
+ }
+
+ newargz = XMALLOC (char *, argc + 1);
+ tmp_pathspec = find_executable (argv[0]);
+ if (tmp_pathspec == NULL)
+ lt_fatal ("Couldn't find %s", argv[0]);
+ LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
+ tmp_pathspec));
+
+ actual_cwrapper_path = chase_symlinks (tmp_pathspec);
+ LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
+ actual_cwrapper_path));
+ XFREE (tmp_pathspec);
+
+ actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
+ strendzap (actual_cwrapper_path, actual_cwrapper_name);
+
+ /* wrapper name transforms */
+ strendzap (actual_cwrapper_name, ".exe");
+ tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
+ XFREE (actual_cwrapper_name);
+ actual_cwrapper_name = tmp_pathspec;
+ tmp_pathspec = 0;
+
+ /* target_name transforms -- use actual target program name; might have lt- prefix */
+ target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
+ strendzap (target_name, ".exe");
+ tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
+ XFREE (target_name);
+ target_name = tmp_pathspec;
+ tmp_pathspec = 0;
+
+ LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
+ target_name));
+EOF
+
+ cat <<EOF
+ newargz[0] =
+ XMALLOC (char, (strlen (actual_cwrapper_path) +
+ strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
+ strcpy (newargz[0], actual_cwrapper_path);
+ strcat (newargz[0], "$objdir");
+ strcat (newargz[0], "/");
+EOF
+
+ cat <<"EOF"
+ /* stop here, and copy so we don't have to do this twice */
+ tmp_pathspec = xstrdup (newargz[0]);
+
+ /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
+ strcat (newargz[0], actual_cwrapper_name);
+
+ /* DO want the lt- prefix here if it exists, so use target_name */
+ lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
+ XFREE (tmp_pathspec);
+ tmp_pathspec = NULL;
+EOF
+
+ case $host_os in
+ mingw*)
+ cat <<"EOF"
+ {
+ char* p;
+ while ((p = strchr (newargz[0], '\\')) != NULL)
+ {
+ *p = '/';
+ }
+ while ((p = strchr (lt_argv_zero, '\\')) != NULL)
+ {
+ *p = '/';
+ }
+ }
+EOF
+ ;;
+ esac
+
+ cat <<"EOF"
+ XFREE (target_name);
+ XFREE (actual_cwrapper_path);
+ XFREE (actual_cwrapper_name);
+
+ lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
+ lt_setenv ("DUALCASE", "1"); /* for MSK sh */
+ lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+ lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
+
+ newargc=0;
+ for (i = 1; i < argc; i++)
+ {
+ if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
+ {
+ if (argv[i][env_set_opt_len] == '=')
+ {
+ const char *p = argv[i] + env_set_opt_len + 1;
+ lt_opt_process_env_set (p);
+ }
+ else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
+ {
+ lt_opt_process_env_set (argv[++i]); /* don't copy */
+ }
+ else
+ lt_fatal ("%s missing required argument", env_set_opt);
+ continue;
+ }
+ if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
+ {
+ if (argv[i][env_prepend_opt_len] == '=')
+ {
+ const char *p = argv[i] + env_prepend_opt_len + 1;
+ lt_opt_process_env_prepend (p);
+ }
+ else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
+ {
+ lt_opt_process_env_prepend (argv[++i]); /* don't copy */
+ }
+ else
+ lt_fatal ("%s missing required argument", env_prepend_opt);
+ continue;
+ }
+ if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
+ {
+ if (argv[i][env_append_opt_len] == '=')
+ {
+ const char *p = argv[i] + env_append_opt_len + 1;
+ lt_opt_process_env_append (p);
+ }
+ else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
+ {
+ lt_opt_process_env_append (argv[++i]); /* don't copy */
+ }
+ else
+ lt_fatal ("%s missing required argument", env_append_opt);
+ continue;
+ }
+ if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
+ {
+ /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+ namespace, but it is not one of the ones we know about and
+ have already dealt with, above (inluding dump-script), then
+ report an error. Otherwise, targets might begin to believe
+ they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+ namespace. The first time any user complains about this, we'll
+ need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+ or a configure.ac-settable value.
+ */
+ lt_fatal ("Unrecognized option in %s namespace: '%s'",
+ ltwrapper_option_prefix, argv[i]);
+ }
+ /* otherwise ... */
+ newargz[++newargc] = xstrdup (argv[i]);
+ }
+ newargz[++newargc] = NULL;
+
+ LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
+ for (i = 0; i < newargc; i++)
+ {
+ LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
+ }
+
+EOF
+
+ case $host_os in
+ mingw*)
+ cat <<"EOF"
+ /* execv doesn't actually work on mingw as expected on unix */
+ rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
+ if (rval == -1)
+ {
+ /* failed to start process */
+ LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
+ return 127;
+ }
+ return rval;
+EOF
+ ;;
+ *)
+ cat <<"EOF"
+ execv (lt_argv_zero, newargz);
+ return rval; /* =127, but avoids unused variable warning */
+EOF
+ ;;
+ esac
+
+ cat <<"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;
+}
+
+const char *
+base_name (const char *name)
+{
+ const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ /* Skip over the disk name in MSDOS pathnames. */
+ if (isalpha ((unsigned char) name[0]) && name[1] == ':')
+ name += 2;
+#endif
+
+ for (base = name; *name; name++)
+ if (IS_DIR_SEPARATOR (*name))
+ base = name + 1;
+ return base;
+}
+
+int
+check_executable (const char *path)
+{
+ struct stat st;
+
+ LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
+ path ? (*path ? path : "EMPTY!") : "NULL!"));
+ if ((!path) || (!*path))
+ return 0;
+
+ if ((stat (path, &st) >= 0)
+ && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
+ return 1;
+ else
+ return 0;
+}
+
+int
+make_executable (const char *path)
+{
+ int rval = 0;
+ struct stat st;
+
+ LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
+ path ? (*path ? path : "EMPTY!") : "NULL!"));
+ if ((!path) || (!*path))
+ return 0;
+
+ if (stat (path, &st) >= 0)
+ {
+ rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
+ }
+ return rval;
+}
+
+/* Searches for the full path of the wrapper. Returns
+ newly allocated full path name if found, NULL otherwise
+ Does not chase symlinks, even on platforms that support them.
+*/
+char *
+find_executable (const char *wrapper)
+{
+ int has_slash = 0;
+ const char *p;
+ const char *p_next;
+ /* static buffer for getcwd */
+ char tmp[LT_PATHMAX + 1];
+ int tmp_len;
+ char *concat_name;
+
+ LTWRAPPER_DEBUGPRINTF (("(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 ((unsigned char) 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 *
+chase_symlinks (const char *pathspec)
+{
+#ifndef S_ISLNK
+ return xstrdup (pathspec);
+#else
+ char buf[LT_PATHMAX];
+ struct stat s;
+ char *tmp_pathspec = xstrdup (pathspec);
+ char *p;
+ int has_symlinks = 0;
+ while (strlen (tmp_pathspec) && !has_symlinks)
+ {
+ LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
+ tmp_pathspec));
+ if (lstat (tmp_pathspec, &s) == 0)
+ {
+ if (S_ISLNK (s.st_mode) != 0)
+ {
+ has_symlinks = 1;
+ break;
+ }
+
+ /* search backwards for last DIR_SEPARATOR */
+ p = tmp_pathspec + strlen (tmp_pathspec) - 1;
+ while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+ p--;
+ if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+ {
+ /* no more DIR_SEPARATORS left */
+ break;
+ }
+ *p = '\0';
+ }
+ else
+ {
+ char *errstr = strerror (errno);
+ lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
+ }
+ }
+ XFREE (tmp_pathspec);
+
+ if (!has_symlinks)
+ {
+ return xstrdup (pathspec);
+ }
+
+ tmp_pathspec = realpath (pathspec, buf);
+ if (tmp_pathspec == 0)
+ {
+ lt_fatal ("Could not follow symlinks for %s", pathspec);
+ }
+ return xstrdup (tmp_pathspec);
+#endif
+}
+
+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);
+}
+
+void
+lt_setenv (const char *name, const char *value)
+{
+ LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
+ (name ? name : "<NULL>"),
+ (value ? value : "<NULL>")));
+ {
+#ifdef HAVE_SETENV
+ /* always make a copy, for consistency with !HAVE_SETENV */
+ char *str = xstrdup (value);
+ setenv (name, str, 1);
+#else
+ int len = strlen (name) + 1 + strlen (value) + 1;
+ char *str = XMALLOC (char, len);
+ sprintf (str, "%s=%s", name, value);
+ if (putenv (str) != EXIT_SUCCESS)
+ {
+ XFREE (str);
+ }
+#endif
+ }
+}
+
+char *
+lt_extend_str (const char *orig_value, const char *add, int to_end)
+{
+ char *new_value;
+ if (orig_value && *orig_value)
+ {
+ int orig_value_len = strlen (orig_value);
+ int add_len = strlen (add);
+ new_value = XMALLOC (char, add_len + orig_value_len + 1);
+ if (to_end)
+ {
+ strcpy (new_value, orig_value);
+ strcpy (new_value + orig_value_len, add);
+ }
+ else
+ {
+ strcpy (new_value, add);
+ strcpy (new_value + add_len, orig_value);
+ }
+ }
+ else
+ {
+ new_value = xstrdup (add);
+ }
+ return new_value;
+}
+
+int
+lt_split_name_value (const char *arg, char** name, char** value)
+{
+ const char *p;
+ int len;
+ if (!arg || !*arg)
+ return 1;
+
+ p = strchr (arg, (int)'=');
+
+ if (!p)
+ return 1;
+
+ *value = xstrdup (++p);
+
+ len = strlen (arg) - strlen (*value);
+ *name = XMALLOC (char, len);
+ strncpy (*name, arg, len-1);
+ (*name)[len - 1] = '\0';
+
+ return 0;
+}
+
+void
+lt_opt_process_env_set (const char *arg)
+{
+ char *name = NULL;
+ char *value = NULL;
+
+ if (lt_split_name_value (arg, &name, &value) != 0)
+ {
+ XFREE (name);
+ XFREE (value);
+ lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
+ }
+
+ lt_setenv (name, value);
+ XFREE (name);
+ XFREE (value);
+}
+
+void
+lt_opt_process_env_prepend (const char *arg)
+{
+ char *name = NULL;
+ char *value = NULL;
+ char *new_value = NULL;
+
+ if (lt_split_name_value (arg, &name, &value) != 0)
+ {
+ XFREE (name);
+ XFREE (value);
+ lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
+ }
+
+ new_value = lt_extend_str (getenv (name), value, 0);
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ XFREE (name);
+ XFREE (value);
+}
+
+void
+lt_opt_process_env_append (const char *arg)
+{
+ char *name = NULL;
+ char *value = NULL;
+ char *new_value = NULL;
+
+ if (lt_split_name_value (arg, &name, &value) != 0)
+ {
+ XFREE (name);
+ XFREE (value);
+ lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
+ }
+
+ new_value = lt_extend_str (getenv (name), value, 1);
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ XFREE (name);
+ XFREE (value);
+}
+
+void
+lt_update_exe_path (const char *name, const char *value)
+{
+ LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+ (name ? name : "<NULL>"),
+ (value ? value : "<NULL>")));
+
+ if (name && *name && value && *value)
+ {
+ char *new_value = lt_extend_str (getenv (name), value, 0);
+ /* some systems can't cope with a ':'-terminated path #' */
+ int len = strlen (new_value);
+ while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
+ {
+ new_value[len-1] = '\0';
+ }
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ }
+}
+
+void
+lt_update_lib_path (const char *name, const char *value)
+{
+ LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+ (name ? name : "<NULL>"),
+ (value ? value : "<NULL>")));
+
+ if (name && *name && value && *value)
+ {
+ char *new_value = lt_extend_str (getenv (name), value, 0);
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ }
+}
+
+
+EOF
+}
+# end: func_emit_cwrapperexe_src
+
+# func_mode_link arg...
+func_mode_link ()
+{
+ $opt_debug
+ case $host in
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
# 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
@@ -1477,10 +4538,10 @@ EOF
allow_undefined=yes
;;
esac
- libtool_args="$nonopt"
+ libtool_args=$nonopt
base_compile="$nonopt $@"
- compile_command="$nonopt"
- finalize_command="$nonopt"
+ compile_command=$nonopt
+ finalize_command=$nonopt
compile_rpath=
finalize_rpath=
@@ -1495,6 +4556,7 @@ EOF
dllsearchpath=
lib_search_path=`pwd`
inst_prefix_dir=
+ new_inherited_linker_flags=
avoid_version=no
dlfiles=
@@ -1510,7 +4572,6 @@ EOF
no_install=no
objs=
non_pic_objects=
- notinst_path= # paths that contain not-installed libtool libraries
precious_files_regex=
prefer_static_libs=no
preload=no
@@ -1524,19 +4585,25 @@ EOF
thread_safe=no
vinfo=
vinfo_number=no
+ weak_libs=
single_module="${wl}-single_module"
-
func_infer_tag $base_compile
# We need to know -static, to get the right output filenames.
for arg
do
case $arg in
+ -shared)
+ test "$build_libtool_libs" != yes && \
+ func_fatal_configuration "can not build a shared library"
+ build_old_libs=no
+ break
+ ;;
-all-static | -static | -static-libtool-libs)
case $arg in
-all-static)
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
+ func_warning "complete static linking is impossible in this configuration"
fi
if test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
@@ -1570,20 +4637,16 @@ EOF
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"
+ func_quote_for_eval "$arg"
+ qarg=$func_quote_for_eval_unquoted_result
+ func_append libtool_args " $func_quote_for_eval_result"
# 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@"
+ func_append compile_command " @OUTPUT@"
+ func_append finalize_command " @OUTPUT@"
;;
esac
@@ -1591,8 +4654,8 @@ EOF
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@"
+ func_append compile_command " @SYMFILE@"
+ func_append finalize_command " @SYMFILE@"
preload=yes
fi
case $arg in
@@ -1630,10 +4693,8 @@ EOF
;;
expsyms)
export_symbols="$arg"
- if test ! -f "$arg"; then
- $echo "$modename: symbol file \`$arg' does not exist"
- exit $EXIT_FAILURE
- fi
+ test -f "$arg" \
+ || func_fatal_error "symbol file \`$arg' does not exist"
prev=
continue
;;
@@ -1642,18 +4703,21 @@ EOF
prev=
continue
;;
- inst_prefix)
- inst_prefix_dir="$arg"
- prev=
- continue
- ;;
- precious_regex)
- precious_files_regex="$arg"
+ framework)
+ case $host in
+ *-*-darwin*)
+ case "$deplibs " in
+ *" $qarg.ltframework "*) ;;
+ *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
+ ;;
+ esac
+ ;;
+ esac
prev=
continue
;;
- release)
- release="-$arg"
+ inst_prefix)
+ inst_prefix_dir="$arg"
prev=
continue
;;
@@ -1661,39 +4725,30 @@ EOF
if test -f "$arg"; then
save_arg=$arg
moreargs=
- for fil in `cat $save_arg`
+ 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
+ if func_lalib_unsafe_p "$arg"; 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
+ func_source "$arg"
- if test -z "$pic_object" || \
+ if test -z "$pic_object" ||
test -z "$non_pic_object" ||
- test "$pic_object" = none && \
+ test "$pic_object" = none &&
test "$non_pic_object" = none; then
- $echo "$modename: cannot find name of object for \`$arg'" 1>&2
- exit $EXIT_FAILURE
+ func_fatal_error "cannot find name of object for \`$arg'"
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
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
if test "$pic_object" != none; then
# Prepend the subdirectory the object is found in.
@@ -1718,7 +4773,7 @@ EOF
fi
# A PIC object.
- libobjs="$libobjs $pic_object"
+ func_append libobjs " $pic_object"
arg="$pic_object"
fi
@@ -1728,7 +4783,7 @@ EOF
non_pic_object="$xdir$non_pic_object"
# A standard non-PIC object
- non_pic_objects="$non_pic_objects $non_pic_object"
+ func_append non_pic_objects " $non_pic_object"
if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object"
fi
@@ -1736,46 +4791,48 @@ EOF
# If the PIC object exists, use it instead.
# $xdir was prepended to $pic_object above.
non_pic_object="$pic_object"
- non_pic_objects="$non_pic_objects $non_pic_object"
+ func_append non_pic_objects " $non_pic_object"
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.
-
+ if $opt_dry_run; then
# 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"
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ func_lo2o "$arg"
+ pic_object=$xdir$objdir/$func_lo2o_result
+ non_pic_object=$xdir$func_lo2o_result
+ func_append libobjs " $pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ else
+ func_fatal_error "\`$arg' is not a valid libtool object"
fi
fi
done
else
- $echo "$modename: link input file \`$save_arg' does not exist"
- exit $EXIT_FAILURE
+ func_fatal_error "link input file \`$arg' does not exist"
fi
arg=$save_arg
prev=
continue
;;
+ precious_regex)
+ precious_files_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 $EXIT_FAILURE
+ func_fatal_error "only absolute run-paths are allowed"
;;
esac
if test "$prev" = rpath; then
@@ -1792,39 +4849,37 @@ EOF
prev=
continue
;;
- xcompiler)
- compiler_flags="$compiler_flags $qarg"
+ shrext)
+ shrext_cmds="$arg"
prev=
- compile_command="$compile_command $qarg"
- finalize_command="$finalize_command $qarg"
continue
;;
- xlinker)
- linker_flags="$linker_flags $qarg"
- compiler_flags="$compiler_flags $wl$qarg"
+ weak)
+ weak_libs="$weak_libs $arg"
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"
+ func_append compile_command " $qarg"
+ func_append finalize_command " $qarg"
continue
;;
- shrext)
- shrext_cmds="$arg"
+ xcompiler)
+ compiler_flags="$compiler_flags $qarg"
prev=
+ func_append compile_command " $qarg"
+ func_append finalize_command " $qarg"
continue
;;
- darwin_framework|darwin_framework_skip)
- test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
+ xlinker)
+ linker_flags="$linker_flags $qarg"
+ compiler_flags="$compiler_flags $wl$qarg"
prev=
+ func_append compile_command " $wl$qarg"
+ func_append finalize_command " $wl$qarg"
continue
;;
*)
@@ -1840,16 +4895,16 @@ EOF
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"
+ # See comment for -static flag below, for more details.
+ func_append compile_command " $link_static_flag"
+ func_append 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
+ func_fatal_error "\`-allow-undefined' must not be used because it is the default"
;;
-avoid-version)
@@ -1874,8 +4929,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
+ func_fatal_error "more than one -exported-symbols argument is not allowed"
fi
if test "X$arg" = "X-export-symbols"; then
prev=expsyms
@@ -1885,15 +4939,8 @@ EOF
continue
;;
- -framework|-arch|-isysroot)
- case " $CC " in
- *" ${arg} ${1} "* | *" ${arg} ${1} "*)
- prev=darwin_framework_skip ;;
- *) compiler_flags="$compiler_flags $arg"
- prev=darwin_framework ;;
- esac
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
+ -framework)
+ prev=framework
continue
;;
@@ -1907,25 +4954,30 @@ EOF
-L[A-Z][A-Z]*:*)
case $with_gcc/$host in
no/*-*-irix* | /*-*-irix*)
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
;;
esac
continue
;;
-L*)
- dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+ func_stripname '-L' '' "$arg"
+ dir=$func_stripname_result
+ if test -z "$dir"; then
+ if test "$#" -gt 0; then
+ func_fatal_error "require no space between \`-L' and \`$1'"
+ else
+ func_fatal_error "need path for \`-L' option"
+ fi
+ fi
# 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
- absdir="$dir"
- notinst_path="$notinst_path $dir"
- fi
+ test -z "$absdir" && \
+ func_fatal_error "cannot determine absolute directory name of \`$dir'"
dir="$absdir"
;;
esac
@@ -1937,14 +4989,16 @@ EOF
;;
esac
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$dir:"*) ;;
+ ::) dllsearchpath=$dir;;
*) dllsearchpath="$dllsearchpath:$dir";;
esac
case :$dllsearchpath: in
*":$testbindir:"*) ;;
+ ::) dllsearchpath=$testbindir;;
*) dllsearchpath="$dllsearchpath:$testbindir";;
esac
;;
@@ -1955,7 +5009,7 @@ EOF
-l*)
if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
# These systems don't actually have a C or math library (as such)
continue
;;
@@ -1969,7 +5023,7 @@ EOF
;;
*-*-rhapsody* | *-*-darwin1.[012])
# Rhapsody C and math libraries are in the System framework
- deplibs="$deplibs -framework System"
+ deplibs="$deplibs System.ltframework"
continue
;;
*-*-sco3.2v5* | *-*-sco5v6*)
@@ -1993,20 +5047,30 @@ EOF
continue
;;
+ -module)
+ module=yes
+ continue
+ ;;
+
# Tru64 UNIX uses -model [arg] to determine the layout of C++
# classes, name mangling, and exception handling.
- -model)
- compile_command="$compile_command $arg"
+ # Darwin uses the -arch flag to determine output architecture.
+ -model|-arch|-isysroot)
compiler_flags="$compiler_flags $arg"
- finalize_command="$finalize_command $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
prev=xcompiler
continue
;;
- -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
compiler_flags="$compiler_flags $arg"
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ case "$new_inherited_linker_flags " in
+ *" $arg "*) ;;
+ * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
+ esac
continue
;;
@@ -2015,44 +5079,6 @@ EOF
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
- # -m*, -t[45]*, -txscale* pass through architecture-specific
- # compiler args for GCC
- # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
- # -F/path gives path to uninstalled frameworks, gcc on darwin
- # @file GCC response files
- -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
- -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
-
- # 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"
- compiler_flags="$compiler_flags $arg"
- continue
- ;;
-
- -shrext)
- prev=shrext
- continue
- ;;
-
-no-fast-install)
fast_install=no
continue
@@ -2060,11 +5086,11 @@ EOF
-no-install)
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
# The PATH hackery in wrapper scripts is required on Windows
# and Darwin 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
+ func_warning "\`-no-install' is ignored for $host"
+ func_warning "assuming \`-no-fast-install' instead"
fast_install=no
;;
*) no_install=yes ;;
@@ -2105,13 +5131,13 @@ EOF
;;
-R*)
- dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+ func_stripname '-R' '' "$arg"
+ dir=$func_stripname_result
# We need an absolute path.
case $dir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
- $echo "$modename: only absolute run-paths are allowed" 1>&2
- exit $EXIT_FAILURE
+ func_fatal_error "only absolute run-paths are allowed"
;;
esac
case "$xrpath " in
@@ -2121,6 +5147,16 @@ EOF
continue
;;
+ -shared)
+ # The effects of -shared are defined in a previous loop.
+ continue
+ ;;
+
+ -shrext)
+ prev=shrext
+ continue
+ ;;
+
-static | -static-libtool-libs)
# The effects of -static are defined in a previous loop.
# We used to do the same as -all-static on platforms that
@@ -2139,47 +5175,49 @@ EOF
prev=vinfo
continue
;;
+
-version-number)
prev=vinfo
vinfo_number=yes
continue
;;
+ -weak)
+ prev=weak
+ continue
+ ;;
+
-Wc,*)
- args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+ func_stripname '-Wc,' '' "$arg"
+ args=$func_stripname_result
arg=
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"
+ func_quote_for_eval "$flag"
+ arg="$arg $wl$func_quote_for_eval_result"
+ compiler_flags="$compiler_flags $func_quote_for_eval_result"
done
IFS="$save_ifs"
- arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ func_stripname ' ' '' "$arg"
+ arg=$func_stripname_result
;;
-Wl,*)
- args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+ func_stripname '-Wl,' '' "$arg"
+ args=$func_stripname_result
arg=
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"
+ func_quote_for_eval "$flag"
+ arg="$arg $wl$func_quote_for_eval_result"
+ compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
+ linker_flags="$linker_flags $func_quote_for_eval_result"
done
IFS="$save_ifs"
- arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ func_stripname ' ' '' "$arg"
+ arg=$func_stripname_result
;;
-Xcompiler)
@@ -2197,16 +5235,36 @@ EOF
continue
;;
+ # -msg_* for osf cc
+ -msg_*)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ ;;
+
+ # -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*, -t[45]*, -txscale* pass through architecture-specific
+ # compiler args for GCC
+ # -F/path gives path to uninstalled frameworks, gcc on darwin
+ # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
+ # @file GCC response files
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ compiler_flags="$compiler_flags $arg"
+ 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
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
;;
*.$objext)
@@ -2218,32 +5276,23 @@ EOF
# 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
+ if func_lalib_unsafe_p "$arg"; 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
+ func_source "$arg"
- if test -z "$pic_object" || \
+ if test -z "$pic_object" ||
test -z "$non_pic_object" ||
- test "$pic_object" = none && \
+ test "$pic_object" = none &&
test "$non_pic_object" = none; then
- $echo "$modename: cannot find name of object for \`$arg'" 1>&2
- exit $EXIT_FAILURE
+ func_fatal_error "cannot find name of object for \`$arg'"
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
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
if test "$pic_object" != none; then
# Prepend the subdirectory the object is found in.
@@ -2268,7 +5317,7 @@ EOF
fi
# A PIC object.
- libobjs="$libobjs $pic_object"
+ func_append libobjs " $pic_object"
arg="$pic_object"
fi
@@ -2278,7 +5327,7 @@ EOF
non_pic_object="$xdir$non_pic_object"
# A standard non-PIC object
- non_pic_objects="$non_pic_objects $non_pic_object"
+ func_append non_pic_objects " $non_pic_object"
if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object"
fi
@@ -2286,28 +5335,22 @@ EOF
# If the PIC object exists, use it instead.
# $xdir was prepended to $pic_object above.
non_pic_object="$pic_object"
- non_pic_objects="$non_pic_objects $non_pic_object"
+ func_append non_pic_objects " $non_pic_object"
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.
-
+ if $opt_dry_run; then
# 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"
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ func_lo2o "$arg"
+ pic_object=$xdir$objdir/$func_lo2o_result
+ non_pic_object=$xdir$func_lo2o_result
+ func_append libobjs " $pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ else
+ func_fatal_error "\`$arg' is not a valid libtool object"
fi
fi
;;
@@ -2340,70 +5383,51 @@ EOF
*)
# 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
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
;;
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"
+ func_append compile_command " $arg"
+ func_append 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
+ test -n "$prev" && \
+ func_fatal_help "the \`$prevarg' option requires an argument"
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"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
fi
oldlibs=
# calculate the name of the file, without its directory
- outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+ func_basename "$output"
+ outputname="$func_basename_result"
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\'\`
+ 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
+ func_dirname "$output" "/" ""
+ output_objdir="$func_dirname_result$objdir"
# Create the object directory.
- if test ! -d "$output_objdir"; then
- $show "$mkdir $output_objdir"
- $run $mkdir $output_objdir
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
- exit $exit_status
- fi
- fi
+ func_mkdir_p "$output_objdir"
# 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
+ func_fatal_help "you must specify an output file"
;;
*.$libext) linkmode=oldlib ;;
*.lo | *.$objext) linkmode=obj ;;
@@ -2411,22 +5435,13 @@ 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)
for deplib in $deplibs; do
- if test "X$duplicate_deps" = "Xyes" ; then
+ if $opt_duplicate_deps ; then
case "$libs " in
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
esac
@@ -2441,7 +5456,7 @@ EOF
# $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
+ if $opt_duplicate_compiler_generated_deps; then
for pre_post_dep in $predeps $postdeps; do
case "$pre_post_deps " in
*" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
@@ -2457,15 +5472,16 @@ EOF
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"
+ passes="conv dlpreopen 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
+ func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
;;
esac
done
@@ -2481,7 +5497,20 @@ EOF
*) passes="conv"
;;
esac
+
for pass in $passes; do
+ # The preopen pass in lib mode reverses $deplibs; put it back here
+ # so that -L comes before libs that need it for instance...
+ if test "$linkmode,$pass" = "lib,link"; then
+ ## FIXME: Find the place where the list is rebuilt in the wrong
+ ## order, and fix it there properly
+ tmp_deplibs=
+ for deplib in $deplibs; do
+ tmp_deplibs="$deplib $tmp_deplibs"
+ done
+ deplibs="$tmp_deplibs"
+ fi
+
if test "$linkmode,$pass" = "lib,link" ||
test "$linkmode,$pass" = "prog,scan"; then
libs="$deplibs"
@@ -2491,14 +5520,39 @@ EOF
case $pass in
dlopen) libs="$dlfiles" ;;
dlpreopen) libs="$dlprefiles" ;;
- link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+ link)
+ libs="$deplibs %DEPLIBS%"
+ test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
+ ;;
esac
fi
+ if test "$linkmode,$pass" = "lib,dlpreopen"; then
+ # Collect and forward deplibs of preopened libtool libs
+ for lib in $dlprefiles; do
+ # Ignore non-libtool-libs
+ dependency_libs=
+ case $lib in
+ *.la) func_source "$lib" ;;
+ esac
+
+ # Collect preopened libtool deplibs, except any this library
+ # has declared as weak libs
+ for deplib in $dependency_libs; do
+ deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
+ case " $weak_libs " in
+ *" $deplib_base "*) ;;
+ *) deplibs="$deplibs $deplib" ;;
+ esac
+ done
+ done
+ libs="$dlprefiles"
+ fi
if test "$pass" = dlopen; then
# Collect dlpreopened libraries
save_deplibs="$deplibs"
deplibs=
fi
+
for deplib in $libs; do
lib=
found=no
@@ -2509,15 +5563,22 @@ EOF
finalize_deplibs="$deplib $finalize_deplibs"
else
compiler_flags="$compiler_flags $deplib"
+ if test "$linkmode" = lib ; then
+ case "$new_inherited_linker_flags " in
+ *" $deplib "*) ;;
+ * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
+ esac
+ fi
fi
continue
;;
-l*)
if test "$linkmode" != lib && test "$linkmode" != prog; then
- $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
+ func_warning "\`-l' is ignored for archives/objects"
continue
fi
- name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+ func_stripname '-l' '' "$deplib"
+ name=$func_stripname_result
if test "$linkmode" = lib; then
searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
else
@@ -2553,21 +5614,17 @@ EOF
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
+ if func_lalib_p "$lib"; then
library_names=
old_library=
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
+ func_source "$lib"
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="."
+ func_dirname "$lib" "" "."
+ ladir="$func_dirname_result"
lib=$ladir/$old_library
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
@@ -2579,19 +5636,35 @@ EOF
continue
fi
fi
- ;;
+ ;;
*) ;;
esac
fi
fi
;; # -l
+ *.ltframework)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ if test "$linkmode" = lib ; then
+ case "$new_inherited_linker_flags " in
+ *" $deplib "*) ;;
+ * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
+ esac
+ fi
+ fi
+ continue
+ ;;
-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//'`
+ func_stripname '-L' '' "$deplib"
+ newlib_search_path="$newlib_search_path $func_stripname_result"
;;
prog)
if test "$pass" = conv; then
@@ -2604,17 +5677,19 @@ EOF
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
fi
- newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ func_stripname '-L' '' "$deplib"
+ newlib_search_path="$newlib_search_path $func_stripname_result"
;;
*)
- $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
+ func_warning "\`-L' is ignored for archives/objects"
;;
esac # linkmode
continue
;; # -L
-R*)
if test "$pass" = link; then
- dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+ func_stripname '-R' '' "$deplib"
+ dir=$func_stripname_result
# Make sure the xrpath contains only unique directories.
case "$xrpath " in
*" $dir "*) ;;
@@ -2632,35 +5707,41 @@ EOF
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 \
+ # Linking convenience modules into shared libraries is allowed,
+ # but linking other static libraries is non-portable.
+ case " $dlpreconveniencelibs " in
+ *" $deplib "*) ;;
+ *)
+ valid_a_lib=no
+ case $deplibs_check_method in
+ match_pattern*)
+ set dummy $deplibs_check_method; shift
+ match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+ if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
| $EGREP "$match_pattern_regex" > /dev/null; then
- valid_a_lib=yes
- fi
+ valid_a_lib=yes
+ fi
;;
- pass_all)
- valid_a_lib=yes
+ 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
+ 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 use here."
+ else
+ $ECHO
+ $ECHO "*** Warning: Linking the shared library $output against the"
+ $ECHO "*** static library $deplib is not portable!"
+ deplibs="$deplib $deplibs"
+ fi
+ ;;
+ esac
continue
;;
prog)
@@ -2695,21 +5776,18 @@ EOF
continue
;;
esac # case $deplib
+
if test "$found" = yes || test -f "$lib"; then :
else
- $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
- exit $EXIT_FAILURE
+ func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
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
+ func_lalib_unsafe_p "$lib" \
+ || func_fatal_error "\`$lib' is not a valid libtool archive"
- ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
- test "X$ladir" = "X$lib" && ladir="."
+ func_dirname "$lib" "" "."
+ ladir="$func_dirname_result"
dlname=
dlopen=
@@ -2717,6 +5795,7 @@ EOF
libdir=
library_names=
old_library=
+ inherited_linker_flags=
# If the library was installed with an old release of libtool,
# it will not redefine variables installed, or shouldnotlink
installed=yes
@@ -2725,11 +5804,19 @@ EOF
# Read the .la file
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
-
+ func_source "$lib"
+
+ # Convert "-framework foo" to "foo.ltframework"
+ if test -n "$inherited_linker_flags"; then
+ tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
+ for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
+ case " $new_inherited_linker_flags " in
+ *" $tmp_inherited_linker_flag "*) ;;
+ *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
+ esac
+ done
+ fi
+ dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
if test "$linkmode,$pass" = "lib,link" ||
test "$linkmode,$pass" = "prog,scan" ||
{ test "$linkmode" != prog && test "$linkmode" != lib; }; then
@@ -2742,8 +5829,7 @@ EOF
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
+ func_fatal_error "cannot find name of link library for \`$lib'"
fi
# It is a libtool convenience library, so add in its objects.
convenience="$convenience $ladir/$objdir/$old_library"
@@ -2751,16 +5837,15 @@ EOF
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
+ if $opt_duplicate_deps ; 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
+ func_fatal_error "\`$lib' is not a convenience library"
fi
continue
fi # $pass = conv
@@ -2772,15 +5857,13 @@ EOF
linklib="$l"
done
if test -z "$linklib"; then
- $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
- exit $EXIT_FAILURE
+ func_fatal_error "cannot find name of link library for \`$lib'"
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
+ func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
fi
if test -z "$dlname" ||
test "$dlopen_support" != yes ||
@@ -2802,18 +5885,19 @@ EOF
*)
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
+ func_warning "cannot determine absolute directory name of \`$ladir'"
+ func_warning "passing it literally to the linker, although it might fail"
abs_ladir="$ladir"
fi
;;
esac
- laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+ func_basename "$lib"
+ laname="$func_basename_result"
# 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
+ func_warning "library \`$lib' was moved."
dir="$ladir"
absdir="$abs_ladir"
libdir="$abs_ladir"
@@ -2835,18 +5919,22 @@ EOF
notinst_path="$notinst_path $abs_ladir"
fi
fi # $installed = yes
- name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+ func_stripname 'lib' '.la' "$laname"
+ name=$func_stripname_result
# 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
+ if test -z "$libdir" && test "$linkmode" = prog; then
+ func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
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"
+ # Keep a list of preopened convenience libraries to check
+ # that they are being used correctly in the link pass.
+ test -z "$libdir" && \
+ dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
# Otherwise, use the dlname, so that lt_dlopen finds it.
elif test -n "$dlname"; then
newdlprefiles="$newdlprefiles $dir/$dlname"
@@ -2882,7 +5970,9 @@ EOF
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
+ -L*) func_stripname '-L' '' "$deplib"
+ newlib_search_path="$newlib_search_path $func_stripname_result"
+ ;;
esac
# Need to link against all dependency_libs?
if test "$linkalldeplibs" = yes; then
@@ -2892,7 +5982,7 @@ EOF
# or/and link against static libraries
newdependency_libs="$deplib $newdependency_libs"
fi
- if test "X$duplicate_deps" = "Xyes" ; then
+ if $opt_duplicate_deps ; then
case "$tmp_libs " in
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
esac
@@ -2905,15 +5995,14 @@ EOF
if test "$linkmode,$pass" = "prog,link"; then
if test -n "$library_names" &&
{ { test "$prefer_static_libs" = no ||
- test "$prefer_static_libs,$installed" = "built,yes"; } ||
+ test "$prefer_static_libs,$installed" = "built,yes"; } ||
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 $absdir" ;;
+ case "$temp_rpath:" in
+ *"$absdir:"*) ;;
+ *) temp_rpath="$temp_rpath$absdir:" ;;
esac
fi
@@ -2951,27 +6040,43 @@ EOF
link_static=no # Whether the deplib will be linked statically
use_static_libs=$prefer_static_libs
- if test "$use_static_libs" = built && test "$installed" = yes ; then
+ if test "$use_static_libs" = built && test "$installed" = yes; then
use_static_libs=no
fi
if test -n "$library_names" &&
{ test "$use_static_libs" = no || test -z "$old_library"; }; then
- if test "$installed" = no; then
- notinst_deplibs="$notinst_deplibs $lib"
- need_relink=yes
- fi
+ case $host in
+ *cygwin* | *mingw* | *cegcc*)
+ # No point in relinking DLLs because paths are not encoded
+ notinst_deplibs="$notinst_deplibs $lib"
+ need_relink=no
+ ;;
+ *)
+ if test "$installed" = no; then
+ notinst_deplibs="$notinst_deplibs $lib"
+ need_relink=yes
+ fi
+ ;;
+ esac
# 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
+ # Warn about portability, can't link against -module's on some
+ # systems (darwin). Don't bleat about dlopened modules though!
+ dlopenmodule=""
+ for dlpremoduletest in $dlprefiles; do
+ if test "X$dlpremoduletest" = "X$lib"; then
+ dlopenmodule="$dlpremoduletest"
+ break
+ fi
+ done
+ if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
+ $ECHO
if test "$linkmode" = prog; then
- $echo "*** Warning: Linking the executable $output against the loadable module"
+ $ECHO "*** Warning: Linking the executable $output against the loadable module"
else
- $echo "*** Warning: Linking the shared library $output against the loadable module"
+ $ECHO "*** Warning: Linking the shared library $output against the loadable module"
fi
- $echo "*** $linklib is not portable!"
+ $ECHO "*** $linklib is not portable!"
fi
if test "$linkmode" = lib &&
test "$hardcode_into_libs" = yes; then
@@ -3001,17 +6106,19 @@ EOF
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\"`
+ shift
+ realname="$1"
+ 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`
+ *cygwin* | mingw* | *cegcc*)
+ func_arith $current - $age
+ major=$func_arith_result
versuffix="-$major"
;;
esac
@@ -3022,36 +6129,22 @@ 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"
+ func_basename "$soroot"
+ soname="$func_basename_result"
+ func_stripname 'lib' '.dll' "$soname"
+ newlib=libimp-$func_stripname_result.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"
+ func_verbose "extracting exported symbol list from \`$soname'"
+ func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
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"
+ func_verbose "generating import library for \`$soname'"
+ func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
fi
# make sure the library variables are pointing to the new library
dir=$output_objdir
@@ -3073,17 +6166,21 @@ EOF
*-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
*-*-unixware7*) 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 the lib is a (non-dlopened) module then we can not
+ # link against it, someone is ignoring the earlier warnings
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"
+ $GREP ": [^:]* bundle" >/dev/null ; then
+ if test "X$dlopenmodule" != "X$lib"; 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
+ elif test -n "$old_library"; then
+ add="$dir/$old_library"
fi
fi
esac
@@ -3101,7 +6198,8 @@ EOF
fi
;;
relink)
- if test "$hardcode_direct" = yes; then
+ if test "$hardcode_direct" = yes &&
+ test "$hardcode_direct_absolute" = no; then
add="$dir/$linklib"
elif test "$hardcode_minus_L" = yes; then
add_dir="-L$dir"
@@ -3125,8 +6223,7 @@ EOF
esac
if test "$lib_linked" != yes; then
- $echo "$modename: configuration error: unsupported hardcode properties"
- exit $EXIT_FAILURE
+ func_fatal_configuration "unsupported hardcode properties"
fi
if test -n "$add_shlibpath"; then
@@ -3141,8 +6238,8 @@ EOF
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 && \
+ if test "$hardcode_direct" != yes &&
+ test "$hardcode_minus_L" != yes &&
test "$hardcode_shlibpath_var" = yes; then
case :$finalize_shlibpath: in
*":$libdir:"*) ;;
@@ -3157,7 +6254,8 @@ EOF
add_dir=
add=
# Finalize command for both is simple: just hardcode it.
- if test "$hardcode_direct" = yes; then
+ if test "$hardcode_direct" = yes &&
+ test "$hardcode_direct_absolute" = no; then
add="$libdir/$linklib"
elif test "$hardcode_minus_L" = yes; then
add_dir="-L$libdir"
@@ -3171,9 +6269,9 @@ EOF
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"
+ add="$inst_prefix_dir$libdir/$linklib"
else
- add="$libdir/$linklib"
+ add="$libdir/$linklib"
fi
else
# We cannot seem to hardcode it, guess we'll fake it.
@@ -3217,21 +6315,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
@@ -3255,7 +6353,8 @@ EOF
temp_deplibs=
for libdir in $dependency_libs; do
case $libdir in
- -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+ -R*) func_stripname '-R' '' "$libdir"
+ temp_xrpath=$func_stripname_result
case " $xrpath " in
*" $temp_xrpath "*) ;;
*) xrpath="$xrpath $temp_xrpath";;
@@ -3273,7 +6372,7 @@ EOF
tmp_libs=
for deplib in $dependency_libs; do
newdependency_libs="$deplib $newdependency_libs"
- if test "X$duplicate_deps" = "Xyes" ; then
+ if $opt_duplicate_deps ; then
case "$tmp_libs " in
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
esac
@@ -3284,97 +6383,75 @@ EOF
if test "$link_all_deplibs" != no; then
# Add the search paths of all dependency libraries
for deplib in $dependency_libs; do
+ path=
case $deplib in
-L*) path="$deplib" ;;
*.la)
- dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$deplib" && dir="."
+ func_dirname "$deplib" "" "."
+ dir="$func_dirname_result"
# 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
+ func_warning "cannot determine absolute directory name of \`$dir'"
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=
+ if $GREP "^installed=no" $deplib > /dev/null; then
case $host in
*-*-darwin*)
- # we do not want to link against static libs,
- # but need to link against shared
+ depdepl=
eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
- eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
if test -n "$deplibrary_names" ; then
for tmp in $deplibrary_names ; do
depdepl=$tmp
done
- if test -f "$deplibdir/$depdepl" ; then
- depdepl="$deplibdir/$depdepl"
- elif test -f "$path/$depdepl" ; then
- depdepl="$path/$depdepl"
- else
- # Can't find it, oh well...
- depdepl=
+ if test -f "$absdir/$objdir/$depdepl" ; then
+ depdepl="$absdir/$objdir/$depdepl"
+ darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+ if test -z "$darwin_install_name"; then
+ darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+ fi
+ compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+ linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
+ path=
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=""
+ path="-L$absdir/$objdir"
;;
- *) continue ;;
esac
+ else
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$deplib' is not a valid libtool archive"
+ test "$absdir" != "$libdir" && \
+ func_warning "\`$deplib' seems to be moved"
+
+ path="-L$absdir"
+ fi
;;
- *) continue ;;
esac
case " $deplibs " in
*" $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" = link; then
+ if test "$linkmode" = "prog"; then
+ compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
+ finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
+ else
+ compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+ fi
+ fi
dependency_libs="$newdependency_libs"
if test "$pass" = dlpreopen; then
# Link the dlpreopened libraries before other libraries
@@ -3473,39 +6550,36 @@ EOF
done # for pass
if test "$linkmode" = prog; then
dlfiles="$newdlfiles"
+ fi
+ if test "$linkmode" = prog || test "$linkmode" = lib; then
dlprefiles="$newdlprefiles"
fi
case $linkmode in
oldlib)
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ func_warning "\`-dlopen' is ignored for archives"
+ fi
+
case " $deplibs" in
*\ -l* | *\ -L*)
- $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
+ func_warning "\`-l' and \`-L' are ignored for archives" ;;
esac
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
- fi
+ test -n "$rpath" && \
+ func_warning "\`-rpath' is ignored for archives"
- if test -n "$rpath"; then
- $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
- fi
+ test -n "$xrpath" && \
+ func_warning "\`-R' is ignored for archives"
- if test -n "$xrpath"; then
- $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
- fi
+ test -n "$vinfo" && \
+ func_warning "\`-version-info/-version-number' is ignored for archives"
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
- fi
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for archives"
- 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
+ test -n "$export_symbols$export_symbols_regex" && \
+ func_warning "\`-export-symbols' is ignored for archives"
# Now set the variables for building old libraries.
build_libtool_libs=no
@@ -3517,48 +6591,48 @@ EOF
# 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//'`
+ func_stripname 'lib' '.la' "$outputname"
+ name=$func_stripname_result
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
+ test "$module" = no && \
+ func_fatal_help "libtool library \`$output' must begin with \`lib'"
+
if test "$need_lib_prefix" != no; then
# Add the "lib" prefix for modules if required
- name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ func_stripname '' '.la' "$outputname"
+ name=$func_stripname_result
eval shared_ext=\"$shrext_cmds\"
eval libname=\"$libname_spec\"
else
- libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ func_stripname '' '.la' "$outputname"
+ libname=$func_stripname_result
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
+ func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
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
- if test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
- fi
+ test "$dlself" != no && \
+ func_warning "\`-dlopen self' is ignored for libtool libraries"
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"
+ shift
+ test "$#" -gt 1 && \
+ func_warning "ignoring multiple \`-rpath's for a libtool library"
+
+ install_libdir="$1"
oldlibs=
if test -z "$rpath"; then
@@ -3572,25 +6646,21 @@ EOF
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
+ test -n "$vinfo" && \
+ func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
- fi
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for convenience libraries"
else
# Parse the version information argument.
save_ifs="$IFS"; IFS=':'
set dummy $vinfo 0 0 0
+ shift
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
+ test -n "$7" && \
+ func_fatal_help "too many parameters to \`-version-info'"
# convert absolute version numbers to libtool ages
# this retains compatibility with .la files and attempts
@@ -3598,9 +6668,9 @@ EOF
case $vinfo_number in
yes)
- number_major="$2"
- number_minor="$3"
- number_revision="$4"
+ number_major="$1"
+ number_minor="$2"
+ number_revision="$3"
#
# There are really only two kinds -- those that
# use the current revision as the major version
@@ -3610,7 +6680,8 @@ EOF
#
case $version_type in
darwin|linux|osf|windows|none)
- current=`expr $number_major + $number_minor`
+ func_arith $number_major + $number_minor
+ current=$func_arith_result
age="$number_minor"
revision="$number_revision"
;;
@@ -3620,17 +6691,21 @@ EOF
age="0"
;;
irix|nonstopux)
- current=`expr $number_major + $number_minor`
+ func_arith $number_major + $number_minor
+ current=$func_arith_result
age="$number_minor"
revision="$number_minor"
lt_irix_increment=no
;;
+ *)
+ func_fatal_configuration "$modename: unknown library version type \`$version_type'"
+ ;;
esac
;;
no)
- current="$2"
- revision="$3"
- age="$4"
+ current="$1"
+ revision="$2"
+ age="$3"
;;
esac
@@ -3638,34 +6713,30 @@ 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: \`$vinfo' is not valid version information" 1>&2
- exit $EXIT_FAILURE
+ func_error "CURRENT \`$current' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
;;
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' must be a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit $EXIT_FAILURE
+ func_error "REVISION \`$revision' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
;;
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' must be a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit $EXIT_FAILURE
+ func_error "AGE \`$age' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
;;
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
+ func_error "AGE \`$age' is greater than the current interface number \`$current'"
+ func_fatal_error "\`$vinfo' is not valid version information"
fi
# Calculate the version variables.
@@ -3678,10 +6749,12 @@ EOF
darwin)
# Like Linux, but with the current version available in
# verstring for coding it into the library header
- major=.`expr $current - $age`
+ func_arith $current - $age
+ major=.$func_arith_result
versuffix="$major.$age.$revision"
# Darwin ld doesn't like 0 for these options...
- minor_current=`expr $current + 1`
+ func_arith $current + 1
+ minor_current=$func_arith_result
xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
;;
@@ -3693,15 +6766,17 @@ EOF
freebsd-elf)
major=".$current"
- versuffix=".$current";
+ versuffix=".$current"
;;
irix | nonstopux)
if test "X$lt_irix_increment" = "Xno"; then
- major=`expr $current - $age`
+ func_arith $current - $age
else
- major=`expr $current - $age + 1`
+ func_arith $current - $age + 1
fi
+ major=$func_arith_result
+
case $version_type in
nonstopux) verstring_prefix=nonstopux ;;
*) verstring_prefix=sgi ;;
@@ -3711,8 +6786,10 @@ EOF
# 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`
+ func_arith $revision - $loop
+ iface=$func_arith_result
+ func_arith $loop - 1
+ loop=$func_arith_result
verstring="$verstring_prefix$major.$iface:$verstring"
done
@@ -3722,20 +6799,24 @@ EOF
;;
linux)
- major=.`expr $current - $age`
+ func_arith $current - $age
+ major=.$func_arith_result
versuffix="$major.$age.$revision"
;;
osf)
- major=.`expr $current - $age`
+ func_arith $current - $age
+ major=.$func_arith_result
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`
+ func_arith $current - $loop
+ iface=$func_arith_result
+ func_arith $loop - 1
+ loop=$func_arith_result
verstring="$verstring:${iface}.0"
done
@@ -3743,6 +6824,11 @@ EOF
verstring="$verstring:${current}.0"
;;
+ qnx)
+ major=".$current"
+ versuffix=".$current"
+ ;;
+
sunos)
major=".$current"
versuffix=".$current.$revision"
@@ -3751,14 +6837,13 @@ EOF
windows)
# Use '-' rather than '.', since we only want one
# extension on DOS 8.3 filesystems.
- major=`expr $current - $age`
+ func_arith $current - $age
+ major=$func_arith_result
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
+ func_fatal_configuration "unknown library version type \`$version_type'"
;;
esac
@@ -3792,7 +6877,7 @@ EOF
# 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
+ func_warning "undefined symbols not allowed in $host shared libraries"
build_libtool_libs=no
build_old_libs=yes
fi
@@ -3800,21 +6885,26 @@ EOF
# Don't allow undefined symbols.
allow_undefined_flag="$no_undefined_flag"
fi
+
fi
+ func_generate_dlsyms "$libname" "$libname" "yes"
+ libobjs="$libobjs $symfileobj"
+ test "X$libobjs" = "X " && libobjs=
+
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/*"`
+ tempremovelist=`$ECHO "$output_objdir/*"`
for p in $tempremovelist; do
case $p in
- *.$objext)
+ *.$objext | *.gcno)
;;
$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
+ if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+ then
continue
fi
fi
@@ -3823,10 +6913,8 @@ EOF
*) ;;
esac
done
- if test -n "$removelist"; then
- $show "${rm}r $removelist"
- $run ${rm}r $removelist
- fi
+ test -n "$removelist" && \
+ func_show_eval "${RM}r \$removelist"
fi
# Now set the variables for building old libraries.
@@ -3834,14 +6922,14 @@ EOF
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`
+ 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"`
+ # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
+ # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
+ # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
#done
if test -n "$xrpath"; then
@@ -3882,12 +6970,12 @@ EOF
if test "$build_libtool_libs" = yes; then
if test -n "$rpath"; then
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
# 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"
+ deplibs="$deplibs System.ltframework"
;;
*-*-netbsd*)
# Don't link with libc until the a.out ld.so is fixed.
@@ -3901,7 +6989,7 @@ EOF
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
# Compiler inserts libc in the correct place for threads to work
;;
- *)
+ *)
# Add libc to deplibs on all other systems if necessary.
if test "$build_libtool_need_lc" = "yes"; then
deplibs="$deplibs -lc"
@@ -3938,17 +7026,18 @@ EOF
# 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
+ $opt_dry_run || $RM conftest.c
cat > conftest.c <<EOF
int main() { return 0; }
EOF
- $rm conftest
+ $opt_dry_run || $RM conftest
if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; 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" != "0"; then
+ case $i in
+ -l*)
+ func_stripname -l '' "$i"
+ name=$func_stripname_result
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $i "*)
@@ -3956,37 +7045,40 @@ EOF
i=""
;;
esac
- fi
+ 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
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+ set dummy $deplib_matches; shift
+ deplib_match=$1
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."
+ $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
+ ;;
+ esac
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
+ case $i in
+ -l*)
+ func_stripname -l '' "$i"
+ name=$func_stripname_result
+ $opt_dry_run || $RM conftest
if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
ldd_output=`ldd conftest`
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
@@ -3998,44 +7090,47 @@ EOF
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
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+ set dummy $deplib_matches; shift
+ deplib_match=$1
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."
+ $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"
- fi
+ ;;
+ esac
done
fi
;;
file_magic*)
- set dummy $deplibs_check_method
- file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ set dummy $deplibs_check_method; shift
+ file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
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
+ case $a_deplib in
+ -l*)
+ func_stripname -l '' "$a_deplib"
+ name=$func_stripname_result
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $a_deplib "*)
@@ -4045,13 +7140,13 @@ EOF
esac
fi
if test -n "$a_deplib" ; then
- libname=`eval \\$echo \"$libname_spec\"`
+ 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
+ if ls -lLd "$potent_lib" 2>/dev/null |
+ $GREP " -> " >/dev/null; then
continue
fi
# The statement above tries to avoid entering an
@@ -4064,12 +7159,12 @@ EOF
potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
case $potliblink in
[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
- *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$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
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
+ $SED -e 10q |
+ $EGREP "$file_magic_regex" > /dev/null; then
newdeplibs="$newdeplibs $a_deplib"
a_deplib=""
break 2
@@ -4079,32 +7174,35 @@ EOF
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
+ ;;
+ *)
# Add a -L argument.
newdeplibs="$newdeplibs $a_deplib"
- fi
+ ;;
+ esac
done # Gone through all deplibs.
;;
match_pattern*)
- set dummy $deplibs_check_method
- match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ set dummy $deplibs_check_method; shift
+ match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
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
+ case $a_deplib in
+ -l*)
+ func_stripname -l '' "$a_deplib"
+ name=$func_stripname_result
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $a_deplib "*)
@@ -4114,14 +7212,13 @@ EOF
esac
fi
if test -n "$a_deplib" ; then
- libname=`eval \\$echo \"$libname_spec\"`
+ 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
+ if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
+ $EGREP "$match_pattern_regex" > /dev/null; then
newdeplibs="$newdeplibs $a_deplib"
a_deplib=""
break 2
@@ -4131,44 +7228,46 @@ EOF
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
+ ;;
+ *)
# Add a -L argument.
newdeplibs="$newdeplibs $a_deplib"
- fi
+ ;;
+ esac
done # Gone through all deplibs.
;;
none | unknown | *)
newdeplibs=""
- tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
- -e 's/ -[LR][^ ]*//g'`
+ 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,,"`
+ tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
done
fi
- if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
- | grep . >/dev/null; then
- $echo
+ 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
;;
@@ -4181,24 +7280,24 @@ EOF
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 /'`
+ # On Rhapsody replace the C library with the System framework
+ newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
;;
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."
+ $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"
@@ -4208,16 +7307,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."
+ $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
@@ -4231,7 +7330,14 @@ EOF
# Done checking deplibs!
deplibs=$newdeplibs
fi
-
+ # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+ case $host in
+ *-*-darwin*)
+ newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+ new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+ deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+ ;;
+ esac
# move library search paths that coincide with paths to not yet
# installed libraries to the beginning of the library search list
@@ -4260,7 +7366,6 @@ EOF
done
deplibs="$new_libs"
-
# All the library-specific variables (install_libdir is set above).
library_names=
old_library=
@@ -4305,10 +7410,7 @@ EOF
test -n "$hardcode_libdirs"; then
libdir="$hardcode_libdirs"
if test -n "$hardcode_libdir_flag_spec_ld"; then
- case $archive_cmds in
- *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
- *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
- esac
+ eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
else
eval dep_rpath=\"$hardcode_libdir_flag_spec\"
fi
@@ -4334,8 +7436,9 @@ EOF
eval shared_ext=\"$shrext_cmds\"
eval library_names=\"$library_names_spec\"
set dummy $library_names
- realname="$2"
- shift; shift
+ shift
+ realname="$1"
+ shift
if test -n "$soname_spec"; then
eval soname=\"$soname_spec\"
@@ -4354,71 +7457,122 @@ EOF
done
# Use standard objects if they are pic
- test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ test "X$libobjs" = "X " && libobjs=
+
+ delfiles=
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
+ export_symbols="$output_objdir/$libname.uexp"
+ delfiles="$delfiles $export_symbols"
+ fi
+
+ orig_export_symbols=
+ case $host_os in
+ cygwin* | mingw* | cegcc*)
+ if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
+ # exporting using user supplied symfile
+ if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+ # and it's NOT already a .def file. Must figure out
+ # which of the given symbols are data symbols and tag
+ # them as such. So, trigger use of export_symbols_cmds.
+ # export_symbols gets reassigned inside the "prepare
+ # the list of exported symbols" if statement, so the
+ # include_expsyms logic still works.
+ orig_export_symbols="$export_symbols"
+ export_symbols=
+ always_export_symbols=yes
+ fi
+ fi
+ ;;
+ esac
# 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'"
+ func_verbose "generating symbol list for \`$libname.la'"
export_symbols="$output_objdir/$libname.exp"
- $run $rm $export_symbols
+ $opt_dry_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
+ func_len " $cmd"
+ len=$func_len_result
+ if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ func_show_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=:
+ # The command line is too long to execute in one step.
+ func_verbose "using reloadable object file for export list..."
+ skipped_export=:
# Break out early, otherwise skipped_export may be
# set to false by a later but shorter cmd.
break
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"'
+ if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
+ func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ func_show_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"'
+ tmp_export_symbols="$export_symbols"
+ test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+ $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
+ fi
+
+ if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
+ # The given exports_symbols file has to be filtered, so filter it.
+ func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+ # FIXME: $output_objdir/$libname.filter potentially contains lots of
+ # 's' commands which not all seds can handle. GNU sed should be fine
+ # though. Also, the filter scales superlinearly with the number of
+ # global variables. join(1) would be nice here, but unfortunately
+ # isn't a blessed tool.
+ $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+ delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
+ export_symbols=$output_objdir/$libname.def
+ $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
fi
tmp_deplibs=
for test_deplib in $deplibs; do
- case " $convenience " in
- *" $test_deplib "*) ;;
- *)
- tmp_deplibs="$tmp_deplibs $test_deplib"
- ;;
- esac
+ 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" &&
+ test "$compiler_needs_object" = yes &&
+ test -z "$libobjs"; then
+ # extract the archives, so we have objects to list.
+ # TODO: could optimize this to just extract one archive.
+ whole_archive_flag_spec=
+ fi
if test -n "$whole_archive_flag_spec"; then
save_libobjs=$libobjs
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ test "X$libobjs" = "X " && libobjs=
else
gentop="$output_objdir/${outputname}x"
generated="$generated $gentop"
func_extract_archives $gentop $convenience
libobjs="$libobjs $func_extract_archives_result"
+ test "X$libobjs" = "X " && libobjs=
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"
@@ -4426,7 +7580,7 @@ EOF
# 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 $?
+ $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
fi
# Do each of the archive commands.
@@ -4439,22 +7593,24 @@ EOF
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
+ 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" : ".*" 2>/dev/null` &&
- test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ func_len " $test_cmds" &&
+ len=$func_len_result &&
+ test "$len" -lt "$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..."
+ # The command line is too long to link in one step, link piecewise
+ # or, if using GNU ld and skipped_export is not :, use a linker
+ # script.
# Save the value of $output and $libobjs because we want to
# use them later. If we have whole_archive_flag_spec, we
@@ -4468,77 +7624,162 @@ EOF
save_libobjs=$libobjs
fi
save_output=$output
- output_la=`$echo "X$output" | $Xsed -e "$basename"`
+ 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" : ".*" 2>/dev/null` &&
- test "$len" -le "$max_cmd_len"; }; then
- objlist="$objlist $obj"
+
+ if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
+ output=${output_objdir}/${output_la}.lnkscript
+ func_verbose "creating GNU ld script: $output"
+ $ECHO 'INPUT (' > $output
+ for obj in $save_libobjs
+ do
+ $ECHO "$obj" >> $output
+ done
+ $ECHO ')' >> $output
+ delfiles="$delfiles $output"
+ elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
+ output=${output_objdir}/${output_la}.lnk
+ func_verbose "creating linker input file list: $output"
+ : > $output
+ set x $save_libobjs
+ shift
+ firstobj=
+ if test "$compiler_needs_object" = yes; then
+ firstobj="$1 "
+ shift
+ fi
+ for obj
+ do
+ $ECHO "$obj" >> $output
+ done
+ delfiles="$delfiles $output"
+ output=$firstobj\"$file_list_spec$output\"
+ else
+ if test -n "$save_libobjs"; then
+ func_verbose "creating reloadable object files..."
+ output=$output_objdir/$output_la-${k}.$objext
+ eval test_cmds=\"$reload_cmds\"
+ func_len " $test_cmds"
+ len0=$func_len_result
+ len=$len0
+
+ # Loop over the list of objects to be linked.
+ for obj in $save_libobjs
+ do
+ func_len " $obj"
+ func_arith $len + $func_len_result
+ len=$func_arith_result
+ if test "X$objlist" = X ||
+ test "$len" -lt "$max_cmd_len"; then
+ func_append 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~\$RM $last_robj\"
+ fi
+ last_robj=$output_objdir/$output_la-${k}.$objext
+ func_arith $k + 1
+ k=$func_arith_result
+ output=$output_objdir/$output_la-${k}.$objext
+ objlist=$obj
+ func_len " $last_robj"
+ func_arith $len0 + $func_len_result
+ len=$func_arith_result
+ 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 test -n "$last_robj"; then
+ eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
+ fi
+ delfiles="$delfiles $output"
+
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\"
+ output=
+ fi
+
+ if ${skipped_export-false}; then
+ func_verbose "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $opt_dry_run || $RM $export_symbols
+ libobjs=$output
+ # Append the command to create the export file.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
+ if test -n "$last_robj"; then
+ eval concat_cmds=\"\$concat_cmds~\$RM $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"
+ test -n "$save_libobjs" &&
+ func_verbose "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"
+ $opt_silent || {
+ func_quote_for_expand "$cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ $opt_dry_run || eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ ( cd "$output_objdir" && \
+ $RM "${realname}T" && \
+ $MV "${realname}U" "$realname" )
+ fi
- # Loop through the commands generated above and execute them.
- save_ifs="$IFS"; IFS='~'
- for cmd in $concat_cmds; do
+ exit $lt_exit
+ }
+ done
IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
+
+ if test -n "$export_symbols_regex" && ${skipped_export-false}; then
+ func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+
+ if ${skipped_export-false}; then
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ tmp_export_symbols="$export_symbols"
+ test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+ $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
+ fi
+
+ if test -n "$orig_export_symbols"; then
+ # The given exports_symbols file has to be filtered, so filter it.
+ func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+ # FIXME: $output_objdir/$libname.filter potentially contains lots of
+ # 's' commands which not all seds can handle. GNU sed should be fine
+ # though. Also, the filter scales superlinearly with the number of
+ # global variables. join(1) would be nice here, but unfortunately
+ # isn't a blessed tool.
+ $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+ delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
+ export_symbols=$output_objdir/$libname.def
+ $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+ fi
+ fi
libobjs=$output
# Restore the value of output.
@@ -4546,6 +7787,7 @@ EOF
if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ test "X$libobjs" = "X " && libobjs=
fi
# Expand the library linking commands again to reset the
# value of $libobjs for piecewise linking.
@@ -4558,28 +7800,45 @@ EOF
cmds=$module_cmds
fi
else
- if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- cmds=$archive_expsym_cmds
- else
- cmds=$archive_cmds
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ cmds=$archive_expsym_cmds
+ else
+ cmds=$archive_cmds
fi
fi
+ fi
+
+ if test -n "$delfiles"; then
+ # Append the command to remove temporary files to $cmds.
+ eval cmds=\"\$cmds~\$RM $delfiles\"
+ fi
+
+ # Add any objects from preloaded convenience libraries
+ if test -n "$dlprefiles"; then
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
- # Append the command to remove the reloadable object files
- # to the just-reset $cmds.
- eval cmds=\"\$cmds~\$rm $delfiles\"
+ func_extract_archives $gentop $dlprefiles
+ libobjs="$libobjs $func_extract_archives_result"
+ test "X$libobjs" = "X " && libobjs=
fi
+
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || {
+ $opt_silent || {
+ func_quote_for_expand "$cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ $opt_dry_run || eval "$cmd" || {
lt_exit=$?
# Restore the uninstalled library and exit
if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+ ( cd "$output_objdir" && \
+ $RM "${realname}T" && \
+ $MV "${realname}U" "$realname" )
fi
exit $lt_exit
@@ -4589,12 +7848,11 @@ 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 $?
+ $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
if test -n "$convenience"; then
if test -z "$whole_archive_flag_spec"; then
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
+ func_show_eval '${RM}r "$gentop"'
fi
fi
@@ -4604,8 +7862,7 @@ EOF
# 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 $?
+ func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
fi
done
@@ -4618,39 +7875,35 @@ EOF
;;
obj)
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ func_warning "\`-dlopen' is ignored for objects"
+ fi
+
case " $deplibs" in
*\ -l* | *\ -L*)
- $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
+ func_warning "\`-l' and \`-L' are ignored for objects" ;;
esac
- 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
+ test -n "$rpath" && \
+ func_warning "\`-rpath' is ignored for objects"
- if test -n "$xrpath"; then
- $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
- fi
+ test -n "$xrpath" && \
+ func_warning "\`-R' is ignored for objects"
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
- fi
+ test -n "$vinfo" && \
+ func_warning "\`-version-info' is ignored for objects"
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
- fi
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for objects"
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"`
+ test -n "$objs$old_deplibs" && \
+ func_fatal_error "cannot build library object \`$output' from non-libtool objects"
+
+ libobj=$output
+ func_lo2o "$libobj"
+ obj=$func_lo2o_result
;;
*)
libobj=
@@ -4659,7 +7912,7 @@ EOF
esac
# Delete the old objects.
- $run $rm $obj $libobj
+ $opt_dry_run || $RM $obj $libobj
# Objects from convenience libraries. This assumes
# single-version convenience libraries. Whenever we create
@@ -4675,7 +7928,7 @@ EOF
if test -n "$convenience"; then
if test -n "$whole_archive_flag_spec"; then
eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
- reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
+ reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
else
gentop="$output_objdir/${obj}x"
generated="$generated $gentop"
@@ -4686,24 +7939,15 @@ EOF
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
+ 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"
+ func_execute_cmds "$reload_cmds" 'exit $?'
# 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
+ func_show_eval '${RM}r "$gentop"'
fi
exit $EXIT_SUCCESS
@@ -4711,14 +7955,13 @@ EOF
if test "$build_libtool_libs" != yes; then
if test -n "$gentop"; then
- $show "${rm}r $gentop"
- $run ${rm}r $gentop
+ func_show_eval '${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 $?
+ # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
exit $EXIT_SUCCESS
fi
@@ -4726,20 +7969,11 @@ EOF
# 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"
+ func_execute_cmds "$reload_cmds" 'exit $?'
fi
if test -n "$gentop"; then
- $show "${rm}r $gentop"
- $run ${rm}r $gentop
+ func_show_eval '${RM}r "$gentop"'
fi
exit $EXIT_SUCCESS
@@ -4747,39 +7981,45 @@ EOF
prog)
case $host in
- *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+ *cygwin*) func_stripname '' '.exe' "$output"
+ output=$func_stripname_result.exe;;
esac
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
- fi
+ test -n "$vinfo" && \
+ func_warning "\`-version-info' is ignored for programs"
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
- fi
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for programs"
- 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
+ test "$preload" = yes \
+ && test "$dlopen_support" = unknown \
+ && test "$dlopen_self" = unknown \
+ && test "$dlopen_self_static" = unknown && \
+ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
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 /'`
+ compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+ finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
;;
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
- ;;
+ *-*-darwin*)
+ # Don't allow lazy linking, it breaks C++ global constructors
+ # But is supposedly fixed on 10.4 or later (yay!).
+ if test "$tagname" = CXX ; then
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+ 10.[0123])
+ compile_command="$compile_command ${wl}-bind_at_load"
+ finalize_command="$finalize_command ${wl}-bind_at_load"
+ ;;
+ esac
+ fi
+ # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+ compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+ finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+ ;;
esac
@@ -4854,14 +8094,16 @@ EOF
esac
fi
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$libdir:"*) ;;
+ ::) dllsearchpath=$libdir;;
*) dllsearchpath="$dllsearchpath:$libdir";;
esac
case :$dllsearchpath: in
*":$testbindir:"*) ;;
+ ::) dllsearchpath=$testbindir;;
*) dllsearchpath="$dllsearchpath:$testbindir";;
esac
;;
@@ -4913,281 +8155,51 @@ EOF
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
+ compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
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"'
- case $host in
- *cygwin* | *mingw* )
- $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
- $run eval 'cat "$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"'
- $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
- $run eval 'mv "$nlist"T "$nlist"'
- case $host in
- *cygwin* | *mingw* )
- $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
- $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
- ;;
- esac
- 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 >/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 $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
- $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -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.
- case $host in
- *cygwin* | *mingw* )
- if test -f "$output_objdir/${outputname}.def" ; then
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
- finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
- else
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
- finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
- fi
- ;;
- * )
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
- finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
- ;;
- esac
- ;;
- *)
- $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.
+ func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
- # Nullify the symbol file.
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
- finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
+ # template prelinking step
+ if test -n "$prelink_cmds"; then
+ func_execute_cmds "$prelink_cmds" 'exit $?'
fi
- if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+ wrappers_required=yes
+ case $host in
+ *cygwin* | *mingw* )
+ if test "$build_libtool_libs" != yes; then
+ wrappers_required=no
+ fi
+ ;;
+ *cegcc)
+ # Disable wrappers for cegcc, we are cross compiling anyway.
+ wrappers_required=no
+ ;;
+ *)
+ if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+ wrappers_required=no
+ fi
+ ;;
+ esac
+ if test "$wrappers_required" = no; then
# Replace the output file specification.
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
+ 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"
- exit_status=$?
+ exit_status=0
+ func_show_eval "$link_command" 'exit_status=$?'
# Delete the generated files.
- if test -n "$dlsyms"; then
- $show "$rm $output_objdir/${outputname}S.${objext}"
- $run $rm "$output_objdir/${outputname}S.${objext}"
+ if test -f "$output_objdir/${outputname}S.${objext}"; then
+ func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
fi
exit $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
@@ -5220,12 +8232,11 @@ static const void *lt_preloaded_setup() {
# 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'`
+ link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
# Delete the old output file.
- $run $rm $output
+ $opt_dry_run || $RM $output
# Link the executable and exit
- $show "$link_command"
- $run eval "$link_command" || exit $?
+ func_show_eval "$link_command" 'exit $?'
exit $EXIT_SUCCESS
fi
@@ -5234,13 +8245,13 @@ static const void *lt_preloaded_setup() {
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
+ func_warning "this platform does not like uninstalled shared libraries"
+ func_warning "\`$output' will be relinked during installation"
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" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
+ 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=
@@ -5252,608 +8263,103 @@ static const void *lt_preloaded_setup() {
fi
# Replace the output file specification.
- link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+ 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
+ $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
- $show "$link_command"
- $run eval "$link_command" || exit $?
+ func_show_eval "$link_command" 'exit $?'
# Now create the wrapper script.
- $show "creating $output"
+ func_verbose "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"
+ relink_command="{ test -z \"\${$var+set}\" || $lt_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"
+ func_quote_for_eval "$var_value"
+ relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
fi
done
relink_command="(cd `pwd`; $relink_command)"
- relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
+ 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
+ # 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"`
+ qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
else
- qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+ 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
+ # Only actually do things if not in dry run mode.
+ $opt_dry_run || {
# 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) func_stripname '' '.exe' "$output"
+ output=$func_stripname_result ;;
esac
# test for cygwin because mv fails w/o .exe extensions
case $host in
*cygwin*)
exeext=.exe
- outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
+ func_stripname '' '.exe' "$outputname"
+ outputname=$func_stripname_result ;;
*) exeext= ;;
esac
case $host in
*cygwin* | *mingw* )
- output_name=`basename $output`
- output_path=`dirname $output`
- cwrappersource="$output_path/$objdir/lt-$output_name.c"
- cwrapper="$output_path/$output_name.exe"
- $rm $cwrappersource $cwrapper
- trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
-
- cat > $cwrappersource <<EOF
-
-/* $cwrappersource - temporary wrapper executable 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 executable should never be moved out of the build directory.
- If it is, it will not operate correctly.
-
- Currently, it simply execs the wrapper *script* "/bin/sh $output",
- but could eventually absorb all of the scripts functionality and
- exec $objdir/$outputname directly.
-*/
-EOF
- cat >> $cwrappersource<<"EOF"
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <malloc.h>
-#include <stdarg.h>
-#include <assert.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/stat.h>
-
-#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)
-
-/* -DDEBUG is fairly common in CFLAGS. */
-#undef DEBUG
-#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);
-const char * base_name (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 (base_name (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 <<EOF
- newargz[0] = (char *) xstrdup("$SHELL");
-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]);
- /* 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<argc+1; i++)
- {
- DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
- ;
- }
-
-EOF
-
- case $host_os in
- mingw*)
- cat >> $cwrappersource <<EOF
- execv("$SHELL",(char const **)newargz);
-EOF
- ;;
- *)
- cat >> $cwrappersource <<EOF
- execv("$SHELL",newargz);
-EOF
- ;;
- esac
-
- cat >> $cwrappersource <<"EOF"
- return 127;
-}
-
-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
-;
-}
-
-const char *
-base_name (const char *name)
-{
- const char *base;
-
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- /* Skip over the disk name in MSDOS pathnames. */
- if (isalpha ((unsigned char)name[0]) && name[1] == ':')
- name += 2;
-#endif
-
- for (base = name; *name; name++)
- if (IS_DIR_SEPARATOR (*name))
- base = name + 1;
- return 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) &&
- (
- /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
-#if defined (S_IXOTH)
- ((st.st_mode & S_IXOTH) == S_IXOTH) ||
-#endif
-#if defined (S_IXGRP)
- ((st.st_mode & S_IXGRP) == S_IXGRP) ||
-#endif
- ((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;
- /* 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 ((unsigned char)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 $LTCFLAGS -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'
-
-# Be Bourne compatible (taken from Autoconf:_AS_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+\"\$@\"}'='\"\$@\"'
- setopt NO_GLOB_SUBST
-else
- case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
-fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# 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
+ func_dirname_and_basename "$output" "" "."
+ output_name=$func_basename_result
+ output_path=$func_dirname_result
+ cwrappersource="$output_path/$objdir/lt-$output_name.c"
+ cwrapper="$output_path/$output_name.exe"
+ $RM $cwrappersource $cwrapper
+ trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+ func_emit_cwrapperexe_src > $cwrappersource
+
+ # The wrapper executable is built using the $host compiler,
+ # because it contains $host paths and files. If cross-
+ # compiling, it, like the target executable, must be
+ # executed on the $host or under an emulation environment.
+ $opt_dry_run || {
+ $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
+ $STRIP $cwrapper
+ }
- $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+\"\$@\"}
-"
+ # Now, create the wrapper script for func_source use:
+ func_ltwrapper_scriptname $cwrapper
+ $RM $func_ltwrapper_scriptname_result
+ trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
+ $opt_dry_run || {
+ # note: this script will not be executed, so do not chmod.
+ if test "x$build" = "x$host" ; then
+ $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
+ else
+ func_emit_wrapper no > $func_ltwrapper_scriptname_result
+ fi
+ }
;;
+ * )
+ $RM $output
+ trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
- *)
- $echo >> $output "\
- exec \"\$progdir/\$program\" \${1+\"\$@\"}
-"
+ func_emit_wrapper no > $output
+ chmod +x $output
;;
esac
- $echo >> $output "\
- \$echo \"\$0: cannot exec \$program \$*\"
- 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
@@ -5862,7 +8368,7 @@ fi\
for oldlib in $oldlibs; do
if test "$build_libtool_libs" = convenience; then
- oldobjs="$libobjs_save"
+ oldobjs="$libobjs_save $symfileobj"
addlibs="$convenience"
build_libtool_libs=no
else
@@ -5871,6 +8377,9 @@ fi\
build_libtool_libs=no
else
oldobjs="$old_deplibs $non_pic_objects"
+ if test "$preload" = yes && test -f "$symfileobj"; then
+ oldobjs="$oldobjs $symfileobj"
+ fi
fi
addlibs="$old_convenience"
fi
@@ -5885,8 +8394,18 @@ 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
+ cmds=$old_archive_from_new_cmds
else
+
+ # Add any objects from preloaded convenience libraries
+ if test -n "$dlprefiles"; then
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+
+ func_extract_archives $gentop $dlprefiles
+ oldobjs="$oldobjs $func_extract_archives_result"
+ fi
+
# 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
@@ -5895,32 +8414,22 @@ fi\
# not supported by libtool).
if (for obj in $oldobjs
do
- $echo "X$obj" | $Xsed -e 's%^.*/%%'
+ func_basename "$obj"
+ $ECHO "$func_basename_result"
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"
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
- exit $exit_status
- fi
- fi
-
+ $ECHO "copying selected object files to avoid basename conflicts..."
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+ func_mkdir_p "$gentop"
save_oldobjs=$oldobjs
oldobjs=
counter=1
for obj in $save_oldobjs
do
- objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ func_basename "$obj"
+ objbase="$func_basename_result"
case " $oldobjs " in
" ") oldobjs=$obj ;;
*[\ /]"$objbase "*)
@@ -5928,58 +8437,62 @@ fi\
# Make sure we don't pick an alternate name that also
# overlaps.
newobj=lt$counter-$objbase
- counter=`expr $counter + 1`
+ func_arith $counter + 1
+ counter=$func_arith_result
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"
+ func_show_eval "ln $obj $gentop/$newobj || 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
+ func_len " $cmds"
+ len=$func_len_result
+ if test "$len" -lt "$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..."
+ func_verbose "using piecewise archive linking..."
save_RANLIB=$RANLIB
RANLIB=:
objlist=
concat_cmds=
save_oldobjs=$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
+ eval test_cmds=\"$old_archive_cmds\"
+ func_len " $test_cmds"
+ len0=$func_len_result
+ len=$len0
for obj in $save_oldobjs
do
- oldobjs="$objlist $obj"
- objlist="$objlist $obj"
- eval test_cmds=\"$old_archive_cmds\"
- if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
- test "$len" -le "$max_cmd_len"; then
+ func_len " $obj"
+ func_arith $len + $func_len_result
+ len=$func_arith_result
+ func_append objlist " $obj"
+ if test "$len" -lt "$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
+ RANLIB=$save_RANLIB
fi
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
objlist=
+ len=$len0
fi
done
RANLIB=$save_RANLIB
@@ -5991,49 +8504,39 @@ fi\
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"
+ func_execute_cmds "$cmds" 'exit $?'
done
- if test -n "$generated"; then
- $show "${rm}r$generated"
- $run ${rm}r$generated
- fi
+ test -n "$generated" && \
+ func_show_eval "${RM}r$generated"
# Now create the libtool archive.
case $output in
*.la)
old_library=
test "$build_old_libs" = yes && old_library="$libname.$libext"
- $show "creating $output"
+ func_verbose "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"
+ relink_command="{ test -z \"\${$var+set}\" || $lt_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"
+ func_quote_for_eval "$var_value"
+ relink_command="$var=$func_quote_for_eval_result; 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" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
+ 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
+ $opt_dry_run || {
for installed in no yes; do
if test "$installed" = yes; then
if test -z "$install_libdir"; then
@@ -6045,12 +8548,11 @@ fi\
for deplib in $dependency_libs; do
case $deplib in
*.la)
- name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+ func_basename "$deplib"
+ name="$func_basename_result"
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
+ test -z "$libdir" && \
+ func_fatal_error "\`$deplib' is not a valid libtool archive"
newdependency_libs="$newdependency_libs $libdir/$name"
;;
*) newdependency_libs="$newdependency_libs $deplib" ;;
@@ -6058,25 +8560,37 @@ fi\
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"
+ case $lib in
+ *.la)
+ func_basename "$lib"
+ name="$func_basename_result"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$lib' is not a valid libtool archive"
+ newdlfiles="$newdlfiles $libdir/$name"
+ ;;
+ *) newdlfiles="$newdlfiles $lib" ;;
+ esac
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"
+ case $lib in
+ *.la)
+ # Only pass preopened files to the pseudo-archive (for
+ # eventual linking with the app. that links it) if we
+ # didn't already link the preopened objects directly into
+ # the library:
+ func_basename "$lib"
+ name="$func_basename_result"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$lib' is not a valid libtool archive"
+ newdlprefiles="$newdlprefiles $libdir/$name"
+ ;;
+ esac
done
dlprefiles="$newdlprefiles"
else
@@ -6099,15 +8613,15 @@ fi\
done
dlprefiles="$newdlprefiles"
fi
- $rm $output
+ $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 | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
esac
- $echo > $output "\
+ $ECHO > $output "\
# $outputname - a libtool library file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
@@ -6121,9 +8635,15 @@ library_names='$library_names'
# The name of the static archive.
old_library='$old_library'
+# Linker flags that can not go in dependency_libs.
+inherited_linker_flags='$new_inherited_linker_flags'
+
# Libraries that this one depends upon.
dependency_libs='$dependency_libs'
+# Names of additional weak libraries provided by this library
+weak_library_names='$weak_libs'
+
# Version information for $libname.
current=$current
age=$age
@@ -6142,748 +8662,29 @@ 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 "\
+ $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" | 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)
- case " $install_prog " in
- *[\\\ /]cp\ *) ;;
- *) prev=$arg ;;
- esac
- ;;
- -g | -m | -o) prev=$arg ;;
- -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 $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
+ func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
;;
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" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
- else
- relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
- 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.
- # Try `ln -sf' first, because the `ln' binary might depend on
- # the symlink we replace! Solaris /bin/ln does not understand -f,
- # so we also need to try rm && ln -s.
- for linkname
- do
- if test "$linkname" != "$realname"; then
- $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
- $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $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" || {
- lt_exit=$?
-
- # Restore the uninstalled library and exit
- if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
- fi
-
- exit $lt_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=
-
- # Note that it is not necessary on cygwin/mingw to append a dot to
- # foo even if both foo and FILE.exe exist: automatic-append-.exe
- # behavior happens only for exec(3), not for open(2)! Also, sourcing
- # `FILE.' does not work on cygwin managed mounts.
- #
- # If there is no directory component, then add one.
- case $wrapper in
- */* | *\\*) . ${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
- 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=
- # Note that it is not necessary on cygwin/mingw to append a dot to
- # foo even if both foo and FILE.exe exist: automatic-append-.exe
- # behavior happens only for exec(3), not for open(2)! Also, sourcing
- # `FILE.' does not work on cygwin managed mounts.
- #
- # If there is no directory component, then add one.
- case $wrapper in
- */* | *\\*) . ${wrapper} ;;
- *) . ./${wrapper} ;;
- esac
-
- outputname=
- if test "$fast_install" = no && test -n "$relink_command"; then
- if test "$finalize" = yes && test -z "$run"; then
- tmpdir=`func_mktempdir`
- file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
- outputname="$tmpdir/$file"
- # Replace the output file specification.
- relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
-
- $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 anyway
- 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 "X----------------------------------------------------------------------" | $Xsed
- $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 "X----------------------------------------------------------------------" | $Xsed
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
- if test ! -f "$dir/$dlname"; then
- $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
- exit $EXIT_FAILURE
- fi
- 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
+{ test "$mode" = link || test "$mode" = relink; } &&
+ func_mode_link ${1+"$@"}
- # Restore saved environment variables
- for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
- do
- eval "if test \"\${save_$lt_var+set}\" = set; then
- $lt_var=\$save_$lt_var; export $lt_var
- fi"
- done
- # 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
- $echo "$cmd$args"
- exit $EXIT_SUCCESS
- fi
- ;;
-
- # libtool clean and uninstall mode
- clean | uninstall)
- modename="$modename: $mode"
- rm="$nonopt"
+# func_mode_uninstall arg...
+func_mode_uninstall ()
+{
+ $opt_debug
+ RM="$nonopt"
files=
rmforce=
exit_status=0
@@ -6895,30 +8696,28 @@ relink_command=\"$relink_command\""
for arg
do
case $arg in
- -f) rm="$rm $arg"; rmforce=yes ;;
- -*) rm="$rm $arg" ;;
+ -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
+ test -z "$RM" && \
+ func_fatal_help "you must specify an RM program"
rmdirs=
origobjdir="$objdir"
for file in $files; do
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$dir" = "X$file"; then
- dir=.
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+ if test "X$dir" = X.; then
objdir="$origobjdir"
else
objdir="$dir/$origobjdir"
fi
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ func_basename "$file"
+ name="$func_basename_result"
test "$mode" = uninstall && objdir="$dir"
# Remember objdir for removal later, being careful to avoid duplicates
@@ -6930,9 +8729,9 @@ relink_command=\"$relink_command\""
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
+ 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
@@ -6946,8 +8745,8 @@ 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
- . $dir/$name
+ if func_lalib_p "$file"; then
+ func_source $dir/$name
# Delete the libtool libraries and symlinks.
for n in $library_names; do
@@ -6962,39 +8761,17 @@ relink_command=\"$relink_command\""
*" $dlname "*) ;;
*) rmfiles="$rmfiles $objdir/$dlname" ;;
esac
- test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+ test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
;;
uninstall)
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"
+ func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
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"
+ func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
fi
# FIXME: should reinstall the best remaining shared library.
;;
@@ -7004,20 +8781,20 @@ 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
+ if func_lalib_p "$file"; then
# Read the .lo file
- . $dir/$name
+ func_source $dir/$name
# Add PIC object to the list of files to remove.
- if test -n "$pic_object" \
- && test "$pic_object" != none; then
+ 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
+ if test -n "$non_pic_object" &&
+ test "$non_pic_object" != none; then
rmfiles="$rmfiles $dir/$non_pic_object"
fi
fi
@@ -7028,17 +8805,26 @@ relink_command=\"$relink_command\""
noexename=$name
case $file in
*.exe)
- file=`$echo $file|${SED} 's,.exe$,,'`
- noexename=`$echo $name|${SED} 's,.exe$,,'`
+ func_stripname '' '.exe' "$file"
+ file=$func_stripname_result
+ func_stripname '' '.exe' "$name"
+ noexename=$func_stripname_result
# $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
+ if func_ltwrapper_p "$file"; then
+ if func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ relink_command=
+ func_source $func_ltwrapper_scriptname_result
+ rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
+ else
+ relink_command=
+ func_source $dir/$noexename
+ fi
# note $name still contains .exe if it was in $file originally
# as does the version of $file that was added into $rmfiles
@@ -7053,239 +8839,38 @@ relink_command=\"$relink_command\""
fi
;;
esac
- $show "$rm $rmfiles"
- $run $rm $rmfiles || exit_status=1
+ func_show_eval "$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
+ func_show_eval "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
+{ test "$mode" = uninstall || test "$mode" = clean; } &&
+ func_mode_uninstall ${1+"$@"}
- 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"
+test -z "$mode" && {
+ help="$generic_help"
+ func_fatal_help "you must specify a MODE"
+}
+
+test -z "$exec_cmd" && \
+ func_fatal_help "invalid operation mode \`$mode'"
if test -n "$exec_cmd"; then
- eval exec $exec_cmd
+ 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 <bug-libtool@gnu.org>."
- 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 uninstalled libtool libraries
- -static-libtool-libs
- 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.
+exit $exit_status
-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
@@ -7299,323 +8884,17 @@ exit $?
# configuration. But we'll never go from static-only to shared-only.
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
-disable_libs=shared
+build_libtool_libs=no
+build_old_libs=yes
# ### END LIBTOOL TAG CONFIG: disable-shared
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
-disable_libs=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:
-# ### BEGIN LIBTOOL TAG CONFIG: CXX
-
-# Libtool was configured on host announce:
-
-# Shell to use when invoking shell scripts.
-SHELL="/bin/bash"
-
-# Whether or not to build shared libraries.
-build_libtool_libs=yes
-
-# Whether or not to build static libraries.
-build_old_libs=yes
-
-# Whether or not to add -lc for building shared libraries.
-build_libtool_need_lc=no
-
-# Whether or not to disallow shared libs when runtime libs are static
-allow_libtool_libs_with_static_runtimes=no
-
-# Whether or not to optimize for fast installation.
-fast_install=yes
-
-# The host system.
-host_alias=arc-linux-uclibc
-host=arc-unknown-linux-uclibc
-host_os=linux-uclibc
-
-# The build system.
-build_alias=
-build=i686-pc-linux-gnu
-build_os=linux-gnu
-
-# An echo program that does not interpret backslashes.
-echo="echo"
-
-# The archiver.
-AR="arc-linux-uclibc-ar"
-AR_FLAGS="cru"
-
-# A C compiler.
-LTCC="arc-linux-uclibc-gcc"
-
-# LTCC compiler flags.
-LTCFLAGS="-mA7 -g"
-
-# A language-specific compiler.
-CC="arc-linux-uclibc-g++"
-
-# Is the compiler the GNU C compiler?
-with_gcc=yes
-
-# An ERE matcher.
-EGREP="/bin/grep -E"
-
-# The linker used to build libraries.
-LD="/opt/gnutools/arc2.3-p0/uclibc-4.2.1/arc-linux-uclibc/bin/ld"
-
-# Whether we need hard or soft links.
-LN_S="ln -s"
-
-# A BSD-compatible nm program.
-NM="/opt/gnutools/arc2.3-p0/uclibc-4.2.1/bin/arc-linux-uclibc-nm -B"
-
-# A symbol stripping program
-STRIP="arc-linux-uclibc-strip"
-
-# Used to examine libraries when file_magic_cmd begins "file"
-MAGIC_CMD=file
-
-# 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=.libs
-
-# How to create reloadable object files.
-reload_flag=" -r"
-reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
-
-# How to pass a linker flag through the compiler.
-wl="-Wl,"
-
-# Object file suffix (normally "o").
-objext="o"
-
-# Old archive suffix (normally "a").
-libext="a"
-
-# Shared library suffix (normally ".so").
-shrext_cmds='.so'
-
-# Executable file suffix (normally "").
-exeext=""
-
-# Additional compiler flags for building library objects.
-pic_flag=" -fPIC -DPIC"
-pic_mode=default
-
-# What is the maximum length of a command?
-max_cmd_len=805306365
-
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o="yes"
-
-# Must we lock files when doing compilation?
-need_locks="no"
-
-# Do we need the lib prefix for modules?
-need_lib_prefix=no
-
-# Do we need a version for libraries?
-need_version=no
-
-# Whether dlopen is supported.
-dlopen_support=unknown
-
-# Whether dlopen of programs is supported.
-dlopen_self=unknown
-
-# Whether dlopen of statically linked programs is supported.
-dlopen_self_static=unknown
-
-# Compiler flag to prevent dynamic linking.
-link_static_flag="-static"
-
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=" -fno-builtin"
-
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec="\${wl}--export-dynamic"
-
-# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec="\${wl}--whole-archive\$convenience \${wl}--no-whole-archive"
-
-# Compiler flag to generate thread-safe objects.
-thread_safe_flag_spec=""
-
-# Library versioning type.
-version_type=linux
-
-# Format of library name prefix.
-libname_spec="lib\$name"
-
-# 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="\${libname}\${release}\${shared_ext}\$versuffix \${libname}\${release}\${shared_ext}\$major \$libname\${shared_ext}"
-
-# The coded name of the library, if different from the real name.
-soname_spec="\${libname}\${release}\${shared_ext}\$major"
-
-# Commands used to build and install an old-style archive.
-RANLIB="arc-linux-uclibc-ranlib"
-old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$oldlib"
-old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$oldlib"
-old_postuninstall_cmds=""
-
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds=""
-
-# Create a temporary old-style archive to link instead of a shared archive.
-old_archive_from_expsyms_cmds=""
-
-# Commands used to build and install a shared archive.
-archive_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname -o \$lib"
-archive_expsym_cmds="\$CC -shared -nostdlib \$predep_objects \$libobjs \$deplibs \$postdep_objects \$compiler_flags \${wl}-soname \$wl\$soname \${wl}-retain-symbols-file \$wl\$export_symbols -o \$lib"
-postinstall_cmds=""
-postuninstall_cmds=""
-
-# Commands used to build a loadable module (assumed same as above if empty)
-module_cmds=""
-module_expsym_cmds=""
-
-# Commands to strip libraries.
-old_striplib="arc-linux-uclibc-strip --strip-debug"
-striplib="arc-linux-uclibc-strip --strip-unneeded"
-
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predep_objects="/opt/gnutools/arc2.3-p0/uclibc-4.2.1/lib/gcc/arc-linux-uclibc/4.2.1/crti.o /opt/gnutools/arc2.3-p0/uclibc-4.2.1/lib/gcc/arc-linux-uclibc/4.2.1/crtbeginS.o"
-
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdep_objects="/opt/gnutools/arc2.3-p0/uclibc-4.2.1/lib/gcc/arc-linux-uclibc/4.2.1/crtendS.o /opt/gnutools/arc2.3-p0/uclibc-4.2.1/lib/gcc/arc-linux-uclibc/4.2.1/crtn.o"
-
-# Dependencies to place before the objects being linked to create a
-# shared library.
-predeps=""
-
-# Dependencies to place after the objects being linked to create a
-# shared library.
-postdeps="-lstdc++ -lm -lgcc_s -lc -lgcc_s"
-
-# The directories searched by this compiler when creating a shared
-# library
-compiler_lib_search_dirs="/opt/gnutools/arc2.3-p0/uclibc-4.2.1/lib/gcc/arc-linux-uclibc/4.2.1 /opt/gnutools/arc2.3-p0/uclibc-4.2.1/lib/gcc/arc-linux-uclibc/4.2.1/../../../../arc-linux-uclibc/lib"
-
-# The library search path used internally by the compiler when linking
-# a shared library.
-compiler_lib_search_path="-L/opt/gnutools/arc2.3-p0/uclibc-4.2.1/lib/gcc/arc-linux-uclibc/4.2.1 -L/opt/gnutools/arc2.3-p0/uclibc-4.2.1/lib/gcc/arc-linux-uclibc/4.2.1/../../../../arc-linux-uclibc/lib"
-
-# Method to check whether dependent libraries are shared objects.
-deplibs_check_method="pass_all"
-
-# Command to use when deplibs_check_method == file_magic.
-file_magic_cmd="\$MAGIC_CMD"
-
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=""
-
-# Flag that forces no undefined symbols.
-no_undefined_flag=""
-
-# Commands used to finish a libtool library installation in a directory.
-finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
-
-# Same as above, but a single script fragment to be evaled but not shown.
-finish_eval=""
-
-# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe="sed -n -e 's/^.*[ ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[ ][ ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p'"
-
-# Transform the output of nm in a proper C declaration
-global_symbol_to_cdecl="sed -n -e 's/^. .* \\(.*\\)\$/extern int \\1;/p'"
-
-# Transform the output of nm in a C name address pair
-global_symbol_to_c_name_address="sed -n -e 's/^: \\([^ ]*\\) \$/ {\\\"\\1\\\", (lt_ptr) 0},/p' -e 's/^[BCDEGRST] \\([^ ]*\\) \\([^ ]*\\)\$/ {\"\\2\", (lt_ptr) \\&\\2},/p'"
-
-# This is the shared library runtime path variable.
-runpath_var=LD_RUN_PATH
-
-# This is the shared library path variable.
-shlibpath_var=LD_LIBRARY_PATH
-
-# Is shlibpath searched before the hard-coded library search path?
-shlibpath_overrides_runpath=no
-
-# How to hardcode a shared library path into an executable.
-hardcode_action=immediate
-
-# Whether we should hardcode library paths into libraries.
-hardcode_into_libs=yes
-
-# Flag to hardcode $libdir into a binary during linking.
-# This must work even if $libdir does not exist.
-hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir"
-
-# 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=""
-
-# Whether we need a single -rpath flag with a separated argument.
-hardcode_libdir_separator=""
-
-# Set to yes if using DIR/libNAME during linking hardcodes DIR into the
-# resulting binary.
-hardcode_direct=no
-
-# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
-# resulting binary.
-hardcode_minus_L=no
-
-# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
-# the resulting binary.
-hardcode_shlibpath_var=unsupported
-
-# 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=no
-
-# Variables whose values should be saved in libtool wrapper scripts and
-# restored at relink time.
-variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
-
-# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=unknown
-
-# Compile-time system search path for libraries
-sys_lib_search_path_spec="/opt/gnutools/arc2.3-p0/uclibc-4.2.1/lib/gcc/arc-linux-uclibc/4.2.1 /opt/gnutools/arc2.3-p0/uclibc-4.2.1/arc-linux-uclibc/lib"
-
-# Run-time system search path for libraries
-sys_lib_dlsearch_path_spec="/lib /usr/lib /lib/i486-linux-gnu /usr/lib/i486-linux-gnu /usr/lib/alsa-lib /usr/local/lib "
-
-# Fix the shell variable $srcfile for the compiler.
-fix_srcfile_path=""
-
-# Set to yes if exported symbols are required.
-always_export_symbols=no
-
-# The commands to list exported symbols.
-export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
-
-# The commands to extract the exported symbol list from a shared archive.
-extract_expsyms_cmds=""
-
-# Symbols that should not be listed in the preloaded symbols.
-exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
-
-# Symbols that must always be exported.
-include_expsyms=""
-
-# ### END LIBTOOL TAG CONFIG: CXX
+# vi:sw=2
diff --git a/ltmain.sh b/ltmain.sh
index 27d498a..d88da2c 100755
--- a/ltmain.sh
+++ b/ltmain.sh
@@ -1,52 +1,83 @@
-# 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, 2006,
-# 2007, 2008 Free Software Foundation, Inc.
-# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-#
-# This program is free software; you can redistribute it and/or modify
+# Generated from ltmain.m4sh.
+
+# ltmain.sh (GNU libtool) 2.2.6b
+# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 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.
+
+# GNU Libtool is free software; you can redistribute it and/or modify
# it under the terms of the GNU General 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
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See 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., 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"
+# along with GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html,
+# or obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-# The name of this program:
-progname=`echo "$progpath" | $SED $basename`
-modename="$progname"
-
-# Global variables:
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
+# Usage: $progname [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
+# --mode=MODE use operation mode MODE
+# --preserve-dup-deps don't remove duplicate dependency libraries
+# --quiet, --silent don't print informational messages
+# --tag=TAG use configuration variables from tag TAG
+# -v, --verbose print informational messages (default)
+# --version print version information
+# -h, --help print short or long help message
+#
+# 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 `$progname --help --mode=MODE' for a more detailed description of MODE.
+#
+# When reporting a bug, please describe a test case to reproduce it and
+# include the following information:
+#
+# host-triplet: $host
+# shell: $SHELL
+# compiler: $LTCC
+# compiler flags: $LTCFLAGS
+# linker: $LD (gnu? $with_gnu_ld)
+# $progname: (GNU libtool) 2.2.6b Debian-2.2.6b-2
+# automake: $automake_version
+# autoconf: $autoconf_version
+#
+# Report bugs to <bug-libtool@gnu.org>.
PROGRAM=ltmain.sh
PACKAGE=libtool
-VERSION=1.5.26
-TIMESTAMP=" (1.1220.2.492 2008/01/30 06:40:56)"
+VERSION="2.2.6b Debian-2.2.6b-2"
+TIMESTAMP=""
+package_revision=1.3017
-# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+# Be Bourne compatible
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
@@ -60,104 +91,261 @@ fi
BIN_SH=xpg4; export BIN_SH # for Tru64
DUALCASE=1; export DUALCASE # for MKS sh
-# 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 <<EOF
-$*
-EOF
- exit $EXIT_SUCCESS
-fi
-
-default_mode=
-help="Try \`$progname --help' for more information."
-magic="%%%MAGIC variable%%%"
-mkdir="mkdir"
-mv="mv -f"
-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//'
-sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
-# test EBCDIC or ASCII
-case `echo X|tr X '\101'` in
- A) # ASCII based system
- # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
- SP2NL='tr \040 \012'
- NL2SP='tr \015\012 \040\040'
- ;;
- *) # EBCDIC based system
- SP2NL='tr \100 \n'
- NL2SP='tr \r\n \100\100'
- ;;
-esac
-
-# NLS nuisances.
+# NLS nuisances: We save the old values to restore during execute mode.
# 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).
-# We save the old values to restore during execute mode.
-lt_env=
+lt_user_locale=
+lt_safe_locale=
for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
do
eval "if test \"\${$lt_var+set}\" = set; then
- save_$lt_var=\$$lt_var
- lt_env=\"$lt_var=\$$lt_var \$lt_env\"
- $lt_var=C
+ save_$lt_var=\$$lt_var
+ $lt_var=C
export $lt_var
+ lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
+ lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
fi"
done
-if test -n "$lt_env"; then
- lt_env="env $lt_env"
-fi
+$lt_unset CDPATH
+
+
+
+
+
+: ${CP="cp -f"}
+: ${ECHO="echo"}
+: ${EGREP="/bin/grep -E"}
+: ${FGREP="/bin/grep -F"}
+: ${GREP="/bin/grep"}
+: ${LN_S="ln -s"}
+: ${MAKE="make"}
+: ${MKDIR="mkdir"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+: ${SED="/bin/sed"}
+: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
+: ${Xsed="$SED -e 1s/^X//"}
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
+EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
+
+exit_status=$EXIT_SUCCESS
# Make sure IFS has a sensible default
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
- $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
- exit $EXIT_FAILURE
-fi
+dirname="s,/[^/]*$,,"
+basename="s,^.*/,,"
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+# dirname: Compute the dirname of FILE. If nonempty,
+# add APPEND to the result, otherwise set result
+# to NONDIR_REPLACEMENT.
+# value returned in "$func_dirname_result"
+# basename: Compute filename of FILE.
+# value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+ # Extract subdirectory from the argument.
+ func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+ func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
-# Global variables.
-mode=$default_mode
-nonopt=
-prev=
-prevopt=
-run=
-show="$echo"
-show_help=
-execute_dlfiles=
-duplicate_deps=no
-preserve_args=
-lo2o="s/\\.lo\$/.${objext}/"
-o2lo="s/\\.${objext}\$/.lo/"
-extracted_archives=
-extracted_serial=0
+# Generated shell functions inserted here.
+
+# 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:
+# In the unlikely event $progname began with a '-', it would play havoc with
+# func_echo (imagine progname=-n), so we prepend ./ in that case:
+func_dirname_and_basename "$progpath"
+progname=$func_basename_result
+case $progname in
+ -*) progname=./$progname ;;
+esac
+
+# Make sure we have an absolute path for reexecution:
+case $progpath in
+ [\\/]*|[A-Za-z]:\\*) ;;
+ *[\\/]*)
+ progdir=$func_dirname_result
+ progdir=`cd "$progdir" && pwd`
+ progpath="$progdir/$progname"
+ ;;
+ *)
+ save_IFS="$IFS"
+ IFS=:
+ for progdir in $PATH; do
+ IFS="$save_IFS"
+ test -x "$progdir/$progname" && break
+ done
+ IFS="$save_IFS"
+ test -n "$progdir" || progdir=`pwd`
+ progpath="$progdir/$progname"
+ ;;
+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'
+
+# Re-`\' parameter expansions in output of double_quote_subst that were
+# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
+# in input to double_quote_subst, that '$' was protected from expansion.
+# Since each input `\' is now two `\'s, look for any number of runs of
+# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
+bs='\\'
+bs2='\\\\'
+bs4='\\\\\\\\'
+dollar='\$'
+sed_double_backslash="\
+ s/$bs4/&\\
+/g
+ s/^$bs2$dollar/$bs&/
+ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
+ s/\n//g"
+
+# Standard options:
+opt_dry_run=false
+opt_help=false
+opt_quiet=false
+opt_verbose=false
+opt_warning=:
+
+# func_echo arg...
+# Echo program name prefixed message, along with the current mode
+# name if it has been set yet.
+func_echo ()
+{
+ $ECHO "$progname${mode+: }$mode: $*"
+}
+
+# func_verbose arg...
+# Echo program name prefixed message in verbose mode only.
+func_verbose ()
+{
+ $opt_verbose && func_echo ${1+"$@"}
+
+ # A bug in bash halts the script if the last line of a function
+ # fails when set -e is in force, so we need another command to
+ # work around that:
+ :
+}
+
+# func_error arg...
+# Echo program name prefixed message to standard error.
+func_error ()
+{
+ $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
+}
+
+# func_warning arg...
+# Echo program name prefixed warning message to standard error.
+func_warning ()
+{
+ $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
+
+ # bash bug again:
+ :
+}
+
+# func_fatal_error arg...
+# Echo program name prefixed message to standard error, and exit.
+func_fatal_error ()
+{
+ func_error ${1+"$@"}
+ exit $EXIT_FAILURE
+}
+
+# func_fatal_help arg...
+# Echo program name prefixed message to standard error, followed by
+# a help hint, and exit.
+func_fatal_help ()
+{
+ func_error ${1+"$@"}
+ func_fatal_error "$help"
+}
+help="Try \`$progname --help' for more information." ## default
+
+
+# func_grep expression filename
+# Check whether EXPRESSION matches any line of FILENAME, without output.
+func_grep ()
+{
+ $GREP "$1" "$2" >/dev/null 2>&1
+}
+
+
+# func_mkdir_p directory-path
+# Make sure the entire path to DIRECTORY-PATH is available.
+func_mkdir_p ()
+{
+ my_directory_path="$1"
+ my_dir_list=
+
+ if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
+
+ # Protect directory names starting with `-'
+ case $my_directory_path in
+ -*) my_directory_path="./$my_directory_path" ;;
+ esac
+
+ # While some portion of DIR does not yet exist...
+ while test ! -d "$my_directory_path"; do
+ # ...make a list in topmost first order. Use a colon delimited
+ # list incase some portion of path contains whitespace.
+ my_dir_list="$my_directory_path:$my_dir_list"
+
+ # If the last portion added has no slash in it, the list is done
+ case $my_directory_path in */*) ;; *) break ;; esac
+
+ # ...otherwise throw away the child directory and loop
+ my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
+ done
+ my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
+
+ save_mkdir_p_IFS="$IFS"; IFS=':'
+ for my_dir in $my_dir_list; do
+ IFS="$save_mkdir_p_IFS"
+ # mkdir can fail with a `File exist' error if two processes
+ # try to create one of the directories concurrently. Don't
+ # stop in that case!
+ $MKDIR "$my_dir" 2>/dev/null || :
+ done
+ IFS="$save_mkdir_p_IFS"
+
+ # Bail out if we (or some other process) failed to create a directory.
+ test -d "$my_directory_path" || \
+ func_fatal_error "Failed to create \`$1'"
+ fi
+}
-#####################################
-# Shell function definitions:
-# This seems to be the best place for them
# func_mktempdir [string]
# Make a temporary directory that won't clash with other running
@@ -167,7 +355,7 @@ func_mktempdir ()
{
my_template="${TMPDIR-/tmp}/${1-$progname}"
- if test "$run" = ":"; then
+ if test "$opt_dry_run" = ":"; then
# Return a directory name, but don't create it in dry-run mode
my_tmpdir="${my_template}-$$"
else
@@ -176,486 +364,743 @@ func_mktempdir ()
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
if test ! -d "$my_tmpdir"; then
- # Failing that, at least try and use $RANDOM to avoid a race
- my_tmpdir="${my_template}-${RANDOM-0}$$"
+ # Failing that, at least try and use $RANDOM to avoid a race
+ my_tmpdir="${my_template}-${RANDOM-0}$$"
- save_mktempdir_umask=`umask`
- umask 0077
- $mkdir "$my_tmpdir"
- umask $save_mktempdir_umask
+ save_mktempdir_umask=`umask`
+ umask 0077
+ $MKDIR "$my_tmpdir"
+ umask $save_mktempdir_umask
fi
# If we're not in dry-run mode, bomb out on failure
- test -d "$my_tmpdir" || {
- $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
- exit $EXIT_FAILURE
- }
+ test -d "$my_tmpdir" || \
+ func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
fi
- $echo "X$my_tmpdir" | $Xsed
+ $ECHO "X$my_tmpdir" | $Xsed
}
-# 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 ()
+# func_quote_for_eval arg
+# Aesthetically quote ARG to be evaled later.
+# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
+# is double-quoted, suitable for a subsequent eval, whereas
+# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
+# which are still active within double quotes backslashified.
+func_quote_for_eval ()
{
- 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 /{
- s,.*,import,
- p
- q
- }
- }'`
- case $win32_nmres in
- import*) win32_libid_type="x86 archive import";;
- *) win32_libid_type="x86 archive static";;
- esac
- 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"
- ;;
+ case $1 in
+ *[\\\`\"\$]*)
+ func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
+ *)
+ func_quote_for_eval_unquoted_result="$1" ;;
+ esac
+
+ case $func_quote_for_eval_unquoted_result in
+ # Double-quote args containing shell metacharacters to delay
+ # word splitting, command substitution and and variable
+ # expansion for a subsequent eval.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
+ ;;
+ *)
+ func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
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 ()
+# func_quote_for_expand arg
+# Aesthetically quote ARG to be evaled later; same as above,
+# but do not quote variable references.
+func_quote_for_expand ()
{
- 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.
+ case $1 in
+ *[\\\`\"]*)
+ my_arg=`$ECHO "X$1" | $Xsed \
+ -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
*)
- 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
+ my_arg="$1" ;;
+ esac
+
+ case $my_arg in
+ # Double-quote args containing shell metacharacters to delay
+ # word splitting and command substitution for a subsequent eval.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ my_arg="\"$my_arg\""
+ ;;
+ esac
+
+ func_quote_for_expand_result="$my_arg"
}
-# func_extract_an_archive dir oldlib
-func_extract_an_archive ()
+# func_show_eval cmd [fail_exp]
+# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
+# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it.
+func_show_eval ()
{
- f_ex_an_ar_dir="$1"; shift
- f_ex_an_ar_oldlib="$1"
+ my_cmd="$1"
+ my_fail_exp="${2-:}"
- $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
+ ${opt_silent-false} || {
+ func_quote_for_expand "$my_cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+
+ if ${opt_dry_run-false}; then :; else
+ eval "$my_cmd"
+ my_status=$?
+ if test "$my_status" -eq 0; then :; else
+ eval "(exit $my_status); $my_fail_exp"
+ fi
fi
}
-# func_extract_archives gentop oldlib ...
-func_extract_archives ()
+
+# func_show_eval_locale cmd [fail_exp]
+# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
+# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
+# is given, then evaluate it. Use the saved locale for evaluation.
+func_show_eval_locale ()
{
- 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
+ my_cmd="$1"
+ my_fail_exp="${2-:}"
- 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_xlib_u=$my_xlib
- while :; do
- case " $extracted_archives " in
- *" $my_xlib_u "*)
- extracted_serial=`expr $extracted_serial + 1`
- my_xlib_u=lt$extracted_serial-$my_xlib ;;
- *) break ;;
- esac
- done
- extracted_archives="$extracted_archives $my_xlib_u"
- my_xdir="$my_gentop/$my_xlib_u"
+ ${opt_silent-false} || {
+ func_quote_for_expand "$my_cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
- $show "${rm}r $my_xdir"
- $run ${rm}r "$my_xdir"
- $show "$mkdir $my_xdir"
- $run $mkdir "$my_xdir"
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
- exit $exit_status
+ if ${opt_dry_run-false}; then :; else
+ eval "$lt_user_locale
+ $my_cmd"
+ my_status=$?
+ eval "$lt_safe_locale"
+ if test "$my_status" -eq 0; then :; else
+ eval "(exit $my_status); $my_fail_exp"
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"
+ fi
}
-# End of Shell function definitions
-#####################################
-# Darwin sucks
-eval std_shrext=\"$shrext_cmds\"
-disable_libs=no
-# Parse our command line options once, thoroughly.
-while test "$#" -gt 0
-do
- arg="$1"
+
+
+# func_version
+# Echo version message to standard output and exit.
+func_version ()
+{
+ $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
+ s/^# //
+ s/^# *$//
+ s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
+ p
+ }' < "$progpath"
+ exit $?
+}
+
+# func_usage
+# Echo short help message to standard output and exit.
+func_usage ()
+{
+ $SED -n '/^# Usage:/,/# -h/ {
+ s/^# //
+ s/^# *$//
+ s/\$progname/'$progname'/
+ p
+ }' < "$progpath"
+ $ECHO
+ $ECHO "run \`$progname --help | more' for full usage"
+ exit $?
+}
+
+# func_help
+# Echo long help message to standard output and exit.
+func_help ()
+{
+ $SED -n '/^# Usage:/,/# Report bugs to/ {
+ s/^# //
+ s/^# *$//
+ s*\$progname*'$progname'*
+ s*\$host*'"$host"'*
+ s*\$SHELL*'"$SHELL"'*
+ s*\$LTCC*'"$LTCC"'*
+ s*\$LTCFLAGS*'"$LTCFLAGS"'*
+ s*\$LD*'"$LD"'*
+ s/\$with_gnu_ld/'"$with_gnu_ld"'/
+ s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
+ s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
+ p
+ }' < "$progpath"
+ exit $?
+}
+
+# func_missing_arg argname
+# Echo program name prefixed message to standard error and set global
+# exit_cmd.
+func_missing_arg ()
+{
+ func_error "missing argument for $1"
+ exit_cmd=exit
+}
+
+exit_cmd=:
+
+
+
+
+
+# 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
- case $arg in
- -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
- *) optarg= ;;
- esac
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit $EXIT_SUCCESS
+fi
- # 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
+magic="%%%MAGIC variable%%%"
+magic_exe="%%%MAGIC EXE variable%%%"
- 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
+# Global variables.
+# $mode is unset
+nonopt=
+execute_dlfiles=
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
- prev=
- prevopt=
- continue
- fi
+opt_dry_run=false
+opt_duplicate_deps=false
+opt_silent=false
+opt_debug=:
- # Have we seen a non-optional argument yet?
- case $arg in
- --help)
- show_help=yes
- ;;
+# 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=
+
+# func_fatal_configuration arg...
+# Echo program name prefixed message to standard error, followed by
+# a configuration failure hint, and exit.
+func_fatal_configuration ()
+{
+ func_error ${1+"$@"}
+ func_error "See the $PACKAGE documentation for more information."
+ func_fatal_error "Fatal configuration error."
+}
- --version)
- echo "\
-$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
-Copyright (C) 2008 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."
- exit $?
- ;;
+# func_config
+# Display the configuration for all the tags in this script.
+func_config ()
+{
+ re_begincf='^# ### BEGIN LIBTOOL'
+ re_endcf='^# ### END LIBTOOL'
+
+ # Default configuration.
+ $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
- --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"
+ $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf 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=:
- ;;
+ exit $?
+}
- --features)
- $echo "host: $host"
+# func_features
+# Display the features supported by this script.
+func_features ()
+{
+ $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 $?
- ;;
+}
- --finish) mode="finish" ;;
+# func_enable_tag tagname
+# Verify that TAGNAME is valid, and either flag an error and exit, or
+# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
+# variable here.
+func_enable_tag ()
+{
+ # Global variable:
+ tagname="$1"
- --mode) prevopt="--mode" prev=mode ;;
- --mode=*) mode="$optarg" ;;
+ re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
+ re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
+ sed_extractcf="/$re_begincf/,/$re_endcf/p"
- --preserve-dup-deps) duplicate_deps="yes" ;;
+ # Validate tagname.
+ case $tagname in
+ *[!-_A-Za-z0-9,/]*)
+ func_fatal_error "invalid tag name: $tagname"
+ ;;
+ esac
- --quiet | --silent)
- show=:
- preserve_args="$preserve_args $arg"
- ;;
+ # Don't test for the "default" C tag, as we know it's
+ # there but not specially marked.
+ case $tagname in
+ CC) ;;
+ *)
+ if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
+ taglist="$taglist $tagname"
+
+ # Evaluate the configuration. Be careful to quote the path
+ # and the sed script, to avoid splitting on whitespace, but
+ # also don't use non-portable quotes within backquotes within
+ # quotes we have to do it in 2 steps:
+ extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
+ eval "$extractedcf"
+ else
+ func_error "ignoring unknown tag $tagname"
+ fi
+ ;;
+ esac
+}
+
+# Parse options once, thoroughly. This comes as soon as possible in
+# the script to make things like `libtool --version' happen quickly.
+{
- --tag)
- prevopt="--tag"
- prev=tag
- preserve_args="$preserve_args --tag"
+ # Shorthand for --mode=foo, only valid as the first argument
+ case $1 in
+ clean|clea|cle|cl)
+ shift; set dummy --mode clean ${1+"$@"}; shift
;;
- --tag=*)
- set tag "$optarg" ${1+"$@"}
- shift
- prev=tag
- preserve_args="$preserve_args --tag"
+ compile|compil|compi|comp|com|co|c)
+ shift; set dummy --mode compile ${1+"$@"}; shift
;;
-
- -dlopen)
- prevopt="-dlopen"
- prev=execute_dlfiles
+ execute|execut|execu|exec|exe|ex|e)
+ shift; set dummy --mode execute ${1+"$@"}; shift
;;
-
- -*)
- $echo "$modename: unrecognized option \`$arg'" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
+ finish|finis|fini|fin|fi|f)
+ shift; set dummy --mode finish ${1+"$@"}; shift
;;
-
- *)
- nonopt="$arg"
- break
+ install|instal|insta|inst|ins|in|i)
+ shift; set dummy --mode install ${1+"$@"}; shift
+ ;;
+ link|lin|li|l)
+ shift; set dummy --mode link ${1+"$@"}; shift
+ ;;
+ uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
+ shift; set dummy --mode uninstall ${1+"$@"}; shift
;;
esac
-done
-if test -n "$prevopt"; then
- $echo "$modename: option \`$prevopt' requires an argument" 1>&2
- $echo "$help" 1>&2
- exit $EXIT_FAILURE
-fi
+ # Parse non-mode specific arguments:
+ while test "$#" -gt 0; do
+ opt="$1"
+ shift
-case $disable_libs in
-no)
- ;;
-shared)
- build_libtool_libs=no
- build_old_libs=yes
- ;;
-static)
- build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
- ;;
-esac
+ case $opt in
+ --config) func_config ;;
-# 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=
+ --debug) preserve_args="$preserve_args $opt"
+ func_echo "enabling shell trace mode"
+ opt_debug='set -x'
+ $opt_debug
+ ;;
-if test -z "$show_help"; then
+ -dlopen) test "$#" -eq 0 && func_missing_arg "$opt" && break
+ execute_dlfiles="$execute_dlfiles $1"
+ shift
+ ;;
- # 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
+ --dry-run | -n) opt_dry_run=: ;;
+ --features) func_features ;;
+ --finish) mode="finish" ;;
+
+ --mode) test "$#" -eq 0 && func_missing_arg "$opt" && break
+ case $1 in
+ # Valid mode arguments:
+ clean) ;;
+ compile) ;;
+ execute) ;;
+ finish) ;;
+ install) ;;
+ link) ;;
+ relink) ;;
+ uninstall) ;;
+
+ # Catch anything else as an error
+ *) func_error "invalid argument for $opt"
+ exit_cmd=exit
+ break
+ ;;
+ esac
+
+ mode="$1"
+ shift
+ ;;
+
+ --preserve-dup-deps)
+ opt_duplicate_deps=: ;;
+
+ --quiet|--silent) preserve_args="$preserve_args $opt"
+ opt_silent=:
+ ;;
+
+ --verbose| -v) preserve_args="$preserve_args $opt"
+ opt_silent=false
+ ;;
+
+ --tag) test "$#" -eq 0 && func_missing_arg "$opt" && break
+ preserve_args="$preserve_args $opt $1"
+ func_enable_tag "$1" # tagname is set here
+ shift
+ ;;
+
+ # Separate optargs to long options:
+ -dlopen=*|--mode=*|--tag=*)
+ func_opt_split "$opt"
+ set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
+ shift
+ ;;
+
+ -\?|-h) func_usage ;;
+ --help) opt_help=: ;;
+ --version) func_version ;;
+
+ -*) func_fatal_help "unrecognized option \`$opt'" ;;
+
+ *) nonopt="$opt"
+ break
+ ;;
+ esac
+ done
+
+
+ case $host in
+ *cygwin* | *mingw* | *pw32* | *cegcc*)
+ # don't eliminate duplications in $postdeps and $predeps
+ opt_duplicate_compiler_generated_deps=:
;;
*)
- # If we have no mode, but dlfiles were specified, then do execute mode.
- test -n "$execute_dlfiles" && mode=execute
+ opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
+ ;;
+ esac
- # 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
+ # Having warned about all mis-specified options, bail out if
+ # anything was wrong.
+ $exit_cmd $EXIT_FAILURE
+}
+
+# func_check_version_match
+# Ensure that we are using m4 macros, and libtool script from the same
+# release of libtool.
+func_check_version_match ()
+{
+ if test "$package_revision" != "$macro_revision"; then
+ if test "$VERSION" != "$macro_version"; then
+ if test -z "$macro_version"; then
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from an older release.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
+ else
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
+$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
+$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
+$progname: and run autoconf again.
+_LT_EOF
fi
- ;;
- esac
+ else
+ cat >&2 <<_LT_EOF
+$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
+$progname: but the definition of this LT_INIT comes from revision $macro_revision.
+$progname: You should recreate aclocal.m4 with macros from revision $package_revision
+$progname: of $PACKAGE $VERSION and run autoconf again.
+_LT_EOF
+ fi
+
+ exit $EXIT_MISMATCH
+ fi
+}
+
+
+## ----------- ##
+## Main. ##
+## ----------- ##
+
+$opt_help || {
+ # Sanity checks first:
+ func_check_version_match
+
+ if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ func_fatal_configuration "not configured to build any kind of library"
fi
+ test -z "$mode" && func_fatal_error "error: you must specify a MODE."
+
+
+ # Darwin sucks
+ eval std_shrext=\"$shrext_cmds\"
+
+
# 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
+ func_error "unrecognized option \`-dlopen'"
+ $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."
+ help="Try \`$progname --help --mode=$mode' for more information."
+}
+
+
+# func_lalib_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_lalib_p ()
+{
+ test -f "$1" &&
+ $SED -e 4q "$1" 2>/dev/null \
+ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
+}
+
+# func_lalib_unsafe_p file
+# True iff FILE is a libtool `.la' library or `.lo' object file.
+# This function implements the same check as func_lalib_p without
+# resorting to external programs. To this end, it redirects stdin and
+# closes it afterwards, without saving the original file descriptor.
+# As a safety measure, use it only where a negative result would be
+# fatal anyway. Works if `file' does not exist.
+func_lalib_unsafe_p ()
+{
+ lalib_p=no
+ if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
+ for lalib_p_l in 1 2 3 4
+ do
+ read lalib_p_line
+ case "$lalib_p_line" in
+ \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
+ esac
+ done
+ exec 0<&5 5<&-
+ fi
+ test "$lalib_p" = yes
+}
+
+# func_ltwrapper_script_p file
+# True iff FILE is a libtool wrapper script
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_script_p ()
+{
+ func_lalib_p "$1"
+}
+
+# func_ltwrapper_executable_p file
+# True iff FILE is a libtool wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_executable_p ()
+{
+ func_ltwrapper_exec_suffix=
+ case $1 in
+ *.exe) ;;
+ *) func_ltwrapper_exec_suffix=.exe ;;
+ esac
+ $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
+}
+
+# func_ltwrapper_scriptname file
+# Assumes file is an ltwrapper_executable
+# uses $file to determine the appropriate filename for a
+# temporary ltwrapper_script.
+func_ltwrapper_scriptname ()
+{
+ func_ltwrapper_scriptname_result=""
+ if func_ltwrapper_executable_p "$1"; then
+ func_dirname_and_basename "$1" "" "."
+ func_stripname '' '.exe' "$func_basename_result"
+ func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
+ fi
+}
- # These modes are in order of execution frequency so that they run quickly.
- case $mode in
- # libtool compile mode
- compile)
- modename="$modename: compile"
+# func_ltwrapper_p file
+# True iff FILE is a libtool wrapper script or wrapper executable
+# This function is only a basic sanity check; it will hardly flush out
+# determined imposters.
+func_ltwrapper_p ()
+{
+ func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
+}
+
+
+# func_execute_cmds commands fail_cmd
+# Execute tilde-delimited COMMANDS.
+# If FAIL_CMD is given, eval that upon failure.
+# FAIL_CMD may read-access the current command in variable CMD!
+func_execute_cmds ()
+{
+ $opt_debug
+ save_ifs=$IFS; IFS='~'
+ for cmd in $1; do
+ IFS=$save_ifs
+ eval cmd=\"$cmd\"
+ func_show_eval "$cmd" "${2-:}"
+ done
+ IFS=$save_ifs
+}
+
+
+# func_source file
+# Source FILE, adding directory component if necessary.
+# Note that it is not necessary on cygwin/mingw to append a dot to
+# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
+# behavior happens only for exec(3), not for open(2)! Also, sourcing
+# `FILE.' does not work on cygwin managed mounts.
+func_source ()
+{
+ $opt_debug
+ case $1 in
+ */* | *\\*) . "$1" ;;
+ *) . "./$1" ;;
+ esac
+}
+
+
+# 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 ()
+{
+ $opt_debug
+ if test -n "$available_tags" && test -z "$tagname"; then
+ CC_quoted=
+ for arg in $CC; do
+ func_quote_for_eval "$arg"
+ CC_quoted="$CC_quoted $func_quote_for_eval_result"
+ 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.
+ func_quote_for_eval "$arg"
+ CC_quoted="$CC_quoted $func_quote_for_eval_result"
+ 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
+ func_echo "unable to infer tagged configuration"
+ func_fatal_error "specify a tag with \`--tag'"
+# else
+# func_verbose "using $tagname tagged configuration"
+ fi
+ ;;
+ esac
+ fi
+}
+
+
+
+# func_write_libtool_object output_name pic_name nonpic_name
+# Create a libtool object file (analogous to a ".la" file),
+# but don't create it if we're doing a dry run.
+func_write_libtool_object ()
+{
+ write_libobj=${1}
+ if test "$build_libtool_libs" = yes; then
+ write_lobj=\'${2}\'
+ else
+ write_lobj=none
+ fi
+
+ if test "$build_old_libs" = yes; then
+ write_oldobj=\'${3}\'
+ else
+ write_oldobj=none
+ fi
+
+ $opt_dry_run || {
+ cat >${write_libobj}T <<EOF
+# $write_libobj - a libtool object file
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+pic_object=$write_lobj
+
+# Name of the non-PIC object
+non_pic_object=$write_oldobj
+
+EOF
+ $MV "${write_libobj}T" "${write_libobj}"
+ }
+}
+
+# func_mode_compile arg...
+func_mode_compile ()
+{
+ $opt_debug
# Get the compilation command and the source file.
base_compile=
srcfile="$nonopt" # always keep a non-empty value in "srcfile"
@@ -664,6 +1109,7 @@ if test -z "$show_help"; then
arg_mode=normal
libobj=
later=
+ pie_flag=
for arg
do
@@ -684,15 +1130,18 @@ if test -z "$show_help"; then
# 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
+ test -n "$libobj" && \
+ func_fatal_error "you cannot specify \`-o' more than once"
arg_mode=target
continue
;;
- -static | -prefer-pic | -prefer-non-pic)
+ -pie | -fpie | -fPIE)
+ pie_flag="$pie_flag $arg"
+ continue
+ ;;
+
+ -shared | -static | -prefer-pic | -prefer-non-pic)
later="$later $arg"
continue
;;
@@ -708,31 +1157,25 @@ if test -z "$show_help"; then
;; # replaced later. I would guess that would be a bug.
-Wc,*)
- args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
+ func_stripname '-Wc,' '' "$arg"
+ args=$func_stripname_result
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.
- # 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"
+ func_quote_for_eval "$arg"
+ lastarg="$lastarg $func_quote_for_eval_result"
done
IFS="$save_ifs"
- lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
+ func_stripname ' ' '' "$lastarg"
+ lastarg=$func_stripname_result
# 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.
#
@@ -744,66 +1187,42 @@ if test -z "$show_help"; then
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.
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- lastarg="\"$lastarg\""
- ;;
- esac
-
- base_compile="$base_compile $lastarg"
+ func_quote_for_eval "$lastarg"
+ base_compile="$base_compile $func_quote_for_eval_result"
done # for arg
case $arg_mode in
arg)
- $echo "$modename: you must specify an argument for -Xcompile"
- exit $EXIT_FAILURE
+ func_fatal_error "you must specify an argument for -Xcompile"
;;
target)
- $echo "$modename: you must specify a target with \`-o'" 1>&2
- exit $EXIT_FAILURE
+ func_fatal_error "you must specify a target with \`-o'"
;;
*)
# Get the name of the library object.
- [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
+ test -z "$libobj" && {
+ func_basename "$srcfile"
+ libobj="$func_basename_result"
+ }
;;
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 ;;
- *.[fF][09]?) xform=[fF][09]. ;;
- *.for) xform=for ;;
- *.java) xform=java ;;
- *.obj) xform=obj ;;
- *.sx) xform=sx ;;
+ *.[cCFSifmso] | \
+ *.ada | *.adb | *.ads | *.asm | \
+ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
+ *.[fF][09]? | *.for | *.java | *.obj | *.sx)
+ func_xform "$libobj"
+ libobj=$func_xform_result
+ ;;
esac
- libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
-
case $libobj in
- *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
+ *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
*)
- $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
- exit $EXIT_FAILURE
+ func_fatal_error "cannot determine name of library object from \`$libobj'"
;;
esac
@@ -811,7 +1230,15 @@ if test -z "$show_help"; then
for arg in $later; do
case $arg in
+ -shared)
+ test "$build_libtool_libs" != yes && \
+ func_fatal_configuration "can not build a shared library"
+ build_old_libs=no
+ continue
+ ;;
+
-static)
+ build_libtool_libs=no
build_old_libs=yes
continue
;;
@@ -828,28 +1255,17 @@ if test -z "$show_help"; then
esac
done
- qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
- case $qlibobj in
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- qlibobj="\"$qlibobj\"" ;;
- esac
- test "X$libobj" != "X$qlibobj" \
- && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
- && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
- 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
+ func_quote_for_eval "$libobj"
+ test "X$libobj" != "X$func_quote_for_eval_result" \
+ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
+ && func_warning "libobj name \`$libobj' may not contain shell special characters."
+ func_dirname_and_basename "$obj" "/" ""
+ objname="$func_basename_result"
+ xdir="$func_dirname_result"
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
+ test -z "$base_compile" && \
+ func_fatal_help "you must specify a compilation command"
# Delete any leftover library objects.
if test "$build_old_libs" = yes; then
@@ -858,12 +1274,9 @@ if test -z "$show_help"; then
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*)
+ cygwin* | mingw* | pw32* | os2* | cegcc*)
pic_mode=default
;;
esac
@@ -875,10 +1288,8 @@ if test -z "$show_help"; then
# 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}
+ 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
@@ -888,13 +1299,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
- $show "Waiting for $lockfile to be removed"
+ until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
+ func_echo "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`
@@ -905,34 +1316,22 @@ 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
+ $opt_dry_run || $RM $removelist
exit $EXIT_FAILURE
fi
- $echo "$srcfile" > "$lockfile"
+ removelist="$removelist $output_obj"
+ $ECHO "$srcfile" > "$lockfile"
fi
+ $opt_dry_run || $RM $removelist
+ removelist="$removelist $lockfile"
+ trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
+
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
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- 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 <<EOF
-# $libobj - a libtool object file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# Name of the PIC object.
-EOF
+ func_quote_for_eval "$srcfile"
+ qsrcfile=$func_quote_for_eval_result
# Only build a PIC object if we are building libtool libraries.
if test "$build_libtool_libs" = yes; then
@@ -946,32 +1345,19 @@ EOF
command="$base_compile $qsrcfile"
fi
- if test ! -d "${xdir}$objdir"; then
- $show "$mkdir ${xdir}$objdir"
- $run $mkdir ${xdir}$objdir
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
- exit $exit_status
- fi
- fi
+ func_mkdir_p "$xdir$objdir"
if test -z "$output_obj"; then
# Place PIC objects in $objdir
command="$command -o $lobj"
fi
- $run $rm "$lobj" "$output_obj"
-
- $show "$command"
- if $run eval $lt_env "$command"; then :
- else
- test -n "$output_obj" && $run $rm $removelist
- exit $EXIT_FAILURE
- fi
+ func_show_eval_locale "$command" \
+ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
if test "$need_locks" = warn &&
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
- $echo "\
+ $ECHO "\
*** ERROR, $lockfile contains:
`cat $lockfile 2>/dev/null`
@@ -985,45 +1371,27 @@ 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
+ $opt_dry_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
+ func_show_eval '$MV "$output_obj" "$lobj"' \
+ 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
fi
- # Append the name of the PIC object to the libtool object file.
- test -z "$run" && cat >> ${libobj}T <<EOF
-pic_object='$objdir/$objname'
-
-EOF
-
# Allow error messages only from the first compilation.
if test "$suppress_opt" = yes; then
- suppress_output=' >/dev/null 2>&1'
+ suppress_output=' >/dev/null 2>&1'
fi
- else
- # No PIC object so indicate it doesn't exist in the libtool
- # object file.
- test -z "$run" && cat >> ${libobj}T <<EOF
-pic_object=none
-
-EOF
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 $qsrcfile"
+ command="$base_compile $qsrcfile$pie_flag"
else
command="$base_compile $qsrcfile $pic_flag"
fi
@@ -1033,17 +1401,12 @@ EOF
# Suppress compiler output if we already did a PIC compilation.
command="$command$suppress_output"
- $run $rm "$obj" "$output_obj"
- $show "$command"
- if $run eval $lt_env "$command"; then :
- else
- $run $rm $removelist
- exit $EXIT_FAILURE
- fi
+ func_show_eval_locale "$command" \
+ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
if test "$need_locks" = warn &&
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
- $echo "\
+ $ECHO "\
*** ERROR, $lockfile contains:
`cat $lockfile 2>/dev/null`
@@ -1057,53 +1420,2620 @@ 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
+ $opt_dry_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 :
+ func_show_eval '$MV "$output_obj" "$obj"' \
+ 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+ fi
+ fi
+
+ $opt_dry_run || {
+ func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
+
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ removelist=$lockfile
+ $RM "$lockfile"
+ fi
+ }
+
+ exit $EXIT_SUCCESS
+}
+
+$opt_help || {
+test "$mode" = compile && func_mode_compile ${1+"$@"}
+}
+
+func_mode_help ()
+{
+ # We need to display help for each of the modes.
+ case $mode in
+ "")
+ # Generic help is extracted from the usage comments
+ # at the start of this file.
+ func_help
+ ;;
+
+ clean)
+ $ECHO \
+"Usage: $progname [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: $progname [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
+ -no-suppress do not suppress compiler output for multiple passes
+ -prefer-pic try to building PIC objects only
+ -prefer-non-pic try to building non-PIC objects only
+ -shared do not build a \`.o' file suitable for static linking
+ -static only 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: $progname [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: $progname [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: $progname [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 following components of INSTALL-COMMAND are treated specially:
+
+ -inst-prefix PREFIX-DIR Use PREFIX-DIR as a staging area for installation
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+ link)
+ $ECHO \
+"Usage: $progname [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
+ -shared only do dynamic linking of libtool libraries
+ -shrext SUFFIX override the standard shared library file extension
+ -static do not do any dynamic linking of uninstalled libtool libraries
+ -static-libtool-libs
+ do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+ -weak LIBNAME declare that the target provides the LIBNAME interface
+
+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: $progname [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."
+ ;;
+
+ *)
+ func_fatal_help "invalid operation mode \`$mode'"
+ ;;
+ esac
+
+ $ECHO
+ $ECHO "Try \`$progname --help' for more information about other modes."
+
+ exit $?
+}
+
+ # Now that we've collected a possible --mode arg, show help if necessary
+ $opt_help && func_mode_help
+
+
+# func_mode_execute arg...
+func_mode_execute ()
+{
+ $opt_debug
+ # The first argument is the command name.
+ cmd="$nonopt"
+ test -z "$cmd" && \
+ func_fatal_help "you must specify a COMMAND"
+
+ # Handle -dlopen flags immediately.
+ for file in $execute_dlfiles; do
+ test -f "$file" \
+ || func_fatal_help "\`$file' is not a file"
+
+ dir=
+ case $file in
+ *.la)
+ # Check to see that this really is a libtool archive.
+ func_lalib_unsafe_p "$file" \
+ || func_fatal_help "\`$lib' is not a valid libtool archive"
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+ func_source "$file"
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && \
+ func_warning "\`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+
+ if test -f "$dir/$objdir/$dlname"; then
+ dir="$dir/$objdir"
else
- error=$?
- $run $rm $removelist
- exit $error
+ if test ! -f "$dir/$dlname"; then
+ func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
+ fi
fi
+ ;;
+
+ *.lo)
+ # Just add the directory containing the .lo file.
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+ ;;
+
+ *)
+ func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
+ 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
- # 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 <<EOF
-# Name of the non-PIC object.
-non_pic_object='$objname'
+ # This variable tells wrapper scripts just to set shlibpath_var
+ # rather than running their programs.
+ libtool_execute_magic="$magic"
-EOF
+ # 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 func_ltwrapper_script_p "$file"; then
+ func_source "$file"
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ elif func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ func_source "$func_ltwrapper_scriptname_result"
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ fi
+ ;;
+ esac
+ # Quote arguments (to preserve shell metacharacters).
+ func_quote_for_eval "$file"
+ args="$args $func_quote_for_eval_result"
+ done
+
+ if test "X$opt_dry_run" = Xfalse; then
+ if test -n "$shlibpath_var"; then
+ # Export the shlibpath_var.
+ eval "export $shlibpath_var"
+ fi
+
+ # Restore saved environment variables
+ for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+ do
+ eval "if test \"\${save_$lt_var+set}\" = set; then
+ $lt_var=\$save_$lt_var; export $lt_var
+ else
+ $lt_unset $lt_var
+ fi"
+ done
+
+ # Now prepare to actually exec the command.
+ exec_cmd="\$cmd$args"
else
- # 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 <<EOF
-# Name of the non-PIC object.
-non_pic_object=none
+ # 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 $EXIT_SUCCESS
+ fi
+}
-EOF
+test "$mode" = execute && func_mode_execute ${1+"$@"}
+
+
+# func_mode_finish arg...
+func_mode_finish ()
+{
+ $opt_debug
+ 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.
+ func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
+'"$cmd"'"'
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $opt_dry_run || eval "$cmds" || admincmds="$admincmds
+ $cmds"
+ fi
+ done
fi
- $run $mv "${libobj}T" "${libobj}"
+ # Exit here if they wanted silent mode.
+ $opt_silent && exit $EXIT_SUCCESS
+
+ $ECHO "X----------------------------------------------------------------------" | $Xsed
+ $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\"
- # Unlock the critical section if it was locked
- if test "$need_locks" != no; then
- $run $rm "$lockfile"
+ $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"
+ case $host in
+ solaris2.[6789]|solaris2.1[0-9])
+ $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
+ $ECHO "pages."
+ ;;
+ *)
+ $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
+ ;;
+ esac
+ $ECHO "X----------------------------------------------------------------------" | $Xsed
exit $EXIT_SUCCESS
+}
+
+test "$mode" = finish && func_mode_finish ${1+"$@"}
+
+
+# func_mode_install arg...
+func_mode_install ()
+{
+ $opt_debug
+ # 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" | $GREP shtool >/dev/null; then
+ # Aesthetically quote it.
+ func_quote_for_eval "$nonopt"
+ install_prog="$func_quote_for_eval_result "
+ arg=$1
+ shift
+ else
+ install_prog=
+ arg=$nonopt
+ fi
+
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ func_quote_for_eval "$arg"
+ install_prog="$install_prog$func_quote_for_eval_result"
+
+ # 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)
+ case " $install_prog " in
+ *[\\\ /]cp\ *) ;;
+ *) prev=$arg ;;
+ esac
+ ;;
+ -g | -m | -o)
+ prev=$arg
+ ;;
+ -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.
+ func_quote_for_eval "$arg"
+ install_prog="$install_prog $func_quote_for_eval_result"
+ done
+
+ test -z "$install_prog" && \
+ func_fatal_help "you must specify an install program"
+
+ test -n "$prev" && \
+ func_fatal_help "the \`$prev' option requires an argument"
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ func_fatal_help "no file or destination specified"
+ else
+ func_fatal_help "you must specify a destination"
+ fi
+ fi
+
+ # Strip any trailing slash from the destination.
+ func_stripname '' '/' "$dest"
+ dest=$func_stripname_result
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ func_dirname_and_basename "$dest" "" "."
+ destdir="$func_dirname_result"
+ destname="$func_basename_result"
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files; shift
+ test "$#" -gt 1 && \
+ func_fatal_help "\`$dest' is not a directory"
+ fi
+ case $destdir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case $file in
+ *.lo) ;;
+ *)
+ func_fatal_help "\`$destdir' must be an absolute directory name"
+ ;;
+ 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.
+ func_lalib_unsafe_p "$file" \
+ || func_fatal_help "\`$file' is not a valid libtool archive"
+
+ library_names=
+ old_library=
+ relink_command=
+ func_source "$file"
+
+ # 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
+
+ func_dirname "$file" "/" ""
+ dir="$func_dirname_result"
+ dir="$dir$objdir"
+
+ if test -n "$relink_command"; then
+ # Determine the prefix the user has applied to our future dir.
+ inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "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.
+ test "$inst_prefix_dir" = "$destdir" && \
+ func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
+
+ if test -n "$inst_prefix_dir"; then
+ # Stick the inst_prefix_dir data into the link command.
+ relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
+ else
+ relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
+ fi
+
+ func_warning "relinking \`$file'"
+ func_show_eval "$relink_command" \
+ 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
+ fi
+
+ # See the names of the shared library.
+ set dummy $library_names; shift
+ if test -n "$1"; then
+ realname="$1"
+ shift
+
+ srcname="$realname"
+ test -n "$relink_command" && srcname="$realname"T
+
+ # Install the shared library and build the symlinks.
+ func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
+ 'exit $?'
+ tstripme="$stripme"
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ case $realname in
+ *.dll.a)
+ tstripme=""
+ ;;
+ esac
+ ;;
+ esac
+ if test -n "$tstripme" && test -n "$striplib"; then
+ func_show_eval "$striplib $destdir/$realname" 'exit $?'
+ fi
+
+ if test "$#" -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ # Try `ln -sf' first, because the `ln' binary might depend on
+ # the symlink we replace! Solaris /bin/ln does not understand -f,
+ # so we also need to try rm && ln -s.
+ for linkname
+ do
+ test "$linkname" != "$realname" \
+ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ func_execute_cmds "$postinstall_cmds" 'exit $?'
+ fi
+
+ # Install the pseudo-library for information purposes.
+ func_basename "$file"
+ name="$func_basename_result"
+ instname="$dir/$name"i
+ func_show_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
+ func_basename "$file"
+ destfile="$func_basename_result"
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case $destfile in
+ *.lo)
+ func_lo2o "$destfile"
+ staticdest=$func_lo2o_result
+ ;;
+ *.$objext)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ func_fatal_help "cannot copy a libtool object to \`$destfile'"
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ test -n "$destfile" && \
+ func_show_eval "$install_prog $file $destfile" 'exit $?'
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ func_lo2o "$file"
+ staticobj=$func_lo2o_result
+ func_show_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
+ func_basename "$file"
+ destfile="$func_basename_result"
+ 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
+ func_stripname '' '.exe' "$file"
+ file=$func_stripname_result
+ stripped_ext=".exe"
+ fi
+ ;;
+ esac
+
+ # Do a test to see if this is really a libtool program.
+ case $host in
+ *cygwin* | *mingw*)
+ if func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ wrapper=$func_ltwrapper_scriptname_result
+ else
+ func_stripname '' '.exe' "$file"
+ wrapper=$func_stripname_result
+ fi
+ ;;
+ *)
+ wrapper=$file
+ ;;
+ esac
+ if func_ltwrapper_script_p "$wrapper"; then
+ notinst_deplibs=
+ relink_command=
+
+ func_source "$wrapper"
+
+ # Check the variables that should have been set.
+ test -z "$generated_by_libtool_version" && \
+ func_fatal_error "invalid libtool wrapper script \`$wrapper'"
+
+ finalize=yes
+ for lib in $notinst_deplibs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ func_source "$lib"
+ fi
+ libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ func_warning "\`$lib' has not been installed in \`$libdir'"
+ finalize=no
+ fi
+ done
+
+ relink_command=
+ func_source "$wrapper"
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ $opt_dry_run || {
+ if test "$finalize" = yes; then
+ tmpdir=`func_mktempdir`
+ func_basename "$file$stripped_ext"
+ file="$func_basename_result"
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
+
+ $opt_silent || {
+ func_quote_for_expand "$relink_command"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ if eval "$relink_command"; then :
+ else
+ func_error "error: relink \`$file' with the above command before installing it"
+ $opt_dry_run || ${RM}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ func_warning "cannot relink \`$file'"
+ 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 anyway
+ case $install_prog,$host in
+ */usr/bin/install*,*cygwin*)
+ case $file:$destfile in
+ *.exe:*.exe)
+ # this is ok
+ ;;
+ *.exe:*)
+ destfile=$destfile.exe
+ ;;
+ *:*.exe)
+ func_stripname '' '.exe' "$destfile"
+ destfile=$func_stripname_result
+ ;;
+ esac
+ ;;
+ esac
+ func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
+ $opt_dry_run || if test -n "$outputname"; then
+ ${RM}r "$tmpdir"
+ fi
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ func_basename "$file"
+ name="$func_basename_result"
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+
+ func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
+
+ if test -n "$stripme" && test -n "$old_striplib"; then
+ func_show_eval "$old_striplib $oldlib" 'exit $?'
+ fi
+
+ # Do each command in the postinstall commands.
+ func_execute_cmds "$old_postinstall_cmds" 'exit $?'
+ done
+
+ test -n "$future_libdirs" && \
+ func_warning "remember to run \`$progname --finish$future_libdirs'"
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ $opt_dry_run && current_libdirs=" -n$current_libdirs"
+ exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+ else
+ exit $EXIT_SUCCESS
+ fi
+}
+
+test "$mode" = install && func_mode_install ${1+"$@"}
+
+
+# func_generate_dlsyms outputname originator pic_p
+# Extract symbols from dlprefiles and create ${outputname}S.o with
+# a dlpreopen symbol table.
+func_generate_dlsyms ()
+{
+ $opt_debug
+ my_outputname="$1"
+ my_originator="$2"
+ my_pic_p="${3-no}"
+ my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
+ my_dlsyms=
+
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ my_dlsyms="${my_outputname}S.c"
+ else
+ func_error "not configured to extract global symbols from dlpreopened files"
+ fi
+ fi
+
+ if test -n "$my_dlsyms"; then
+ case $my_dlsyms in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${my_outputname}.nm"
+
+ func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
+
+ # Parse the name list into a source file.
+ func_verbose "creating $output_objdir/$my_dlsyms"
+
+ $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
+/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
+/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ func_verbose "generating symbol list for \`$output'"
+
+ $opt_dry_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 progfile in $progfiles; do
+ func_verbose "extracting global C symbols from \`$progfile'"
+ $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $opt_dry_run || {
+ eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ }
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $opt_dry_run || {
+ eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ }
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$outputname.exp"
+ $opt_dry_run || {
+ $RM $export_symbols
+ eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ }
+ else
+ $opt_dry_run || {
+ eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+ eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+ eval '$MV "$nlist"T "$nlist"'
+ case $host in
+ *cygwin | *mingw* | *cegcc* )
+ eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ }
+ fi
+ fi
+
+ for dlprefile in $dlprefiles; do
+ func_verbose "extracting global C symbols from \`$dlprefile'"
+ func_basename "$dlprefile"
+ name="$func_basename_result"
+ $opt_dry_run || {
+ eval '$ECHO ": $name " >> "$nlist"'
+ eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
+ }
+ done
+
+ $opt_dry_run || {
+ # 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 >/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/$my_dlsyms"'
+ else
+ $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
+ fi
+
+ $ECHO >> "$output_objdir/$my_dlsyms" "\
+
+/* The mapping between symbol names and symbols. */
+typedef struct {
+ const char *name;
+ void *address;
+} lt_dlsymlist;
+"
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ $ECHO >> "$output_objdir/$my_dlsyms" "\
+/* DATA imports from DLLs on WIN32 con't be const, because
+ runtime relocations are performed -- see ld's documentation
+ on pseudo-relocs. */"
+ lt_dlsym_const= ;;
+ *osf5*)
+ echo >> "$output_objdir/$my_dlsyms" "\
+/* This system does not cope well with relocations in const data */"
+ lt_dlsym_const= ;;
+ *)
+ lt_dlsym_const=const ;;
+ esac
+
+ $ECHO >> "$output_objdir/$my_dlsyms" "\
+extern $lt_dlsym_const lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[];
+$lt_dlsym_const lt_dlsymlist
+lt_${my_prefix}_LTX_preloaded_symbols[] =
+{\
+ { \"$my_originator\", (void *) 0 },"
+
+ case $need_lib_prefix in
+ no)
+ eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
+ ;;
+ *)
+ eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
+ ;;
+ esac
+ $ECHO >> "$output_objdir/$my_dlsyms" "\
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_${my_prefix}_LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ } # !$opt_dry_run
+
+ pic_flag_for_symtable=
+ case "$compile_command " in
+ *" -static "*) ;;
+ *)
+ 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*)
+ pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
+ *-*-hpux*)
+ pic_flag_for_symtable=" $pic_flag" ;;
+ *)
+ if test "X$my_pic_p" != Xno; then
+ pic_flag_for_symtable=" $pic_flag"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ symtab_cflags=
+ for arg in $LTCFLAGS; do
+ case $arg in
+ -pie | -fpie | -fPIE) ;;
+ *) symtab_cflags="$symtab_cflags $arg" ;;
+ esac
+ done
+
+ # Now compile the dynamic symbol file.
+ func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
+
+ # Clean up the generated files.
+ func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
+
+ # Transform the symbol file into the correct name.
+ symfileobj="$output_objdir/${my_outputname}S.$objext"
+ case $host in
+ *cygwin* | *mingw* | *cegcc* )
+ if test -f "$output_objdir/$my_outputname.def"; then
+ compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+ finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
+ else
+ compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+ finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+ fi
+ ;;
+ *)
+ compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+ finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
+ ;;
+ esac
+ ;;
+ *)
+ func_fatal_error "unknown suffix for \`$my_dlsyms'"
+ ;;
+ 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
+}
+
+# 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 ()
+{
+ $opt_debug
+ 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 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+ win32_nmres=`eval $NM -f posix -A $1 |
+ $SED -n -e '
+ 1,100{
+ / I /{
+ s,.*,import,
+ p
+ q
+ }
+ }'`
+ case $win32_nmres in
+ import*) win32_libid_type="x86 archive import";;
+ *) win32_libid_type="x86 archive static";;
+ esac
+ 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_extract_an_archive dir oldlib
+func_extract_an_archive ()
+{
+ $opt_debug
+ f_ex_an_ar_dir="$1"; shift
+ f_ex_an_ar_oldlib="$1"
+ func_show_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
+ func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
+ fi
+}
+
+
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
+{
+ $opt_debug
+ my_gentop="$1"; shift
+ my_oldlibs=${1+"$@"}
+ my_oldobjs=""
+ my_xlib=""
+ my_xabs=""
+ my_xdir=""
+
+ 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
+ func_basename "$my_xlib"
+ my_xlib="$func_basename_result"
+ my_xlib_u=$my_xlib
+ while :; do
+ case " $extracted_archives " in
+ *" $my_xlib_u "*)
+ func_arith $extracted_serial + 1
+ extracted_serial=$func_arith_result
+ my_xlib_u=lt$extracted_serial-$my_xlib ;;
+ *) break ;;
+ esac
+ done
+ extracted_archives="$extracted_archives $my_xlib_u"
+ my_xdir="$my_gentop/$my_xlib_u"
+
+ func_mkdir_p "$my_xdir"
+
+ case $host in
+ *-darwin*)
+ func_verbose "Extracting $my_xabs"
+ # Do not bother doing anything if just a dry run
+ $opt_dry_run || {
+ 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 | $GREP Architectures 2>/dev/null || true`
+ if test -n "$darwin_arches"; then
+ darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
+ darwin_arch=
+ func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
+ for darwin_arch in $darwin_arches ; do
+ func_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've a bunch of thin objects, gotta fatten them up :)
+ darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
+ 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
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ fi # $darwin_arches
+ } # !$opt_dry_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"
+}
+
+
+
+# func_emit_wrapper_part1 [arg=no]
+#
+# Emit the first part of a libtool wrapper script on stdout.
+# For more information, see the description associated with
+# func_emit_wrapper(), below.
+func_emit_wrapper_part1 ()
+{
+ func_emit_wrapper_part1_arg1=no
+ if test -n "$1" ; then
+ func_emit_wrapper_part1_arg1=$1
+ fi
+
+ $ECHO "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+#
+# 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'
+
+# 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+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# 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 variables:
+ generated_by_libtool_version='$macro_version'
+ 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 "\
+
+ # 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
+"
+}
+# end: func_emit_wrapper_part1
+
+# func_emit_wrapper_part2 [arg=no]
+#
+# Emit the second part of a libtool wrapper script on stdout.
+# For more information, see the description associated with
+# func_emit_wrapper(), below.
+func_emit_wrapper_part2 ()
+{
+ func_emit_wrapper_part2_arg1=no
+ if test -n "$1" ; then
+ func_emit_wrapper_part2_arg1=$1
+ fi
+
+ $ECHO "\
+
+ # Usually 'no', except on cygwin/mingw when embedded into
+ # the cwrapper.
+ WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
+ if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
+ # special case for '.'
+ if test \"\$thisdir\" = \".\"; then
+ thisdir=\`pwd\`
+ fi
+ # remove .libs from thisdir
+ case \"\$thisdir\" in
+ *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
+ $objdir ) thisdir=. ;;
+ esac
+ fi
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ $ECHO "\
+ 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 "\
+
+ # 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 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 "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ $ECHO "\
+
+ 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 "\
+ # 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 "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ $ECHO "\
+ 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* | *-cegcc*)
+ $ECHO "\
+ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
+ ;;
+
+ *)
+ $ECHO "\
+ exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
+ ;;
+ esac
+ $ECHO "\
+ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
+ 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\
+"
+}
+# end: func_emit_wrapper_part2
+
+
+# func_emit_wrapper [arg=no]
+#
+# Emit a libtool wrapper script on stdout.
+# Don't directly open a file because we may want to
+# incorporate the script contents within a cygwin/mingw
+# wrapper executable. Must ONLY be called from within
+# func_mode_link because it depends on a number of variables
+# set therein.
+#
+# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
+# variable will take. If 'yes', then the emitted script
+# will assume that the directory in which it is stored is
+# the $objdir directory. This is a cygwin/mingw-specific
+# behavior.
+func_emit_wrapper ()
+{
+ func_emit_wrapper_arg1=no
+ if test -n "$1" ; then
+ func_emit_wrapper_arg1=$1
+ fi
+
+ # split this up so that func_emit_cwrapperexe_src
+ # can call each part independently.
+ func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
+ func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
+}
+
+
+# func_to_host_path arg
+#
+# Convert paths to host format when used with build tools.
+# Intended for use with "native" mingw (where libtool itself
+# is running under the msys shell), or in the following cross-
+# build environments:
+# $build $host
+# mingw (msys) mingw [e.g. native]
+# cygwin mingw
+# *nix + wine mingw
+# where wine is equipped with the `winepath' executable.
+# In the native mingw case, the (msys) shell automatically
+# converts paths for any non-msys applications it launches,
+# but that facility isn't available from inside the cwrapper.
+# Similar accommodations are necessary for $host mingw and
+# $build cygwin. Calling this function does no harm for other
+# $host/$build combinations not listed above.
+#
+# ARG is the path (on $build) that should be converted to
+# the proper representation for $host. The result is stored
+# in $func_to_host_path_result.
+func_to_host_path ()
+{
+ func_to_host_path_result="$1"
+ if test -n "$1" ; then
+ case $host in
+ *mingw* )
+ lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+ case $build in
+ *mingw* ) # actually, msys
+ # awkward: cmd appends spaces to result
+ lt_sed_strip_trailing_spaces="s/[ ]*\$//"
+ func_to_host_path_tmp1=`( cmd //c echo "$1" |\
+ $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
+ func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+ $SED -e "$lt_sed_naive_backslashify"`
+ ;;
+ *cygwin* )
+ func_to_host_path_tmp1=`cygpath -w "$1"`
+ func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+ $SED -e "$lt_sed_naive_backslashify"`
+ ;;
+ * )
+ # Unfortunately, winepath does not exit with a non-zero
+ # error code, so we are forced to check the contents of
+ # stdout. On the other hand, if the command is not
+ # found, the shell will set an exit code of 127 and print
+ # *an error message* to stdout. So we must check for both
+ # error code of zero AND non-empty stdout, which explains
+ # the odd construction:
+ func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
+ if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
+ func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
+ $SED -e "$lt_sed_naive_backslashify"`
+ else
+ # Allow warning below.
+ func_to_host_path_result=""
+ fi
+ ;;
+ esac
+ if test -z "$func_to_host_path_result" ; then
+ func_error "Could not determine host path corresponding to"
+ func_error " '$1'"
+ func_error "Continuing, but uninstalled executables may not work."
+ # Fallback:
+ func_to_host_path_result="$1"
+ fi
+ ;;
+ esac
+ fi
+}
+# end: func_to_host_path
+
+# func_to_host_pathlist arg
+#
+# Convert pathlists to host format when used with build tools.
+# See func_to_host_path(), above. This function supports the
+# following $build/$host combinations (but does no harm for
+# combinations not listed here):
+# $build $host
+# mingw (msys) mingw [e.g. native]
+# cygwin mingw
+# *nix + wine mingw
+#
+# Path separators are also converted from $build format to
+# $host format. If ARG begins or ends with a path separator
+# character, it is preserved (but converted to $host format)
+# on output.
+#
+# ARG is a pathlist (on $build) that should be converted to
+# the proper representation on $host. The result is stored
+# in $func_to_host_pathlist_result.
+func_to_host_pathlist ()
+{
+ func_to_host_pathlist_result="$1"
+ if test -n "$1" ; then
+ case $host in
+ *mingw* )
+ lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
+ # Remove leading and trailing path separator characters from
+ # ARG. msys behavior is inconsistent here, cygpath turns them
+ # into '.;' and ';.', and winepath ignores them completely.
+ func_to_host_pathlist_tmp2="$1"
+ # Once set for this call, this variable should not be
+ # reassigned. It is used in tha fallback case.
+ func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
+ $SED -e 's|^:*||' -e 's|:*$||'`
+ case $build in
+ *mingw* ) # Actually, msys.
+ # Awkward: cmd appends spaces to result.
+ lt_sed_strip_trailing_spaces="s/[ ]*\$//"
+ func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
+ $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
+ func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
+ $SED -e "$lt_sed_naive_backslashify"`
+ ;;
+ *cygwin* )
+ func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
+ func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
+ $SED -e "$lt_sed_naive_backslashify"`
+ ;;
+ * )
+ # unfortunately, winepath doesn't convert pathlists
+ func_to_host_pathlist_result=""
+ func_to_host_pathlist_oldIFS=$IFS
+ IFS=:
+ for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
+ IFS=$func_to_host_pathlist_oldIFS
+ if test -n "$func_to_host_pathlist_f" ; then
+ func_to_host_path "$func_to_host_pathlist_f"
+ if test -n "$func_to_host_path_result" ; then
+ if test -z "$func_to_host_pathlist_result" ; then
+ func_to_host_pathlist_result="$func_to_host_path_result"
+ else
+ func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
+ fi
+ fi
+ fi
+ IFS=:
+ done
+ IFS=$func_to_host_pathlist_oldIFS
+ ;;
+ esac
+ if test -z "$func_to_host_pathlist_result" ; then
+ func_error "Could not determine the host path(s) corresponding to"
+ func_error " '$1'"
+ func_error "Continuing, but uninstalled executables may not work."
+ # Fallback. This may break if $1 contains DOS-style drive
+ # specifications. The fix is not to complicate the expression
+ # below, but for the user to provide a working wine installation
+ # with winepath so that path translation in the cross-to-mingw
+ # case works properly.
+ lt_replace_pathsep_nix_to_dos="s|:|;|g"
+ func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
+ $SED -e "$lt_replace_pathsep_nix_to_dos"`
+ fi
+ # Now, add the leading and trailing path separators back
+ case "$1" in
+ :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
+ ;;
+ esac
+ case "$1" in
+ *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+}
+# end: func_to_host_pathlist
+
+# func_emit_cwrapperexe_src
+# emit the source code for a wrapper executable on stdout
+# Must ONLY be called from within func_mode_link because
+# it depends on a number of variable set therein.
+func_emit_cwrapperexe_src ()
+{
+ cat <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+ Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+
+ The $output program cannot be directly executed until all the libtool
+ libraries that it depends on are installed.
+
+ This wrapper executable should never be moved out of the build directory.
+ If it is, it will not operate correctly.
+
+ Currently, it simply execs the wrapper *script* "$SHELL $output",
+ but could eventually absorb all of the scripts functionality and
+ exec $objdir/$outputname directly.
+*/
+EOF
+ cat <<"EOF"
+#include <stdio.h>
+#include <stdlib.h>
+#ifdef _MSC_VER
+# include <direct.h>
+# include <process.h>
+# include <io.h>
+# define setmode _setmode
+#else
+# include <unistd.h>
+# include <stdint.h>
+# ifdef __CYGWIN__
+# include <io.h>
+# define HAVE_SETENV
+# ifdef __STRICT_ANSI__
+char *realpath (const char *, char *);
+int putenv (char *);
+int setenv (const char *, const char *, int);
+# endif
+# endif
+#endif
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <sys/stat.h>
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef S_IXOTH
+# define S_IXOTH 0
+#endif
+#ifndef S_IXGRP
+# define S_IXGRP 0
+#endif
+
+#ifdef _MSC_VER
+# define S_IXUSR _S_IEXEC
+# define stat _stat
+# ifndef _INTPTR_T_DEFINED
+# define intptr_t int
+# endif
+#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
+# define FOPEN_WB "wb"
+# 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 */
+
+#ifdef __CYGWIN__
+# define FOPEN_WB "wb"
+#endif
+
+#ifndef FOPEN_WB
+# define FOPEN_WB "w"
+#endif
+#ifndef _O_BINARY
+# define _O_BINARY 0
+#endif
+
+#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+ if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+#undef LTWRAPPER_DEBUGPRINTF
+#if defined DEBUGWRAPPER
+# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
+static void
+ltwrapper_debugprintf (const char *fmt, ...)
+{
+ va_list args;
+ va_start (args, fmt);
+ (void) vfprintf (stderr, fmt, args);
+ va_end (args);
+}
+#else
+# define LTWRAPPER_DEBUGPRINTF(args)
+#endif
+
+const char *program_name = NULL;
+
+void *xmalloc (size_t num);
+char *xstrdup (const char *string);
+const char *base_name (const char *name);
+char *find_executable (const char *wrapper);
+char *chase_symlinks (const char *pathspec);
+int make_executable (const char *path);
+int check_executable (const char *path);
+char *strendzap (char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+void lt_setenv (const char *name, const char *value);
+char *lt_extend_str (const char *orig_value, const char *add, int to_end);
+void lt_opt_process_env_set (const char *arg);
+void lt_opt_process_env_prepend (const char *arg);
+void lt_opt_process_env_append (const char *arg);
+int lt_split_name_value (const char *arg, char** name, char** value);
+void lt_update_exe_path (const char *name, const char *value);
+void lt_update_lib_path (const char *name, const char *value);
+
+static const char *script_text_part1 =
+EOF
+
+ func_emit_wrapper_part1 yes |
+ $SED -e 's/\([\\"]\)/\\\1/g' \
+ -e 's/^/ "/' -e 's/$/\\n"/'
+ echo ";"
+ cat <<EOF
+
+static const char *script_text_part2 =
+EOF
+ func_emit_wrapper_part2 yes |
+ $SED -e 's/\([\\"]\)/\\\1/g' \
+ -e 's/^/ "/' -e 's/$/\\n"/'
+ echo ";"
+
+ cat <<EOF
+const char * MAGIC_EXE = "$magic_exe";
+const char * LIB_PATH_VARNAME = "$shlibpath_var";
+EOF
+
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ func_to_host_pathlist "$temp_rpath"
+ cat <<EOF
+const char * LIB_PATH_VALUE = "$func_to_host_pathlist_result";
+EOF
+ else
+ cat <<"EOF"
+const char * LIB_PATH_VALUE = "";
+EOF
+ fi
+
+ if test -n "$dllsearchpath"; then
+ func_to_host_pathlist "$dllsearchpath:"
+ cat <<EOF
+const char * EXE_PATH_VARNAME = "PATH";
+const char * EXE_PATH_VALUE = "$func_to_host_pathlist_result";
+EOF
+ else
+ cat <<"EOF"
+const char * EXE_PATH_VARNAME = "";
+const char * EXE_PATH_VALUE = "";
+EOF
+ fi
+
+ if test "$fast_install" = yes; then
+ cat <<EOF
+const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
+EOF
+ else
+ cat <<EOF
+const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
+EOF
+ fi
+
+
+ cat <<"EOF"
+
+#define LTWRAPPER_OPTION_PREFIX "--lt-"
+#define LTWRAPPER_OPTION_PREFIX_LENGTH 5
+
+static const size_t opt_prefix_len = LTWRAPPER_OPTION_PREFIX_LENGTH;
+static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
+
+static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
+
+static const size_t env_set_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
+static const char *env_set_opt = LTWRAPPER_OPTION_PREFIX "env-set";
+ /* argument is putenv-style "foo=bar", value of foo is set to bar */
+
+static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
+static const char *env_prepend_opt = LTWRAPPER_OPTION_PREFIX "env-prepend";
+ /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
+
+static const size_t env_append_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
+static const char *env_append_opt = LTWRAPPER_OPTION_PREFIX "env-append";
+ /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
+
+int
+main (int argc, char *argv[])
+{
+ char **newargz;
+ int newargc;
+ char *tmp_pathspec;
+ char *actual_cwrapper_path;
+ char *actual_cwrapper_name;
+ char *target_name;
+ char *lt_argv_zero;
+ intptr_t rval = 127;
+
+ int i;
+
+ program_name = (char *) xstrdup (base_name (argv[0]));
+ LTWRAPPER_DEBUGPRINTF (("(main) argv[0] : %s\n", argv[0]));
+ LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
+
+ /* very simple arg parsing; don't want to rely on getopt */
+ for (i = 1; i < argc; i++)
+ {
+ if (strcmp (argv[i], dumpscript_opt) == 0)
+ {
+EOF
+ case "$host" in
+ *mingw* | *cygwin* )
+ # make stdout use "unix" line endings
+ echo " setmode(1,_O_BINARY);"
+ ;;
+ esac
+
+ cat <<"EOF"
+ printf ("%s", script_text_part1);
+ printf ("%s", script_text_part2);
+ return 0;
+ }
+ }
+
+ newargz = XMALLOC (char *, argc + 1);
+ tmp_pathspec = find_executable (argv[0]);
+ if (tmp_pathspec == NULL)
+ lt_fatal ("Couldn't find %s", argv[0]);
+ LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
+ tmp_pathspec));
+
+ actual_cwrapper_path = chase_symlinks (tmp_pathspec);
+ LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
+ actual_cwrapper_path));
+ XFREE (tmp_pathspec);
+
+ actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
+ strendzap (actual_cwrapper_path, actual_cwrapper_name);
+
+ /* wrapper name transforms */
+ strendzap (actual_cwrapper_name, ".exe");
+ tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
+ XFREE (actual_cwrapper_name);
+ actual_cwrapper_name = tmp_pathspec;
+ tmp_pathspec = 0;
+
+ /* target_name transforms -- use actual target program name; might have lt- prefix */
+ target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
+ strendzap (target_name, ".exe");
+ tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
+ XFREE (target_name);
+ target_name = tmp_pathspec;
+ tmp_pathspec = 0;
+
+ LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
+ target_name));
+EOF
+
+ cat <<EOF
+ newargz[0] =
+ XMALLOC (char, (strlen (actual_cwrapper_path) +
+ strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
+ strcpy (newargz[0], actual_cwrapper_path);
+ strcat (newargz[0], "$objdir");
+ strcat (newargz[0], "/");
+EOF
+
+ cat <<"EOF"
+ /* stop here, and copy so we don't have to do this twice */
+ tmp_pathspec = xstrdup (newargz[0]);
+
+ /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
+ strcat (newargz[0], actual_cwrapper_name);
+
+ /* DO want the lt- prefix here if it exists, so use target_name */
+ lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
+ XFREE (tmp_pathspec);
+ tmp_pathspec = NULL;
+EOF
+
+ case $host_os in
+ mingw*)
+ cat <<"EOF"
+ {
+ char* p;
+ while ((p = strchr (newargz[0], '\\')) != NULL)
+ {
+ *p = '/';
+ }
+ while ((p = strchr (lt_argv_zero, '\\')) != NULL)
+ {
+ *p = '/';
+ }
+ }
+EOF
+ ;;
+ esac
+
+ cat <<"EOF"
+ XFREE (target_name);
+ XFREE (actual_cwrapper_path);
+ XFREE (actual_cwrapper_name);
+
+ lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
+ lt_setenv ("DUALCASE", "1"); /* for MSK sh */
+ lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
+ lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
+
+ newargc=0;
+ for (i = 1; i < argc; i++)
+ {
+ if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
+ {
+ if (argv[i][env_set_opt_len] == '=')
+ {
+ const char *p = argv[i] + env_set_opt_len + 1;
+ lt_opt_process_env_set (p);
+ }
+ else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
+ {
+ lt_opt_process_env_set (argv[++i]); /* don't copy */
+ }
+ else
+ lt_fatal ("%s missing required argument", env_set_opt);
+ continue;
+ }
+ if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
+ {
+ if (argv[i][env_prepend_opt_len] == '=')
+ {
+ const char *p = argv[i] + env_prepend_opt_len + 1;
+ lt_opt_process_env_prepend (p);
+ }
+ else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
+ {
+ lt_opt_process_env_prepend (argv[++i]); /* don't copy */
+ }
+ else
+ lt_fatal ("%s missing required argument", env_prepend_opt);
+ continue;
+ }
+ if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
+ {
+ if (argv[i][env_append_opt_len] == '=')
+ {
+ const char *p = argv[i] + env_append_opt_len + 1;
+ lt_opt_process_env_append (p);
+ }
+ else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
+ {
+ lt_opt_process_env_append (argv[++i]); /* don't copy */
+ }
+ else
+ lt_fatal ("%s missing required argument", env_append_opt);
+ continue;
+ }
+ if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
+ {
+ /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
+ namespace, but it is not one of the ones we know about and
+ have already dealt with, above (inluding dump-script), then
+ report an error. Otherwise, targets might begin to believe
+ they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
+ namespace. The first time any user complains about this, we'll
+ need to make LTWRAPPER_OPTION_PREFIX a configure-time option
+ or a configure.ac-settable value.
+ */
+ lt_fatal ("Unrecognized option in %s namespace: '%s'",
+ ltwrapper_option_prefix, argv[i]);
+ }
+ /* otherwise ... */
+ newargz[++newargc] = xstrdup (argv[i]);
+ }
+ newargz[++newargc] = NULL;
+
+ LTWRAPPER_DEBUGPRINTF (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
+ for (i = 0; i < newargc; i++)
+ {
+ LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d] : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
+ }
+
+EOF
+
+ case $host_os in
+ mingw*)
+ cat <<"EOF"
+ /* execv doesn't actually work on mingw as expected on unix */
+ rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
+ if (rval == -1)
+ {
+ /* failed to start process */
+ LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
+ return 127;
+ }
+ return rval;
+EOF
+ ;;
+ *)
+ cat <<"EOF"
+ execv (lt_argv_zero, newargz);
+ return rval; /* =127, but avoids unused variable warning */
+EOF
+ ;;
+ esac
+
+ cat <<"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;
+}
+
+const char *
+base_name (const char *name)
+{
+ const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ /* Skip over the disk name in MSDOS pathnames. */
+ if (isalpha ((unsigned char) name[0]) && name[1] == ':')
+ name += 2;
+#endif
+
+ for (base = name; *name; name++)
+ if (IS_DIR_SEPARATOR (*name))
+ base = name + 1;
+ return base;
+}
+
+int
+check_executable (const char *path)
+{
+ struct stat st;
+
+ LTWRAPPER_DEBUGPRINTF (("(check_executable) : %s\n",
+ path ? (*path ? path : "EMPTY!") : "NULL!"));
+ if ((!path) || (!*path))
+ return 0;
+
+ if ((stat (path, &st) >= 0)
+ && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
+ return 1;
+ else
+ return 0;
+}
+
+int
+make_executable (const char *path)
+{
+ int rval = 0;
+ struct stat st;
+
+ LTWRAPPER_DEBUGPRINTF (("(make_executable) : %s\n",
+ path ? (*path ? path : "EMPTY!") : "NULL!"));
+ if ((!path) || (!*path))
+ return 0;
+
+ if (stat (path, &st) >= 0)
+ {
+ rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
+ }
+ return rval;
+}
+
+/* Searches for the full path of the wrapper. Returns
+ newly allocated full path name if found, NULL otherwise
+ Does not chase symlinks, even on platforms that support them.
+*/
+char *
+find_executable (const char *wrapper)
+{
+ int has_slash = 0;
+ const char *p;
+ const char *p_next;
+ /* static buffer for getcwd */
+ char tmp[LT_PATHMAX + 1];
+ int tmp_len;
+ char *concat_name;
+
+ LTWRAPPER_DEBUGPRINTF (("(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 ((unsigned char) 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 *
+chase_symlinks (const char *pathspec)
+{
+#ifndef S_ISLNK
+ return xstrdup (pathspec);
+#else
+ char buf[LT_PATHMAX];
+ struct stat s;
+ char *tmp_pathspec = xstrdup (pathspec);
+ char *p;
+ int has_symlinks = 0;
+ while (strlen (tmp_pathspec) && !has_symlinks)
+ {
+ LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
+ tmp_pathspec));
+ if (lstat (tmp_pathspec, &s) == 0)
+ {
+ if (S_ISLNK (s.st_mode) != 0)
+ {
+ has_symlinks = 1;
+ break;
+ }
+
+ /* search backwards for last DIR_SEPARATOR */
+ p = tmp_pathspec + strlen (tmp_pathspec) - 1;
+ while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+ p--;
+ if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
+ {
+ /* no more DIR_SEPARATORS left */
+ break;
+ }
+ *p = '\0';
+ }
+ else
+ {
+ char *errstr = strerror (errno);
+ lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
+ }
+ }
+ XFREE (tmp_pathspec);
+
+ if (!has_symlinks)
+ {
+ return xstrdup (pathspec);
+ }
+
+ tmp_pathspec = realpath (pathspec, buf);
+ if (tmp_pathspec == 0)
+ {
+ lt_fatal ("Could not follow symlinks for %s", pathspec);
+ }
+ return xstrdup (tmp_pathspec);
+#endif
+}
+
+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);
+}
- # libtool link mode
- link | relink)
- modename="$modename: link"
+void
+lt_fatal (const char *message, ...)
+{
+ va_list ap;
+ va_start (ap, message);
+ lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+ va_end (ap);
+}
+
+void
+lt_setenv (const char *name, const char *value)
+{
+ LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
+ (name ? name : "<NULL>"),
+ (value ? value : "<NULL>")));
+ {
+#ifdef HAVE_SETENV
+ /* always make a copy, for consistency with !HAVE_SETENV */
+ char *str = xstrdup (value);
+ setenv (name, str, 1);
+#else
+ int len = strlen (name) + 1 + strlen (value) + 1;
+ char *str = XMALLOC (char, len);
+ sprintf (str, "%s=%s", name, value);
+ if (putenv (str) != EXIT_SUCCESS)
+ {
+ XFREE (str);
+ }
+#endif
+ }
+}
+
+char *
+lt_extend_str (const char *orig_value, const char *add, int to_end)
+{
+ char *new_value;
+ if (orig_value && *orig_value)
+ {
+ int orig_value_len = strlen (orig_value);
+ int add_len = strlen (add);
+ new_value = XMALLOC (char, add_len + orig_value_len + 1);
+ if (to_end)
+ {
+ strcpy (new_value, orig_value);
+ strcpy (new_value + orig_value_len, add);
+ }
+ else
+ {
+ strcpy (new_value, add);
+ strcpy (new_value + add_len, orig_value);
+ }
+ }
+ else
+ {
+ new_value = xstrdup (add);
+ }
+ return new_value;
+}
+
+int
+lt_split_name_value (const char *arg, char** name, char** value)
+{
+ const char *p;
+ int len;
+ if (!arg || !*arg)
+ return 1;
+
+ p = strchr (arg, (int)'=');
+
+ if (!p)
+ return 1;
+
+ *value = xstrdup (++p);
+
+ len = strlen (arg) - strlen (*value);
+ *name = XMALLOC (char, len);
+ strncpy (*name, arg, len-1);
+ (*name)[len - 1] = '\0';
+
+ return 0;
+}
+
+void
+lt_opt_process_env_set (const char *arg)
+{
+ char *name = NULL;
+ char *value = NULL;
+
+ if (lt_split_name_value (arg, &name, &value) != 0)
+ {
+ XFREE (name);
+ XFREE (value);
+ lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
+ }
+
+ lt_setenv (name, value);
+ XFREE (name);
+ XFREE (value);
+}
+
+void
+lt_opt_process_env_prepend (const char *arg)
+{
+ char *name = NULL;
+ char *value = NULL;
+ char *new_value = NULL;
+
+ if (lt_split_name_value (arg, &name, &value) != 0)
+ {
+ XFREE (name);
+ XFREE (value);
+ lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
+ }
+
+ new_value = lt_extend_str (getenv (name), value, 0);
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ XFREE (name);
+ XFREE (value);
+}
+
+void
+lt_opt_process_env_append (const char *arg)
+{
+ char *name = NULL;
+ char *value = NULL;
+ char *new_value = NULL;
+
+ if (lt_split_name_value (arg, &name, &value) != 0)
+ {
+ XFREE (name);
+ XFREE (value);
+ lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
+ }
+
+ new_value = lt_extend_str (getenv (name), value, 1);
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ XFREE (name);
+ XFREE (value);
+}
+
+void
+lt_update_exe_path (const char *name, const char *value)
+{
+ LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
+ (name ? name : "<NULL>"),
+ (value ? value : "<NULL>")));
+
+ if (name && *name && value && *value)
+ {
+ char *new_value = lt_extend_str (getenv (name), value, 0);
+ /* some systems can't cope with a ':'-terminated path #' */
+ int len = strlen (new_value);
+ while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
+ {
+ new_value[len-1] = '\0';
+ }
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ }
+}
+
+void
+lt_update_lib_path (const char *name, const char *value)
+{
+ LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
+ (name ? name : "<NULL>"),
+ (value ? value : "<NULL>")));
+
+ if (name && *name && value && *value)
+ {
+ char *new_value = lt_extend_str (getenv (name), value, 0);
+ lt_setenv (name, new_value);
+ XFREE (new_value);
+ }
+}
+
+
+EOF
+}
+# end: func_emit_cwrapperexe_src
+
+# func_mode_link arg...
+func_mode_link ()
+{
+ $opt_debug
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
# 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
@@ -1121,10 +4051,10 @@ EOF
allow_undefined=yes
;;
esac
- libtool_args="$nonopt"
+ libtool_args=$nonopt
base_compile="$nonopt $@"
- compile_command="$nonopt"
- finalize_command="$nonopt"
+ compile_command=$nonopt
+ finalize_command=$nonopt
compile_rpath=
finalize_rpath=
@@ -1139,6 +4069,7 @@ EOF
dllsearchpath=
lib_search_path=`pwd`
inst_prefix_dir=
+ new_inherited_linker_flags=
avoid_version=no
dlfiles=
@@ -1154,7 +4085,6 @@ EOF
no_install=no
objs=
non_pic_objects=
- notinst_path= # paths that contain not-installed libtool libraries
precious_files_regex=
prefer_static_libs=no
preload=no
@@ -1168,19 +4098,25 @@ EOF
thread_safe=no
vinfo=
vinfo_number=no
+ weak_libs=
single_module="${wl}-single_module"
-
func_infer_tag $base_compile
# We need to know -static, to get the right output filenames.
for arg
do
case $arg in
+ -shared)
+ test "$build_libtool_libs" != yes && \
+ func_fatal_configuration "can not build a shared library"
+ build_old_libs=no
+ break
+ ;;
-all-static | -static | -static-libtool-libs)
case $arg in
-all-static)
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
+ func_warning "complete static linking is impossible in this configuration"
fi
if test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
@@ -1214,20 +4150,16 @@ EOF
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"
+ func_quote_for_eval "$arg"
+ qarg=$func_quote_for_eval_unquoted_result
+ func_append libtool_args " $func_quote_for_eval_result"
# 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@"
+ func_append compile_command " @OUTPUT@"
+ func_append finalize_command " @OUTPUT@"
;;
esac
@@ -1235,8 +4167,8 @@ EOF
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@"
+ func_append compile_command " @SYMFILE@"
+ func_append finalize_command " @SYMFILE@"
preload=yes
fi
case $arg in
@@ -1274,10 +4206,8 @@ EOF
;;
expsyms)
export_symbols="$arg"
- if test ! -f "$arg"; then
- $echo "$modename: symbol file \`$arg' does not exist"
- exit $EXIT_FAILURE
- fi
+ test -f "$arg" \
+ || func_fatal_error "symbol file \`$arg' does not exist"
prev=
continue
;;
@@ -1286,18 +4216,21 @@ EOF
prev=
continue
;;
- inst_prefix)
- inst_prefix_dir="$arg"
- prev=
- continue
- ;;
- precious_regex)
- precious_files_regex="$arg"
+ framework)
+ case $host in
+ *-*-darwin*)
+ case "$deplibs " in
+ *" $qarg.ltframework "*) ;;
+ *) deplibs="$deplibs $qarg.ltframework" # this is fixed later
+ ;;
+ esac
+ ;;
+ esac
prev=
continue
;;
- release)
- release="-$arg"
+ inst_prefix)
+ inst_prefix_dir="$arg"
prev=
continue
;;
@@ -1305,39 +4238,30 @@ EOF
if test -f "$arg"; then
save_arg=$arg
moreargs=
- for fil in `cat $save_arg`
+ 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
+ if func_lalib_unsafe_p "$arg"; 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
+ func_source "$arg"
- if test -z "$pic_object" || \
+ if test -z "$pic_object" ||
test -z "$non_pic_object" ||
- test "$pic_object" = none && \
+ test "$pic_object" = none &&
test "$non_pic_object" = none; then
- $echo "$modename: cannot find name of object for \`$arg'" 1>&2
- exit $EXIT_FAILURE
+ func_fatal_error "cannot find name of object for \`$arg'"
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
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
if test "$pic_object" != none; then
# Prepend the subdirectory the object is found in.
@@ -1362,7 +4286,7 @@ EOF
fi
# A PIC object.
- libobjs="$libobjs $pic_object"
+ func_append libobjs " $pic_object"
arg="$pic_object"
fi
@@ -1372,7 +4296,7 @@ EOF
non_pic_object="$xdir$non_pic_object"
# A standard non-PIC object
- non_pic_objects="$non_pic_objects $non_pic_object"
+ func_append non_pic_objects " $non_pic_object"
if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object"
fi
@@ -1380,46 +4304,48 @@ EOF
# If the PIC object exists, use it instead.
# $xdir was prepended to $pic_object above.
non_pic_object="$pic_object"
- non_pic_objects="$non_pic_objects $non_pic_object"
+ func_append non_pic_objects " $non_pic_object"
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.
-
+ if $opt_dry_run; then
# 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"
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ func_lo2o "$arg"
+ pic_object=$xdir$objdir/$func_lo2o_result
+ non_pic_object=$xdir$func_lo2o_result
+ func_append libobjs " $pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ else
+ func_fatal_error "\`$arg' is not a valid libtool object"
fi
fi
done
else
- $echo "$modename: link input file \`$save_arg' does not exist"
- exit $EXIT_FAILURE
+ func_fatal_error "link input file \`$arg' does not exist"
fi
arg=$save_arg
prev=
continue
;;
+ precious_regex)
+ precious_files_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 $EXIT_FAILURE
+ func_fatal_error "only absolute run-paths are allowed"
;;
esac
if test "$prev" = rpath; then
@@ -1436,39 +4362,37 @@ EOF
prev=
continue
;;
- xcompiler)
- compiler_flags="$compiler_flags $qarg"
+ shrext)
+ shrext_cmds="$arg"
prev=
- compile_command="$compile_command $qarg"
- finalize_command="$finalize_command $qarg"
continue
;;
- xlinker)
- linker_flags="$linker_flags $qarg"
- compiler_flags="$compiler_flags $wl$qarg"
+ weak)
+ weak_libs="$weak_libs $arg"
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"
+ func_append compile_command " $qarg"
+ func_append finalize_command " $qarg"
continue
;;
- shrext)
- shrext_cmds="$arg"
+ xcompiler)
+ compiler_flags="$compiler_flags $qarg"
prev=
+ func_append compile_command " $qarg"
+ func_append finalize_command " $qarg"
continue
;;
- darwin_framework|darwin_framework_skip)
- test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
+ xlinker)
+ linker_flags="$linker_flags $qarg"
+ compiler_flags="$compiler_flags $wl$qarg"
prev=
+ func_append compile_command " $wl$qarg"
+ func_append finalize_command " $wl$qarg"
continue
;;
*)
@@ -1484,16 +4408,16 @@ EOF
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"
+ # See comment for -static flag below, for more details.
+ func_append compile_command " $link_static_flag"
+ func_append 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
+ func_fatal_error "\`-allow-undefined' must not be used because it is the default"
;;
-avoid-version)
@@ -1518,8 +4442,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
+ func_fatal_error "more than one -exported-symbols argument is not allowed"
fi
if test "X$arg" = "X-export-symbols"; then
prev=expsyms
@@ -1529,15 +4452,8 @@ EOF
continue
;;
- -framework|-arch|-isysroot)
- case " $CC " in
- *" ${arg} ${1} "* | *" ${arg} ${1} "*)
- prev=darwin_framework_skip ;;
- *) compiler_flags="$compiler_flags $arg"
- prev=darwin_framework ;;
- esac
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
+ -framework)
+ prev=framework
continue
;;
@@ -1551,25 +4467,30 @@ EOF
-L[A-Z][A-Z]*:*)
case $with_gcc/$host in
no/*-*-irix* | /*-*-irix*)
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
;;
esac
continue
;;
-L*)
- dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
+ func_stripname '-L' '' "$arg"
+ dir=$func_stripname_result
+ if test -z "$dir"; then
+ if test "$#" -gt 0; then
+ func_fatal_error "require no space between \`-L' and \`$1'"
+ else
+ func_fatal_error "need path for \`-L' option"
+ fi
+ fi
# 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
- absdir="$dir"
- notinst_path="$notinst_path $dir"
- fi
+ test -z "$absdir" && \
+ func_fatal_error "cannot determine absolute directory name of \`$dir'"
dir="$absdir"
;;
esac
@@ -1581,14 +4502,16 @@ EOF
;;
esac
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$dir:"*) ;;
+ ::) dllsearchpath=$dir;;
*) dllsearchpath="$dllsearchpath:$dir";;
esac
case :$dllsearchpath: in
*":$testbindir:"*) ;;
+ ::) dllsearchpath=$testbindir;;
*) dllsearchpath="$dllsearchpath:$testbindir";;
esac
;;
@@ -1599,7 +4522,7 @@ EOF
-l*)
if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
# These systems don't actually have a C or math library (as such)
continue
;;
@@ -1613,7 +4536,7 @@ EOF
;;
*-*-rhapsody* | *-*-darwin1.[012])
# Rhapsody C and math libraries are in the System framework
- deplibs="$deplibs -framework System"
+ deplibs="$deplibs System.ltframework"
continue
;;
*-*-sco3.2v5* | *-*-sco5v6*)
@@ -1637,20 +4560,30 @@ EOF
continue
;;
+ -module)
+ module=yes
+ continue
+ ;;
+
# Tru64 UNIX uses -model [arg] to determine the layout of C++
# classes, name mangling, and exception handling.
- -model)
- compile_command="$compile_command $arg"
+ # Darwin uses the -arch flag to determine output architecture.
+ -model|-arch|-isysroot)
compiler_flags="$compiler_flags $arg"
- finalize_command="$finalize_command $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
prev=xcompiler
continue
;;
- -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
compiler_flags="$compiler_flags $arg"
- compile_command="$compile_command $arg"
- finalize_command="$finalize_command $arg"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ case "$new_inherited_linker_flags " in
+ *" $arg "*) ;;
+ * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
+ esac
continue
;;
@@ -1659,44 +4592,6 @@ EOF
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
- # -m*, -t[45]*, -txscale* pass through architecture-specific
- # compiler args for GCC
- # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
- # -F/path gives path to uninstalled frameworks, gcc on darwin
- # @file GCC response files
- -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
- -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
-
- # 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"
- compiler_flags="$compiler_flags $arg"
- continue
- ;;
-
- -shrext)
- prev=shrext
- continue
- ;;
-
-no-fast-install)
fast_install=no
continue
@@ -1704,11 +4599,11 @@ EOF
-no-install)
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
# The PATH hackery in wrapper scripts is required on Windows
# and Darwin 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
+ func_warning "\`-no-install' is ignored for $host"
+ func_warning "assuming \`-no-fast-install' instead"
fast_install=no
;;
*) no_install=yes ;;
@@ -1749,13 +4644,13 @@ EOF
;;
-R*)
- dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
+ func_stripname '-R' '' "$arg"
+ dir=$func_stripname_result
# We need an absolute path.
case $dir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
- $echo "$modename: only absolute run-paths are allowed" 1>&2
- exit $EXIT_FAILURE
+ func_fatal_error "only absolute run-paths are allowed"
;;
esac
case "$xrpath " in
@@ -1765,6 +4660,16 @@ EOF
continue
;;
+ -shared)
+ # The effects of -shared are defined in a previous loop.
+ continue
+ ;;
+
+ -shrext)
+ prev=shrext
+ continue
+ ;;
+
-static | -static-libtool-libs)
# The effects of -static are defined in a previous loop.
# We used to do the same as -all-static on platforms that
@@ -1783,47 +4688,49 @@ EOF
prev=vinfo
continue
;;
+
-version-number)
prev=vinfo
vinfo_number=yes
continue
;;
+ -weak)
+ prev=weak
+ continue
+ ;;
+
-Wc,*)
- args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
+ func_stripname '-Wc,' '' "$arg"
+ args=$func_stripname_result
arg=
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"
+ func_quote_for_eval "$flag"
+ arg="$arg $wl$func_quote_for_eval_result"
+ compiler_flags="$compiler_flags $func_quote_for_eval_result"
done
IFS="$save_ifs"
- arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ func_stripname ' ' '' "$arg"
+ arg=$func_stripname_result
;;
-Wl,*)
- args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
+ func_stripname '-Wl,' '' "$arg"
+ args=$func_stripname_result
arg=
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"
+ func_quote_for_eval "$flag"
+ arg="$arg $wl$func_quote_for_eval_result"
+ compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
+ linker_flags="$linker_flags $func_quote_for_eval_result"
done
IFS="$save_ifs"
- arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
+ func_stripname ' ' '' "$arg"
+ arg=$func_stripname_result
;;
-Xcompiler)
@@ -1841,16 +4748,36 @@ EOF
continue
;;
+ # -msg_* for osf cc
+ -msg_*)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ ;;
+
+ # -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*, -t[45]*, -txscale* pass through architecture-specific
+ # compiler args for GCC
+ # -F/path gives path to uninstalled frameworks, gcc on darwin
+ # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
+ # @file GCC response files
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
+ compiler_flags="$compiler_flags $arg"
+ 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
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
;;
*.$objext)
@@ -1862,32 +4789,23 @@ EOF
# 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
+ if func_lalib_unsafe_p "$arg"; 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
+ func_source "$arg"
- if test -z "$pic_object" || \
+ if test -z "$pic_object" ||
test -z "$non_pic_object" ||
- test "$pic_object" = none && \
+ test "$pic_object" = none &&
test "$non_pic_object" = none; then
- $echo "$modename: cannot find name of object for \`$arg'" 1>&2
- exit $EXIT_FAILURE
+ func_fatal_error "cannot find name of object for \`$arg'"
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
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
if test "$pic_object" != none; then
# Prepend the subdirectory the object is found in.
@@ -1912,7 +4830,7 @@ EOF
fi
# A PIC object.
- libobjs="$libobjs $pic_object"
+ func_append libobjs " $pic_object"
arg="$pic_object"
fi
@@ -1922,7 +4840,7 @@ EOF
non_pic_object="$xdir$non_pic_object"
# A standard non-PIC object
- non_pic_objects="$non_pic_objects $non_pic_object"
+ func_append non_pic_objects " $non_pic_object"
if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object"
fi
@@ -1930,28 +4848,22 @@ EOF
# If the PIC object exists, use it instead.
# $xdir was prepended to $pic_object above.
non_pic_object="$pic_object"
- non_pic_objects="$non_pic_objects $non_pic_object"
+ func_append non_pic_objects " $non_pic_object"
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.
-
+ if $opt_dry_run; then
# 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"
+ func_dirname "$arg" "/" ""
+ xdir="$func_dirname_result"
+
+ func_lo2o "$arg"
+ pic_object=$xdir$objdir/$func_lo2o_result
+ non_pic_object=$xdir$func_lo2o_result
+ func_append libobjs " $pic_object"
+ func_append non_pic_objects " $non_pic_object"
+ else
+ func_fatal_error "\`$arg' is not a valid libtool object"
fi
fi
;;
@@ -1984,70 +4896,51 @@ EOF
*)
# 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
+ func_quote_for_eval "$arg"
+ arg="$func_quote_for_eval_result"
;;
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"
+ func_append compile_command " $arg"
+ func_append 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
+ test -n "$prev" && \
+ func_fatal_help "the \`$prevarg' option requires an argument"
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"
+ func_append compile_command " $arg"
+ func_append finalize_command " $arg"
fi
oldlibs=
# calculate the name of the file, without its directory
- outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
+ func_basename "$output"
+ outputname="$func_basename_result"
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\'\`
+ 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
+ func_dirname "$output" "/" ""
+ output_objdir="$func_dirname_result$objdir"
# Create the object directory.
- if test ! -d "$output_objdir"; then
- $show "$mkdir $output_objdir"
- $run $mkdir $output_objdir
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
- exit $exit_status
- fi
- fi
+ func_mkdir_p "$output_objdir"
# 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
+ func_fatal_help "you must specify an output file"
;;
*.$libext) linkmode=oldlib ;;
*.lo | *.$objext) linkmode=obj ;;
@@ -2055,22 +4948,13 @@ 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)
for deplib in $deplibs; do
- if test "X$duplicate_deps" = "Xyes" ; then
+ if $opt_duplicate_deps ; then
case "$libs " in
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
esac
@@ -2085,7 +4969,7 @@ EOF
# $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
+ if $opt_duplicate_compiler_generated_deps; then
for pre_post_dep in $predeps $postdeps; do
case "$pre_post_deps " in
*" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
@@ -2101,15 +4985,16 @@ EOF
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"
+ passes="conv dlpreopen 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
+ func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
;;
esac
done
@@ -2125,7 +5010,20 @@ EOF
*) passes="conv"
;;
esac
+
for pass in $passes; do
+ # The preopen pass in lib mode reverses $deplibs; put it back here
+ # so that -L comes before libs that need it for instance...
+ if test "$linkmode,$pass" = "lib,link"; then
+ ## FIXME: Find the place where the list is rebuilt in the wrong
+ ## order, and fix it there properly
+ tmp_deplibs=
+ for deplib in $deplibs; do
+ tmp_deplibs="$deplib $tmp_deplibs"
+ done
+ deplibs="$tmp_deplibs"
+ fi
+
if test "$linkmode,$pass" = "lib,link" ||
test "$linkmode,$pass" = "prog,scan"; then
libs="$deplibs"
@@ -2135,14 +5033,39 @@ EOF
case $pass in
dlopen) libs="$dlfiles" ;;
dlpreopen) libs="$dlprefiles" ;;
- link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
+ link)
+ libs="$deplibs %DEPLIBS%"
+ test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
+ ;;
esac
fi
+ if test "$linkmode,$pass" = "lib,dlpreopen"; then
+ # Collect and forward deplibs of preopened libtool libs
+ for lib in $dlprefiles; do
+ # Ignore non-libtool-libs
+ dependency_libs=
+ case $lib in
+ *.la) func_source "$lib" ;;
+ esac
+
+ # Collect preopened libtool deplibs, except any this library
+ # has declared as weak libs
+ for deplib in $dependency_libs; do
+ deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
+ case " $weak_libs " in
+ *" $deplib_base "*) ;;
+ *) deplibs="$deplibs $deplib" ;;
+ esac
+ done
+ done
+ libs="$dlprefiles"
+ fi
if test "$pass" = dlopen; then
# Collect dlpreopened libraries
save_deplibs="$deplibs"
deplibs=
fi
+
for deplib in $libs; do
lib=
found=no
@@ -2153,15 +5076,22 @@ EOF
finalize_deplibs="$deplib $finalize_deplibs"
else
compiler_flags="$compiler_flags $deplib"
+ if test "$linkmode" = lib ; then
+ case "$new_inherited_linker_flags " in
+ *" $deplib "*) ;;
+ * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
+ esac
+ fi
fi
continue
;;
-l*)
if test "$linkmode" != lib && test "$linkmode" != prog; then
- $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
+ func_warning "\`-l' is ignored for archives/objects"
continue
fi
- name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+ func_stripname '-l' '' "$deplib"
+ name=$func_stripname_result
if test "$linkmode" = lib; then
searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
else
@@ -2197,21 +5127,17 @@ EOF
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
+ if func_lalib_p "$lib"; then
library_names=
old_library=
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
+ func_source "$lib"
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="."
+ func_dirname "$lib" "" "."
+ ladir="$func_dirname_result"
lib=$ladir/$old_library
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
@@ -2223,19 +5149,35 @@ EOF
continue
fi
fi
- ;;
+ ;;
*) ;;
esac
fi
fi
;; # -l
+ *.ltframework)
+ if test "$linkmode,$pass" = "prog,link"; then
+ compile_deplibs="$deplib $compile_deplibs"
+ finalize_deplibs="$deplib $finalize_deplibs"
+ else
+ deplibs="$deplib $deplibs"
+ if test "$linkmode" = lib ; then
+ case "$new_inherited_linker_flags " in
+ *" $deplib "*) ;;
+ * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
+ esac
+ fi
+ fi
+ continue
+ ;;
-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//'`
+ func_stripname '-L' '' "$deplib"
+ newlib_search_path="$newlib_search_path $func_stripname_result"
;;
prog)
if test "$pass" = conv; then
@@ -2248,17 +5190,19 @@ EOF
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
fi
- newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
+ func_stripname '-L' '' "$deplib"
+ newlib_search_path="$newlib_search_path $func_stripname_result"
;;
*)
- $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
+ func_warning "\`-L' is ignored for archives/objects"
;;
esac # linkmode
continue
;; # -L
-R*)
if test "$pass" = link; then
- dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
+ func_stripname '-R' '' "$deplib"
+ dir=$func_stripname_result
# Make sure the xrpath contains only unique directories.
case "$xrpath " in
*" $dir "*) ;;
@@ -2276,35 +5220,41 @@ EOF
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 \
+ # Linking convenience modules into shared libraries is allowed,
+ # but linking other static libraries is non-portable.
+ case " $dlpreconveniencelibs " in
+ *" $deplib "*) ;;
+ *)
+ valid_a_lib=no
+ case $deplibs_check_method in
+ match_pattern*)
+ set dummy $deplibs_check_method; shift
+ match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+ if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
| $EGREP "$match_pattern_regex" > /dev/null; then
- valid_a_lib=yes
- fi
+ valid_a_lib=yes
+ fi
;;
- pass_all)
- valid_a_lib=yes
+ 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
+ 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 use here."
+ else
+ $ECHO
+ $ECHO "*** Warning: Linking the shared library $output against the"
+ $ECHO "*** static library $deplib is not portable!"
+ deplibs="$deplib $deplibs"
+ fi
+ ;;
+ esac
continue
;;
prog)
@@ -2339,21 +5289,18 @@ EOF
continue
;;
esac # case $deplib
+
if test "$found" = yes || test -f "$lib"; then :
else
- $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
- exit $EXIT_FAILURE
+ func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
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
+ func_lalib_unsafe_p "$lib" \
+ || func_fatal_error "\`$lib' is not a valid libtool archive"
- ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
- test "X$ladir" = "X$lib" && ladir="."
+ func_dirname "$lib" "" "."
+ ladir="$func_dirname_result"
dlname=
dlopen=
@@ -2361,6 +5308,7 @@ EOF
libdir=
library_names=
old_library=
+ inherited_linker_flags=
# If the library was installed with an old release of libtool,
# it will not redefine variables installed, or shouldnotlink
installed=yes
@@ -2369,11 +5317,19 @@ EOF
# Read the .la file
- case $lib in
- */* | *\\*) . $lib ;;
- *) . ./$lib ;;
- esac
-
+ func_source "$lib"
+
+ # Convert "-framework foo" to "foo.ltframework"
+ if test -n "$inherited_linker_flags"; then
+ tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
+ for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
+ case " $new_inherited_linker_flags " in
+ *" $tmp_inherited_linker_flag "*) ;;
+ *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
+ esac
+ done
+ fi
+ dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
if test "$linkmode,$pass" = "lib,link" ||
test "$linkmode,$pass" = "prog,scan" ||
{ test "$linkmode" != prog && test "$linkmode" != lib; }; then
@@ -2386,8 +5342,7 @@ EOF
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
+ func_fatal_error "cannot find name of link library for \`$lib'"
fi
# It is a libtool convenience library, so add in its objects.
convenience="$convenience $ladir/$objdir/$old_library"
@@ -2395,16 +5350,15 @@ EOF
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
+ if $opt_duplicate_deps ; 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
+ func_fatal_error "\`$lib' is not a convenience library"
fi
continue
fi # $pass = conv
@@ -2416,15 +5370,13 @@ EOF
linklib="$l"
done
if test -z "$linklib"; then
- $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
- exit $EXIT_FAILURE
+ func_fatal_error "cannot find name of link library for \`$lib'"
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
+ func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
fi
if test -z "$dlname" ||
test "$dlopen_support" != yes ||
@@ -2446,18 +5398,19 @@ EOF
*)
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
+ func_warning "cannot determine absolute directory name of \`$ladir'"
+ func_warning "passing it literally to the linker, although it might fail"
abs_ladir="$ladir"
fi
;;
esac
- laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+ func_basename "$lib"
+ laname="$func_basename_result"
# 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
+ func_warning "library \`$lib' was moved."
dir="$ladir"
absdir="$abs_ladir"
libdir="$abs_ladir"
@@ -2479,18 +5432,22 @@ EOF
notinst_path="$notinst_path $abs_ladir"
fi
fi # $installed = yes
- name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+ func_stripname 'lib' '.la' "$laname"
+ name=$func_stripname_result
# 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
+ if test -z "$libdir" && test "$linkmode" = prog; then
+ func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
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"
+ # Keep a list of preopened convenience libraries to check
+ # that they are being used correctly in the link pass.
+ test -z "$libdir" && \
+ dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
# Otherwise, use the dlname, so that lt_dlopen finds it.
elif test -n "$dlname"; then
newdlprefiles="$newdlprefiles $dir/$dlname"
@@ -2526,7 +5483,9 @@ EOF
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
+ -L*) func_stripname '-L' '' "$deplib"
+ newlib_search_path="$newlib_search_path $func_stripname_result"
+ ;;
esac
# Need to link against all dependency_libs?
if test "$linkalldeplibs" = yes; then
@@ -2536,7 +5495,7 @@ EOF
# or/and link against static libraries
newdependency_libs="$deplib $newdependency_libs"
fi
- if test "X$duplicate_deps" = "Xyes" ; then
+ if $opt_duplicate_deps ; then
case "$tmp_libs " in
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
esac
@@ -2549,15 +5508,14 @@ EOF
if test "$linkmode,$pass" = "prog,link"; then
if test -n "$library_names" &&
{ { test "$prefer_static_libs" = no ||
- test "$prefer_static_libs,$installed" = "built,yes"; } ||
+ test "$prefer_static_libs,$installed" = "built,yes"; } ||
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 $absdir" ;;
+ case "$temp_rpath:" in
+ *"$absdir:"*) ;;
+ *) temp_rpath="$temp_rpath$absdir:" ;;
esac
fi
@@ -2595,27 +5553,43 @@ EOF
link_static=no # Whether the deplib will be linked statically
use_static_libs=$prefer_static_libs
- if test "$use_static_libs" = built && test "$installed" = yes ; then
+ if test "$use_static_libs" = built && test "$installed" = yes; then
use_static_libs=no
fi
if test -n "$library_names" &&
{ test "$use_static_libs" = no || test -z "$old_library"; }; then
- if test "$installed" = no; then
- notinst_deplibs="$notinst_deplibs $lib"
- need_relink=yes
- fi
+ case $host in
+ *cygwin* | *mingw* | *cegcc*)
+ # No point in relinking DLLs because paths are not encoded
+ notinst_deplibs="$notinst_deplibs $lib"
+ need_relink=no
+ ;;
+ *)
+ if test "$installed" = no; then
+ notinst_deplibs="$notinst_deplibs $lib"
+ need_relink=yes
+ fi
+ ;;
+ esac
# 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
+ # Warn about portability, can't link against -module's on some
+ # systems (darwin). Don't bleat about dlopened modules though!
+ dlopenmodule=""
+ for dlpremoduletest in $dlprefiles; do
+ if test "X$dlpremoduletest" = "X$lib"; then
+ dlopenmodule="$dlpremoduletest"
+ break
+ fi
+ done
+ if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
+ $ECHO
if test "$linkmode" = prog; then
- $echo "*** Warning: Linking the executable $output against the loadable module"
+ $ECHO "*** Warning: Linking the executable $output against the loadable module"
else
- $echo "*** Warning: Linking the shared library $output against the loadable module"
+ $ECHO "*** Warning: Linking the shared library $output against the loadable module"
fi
- $echo "*** $linklib is not portable!"
+ $ECHO "*** $linklib is not portable!"
fi
if test "$linkmode" = lib &&
test "$hardcode_into_libs" = yes; then
@@ -2645,17 +5619,19 @@ EOF
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\"`
+ shift
+ realname="$1"
+ 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`
+ *cygwin* | mingw* | *cegcc*)
+ func_arith $current - $age
+ major=$func_arith_result
versuffix="-$major"
;;
esac
@@ -2666,36 +5642,22 @@ 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"
+ func_basename "$soroot"
+ soname="$func_basename_result"
+ func_stripname 'lib' '.dll' "$soname"
+ newlib=libimp-$func_stripname_result.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"
+ func_verbose "extracting exported symbol list from \`$soname'"
+ func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
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"
+ func_verbose "generating import library for \`$soname'"
+ func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
fi
# make sure the library variables are pointing to the new library
dir=$output_objdir
@@ -2717,17 +5679,21 @@ EOF
*-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
*-*-unixware7*) 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 the lib is a (non-dlopened) module then we can not
+ # link against it, someone is ignoring the earlier warnings
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"
+ $GREP ": [^:]* bundle" >/dev/null ; then
+ if test "X$dlopenmodule" != "X$lib"; 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
+ elif test -n "$old_library"; then
+ add="$dir/$old_library"
fi
fi
esac
@@ -2745,7 +5711,8 @@ EOF
fi
;;
relink)
- if test "$hardcode_direct" = yes; then
+ if test "$hardcode_direct" = yes &&
+ test "$hardcode_direct_absolute" = no; then
add="$dir/$linklib"
elif test "$hardcode_minus_L" = yes; then
add_dir="-L$dir"
@@ -2769,8 +5736,7 @@ EOF
esac
if test "$lib_linked" != yes; then
- $echo "$modename: configuration error: unsupported hardcode properties"
- exit $EXIT_FAILURE
+ func_fatal_configuration "unsupported hardcode properties"
fi
if test -n "$add_shlibpath"; then
@@ -2785,8 +5751,8 @@ EOF
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 && \
+ if test "$hardcode_direct" != yes &&
+ test "$hardcode_minus_L" != yes &&
test "$hardcode_shlibpath_var" = yes; then
case :$finalize_shlibpath: in
*":$libdir:"*) ;;
@@ -2801,7 +5767,8 @@ EOF
add_dir=
add=
# Finalize command for both is simple: just hardcode it.
- if test "$hardcode_direct" = yes; then
+ if test "$hardcode_direct" = yes &&
+ test "$hardcode_direct_absolute" = no; then
add="$libdir/$linklib"
elif test "$hardcode_minus_L" = yes; then
add_dir="-L$libdir"
@@ -2815,9 +5782,9 @@ EOF
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"
+ add="$inst_prefix_dir$libdir/$linklib"
else
- add="$libdir/$linklib"
+ add="$libdir/$linklib"
fi
else
# We cannot seem to hardcode it, guess we'll fake it.
@@ -2861,21 +5828,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
@@ -2899,7 +5866,8 @@ EOF
temp_deplibs=
for libdir in $dependency_libs; do
case $libdir in
- -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
+ -R*) func_stripname '-R' '' "$libdir"
+ temp_xrpath=$func_stripname_result
case " $xrpath " in
*" $temp_xrpath "*) ;;
*) xrpath="$xrpath $temp_xrpath";;
@@ -2917,7 +5885,7 @@ EOF
tmp_libs=
for deplib in $dependency_libs; do
newdependency_libs="$deplib $newdependency_libs"
- if test "X$duplicate_deps" = "Xyes" ; then
+ if $opt_duplicate_deps ; then
case "$tmp_libs " in
*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
esac
@@ -2928,97 +5896,75 @@ EOF
if test "$link_all_deplibs" != no; then
# Add the search paths of all dependency libraries
for deplib in $dependency_libs; do
+ path=
case $deplib in
-L*) path="$deplib" ;;
*.la)
- dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
- test "X$dir" = "X$deplib" && dir="."
+ func_dirname "$deplib" "" "."
+ dir="$func_dirname_result"
# 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
+ func_warning "cannot determine absolute directory name of \`$dir'"
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=
+ if $GREP "^installed=no" $deplib > /dev/null; then
case $host in
*-*-darwin*)
- # we do not want to link against static libs,
- # but need to link against shared
+ depdepl=
eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
- eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
if test -n "$deplibrary_names" ; then
for tmp in $deplibrary_names ; do
depdepl=$tmp
done
- if test -f "$deplibdir/$depdepl" ; then
- depdepl="$deplibdir/$depdepl"
- elif test -f "$path/$depdepl" ; then
- depdepl="$path/$depdepl"
- else
- # Can't find it, oh well...
- depdepl=
+ if test -f "$absdir/$objdir/$depdepl" ; then
+ depdepl="$absdir/$objdir/$depdepl"
+ darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+ if test -z "$darwin_install_name"; then
+ darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
+ fi
+ compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
+ linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
+ path=
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=""
+ path="-L$absdir/$objdir"
;;
- *) continue ;;
esac
+ else
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$deplib' is not a valid libtool archive"
+ test "$absdir" != "$libdir" && \
+ func_warning "\`$deplib' seems to be moved"
+
+ path="-L$absdir"
+ fi
;;
- *) continue ;;
esac
case " $deplibs " in
*" $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" = link; then
+ if test "$linkmode" = "prog"; then
+ compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
+ finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
+ else
+ compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+ fi
+ fi
dependency_libs="$newdependency_libs"
if test "$pass" = dlpreopen; then
# Link the dlpreopened libraries before other libraries
@@ -3117,39 +6063,36 @@ EOF
done # for pass
if test "$linkmode" = prog; then
dlfiles="$newdlfiles"
+ fi
+ if test "$linkmode" = prog || test "$linkmode" = lib; then
dlprefiles="$newdlprefiles"
fi
case $linkmode in
oldlib)
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ func_warning "\`-dlopen' is ignored for archives"
+ fi
+
case " $deplibs" in
*\ -l* | *\ -L*)
- $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
+ func_warning "\`-l' and \`-L' are ignored for archives" ;;
esac
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
- fi
+ test -n "$rpath" && \
+ func_warning "\`-rpath' is ignored for archives"
- if test -n "$rpath"; then
- $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
- fi
+ test -n "$xrpath" && \
+ func_warning "\`-R' is ignored for archives"
- if test -n "$xrpath"; then
- $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
- fi
+ test -n "$vinfo" && \
+ func_warning "\`-version-info/-version-number' is ignored for archives"
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
- fi
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for archives"
- 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
+ test -n "$export_symbols$export_symbols_regex" && \
+ func_warning "\`-export-symbols' is ignored for archives"
# Now set the variables for building old libraries.
build_libtool_libs=no
@@ -3161,48 +6104,48 @@ EOF
# 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//'`
+ func_stripname 'lib' '.la' "$outputname"
+ name=$func_stripname_result
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
+ test "$module" = no && \
+ func_fatal_help "libtool library \`$output' must begin with \`lib'"
+
if test "$need_lib_prefix" != no; then
# Add the "lib" prefix for modules if required
- name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ func_stripname '' '.la' "$outputname"
+ name=$func_stripname_result
eval shared_ext=\"$shrext_cmds\"
eval libname=\"$libname_spec\"
else
- libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
+ func_stripname '' '.la' "$outputname"
+ libname=$func_stripname_result
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
+ func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
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
- if test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
- fi
+ test "$dlself" != no && \
+ func_warning "\`-dlopen self' is ignored for libtool libraries"
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"
+ shift
+ test "$#" -gt 1 && \
+ func_warning "ignoring multiple \`-rpath's for a libtool library"
+
+ install_libdir="$1"
oldlibs=
if test -z "$rpath"; then
@@ -3216,25 +6159,21 @@ EOF
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
+ test -n "$vinfo" && \
+ func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
- fi
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for convenience libraries"
else
# Parse the version information argument.
save_ifs="$IFS"; IFS=':'
set dummy $vinfo 0 0 0
+ shift
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
+ test -n "$7" && \
+ func_fatal_help "too many parameters to \`-version-info'"
# convert absolute version numbers to libtool ages
# this retains compatibility with .la files and attempts
@@ -3242,9 +6181,9 @@ EOF
case $vinfo_number in
yes)
- number_major="$2"
- number_minor="$3"
- number_revision="$4"
+ number_major="$1"
+ number_minor="$2"
+ number_revision="$3"
#
# There are really only two kinds -- those that
# use the current revision as the major version
@@ -3254,7 +6193,8 @@ EOF
#
case $version_type in
darwin|linux|osf|windows|none)
- current=`expr $number_major + $number_minor`
+ func_arith $number_major + $number_minor
+ current=$func_arith_result
age="$number_minor"
revision="$number_revision"
;;
@@ -3264,17 +6204,21 @@ EOF
age="0"
;;
irix|nonstopux)
- current=`expr $number_major + $number_minor`
+ func_arith $number_major + $number_minor
+ current=$func_arith_result
age="$number_minor"
revision="$number_minor"
lt_irix_increment=no
;;
+ *)
+ func_fatal_configuration "$modename: unknown library version type \`$version_type'"
+ ;;
esac
;;
no)
- current="$2"
- revision="$3"
- age="$4"
+ current="$1"
+ revision="$2"
+ age="$3"
;;
esac
@@ -3282,34 +6226,30 @@ 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: \`$vinfo' is not valid version information" 1>&2
- exit $EXIT_FAILURE
+ func_error "CURRENT \`$current' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
;;
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' must be a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit $EXIT_FAILURE
+ func_error "REVISION \`$revision' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
;;
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' must be a nonnegative integer" 1>&2
- $echo "$modename: \`$vinfo' is not valid version information" 1>&2
- exit $EXIT_FAILURE
+ func_error "AGE \`$age' must be a nonnegative integer"
+ func_fatal_error "\`$vinfo' is not valid version information"
;;
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
+ func_error "AGE \`$age' is greater than the current interface number \`$current'"
+ func_fatal_error "\`$vinfo' is not valid version information"
fi
# Calculate the version variables.
@@ -3322,10 +6262,12 @@ EOF
darwin)
# Like Linux, but with the current version available in
# verstring for coding it into the library header
- major=.`expr $current - $age`
+ func_arith $current - $age
+ major=.$func_arith_result
versuffix="$major.$age.$revision"
# Darwin ld doesn't like 0 for these options...
- minor_current=`expr $current + 1`
+ func_arith $current + 1
+ minor_current=$func_arith_result
xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
;;
@@ -3337,15 +6279,17 @@ EOF
freebsd-elf)
major=".$current"
- versuffix=".$current";
+ versuffix=".$current"
;;
irix | nonstopux)
if test "X$lt_irix_increment" = "Xno"; then
- major=`expr $current - $age`
+ func_arith $current - $age
else
- major=`expr $current - $age + 1`
+ func_arith $current - $age + 1
fi
+ major=$func_arith_result
+
case $version_type in
nonstopux) verstring_prefix=nonstopux ;;
*) verstring_prefix=sgi ;;
@@ -3355,8 +6299,10 @@ EOF
# 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`
+ func_arith $revision - $loop
+ iface=$func_arith_result
+ func_arith $loop - 1
+ loop=$func_arith_result
verstring="$verstring_prefix$major.$iface:$verstring"
done
@@ -3366,20 +6312,24 @@ EOF
;;
linux)
- major=.`expr $current - $age`
+ func_arith $current - $age
+ major=.$func_arith_result
versuffix="$major.$age.$revision"
;;
osf)
- major=.`expr $current - $age`
+ func_arith $current - $age
+ major=.$func_arith_result
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`
+ func_arith $current - $loop
+ iface=$func_arith_result
+ func_arith $loop - 1
+ loop=$func_arith_result
verstring="$verstring:${iface}.0"
done
@@ -3387,6 +6337,11 @@ EOF
verstring="$verstring:${current}.0"
;;
+ qnx)
+ major=".$current"
+ versuffix=".$current"
+ ;;
+
sunos)
major=".$current"
versuffix=".$current.$revision"
@@ -3395,14 +6350,13 @@ EOF
windows)
# Use '-' rather than '.', since we only want one
# extension on DOS 8.3 filesystems.
- major=`expr $current - $age`
+ func_arith $current - $age
+ major=$func_arith_result
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
+ func_fatal_configuration "unknown library version type \`$version_type'"
;;
esac
@@ -3436,7 +6390,7 @@ EOF
# 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
+ func_warning "undefined symbols not allowed in $host shared libraries"
build_libtool_libs=no
build_old_libs=yes
fi
@@ -3444,21 +6398,26 @@ EOF
# Don't allow undefined symbols.
allow_undefined_flag="$no_undefined_flag"
fi
+
fi
+ func_generate_dlsyms "$libname" "$libname" "yes"
+ libobjs="$libobjs $symfileobj"
+ test "X$libobjs" = "X " && libobjs=
+
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/*"`
+ tempremovelist=`$ECHO "$output_objdir/*"`
for p in $tempremovelist; do
case $p in
- *.$objext)
+ *.$objext | *.gcno)
;;
$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
+ if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+ then
continue
fi
fi
@@ -3467,10 +6426,8 @@ EOF
*) ;;
esac
done
- if test -n "$removelist"; then
- $show "${rm}r $removelist"
- $run ${rm}r $removelist
- fi
+ test -n "$removelist" && \
+ func_show_eval "${RM}r \$removelist"
fi
# Now set the variables for building old libraries.
@@ -3478,14 +6435,14 @@ EOF
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`
+ 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"`
+ # lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
+ # deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
+ # dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
#done
if test -n "$xrpath"; then
@@ -3526,12 +6483,12 @@ EOF
if test "$build_libtool_libs" = yes; then
if test -n "$rpath"; then
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
# 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"
+ deplibs="$deplibs System.ltframework"
;;
*-*-netbsd*)
# Don't link with libc until the a.out ld.so is fixed.
@@ -3545,7 +6502,7 @@ EOF
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
# Compiler inserts libc in the correct place for threads to work
;;
- *)
+ *)
# Add libc to deplibs on all other systems if necessary.
if test "$build_libtool_need_lc" = "yes"; then
deplibs="$deplibs -lc"
@@ -3582,17 +6539,18 @@ EOF
# 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
+ $opt_dry_run || $RM conftest.c
cat > conftest.c <<EOF
int main() { return 0; }
EOF
- $rm conftest
+ $opt_dry_run || $RM conftest
if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; 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" != "0"; then
+ case $i in
+ -l*)
+ func_stripname -l '' "$i"
+ name=$func_stripname_result
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $i "*)
@@ -3600,37 +6558,40 @@ EOF
i=""
;;
esac
- fi
+ 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
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+ set dummy $deplib_matches; shift
+ deplib_match=$1
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."
+ $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
+ ;;
+ esac
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
+ case $i in
+ -l*)
+ func_stripname -l '' "$i"
+ name=$func_stripname_result
+ $opt_dry_run || $RM conftest
if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
ldd_output=`ldd conftest`
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
@@ -3642,44 +6603,47 @@ EOF
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
+ libname=`eval "\\$ECHO \"$libname_spec\""`
+ deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
+ set dummy $deplib_matches; shift
+ deplib_match=$1
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."
+ $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"
- fi
+ ;;
+ esac
done
fi
;;
file_magic*)
- set dummy $deplibs_check_method
- file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ set dummy $deplibs_check_method; shift
+ file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
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
+ case $a_deplib in
+ -l*)
+ func_stripname -l '' "$a_deplib"
+ name=$func_stripname_result
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $a_deplib "*)
@@ -3689,13 +6653,13 @@ EOF
esac
fi
if test -n "$a_deplib" ; then
- libname=`eval \\$echo \"$libname_spec\"`
+ 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
+ if ls -lLd "$potent_lib" 2>/dev/null |
+ $GREP " -> " >/dev/null; then
continue
fi
# The statement above tries to avoid entering an
@@ -3708,12 +6672,12 @@ EOF
potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
case $potliblink in
[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
- *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$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
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
+ $SED -e 10q |
+ $EGREP "$file_magic_regex" > /dev/null; then
newdeplibs="$newdeplibs $a_deplib"
a_deplib=""
break 2
@@ -3723,32 +6687,35 @@ EOF
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
+ ;;
+ *)
# Add a -L argument.
newdeplibs="$newdeplibs $a_deplib"
- fi
+ ;;
+ esac
done # Gone through all deplibs.
;;
match_pattern*)
- set dummy $deplibs_check_method
- match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ set dummy $deplibs_check_method; shift
+ match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
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
+ case $a_deplib in
+ -l*)
+ func_stripname -l '' "$a_deplib"
+ name=$func_stripname_result
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $a_deplib "*)
@@ -3758,14 +6725,13 @@ EOF
esac
fi
if test -n "$a_deplib" ; then
- libname=`eval \\$echo \"$libname_spec\"`
+ 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
+ if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
+ $EGREP "$match_pattern_regex" > /dev/null; then
newdeplibs="$newdeplibs $a_deplib"
a_deplib=""
break 2
@@ -3775,44 +6741,46 @@ EOF
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
+ ;;
+ *)
# Add a -L argument.
newdeplibs="$newdeplibs $a_deplib"
- fi
+ ;;
+ esac
done # Gone through all deplibs.
;;
none | unknown | *)
newdeplibs=""
- tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
- -e 's/ -[LR][^ ]*//g'`
+ 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,,"`
+ tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
done
fi
- if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
- | grep . >/dev/null; then
- $echo
+ 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
;;
@@ -3825,24 +6793,24 @@ EOF
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 /'`
+ # On Rhapsody replace the C library with the System framework
+ newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
;;
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."
+ $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"
@@ -3852,16 +6820,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."
+ $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
@@ -3875,7 +6843,14 @@ EOF
# Done checking deplibs!
deplibs=$newdeplibs
fi
-
+ # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+ case $host in
+ *-*-darwin*)
+ newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+ new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+ deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+ ;;
+ esac
# move library search paths that coincide with paths to not yet
# installed libraries to the beginning of the library search list
@@ -3904,7 +6879,6 @@ EOF
done
deplibs="$new_libs"
-
# All the library-specific variables (install_libdir is set above).
library_names=
old_library=
@@ -3949,10 +6923,7 @@ EOF
test -n "$hardcode_libdirs"; then
libdir="$hardcode_libdirs"
if test -n "$hardcode_libdir_flag_spec_ld"; then
- case $archive_cmds in
- *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
- *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
- esac
+ eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
else
eval dep_rpath=\"$hardcode_libdir_flag_spec\"
fi
@@ -3978,8 +6949,9 @@ EOF
eval shared_ext=\"$shrext_cmds\"
eval library_names=\"$library_names_spec\"
set dummy $library_names
- realname="$2"
- shift; shift
+ shift
+ realname="$1"
+ shift
if test -n "$soname_spec"; then
eval soname=\"$soname_spec\"
@@ -3998,71 +6970,122 @@ EOF
done
# Use standard objects if they are pic
- test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ test "X$libobjs" = "X " && libobjs=
+
+ delfiles=
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
+ export_symbols="$output_objdir/$libname.uexp"
+ delfiles="$delfiles $export_symbols"
+ fi
+
+ orig_export_symbols=
+ case $host_os in
+ cygwin* | mingw* | cegcc*)
+ if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
+ # exporting using user supplied symfile
+ if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
+ # and it's NOT already a .def file. Must figure out
+ # which of the given symbols are data symbols and tag
+ # them as such. So, trigger use of export_symbols_cmds.
+ # export_symbols gets reassigned inside the "prepare
+ # the list of exported symbols" if statement, so the
+ # include_expsyms logic still works.
+ orig_export_symbols="$export_symbols"
+ export_symbols=
+ always_export_symbols=yes
+ fi
+ fi
+ ;;
+ esac
# 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'"
+ func_verbose "generating symbol list for \`$libname.la'"
export_symbols="$output_objdir/$libname.exp"
- $run $rm $export_symbols
+ $opt_dry_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
+ func_len " $cmd"
+ len=$func_len_result
+ if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ func_show_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=:
+ # The command line is too long to execute in one step.
+ func_verbose "using reloadable object file for export list..."
+ skipped_export=:
# Break out early, otherwise skipped_export may be
# set to false by a later but shorter cmd.
break
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"'
+ if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
+ func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ func_show_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"'
+ tmp_export_symbols="$export_symbols"
+ test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+ $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
+ fi
+
+ if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
+ # The given exports_symbols file has to be filtered, so filter it.
+ func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+ # FIXME: $output_objdir/$libname.filter potentially contains lots of
+ # 's' commands which not all seds can handle. GNU sed should be fine
+ # though. Also, the filter scales superlinearly with the number of
+ # global variables. join(1) would be nice here, but unfortunately
+ # isn't a blessed tool.
+ $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+ delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
+ export_symbols=$output_objdir/$libname.def
+ $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
fi
tmp_deplibs=
for test_deplib in $deplibs; do
- case " $convenience " in
- *" $test_deplib "*) ;;
- *)
- tmp_deplibs="$tmp_deplibs $test_deplib"
- ;;
- esac
+ 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" &&
+ test "$compiler_needs_object" = yes &&
+ test -z "$libobjs"; then
+ # extract the archives, so we have objects to list.
+ # TODO: could optimize this to just extract one archive.
+ whole_archive_flag_spec=
+ fi
if test -n "$whole_archive_flag_spec"; then
save_libobjs=$libobjs
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ test "X$libobjs" = "X " && libobjs=
else
gentop="$output_objdir/${outputname}x"
generated="$generated $gentop"
func_extract_archives $gentop $convenience
libobjs="$libobjs $func_extract_archives_result"
+ test "X$libobjs" = "X " && libobjs=
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"
@@ -4070,7 +7093,7 @@ EOF
# 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 $?
+ $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
fi
# Do each of the archive commands.
@@ -4083,22 +7106,24 @@ EOF
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
+ 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" : ".*" 2>/dev/null` &&
- test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ func_len " $test_cmds" &&
+ len=$func_len_result &&
+ test "$len" -lt "$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..."
+ # The command line is too long to link in one step, link piecewise
+ # or, if using GNU ld and skipped_export is not :, use a linker
+ # script.
# Save the value of $output and $libobjs because we want to
# use them later. If we have whole_archive_flag_spec, we
@@ -4112,77 +7137,162 @@ EOF
save_libobjs=$libobjs
fi
save_output=$output
- output_la=`$echo "X$output" | $Xsed -e "$basename"`
+ 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" : ".*" 2>/dev/null` &&
- test "$len" -le "$max_cmd_len"; }; then
- objlist="$objlist $obj"
+
+ if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
+ output=${output_objdir}/${output_la}.lnkscript
+ func_verbose "creating GNU ld script: $output"
+ $ECHO 'INPUT (' > $output
+ for obj in $save_libobjs
+ do
+ $ECHO "$obj" >> $output
+ done
+ $ECHO ')' >> $output
+ delfiles="$delfiles $output"
+ elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
+ output=${output_objdir}/${output_la}.lnk
+ func_verbose "creating linker input file list: $output"
+ : > $output
+ set x $save_libobjs
+ shift
+ firstobj=
+ if test "$compiler_needs_object" = yes; then
+ firstobj="$1 "
+ shift
+ fi
+ for obj
+ do
+ $ECHO "$obj" >> $output
+ done
+ delfiles="$delfiles $output"
+ output=$firstobj\"$file_list_spec$output\"
+ else
+ if test -n "$save_libobjs"; then
+ func_verbose "creating reloadable object files..."
+ output=$output_objdir/$output_la-${k}.$objext
+ eval test_cmds=\"$reload_cmds\"
+ func_len " $test_cmds"
+ len0=$func_len_result
+ len=$len0
+
+ # Loop over the list of objects to be linked.
+ for obj in $save_libobjs
+ do
+ func_len " $obj"
+ func_arith $len + $func_len_result
+ len=$func_arith_result
+ if test "X$objlist" = X ||
+ test "$len" -lt "$max_cmd_len"; then
+ func_append 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~\$RM $last_robj\"
+ fi
+ last_robj=$output_objdir/$output_la-${k}.$objext
+ func_arith $k + 1
+ k=$func_arith_result
+ output=$output_objdir/$output_la-${k}.$objext
+ objlist=$obj
+ func_len " $last_robj"
+ func_arith $len0 + $func_len_result
+ len=$func_arith_result
+ 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 test -n "$last_robj"; then
+ eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
+ fi
+ delfiles="$delfiles $output"
+
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\"
+ output=
+ fi
+
+ if ${skipped_export-false}; then
+ func_verbose "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $opt_dry_run || $RM $export_symbols
+ libobjs=$output
+ # Append the command to create the export file.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
+ if test -n "$last_robj"; then
+ eval concat_cmds=\"\$concat_cmds~\$RM $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"
+ test -n "$save_libobjs" &&
+ func_verbose "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
+ # Loop through the commands generated above and execute them.
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $concat_cmds; do
+ IFS="$save_ifs"
+ $opt_silent || {
+ func_quote_for_expand "$cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ $opt_dry_run || eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ ( cd "$output_objdir" && \
+ $RM "${realname}T" && \
+ $MV "${realname}U" "$realname" )
+ fi
+
+ exit $lt_exit
+ }
+ done
IFS="$save_ifs"
- $show "$cmd"
- $run eval "$cmd" || exit $?
- done
- IFS="$save_ifs"
+
+ if test -n "$export_symbols_regex" && ${skipped_export-false}; then
+ func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+ fi
+ fi
+
+ if ${skipped_export-false}; then
+ if test -n "$export_symbols" && test -n "$include_expsyms"; then
+ tmp_export_symbols="$export_symbols"
+ test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
+ $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
+ fi
+
+ if test -n "$orig_export_symbols"; then
+ # The given exports_symbols file has to be filtered, so filter it.
+ func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
+ # FIXME: $output_objdir/$libname.filter potentially contains lots of
+ # 's' commands which not all seds can handle. GNU sed should be fine
+ # though. Also, the filter scales superlinearly with the number of
+ # global variables. join(1) would be nice here, but unfortunately
+ # isn't a blessed tool.
+ $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
+ delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
+ export_symbols=$output_objdir/$libname.def
+ $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+ fi
+ fi
libobjs=$output
# Restore the value of output.
@@ -4190,6 +7300,7 @@ EOF
if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
+ test "X$libobjs" = "X " && libobjs=
fi
# Expand the library linking commands again to reset the
# value of $libobjs for piecewise linking.
@@ -4202,28 +7313,45 @@ EOF
cmds=$module_cmds
fi
else
- if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- cmds=$archive_expsym_cmds
- else
- cmds=$archive_cmds
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ cmds=$archive_expsym_cmds
+ else
+ cmds=$archive_cmds
fi
fi
+ fi
- # Append the command to remove the reloadable object files
- # to the just-reset $cmds.
- eval cmds=\"\$cmds~\$rm $delfiles\"
+ if test -n "$delfiles"; then
+ # Append the command to remove temporary files to $cmds.
+ eval cmds=\"\$cmds~\$RM $delfiles\"
fi
+
+ # Add any objects from preloaded convenience libraries
+ if test -n "$dlprefiles"; then
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+
+ func_extract_archives $gentop $dlprefiles
+ libobjs="$libobjs $func_extract_archives_result"
+ test "X$libobjs" = "X " && libobjs=
+ fi
+
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
eval cmd=\"$cmd\"
- $show "$cmd"
- $run eval "$cmd" || {
+ $opt_silent || {
+ func_quote_for_expand "$cmd"
+ eval "func_echo $func_quote_for_expand_result"
+ }
+ $opt_dry_run || eval "$cmd" || {
lt_exit=$?
# Restore the uninstalled library and exit
if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+ ( cd "$output_objdir" && \
+ $RM "${realname}T" && \
+ $MV "${realname}U" "$realname" )
fi
exit $lt_exit
@@ -4233,12 +7361,11 @@ 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 $?
+ $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
if test -n "$convenience"; then
if test -z "$whole_archive_flag_spec"; then
- $show "${rm}r $gentop"
- $run ${rm}r "$gentop"
+ func_show_eval '${RM}r "$gentop"'
fi
fi
@@ -4248,8 +7375,7 @@ EOF
# 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 $?
+ func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
fi
done
@@ -4262,39 +7388,35 @@ EOF
;;
obj)
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ func_warning "\`-dlopen' is ignored for objects"
+ fi
+
case " $deplibs" in
*\ -l* | *\ -L*)
- $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
+ func_warning "\`-l' and \`-L' are ignored for objects" ;;
esac
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
- fi
+ test -n "$rpath" && \
+ func_warning "\`-rpath' is ignored for objects"
- if test -n "$rpath"; then
- $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
- fi
+ test -n "$xrpath" && \
+ func_warning "\`-R' is ignored for objects"
- if test -n "$xrpath"; then
- $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
- fi
+ test -n "$vinfo" && \
+ func_warning "\`-version-info' is ignored for objects"
- 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
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for objects"
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"`
+ test -n "$objs$old_deplibs" && \
+ func_fatal_error "cannot build library object \`$output' from non-libtool objects"
+
+ libobj=$output
+ func_lo2o "$libobj"
+ obj=$func_lo2o_result
;;
*)
libobj=
@@ -4303,7 +7425,7 @@ EOF
esac
# Delete the old objects.
- $run $rm $obj $libobj
+ $opt_dry_run || $RM $obj $libobj
# Objects from convenience libraries. This assumes
# single-version convenience libraries. Whenever we create
@@ -4319,7 +7441,7 @@ EOF
if test -n "$convenience"; then
if test -n "$whole_archive_flag_spec"; then
eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
- reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
+ reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
else
gentop="$output_objdir/${obj}x"
generated="$generated $gentop"
@@ -4330,24 +7452,15 @@ EOF
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
+ 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"
+ func_execute_cmds "$reload_cmds" 'exit $?'
# 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
+ func_show_eval '${RM}r "$gentop"'
fi
exit $EXIT_SUCCESS
@@ -4355,14 +7468,13 @@ EOF
if test "$build_libtool_libs" != yes; then
if test -n "$gentop"; then
- $show "${rm}r $gentop"
- $run ${rm}r $gentop
+ func_show_eval '${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 $?
+ # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
exit $EXIT_SUCCESS
fi
@@ -4370,20 +7482,11 @@ EOF
# 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"
+ func_execute_cmds "$reload_cmds" 'exit $?'
fi
if test -n "$gentop"; then
- $show "${rm}r $gentop"
- $run ${rm}r $gentop
+ func_show_eval '${RM}r "$gentop"'
fi
exit $EXIT_SUCCESS
@@ -4391,39 +7494,45 @@ EOF
prog)
case $host in
- *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
+ *cygwin*) func_stripname '' '.exe' "$output"
+ output=$func_stripname_result.exe;;
esac
- if test -n "$vinfo"; then
- $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
- fi
+ test -n "$vinfo" && \
+ func_warning "\`-version-info' is ignored for programs"
- if test -n "$release"; then
- $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
- fi
+ test -n "$release" && \
+ func_warning "\`-release' is ignored for programs"
- 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
+ test "$preload" = yes \
+ && test "$dlopen_support" = unknown \
+ && test "$dlopen_self" = unknown \
+ && test "$dlopen_self_static" = unknown && \
+ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
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 /'`
+ compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
+ finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
;;
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
- ;;
+ *-*-darwin*)
+ # Don't allow lazy linking, it breaks C++ global constructors
+ # But is supposedly fixed on 10.4 or later (yay!).
+ if test "$tagname" = CXX ; then
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
+ 10.[0123])
+ compile_command="$compile_command ${wl}-bind_at_load"
+ finalize_command="$finalize_command ${wl}-bind_at_load"
+ ;;
+ esac
+ fi
+ # Time to change all our "foo.ltframework" stuff back to "-framework foo"
+ compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+ finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
+ ;;
esac
@@ -4498,14 +7607,16 @@ EOF
esac
fi
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
- testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$libdir:"*) ;;
+ ::) dllsearchpath=$libdir;;
*) dllsearchpath="$dllsearchpath:$libdir";;
esac
case :$dllsearchpath: in
*":$testbindir:"*) ;;
+ ::) dllsearchpath=$testbindir;;
*) dllsearchpath="$dllsearchpath:$testbindir";;
esac
;;
@@ -4557,281 +7668,51 @@ EOF
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`
+ 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"
+ func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
- 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"'
- case $host in
- *cygwin* | *mingw* )
- $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
- $run eval 'cat "$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"'
- $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
- $run eval 'mv "$nlist"T "$nlist"'
- case $host in
- *cygwin* | *mingw* )
- $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
- $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
- ;;
- esac
- 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 >/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 $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
- $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -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.
- case $host in
- *cygwin* | *mingw* )
- if test -f "$output_objdir/${outputname}.def" ; then
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
- finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
- else
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
- finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
- fi
- ;;
- * )
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
- finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
- ;;
- esac
- ;;
- *)
- $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" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
- finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
+ # template prelinking step
+ if test -n "$prelink_cmds"; then
+ func_execute_cmds "$prelink_cmds" 'exit $?'
fi
- if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+ wrappers_required=yes
+ case $host in
+ *cygwin* | *mingw* )
+ if test "$build_libtool_libs" != yes; then
+ wrappers_required=no
+ fi
+ ;;
+ *cegcc)
+ # Disable wrappers for cegcc, we are cross compiling anyway.
+ wrappers_required=no
+ ;;
+ *)
+ if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
+ wrappers_required=no
+ fi
+ ;;
+ esac
+ if test "$wrappers_required" = no; then
# Replace the output file specification.
- compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
+ 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"
- exit_status=$?
+ exit_status=0
+ func_show_eval "$link_command" 'exit_status=$?'
# Delete the generated files.
- if test -n "$dlsyms"; then
- $show "$rm $output_objdir/${outputname}S.${objext}"
- $run $rm "$output_objdir/${outputname}S.${objext}"
+ if test -f "$output_objdir/${outputname}S.${objext}"; then
+ func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
fi
exit $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
@@ -4864,12 +7745,11 @@ static const void *lt_preloaded_setup() {
# 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'`
+ link_command=`$ECHO "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
# Delete the old output file.
- $run $rm $output
+ $opt_dry_run || $RM $output
# Link the executable and exit
- $show "$link_command"
- $run eval "$link_command" || exit $?
+ func_show_eval "$link_command" 'exit $?'
exit $EXIT_SUCCESS
fi
@@ -4878,13 +7758,13 @@ static const void *lt_preloaded_setup() {
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
+ func_warning "this platform does not like uninstalled shared libraries"
+ func_warning "\`$output' will be relinked during installation"
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" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
+ 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=
@@ -4896,608 +7776,103 @@ static const void *lt_preloaded_setup() {
fi
# Replace the output file specification.
- link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+ 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
+ $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
- $show "$link_command"
- $run eval "$link_command" || exit $?
+ func_show_eval "$link_command" 'exit $?'
# Now create the wrapper script.
- $show "creating $output"
+ func_verbose "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"
+ relink_command="{ test -z \"\${$var+set}\" || $lt_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"
+ func_quote_for_eval "$var_value"
+ relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
fi
done
relink_command="(cd `pwd`; $relink_command)"
- relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
+ 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
+ # 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"`
+ qecho=`$ECHO "X$qecho" | $Xsed -e "$sed_quote_subst"`
else
- qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
+ 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
+ # Only actually do things if not in dry run mode.
+ $opt_dry_run || {
# 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) func_stripname '' '.exe' "$output"
+ output=$func_stripname_result ;;
esac
# test for cygwin because mv fails w/o .exe extensions
case $host in
*cygwin*)
exeext=.exe
- outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
+ func_stripname '' '.exe' "$outputname"
+ outputname=$func_stripname_result ;;
*) exeext= ;;
esac
case $host in
*cygwin* | *mingw* )
- output_name=`basename $output`
- output_path=`dirname $output`
- cwrappersource="$output_path/$objdir/lt-$output_name.c"
- cwrapper="$output_path/$output_name.exe"
- $rm $cwrappersource $cwrapper
- trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
-
- cat > $cwrappersource <<EOF
-
-/* $cwrappersource - temporary wrapper executable 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 executable should never be moved out of the build directory.
- If it is, it will not operate correctly.
-
- Currently, it simply execs the wrapper *script* "/bin/sh $output",
- but could eventually absorb all of the scripts functionality and
- exec $objdir/$outputname directly.
-*/
-EOF
- cat >> $cwrappersource<<"EOF"
-#include <stdio.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <malloc.h>
-#include <stdarg.h>
-#include <assert.h>
-#include <string.h>
-#include <ctype.h>
-#include <sys/stat.h>
-
-#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)
-
-/* -DDEBUG is fairly common in CFLAGS. */
-#undef DEBUG
-#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);
-const char * base_name (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 (base_name (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 <<EOF
- newargz[0] = (char *) xstrdup("$SHELL");
-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]);
- /* 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<argc+1; i++)
- {
- DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
- ;
- }
-
-EOF
-
- case $host_os in
- mingw*)
- cat >> $cwrappersource <<EOF
- execv("$SHELL",(char const **)newargz);
-EOF
- ;;
- *)
- cat >> $cwrappersource <<EOF
- execv("$SHELL",newargz);
-EOF
- ;;
- esac
-
- cat >> $cwrappersource <<"EOF"
- return 127;
-}
-
-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
-;
-}
-
-const char *
-base_name (const char *name)
-{
- const char *base;
-
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- /* Skip over the disk name in MSDOS pathnames. */
- if (isalpha ((unsigned char)name[0]) && name[1] == ':')
- name += 2;
-#endif
-
- for (base = name; *name; name++)
- if (IS_DIR_SEPARATOR (*name))
- base = name + 1;
- return 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) &&
- (
- /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
-#if defined (S_IXOTH)
- ((st.st_mode & S_IXOTH) == S_IXOTH) ||
-#endif
-#if defined (S_IXGRP)
- ((st.st_mode & S_IXGRP) == S_IXGRP) ||
-#endif
- ((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;
- /* 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 ((unsigned char)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 $LTCFLAGS -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'
-
-# Be Bourne compatible (taken from Autoconf:_AS_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+\"\$@\"}'='\"\$@\"'
- setopt NO_GLOB_SUBST
-else
- case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
-fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# 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
+ func_dirname_and_basename "$output" "" "."
+ output_name=$func_basename_result
+ output_path=$func_dirname_result
+ cwrappersource="$output_path/$objdir/lt-$output_name.c"
+ cwrapper="$output_path/$output_name.exe"
+ $RM $cwrappersource $cwrapper
+ trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
+
+ func_emit_cwrapperexe_src > $cwrappersource
+
+ # The wrapper executable is built using the $host compiler,
+ # because it contains $host paths and files. If cross-
+ # compiling, it, like the target executable, must be
+ # executed on the $host or under an emulation environment.
+ $opt_dry_run || {
+ $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
+ $STRIP $cwrapper
+ }
- $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+\"\$@\"}
-"
+ # Now, create the wrapper script for func_source use:
+ func_ltwrapper_scriptname $cwrapper
+ $RM $func_ltwrapper_scriptname_result
+ trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
+ $opt_dry_run || {
+ # note: this script will not be executed, so do not chmod.
+ if test "x$build" = "x$host" ; then
+ $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
+ else
+ func_emit_wrapper no > $func_ltwrapper_scriptname_result
+ fi
+ }
;;
+ * )
+ $RM $output
+ trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
- *)
- $echo >> $output "\
- exec \"\$progdir/\$program\" \${1+\"\$@\"}
-"
+ func_emit_wrapper no > $output
+ chmod +x $output
;;
esac
- $echo >> $output "\
- \$echo \"\$0: cannot exec \$program \$*\"
- 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
@@ -5506,7 +7881,7 @@ fi\
for oldlib in $oldlibs; do
if test "$build_libtool_libs" = convenience; then
- oldobjs="$libobjs_save"
+ oldobjs="$libobjs_save $symfileobj"
addlibs="$convenience"
build_libtool_libs=no
else
@@ -5515,6 +7890,9 @@ fi\
build_libtool_libs=no
else
oldobjs="$old_deplibs $non_pic_objects"
+ if test "$preload" = yes && test -f "$symfileobj"; then
+ oldobjs="$oldobjs $symfileobj"
+ fi
fi
addlibs="$old_convenience"
fi
@@ -5529,8 +7907,18 @@ 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
+ cmds=$old_archive_from_new_cmds
else
+
+ # Add any objects from preloaded convenience libraries
+ if test -n "$dlprefiles"; then
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+
+ func_extract_archives $gentop $dlprefiles
+ oldobjs="$oldobjs $func_extract_archives_result"
+ fi
+
# 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
@@ -5539,32 +7927,22 @@ fi\
# not supported by libtool).
if (for obj in $oldobjs
do
- $echo "X$obj" | $Xsed -e 's%^.*/%%'
+ func_basename "$obj"
+ $ECHO "$func_basename_result"
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"
- exit_status=$?
- if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
- exit $exit_status
- fi
- fi
-
+ $ECHO "copying selected object files to avoid basename conflicts..."
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+ func_mkdir_p "$gentop"
save_oldobjs=$oldobjs
oldobjs=
counter=1
for obj in $save_oldobjs
do
- objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ func_basename "$obj"
+ objbase="$func_basename_result"
case " $oldobjs " in
" ") oldobjs=$obj ;;
*[\ /]"$objbase "*)
@@ -5572,58 +7950,62 @@ fi\
# Make sure we don't pick an alternate name that also
# overlaps.
newobj=lt$counter-$objbase
- counter=`expr $counter + 1`
+ func_arith $counter + 1
+ counter=$func_arith_result
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"
+ func_show_eval "ln $obj $gentop/$newobj || 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
+ func_len " $cmds"
+ len=$func_len_result
+ if test "$len" -lt "$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..."
+ func_verbose "using piecewise archive linking..."
save_RANLIB=$RANLIB
RANLIB=:
objlist=
concat_cmds=
save_oldobjs=$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
+ eval test_cmds=\"$old_archive_cmds\"
+ func_len " $test_cmds"
+ len0=$func_len_result
+ len=$len0
for obj in $save_oldobjs
do
- oldobjs="$objlist $obj"
- objlist="$objlist $obj"
- eval test_cmds=\"$old_archive_cmds\"
- if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
- test "$len" -le "$max_cmd_len"; then
+ func_len " $obj"
+ func_arith $len + $func_len_result
+ len=$func_arith_result
+ func_append objlist " $obj"
+ if test "$len" -lt "$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
+ RANLIB=$save_RANLIB
fi
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
objlist=
+ len=$len0
fi
done
RANLIB=$save_RANLIB
@@ -5635,49 +8017,39 @@ fi\
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"
+ func_execute_cmds "$cmds" 'exit $?'
done
- if test -n "$generated"; then
- $show "${rm}r$generated"
- $run ${rm}r$generated
- fi
+ test -n "$generated" && \
+ func_show_eval "${RM}r$generated"
# Now create the libtool archive.
case $output in
*.la)
old_library=
test "$build_old_libs" = yes && old_library="$libname.$libext"
- $show "creating $output"
+ func_verbose "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"
+ relink_command="{ test -z \"\${$var+set}\" || $lt_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"
+ func_quote_for_eval "$var_value"
+ relink_command="$var=$func_quote_for_eval_result; 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" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
+ 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
+ $opt_dry_run || {
for installed in no yes; do
if test "$installed" = yes; then
if test -z "$install_libdir"; then
@@ -5689,12 +8061,11 @@ fi\
for deplib in $dependency_libs; do
case $deplib in
*.la)
- name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+ func_basename "$deplib"
+ name="$func_basename_result"
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
+ test -z "$libdir" && \
+ func_fatal_error "\`$deplib' is not a valid libtool archive"
newdependency_libs="$newdependency_libs $libdir/$name"
;;
*) newdependency_libs="$newdependency_libs $deplib" ;;
@@ -5702,25 +8073,37 @@ fi\
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"
+ case $lib in
+ *.la)
+ func_basename "$lib"
+ name="$func_basename_result"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$lib' is not a valid libtool archive"
+ newdlfiles="$newdlfiles $libdir/$name"
+ ;;
+ *) newdlfiles="$newdlfiles $lib" ;;
+ esac
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"
+ case $lib in
+ *.la)
+ # Only pass preopened files to the pseudo-archive (for
+ # eventual linking with the app. that links it) if we
+ # didn't already link the preopened objects directly into
+ # the library:
+ func_basename "$lib"
+ name="$func_basename_result"
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ test -z "$libdir" && \
+ func_fatal_error "\`$lib' is not a valid libtool archive"
+ newdlprefiles="$newdlprefiles $libdir/$name"
+ ;;
+ esac
done
dlprefiles="$newdlprefiles"
else
@@ -5743,15 +8126,15 @@ fi\
done
dlprefiles="$newdlprefiles"
fi
- $rm $output
+ $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 | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
esac
- $echo > $output "\
+ $ECHO > $output "\
# $outputname - a libtool library file
-# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
@@ -5765,9 +8148,15 @@ library_names='$library_names'
# The name of the static archive.
old_library='$old_library'
+# Linker flags that can not go in dependency_libs.
+inherited_linker_flags='$new_inherited_linker_flags'
+
# Libraries that this one depends upon.
dependency_libs='$dependency_libs'
+# Names of additional weak libraries provided by this library
+weak_library_names='$weak_libs'
+
# Version information for $libname.
current=$current
age=$age
@@ -5786,748 +8175,29 @@ 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 "\
+ $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 $?
+ func_show_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" | 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)
- case " $install_prog " in
- *[\\\ /]cp\ *) ;;
- *) prev=$arg ;;
- esac
- ;;
- -g | -m | -o) prev=$arg ;;
- -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 $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" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
- else
- relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
- 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.
- # Try `ln -sf' first, because the `ln' binary might depend on
- # the symlink we replace! Solaris /bin/ln does not understand -f,
- # so we also need to try rm && ln -s.
- for linkname
- do
- if test "$linkname" != "$realname"; then
- $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
- $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $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" || {
- lt_exit=$?
-
- # Restore the uninstalled library and exit
- if test "$mode" = relink; then
- $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
- fi
-
- exit $lt_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=
-
- # Note that it is not necessary on cygwin/mingw to append a dot to
- # foo even if both foo and FILE.exe exist: automatic-append-.exe
- # behavior happens only for exec(3), not for open(2)! Also, sourcing
- # `FILE.' does not work on cygwin managed mounts.
- #
- # If there is no directory component, then add one.
- case $wrapper in
- */* | *\\*) . ${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
- 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=
- # Note that it is not necessary on cygwin/mingw to append a dot to
- # foo even if both foo and FILE.exe exist: automatic-append-.exe
- # behavior happens only for exec(3), not for open(2)! Also, sourcing
- # `FILE.' does not work on cygwin managed mounts.
- #
- # If there is no directory component, then add one.
- case $wrapper in
- */* | *\\*) . ${wrapper} ;;
- *) . ./${wrapper} ;;
- esac
-
- outputname=
- if test "$fast_install" = no && test -n "$relink_command"; then
- if test "$finalize" = yes && test -z "$run"; then
- tmpdir=`func_mktempdir`
- file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
- outputname="$tmpdir/$file"
- # Replace the output file specification.
- relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
-
- $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 anyway
- 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 "X----------------------------------------------------------------------" | $Xsed
- $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 "X----------------------------------------------------------------------" | $Xsed
- 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
- if test ! -f "$dir/$dlname"; then
- $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
- exit $EXIT_FAILURE
- fi
- 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
+{ test "$mode" = link || test "$mode" = relink; } &&
+ func_mode_link ${1+"$@"}
- # Restore saved environment variables
- for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
- do
- eval "if test \"\${save_$lt_var+set}\" = set; then
- $lt_var=\$save_$lt_var; export $lt_var
- fi"
- done
- # 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
- $echo "$cmd$args"
- exit $EXIT_SUCCESS
- fi
- ;;
-
- # libtool clean and uninstall mode
- clean | uninstall)
- modename="$modename: $mode"
- rm="$nonopt"
+# func_mode_uninstall arg...
+func_mode_uninstall ()
+{
+ $opt_debug
+ RM="$nonopt"
files=
rmforce=
exit_status=0
@@ -6539,30 +8209,28 @@ relink_command=\"$relink_command\""
for arg
do
case $arg in
- -f) rm="$rm $arg"; rmforce=yes ;;
- -*) rm="$rm $arg" ;;
+ -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
+ test -z "$RM" && \
+ func_fatal_help "you must specify an RM program"
rmdirs=
origobjdir="$objdir"
for file in $files; do
- dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
- if test "X$dir" = "X$file"; then
- dir=.
+ func_dirname "$file" "" "."
+ dir="$func_dirname_result"
+ if test "X$dir" = X.; then
objdir="$origobjdir"
else
objdir="$dir/$origobjdir"
fi
- name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ func_basename "$file"
+ name="$func_basename_result"
test "$mode" = uninstall && objdir="$dir"
# Remember objdir for removal later, being careful to avoid duplicates
@@ -6574,9 +8242,9 @@ relink_command=\"$relink_command\""
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
+ 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
@@ -6590,8 +8258,8 @@ 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
- . $dir/$name
+ if func_lalib_p "$file"; then
+ func_source $dir/$name
# Delete the libtool libraries and symlinks.
for n in $library_names; do
@@ -6606,39 +8274,17 @@ relink_command=\"$relink_command\""
*" $dlname "*) ;;
*) rmfiles="$rmfiles $objdir/$dlname" ;;
esac
- test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
+ test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
;;
uninstall)
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"
+ func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
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"
+ func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
fi
# FIXME: should reinstall the best remaining shared library.
;;
@@ -6648,20 +8294,20 @@ 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
+ if func_lalib_p "$file"; then
# Read the .lo file
- . $dir/$name
+ func_source $dir/$name
# Add PIC object to the list of files to remove.
- if test -n "$pic_object" \
- && test "$pic_object" != none; then
+ 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
+ if test -n "$non_pic_object" &&
+ test "$non_pic_object" != none; then
rmfiles="$rmfiles $dir/$non_pic_object"
fi
fi
@@ -6672,17 +8318,26 @@ relink_command=\"$relink_command\""
noexename=$name
case $file in
*.exe)
- file=`$echo $file|${SED} 's,.exe$,,'`
- noexename=`$echo $name|${SED} 's,.exe$,,'`
+ func_stripname '' '.exe' "$file"
+ file=$func_stripname_result
+ func_stripname '' '.exe' "$name"
+ noexename=$func_stripname_result
# $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
+ if func_ltwrapper_p "$file"; then
+ if func_ltwrapper_executable_p "$file"; then
+ func_ltwrapper_scriptname "$file"
+ relink_command=
+ func_source $func_ltwrapper_scriptname_result
+ rmfiles="$rmfiles $func_ltwrapper_scriptname_result"
+ else
+ relink_command=
+ func_source $dir/$noexename
+ fi
# note $name still contains .exe if it was in $file originally
# as does the version of $file that was added into $rmfiles
@@ -6697,239 +8352,38 @@ relink_command=\"$relink_command\""
fi
;;
esac
- $show "$rm $rmfiles"
- $run $rm $rmfiles || exit_status=1
+ func_show_eval "$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
+ func_show_eval "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
+{ test "$mode" = uninstall || test "$mode" = clean; } &&
+ func_mode_uninstall ${1+"$@"}
- 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"
+test -z "$mode" && {
+ help="$generic_help"
+ func_fatal_help "you must specify a MODE"
+}
+
+test -z "$exec_cmd" && \
+ func_fatal_help "invalid operation mode \`$mode'"
if test -n "$exec_cmd"; then
- eval exec $exec_cmd
+ 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 <bug-libtool@gnu.org>."
- 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."
- ;;
+exit $exit_status
-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 uninstalled libtool libraries
- -static-libtool-libs
- 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
@@ -6943,14 +8397,17 @@ exit $?
# configuration. But we'll never go from static-only to shared-only.
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
-disable_libs=shared
+build_libtool_libs=no
+build_old_libs=yes
# ### END LIBTOOL TAG CONFIG: disable-shared
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
-disable_libs=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:
+# vi:sw=2
+
diff --git a/m4/libtool.m4 b/m4/libtool.m4
new file mode 100755
index 0000000..a3fee53
--- a/dev/null
+++ b/m4/libtool.m4
@@ -0,0 +1,7377 @@
+# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# 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.
+
+m4_define([_LT_COPYING], [dnl
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
+# 2006, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gordon Matzigkeit, 1996
+#
+# This file is part of GNU Libtool.
+#
+# GNU Libtool is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License as
+# published by the Free Software Foundation; either version 2 of
+# the License, or (at your option) any later version.
+#
+# As a special exception to the GNU General Public License,
+# if you distribute this file as part of a program or library that
+# is built using GNU Libtool, you may include this file under the
+# same distribution terms that you use for the rest of that program.
+#
+# GNU Libtool is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with GNU Libtool; see the file COPYING. If not, a copy
+# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
+# obtained by writing to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+])
+
+# serial 56 LT_INIT
+
+
+# LT_PREREQ(VERSION)
+# ------------------
+# Complain and exit if this libtool version is less that VERSION.
+m4_defun([LT_PREREQ],
+[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
+ [m4_default([$3],
+ [m4_fatal([Libtool version $1 or higher is required],
+ 63)])],
+ [$2])])
+
+
+# _LT_CHECK_BUILDDIR
+# ------------------
+# Complain if the absolute build directory name contains unusual characters
+m4_defun([_LT_CHECK_BUILDDIR],
+[case `pwd` in
+ *\ * | *\ *)
+ AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
+esac
+])
+
+
+# LT_INIT([OPTIONS])
+# ------------------
+AC_DEFUN([LT_INIT],
+[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
+AC_BEFORE([$0], [LT_LANG])dnl
+AC_BEFORE([$0], [LT_OUTPUT])dnl
+AC_BEFORE([$0], [LTDL_INIT])dnl
+m4_require([_LT_CHECK_BUILDDIR])dnl
+
+dnl Autoconf doesn't catch unexpanded LT_ macros by default:
+m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
+m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
+dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
+dnl unless we require an AC_DEFUNed macro:
+AC_REQUIRE([LTOPTIONS_VERSION])dnl
+AC_REQUIRE([LTSUGAR_VERSION])dnl
+AC_REQUIRE([LTVERSION_VERSION])dnl
+AC_REQUIRE([LTOBSOLETE_VERSION])dnl
+m4_require([_LT_PROG_LTMAIN])dnl
+
+dnl Parse OPTIONS
+_LT_SET_OPTIONS([$0], [$1])
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ltmain"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+AC_SUBST(LIBTOOL)dnl
+
+_LT_SETUP
+
+# Only expand once:
+m4_define([LT_INIT])
+])# LT_INIT
+
+# Old names:
+AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
+AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
+dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
+m4_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_FILEUTILS_DEFAULTS
+# ----------------------
+# It is okay to use these file commands and assume they have been set
+# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
+m4_defun([_LT_FILEUTILS_DEFAULTS],
+[: ${CP="cp -f"}
+: ${MV="mv -f"}
+: ${RM="rm -f"}
+])# _LT_FILEUTILS_DEFAULTS
+
+
+# _LT_SETUP
+# ---------
+m4_defun([_LT_SETUP],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+_LT_DECL([], [host_alias], [0], [The host system])dnl
+_LT_DECL([], [host], [0])dnl
+_LT_DECL([], [host_os], [0])dnl
+dnl
+_LT_DECL([], [build_alias], [0], [The build system])dnl
+_LT_DECL([], [build], [0])dnl
+_LT_DECL([], [build_os], [0])dnl
+dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+dnl
+AC_REQUIRE([AC_PROG_LN_S])dnl
+test -z "$LN_S" && LN_S="ln -s"
+_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+dnl
+AC_REQUIRE([LT_CMD_MAX_LEN])dnl
+_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
+_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
+dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+m4_require([_LT_CMD_RELOAD])dnl
+m4_require([_LT_CHECK_MAGIC_METHOD])dnl
+m4_require([_LT_CMD_OLD_ARCHIVE])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+
+_LT_CONFIG_LIBTOOL_INIT([
+# See if we are running on zsh, and set the options which allow our
+# commands through without removal of \ escapes INIT.
+if test -n "\${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+])
+if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+fi
+
+_LT_CHECK_OBJDIR
+
+m4_require([_LT_TAG_COMPILER])dnl
+_LT_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.
+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 delay expansion of an escaped single quote.
+delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Global variables:
+ofile=libtool
+can_build_shared=yes
+
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+
+with_gnu_ld="$lt_cv_prog_gnu_ld"
+
+old_CC="$CC"
+old_CFLAGS="$CFLAGS"
+
+# Set sane defaults for various variables
+test -z "$CC" && CC=cc
+test -z "$LTCC" && LTCC=$CC
+test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$LD" && LD=ld
+test -z "$ac_objext" && ac_objext=o
+
+_LT_CC_BASENAME([$compiler])
+
+# Only perform the check for file, if the check method requires it
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+case $deplibs_check_method in
+file_magic*)
+ if test "$file_magic_cmd" = '$MAGIC_CMD'; then
+ _LT_PATH_MAGIC
+ fi
+ ;;
+esac
+
+# Use C for the default configuration in the libtool script
+LT_SUPPORTED_TAG([CC])
+_LT_LANG_C_CONFIG
+_LT_LANG_DEFAULT_CONFIG
+_LT_CONFIG_COMMANDS
+])# _LT_SETUP
+
+
+# _LT_PROG_LTMAIN
+# ---------------
+# Note that this code is called both from `configure', and `config.status'
+# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably,
+# `config.status' has no value for ac_aux_dir unless we are using Automake,
+# so we pass a copy along to make sure it has a sensible value anyway.
+m4_defun([_LT_PROG_LTMAIN],
+[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
+_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
+ltmain="$ac_aux_dir/ltmain.sh"
+])# _LT_PROG_LTMAIN
+
+
+## ------------------------------------- ##
+## Accumulate code for creating libtool. ##
+## ------------------------------------- ##
+
+# So that we can recreate a full libtool script including additional
+# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
+# in macros and then make a single call at the end using the `libtool'
+# label.
+
+
+# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
+# ----------------------------------------
+# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL_INIT],
+[m4_ifval([$1],
+ [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
+ [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_INIT])
+
+
+# _LT_CONFIG_LIBTOOL([COMMANDS])
+# ------------------------------
+# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
+m4_define([_LT_CONFIG_LIBTOOL],
+[m4_ifval([$1],
+ [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
+ [$1
+])])])
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
+
+
+# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
+# -----------------------------------------------------
+m4_defun([_LT_CONFIG_SAVE_COMMANDS],
+[_LT_CONFIG_LIBTOOL([$1])
+_LT_CONFIG_LIBTOOL_INIT([$2])
+])
+
+
+# _LT_FORMAT_COMMENT([COMMENT])
+# -----------------------------
+# Add leading comment marks to the start of each line, and a trailing
+# full-stop to the whole comment if one is not present already.
+m4_define([_LT_FORMAT_COMMENT],
+[m4_ifval([$1], [
+m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
+ [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
+)])
+
+
+
+## ------------------------ ##
+## FIXME: Eliminate VARNAME ##
+## ------------------------ ##
+
+
+# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
+# -------------------------------------------------------------------
+# CONFIGNAME is the name given to the value in the libtool script.
+# VARNAME is the (base) name used in the configure script.
+# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
+# VARNAME. Any other value will be used directly.
+m4_define([_LT_DECL],
+[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
+ [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
+ [m4_ifval([$1], [$1], [$2])])
+ lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
+ m4_ifval([$4],
+ [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
+ lt_dict_add_subkey([lt_decl_dict], [$2],
+ [tagged?], [m4_ifval([$5], [yes], [no])])])
+])
+
+
+# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
+# --------------------------------------------------------
+m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
+
+
+# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_tag_varnames],
+[_lt_decl_filter([tagged?], [yes], $@)])
+
+
+# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
+# ---------------------------------------------------------
+m4_define([_lt_decl_filter],
+[m4_case([$#],
+ [0], [m4_fatal([$0: too few arguments: $#])],
+ [1], [m4_fatal([$0: too few arguments: $#: $1])],
+ [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
+ [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
+ [lt_dict_filter([lt_decl_dict], $@)])[]dnl
+])
+
+
+# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
+# --------------------------------------------------
+m4_define([lt_decl_quote_varnames],
+[_lt_decl_filter([value], [1], $@)])
+
+
+# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_dquote_varnames],
+[_lt_decl_filter([value], [2], $@)])
+
+
+# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
+# ---------------------------------------------------
+m4_define([lt_decl_varnames_tagged],
+[m4_assert([$# <= 2])dnl
+_$0(m4_quote(m4_default([$1], [[, ]])),
+ m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
+ m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
+m4_define([_lt_decl_varnames_tagged],
+[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
+
+
+# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
+# ------------------------------------------------
+m4_define([lt_decl_all_varnames],
+[_$0(m4_quote(m4_default([$1], [[, ]])),
+ m4_if([$2], [],
+ m4_quote(lt_decl_varnames),
+ m4_quote(m4_shift($@))))[]dnl
+])
+m4_define([_lt_decl_all_varnames],
+[lt_join($@, lt_decl_varnames_tagged([$1],
+ lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
+])
+
+
+# _LT_CONFIG_STATUS_DECLARE([VARNAME])
+# ------------------------------------
+# Quote a variable value, and forward it to `config.status' so that its
+# declaration there will have the same value as in `configure'. VARNAME
+# must have a single quote delimited value for this to work.
+m4_define([_LT_CONFIG_STATUS_DECLARE],
+[$1='`$ECHO "X$][$1" | $Xsed -e "$delay_single_quote_subst"`'])
+
+
+# _LT_CONFIG_STATUS_DECLARATIONS
+# ------------------------------
+# We delimit libtool config variables with single quotes, so when
+# we write them to config.status, we have to be sure to quote all
+# embedded single quotes properly. In configure, this macro expands
+# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
+#
+# <var>='`$ECHO "X$<var>" | $Xsed -e "$delay_single_quote_subst"`'
+m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
+ [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAGS
+# ----------------
+# Output comment and list of tags supported by the script
+m4_defun([_LT_LIBTOOL_TAGS],
+[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
+available_tags="_LT_TAGS"dnl
+])
+
+
+# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
+# -----------------------------------
+# Extract the dictionary values for VARNAME (optionally with TAG) and
+# expand to a commented shell variable setting:
+#
+# # Some comment about what VAR is for.
+# visible_name=$lt_internal_name
+m4_define([_LT_LIBTOOL_DECLARE],
+[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
+ [description])))[]dnl
+m4_pushdef([_libtool_name],
+ m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
+m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
+ [0], [_libtool_name=[$]$1],
+ [1], [_libtool_name=$lt_[]$1],
+ [2], [_libtool_name=$lt_[]$1],
+ [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
+m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
+])
+
+
+# _LT_LIBTOOL_CONFIG_VARS
+# -----------------------
+# Produce commented declarations of non-tagged libtool config variables
+# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
+# script. Tagged libtool config variables (even for the LIBTOOL CONFIG
+# section) are produced by _LT_LIBTOOL_TAG_VARS.
+m4_defun([_LT_LIBTOOL_CONFIG_VARS],
+[m4_foreach([_lt_var],
+ m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
+ [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
+
+
+# _LT_LIBTOOL_TAG_VARS(TAG)
+# -------------------------
+m4_define([_LT_LIBTOOL_TAG_VARS],
+[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
+ [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+
+
+# _LT_TAGVAR(VARNAME, [TAGNAME])
+# ------------------------------
+m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+
+
+# _LT_CONFIG_COMMANDS
+# -------------------
+# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of
+# variables for single and double quote escaping we saved from calls
+# to _LT_DECL, we can put quote escaped variables declarations
+# into `config.status', and then the shell code to quote escape them in
+# for loops in `config.status'. Finally, any additional code accumulated
+# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
+m4_defun([_LT_CONFIG_COMMANDS],
+[AC_PROVIDE_IFELSE([LT_OUTPUT],
+ dnl If the libtool generation code has been placed in $CONFIG_LT,
+ dnl instead of duplicating it all over again into config.status,
+ dnl then we will have config.status run $CONFIG_LT later, so it
+ dnl needs to know what name is stored there:
+ [AC_CONFIG_COMMANDS([libtool],
+ [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
+ dnl If the libtool generation code is destined for config.status,
+ dnl expand the accumulated commands and init code now:
+ [AC_CONFIG_COMMANDS([libtool],
+ [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
+])#_LT_CONFIG_COMMANDS
+
+
+# Initialize.
+m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
+[
+
+# 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
+
+sed_quote_subst='$sed_quote_subst'
+double_quote_subst='$double_quote_subst'
+delay_variable_subst='$delay_variable_subst'
+_LT_CONFIG_STATUS_DECLARATIONS
+LTCC='$LTCC'
+LTCFLAGS='$LTCFLAGS'
+compiler='$compiler_DEFAULT'
+
+# Quote evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_quote_varnames); do
+ case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+ *[[\\\\\\\`\\"\\\$]]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Double-quote double-evaled strings.
+for var in lt_decl_all_varnames([[ \
+]], lt_decl_dquote_varnames); do
+ case \`eval \\\\\$ECHO "X\\\\\$\$var"\` in
+ *[[\\\\\\\`\\"\\\$]]*)
+ eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"X\\\$\$var\\" | \\\$Xsed -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
+ ;;
+ *)
+ eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
+ ;;
+ esac
+done
+
+# Fix-up fallback echo if it was mangled by the above quoting rules.
+case \$lt_ECHO in
+*'\\\[$]0 --fallback-echo"')dnl "
+ lt_ECHO=\`\$ECHO "X\$lt_ECHO" | \$Xsed -e 's/\\\\\\\\\\\\\\\[$]0 --fallback-echo"\[$]/\[$]0 --fallback-echo"/'\`
+ ;;
+esac
+
+_LT_OUTPUT_LIBTOOL_INIT
+])
+
+
+# LT_OUTPUT
+# ---------
+# This macro allows early generation of the libtool script (before
+# AC_OUTPUT is called), incase it is used in configure for compilation
+# tests.
+AC_DEFUN([LT_OUTPUT],
+[: ${CONFIG_LT=./config.lt}
+AC_MSG_NOTICE([creating $CONFIG_LT])
+cat >"$CONFIG_LT" <<_LTEOF
+#! $SHELL
+# Generated by $as_me.
+# Run this file to recreate a libtool stub with the current configuration.
+
+lt_cl_silent=false
+SHELL=\${CONFIG_SHELL-$SHELL}
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AS_SHELL_SANITIZE
+_AS_PREPARE
+
+exec AS_MESSAGE_FD>&1
+exec AS_MESSAGE_LOG_FD>>config.log
+{
+ echo
+ AS_BOX([Running $as_me.])
+} >&AS_MESSAGE_LOG_FD
+
+lt_cl_help="\
+\`$as_me' creates a local libtool stub from the current configuration,
+for use in further configure time tests before the real libtool is
+generated.
+
+Usage: $[0] [[OPTIONS]]
+
+ -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
+
+Report bugs to <bug-libtool@gnu.org>."
+
+lt_cl_version="\
+m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
+m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
+configured by $[0], generated by m4_PACKAGE_STRING.
+
+Copyright (C) 2008 Free Software Foundation, Inc.
+This config.lt script is free software; the Free Software Foundation
+gives unlimited permision to copy, distribute and modify it."
+
+while test $[#] != 0
+do
+ case $[1] in
+ --version | --v* | -V )
+ echo "$lt_cl_version"; exit 0 ;;
+ --help | --h* | -h )
+ echo "$lt_cl_help"; exit 0 ;;
+ --debug | --d* | -d )
+ debug=: ;;
+ --quiet | --q* | --silent | --s* | -q )
+ lt_cl_silent=: ;;
+
+ -*) AC_MSG_ERROR([unrecognized option: $[1]
+Try \`$[0] --help' for more information.]) ;;
+
+ *) AC_MSG_ERROR([unrecognized argument: $[1]
+Try \`$[0] --help' for more information.]) ;;
+ esac
+ shift
+done
+
+if $lt_cl_silent; then
+ exec AS_MESSAGE_FD>/dev/null
+fi
+_LTEOF
+
+cat >>"$CONFIG_LT" <<_LTEOF
+_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
+_LTEOF
+
+cat >>"$CONFIG_LT" <<\_LTEOF
+AC_MSG_NOTICE([creating $ofile])
+_LT_OUTPUT_LIBTOOL_COMMANDS
+AS_EXIT(0)
+_LTEOF
+chmod +x "$CONFIG_LT"
+
+# configure is writing to config.log, but config.lt does its own redirection,
+# appending to config.log, which fails on DOS, as config.log is still kept
+# open by configure. Here we exec the FD to /dev/null, effectively closing
+# config.log, so it can be properly (re)opened and appended to by config.lt.
+if test "$no_create" != yes; then
+ lt_cl_success=:
+ test "$silent" = yes &&
+ lt_config_lt_args="$lt_config_lt_args --quiet"
+ exec AS_MESSAGE_LOG_FD>/dev/null
+ $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
+ exec AS_MESSAGE_LOG_FD>>config.log
+ $lt_cl_success || AS_EXIT(1)
+fi
+])# LT_OUTPUT
+
+
+# _LT_CONFIG(TAG)
+# ---------------
+# If TAG is the built-in tag, 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 TAG from the
+# matching tagged config vars.
+m4_defun([_LT_CONFIG],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_CONFIG_SAVE_COMMANDS([
+ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
+ m4_if(_LT_TAG, [C], [
+ # 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
+
+ cfgfile="${ofile}T"
+ trap "$RM \"$cfgfile\"; exit 1" 1 2 15
+ $RM "$cfgfile"
+
+ cat <<_LT_EOF >> "$cfgfile"
+#! $SHELL
+
+# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+_LT_COPYING
+_LT_LIBTOOL_TAGS
+
+# ### BEGIN LIBTOOL CONFIG
+_LT_LIBTOOL_CONFIG_VARS
+_LT_LIBTOOL_TAG_VARS
+# ### END LIBTOOL CONFIG
+
+_LT_EOF
+
+ case $host_os in
+ aix3*)
+ cat <<\_LT_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
+_LT_EOF
+ ;;
+ esac
+
+ _LT_PROG_LTMAIN
+
+ # 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 '/^# Generated shell functions inserted here/q' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ _LT_PROG_XSI_SHELLFNS
+
+ sed -n '/^# Generated shell functions inserted here/,$p' "$ltmain" >> "$cfgfile" \
+ || (rm -f "$cfgfile"; exit 1)
+
+ mv -f "$cfgfile" "$ofile" ||
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+],
+[cat <<_LT_EOF >> "$ofile"
+
+dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
+dnl in a comment (ie after a #).
+# ### BEGIN LIBTOOL TAG CONFIG: $1
+_LT_LIBTOOL_TAG_VARS(_LT_TAG)
+# ### END LIBTOOL TAG CONFIG: $1
+_LT_EOF
+])dnl /m4_if
+],
+[m4_if([$1], [], [
+ PACKAGE='$PACKAGE'
+ VERSION='$VERSION'
+ TIMESTAMP='$TIMESTAMP'
+ RM='$RM'
+ ofile='$ofile'], [])
+])dnl /_LT_CONFIG_SAVE_COMMANDS
+])# _LT_CONFIG
+
+
+# LT_SUPPORTED_TAG(TAG)
+# ---------------------
+# Trace this macro to discover what tags are supported by the libtool
+# --tag option, using:
+# autoconf --trace 'LT_SUPPORTED_TAG:$1'
+AC_DEFUN([LT_SUPPORTED_TAG], [])
+
+
+# C support is built-in for now
+m4_define([_LT_LANG_C_enabled], [])
+m4_define([_LT_TAGS], [])
+
+
+# LT_LANG(LANG)
+# -------------
+# Enable libtool support for the given language if not already enabled.
+AC_DEFUN([LT_LANG],
+[AC_BEFORE([$0], [LT_OUTPUT])dnl
+m4_case([$1],
+ [C], [_LT_LANG(C)],
+ [C++], [_LT_LANG(CXX)],
+ [Java], [_LT_LANG(GCJ)],
+ [Fortran 77], [_LT_LANG(F77)],
+ [Fortran], [_LT_LANG(FC)],
+ [Windows Resource], [_LT_LANG(RC)],
+ [m4_ifdef([_LT_LANG_]$1[_CONFIG],
+ [_LT_LANG($1)],
+ [m4_fatal([$0: unsupported language: "$1"])])])dnl
+])# LT_LANG
+
+
+# _LT_LANG(LANGNAME)
+# ------------------
+m4_defun([_LT_LANG],
+[m4_ifdef([_LT_LANG_]$1[_enabled], [],
+ [LT_SUPPORTED_TAG([$1])dnl
+ m4_append([_LT_TAGS], [$1 ])dnl
+ m4_define([_LT_LANG_]$1[_enabled], [])dnl
+ _LT_LANG_$1_CONFIG($1)])dnl
+])# _LT_LANG
+
+
+# _LT_LANG_DEFAULT_CONFIG
+# -----------------------
+m4_defun([_LT_LANG_DEFAULT_CONFIG],
+[AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [LT_LANG(CXX)],
+ [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_F77],
+ [LT_LANG(F77)],
+ [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
+
+AC_PROVIDE_IFELSE([AC_PROG_FC],
+ [LT_LANG(FC)],
+ [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
+
+dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
+dnl pulling things in needlessly.
+AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
+ [LT_LANG(GCJ)],
+ [m4_ifdef([AC_PROG_GCJ],
+ [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
+ m4_ifdef([A][M_PROG_GCJ],
+ [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
+ m4_ifdef([LT_PROG_GCJ],
+ [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
+
+AC_PROVIDE_IFELSE([LT_PROG_RC],
+ [LT_LANG(RC)],
+ [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
+])# _LT_LANG_DEFAULT_CONFIG
+
+# Obsolete macros:
+AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
+AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
+AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
+AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
+dnl AC_DEFUN([AC_LIBTOOL_F77], [])
+dnl AC_DEFUN([AC_LIBTOOL_FC], [])
+dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
+
+
+# _LT_TAG_COMPILER
+# ----------------
+m4_defun([_LT_TAG_COMPILER],
+[AC_REQUIRE([AC_PROG_CC])dnl
+
+_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
+_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
+_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
+_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
+
+# If no C compiler was specified, use CC.
+LTCC=${LTCC-"$CC"}
+
+# If no C compiler flags were specified, use CFLAGS.
+LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
+
+# Allow CC to be a program name with arguments.
+compiler=$CC
+])# _LT_TAG_COMPILER
+
+
+# _LT_COMPILER_BOILERPLATE
+# ------------------------
+# Check for compiler boilerplate output or warnings with
+# the simple compiler test code.
+m4_defun([_LT_COMPILER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_compile_test_code" >conftest.$ac_ext
+eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/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.
+m4_defun([_LT_LINKER_BOILERPLATE],
+[m4_require([_LT_DECL_SED])dnl
+ac_outfile=conftest.$ac_objext
+echo "$lt_simple_link_test_code" >conftest.$ac_ext
+eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err
+_lt_linker_boilerplate=`cat conftest.err`
+$RM -r conftest*
+])# _LT_LINKER_BOILERPLATE
+
+# _LT_REQUIRED_DARWIN_CHECKS
+# -------------------------
+m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
+ case $host_os in
+ rhapsody* | darwin*)
+ AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
+ AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
+ AC_CHECK_TOOL([LIPO], [lipo], [:])
+ AC_CHECK_TOOL([OTOOL], [otool], [:])
+ AC_CHECK_TOOL([OTOOL64], [otool64], [:])
+ _LT_DECL([], [DSYMUTIL], [1],
+ [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
+ _LT_DECL([], [NMEDIT], [1],
+ [Tool to change global to local symbols on Mac OS X])
+ _LT_DECL([], [LIPO], [1],
+ [Tool to manipulate fat objects and archives on Mac OS X])
+ _LT_DECL([], [OTOOL], [1],
+ [ldd/readelf like tool for Mach-O binaries on Mac OS X])
+ _LT_DECL([], [OTOOL64], [1],
+ [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
+
+ AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
+ [lt_cv_apple_cc_single_mod=no
+ if test -z "${LT_MULTI_MODULE}"; then
+ # By default we will add the -single_module flag. You can override
+ # by either setting the environment variable LT_MULTI_MODULE
+ # non-empty at configure time, or by adding -multi_module to the
+ # link flags.
+ rm -rf libconftest.dylib*
+ echo "int foo(void){return 1;}" > conftest.c
+ echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
+ $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
+ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
+ _lt_result=$?
+ if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then
+ lt_cv_apple_cc_single_mod=yes
+ else
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ fi
+ rm -rf libconftest.dylib*
+ rm -f conftest.*
+ fi])
+ AC_CACHE_CHECK([for -exported_symbols_list linker flag],
+ [lt_cv_ld_exported_symbols_list],
+ [lt_cv_ld_exported_symbols_list=no
+ save_LDFLAGS=$LDFLAGS
+ echo "_main" > conftest.sym
+ LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+ [lt_cv_ld_exported_symbols_list=yes],
+ [lt_cv_ld_exported_symbols_list=no])
+ LDFLAGS="$save_LDFLAGS"
+ ])
+ case $host_os in
+ rhapsody* | darwin1.[[012]])
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
+ darwin1.*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ darwin*) # darwin 5.x on
+ # if running on 10.5 or later, the deployment target defaults
+ # to the OS version, if on x86, and 10.4, the deployment
+ # target defaults to 10.4. Don't you love it?
+ case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
+ 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ 10.[[012]]*)
+ _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
+ 10.*)
+ _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
+ esac
+ ;;
+ esac
+ if test "$lt_cv_apple_cc_single_mod" = "yes"; then
+ _lt_dar_single_mod='$single_module'
+ fi
+ if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
+ _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
+ else
+ _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ if test "$DSYMUTIL" != ":"; then
+ _lt_dsymutil='~$DSYMUTIL $lib || :'
+ else
+ _lt_dsymutil=
+ fi
+ ;;
+ esac
+])
+
+
+# _LT_DARWIN_LINKER_FEATURES
+# --------------------------
+# Checks for linker and compiler features on darwin
+m4_defun([_LT_DARWIN_LINKER_FEATURES],
+[
+ m4_require([_LT_REQUIRED_DARWIN_CHECKS])
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=''
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined"
+ case $cc_basename in
+ ifort*) _lt_dar_can_shared=yes ;;
+ *) _lt_dar_can_shared=$GCC ;;
+ esac
+ if test "$_lt_dar_can_shared" = "yes"; then
+ output_verbose_link_cmd=echo
+ _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
+ _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}"
+ _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}"
+ m4_if([$1], [CXX],
+[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
+ _LT_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${_lt_dsymutil}"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="sed '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${_lt_dar_export_syms}${_lt_dsymutil}"
+ fi
+],[])
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+])
+
+# _LT_SYS_MODULE_PATH_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.
+m4_defun([_LT_SYS_MODULE_PATH_AIX],
+[m4_require([_LT_DECL_SED])dnl
+AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+# 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 "$lt_aix_libpath_sed"`
+fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])# _LT_SYS_MODULE_PATH_AIX
+
+
+# _LT_SHELL_INIT(ARG)
+# -------------------
+m4_define([_LT_SHELL_INIT],
+[ifdef([AC_DIVERSION_NOTICE],
+ [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+ [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_SHELL_INIT
+
+
+# _LT_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.
+m4_defun([_LT_PROG_ECHO_BACKSLASH],
+[_LT_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$lt_ECHO in
+X*--fallback-echo)
+ # Remove one level of quotation (which was required for Make).
+ ECHO=`echo "$lt_ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+ ;;
+esac
+
+ECHO=${lt_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 <<_LT_EOF
+[$]*
+_LT_EOF
+ exit 0
+fi
+
+# 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 -z "$lt_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 &&
+ { 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.
+lt_ECHO=$ECHO
+if test "X$lt_ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+ lt_ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(lt_ECHO)
+])
+_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
+_LT_DECL([], [ECHO], [1],
+ [An echo program that does not interpret backslashes])
+])# _LT_PROG_ECHO_BACKSLASH
+
+
+# _LT_ENABLE_LOCK
+# ---------------
+m4_defun([_LT_ENABLE_LOCK],
+[AC_ARG_ENABLE([libtool-lock],
+ [AS_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-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|s390*-*tpf*|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-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ 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-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*|s390*-*tpf*)
+ 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_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[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
+ ;;
+sparc*-*solaris*)
+ # 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
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*) LD="${LD-ld} -m elf64_sparc" ;;
+ *)
+ if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
+ LD="${LD-ld} -64"
+ fi
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+esac
+
+need_locks="$enable_libtool_lock"
+])# _LT_ENABLE_LOCK
+
+
+# _LT_CMD_OLD_ARCHIVE
+# -------------------
+m4_defun([_LT_CMD_OLD_ARCHIVE],
+[AC_CHECK_TOOL(AR, ar, false)
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+_LT_DECL([], [AR], [1], [The archiver])
+_LT_DECL([], [AR_FLAGS], [1])
+
+AC_CHECK_TOOL(STRIP, strip, :)
+test -z "$STRIP" && STRIP=:
+_LT_DECL([], [STRIP], [1], [A symbol stripping program])
+
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+test -z "$RANLIB" && RANLIB=:
+_LT_DECL([], [RANLIB], [1],
+ [Commands used to install an old-style archive])
+
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+_LT_DECL([], [old_postinstall_cmds], [2])
+_LT_DECL([], [old_postuninstall_cmds], [2])
+_LT_TAGDECL([], [old_archive_cmds], [2],
+ [Commands used to build an old-style archive])
+])# _LT_CMD_OLD_ARCHIVE
+
+
+# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([_LT_COMPILER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+ echo "$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}\{0,1\} :&$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 -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ fi
+ $RM conftest*
+])
+
+if test x"[$]$2" = xyes; then
+ m4_if([$5], , :, [$5])
+else
+ m4_if([$6], , :, [$6])
+fi
+])# _LT_COMPILER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
+
+
+# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [ACTION-SUCCESS], [ACTION-FAILURE])
+# ----------------------------------------------------
+# Check whether the given linker option works
+AC_DEFUN([_LT_LINKER_OPTION],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_CACHE_CHECK([$1], [$2],
+ [$2=no
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS $3"
+ echo "$lt_simple_link_test_code" > conftest.$ac_ext
+ if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then
+ # The linker 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 -e '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ $2=yes
+ fi
+ else
+ $2=yes
+ fi
+ fi
+ $RM -r conftest*
+ LDFLAGS="$save_LDFLAGS"
+])
+
+if test x"[$]$2" = xyes; then
+ m4_if([$4], , :, [$4])
+else
+ m4_if([$5], , :, [$5])
+fi
+])# _LT_LINKER_OPTION
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
+
+
+# LT_CMD_MAX_LEN
+#---------------
+AC_DEFUN([LT_CMD_MAX_LEN],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# 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* | cegcc*)
+ # 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 all BSDs
+ 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`
+ ;;
+
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+
+ 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
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len"; then
+ 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`
+ else
+ # Make teststring a little bigger before we do anything with it.
+ # a 1K string should be a reasonable start.
+ for i in 1 2 3 4 5 6 7 8 ; do
+ teststring=$teststring$teststring
+ done
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ # 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"`$SHELL [$]0 --fallback-echo "X$teststring$teststring" 2>/dev/null` \
+ = "XX$teststring$teststring"; } >/dev/null 2>&1 &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ # Only check the string length outside the loop.
+ lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
+ 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`
+ fi
+ ;;
+ 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
+max_cmd_len=$lt_cv_sys_max_cmd_len
+_LT_DECL([], [max_cmd_len], [0],
+ [What is the maximum length of a command?])
+])# LT_CMD_MAX_LEN
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+
+
+# _LT_HEADER_DLFCN
+# ----------------
+m4_defun([_LT_HEADER_DLFCN],
+[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
+])# _LT_HEADER_DLFCN
+
+
+# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ----------------------------------------------------------------
+m4_defun([_LT_TRY_DLOPEN_SELF],
+[m4_require([_LT_HEADER_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 <<_LT_EOF
+[#line __oline__ "configure"
+#include "confdefs.h"
+
+#if HAVE_DLFCN_H
+#include <dlfcn.h>
+#endif
+
+#include <stdio.h>
+
+#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
+
+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); */
+ }
+ else
+ puts (dlerror ());
+
+ return status;
+}]
+_LT_EOF
+ if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
+ (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
+ lt_status=$?
+ case x$lt_status in
+ x$lt_dlno_uscore) $1 ;;
+ x$lt_dlneed_uscore) $2 ;;
+ x$lt_dlunknown|x*) $3 ;;
+ esac
+ else :
+ # compilation failed
+ $3
+ fi
+fi
+rm -fr conftest*
+])# _LT_TRY_DLOPEN_SELF
+
+
+# LT_SYS_DLOPEN_SELF
+# ------------------
+AC_DEFUN([LT_SYS_DLOPEN_SELF],
+[m4_require([_LT_HEADER_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* | cegcc*)
+ 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="-ldld"],
+ [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="-ldld"])
+ ])
+ ])
+ ])
+ ])
+ ])
+ ;;
+ 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"
+ wl=$lt_prog_compiler_wl 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_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
+ wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
+ AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
+ lt_cv_dlopen_self_static, [dnl
+ _LT_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
+_LT_DECL([dlopen_support], [enable_dlopen], [0],
+ [Whether dlopen is supported])
+_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
+ [Whether dlopen of programs is supported])
+_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
+ [Whether dlopen of statically linked programs is supported])
+])# LT_SYS_DLOPEN_SELF
+
+# Old name:
+AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+
+
+# _LT_COMPILER_C_O([TAGNAME])
+# ---------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler.
+# This macro does not hard code the compiler like AC_PROG_CC_C_O.
+m4_defun([_LT_COMPILER_C_O],
+[m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
+ [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+ [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+ $RM -r conftest 2>/dev/null
+ mkdir conftest
+ cd conftest
+ mkdir out
+ echo "$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}\{0,1\} :&$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 -e '/^$/d' > out/conftest.exp
+ $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2
+ if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then
+ _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+ fi
+ fi
+ chmod u+w . 2>&AS_MESSAGE_LOG_FD
+ $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 ..
+ $RM -r conftest
+ $RM conftest*
+])
+_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
+ [Does compiler simultaneously support -c and -o options?])
+])# _LT_COMPILER_C_O
+
+
+# _LT_COMPILER_FILE_LOCKS([TAGNAME])
+# ----------------------------------
+# Check to see if we can do hard links to lock some files if needed
+m4_defun([_LT_COMPILER_FILE_LOCKS],
+[m4_require([_LT_ENABLE_LOCK])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+_LT_COMPILER_C_O([$1])
+
+hard_links="nottested"
+if test "$_LT_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
+_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
+])# _LT_COMPILER_FILE_LOCKS
+
+
+# _LT_CHECK_OBJDIR
+# ----------------
+m4_defun([_LT_CHECK_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
+_LT_DECL([], [objdir], [0],
+ [The name of the directory that contains temporary libtool files])dnl
+m4_pattern_allow([LT_OBJDIR])dnl
+AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
+ [Define to the sub-directory in which libtool stores uninstalled libraries.])
+])# _LT_CHECK_OBJDIR
+
+
+# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
+# --------------------------------------
+# Check hardcoding attributes.
+m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+[AC_MSG_CHECKING([how to hardcode library paths into programs])
+_LT_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
+ test -n "$_LT_TAGVAR(runpath_var, $1)" ||
+ test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+
+ # We can hardcode non-existent directories.
+ if test "$_LT_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_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+ test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+ # Linking always hardcodes the temporary library directory.
+ _LT_TAGVAR(hardcode_action, $1)=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ _LT_TAGVAR(hardcode_action, $1)=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ _LT_TAGVAR(hardcode_action, $1)=unsupported
+fi
+AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+
+if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
+ test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; 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
+_LT_TAGDECL([], [hardcode_action], [0],
+ [How to hardcode a shared library path into an executable])
+])# _LT_LINKER_HARDCODE_LIBPATH
+
+
+# _LT_CMD_STRIPLIB
+# ----------------
+m4_defun([_LT_CMD_STRIPLIB],
+[m4_require([_LT_DECL_EGREP])
+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"
+ old_striplib="$STRIP -S"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+ fi
+ ;;
+ *)
+ AC_MSG_RESULT([no])
+ ;;
+ esac
+fi
+_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
+_LT_DECL([], [striplib], [1])
+])# _LT_CMD_STRIPLIB
+
+
+# _LT_SYS_DYNAMIC_LINKER([TAG])
+# -----------------------------
+# PORTME Fill in your ld.so characteristics
+m4_defun([_LT_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_OBJDUMP])dnl
+m4_require([_LT_DECL_SED])dnl
+AC_MSG_CHECKING([dynamic linker characteristics])
+m4_if([$1],
+ [], [
+if test "$GCC" = yes; then
+ case $host_os in
+ darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
+ *) lt_awk_arg="/^libraries:/" ;;
+ esac
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if $ECHO "$lt_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.
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
+ # Ok, now we have the path, separated by spaces, we can step through it
+ # and add multilib dir if necessary.
+ lt_tmp_lt_search_path_spec=
+ lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null`
+ for lt_sys_path in $lt_search_path_spec; do
+ if test -d "$lt_sys_path/$lt_multi_os_dir"; then
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir"
+ else
+ test -d "$lt_sys_path" && \
+ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
+ fi
+ done
+ lt_search_path_spec=`$ECHO $lt_tmp_lt_search_path_spec | awk '
+BEGIN {RS=" "; FS="/|\n";} {
+ lt_foo="";
+ lt_count=0;
+ for (lt_i = NF; lt_i > 0; lt_i--) {
+ if ($lt_i != "" && $lt_i != ".") {
+ if ($lt_i == "..") {
+ lt_count++;
+ } else {
+ if (lt_count == 0) {
+ lt_foo="/" $lt_i lt_foo;
+ } else {
+ lt_count--;
+ }
+ }
+ }
+ }
+ if (lt_foo != "") { lt_freq[[lt_foo]]++; }
+ if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
+}'`
+ sys_lib_search_path_spec=`$ECHO $lt_search_path_spec`
+else
+ sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
+fi])
+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"
+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'
+ ;;
+
+aix[[4-9]]*)
+ 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<name>.so
+ # instead of lib<name>.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*)
+ case $host_cpu in
+ powerpc)
+ # Since July 2007 AmigaOS4 officially supports .so libraries.
+ # When compiling the executable, add -use-dynld -Lsobjs: to the compileline.
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
+ ;;
+ m68k)
+ 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'
+ ;;
+ esac
+ ;;
+
+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* | cegcc*)
+ 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,cegcc*)
+ 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~
+ chmod a+x \$dldir/$dlname~
+ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then
+ eval '\''$striplib \$dldir/$dlname'\'' || exit \$?;
+ fi'
+ 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* | cegcc*)
+ # 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}${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`'
+m4_if([$1], [],[
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+ 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* | dragonfly*)
+ # DragonFly does not have aout. When/if they implement a new
+ # versioning mechanism, adjust this.
+ if test -x /usr/bin/objformat; then
+ objformat=`/usr/bin/objformat`
+ else
+ case $host_os in
+ freebsd[[123]]*) objformat=aout ;;
+ *) objformat=elf ;;
+ esac
+ fi
+ 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
+ ;;
+ freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \
+ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1)
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+ *) # from 4.6 on, and DragonFly
+ shlibpath_overrides_runpath=yes
+ 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'
+ ;;
+
+interix[[3-9]]*)
+ version_type=linux
+ need_lib_prefix=no
+ need_version=no
+ 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='Interix 3.x ld.so.1 (PE, like ELF)'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+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* | k*bsd*-gnu | kopensolaris*-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'
+ finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ # Some binutils ld are patched to set DT_RUNPATH
+ save_LDFLAGS=$LDFLAGS
+ save_libdir=$libdir
+ eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
+ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
+ AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
+ [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
+ [shlibpath_overrides_runpath=yes])])
+ LDFLAGS=$save_LDFLAGS
+ libdir=$save_libdir
+
+ # 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>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;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'
+ ;;
+
+netbsdelf*-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='NetBSD ld.elf_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=qnx
+ need_lib_prefix=no
+ need_version=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='ldqnx.so'
+ ;;
+
+openbsd*)
+ version_type=sunos
+ sys_lib_dlsearch_path_spec="/usr/lib"
+ 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"
+ ;;
+
+rdos*)
+ dynamic_linker=no
+ ;;
+
+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.3*)
+ 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
+ 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
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ version_type=freebsd-elf
+ need_lib_prefix=no
+ need_version=no
+ library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
+ soname_spec='${libname}${release}${shared_ext}$major'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=yes
+ hardcode_into_libs=yes
+ if test "$with_gnu_ld" = yes; then
+ sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib'
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ case $host_os in
+ sco3.2v5*)
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
+ ;;
+ esac
+ fi
+ sys_lib_dlsearch_path_spec='/usr/lib'
+ ;;
+
+tpf*)
+ # TPF is a cross-target only. Preferred cross-host = GNU/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}'
+ shlibpath_var=LD_LIBRARY_PATH
+ shlibpath_overrides_runpath=no
+ hardcode_into_libs=yes
+ ;;
+
+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
+
+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 "${lt_cv_sys_lib_search_path_spec+set}" = set; then
+ sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec"
+fi
+if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then
+ sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec"
+fi
+
+_LT_DECL([], [variables_saved_for_relink], [1],
+ [Variables whose values should be saved in libtool wrapper scripts and
+ restored at link time])
+_LT_DECL([], [need_lib_prefix], [0],
+ [Do we need the "lib" prefix for modules?])
+_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
+_LT_DECL([], [version_type], [0], [Library versioning type])
+_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable])
+_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
+_LT_DECL([], [shlibpath_overrides_runpath], [0],
+ [Is shlibpath searched before the hard-coded library search path?])
+_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
+_LT_DECL([], [library_names_spec], [1],
+ [[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]])
+_LT_DECL([], [soname_spec], [1],
+ [[The coded name of the library, if different from the real name]])
+_LT_DECL([], [postinstall_cmds], [2],
+ [Command to use after installation of a shared archive])
+_LT_DECL([], [postuninstall_cmds], [2],
+ [Command to use after uninstallation of a shared archive])
+_LT_DECL([], [finish_cmds], [2],
+ [Commands used to finish a libtool library installation in a directory])
+_LT_DECL([], [finish_eval], [1],
+ [[As "finish_cmds", except a single script fragment to be evaled but
+ not shown]])
+_LT_DECL([], [hardcode_into_libs], [0],
+ [Whether we should hardcode library paths into libraries])
+_LT_DECL([], [sys_lib_search_path_spec], [2],
+ [Compile-time system search path for libraries])
+_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
+ [Run-time system search path for libraries])
+])# _LT_SYS_DYNAMIC_LINKER
+
+
+# _LT_PATH_TOOL_PREFIX(TOOL)
+# --------------------------
+# find a file program which can recognize shared library
+AC_DEFUN([_LT_PATH_TOOL_PREFIX],
+[m4_require([_LT_DECL_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="m4_if([$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 <<_LT_EOF 1>&2
+
+*** Warning: the command libtool uses to detect shared libraries,
+*** $file_magic_cmd, produces output that libtool cannot recognize.
+*** The result is that libtool may fail to recognize shared libraries
+*** as such. This will affect the creation of libtool libraries that
+*** depend on shared libraries, but programs linked with such libtool
+*** libraries will work regardless of this problem. Nevertheless, you
+*** may want to report the problem to your system manager and/or to
+*** bug-libtool@gnu.org
+
+_LT_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
+_LT_DECL([], [MAGIC_CMD], [0],
+ [Used to examine libraries when file_magic_cmd begins with "file"])dnl
+])# _LT_PATH_TOOL_PREFIX
+
+# Old name:
+AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
+
+
+# _LT_PATH_MAGIC
+# --------------
+# find a file program which can recognize a shared library
+m4_defun([_LT_PATH_MAGIC],
+[_LT_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
+ _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+ else
+ MAGIC_CMD=:
+ fi
+fi
+])# _LT_PATH_MAGIC
+
+
+# LT_PATH_LD
+# ----------
+# find the pathname to the GNU or non-GNU linker
+AC_DEFUN([LT_PATH_LD],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+
+AC_ARG_WITH([gnu-ld],
+ [AS_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])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 variants of GNU ld only accept -v.
+ # Break only if it was the GNU/non-GNU ld that we prefer.
+ case `"$lt_cv_path_LD" -v 2>&1 </dev/null` in
+ *GNU* | *'with BFD'*)
+ test "$with_gnu_ld" != no && break
+ ;;
+ *)
+ test "$with_gnu_ld" != yes && break
+ ;;
+ esac
+ fi
+ done
+ IFS="$lt_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])
+_LT_PATH_LD_GNU
+AC_SUBST([LD])
+
+_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
+])# LT_PATH_LD
+
+# Old names:
+AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
+AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_LD], [])
+dnl AC_DEFUN([AC_PROG_LD], [])
+
+
+# _LT_PATH_LD_GNU
+#- --------------
+m4_defun([_LT_PATH_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 lds only accept -v.
+case `$LD -v 2>&1 </dev/null` in
+*GNU* | *'with BFD'*)
+ lt_cv_prog_gnu_ld=yes
+ ;;
+*)
+ lt_cv_prog_gnu_ld=no
+ ;;
+esac])
+with_gnu_ld=$lt_cv_prog_gnu_ld
+])# _LT_PATH_LD_GNU
+
+
+# _LT_CMD_RELOAD
+# --------------
+# find reload flag for linker
+# -- PORTME Some linkers may need a different reload flag.
+m4_defun([_LT_CMD_RELOAD],
+[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
+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='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
+ else
+ reload_cmds='$LD$reload_flag -o $output$reload_objs'
+ fi
+ ;;
+esac
+_LT_DECL([], [reload_flag], [1], [How to create reloadable object files])dnl
+_LT_DECL([], [reload_cmds], [2])dnl
+])# _LT_CMD_RELOAD
+
+
+# _LT_CHECK_MAGIC_METHOD
+# ----------------------
+# how to check for library dependencies
+# -- PORTME fill in with the dynamic library characteristics
+m4_defun([_LT_CHECK_MAGIC_METHOD],
+[m4_require([_LT_DECL_EGREP])
+m4_require([_LT_DECL_OBJDUMP])
+AC_CACHE_CHECK([how to recognize 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 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
+aix[[4-9]]*)
+ 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',
+ # unless we find 'file', for example because we are cross-compiling.
+ if ( file / ) >/dev/null 2>&1; then
+ lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
+ lt_cv_file_magic_cmd='func_win32_libid'
+ else
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ fi
+ ;;
+
+cegcc)
+ # use the weaker test based on 'objdump'. See mingw*.
+ lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
+ lt_cv_file_magic_cmd='$OBJDUMP -f'
+ ;;
+
+darwin* | rhapsody*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+freebsd* | 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
+ ;;
+
+interix[[3-9]]*)
+ # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here
+ lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$'
+ ;;
+
+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* | k*bsd*-gnu | kopensolaris*-gnu)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+netbsd* | netbsdelf*-gnu)
+ 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=pass_all
+ ;;
+
+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
+ ;;
+
+rdos*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+solaris*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+
+sysv4 | sysv4.3*)
+ 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
+ ;;
+ pc)
+ lt_cv_deplibs_check_method=pass_all
+ ;;
+ esac
+ ;;
+
+tpf*)
+ 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
+
+_LT_DECL([], [deplibs_check_method], [1],
+ [Method to check whether dependent libraries are shared objects])
+_LT_DECL([], [file_magic_cmd], [1],
+ [Command to use when deplibs_check_method == "file_magic"])
+])# _LT_CHECK_MAGIC_METHOD
+
+
+# LT_PATH_NM
+# ----------
+# find the pathname to a BSD- or MS-compatible name lister
+AC_DEFUN([LT_PATH_NM],
+[AC_REQUIRE([AC_PROG_CC])dnl
+AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+[if test -n "$NM"; then
+ # Let the user override the test.
+ lt_cv_path_NM="$NM"
+else
+ lt_nm_to_check="${ac_tool_prefix}nm"
+ if test -n "$ac_tool_prefix" && test "$build" = "$host"; then
+ lt_nm_to_check="$lt_nm_to_check nm"
+ fi
+ for lt_tmp_nm in $lt_nm_to_check; do
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do
+ IFS="$lt_save_ifs"
+ test -z "$ac_dir" && ac_dir=.
+ tmp_nm="$ac_dir/$lt_tmp_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"
+ done
+ : ${lt_cv_path_NM=no}
+fi])
+if test "$lt_cv_path_NM" != "no"; then
+ NM="$lt_cv_path_NM"
+else
+ # Didn't find any BSD compatible name lister, look for dumpbin.
+ AC_CHECK_TOOLS(DUMPBIN, ["dumpbin -symbols" "link -dump -symbols"], :)
+ AC_SUBST([DUMPBIN])
+ if test "$DUMPBIN" != ":"; then
+ NM="$DUMPBIN"
+ fi
+fi
+test -z "$NM" && NM=nm
+AC_SUBST([NM])
+_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
+
+AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
+ [lt_cv_nm_interface="BSD nm"
+ echo "int some_variable = 0;" > conftest.$ac_ext
+ (eval echo "\"\$as_me:__oline__: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$ac_compile" 2>conftest.err)
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ (eval echo "\"\$as_me:__oline__: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
+ (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
+ cat conftest.err >&AS_MESSAGE_LOG_FD
+ (eval echo "\"\$as_me:__oline__: output\"" >&AS_MESSAGE_LOG_FD)
+ cat conftest.out >&AS_MESSAGE_LOG_FD
+ if $GREP 'External.*some_variable' conftest.out > /dev/null; then
+ lt_cv_nm_interface="MS dumpbin"
+ fi
+ rm -f conftest*])
+])# LT_PATH_NM
+
+# Old names:
+AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
+AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_PROG_NM], [])
+dnl AC_DEFUN([AC_PROG_NM], [])
+
+
+# LT_LIB_M
+# --------
+# check for math library
+AC_DEFUN([LT_LIB_M],
+[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_SUBST([LIBM])
+])# LT_LIB_M
+
+# Old name:
+AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_CHECK_LIBM], [])
+
+
+# _LT_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------
+m4_defun([_LT_COMPILER_NO_RTTI],
+[m4_require([_LT_TAG_COMPILER])dnl
+
+_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+
+ _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+ lt_cv_prog_compiler_rtti_exceptions,
+ [-fno-rtti -fno-exceptions], [],
+ [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+fi
+_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
+ [Compiler flag to turn off builtin functions])
+])# _LT_COMPILER_NO_RTTI
+
+
+# _LT_CMD_GLOBAL_SYMBOLS
+# ----------------------
+m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+AC_REQUIRE([LT_PATH_LD])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+
+# 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]]*\)'
+
+# Define system-specific variables.
+case $host_os in
+aix*)
+ symcode='[[BCDT]]'
+ ;;
+cygwin* | mingw* | pw32* | cegcc*)
+ symcode='[[ABCDGISTW]]'
+ ;;
+hpux*)
+ if test "$host_cpu" = ia64; then
+ symcode='[[ABCDEGRST]]'
+ fi
+ ;;
+irix* | nonstopux*)
+ symcode='[[BCDEGRST]]'
+ ;;
+osf*)
+ symcode='[[BCDEGQRST]]'
+ ;;
+solaris*)
+ symcode='[[BDRT]]'
+ ;;
+sco3.2v5*)
+ symcode='[[DT]]'
+ ;;
+sysv4.2uw2*)
+ symcode='[[DT]]'
+ ;;
+sysv5* | sco5v6* | unixware* | OpenUNIX*)
+ symcode='[[ABDT]]'
+ ;;
+sysv4)
+ symcode='[[DFNSTU]]'
+ ;;
+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
+
+# Transform an extracted symbol line into a proper C declaration.
+# Some systems (esp. on ia64) link data and code symbols differently,
+# so use this general approach.
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \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\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'"
+lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
+
+# 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
+
+# Try without a prefix underscore, 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.
+ if test "$lt_cv_nm_interface" = "MS dumpbin"; then
+ # Fake it for dumpbin and say T for any non-static function
+ # and D for any global variable.
+ # Also find C++ and __fastcall symbols from MSVC++,
+ # which start with @ or ?.
+ lt_cv_sys_global_symbol_pipe="$AWK ['"\
+" {last_section=section; section=\$ 3};"\
+" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
+" \$ 0!~/External *\|/{next};"\
+" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
+" {if(hide[section]) next};"\
+" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
+" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
+" s[1]~/^[@?]/{print s[1], s[1]; next};"\
+" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
+" ' prfx=^$ac_symprfx]"
+ else
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
+ fi
+
+ # Check to see that the pipe works correctly.
+ pipe_works=no
+
+ rm -f conftest*
+ cat > conftest.$ac_ext <<_LT_EOF
+#ifdef __cplusplus
+extern "C" {
+#endif
+char nm_test_var;
+void nm_test_func(void);
+void nm_test_func(void){}
+#ifdef __cplusplus
+}
+#endif
+int main(){nm_test_var='a';nm_test_func();return(0);}
+_LT_EOF
+
+ if AC_TRY_EVAL(ac_compile); then
+ # Now try to grab the symbols.
+ nlist=conftest.nm
+ if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $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 <<_LT_EOF > conftest.$ac_ext
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+_LT_EOF
+ # Now generate the symbol file.
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+
+ cat <<_LT_EOF >> conftest.$ac_ext
+
+/* The mapping between symbol names and symbols. */
+const struct {
+ const char *name;
+ void *address;
+}
+lt__PROGRAM__LTX_preloaded_symbols[[]] =
+{
+ { "@PROGRAM@", (void *) 0 },
+_LT_EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
+ cat <<\_LT_EOF >> conftest.$ac_ext
+ {0, (void *) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt__PROGRAM__LTX_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+_LT_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_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 -rf 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
+
+_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
+ [Take the output of nm and produce a listing of raw symbols and C names])
+_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
+ [Transform the output of nm in a proper C declaration])
+_LT_DECL([global_symbol_to_c_name_address],
+ [lt_cv_sys_global_symbol_to_c_name_address], [1],
+ [Transform the output of nm in a C name address pair])
+_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
+ [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
+ [Transform the output of nm in a C name address pair when lib prefix is needed])
+]) # _LT_CMD_GLOBAL_SYMBOLS
+
+
+# _LT_COMPILER_PIC([TAGNAME])
+# ---------------------------
+m4_defun([_LT_COMPILER_PIC],
+[m4_require([_LT_TAG_COMPILER])dnl
+_LT_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_TAGVAR(lt_prog_compiler_static, $1)=
+
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+m4_if([$1], [CXX], [
+ # C++ specific cases for pic, static, wl, etc.
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_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_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ m68k)
+ # 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_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+ mingw* | cygwin* | os2* | pw32* | cegcc*)
+ # 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).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ m4_if([$1], [GCJ], [],
+ [_LT_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_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+ *djgpp*)
+ # DJGPP does not support shared libraries at all
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ interix[[3-9]]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ else
+ case $host_os in
+ aix[[4-9]]*)
+ # All AIX code is PIC.
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ chorus*)
+ case $cc_basename in
+ cxch68*)
+ # Green Hills C++ Compiler
+ # _LT_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_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ freebsd* | dragonfly*)
+ # FreeBSD uses GNU C++
+ ;;
+ hpux9* | hpux10* | hpux11*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ if test "$host_cpu" != ia64; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ fi
+ ;;
+ aCC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ case $host_cpu in
+ hppa*64*|ia64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ interix*)
+ # This is c89, which is MS Visual C++ (no shared libs)
+ # Anyone wants to do a port?
+ ;;
+ irix5* | irix6* | nonstopux*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ # CC pic flag -KPIC is the default.
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ KCC*)
+ # KAI C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ ecpc* )
+ # old Intel C++ for x86_64 which still supported -KPIC.
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ icpc* )
+ # Intel C++, used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ cxx*)
+ # Compaq C++
+ # Make sure the PIC flag is empty. It appears that all Alpha
+ # Linux and Compaq Tru64 Unix objects are PIC.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ xlc* | xlC*)
+ # IBM XL 8.0 on PPC
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ lynxos*)
+ ;;
+ m88k*)
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ netbsd* | netbsdelf*-gnu)
+ ;;
+ *qnx* | *nto*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+ osf3* | osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ cxx*)
+ # Digital/Compaq C++
+ _LT_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_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ psos*)
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ lcc*)
+ # Lucid
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ ;;
+ *)
+ ;;
+ esac
+ ;;
+ vxworks*)
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+],
+[
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_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_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ m68k)
+ # 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_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
+ ;;
+ esac
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # 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).
+ # Although the cygwin gcc ignores -fPIC, still need this for old-style
+ # (--disable-auto-import) libraries
+ m4_if([$1], [GCJ], [],
+ [_LT_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_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ ;;
+
+ hpux*)
+ # PIC is the default for 64-bit PA HP-UX, but not for 32-bit
+ # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag
+ # sets the default TLS model and affects inlining.
+ case $host_cpu in
+ hppa*64*)
+ # +Z the default
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
+ ;;
+
+ interix[[3-9]]*)
+ # Interix 3.x gcc -fpic/-fPIC options generate broken code.
+ # Instead, we relocate shared libraries at runtime.
+ ;;
+
+ msdosdjgpp*)
+ # Just because we use GCC doesn't mean we suddenly get shared libraries
+ # on systems that don't support them.
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ enable_shared=no
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ fi
+ ;;
+
+ *)
+ _LT_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_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ else
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+
+ mingw* | cygwin* | pw32* | os2* | cegcc*)
+ # 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).
+ m4_if([$1], [GCJ], [],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ _LT_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_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # PIC (with -KPIC) is the default.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ case $cc_basename in
+ # old Intel for x86_64 which still supported -KPIC.
+ ecc*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ # icc used to be incompatible with GCC.
+ # ICC 10 doesn't accept -KPIC any more.
+ icc* | ifort*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ ;;
+ # Lahey Fortran 8.1.
+ lf95*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ ccc*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All Alpha code is PIC.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+ xl*)
+ # IBM XL C 8.0/Fortran 10.1 on PPC
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C 5.9
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ ;;
+ *Sun\ F*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ newsos6)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ *nto* | *qnx*)
+ # QNX uses GNU C++, but need to define -shared option too, otherwise
+ # it will coredump.
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
+ ;;
+
+ osf3* | osf4* | osf5*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ # All OSF/1 code is PIC.
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ rdos*)
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ ;;
+
+ solaris*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ unicos*)
+ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+
+ uts4*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ *)
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ ;;
+ esac
+ fi
+])
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ *)
+ _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
+ ;;
+esac
+AC_MSG_RESULT([$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
+_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
+ [How to pass a linker flag through the compiler])
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
+ _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
+ [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
+ [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
+ [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+ "" | " "*) ;;
+ *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+ esac],
+ [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+fi
+_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
+ [Additional compiler flags for building library objects])
+
+#
+# Check to make sure the static flag actually works.
+#
+wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
+_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+ _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+ $lt_tmp_static_flag,
+ [],
+ [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
+_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
+ [Compiler flag to prevent dynamic linking])
+])# _LT_COMPILER_PIC
+
+
+# _LT_LINKER_SHLIBS([TAGNAME])
+# ----------------------------
+# See if the linker supports building shared libraries.
+m4_defun([_LT_LINKER_SHLIBS],
+[AC_REQUIRE([LT_PATH_LD])dnl
+AC_REQUIRE([LT_PATH_NM])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+m4_require([_LT_DECL_SED])dnl
+m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
+m4_require([_LT_TAG_COMPILER])dnl
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+m4_if([$1], [CXX], [
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ case $host_os in
+ aix[[4-9]]*)
+ # 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_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_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_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+ ;;
+ cygwin* | mingw* | cegcc*)
+ _LT_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'
+ ;;
+ linux* | k*bsd*-gnu)
+ _LT_TAGVAR(link_all_deplibs, $1)=no
+ ;;
+ *)
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ esac
+ _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+], [
+ runpath_var=
+ _LT_TAGVAR(allow_undefined_flag, $1)=
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(archive_cmds, $1)=
+ _LT_TAGVAR(archive_expsym_cmds, $1)=
+ _LT_TAGVAR(compiler_needs_object, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ _LT_TAGVAR(hardcode_automatic, $1)=no
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ _LT_TAGVAR(hardcode_minus_L, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_TAGVAR(inherit_rpath, $1)=no
+ _LT_TAGVAR(link_all_deplibs, $1)=unknown
+ _LT_TAGVAR(module_cmds, $1)=
+ _LT_TAGVAR(module_expsym_cmds, $1)=
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)=
+ _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+ _LT_TAGVAR(thread_safe_flag_spec, $1)=
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ _LT_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_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+ # 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.
+ # Exclude shared library initialization/finalization symbols.
+dnl Note also adjust exclude_expsyms for C++ above.
+ extract_expsyms_cmds=
+
+ case $host_os in
+ cygwin* | mingw* | pw32* | cegcc*)
+ # 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
+ ;;
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
+ ;;
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ linux* | k*bsd*-gnu)
+ _LT_TAGVAR(link_all_deplibs, $1)=no
+ ;;
+ esac
+
+ _LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_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_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>&1` in
+ *GNU\ gold*) supports_anon_versioning=yes ;;
+ *\ [[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
+ aix[[3-9]]*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&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.
+
+_LT_EOF
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)=''
+ ;;
+ m68k)
+ _LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_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_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ interix[[3-9]]*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+
+ gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu)
+ tmp_diet=no
+ if test "$host_os" = linux-dietlibc; then
+ case $cc_basename in
+ diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn)
+ esac
+ fi
+ if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \
+ && test "$tmp_diet" = no
+ then
+ tmp_addflag=
+ tmp_sharedflag='-shared'
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ _LT_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* | pgf95*) # Portland Group f77 and f90 compilers
+ _LT_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' ;;
+ lf95*) # Lahey Fortran 8.1
+ _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ tmp_sharedflag='--shared' ;;
+ xl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below)
+ tmp_sharedflag='-qmkshrobj'
+ tmp_addflag= ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(compiler_needs_object, $1)=yes
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ esac
+ _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_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 '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+
+ case $cc_basename in
+ xlf*)
+ # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
+ _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $compiler_flags -soname $soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_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~
+ $LD -shared $libobjs $deplibs $compiler_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ esac
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ netbsd* | netbsdelf*-gnu)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_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*)
+ if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&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.
+
+_LT_EOF
+ elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_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_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ cat <<_LT_EOF 1>&2
+
+*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
+*** reliably create shared libraries on SCO systems. Therefore, libtool
+*** is disabling shared libraries support. We urge you to upgrade GNU
+*** binutils to release 2.16.91.0.3 or newer. Another option is to modify
+*** your PATH or compiler configuration so that the native linker is
+*** used, and then restart.
+
+_LT_EOF
+ ;;
+ *)
+ # For security reasons, it is highly recommended that you always
+ # use absolute paths for naming shared libraries, and exclude the
+ # DT_RUNPATH tag from executables and libraries. But doing so
+ # requires that you compile everything twice, which is a pain.
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_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_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ sunos4*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_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_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+
+ if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+ runpath_var=
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_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_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=yes
+ _LT_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_TAGVAR(hardcode_minus_L, $1)=yes
+ if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
+ # Neither direct hardcoding nor static linking is supported with a
+ # broken collect2.
+ _LT_TAGVAR(hardcode_direct, $1)=unsupported
+ fi
+ ;;
+
+ aix[[4-9]]*)
+ 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_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_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]].*|aix[[5-9]]*)
+ 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_TAGVAR(archive_cmds, $1)=''
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+ 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
+ :
+ else
+ # We have old collect2
+ _LT_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_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ fi
+ ;;
+ esac
+ shared_flag='-shared'
+ if test "$aix_use_runtimelinking" = yes; then
+ shared_flag="$shared_flag "'${wl}-G'
+ fi
+ _LT_TAGVAR(link_all_deplibs, $1)=no
+ 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
+
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ _LT_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_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX
+ _LT_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_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ amigaos*)
+ case $host_cpu in
+ powerpc)
+ # see comment about AmigaOS4 .so support
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)=''
+ ;;
+ m68k)
+ _LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ ;;
+
+ bsdi[[45]]*)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # 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_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_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_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `$ECHO "X$deplibs" | $Xsed -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
+ # FIXME: Should let the user specify the lib program.
+ _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ _LT_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ ;;
+
+ darwin* | rhapsody*)
+ _LT_DARWIN_LINKER_FEATURES($1)
+ ;;
+
+ dgux*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ freebsd1*)
+ _LT_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_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ _LT_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_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_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ if test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_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_TAGVAR(hardcode_minus_L, $1)=yes
+ fi
+ ;;
+
+ hpux11*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_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*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ fi
+ if test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ *)
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_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_TAGVAR(hardcode_minus_L, $1)=yes
+ ;;
+ esac
+ fi
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ # Try to use the -exported_symbol ld option, if it does not
+ # work, assume that -exports_file does not work either and
+ # implicitly export all symbols.
+ save_LDFLAGS="$LDFLAGS"
+ LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
+ AC_LINK_IFELSE(int foo(void) {},
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib'
+ )
+ LDFLAGS="$save_LDFLAGS"
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(inherit_rpath, $1)=yes
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+
+ netbsd* | netbsdelf*-gnu)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ newsos6)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *nto* | *qnx*)
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ else
+ case $host_os in
+ openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ os2*)
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_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_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+
+ osf3*)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ else
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~
+ $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp'
+
+ # Both c and cxx compiler support -rpath directly
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ fi
+ _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+
+ solaris*)
+ _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_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}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ else
+ case `$CC -V 2>&1` in
+ *"Compilers 5.0"*)
+ wlarc=''
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_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'
+ ;;
+ *)
+ wlarc='${wl}'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_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} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp'
+ ;;
+ esac
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'. GCC discards it without `$wl',
+ # but is careful enough not to reorder.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ _LT_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_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4)
+ case $host_vendor in
+ sni)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ ;;
+ motorola)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ sysv4.3*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ fi
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ if test "$GCC" = yes; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+
+ uts4*)
+ _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ *)
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+
+ if test x$host_vendor = xsni; then
+ case $host in
+ sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
+ ;;
+ esac
+ fi
+ fi
+])
+AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
+
+_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
+_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
+_LT_DECL([], [extract_expsyms_cmds], [2],
+ [The commands to extract the exported symbol list from a shared archive])
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+x|xyes)
+ # Assume -lc should be added
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $_LT_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*
+ echo "$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_TAGVAR(lt_prog_compiler_wl, $1)
+ pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
+ _LT_TAGVAR(allow_undefined_flag, $1)=
+ if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
+ then
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ else
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ fi
+ _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $RM conftest*
+ AC_MSG_RESULT([$_LT_TAGVAR(archive_cmds_need_lc, $1)])
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
+ [Whether or not to add -lc for building shared libraries])
+_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
+ [enable_shared_with_static_runtimes], [0],
+ [Whether or not to disallow shared libs when runtime libs are static])
+_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
+ [Compiler flag to allow reflexive dlopens])
+_LT_TAGDECL([], [whole_archive_flag_spec], [1],
+ [Compiler flag to generate shared objects directly from archives])
+_LT_TAGDECL([], [compiler_needs_object], [1],
+ [Whether the compiler copes with passing no objects directly])
+_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
+ [Create an old-style archive from a shared archive])
+_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
+ [Create a temporary old-style archive to link instead of a shared archive])
+_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
+_LT_TAGDECL([], [archive_expsym_cmds], [2])
+_LT_TAGDECL([], [module_cmds], [2],
+ [Commands used to build a loadable module if different from building
+ a shared archive.])
+_LT_TAGDECL([], [module_expsym_cmds], [2])
+_LT_TAGDECL([], [with_gnu_ld], [1],
+ [Whether we are building with GNU ld or not])
+_LT_TAGDECL([], [allow_undefined_flag], [1],
+ [Flag that allows shared libraries with undefined symbols to be built])
+_LT_TAGDECL([], [no_undefined_flag], [1],
+ [Flag that enforces no undefined symbols])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
+ [Flag to hardcode $libdir into a binary during linking.
+ This must work even if $libdir does not exist])
+_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [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]])
+_LT_TAGDECL([], [hardcode_libdir_separator], [1],
+ [Whether we need a single "-rpath" flag with a separated argument])
+_LT_TAGDECL([], [hardcode_direct], [0],
+ [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+ DIR into the resulting binary])
+_LT_TAGDECL([], [hardcode_direct_absolute], [0],
+ [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
+ DIR into the resulting binary and the resulting library dependency is
+ "absolute", i.e impossible to change by setting ${shlibpath_var} if the
+ library is relocated])
+_LT_TAGDECL([], [hardcode_minus_L], [0],
+ [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
+ into the resulting binary])
+_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
+ [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
+ into the resulting binary])
+_LT_TAGDECL([], [hardcode_automatic], [0],
+ [Set to "yes" if building a shared library automatically hardcodes DIR
+ into the library and all subsequent libraries and executables linked
+ against it])
+_LT_TAGDECL([], [inherit_rpath], [0],
+ [Set to yes if linker adds runtime paths of dependent libraries
+ to runtime path list])
+_LT_TAGDECL([], [link_all_deplibs], [0],
+ [Whether libtool must link a program against all its dependency libraries])
+_LT_TAGDECL([], [fix_srcfile_path], [1],
+ [Fix the shell variable $srcfile for the compiler])
+_LT_TAGDECL([], [always_export_symbols], [0],
+ [Set to "yes" if exported symbols are required])
+_LT_TAGDECL([], [export_symbols_cmds], [2],
+ [The commands to list exported symbols])
+_LT_TAGDECL([], [exclude_expsyms], [1],
+ [Symbols that should not be listed in the preloaded symbols])
+_LT_TAGDECL([], [include_expsyms], [1],
+ [Symbols that must always be exported])
+_LT_TAGDECL([], [prelink_cmds], [2],
+ [Commands necessary for linking programs (against libraries) with templates])
+_LT_TAGDECL([], [file_list_spec], [1],
+ [Specify filename containing input files])
+dnl FIXME: Not yet implemented
+dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
+dnl [Compiler flag to generate thread safe objects])
+])# _LT_LINKER_SHLIBS
+
+
+# _LT_LANG_C_CONFIG([TAG])
+# ------------------------
+# Ensure that the configuration variables for a C compiler are suitably
+# defined. These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_C_CONFIG],
+[m4_require([_LT_DECL_EGREP])dnl
+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_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_TAG_COMPILER
+# Save the default compiler, since it gets overwritten when the other
+# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
+compiler_DEFAULT=$CC
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+ _LT_COMPILER_NO_RTTI($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+ LT_SYS_DLOPEN_SELF
+ _LT_CMD_STRIPLIB
+
+ # Report which library types will 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
+ ;;
+
+ aix[[4-9]]*)
+ 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])
+
+ _LT_CONFIG($1)
+fi
+AC_LANG_POP
+CC="$lt_save_CC"
+])# _LT_LANG_C_CONFIG
+
+
+# _LT_PROG_CXX
+# ------------
+# Since AC_PROG_CXX is broken, in that it returns g++ if there is no c++
+# compiler, we have our own version here.
+m4_defun([_LT_PROG_CXX],
+[
+pushdef([AC_MSG_ERROR], [_lt_caught_CXX_error=yes])
+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
+else
+ _lt_caught_CXX_error=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_CXX
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_CXX], [])
+
+
+# _LT_LANG_CXX_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a C++ compiler are suitably
+# defined. These variables are subsequently used by _LT_CONFIG to write
+# the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_CXX_CONFIG],
+[AC_REQUIRE([_LT_PROG_CXX])dnl
+m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+m4_require([_LT_DECL_EGREP])dnl
+
+AC_LANG_PUSH(C++)
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(compiler_needs_object, $1)=no
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the CXX compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_caught_CXX_error" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="int some_variable = 0;"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_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
+ $as_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
+ $as_unset lt_cv_path_LD
+ fi
+ test -z "${LDCXX+set}" || LD=$LDCXX
+ CC=${CXX-"c++"}
+ compiler=$CC
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+
+ if test -n "$compiler"; then
+ # We don't want -fno-exception when compiling C++ code, so set the
+ # no_builtin_flag separately
+ if test "$GXX" = yes; then
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+ else
+ _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+ fi
+
+ if test "$GXX" = yes; then
+ # Set up default GNU C++ configuration
+
+ LT_PATH_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_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_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_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_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_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_TAGVAR(ld_shlibs, $1)=yes
+ case $host_os in
+ aix3*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aix[[4-9]]*)
+ 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]].*|aix[[5-9]]*)
+ 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_TAGVAR(archive_cmds, $1)=''
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+
+ 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
+ :
+ else
+ # We have old collect2
+ _LT_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_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_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
+
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall'
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to
+ # export.
+ _LT_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_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an empty
+ # executable.
+ _LT_SYS_MODULE_PATH_AIX
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then $ECHO "X${wl}${allow_undefined_flag}" | $Xsed; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols"
+ else
+ # Determine the default libpath from the value encoded in an
+ # empty executable.
+ _LT_SYS_MODULE_PATH_AIX
+ _LT_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_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared
+ # libraries.
+ _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname'
+ fi
+ fi
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ chorus*)
+ case $cc_basename in
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ cygwin* | mingw* | pw32* | cegcc*)
+ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_TAGVAR(always_export_symbols, $1)=no
+ _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+ if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ # If the export-symbols file already is a .def file (1st line
+ # is EXPORTS), use it as is; otherwise, prepend...
+ _LT_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}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ darwin* | rhapsody*)
+ _LT_DARWIN_LINKER_FEATURES($1)
+ ;;
+
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ freebsd[[12]]*)
+ # C++ shared libraries reported to be fairly broken before
+ # switch to ELF
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ freebsd-elf*)
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ ;;
+
+ freebsd* | dragonfly*)
+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+ # conventions
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+
+ gnu*)
+ ;;
+
+ hpux9*)
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_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_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ _LT_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 "X$list" | $Xsed'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ _LT_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_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ hpux10*|hpux11*)
+ if test $with_gnu_ld = no; then
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ case $host_cpu in
+ hppa*64*|ia64*)
+ ;;
+ *)
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+ esac
+ fi
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ *)
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_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_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_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 "X$list" | $Xsed'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test $with_gnu_ld = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_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_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ interix[[3-9]]*)
+ _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc.
+ # Instead, shared libraries are loaded at an image base (0x10000000 by
+ # default) and relocated if they conflict, which is a slow very memory
+ # consuming and fragmenting process. To avoid this, we pick a random,
+ # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link
+ # time. Moving up from 0x10000000 also allows more sbrk(2) space.
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ ;;
+ irix5* | irix6*)
+ case $cc_basename in
+ CC*)
+ # SGI C++
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -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_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_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && $ECHO "X${wl}-set_version ${wl}$verstring" | $Xsed` -o $lib'
+ fi
+ fi
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+ esac
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_TAGVAR(inherit_rpath, $1)=yes
+ ;;
+
+ linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ 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_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_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 "X$list" | $Xsed'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_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_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+ ;;
+ icpc* | ecpc* )
+ # 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_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_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_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_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_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ ;;
+ pgCC* | pgcpp*)
+ # Portland Group C++ compiler
+ case `$CC -V` in
+ *pgCC\ [[1-5]]* | *pgcpp\ [[1-5]]*)
+ _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
+ compile_command="$compile_command `find $tpldir -name \*.o | $NL2SP`"'
+ _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
+ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | $NL2SP`~
+ $RANLIB $oldlib'
+ _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
+ rm -rf $tpldir~
+ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
+ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+ ;;
+ *) # Version 6 will use weak symbols
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_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'
+ ;;
+ esac
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_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_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ _LT_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 "X$templist" | $Xsed -e "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 "X$list" | $Xsed'
+ ;;
+ xl*)
+ # IBM XL 8.0 on PPC, with GNU ld
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ if test "x$supports_anon_versioning" = xyes; then
+ _LT_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 -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
+ fi
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $ECHO \"$new_convenience\"` ${wl}--no-whole-archive'
+ _LT_TAGVAR(compiler_needs_object, $1)=yes
+
+ # Not sure whether something based on
+ # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+ # would be better.
+ output_verbose_link_cmd='echo'
+
+ # 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_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ lynxos*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ m88k*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ netbsd*)
+ if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+ wlarc=
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_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::"'
+ ;;
+
+ *nto* | *qnx*)
+ _LT_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+
+ openbsd2*)
+ # C++ shared libraries are fairly broken
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ _LT_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_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_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ fi
+ output_verbose_link_cmd=echo
+ else
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ osf3* | 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_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_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Archives containing C++ object files must be created using
+ # the KAI C++ compiler.
+ case $host in
+ osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
+ *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
+ esac
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ cxx*)
+ case $host in
+ osf3*)
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && $ECHO "X${wl}-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ ;;
+ *)
+ _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && $ECHO "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_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 "X-set_version $verstring" | $Xsed` -update_registry ${output_objdir}/so_locations -o $lib~
+ $RM $lib.exp'
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ ;;
+ esac
+
+ _LT_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 "X$templist" | $Xsed -e "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 "X$list" | $Xsed'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ case $host in
+ osf3*)
+ _LT_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 "X${wl}-set_version ${wl}$verstring" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ *)
+ _LT_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" | $Xsed` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ ;;
+ esac
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_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_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+
+ psos*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ lcc*)
+ # Lucid
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
+ _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_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} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
+
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+ ;;
+ esac
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+
+ output_verbose_link_cmd='echo'
+
+ # 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_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_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_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_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+ if $CC --version | $GREP -v '^2\.7' > /dev/null; then
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_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_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_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_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ ;;
+
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ sysv5* | sco3.2v5* | sco5v6*)
+ # Note: We can NOT use -z defs as we might desire, because we do not
+ # link with -lc, and that would cause any symbols used from libc to
+ # always be unresolved, which means just about no library would
+ # ever link correctly. If we're not using GNU ld we use -z text
+ # though, which does catch some bad symbols but isn't as heavy-handed
+ # as -z defs.
+ _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
+ _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ vxworks*)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+
+ AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
+ test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+ _LT_TAGVAR(GCC, $1)="$GXX"
+ _LT_TAGVAR(LD, $1)="$LD"
+
+ ## CAVEAT EMPTOR:
+ ## There is no encapsulation within the following macros, do not change
+ ## the running order or otherwise move them around unless you know exactly
+ ## what you are doing...
+ _LT_SYS_HIDDEN_LIBDEPS($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ CC=$lt_save_CC
+ LDCXX=$LD
+ LD=$lt_save_LD
+ GCC=$lt_save_GCC
+ 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
+fi # test "$_lt_caught_CXX_error" != yes
+
+AC_LANG_POP
+])# _LT_LANG_CXX_CONFIG
+
+
+# _LT_SYS_HIDDEN_LIBDEPS([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.
+m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
+[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
+# Dependencies to place before and after the object being linked:
+_LT_TAGVAR(predep_objects, $1)=
+_LT_TAGVAR(postdep_objects, $1)=
+_LT_TAGVAR(predeps, $1)=
+_LT_TAGVAR(postdeps, $1)=
+_LT_TAGVAR(compiler_lib_search_path, $1)=
+
+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...
+m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
+int a;
+void foo (void) { a = 0; }
+_LT_EOF
+], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
+class Foo
+{
+public:
+ Foo (void) { a = 0; }
+private:
+ int a;
+};
+_LT_EOF
+], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
+ subroutine foo
+ implicit none
+ integer*4 a
+ a=0
+ return
+ end
+_LT_EOF
+], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
+ subroutine foo
+ implicit none
+ integer a
+ a=0
+ return
+ end
+_LT_EOF
+], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
+public class foo {
+ private int a;
+ public void bar (void) {
+ a = 0;
+ }
+};
+_LT_EOF
+])
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); 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
+
+ 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 "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
+ _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+ else
+ _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${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 "$_LT_TAGVAR(postdeps, $1)"; then
+ _LT_TAGVAR(postdeps, $1)="${prev}${p}"
+ else
+ _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${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 "$_LT_TAGVAR(predep_objects, $1)"; then
+ _LT_TAGVAR(predep_objects, $1)="$p"
+ else
+ _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
+ fi
+ else
+ if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
+ _LT_TAGVAR(postdep_objects, $1)="$p"
+ else
+ _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
+ fi
+ fi
+ ;;
+
+ *) ;; # Ignore the rest.
+
+ esac
+ done
+
+ # Clean up.
+ rm -f a.out a.exe
+else
+ echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$RM -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+m4_if([$1], [CXX],
+[case $host_os in
+interix[[3-9]]*)
+ # Interix 3.5 installs completely hosed .la files for C++, so rather than
+ # hack all around it, let's just trust "g++" to DTRT.
+ _LT_TAGVAR(predep_objects,$1)=
+ _LT_TAGVAR(postdep_objects,$1)=
+ _LT_TAGVAR(postdeps,$1)=
+ ;;
+
+linux*)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ if test "$solaris_use_stlport4" != yes; then
+ _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+
+solaris*)
+ case $cc_basename in
+ CC*)
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ # Adding this requires a known-good setup of shared libraries for
+ # Sun compiler versions before 5.6, else PIC objects from an old
+ # archive will be linked into the output, leading to subtle bugs.
+ if test "$solaris_use_stlport4" != yes; then
+ _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
+ ;;
+esac
+])
+
+case " $_LT_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=
+if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
+ _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
+fi
+_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
+ [The directories searched by this compiler when creating a shared library])
+_LT_TAGDECL([], [predep_objects], [1],
+ [Dependencies to place before and after the objects being linked to
+ create a shared library])
+_LT_TAGDECL([], [postdep_objects], [1])
+_LT_TAGDECL([], [predeps], [1])
+_LT_TAGDECL([], [postdeps], [1])
+_LT_TAGDECL([], [compiler_lib_search_path], [1],
+ [The library search path used internally by the compiler when linking
+ a shared library])
+])# _LT_SYS_HIDDEN_LIBDEPS
+
+
+# _LT_PROG_F77
+# ------------
+# Since AC_PROG_F77 is broken, in that it returns the empty string
+# if there is no fortran compiler, we have our own version here.
+m4_defun([_LT_PROG_F77],
+[
+pushdef([AC_MSG_ERROR], [_lt_disable_F77=yes])
+AC_PROG_F77
+if test -z "$F77" || test "X$F77" = "Xno"; then
+ _lt_disable_F77=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_F77
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_F77], [])
+
+
+# _LT_LANG_F77_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for a Fortran 77 compiler are
+# suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_F77_CONFIG],
+[AC_REQUIRE([_LT_PROG_F77])dnl
+AC_LANG_PUSH(Fortran 77)
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for f77 test sources.
+ac_ext=f
+
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the F77 compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_F77" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="\
+ subroutine t
+ return
+ end
+"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code="\
+ program t
+ end
+"
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_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_GCC=$GCC
+ CC=${F77-"f77"}
+ compiler=$CC
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+ GCC=$G77
+ if test -n "$compiler"; then
+ 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
+ ;;
+ aix[[4-9]]*)
+ 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])
+
+ _LT_TAGVAR(GCC, $1)="$G77"
+ _LT_TAGVAR(LD, $1)="$LD"
+
+ ## CAVEAT EMPTOR:
+ ## There is no encapsulation within the following macros, do not change
+ ## the running order or otherwise move them around unless you know exactly
+ ## what you are doing...
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ GCC=$lt_save_GCC
+ CC="$lt_save_CC"
+fi # test "$_lt_disable_F77" != yes
+
+AC_LANG_POP
+])# _LT_LANG_F77_CONFIG
+
+
+# _LT_PROG_FC
+# -----------
+# Since AC_PROG_FC is broken, in that it returns the empty string
+# if there is no fortran compiler, we have our own version here.
+m4_defun([_LT_PROG_FC],
+[
+pushdef([AC_MSG_ERROR], [_lt_disable_FC=yes])
+AC_PROG_FC
+if test -z "$FC" || test "X$FC" = "Xno"; then
+ _lt_disable_FC=yes
+fi
+popdef([AC_MSG_ERROR])
+])# _LT_PROG_FC
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([_LT_PROG_FC], [])
+
+
+# _LT_LANG_FC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for a Fortran compiler are
+# suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_FC_CONFIG],
+[AC_REQUIRE([_LT_PROG_FC])dnl
+AC_LANG_PUSH(Fortran)
+
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_TAGVAR(allow_undefined_flag, $1)=
+_LT_TAGVAR(always_export_symbols, $1)=no
+_LT_TAGVAR(archive_expsym_cmds, $1)=
+_LT_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_TAGVAR(hardcode_direct, $1)=no
+_LT_TAGVAR(hardcode_direct_absolute, $1)=no
+_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_TAGVAR(hardcode_minus_L, $1)=no
+_LT_TAGVAR(hardcode_automatic, $1)=no
+_LT_TAGVAR(inherit_rpath, $1)=no
+_LT_TAGVAR(module_cmds, $1)=
+_LT_TAGVAR(module_expsym_cmds, $1)=
+_LT_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_TAGVAR(no_undefined_flag, $1)=
+_LT_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Source file extension for fc test sources.
+ac_ext=${ac_fc_srcext-f}
+
+# Object file extension for compiled fc test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# No sense in running all these tests if we already determined that
+# the FC compiler isn't working. Some variables (like enable_shared)
+# are currently assumed to apply to all compilers on this platform,
+# and will be corrupted by setting them based on a non-working compiler.
+if test "$_lt_disable_FC" != yes; then
+ # Code to be used in simple compile tests
+ lt_simple_compile_test_code="\
+ subroutine t
+ return
+ end
+"
+
+ # Code to be used in simple link tests
+ lt_simple_link_test_code="\
+ program t
+ end
+"
+
+ # ltmain only uses $CC for tagged configurations so make sure $CC is set.
+ _LT_TAG_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_GCC=$GCC
+ CC=${FC-"f95"}
+ compiler=$CC
+ GCC=$ac_cv_fc_compiler_gnu
+
+ _LT_TAGVAR(compiler, $1)=$CC
+ _LT_CC_BASENAME([$compiler])
+
+ if test -n "$compiler"; then
+ 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
+ ;;
+ aix[[4-9]]*)
+ 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])
+
+ _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
+ _LT_TAGVAR(LD, $1)="$LD"
+
+ ## CAVEAT EMPTOR:
+ ## There is no encapsulation within the following macros, do not change
+ ## the running order or otherwise move them around unless you know exactly
+ ## what you are doing...
+ _LT_SYS_HIDDEN_LIBDEPS($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_SYS_DYNAMIC_LINKER($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+ fi # test -n "$compiler"
+
+ GCC=$lt_save_GCC
+ CC="$lt_save_CC"
+fi # test "$_lt_disable_FC" != yes
+
+AC_LANG_POP
+])# _LT_LANG_FC_CONFIG
+
+
+# _LT_LANG_GCJ_CONFIG([TAG])
+# --------------------------
+# Ensure that the configuration variables for the GNU Java Compiler compiler
+# are suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_GCJ_CONFIG],
+[AC_REQUIRE([LT_PROG_GCJ])dnl
+AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_TAG_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_GCC=$GCC
+GCC=yes
+CC=${GCJ-"gcj"}
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_TAGVAR(LD, $1)="$LD"
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+if test -n "$compiler"; then
+ _LT_COMPILER_NO_RTTI($1)
+ _LT_COMPILER_PIC($1)
+ _LT_COMPILER_C_O($1)
+ _LT_COMPILER_FILE_LOCKS($1)
+ _LT_LINKER_SHLIBS($1)
+ _LT_LINKER_HARDCODE_LIBPATH($1)
+
+ _LT_CONFIG($1)
+fi
+
+AC_LANG_RESTORE
+
+GCC=$lt_save_GCC
+CC="$lt_save_CC"
+])# _LT_LANG_GCJ_CONFIG
+
+
+# _LT_LANG_RC_CONFIG([TAG])
+# -------------------------
+# Ensure that the configuration variables for the Windows resource compiler
+# are suitably defined. These variables are subsequently used by _LT_CONFIG
+# to write the compiler configuration to `libtool'.
+m4_defun([_LT_LANG_RC_CONFIG],
+[AC_REQUIRE([LT_PROG_RC])dnl
+AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# 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_TAG_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_GCC=$GCC
+GCC=
+CC=${RC-"windres"}
+compiler=$CC
+_LT_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+if test -n "$compiler"; then
+ :
+ _LT_CONFIG($1)
+fi
+
+GCC=$lt_save_GCC
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# _LT_LANG_RC_CONFIG
+
+
+# LT_PROG_GCJ
+# -----------
+AC_DEFUN([LT_PROG_GCJ],
+[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
+ [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
+ [AC_CHECK_TOOL(GCJ, gcj,)
+ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+ AC_SUBST(GCJFLAGS)])])[]dnl
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+
+
+# LT_PROG_RC
+# ----------
+AC_DEFUN([LT_PROG_RC],
+[AC_CHECK_TOOL(RC, windres,)
+])
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_RC], [])
+
+
+# _LT_DECL_EGREP
+# --------------
+# If we don't have a new enough Autoconf to choose the best grep
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_EGREP],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_REQUIRE([AC_PROG_FGREP])dnl
+test -z "$GREP" && GREP=grep
+_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
+_LT_DECL([], [EGREP], [1], [An ERE matcher])
+_LT_DECL([], [FGREP], [1], [A literal string matcher])
+dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
+AC_SUBST([GREP])
+])
+
+
+# _LT_DECL_OBJDUMP
+# --------------
+# If we don't have a new enough Autoconf to choose the best objdump
+# available, choose the one first in the user's PATH.
+m4_defun([_LT_DECL_OBJDUMP],
+[AC_CHECK_TOOL(OBJDUMP, objdump, false)
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
+AC_SUBST([OBJDUMP])
+])
+
+
+# _LT_DECL_SED
+# ------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible. Prefer GNU sed if found.
+m4_defun([_LT_DECL_SED],
+[AC_PROG_SED
+test -z "$SED" && SED=sed
+Xsed="$SED -e 1s/^X//"
+_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
+_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
+ [Sed that helps us avoid accidentally triggering echo(1) options like -n])
+])# _LT_DECL_SED
+
+m4_ifndef([AC_PROG_SED], [
+############################################################
+# 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. #
+############################################################
+
+m4_defun([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
+IFS=$as_save_IFS
+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_SUBST([SED])
+AC_MSG_RESULT([$SED])
+])#AC_PROG_SED
+])#m4_ifndef
+
+# Old name:
+AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([LT_AC_PROG_SED], [])
+
+
+# _LT_CHECK_SHELL_FEATURES
+# ------------------------
+# Find out whether the shell is Bourne or XSI compatible,
+# or has some other useful features.
+m4_defun([_LT_CHECK_SHELL_FEATURES],
+[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
+# Try some XSI features
+xsi_shell=no
+( _lt_dummy="a/b/c"
+ test "${_lt_dummy##*/},${_lt_dummy%/*},"${_lt_dummy%"$_lt_dummy"}, \
+ = c,a/b,, \
+ && eval 'test $(( 1 + 1 )) -eq 2 \
+ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
+ && xsi_shell=yes
+AC_MSG_RESULT([$xsi_shell])
+_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
+
+AC_MSG_CHECKING([whether the shell understands "+="])
+lt_shell_append=no
+( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
+ >/dev/null 2>&1 \
+ && lt_shell_append=yes
+AC_MSG_RESULT([$lt_shell_append])
+_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
+
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ lt_unset=unset
+else
+ lt_unset=false
+fi
+_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
+
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ lt_SP2NL='tr \040 \012'
+ lt_NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ lt_SP2NL='tr \100 \n'
+ lt_NL2SP='tr \r\n \100\100'
+ ;;
+esac
+_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
+_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
+])# _LT_CHECK_SHELL_FEATURES
+
+
+# _LT_PROG_XSI_SHELLFNS
+# ---------------------
+# Bourne and XSI compatible variants of some useful shell functions.
+m4_defun([_LT_PROG_XSI_SHELLFNS],
+[case $xsi_shell in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result="${1##*/}"
+}
+
+# func_dirname_and_basename file append nondir_replacement
+# perform func_basename and func_dirname in a single function
+# call:
+# dirname: Compute the dirname of FILE. If nonempty,
+# add APPEND to the result, otherwise set result
+# to NONDIR_REPLACEMENT.
+# value returned in "$func_dirname_result"
+# basename: Compute filename of FILE.
+# value retuned in "$func_basename_result"
+# Implementation must be kept synchronized with func_dirname
+# and func_basename. For efficiency, we do not delegate to
+# those functions but instead duplicate the functionality here.
+func_dirname_and_basename ()
+{
+ case ${1} in
+ */*) func_dirname_result="${1%/*}${2}" ;;
+ * ) func_dirname_result="${3}" ;;
+ esac
+ func_basename_result="${1##*/}"
+}
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+func_stripname ()
+{
+ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
+ # positional parameters, so assign one to ordinary parameter first.
+ func_stripname_result=${3}
+ func_stripname_result=${func_stripname_result#"${1}"}
+ func_stripname_result=${func_stripname_result%"${2}"}
+}
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=${1%%=*}
+ func_opt_split_arg=${1#*=}
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ case ${1} in
+ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
+ *) func_lo2o_result=${1} ;;
+ esac
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=${1%.*}.lo
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=$(( $[*] ))
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=${#1}
+}
+
+_LT_EOF
+ ;;
+ *) # Bourne compatible functions.
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_dirname file append nondir_replacement
+# Compute the dirname of FILE. If nonempty, add APPEND to the result,
+# otherwise set result to NONDIR_REPLACEMENT.
+func_dirname ()
+{
+ # Extract subdirectory from the argument.
+ func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
+ if test "X$func_dirname_result" = "X${1}"; then
+ func_dirname_result="${3}"
+ else
+ func_dirname_result="$func_dirname_result${2}"
+ fi
+}
+
+# func_basename file
+func_basename ()
+{
+ func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
+}
+
+dnl func_dirname_and_basename
+dnl A portable version of this function is already defined in general.m4sh
+dnl so there is no need for it here.
+
+# func_stripname prefix suffix name
+# strip PREFIX and SUFFIX off of NAME.
+# PREFIX and SUFFIX must not contain globbing or regex special
+# characters, hashes, percent signs, but SUFFIX may contain a leading
+# dot (in which case that matches only a dot).
+# func_strip_suffix prefix name
+func_stripname ()
+{
+ case ${2} in
+ .*) func_stripname_result=`$ECHO "X${3}" \
+ | $Xsed -e "s%^${1}%%" -e "s%\\\\${2}\$%%"`;;
+ *) func_stripname_result=`$ECHO "X${3}" \
+ | $Xsed -e "s%^${1}%%" -e "s%${2}\$%%"`;;
+ esac
+}
+
+# sed scripts:
+my_sed_long_opt='1s/^\(-[[^=]]*\)=.*/\1/;q'
+my_sed_long_arg='1s/^-[[^=]]*=//'
+
+# func_opt_split
+func_opt_split ()
+{
+ func_opt_split_opt=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_opt"`
+ func_opt_split_arg=`$ECHO "X${1}" | $Xsed -e "$my_sed_long_arg"`
+}
+
+# func_lo2o object
+func_lo2o ()
+{
+ func_lo2o_result=`$ECHO "X${1}" | $Xsed -e "$lo2o"`
+}
+
+# func_xform libobj-or-source
+func_xform ()
+{
+ func_xform_result=`$ECHO "X${1}" | $Xsed -e 's/\.[[^.]]*$/.lo/'`
+}
+
+# func_arith arithmetic-term...
+func_arith ()
+{
+ func_arith_result=`expr "$[@]"`
+}
+
+# func_len string
+# STRING may not start with a hyphen.
+func_len ()
+{
+ func_len_result=`expr "$[1]" : ".*" 2>/dev/null || echo $max_cmd_len`
+}
+
+_LT_EOF
+esac
+
+case $lt_shell_append in
+ yes)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$[1]+=\$[2]"
+}
+_LT_EOF
+ ;;
+ *)
+ cat << \_LT_EOF >> "$cfgfile"
+
+# func_append var value
+# Append VALUE to the end of shell variable VAR.
+func_append ()
+{
+ eval "$[1]=\$$[1]\$[2]"
+}
+
+_LT_EOF
+ ;;
+ esac
+])
diff --git a/m4/ltoptions.m4 b/m4/ltoptions.m4
new file mode 100755
index 0000000..34151a3
--- a/dev/null
+++ b/m4/ltoptions.m4
@@ -0,0 +1,368 @@
+# Helper functions for option handling. -*- Autoconf -*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# 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 6 ltoptions.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
+
+
+# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
+# ------------------------------------------
+m4_define([_LT_MANGLE_OPTION],
+[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
+
+
+# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
+# ---------------------------------------
+# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
+# matching handler defined, dispatch to it. Other OPTION-NAMEs are
+# saved as a flag.
+m4_define([_LT_SET_OPTION],
+[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
+m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
+ _LT_MANGLE_DEFUN([$1], [$2]),
+ [m4_warning([Unknown $1 option `$2'])])[]dnl
+])
+
+
+# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
+# ------------------------------------------------------------
+# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
+m4_define([_LT_IF_OPTION],
+[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
+
+
+# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
+# -------------------------------------------------------
+# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
+# are set.
+m4_define([_LT_UNLESS_OPTIONS],
+[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+ [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
+ [m4_define([$0_found])])])[]dnl
+m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
+])[]dnl
+])
+
+
+# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
+# ----------------------------------------
+# OPTION-LIST is a space-separated list of Libtool options associated
+# with MACRO-NAME. If any OPTION has a matching handler declared with
+# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
+# the unknown option and exit.
+m4_defun([_LT_SET_OPTIONS],
+[# Set options
+m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
+ [_LT_SET_OPTION([$1], _LT_Option)])
+
+m4_if([$1],[LT_INIT],[
+ dnl
+ dnl Simply set some default values (i.e off) if boolean options were not
+ dnl specified:
+ _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
+ ])
+ _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
+ ])
+ dnl
+ dnl If no reference was made to various pairs of opposing options, then
+ dnl we run the default mode handler for the pair. For example, if neither
+ dnl `shared' nor `disable-shared' was passed, we enable building of shared
+ dnl archives by default:
+ _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
+ _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
+ _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
+ _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
+ [_LT_ENABLE_FAST_INSTALL])
+ ])
+])# _LT_SET_OPTIONS
+
+
+## --------------------------------- ##
+## Macros to handle LT_INIT options. ##
+## --------------------------------- ##
+
+# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
+# -----------------------------------------
+m4_define([_LT_MANGLE_DEFUN],
+[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
+
+
+# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
+# -----------------------------------------------
+m4_define([LT_OPTION_DEFINE],
+[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
+])# LT_OPTION_DEFINE
+
+
+# dlopen
+# ------
+LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
+])
+
+AU_DEFUN([AC_LIBTOOL_DLOPEN],
+[_LT_SET_OPTION([LT_INIT], [dlopen])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `dlopen' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
+
+
+# win32-dll
+# ---------
+# Declare package support for building win32 dll's.
+LT_OPTION_DEFINE([LT_INIT], [win32-dll],
+[enable_win32_dll=yes
+
+case $host in
+*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-cegcc*)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+ ;;
+esac
+
+test -z "$AS" && AS=as
+_LT_DECL([], [AS], [0], [Assembler program])dnl
+
+test -z "$DLLTOOL" && DLLTOOL=dlltool
+_LT_DECL([], [DLLTOOL], [0], [DLL creation program])dnl
+
+test -z "$OBJDUMP" && OBJDUMP=objdump
+_LT_DECL([], [OBJDUMP], [0], [Object dumper program])dnl
+])# win32-dll
+
+AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+_LT_SET_OPTION([LT_INIT], [win32-dll])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `win32-dll' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
+
+
+# _LT_ENABLE_SHARED([DEFAULT])
+# ----------------------------
+# implement the --enable-shared flag, and supports the `shared' and
+# `disable-shared' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_SHARED],
+[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([shared],
+ [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+ [build shared libraries @<:@default=]_LT_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=]_LT_ENABLE_SHARED_DEFAULT)
+
+ _LT_DECL([build_libtool_libs], [enable_shared], [0],
+ [Whether or not to build shared libraries])
+])# _LT_ENABLE_SHARED
+
+LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
+])
+
+AC_DEFUN([AC_DISABLE_SHARED],
+[_LT_SET_OPTION([LT_INIT], [disable-shared])
+])
+
+AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_SHARED], [])
+dnl AC_DEFUN([AM_DISABLE_SHARED], [])
+
+
+
+# _LT_ENABLE_STATIC([DEFAULT])
+# ----------------------------
+# implement the --enable-static flag, and support the `static' and
+# `disable-static' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_STATIC],
+[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([static],
+ [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+ [build static libraries @<:@default=]_LT_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=]_LT_ENABLE_STATIC_DEFAULT)
+
+ _LT_DECL([build_old_libs], [enable_static], [0],
+ [Whether or not to build static libraries])
+])# _LT_ENABLE_STATIC
+
+LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
+
+# Old names:
+AC_DEFUN([AC_ENABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
+])
+
+AC_DEFUN([AC_DISABLE_STATIC],
+[_LT_SET_OPTION([LT_INIT], [disable-static])
+])
+
+AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AM_ENABLE_STATIC], [])
+dnl AC_DEFUN([AM_DISABLE_STATIC], [])
+
+
+
+# _LT_ENABLE_FAST_INSTALL([DEFAULT])
+# ----------------------------------
+# implement the --enable-fast-install flag, and support the `fast-install'
+# and `disable-fast-install' LT_INIT options.
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+m4_define([_LT_ENABLE_FAST_INSTALL],
+[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
+AC_ARG_ENABLE([fast-install],
+ [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+ [optimize for fast installation @<:@default=]_LT_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=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
+
+_LT_DECL([fast_install], [enable_fast_install], [0],
+ [Whether or not to optimize for fast installation])dnl
+])# _LT_ENABLE_FAST_INSTALL
+
+LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
+LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
+
+# Old names:
+AU_DEFUN([AC_ENABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `fast-install' option into LT_INIT's first parameter.])
+])
+
+AU_DEFUN([AC_DISABLE_FAST_INSTALL],
+[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you put
+the `disable-fast-install' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
+dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
+
+
+# _LT_WITH_PIC([MODE])
+# --------------------
+# implement the --with-pic flag, and support the `pic-only' and `no-pic'
+# LT_INIT options.
+# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
+m4_define([_LT_WITH_PIC],
+[AC_ARG_WITH([pic],
+ [AS_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=m4_default([$1], [default])
+
+_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
+])# _LT_WITH_PIC
+
+LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
+LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
+
+# Old name:
+AU_DEFUN([AC_LIBTOOL_PICMODE],
+[_LT_SET_OPTION([LT_INIT], [pic-only])
+AC_DIAGNOSE([obsolete],
+[$0: Remove this warning and the call to _LT_SET_OPTION when you
+put the `pic-only' option into LT_INIT's first parameter.])
+])
+
+dnl aclocal-1.4 backwards compatibility:
+dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
+
+## ----------------- ##
+## LTDL_INIT Options ##
+## ----------------- ##
+
+m4_define([_LTDL_MODE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
+ [m4_define([_LTDL_MODE], [nonrecursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [recursive],
+ [m4_define([_LTDL_MODE], [recursive])])
+LT_OPTION_DEFINE([LTDL_INIT], [subproject],
+ [m4_define([_LTDL_MODE], [subproject])])
+
+m4_define([_LTDL_TYPE], [])
+LT_OPTION_DEFINE([LTDL_INIT], [installable],
+ [m4_define([_LTDL_TYPE], [installable])])
+LT_OPTION_DEFINE([LTDL_INIT], [convenience],
+ [m4_define([_LTDL_TYPE], [convenience])])
diff --git a/m4/ltsugar.m4 b/m4/ltsugar.m4
new file mode 100755
index 0000000..9000a05
--- a/dev/null
+++ b/m4/ltsugar.m4
@@ -0,0 +1,123 @@
+# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
+# Written by Gary V. Vaughan, 2004
+#
+# 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 6 ltsugar.m4
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
+
+
+# lt_join(SEP, ARG1, [ARG2...])
+# -----------------------------
+# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
+# associated separator.
+# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
+# versions in m4sugar had bugs.
+m4_define([lt_join],
+[m4_if([$#], [1], [],
+ [$#], [2], [[$2]],
+ [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
+m4_define([_lt_join],
+[m4_if([$#$2], [2], [],
+ [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
+
+
+# lt_car(LIST)
+# lt_cdr(LIST)
+# ------------
+# Manipulate m4 lists.
+# These macros are necessary as long as will still need to support
+# Autoconf-2.59 which quotes differently.
+m4_define([lt_car], [[$1]])
+m4_define([lt_cdr],
+[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
+ [$#], 1, [],
+ [m4_dquote(m4_shift($@))])])
+m4_define([lt_unquote], $1)
+
+
+# lt_append(MACRO-NAME, STRING, [SEPARATOR])
+# ------------------------------------------
+# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
+# Note that neither SEPARATOR nor STRING are expanded; they are appended
+# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
+# No SEPARATOR is output if MACRO-NAME was previously undefined (different
+# than defined and empty).
+#
+# This macro is needed until we can rely on Autoconf 2.62, since earlier
+# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
+m4_define([lt_append],
+[m4_define([$1],
+ m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
+
+
+
+# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
+# ----------------------------------------------------------
+# Produce a SEP delimited list of all paired combinations of elements of
+# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
+# has the form PREFIXmINFIXSUFFIXn.
+# Needed until we can rely on m4_combine added in Autoconf 2.62.
+m4_define([lt_combine],
+[m4_if(m4_eval([$# > 3]), [1],
+ [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
+[[m4_foreach([_Lt_prefix], [$2],
+ [m4_foreach([_Lt_suffix],
+ ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
+ [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
+
+
+# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
+# -----------------------------------------------------------------------
+# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
+# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
+m4_define([lt_if_append_uniq],
+[m4_ifdef([$1],
+ [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
+ [lt_append([$1], [$2], [$3])$4],
+ [$5])],
+ [lt_append([$1], [$2], [$3])$4])])
+
+
+# lt_dict_add(DICT, KEY, VALUE)
+# -----------------------------
+m4_define([lt_dict_add],
+[m4_define([$1($2)], [$3])])
+
+
+# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
+# --------------------------------------------
+m4_define([lt_dict_add_subkey],
+[m4_define([$1($2:$3)], [$4])])
+
+
+# lt_dict_fetch(DICT, KEY, [SUBKEY])
+# ----------------------------------
+m4_define([lt_dict_fetch],
+[m4_ifval([$3],
+ m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
+ m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
+
+
+# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
+# -----------------------------------------------------------------
+m4_define([lt_if_dict_fetch],
+[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
+ [$5],
+ [$6])])
+
+
+# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
+# --------------------------------------------------------------
+m4_define([lt_dict_filter],
+[m4_if([$5], [], [],
+ [lt_join(m4_quote(m4_default([$4], [[, ]])),
+ lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
+ [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
+])
diff --git a/m4/ltversion.m4 b/m4/ltversion.m4
new file mode 100755
index 0000000..f3c5309
--- a/dev/null
+++ b/m4/ltversion.m4
@@ -0,0 +1,23 @@
+# ltversion.m4 -- version numbers -*- Autoconf -*-
+#
+# Copyright (C) 2004 Free Software Foundation, Inc.
+# Written by Scott James Remnant, 2004
+#
+# 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.
+
+# Generated from ltversion.in.
+
+# serial 3017 ltversion.m4
+# This file is part of GNU Libtool
+
+m4_define([LT_PACKAGE_VERSION], [2.2.6b])
+m4_define([LT_PACKAGE_REVISION], [1.3017])
+
+AC_DEFUN([LTVERSION_VERSION],
+[macro_version='2.2.6b'
+macro_revision='1.3017'
+_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
+_LT_DECL(, macro_revision, 0)
+])
diff --git a/m4/lt~obsolete.m4 b/m4/lt~obsolete.m4
new file mode 100755
index 0000000..637bb20
--- a/dev/null
+++ b/m4/lt~obsolete.m4
@@ -0,0 +1,92 @@
+# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
+#
+# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc.
+# Written by Scott James Remnant, 2004.
+#
+# 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 lt~obsolete.m4
+
+# These exist entirely to fool aclocal when bootstrapping libtool.
+#
+# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
+# which have later been changed to m4_define as they aren't part of the
+# exported API, or moved to Autoconf or Automake where they belong.
+#
+# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
+# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
+# using a macro with the same name in our local m4/libtool.m4 it'll
+# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
+# and doesn't know about Autoconf macros at all.)
+#
+# So we provide this file, which has a silly filename so it's always
+# included after everything else. This provides aclocal with the
+# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
+# because those macros already exist, or will be overwritten later.
+# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
+#
+# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
+# Yes, that means every name once taken will need to remain here until
+# we give up compatibility with versions before 1.7, at which point
+# we need to keep only those names which we still refer to.
+
+# This is to help aclocal find these macros, as it can't see m4_define.
+AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
+
+m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
+m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
+m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
+m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
+m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
+m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
+m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
+m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
+m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
+m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
+m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
+m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
+m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
+m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
+m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
+m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
+m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
+m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
+m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
+m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
+m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
+m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
+m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
+m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
+m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
+m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
+m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
+m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
+m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
+m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
+m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
+m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
+m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
+m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
+m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
+m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
+m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
+m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
+m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
+m4_ifndef([AC_LIBTOOL_RC], [AC_DEFUN([AC_LIBTOOL_RC])])
+m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
+m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
+m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
+m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
+m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
+m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
+m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
+m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
+m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
diff --git a/missing b/missing
index 1c8ff70..28055d2 100755
--- a/missing
+++ b/missing
@@ -1,10 +1,10 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
-scriptversion=2006-05-10.23
+scriptversion=2009-04-28.21; # UTC
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
+# 2008, 2009 Free Software Foundation, Inc.
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
# This program is free software; you can redistribute it and/or modify
@@ -18,9 +18,7 @@ scriptversion=2006-05-10.23
# 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., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -89,6 +87,9 @@ Supported PROGRAM values:
tar try tar, gnutar, gtar, then tar without non-portable flags
yacc create \`y.tab.[ch]', if possible, from existing .[ch]
+Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and
+\`g' are ignored when checking the name.
+
Send bug reports to <bug-automake@gnu.org>."
exit $?
;;
@@ -106,15 +107,22 @@ Send bug reports to <bug-automake@gnu.org>."
esac
+# normalize program name to check for.
+program=`echo "$1" | sed '
+ s/^gnu-//; t
+ s/^gnu//; t
+ s/^g//; t'`
+
# 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).
+# the program). This is about non-GNU programs, so use $1 not
+# $program.
case $1 in
- lex|yacc)
+ lex*|yacc*)
# Not GNU programs, they don't have --version.
;;
- tar)
+ tar*)
if test -n "$run"; then
echo 1>&2 "ERROR: \`tar' requires --run"
exit 1
@@ -138,7 +146,7 @@ esac
# If it does not exist, or fails to run (possibly an outdated version),
# try to emulate it.
-case $1 in
+case $program in
aclocal*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
@@ -148,7 +156,7 @@ WARNING: \`$1' is $msg. You should only need it if
touch aclocal.m4
;;
- autoconf)
+ autoconf*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`${configure_ac}'. You might want to install the
@@ -157,7 +165,7 @@ WARNING: \`$1' is $msg. You should only need it if
touch configure
;;
- autoheader)
+ autoheader*)
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified \`acconfig.h' or \`${configure_ac}'. You might want
@@ -187,7 +195,7 @@ WARNING: \`$1' is $msg. You should only need it if
while read f; do touch "$f"; done
;;
- autom4te)
+ autom4te*)
echo 1>&2 "\
WARNING: \`$1' is needed, but is $msg.
You might have modified some files without having the
@@ -210,7 +218,7 @@ WARNING: \`$1' is needed, but is $msg.
fi
;;
- bison|yacc)
+ 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
@@ -240,7 +248,7 @@ WARNING: \`$1' $msg. You should only need it if
fi
;;
- lex|flex)
+ 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
@@ -263,7 +271,7 @@ WARNING: \`$1' is $msg. You should only need it if
fi
;;
- help2man)
+ 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
@@ -277,11 +285,11 @@ WARNING: \`$1' is $msg. You should only need it if
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
- exit 1
+ exit $?
fi
;;
- makeinfo)
+ 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
@@ -310,7 +318,7 @@ WARNING: \`$1' is $msg. You should only need it if
touch $file
;;
- tar)
+ tar*)
shift
# We have already tried tar in the generic part.
@@ -363,5 +371,6 @@ exit 0
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
+# time-stamp-time-zone: "UTC"
+# time-stamp-end: "; # UTC"
# End:
diff --git a/ntfsprogs/Makefile.am b/ntfsprogs/Makefile.am
new file mode 100755
index 0000000..247912a
--- a/dev/null
+++ b/ntfsprogs/Makefile.am
@@ -0,0 +1,154 @@
+if REALLYSTATIC
+AM_LIBS = $(top_builddir)/libntfs-3g/.libs/libntfs-3g.a $(NTFSPROGS_STATIC_LIBS)
+# older builds may need -static instead of newer -all-static
+AM_LFLAGS = -static
+STATIC_LINK = $(CC) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+else
+AM_LIBS = $(top_builddir)/libntfs-3g/libntfs-3g.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)
+
+if ENABLE_NTFSPROGS
+
+bin_PROGRAMS = ntfsfix ntfsinfo ntfscluster ntfsls ntfscat ntfscmp
+sbin_PROGRAMS = mkntfs ntfslabel ntfsundelete ntfsresize ntfsclone \
+ ntfscp
+EXTRA_PROGRAM_NAMES = ntfsdump_logfile ntfswipe ntfstruncate ntfsmove \
+ ntfsmftalloc ntfsck
+
+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 \
+ ntfscmp.8
+EXTRA_MANS =
+
+CLEANFILES = $(EXTRA_PROGRAMS)
+
+MAINTAINERCLEANFILES = Makefile.in
+
+if ENABLE_CRYPTO
+EXTRA_PROGRAM_NAMES += ntfsdecrypt
+endif
+
+if ENABLE_EXTRAS
+bin_PROGRAMS += $(EXTRA_PROGRAM_NAMES)
+else
+EXTRA_PROGRAMS = $(EXTRA_PROGRAM_NAMES)
+endif
+
+# Set the include path.
+AM_CPPFLAGS = -I$(top_srcdir)/include/ntfs-3g $(all_includes)
+
+ntfsfix_SOURCES = ntfsfix.c utils.c utils.h
+ntfsfix_LDADD = $(AM_LIBS)
+ntfsfix_LDFLAGS = $(AM_LFLAGS)
+
+mkntfs_CPPFLAGS = $(AM_CPPFLAGS) $(MKNTFS_CPPFLAGS)
+mkntfs_SOURCES = attrdef.c attrdef.h boot.c boot.h sd.c sd.h mkntfs.c utils.c utils.h
+mkntfs_LDADD = $(AM_LIBS) $(MKNTFS_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 list.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 list.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)
+
+ntfsck_SOURCES = ntfsck.c utils.c utils.h
+ntfsck_LDADD = $(AM_LIBS)
+ntfsck_LDFLAGS = $(AM_LFLAGS)
+
+ntfscmp_SOURCES = ntfscmp.c utils.c utils.h
+ntfscmp_LDADD = $(AM_LIBS)
+ntfscmp_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)
+
+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)
+
+if ENABLE_CRYPTO
+ntfsdecrypt_SOURCES = ntfsdecrypt.c utils.c utils.h
+ntfsdecrypt_LDADD = $(AM_LIBS) $(GNUTLS_LIBS) $(LIBGCRYPT_LIBS)
+ntfsdecrypt_LDFLAGS = $(AM_LFLAGS)
+ntfsdecrypt_CFLAGS = $(GNUTLS_CFLAGS) $(LIBGCRYPT_CFLAGS)
+endif
+
+# Extra targets
+
+strip: $(bin_PROGRAMS) $(sbin_PROGRAMS)
+ $(STRIP) $^
+
+libs:
+ (cd ../libntfs-3g && $(MAKE) libs) || exit 1;
+
+extra: extras
+
+extras: libs $(EXTRA_PROGRAMS)
+
+# mkfs.ntfs[.8] hard link
+
+install-exec-hook:
+ $(INSTALL) -d $(DESTDIR)/sbin
+ $(LN_S) -f $(sbindir)/mkntfs $(DESTDIR)/sbin/mkfs.ntfs
+
+install-data-hook:
+ $(INSTALL) -d $(DESTDIR)$(man8dir)
+ $(LN_S) -f mkntfs.8 $(DESTDIR)$(man8dir)/mkfs.ntfs.8
+
+uninstall-local:
+ $(RM) -f $(DESTDIR)/sbin/mkfs.ntfs
+ $(RM) -f $(DESTDIR)$(man8dir)/mkfs.ntfs.8
+
+endif
diff --git a/ntfsprogs/Makefile.in b/ntfsprogs/Makefile.in
new file mode 100755
index 0000000..ef4791d
--- a/dev/null
+++ b/ntfsprogs/Makefile.in
@@ -0,0 +1,1199 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+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@
+@ENABLE_NTFSPROGS_TRUE@bin_PROGRAMS = ntfsfix$(EXEEXT) \
+@ENABLE_NTFSPROGS_TRUE@ ntfsinfo$(EXEEXT) ntfscluster$(EXEEXT) \
+@ENABLE_NTFSPROGS_TRUE@ ntfsls$(EXEEXT) ntfscat$(EXEEXT) \
+@ENABLE_NTFSPROGS_TRUE@ ntfscmp$(EXEEXT) $(am__EXEEXT_3)
+@ENABLE_NTFSPROGS_TRUE@sbin_PROGRAMS = mkntfs$(EXEEXT) \
+@ENABLE_NTFSPROGS_TRUE@ ntfslabel$(EXEEXT) \
+@ENABLE_NTFSPROGS_TRUE@ ntfsundelete$(EXEEXT) \
+@ENABLE_NTFSPROGS_TRUE@ ntfsresize$(EXEEXT) ntfsclone$(EXEEXT) \
+@ENABLE_NTFSPROGS_TRUE@ ntfscp$(EXEEXT)
+@ENABLE_CRYPTO_TRUE@@ENABLE_NTFSPROGS_TRUE@am__append_1 = ntfsdecrypt
+@ENABLE_EXTRAS_TRUE@@ENABLE_NTFSPROGS_TRUE@am__append_2 = $(EXTRA_PROGRAM_NAMES)
+@ENABLE_EXTRAS_FALSE@@ENABLE_NTFSPROGS_TRUE@EXTRA_PROGRAMS = \
+@ENABLE_EXTRAS_FALSE@@ENABLE_NTFSPROGS_TRUE@ $(am__EXEEXT_2)
+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)/ntfscmp.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)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES = mkntfs.8 ntfscat.8 ntfsclone.8 ntfscluster.8 \
+ ntfscmp.8 ntfscp.8 ntfsfix.8 ntfsinfo.8 ntfslabel.8 ntfsls.8 \
+ ntfsprogs.8 ntfsresize.8 ntfsundelete.8
+CONFIG_CLEAN_VPATH_FILES =
+@ENABLE_CRYPTO_TRUE@@ENABLE_NTFSPROGS_TRUE@am__EXEEXT_1 = ntfsdecrypt$(EXEEXT)
+@ENABLE_NTFSPROGS_TRUE@am__EXEEXT_2 = ntfsdump_logfile$(EXEEXT) \
+@ENABLE_NTFSPROGS_TRUE@ ntfswipe$(EXEEXT) ntfstruncate$(EXEEXT) \
+@ENABLE_NTFSPROGS_TRUE@ ntfsmove$(EXEEXT) ntfsmftalloc$(EXEEXT) \
+@ENABLE_NTFSPROGS_TRUE@ ntfsck$(EXEEXT) $(am__EXEEXT_1)
+@ENABLE_EXTRAS_TRUE@@ENABLE_NTFSPROGS_TRUE@am__EXEEXT_3 = \
+@ENABLE_EXTRAS_TRUE@@ENABLE_NTFSPROGS_TRUE@ $(am__EXEEXT_2)
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(sbindir)" \
+ "$(DESTDIR)$(man8dir)"
+PROGRAMS = $(bin_PROGRAMS) $(sbin_PROGRAMS)
+am__mkntfs_SOURCES_DIST = attrdef.c attrdef.h boot.c boot.h sd.c sd.h \
+ mkntfs.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@am_mkntfs_OBJECTS = mkntfs-attrdef.$(OBJEXT) \
+@ENABLE_NTFSPROGS_TRUE@ mkntfs-boot.$(OBJEXT) \
+@ENABLE_NTFSPROGS_TRUE@ mkntfs-sd.$(OBJEXT) \
+@ENABLE_NTFSPROGS_TRUE@ mkntfs-mkntfs.$(OBJEXT) \
+@ENABLE_NTFSPROGS_TRUE@ mkntfs-utils.$(OBJEXT)
+mkntfs_OBJECTS = $(am_mkntfs_OBJECTS)
+am__DEPENDENCIES_1 =
+@REALLYSTATIC_FALSE@am__DEPENDENCIES_2 = \
+@REALLYSTATIC_FALSE@ $(top_builddir)/libntfs-3g/libntfs-3g.la
+@REALLYSTATIC_TRUE@am__DEPENDENCIES_2 = $(top_builddir)/libntfs-3g/.libs/libntfs-3g.a \
+@REALLYSTATIC_TRUE@ $(am__DEPENDENCIES_1)
+@ENABLE_NTFSPROGS_TRUE@mkntfs_DEPENDENCIES = $(am__DEPENDENCIES_2) \
+@ENABLE_NTFSPROGS_TRUE@ $(am__DEPENDENCIES_1)
+mkntfs_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(mkntfs_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am__ntfscat_SOURCES_DIST = ntfscat.c ntfscat.h utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@am_ntfscat_OBJECTS = ntfscat.$(OBJEXT) \
+@ENABLE_NTFSPROGS_TRUE@ utils.$(OBJEXT)
+ntfscat_OBJECTS = $(am_ntfscat_OBJECTS)
+@ENABLE_NTFSPROGS_TRUE@ntfscat_DEPENDENCIES = $(am__DEPENDENCIES_2)
+ntfscat_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ntfscat_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am__ntfsck_SOURCES_DIST = ntfsck.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@am_ntfsck_OBJECTS = ntfsck.$(OBJEXT) \
+@ENABLE_NTFSPROGS_TRUE@ utils.$(OBJEXT)
+ntfsck_OBJECTS = $(am_ntfsck_OBJECTS)
+@ENABLE_NTFSPROGS_TRUE@ntfsck_DEPENDENCIES = $(am__DEPENDENCIES_2)
+ntfsck_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ntfsck_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am__ntfsclone_SOURCES_DIST = ntfsclone.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@am_ntfsclone_OBJECTS = ntfsclone.$(OBJEXT) \
+@ENABLE_NTFSPROGS_TRUE@ utils.$(OBJEXT)
+ntfsclone_OBJECTS = $(am_ntfsclone_OBJECTS)
+@ENABLE_NTFSPROGS_TRUE@ntfsclone_DEPENDENCIES = $(am__DEPENDENCIES_2)
+ntfsclone_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(ntfsclone_LDFLAGS) $(LDFLAGS) -o $@
+am__ntfscluster_SOURCES_DIST = ntfscluster.c ntfscluster.h cluster.c \
+ cluster.h utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@am_ntfscluster_OBJECTS = ntfscluster.$(OBJEXT) \
+@ENABLE_NTFSPROGS_TRUE@ cluster.$(OBJEXT) utils.$(OBJEXT)
+ntfscluster_OBJECTS = $(am_ntfscluster_OBJECTS)
+@ENABLE_NTFSPROGS_TRUE@ntfscluster_DEPENDENCIES = \
+@ENABLE_NTFSPROGS_TRUE@ $(am__DEPENDENCIES_2)
+ntfscluster_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(ntfscluster_LDFLAGS) $(LDFLAGS) -o $@
+am__ntfscmp_SOURCES_DIST = ntfscmp.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@am_ntfscmp_OBJECTS = ntfscmp.$(OBJEXT) \
+@ENABLE_NTFSPROGS_TRUE@ utils.$(OBJEXT)
+ntfscmp_OBJECTS = $(am_ntfscmp_OBJECTS)
+@ENABLE_NTFSPROGS_TRUE@ntfscmp_DEPENDENCIES = $(am__DEPENDENCIES_2)
+ntfscmp_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ntfscmp_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am__ntfscp_SOURCES_DIST = ntfscp.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@am_ntfscp_OBJECTS = ntfscp.$(OBJEXT) \
+@ENABLE_NTFSPROGS_TRUE@ utils.$(OBJEXT)
+ntfscp_OBJECTS = $(am_ntfscp_OBJECTS)
+@ENABLE_NTFSPROGS_TRUE@ntfscp_DEPENDENCIES = $(am__DEPENDENCIES_2)
+ntfscp_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ntfscp_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am__ntfsdecrypt_SOURCES_DIST = ntfsdecrypt.c utils.c utils.h
+@ENABLE_CRYPTO_TRUE@@ENABLE_NTFSPROGS_TRUE@am_ntfsdecrypt_OBJECTS = ntfsdecrypt-ntfsdecrypt.$(OBJEXT) \
+@ENABLE_CRYPTO_TRUE@@ENABLE_NTFSPROGS_TRUE@ ntfsdecrypt-utils.$(OBJEXT)
+ntfsdecrypt_OBJECTS = $(am_ntfsdecrypt_OBJECTS)
+@ENABLE_CRYPTO_TRUE@@ENABLE_NTFSPROGS_TRUE@ntfsdecrypt_DEPENDENCIES = $(am__DEPENDENCIES_2) \
+@ENABLE_CRYPTO_TRUE@@ENABLE_NTFSPROGS_TRUE@ $(am__DEPENDENCIES_1) \
+@ENABLE_CRYPTO_TRUE@@ENABLE_NTFSPROGS_TRUE@ $(am__DEPENDENCIES_1)
+ntfsdecrypt_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(ntfsdecrypt_CFLAGS) \
+ $(CFLAGS) $(ntfsdecrypt_LDFLAGS) $(LDFLAGS) -o $@
+am__ntfsdump_logfile_SOURCES_DIST = ntfsdump_logfile.c
+@ENABLE_NTFSPROGS_TRUE@am_ntfsdump_logfile_OBJECTS = \
+@ENABLE_NTFSPROGS_TRUE@ ntfsdump_logfile.$(OBJEXT)
+ntfsdump_logfile_OBJECTS = $(am_ntfsdump_logfile_OBJECTS)
+@ENABLE_NTFSPROGS_TRUE@ntfsdump_logfile_DEPENDENCIES = \
+@ENABLE_NTFSPROGS_TRUE@ $(am__DEPENDENCIES_2)
+ntfsdump_logfile_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(ntfsdump_logfile_LDFLAGS) $(LDFLAGS) -o $@
+am__ntfsfix_SOURCES_DIST = ntfsfix.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@am_ntfsfix_OBJECTS = ntfsfix.$(OBJEXT) \
+@ENABLE_NTFSPROGS_TRUE@ utils.$(OBJEXT)
+ntfsfix_OBJECTS = $(am_ntfsfix_OBJECTS)
+@ENABLE_NTFSPROGS_TRUE@ntfsfix_DEPENDENCIES = $(am__DEPENDENCIES_2)
+ntfsfix_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ntfsfix_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am__ntfsinfo_SOURCES_DIST = ntfsinfo.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@am_ntfsinfo_OBJECTS = ntfsinfo.$(OBJEXT) \
+@ENABLE_NTFSPROGS_TRUE@ utils.$(OBJEXT)
+ntfsinfo_OBJECTS = $(am_ntfsinfo_OBJECTS)
+@ENABLE_NTFSPROGS_TRUE@ntfsinfo_DEPENDENCIES = $(am__DEPENDENCIES_2)
+ntfsinfo_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ntfsinfo_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am__ntfslabel_SOURCES_DIST = ntfslabel.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@am_ntfslabel_OBJECTS = ntfslabel.$(OBJEXT) \
+@ENABLE_NTFSPROGS_TRUE@ utils.$(OBJEXT)
+ntfslabel_OBJECTS = $(am_ntfslabel_OBJECTS)
+@ENABLE_NTFSPROGS_TRUE@ntfslabel_DEPENDENCIES = $(am__DEPENDENCIES_2)
+ntfslabel_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(ntfslabel_LDFLAGS) $(LDFLAGS) -o $@
+am__ntfsls_SOURCES_DIST = ntfsls.c utils.c utils.h list.h
+@ENABLE_NTFSPROGS_TRUE@am_ntfsls_OBJECTS = ntfsls.$(OBJEXT) \
+@ENABLE_NTFSPROGS_TRUE@ utils.$(OBJEXT)
+ntfsls_OBJECTS = $(am_ntfsls_OBJECTS)
+@ENABLE_NTFSPROGS_TRUE@ntfsls_DEPENDENCIES = $(am__DEPENDENCIES_2)
+ntfsls_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ntfsls_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am__ntfsmftalloc_SOURCES_DIST = ntfsmftalloc.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@am_ntfsmftalloc_OBJECTS = \
+@ENABLE_NTFSPROGS_TRUE@ ntfsmftalloc.$(OBJEXT) utils.$(OBJEXT)
+ntfsmftalloc_OBJECTS = $(am_ntfsmftalloc_OBJECTS)
+@ENABLE_NTFSPROGS_TRUE@ntfsmftalloc_DEPENDENCIES = \
+@ENABLE_NTFSPROGS_TRUE@ $(am__DEPENDENCIES_2)
+ntfsmftalloc_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(ntfsmftalloc_LDFLAGS) $(LDFLAGS) -o $@
+am__ntfsmove_SOURCES_DIST = ntfsmove.c ntfsmove.h utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@am_ntfsmove_OBJECTS = ntfsmove.$(OBJEXT) \
+@ENABLE_NTFSPROGS_TRUE@ utils.$(OBJEXT)
+ntfsmove_OBJECTS = $(am_ntfsmove_OBJECTS)
+@ENABLE_NTFSPROGS_TRUE@ntfsmove_DEPENDENCIES = $(am__DEPENDENCIES_2)
+ntfsmove_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ntfsmove_LDFLAGS) \
+ $(LDFLAGS) -o $@
+am__ntfsresize_SOURCES_DIST = ntfsresize.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@am_ntfsresize_OBJECTS = ntfsresize.$(OBJEXT) \
+@ENABLE_NTFSPROGS_TRUE@ utils.$(OBJEXT)
+ntfsresize_OBJECTS = $(am_ntfsresize_OBJECTS)
+@ENABLE_NTFSPROGS_TRUE@ntfsresize_DEPENDENCIES = \
+@ENABLE_NTFSPROGS_TRUE@ $(am__DEPENDENCIES_2)
+ntfsresize_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(ntfsresize_LDFLAGS) $(LDFLAGS) -o $@
+am__ntfstruncate_SOURCES_DIST = attrdef.c ntfstruncate.c utils.c \
+ utils.h
+@ENABLE_NTFSPROGS_TRUE@am_ntfstruncate_OBJECTS = attrdef.$(OBJEXT) \
+@ENABLE_NTFSPROGS_TRUE@ ntfstruncate.$(OBJEXT) utils.$(OBJEXT)
+ntfstruncate_OBJECTS = $(am_ntfstruncate_OBJECTS)
+@ENABLE_NTFSPROGS_TRUE@ntfstruncate_DEPENDENCIES = \
+@ENABLE_NTFSPROGS_TRUE@ $(am__DEPENDENCIES_2)
+ntfstruncate_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(ntfstruncate_LDFLAGS) $(LDFLAGS) -o $@
+am__ntfsundelete_SOURCES_DIST = ntfsundelete.c ntfsundelete.h utils.c \
+ utils.h list.h
+@ENABLE_NTFSPROGS_TRUE@am_ntfsundelete_OBJECTS = \
+@ENABLE_NTFSPROGS_TRUE@ ntfsundelete.$(OBJEXT) utils.$(OBJEXT)
+ntfsundelete_OBJECTS = $(am_ntfsundelete_OBJECTS)
+@ENABLE_NTFSPROGS_TRUE@ntfsundelete_DEPENDENCIES = \
+@ENABLE_NTFSPROGS_TRUE@ $(am__DEPENDENCIES_2)
+ntfsundelete_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(ntfsundelete_LDFLAGS) $(LDFLAGS) -o $@
+am__ntfswipe_SOURCES_DIST = ntfswipe.c ntfswipe.h utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@am_ntfswipe_OBJECTS = ntfswipe.$(OBJEXT) \
+@ENABLE_NTFSPROGS_TRUE@ utils.$(OBJEXT)
+ntfswipe_OBJECTS = $(am_ntfswipe_OBJECTS)
+@ENABLE_NTFSPROGS_TRUE@ntfswipe_DEPENDENCIES = $(am__DEPENDENCIES_2)
+ntfswipe_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(ntfswipe_LDFLAGS) \
+ $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+SOURCES = $(mkntfs_SOURCES) $(ntfscat_SOURCES) $(ntfsck_SOURCES) \
+ $(ntfsclone_SOURCES) $(ntfscluster_SOURCES) $(ntfscmp_SOURCES) \
+ $(ntfscp_SOURCES) $(ntfsdecrypt_SOURCES) \
+ $(ntfsdump_logfile_SOURCES) $(ntfsfix_SOURCES) \
+ $(ntfsinfo_SOURCES) $(ntfslabel_SOURCES) $(ntfsls_SOURCES) \
+ $(ntfsmftalloc_SOURCES) $(ntfsmove_SOURCES) \
+ $(ntfsresize_SOURCES) $(ntfstruncate_SOURCES) \
+ $(ntfsundelete_SOURCES) $(ntfswipe_SOURCES)
+DIST_SOURCES = $(am__mkntfs_SOURCES_DIST) $(am__ntfscat_SOURCES_DIST) \
+ $(am__ntfsck_SOURCES_DIST) $(am__ntfsclone_SOURCES_DIST) \
+ $(am__ntfscluster_SOURCES_DIST) $(am__ntfscmp_SOURCES_DIST) \
+ $(am__ntfscp_SOURCES_DIST) $(am__ntfsdecrypt_SOURCES_DIST) \
+ $(am__ntfsdump_logfile_SOURCES_DIST) \
+ $(am__ntfsfix_SOURCES_DIST) $(am__ntfsinfo_SOURCES_DIST) \
+ $(am__ntfslabel_SOURCES_DIST) $(am__ntfsls_SOURCES_DIST) \
+ $(am__ntfsmftalloc_SOURCES_DIST) $(am__ntfsmove_SOURCES_DIST) \
+ $(am__ntfsresize_SOURCES_DIST) \
+ $(am__ntfstruncate_SOURCES_DIST) \
+ $(am__ntfsundelete_SOURCES_DIST) $(am__ntfswipe_SOURCES_DIST)
+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 = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+man8dir = $(mandir)/man8
+NROFF = nroff
+MANS = $(man_MANS)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@
+FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDCONFIG = @LDCONFIG@
+LDFLAGS = @LDFLAGS@
+LIBFUSE_LITE_CFLAGS = @LIBFUSE_LITE_CFLAGS@
+LIBFUSE_LITE_LIBS = @LIBFUSE_LITE_LIBS@
+LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+LIBNTFS_3G_VERSION = @LIBNTFS_3G_VERSION@
+LIBNTFS_CPPFLAGS = @LIBNTFS_CPPFLAGS@
+LIBNTFS_LIBS = @LIBNTFS_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MKNTFS_CPPFLAGS = @MKNTFS_CPPFLAGS@
+MKNTFS_LIBS = @MKNTFS_LIBS@
+MV = @MV@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NTFSPROGS_STATIC_LIBS = @NTFSPROGS_STATIC_LIBS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+OUTPUT_FORMAT = @OUTPUT_FORMAT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+RANLIB = @RANLIB@
+RM = @RM@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+all_includes = @all_includes@
+all_libraries = @all_libraries@
+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@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ntfs3gincludedir = @ntfs3gincludedir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgconfigdir = @pkgconfigdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+rootbindir = @rootbindir@
+rootlibdir = @rootlibdir@
+rootsbindir = @rootsbindir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+@REALLYSTATIC_FALSE@AM_LIBS = $(top_builddir)/libntfs-3g/libntfs-3g.la
+@REALLYSTATIC_TRUE@AM_LIBS = $(top_builddir)/libntfs-3g/.libs/libntfs-3g.a $(NTFSPROGS_STATIC_LIBS)
+@REALLYSTATIC_FALSE@AM_LFLAGS = $(all_libraries)
+# older builds may need -static instead of newer -all-static
+@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)
+@ENABLE_NTFSPROGS_TRUE@EXTRA_PROGRAM_NAMES = ntfsdump_logfile ntfswipe \
+@ENABLE_NTFSPROGS_TRUE@ ntfstruncate ntfsmove ntfsmftalloc \
+@ENABLE_NTFSPROGS_TRUE@ ntfsck $(am__append_1)
+@ENABLE_NTFSPROGS_TRUE@man_MANS = mkntfs.8 ntfsfix.8 ntfslabel.8 ntfsinfo.8 \
+@ENABLE_NTFSPROGS_TRUE@ ntfsundelete.8 ntfsresize.8 ntfsprogs.8 ntfsls.8 \
+@ENABLE_NTFSPROGS_TRUE@ ntfsclone.8 ntfscluster.8 ntfscat.8 ntfscp.8 \
+@ENABLE_NTFSPROGS_TRUE@ ntfscmp.8
+
+@ENABLE_NTFSPROGS_TRUE@EXTRA_MANS =
+@ENABLE_NTFSPROGS_TRUE@CLEANFILES = $(EXTRA_PROGRAMS)
+@ENABLE_NTFSPROGS_TRUE@MAINTAINERCLEANFILES = Makefile.in
+
+# Set the include path.
+@ENABLE_NTFSPROGS_TRUE@AM_CPPFLAGS = -I$(top_srcdir)/include/ntfs-3g $(all_includes)
+@ENABLE_NTFSPROGS_TRUE@ntfsfix_SOURCES = ntfsfix.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@ntfsfix_LDADD = $(AM_LIBS)
+@ENABLE_NTFSPROGS_TRUE@ntfsfix_LDFLAGS = $(AM_LFLAGS)
+@ENABLE_NTFSPROGS_TRUE@mkntfs_CPPFLAGS = $(AM_CPPFLAGS) $(MKNTFS_CPPFLAGS)
+@ENABLE_NTFSPROGS_TRUE@mkntfs_SOURCES = attrdef.c attrdef.h boot.c boot.h sd.c sd.h mkntfs.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@mkntfs_LDADD = $(AM_LIBS) $(MKNTFS_LIBS)
+@ENABLE_NTFSPROGS_TRUE@mkntfs_LDFLAGS = $(AM_LFLAGS)
+@ENABLE_NTFSPROGS_TRUE@ntfslabel_SOURCES = ntfslabel.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@ntfslabel_LDADD = $(AM_LIBS)
+@ENABLE_NTFSPROGS_TRUE@ntfslabel_LDFLAGS = $(AM_LFLAGS)
+@ENABLE_NTFSPROGS_TRUE@ntfsinfo_SOURCES = ntfsinfo.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@ntfsinfo_LDADD = $(AM_LIBS)
+@ENABLE_NTFSPROGS_TRUE@ntfsinfo_LDFLAGS = $(AM_LFLAGS)
+@ENABLE_NTFSPROGS_TRUE@ntfsundelete_SOURCES = ntfsundelete.c ntfsundelete.h utils.c utils.h list.h
+@ENABLE_NTFSPROGS_TRUE@ntfsundelete_LDADD = $(AM_LIBS)
+@ENABLE_NTFSPROGS_TRUE@ntfsundelete_LDFLAGS = $(AM_LFLAGS)
+@ENABLE_NTFSPROGS_TRUE@ntfsresize_SOURCES = ntfsresize.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@ntfsresize_LDADD = $(AM_LIBS)
+@ENABLE_NTFSPROGS_TRUE@ntfsresize_LDFLAGS = $(AM_LFLAGS)
+@ENABLE_NTFSPROGS_TRUE@ntfsclone_SOURCES = ntfsclone.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@ntfsclone_LDADD = $(AM_LIBS)
+@ENABLE_NTFSPROGS_TRUE@ntfsclone_LDFLAGS = $(AM_LFLAGS)
+@ENABLE_NTFSPROGS_TRUE@ntfscluster_SOURCES = ntfscluster.c ntfscluster.h cluster.c cluster.h utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@ntfscluster_LDADD = $(AM_LIBS)
+@ENABLE_NTFSPROGS_TRUE@ntfscluster_LDFLAGS = $(AM_LFLAGS)
+@ENABLE_NTFSPROGS_TRUE@ntfsls_SOURCES = ntfsls.c utils.c utils.h list.h
+@ENABLE_NTFSPROGS_TRUE@ntfsls_LDADD = $(AM_LIBS)
+@ENABLE_NTFSPROGS_TRUE@ntfsls_LDFLAGS = $(AM_LFLAGS)
+@ENABLE_NTFSPROGS_TRUE@ntfscat_SOURCES = ntfscat.c ntfscat.h utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@ntfscat_LDADD = $(AM_LIBS)
+@ENABLE_NTFSPROGS_TRUE@ntfscat_LDFLAGS = $(AM_LFLAGS)
+@ENABLE_NTFSPROGS_TRUE@ntfscp_SOURCES = ntfscp.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@ntfscp_LDADD = $(AM_LIBS)
+@ENABLE_NTFSPROGS_TRUE@ntfscp_LDFLAGS = $(AM_LFLAGS)
+@ENABLE_NTFSPROGS_TRUE@ntfsck_SOURCES = ntfsck.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@ntfsck_LDADD = $(AM_LIBS)
+@ENABLE_NTFSPROGS_TRUE@ntfsck_LDFLAGS = $(AM_LFLAGS)
+@ENABLE_NTFSPROGS_TRUE@ntfscmp_SOURCES = ntfscmp.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@ntfscmp_LDADD = $(AM_LIBS)
+@ENABLE_NTFSPROGS_TRUE@ntfscmp_LDFLAGS = $(AM_LFLAGS)
+
+# We don't distribute these
+@ENABLE_NTFSPROGS_TRUE@ntfstruncate_SOURCES = attrdef.c ntfstruncate.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@ntfstruncate_LDADD = $(AM_LIBS)
+@ENABLE_NTFSPROGS_TRUE@ntfstruncate_LDFLAGS = $(AM_LFLAGS)
+@ENABLE_NTFSPROGS_TRUE@ntfsmftalloc_SOURCES = ntfsmftalloc.c utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@ntfsmftalloc_LDADD = $(AM_LIBS)
+@ENABLE_NTFSPROGS_TRUE@ntfsmftalloc_LDFLAGS = $(AM_LFLAGS)
+@ENABLE_NTFSPROGS_TRUE@ntfsmove_SOURCES = ntfsmove.c ntfsmove.h utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@ntfsmove_LDADD = $(AM_LIBS)
+@ENABLE_NTFSPROGS_TRUE@ntfsmove_LDFLAGS = $(AM_LFLAGS)
+@ENABLE_NTFSPROGS_TRUE@ntfswipe_SOURCES = ntfswipe.c ntfswipe.h utils.c utils.h
+@ENABLE_NTFSPROGS_TRUE@ntfswipe_LDADD = $(AM_LIBS)
+@ENABLE_NTFSPROGS_TRUE@ntfswipe_LDFLAGS = $(AM_LFLAGS)
+@ENABLE_NTFSPROGS_TRUE@ntfsdump_logfile_SOURCES = ntfsdump_logfile.c
+@ENABLE_NTFSPROGS_TRUE@ntfsdump_logfile_LDADD = $(AM_LIBS)
+@ENABLE_NTFSPROGS_TRUE@ntfsdump_logfile_LDFLAGS = $(AM_LFLAGS)
+@ENABLE_CRYPTO_TRUE@@ENABLE_NTFSPROGS_TRUE@ntfsdecrypt_SOURCES = ntfsdecrypt.c utils.c utils.h
+@ENABLE_CRYPTO_TRUE@@ENABLE_NTFSPROGS_TRUE@ntfsdecrypt_LDADD = $(AM_LIBS) $(GNUTLS_LIBS) $(LIBGCRYPT_LIBS)
+@ENABLE_CRYPTO_TRUE@@ENABLE_NTFSPROGS_TRUE@ntfsdecrypt_LDFLAGS = $(AM_LFLAGS)
+@ENABLE_CRYPTO_TRUE@@ENABLE_NTFSPROGS_TRUE@ntfsdecrypt_CFLAGS = $(GNUTLS_CFLAGS) $(LIBGCRYPT_CFLAGS)
+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 ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu ntfsprogs/Makefile'; \
+ $(am__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
+$(am__aclocal_m4_deps):
+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)/$@
+ntfscmp.8: $(top_builddir)/config.status $(srcdir)/ntfscmp.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)/$@
+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)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+install-sbinPROGRAMS: $(sbin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(sbindir)" || $(MKDIR_P) "$(DESTDIR)$(sbindir)"
+ @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-sbinPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(sbindir)" && rm -f $$files
+
+clean-sbinPROGRAMS:
+ @list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+mkntfs$(EXEEXT): $(mkntfs_OBJECTS) $(mkntfs_DEPENDENCIES)
+ @rm -f mkntfs$(EXEEXT)
+ $(mkntfs_LINK) $(mkntfs_OBJECTS) $(mkntfs_LDADD) $(LIBS)
+ntfscat$(EXEEXT): $(ntfscat_OBJECTS) $(ntfscat_DEPENDENCIES)
+ @rm -f ntfscat$(EXEEXT)
+ $(ntfscat_LINK) $(ntfscat_OBJECTS) $(ntfscat_LDADD) $(LIBS)
+ntfsck$(EXEEXT): $(ntfsck_OBJECTS) $(ntfsck_DEPENDENCIES)
+ @rm -f ntfsck$(EXEEXT)
+ $(ntfsck_LINK) $(ntfsck_OBJECTS) $(ntfsck_LDADD) $(LIBS)
+ntfsclone$(EXEEXT): $(ntfsclone_OBJECTS) $(ntfsclone_DEPENDENCIES)
+ @rm -f ntfsclone$(EXEEXT)
+ $(ntfsclone_LINK) $(ntfsclone_OBJECTS) $(ntfsclone_LDADD) $(LIBS)
+ntfscluster$(EXEEXT): $(ntfscluster_OBJECTS) $(ntfscluster_DEPENDENCIES)
+ @rm -f ntfscluster$(EXEEXT)
+ $(ntfscluster_LINK) $(ntfscluster_OBJECTS) $(ntfscluster_LDADD) $(LIBS)
+ntfscmp$(EXEEXT): $(ntfscmp_OBJECTS) $(ntfscmp_DEPENDENCIES)
+ @rm -f ntfscmp$(EXEEXT)
+ $(ntfscmp_LINK) $(ntfscmp_OBJECTS) $(ntfscmp_LDADD) $(LIBS)
+ntfscp$(EXEEXT): $(ntfscp_OBJECTS) $(ntfscp_DEPENDENCIES)
+ @rm -f ntfscp$(EXEEXT)
+ $(ntfscp_LINK) $(ntfscp_OBJECTS) $(ntfscp_LDADD) $(LIBS)
+ntfsdecrypt$(EXEEXT): $(ntfsdecrypt_OBJECTS) $(ntfsdecrypt_DEPENDENCIES)
+ @rm -f ntfsdecrypt$(EXEEXT)
+ $(ntfsdecrypt_LINK) $(ntfsdecrypt_OBJECTS) $(ntfsdecrypt_LDADD) $(LIBS)
+ntfsdump_logfile$(EXEEXT): $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_DEPENDENCIES)
+ @rm -f ntfsdump_logfile$(EXEEXT)
+ $(ntfsdump_logfile_LINK) $(ntfsdump_logfile_OBJECTS) $(ntfsdump_logfile_LDADD) $(LIBS)
+ntfsfix$(EXEEXT): $(ntfsfix_OBJECTS) $(ntfsfix_DEPENDENCIES)
+ @rm -f ntfsfix$(EXEEXT)
+ $(ntfsfix_LINK) $(ntfsfix_OBJECTS) $(ntfsfix_LDADD) $(LIBS)
+ntfsinfo$(EXEEXT): $(ntfsinfo_OBJECTS) $(ntfsinfo_DEPENDENCIES)
+ @rm -f ntfsinfo$(EXEEXT)
+ $(ntfsinfo_LINK) $(ntfsinfo_OBJECTS) $(ntfsinfo_LDADD) $(LIBS)
+ntfslabel$(EXEEXT): $(ntfslabel_OBJECTS) $(ntfslabel_DEPENDENCIES)
+ @rm -f ntfslabel$(EXEEXT)
+ $(ntfslabel_LINK) $(ntfslabel_OBJECTS) $(ntfslabel_LDADD) $(LIBS)
+ntfsls$(EXEEXT): $(ntfsls_OBJECTS) $(ntfsls_DEPENDENCIES)
+ @rm -f ntfsls$(EXEEXT)
+ $(ntfsls_LINK) $(ntfsls_OBJECTS) $(ntfsls_LDADD) $(LIBS)
+ntfsmftalloc$(EXEEXT): $(ntfsmftalloc_OBJECTS) $(ntfsmftalloc_DEPENDENCIES)
+ @rm -f ntfsmftalloc$(EXEEXT)
+ $(ntfsmftalloc_LINK) $(ntfsmftalloc_OBJECTS) $(ntfsmftalloc_LDADD) $(LIBS)
+ntfsmove$(EXEEXT): $(ntfsmove_OBJECTS) $(ntfsmove_DEPENDENCIES)
+ @rm -f ntfsmove$(EXEEXT)
+ $(ntfsmove_LINK) $(ntfsmove_OBJECTS) $(ntfsmove_LDADD) $(LIBS)
+ntfsresize$(EXEEXT): $(ntfsresize_OBJECTS) $(ntfsresize_DEPENDENCIES)
+ @rm -f ntfsresize$(EXEEXT)
+ $(ntfsresize_LINK) $(ntfsresize_OBJECTS) $(ntfsresize_LDADD) $(LIBS)
+ntfstruncate$(EXEEXT): $(ntfstruncate_OBJECTS) $(ntfstruncate_DEPENDENCIES)
+ @rm -f ntfstruncate$(EXEEXT)
+ $(ntfstruncate_LINK) $(ntfstruncate_OBJECTS) $(ntfstruncate_LDADD) $(LIBS)
+ntfsundelete$(EXEEXT): $(ntfsundelete_OBJECTS) $(ntfsundelete_DEPENDENCIES)
+ @rm -f ntfsundelete$(EXEEXT)
+ $(ntfsundelete_LINK) $(ntfsundelete_OBJECTS) $(ntfsundelete_LDADD) $(LIBS)
+ntfswipe$(EXEEXT): $(ntfswipe_OBJECTS) $(ntfswipe_DEPENDENCIES)
+ @rm -f ntfswipe$(EXEEXT)
+ $(ntfswipe_LINK) $(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)/cluster.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkntfs-attrdef.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkntfs-boot.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkntfs-mkntfs.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkntfs-sd.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkntfs-utils.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfscat.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsck.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)/ntfscmp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfscp.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsdecrypt-ntfsdecrypt.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfsdecrypt-utils.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)/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@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfswipe.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@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@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@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 $@ $<
+
+mkntfs-attrdef.o: attrdef.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mkntfs-attrdef.o -MD -MP -MF $(DEPDIR)/mkntfs-attrdef.Tpo -c -o mkntfs-attrdef.o `test -f 'attrdef.c' || echo '$(srcdir)/'`attrdef.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mkntfs-attrdef.Tpo $(DEPDIR)/mkntfs-attrdef.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='attrdef.c' object='mkntfs-attrdef.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mkntfs-attrdef.o `test -f 'attrdef.c' || echo '$(srcdir)/'`attrdef.c
+
+mkntfs-attrdef.obj: attrdef.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mkntfs-attrdef.obj -MD -MP -MF $(DEPDIR)/mkntfs-attrdef.Tpo -c -o mkntfs-attrdef.obj `if test -f 'attrdef.c'; then $(CYGPATH_W) 'attrdef.c'; else $(CYGPATH_W) '$(srcdir)/attrdef.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mkntfs-attrdef.Tpo $(DEPDIR)/mkntfs-attrdef.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='attrdef.c' object='mkntfs-attrdef.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mkntfs-attrdef.obj `if test -f 'attrdef.c'; then $(CYGPATH_W) 'attrdef.c'; else $(CYGPATH_W) '$(srcdir)/attrdef.c'; fi`
+
+mkntfs-boot.o: boot.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mkntfs-boot.o -MD -MP -MF $(DEPDIR)/mkntfs-boot.Tpo -c -o mkntfs-boot.o `test -f 'boot.c' || echo '$(srcdir)/'`boot.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mkntfs-boot.Tpo $(DEPDIR)/mkntfs-boot.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='boot.c' object='mkntfs-boot.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mkntfs-boot.o `test -f 'boot.c' || echo '$(srcdir)/'`boot.c
+
+mkntfs-boot.obj: boot.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mkntfs-boot.obj -MD -MP -MF $(DEPDIR)/mkntfs-boot.Tpo -c -o mkntfs-boot.obj `if test -f 'boot.c'; then $(CYGPATH_W) 'boot.c'; else $(CYGPATH_W) '$(srcdir)/boot.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mkntfs-boot.Tpo $(DEPDIR)/mkntfs-boot.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='boot.c' object='mkntfs-boot.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mkntfs-boot.obj `if test -f 'boot.c'; then $(CYGPATH_W) 'boot.c'; else $(CYGPATH_W) '$(srcdir)/boot.c'; fi`
+
+mkntfs-sd.o: sd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mkntfs-sd.o -MD -MP -MF $(DEPDIR)/mkntfs-sd.Tpo -c -o mkntfs-sd.o `test -f 'sd.c' || echo '$(srcdir)/'`sd.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mkntfs-sd.Tpo $(DEPDIR)/mkntfs-sd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sd.c' object='mkntfs-sd.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mkntfs-sd.o `test -f 'sd.c' || echo '$(srcdir)/'`sd.c
+
+mkntfs-sd.obj: sd.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mkntfs-sd.obj -MD -MP -MF $(DEPDIR)/mkntfs-sd.Tpo -c -o mkntfs-sd.obj `if test -f 'sd.c'; then $(CYGPATH_W) 'sd.c'; else $(CYGPATH_W) '$(srcdir)/sd.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mkntfs-sd.Tpo $(DEPDIR)/mkntfs-sd.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sd.c' object='mkntfs-sd.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mkntfs-sd.obj `if test -f 'sd.c'; then $(CYGPATH_W) 'sd.c'; else $(CYGPATH_W) '$(srcdir)/sd.c'; fi`
+
+mkntfs-mkntfs.o: mkntfs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mkntfs-mkntfs.o -MD -MP -MF $(DEPDIR)/mkntfs-mkntfs.Tpo -c -o mkntfs-mkntfs.o `test -f 'mkntfs.c' || echo '$(srcdir)/'`mkntfs.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mkntfs-mkntfs.Tpo $(DEPDIR)/mkntfs-mkntfs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mkntfs.c' object='mkntfs-mkntfs.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mkntfs-mkntfs.o `test -f 'mkntfs.c' || echo '$(srcdir)/'`mkntfs.c
+
+mkntfs-mkntfs.obj: mkntfs.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mkntfs-mkntfs.obj -MD -MP -MF $(DEPDIR)/mkntfs-mkntfs.Tpo -c -o mkntfs-mkntfs.obj `if test -f 'mkntfs.c'; then $(CYGPATH_W) 'mkntfs.c'; else $(CYGPATH_W) '$(srcdir)/mkntfs.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mkntfs-mkntfs.Tpo $(DEPDIR)/mkntfs-mkntfs.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mkntfs.c' object='mkntfs-mkntfs.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mkntfs-mkntfs.obj `if test -f 'mkntfs.c'; then $(CYGPATH_W) 'mkntfs.c'; else $(CYGPATH_W) '$(srcdir)/mkntfs.c'; fi`
+
+mkntfs-utils.o: utils.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mkntfs-utils.o -MD -MP -MF $(DEPDIR)/mkntfs-utils.Tpo -c -o mkntfs-utils.o `test -f 'utils.c' || echo '$(srcdir)/'`utils.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mkntfs-utils.Tpo $(DEPDIR)/mkntfs-utils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='utils.c' object='mkntfs-utils.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mkntfs-utils.o `test -f 'utils.c' || echo '$(srcdir)/'`utils.c
+
+mkntfs-utils.obj: utils.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mkntfs-utils.obj -MD -MP -MF $(DEPDIR)/mkntfs-utils.Tpo -c -o mkntfs-utils.obj `if test -f 'utils.c'; then $(CYGPATH_W) 'utils.c'; else $(CYGPATH_W) '$(srcdir)/utils.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mkntfs-utils.Tpo $(DEPDIR)/mkntfs-utils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='utils.c' object='mkntfs-utils.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mkntfs_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mkntfs-utils.obj `if test -f 'utils.c'; then $(CYGPATH_W) 'utils.c'; else $(CYGPATH_W) '$(srcdir)/utils.c'; fi`
+
+ntfsdecrypt-ntfsdecrypt.o: ntfsdecrypt.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsdecrypt_CFLAGS) $(CFLAGS) -MT ntfsdecrypt-ntfsdecrypt.o -MD -MP -MF $(DEPDIR)/ntfsdecrypt-ntfsdecrypt.Tpo -c -o ntfsdecrypt-ntfsdecrypt.o `test -f 'ntfsdecrypt.c' || echo '$(srcdir)/'`ntfsdecrypt.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ntfsdecrypt-ntfsdecrypt.Tpo $(DEPDIR)/ntfsdecrypt-ntfsdecrypt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ntfsdecrypt.c' object='ntfsdecrypt-ntfsdecrypt.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) $(ntfsdecrypt_CFLAGS) $(CFLAGS) -c -o ntfsdecrypt-ntfsdecrypt.o `test -f 'ntfsdecrypt.c' || echo '$(srcdir)/'`ntfsdecrypt.c
+
+ntfsdecrypt-ntfsdecrypt.obj: ntfsdecrypt.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsdecrypt_CFLAGS) $(CFLAGS) -MT ntfsdecrypt-ntfsdecrypt.obj -MD -MP -MF $(DEPDIR)/ntfsdecrypt-ntfsdecrypt.Tpo -c -o ntfsdecrypt-ntfsdecrypt.obj `if test -f 'ntfsdecrypt.c'; then $(CYGPATH_W) 'ntfsdecrypt.c'; else $(CYGPATH_W) '$(srcdir)/ntfsdecrypt.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ntfsdecrypt-ntfsdecrypt.Tpo $(DEPDIR)/ntfsdecrypt-ntfsdecrypt.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ntfsdecrypt.c' object='ntfsdecrypt-ntfsdecrypt.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) $(ntfsdecrypt_CFLAGS) $(CFLAGS) -c -o ntfsdecrypt-ntfsdecrypt.obj `if test -f 'ntfsdecrypt.c'; then $(CYGPATH_W) 'ntfsdecrypt.c'; else $(CYGPATH_W) '$(srcdir)/ntfsdecrypt.c'; fi`
+
+ntfsdecrypt-utils.o: utils.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsdecrypt_CFLAGS) $(CFLAGS) -MT ntfsdecrypt-utils.o -MD -MP -MF $(DEPDIR)/ntfsdecrypt-utils.Tpo -c -o ntfsdecrypt-utils.o `test -f 'utils.c' || echo '$(srcdir)/'`utils.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ntfsdecrypt-utils.Tpo $(DEPDIR)/ntfsdecrypt-utils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='utils.c' object='ntfsdecrypt-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) $(ntfsdecrypt_CFLAGS) $(CFLAGS) -c -o ntfsdecrypt-utils.o `test -f 'utils.c' || echo '$(srcdir)/'`utils.c
+
+ntfsdecrypt-utils.obj: utils.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfsdecrypt_CFLAGS) $(CFLAGS) -MT ntfsdecrypt-utils.obj -MD -MP -MF $(DEPDIR)/ntfsdecrypt-utils.Tpo -c -o ntfsdecrypt-utils.obj `if test -f 'utils.c'; then $(CYGPATH_W) 'utils.c'; else $(CYGPATH_W) '$(srcdir)/utils.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ntfsdecrypt-utils.Tpo $(DEPDIR)/ntfsdecrypt-utils.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='utils.c' object='ntfsdecrypt-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) $(ntfsdecrypt_CFLAGS) $(CFLAGS) -c -o ntfsdecrypt-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
+install-man8: $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)"
+ @list=''; test -n "$(man8dir)" || exit 0; \
+ { for i in $$list; do echo "$$i"; done; \
+ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.8[a-z]*$$/p'; \
+ } | while read p; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; echo "$$p"; \
+ done | \
+ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+ sed 'N;N;s,\n, ,g' | { \
+ list=; while read file base inst; do \
+ if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \
+ fi; \
+ done; \
+ for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+ while read files; do \
+ test -z "$$files" || { \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \
+ done; }
+
+uninstall-man8:
+ @$(NORMAL_UNINSTALL)
+ @list=''; test -n "$(man8dir)" || exit 0; \
+ files=`{ for i in $$list; do echo "$$i"; done; \
+ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.8[a-z]*$$/p'; \
+ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+ test -z "$$files" || { \
+ echo " ( cd '$(DESTDIR)$(man8dir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(man8dir)" && rm -f $$files; }
+
+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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ 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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ 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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @list='$(MANS)'; if test -n "$$list"; then \
+ list=`for p in $$list; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
+ if test -n "$$list" && \
+ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
+ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
+ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
+ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
+ echo " typically \`make maintainer-clean' will remove them" >&2; \
+ exit 1; \
+ else :; fi; \
+ else :; fi
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$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)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+@ENABLE_NTFSPROGS_FALSE@uninstall-local:
+@ENABLE_NTFSPROGS_FALSE@install-exec-hook:
+@ENABLE_NTFSPROGS_FALSE@install-data-hook:
+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-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-man
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS install-sbinPROGRAMS
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man: install-man8
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+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-local uninstall-man \
+ uninstall-sbinPROGRAMS
+
+uninstall-man: uninstall-man8
+
+.MAKE: install-am install-data-am install-exec-am install-strip
+
+.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-data-hook install-dvi install-dvi-am \
+ install-exec install-exec-am install-exec-hook install-html \
+ install-html-am install-info install-info-am install-man \
+ install-man8 install-pdf install-pdf-am install-ps \
+ install-ps-am 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-local uninstall-man uninstall-man8 \
+ uninstall-sbinPROGRAMS
+
+
+# Extra targets
+
+@ENABLE_NTFSPROGS_TRUE@strip: $(bin_PROGRAMS) $(sbin_PROGRAMS)
+@ENABLE_NTFSPROGS_TRUE@ $(STRIP) $^
+
+@ENABLE_NTFSPROGS_TRUE@libs:
+@ENABLE_NTFSPROGS_TRUE@ (cd ../libntfs-3g && $(MAKE) libs) || exit 1;
+
+@ENABLE_NTFSPROGS_TRUE@extra: extras
+
+@ENABLE_NTFSPROGS_TRUE@extras: libs $(EXTRA_PROGRAMS)
+
+# mkfs.ntfs[.8] hard link
+
+@ENABLE_NTFSPROGS_TRUE@install-exec-hook:
+@ENABLE_NTFSPROGS_TRUE@ $(INSTALL) -d $(DESTDIR)/sbin
+@ENABLE_NTFSPROGS_TRUE@ $(LN_S) -f $(sbindir)/mkntfs $(DESTDIR)/sbin/mkfs.ntfs
+
+@ENABLE_NTFSPROGS_TRUE@install-data-hook:
+@ENABLE_NTFSPROGS_TRUE@ $(INSTALL) -d $(DESTDIR)$(man8dir)
+@ENABLE_NTFSPROGS_TRUE@ $(LN_S) -f mkntfs.8 $(DESTDIR)$(man8dir)/mkfs.ntfs.8
+
+@ENABLE_NTFSPROGS_TRUE@uninstall-local:
+@ENABLE_NTFSPROGS_TRUE@ $(RM) -f $(DESTDIR)/sbin/mkfs.ntfs
+@ENABLE_NTFSPROGS_TRUE@ $(RM) -f $(DESTDIR)$(man8dir)/mkfs.ntfs.8
+
+# 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/attrdef.c b/ntfsprogs/attrdef.c
new file mode 100755
index 0000000..36501e5
--- a/dev/null
+++ b/ntfsprogs/attrdef.c
@@ -0,0 +1,168 @@
+#include "attrdef.h"
+
+/**
+ * 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 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/attrdef.h b/ntfsprogs/attrdef.h
new file mode 100755
index 0000000..0c66439
--- a/dev/null
+++ b/ntfsprogs/attrdef.h
@@ -0,0 +1,7 @@
+#ifndef _NTFS_ATTRDEF_H_
+#define _NTFS_ATTRDEF_H_
+
+extern const unsigned char attrdef_ntfs3x_array[2560];
+
+#endif /* _NTFS_ATTRDEF_H_ */
+
diff --git a/ntfsprogs/boot.c b/ntfsprogs/boot.c
new file mode 100755
index 0000000..9272be9
--- a/dev/null
+++ b/ntfsprogs/boot.c
@@ -0,0 +1,268 @@
+#include "boot.h"
+
+/**
+ * boot_array - the first 4136 bytes of $Boot
+ *
+ * The first 4136 bytes of $Boot. The rest is just zero. Total 8192 bytes.
+ */
+const unsigned char boot_array[4136] = {
+235, 82, 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, 250, 51, 192, 142, 208, 188, 0, 124, 251, 104, 192, 7,
+ 31, 30, 104, 102, 0, 203, 136, 22, 14, 0, 102, 129, 62, 3, 0, 78,
+ 84, 70, 83, 117, 21, 180, 65, 187, 170, 85, 205, 19, 114, 12, 129, 251,
+ 85, 170, 117, 6, 247, 193, 1, 0, 117, 3, 233, 210, 0, 30, 131, 236,
+ 24, 104, 26, 0, 180, 72, 138, 22, 14, 0, 139, 244, 22, 31, 205, 19,
+159, 131, 196, 24, 158, 88, 31, 114, 225, 59, 6, 11, 0, 117, 219, 163,
+ 15, 0, 193, 46, 15, 0, 4, 30, 90, 51, 219, 185, 0, 32, 43, 200,
+102, 255, 6, 17, 0, 3, 22, 15, 0, 142, 194, 255, 6, 22, 0, 232,
+ 64, 0, 43, 200, 119, 239, 184, 0, 187, 205, 26, 102, 35, 192, 117, 45,
+102, 129, 251, 84, 67, 80, 65, 117, 36, 129, 249, 2, 1, 114, 30, 22,
+104, 7, 187, 22, 104, 112, 14, 22, 104, 9, 0, 102, 83, 102, 83, 102,
+ 85, 22, 22, 22, 104, 184, 1, 102, 97, 14, 7, 205, 26, 233, 106, 1,
+144, 144, 102, 96, 30, 6, 102, 161, 17, 0, 102, 3, 6, 28, 0, 30,
+102, 104, 0, 0, 0, 0, 102, 80, 6, 83, 104, 1, 0, 104, 16, 0,
+180, 66, 138, 22, 14, 0, 22, 31, 139, 244, 205, 19, 102, 89, 91, 90,
+102, 89, 102, 89, 31, 15, 130, 22, 0, 102, 255, 6, 17, 0, 3, 22,
+ 15, 0, 142, 194, 255, 14, 22, 0, 117, 188, 7, 31, 102, 97, 195, 160,
+248, 1, 232, 8, 0, 160, 251, 1, 232, 2, 0, 235, 254, 180, 1, 139,
+240, 172, 60, 0, 116, 9, 180, 14, 187, 7, 0, 205, 16, 235, 242, 195,
+ 13, 10, 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, 0, 13, 10, 66,
+ 79, 79, 84, 77, 71, 82, 32, 105, 115, 32, 109, 105, 115, 115, 105, 110,
+103, 0, 13, 10, 66, 79, 79, 84, 77, 71, 82, 32, 105, 115, 32, 99,
+111, 109, 112, 114, 101, 115, 115, 101, 100, 0, 13, 10, 80, 114, 101, 115,
+115, 32, 67, 116, 114, 108, 43, 65, 108, 116, 43, 68, 101, 108, 32, 116,
+111, 32, 114, 101, 115, 116, 97, 114, 116, 13, 10, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 128, 157, 178, 202, 0, 0, 85, 170,
+ 7, 0, 66, 0, 79, 0, 79, 0, 84, 0, 77, 0, 71, 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, 235, 34, 144, 144, 5, 0, 78, 0, 84, 0,
+ 76, 0, 68, 0, 82, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 102, 15, 183, 6, 11, 0,
+102, 15, 182, 30, 13, 0, 102, 247, 227, 102, 163, 82, 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, 82, 2, 102, 247, 225, 102, 163,
+102, 2, 102, 15, 183, 30, 11, 0, 102, 51, 210, 102, 247, 243, 102, 163,
+ 86, 2, 232, 149, 4, 102, 139, 14, 78, 2, 102, 137, 14, 38, 2, 102,
+ 3, 14, 102, 2, 102, 137, 14, 42, 2, 102, 3, 14, 102, 2, 102, 137,
+ 14, 46, 2, 102, 3, 14, 102, 2, 102, 137, 14, 62, 2, 102, 3, 14,
+102, 2, 102, 137, 14, 70, 2, 102, 184, 144, 0, 0, 0, 102, 139, 14,
+ 38, 2, 232, 131, 9, 102, 11, 192, 15, 132, 83, 254, 102, 163, 50, 2,
+102, 184, 160, 0, 0, 0, 102, 139, 14, 42, 2, 232, 106, 9, 102, 163,
+ 54, 2, 102, 184, 176, 0, 0, 0, 102, 139, 14, 46, 2, 232, 88, 9,
+102, 163, 58, 2, 102, 161, 50, 2, 102, 11, 192, 15, 132, 32, 254, 103,
+128, 120, 8, 0, 15, 133, 23, 254, 103, 102, 141, 80, 16, 103, 3, 66,
+ 4, 103, 102, 15, 182, 72, 12, 102, 137, 14, 114, 2, 103, 102, 139, 72,
+ 8, 102, 137, 14, 110, 2, 102, 161, 110, 2, 102, 15, 183, 14, 11, 0,
+102, 51, 210, 102, 247, 241, 102, 163, 118, 2, 102, 161, 70, 2, 102, 3,
+ 6, 110, 2, 102, 163, 74, 2, 102, 131, 62, 54, 2, 0, 15, 132, 29,
+ 0, 102, 131, 62, 58, 2, 0, 15, 132, 196, 253, 102, 139, 30, 58, 2,
+ 30, 7, 102, 139, 62, 74, 2, 102, 161, 46, 2, 232, 224, 1, 102, 15,
+183, 14, 0, 2, 102, 184, 2, 2, 0, 0, 232, 34, 8, 102, 11, 192,
+ 15, 133, 22, 0, 102, 15, 183, 14, 90, 2, 102, 184, 92, 2, 0, 0,
+232, 12, 8, 102, 11, 192, 15, 132, 66, 12, 103, 102, 139, 0, 30, 7,
+102, 139, 62, 62, 2, 232, 63, 6, 102, 161, 62, 2, 102, 187, 32, 0,
+ 0, 0, 102, 185, 0, 0, 0, 0, 102, 186, 0, 0, 0, 0, 232, 228,
+ 0, 102, 133, 192, 15, 133, 35, 0, 102, 161, 62, 2, 102, 187, 128, 0,
+ 0, 0, 102, 185, 0, 0, 0, 0, 102, 186, 0, 0, 0, 0, 232, 196,
+ 0, 102, 11, 192, 15, 133, 68, 0, 233, 241, 11, 102, 51, 210, 102, 185,
+128, 0, 0, 0, 102, 161, 62, 2, 232, 202, 8, 102, 11, 192, 15, 132,
+218, 11, 30, 7, 102, 139, 62, 62, 2, 232, 219, 5, 102, 161, 62, 2,
+102, 187, 128, 0, 0, 0, 102, 185, 0, 0, 0, 0, 102, 186, 0, 0,
+ 0, 0, 232, 128, 0, 102, 11, 192, 15, 132, 176, 11, 103, 102, 15, 183,
+ 88, 12, 102, 129, 227, 255, 0, 0, 0, 15, 133, 165, 11, 102, 139, 216,
+104, 0, 32, 7, 102, 43, 255, 102, 161, 62, 2, 232, 0, 1, 104, 0,
+ 32, 7, 102, 43, 255, 102, 161, 62, 2, 232, 172, 10, 138, 22, 14, 0,
+184, 232, 3, 142, 192, 141, 54, 11, 0, 43, 192, 104, 0, 32, 80, 203,
+ 6, 30, 102, 96, 102, 139, 218, 102, 15, 182, 14, 13, 0, 102, 247, 225,
+102, 163, 17, 0, 102, 139, 195, 102, 247, 225, 163, 22, 0, 139, 223, 131,
+227, 15, 140, 192, 102, 193, 239, 4, 3, 199, 80, 7, 232, 51, 252, 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, 151, 6, 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, 108, 6, 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, 73, 6, 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, 102, 80, 103, 102, 141, 83, 16, 102, 133, 192, 15, 133, 10,
+ 0, 103, 102, 139, 74, 8, 102, 65, 235, 17, 144, 103, 102, 139, 66, 24,
+102, 51, 210, 102, 247, 54, 82, 2, 102, 139, 200, 102, 43, 192, 102, 94,
+232, 1, 0, 195, 6, 30, 102, 96, 103, 128, 123, 8, 1, 15, 132, 3,
+ 0, 233, 107, 251, 102, 131, 249, 0, 15, 133, 6, 0, 102, 97, 144, 31,
+ 7, 195, 102, 83, 102, 80, 102, 81, 102, 86, 102, 87, 6, 232, 145, 4,
+102, 139, 209, 7, 102, 95, 102, 94, 102, 89, 102, 133, 192, 15, 132, 52,
+ 0, 102, 59, 202, 15, 141, 3, 0, 102, 139, 209, 232, 130, 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, 159, 102, 133, 246, 15, 132, 3, 251, 102, 81, 102, 87,
+ 6, 103, 102, 15, 182, 67, 9, 102, 133, 192, 15, 132, 32, 0, 102, 209,
+224, 102, 43, 224, 102, 139, 252, 102, 84, 102, 86, 103, 102, 15, 183, 115,
+ 10, 102, 3, 243, 102, 139, 200, 243, 164, 102, 94, 235, 3, 144, 102, 80,
+102, 80, 103, 102, 139, 3, 102, 80, 103, 102, 139, 67, 24, 102, 80, 103,
+102, 139, 86, 32, 102, 133, 210, 15, 132, 11, 0, 102, 139, 254, 30, 7,
+102, 139, 194, 232, 113, 3, 102, 139, 198, 102, 90, 102, 89, 102, 66, 102,
+ 81, 102, 86, 232, 63, 6, 102, 133, 192, 15, 132, 146, 250, 102, 94, 102,
+ 89, 102, 139, 254, 30, 7, 232, 78, 3, 102, 139, 198, 102, 139, 217, 102,
+ 89, 102, 90, 102, 81, 102, 86, 102, 209, 233, 232, 248, 253, 102, 133, 192,
+ 15, 132, 107, 250, 102, 94, 102, 89, 102, 3, 225, 7, 102, 95, 102, 89,
+102, 139, 208, 102, 88, 102, 91, 102, 139, 218, 233, 245, 254, 6, 30, 102,
+ 96, 38, 103, 102, 15, 183, 95, 4, 38, 103, 102, 15, 183, 79, 6, 102,
+ 11, 201, 15, 132, 57, 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, 34, 2, 102, 161, 30, 2, 102, 3, 6, 102,
+ 2, 102, 163, 106, 2, 102, 3, 6, 102, 2, 102, 163, 78, 2, 102, 161,
+ 48, 0, 102, 15, 182, 30, 13, 0, 102, 247, 227, 102, 139, 30, 78, 2,
+102, 137, 7, 102, 163, 17, 0, 131, 195, 4, 102, 161, 86, 2, 102, 137,
+ 7, 163, 22, 0, 131, 195, 4, 102, 137, 30, 78, 2, 102, 139, 30, 30,
+ 2, 30, 7, 232, 92, 249, 102, 139, 251, 232, 81, 255, 102, 161, 30, 2,
+102, 187, 32, 0, 0, 0, 102, 185, 0, 0, 0, 0, 102, 186, 0, 0,
+ 0, 0, 232, 16, 253, 102, 11, 192, 15, 132, 25, 1, 102, 139, 216, 30,
+ 7, 102, 139, 62, 26, 2, 102, 51, 192, 232, 162, 253, 102, 139, 30, 26,
+ 2, 102, 129, 63, 128, 0, 0, 0, 15, 132, 235, 0, 3, 95, 4, 235,
+240, 102, 83, 102, 139, 71, 16, 102, 247, 38, 86, 2, 102, 80, 102, 51,
+210, 102, 15, 182, 30, 13, 0, 102, 247, 243, 102, 82, 232, 220, 0, 102,
+ 11, 192, 15, 132, 57, 249, 102, 139, 14, 86, 2, 102, 15, 182, 30, 13,
+ 0, 102, 247, 227, 102, 90, 102, 3, 194, 102, 139, 30, 78, 2, 102, 137,
+ 7, 131, 195, 4, 102, 15, 182, 6, 13, 0, 102, 43, 194, 102, 59, 193,
+ 15, 134, 3, 0, 102, 139, 193, 102, 137, 7, 102, 43, 200, 102, 90, 15,
+132, 117, 0, 102, 3, 194, 102, 80, 102, 51, 210, 102, 15, 182, 30, 13,
+ 0, 102, 247, 243, 102, 81, 232, 130, 0, 102, 89, 102, 11, 192, 15, 132,
+221, 248, 102, 15, 182, 30, 13, 0, 102, 247, 227, 102, 139, 30, 78, 2,
+102, 139, 23, 131, 195, 4, 102, 3, 23, 102, 59, 208, 15, 133, 21, 0,
+102, 15, 182, 6, 13, 0, 102, 59, 193, 15, 134, 3, 0, 102, 139, 193,
+102, 1, 7, 235, 165, 131, 195, 4, 102, 137, 30, 78, 2, 102, 137, 7,
+131, 195, 4, 102, 15, 182, 6, 13, 0, 102, 59, 193, 15, 134, 3, 0,
+102, 139, 193, 102, 137, 7, 235, 130, 131, 195, 4, 102, 255, 6, 34, 2,
+102, 137, 30, 78, 2, 102, 91, 3, 95, 4, 102, 129, 63, 128, 0, 0,
+ 0, 15, 132, 12, 255, 102, 97, 144, 31, 7, 195, 102, 139, 208, 102, 139,
+ 14, 34, 2, 102, 139, 54, 106, 2, 102, 3, 54, 102, 2, 102, 82, 102,
+ 81, 102, 82, 102, 139, 30, 106, 2, 102, 139, 62, 86, 2, 102, 139, 4,
+102, 163, 17, 0, 131, 198, 4, 102, 139, 4, 163, 22, 0, 131, 198, 4,
+ 30, 7, 232, 221, 247, 102, 43, 248, 15, 132, 8, 0, 247, 38, 11, 0,
+ 3, 216, 235, 217, 102, 139, 62, 106, 2, 30, 7, 232, 191, 253, 102, 161,
+106, 2, 102, 187, 128, 0, 0, 0, 102, 185, 0, 0, 0, 0, 102, 139,
+209, 232, 129, 251, 102, 11, 192, 15, 132, 244, 247, 102, 139, 216, 102, 88,
+102, 86, 232, 44, 1, 102, 94, 102, 11, 192, 15, 132, 5, 0, 102, 91,
+102, 91, 195, 102, 89, 102, 90, 226, 132, 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, 102, 87, 232, 83, 255, 102, 95, 102, 11, 192, 15, 132, 174,
+247, 102, 15, 182, 30, 13, 0, 102, 247, 227, 102, 90, 102, 3, 194, 102,
+163, 17, 0, 102, 89, 102, 15, 182, 30, 13, 0, 102, 59, 203, 15, 142,
+ 19, 0, 137, 30, 22, 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, 22, 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, 5, 247, 102, 95, 7,
+102, 3, 62, 82, 2, 102, 89, 102, 88, 102, 131, 249, 0, 15, 143, 112,
+255, 102, 97, 144, 31, 7, 195, 6, 30, 102, 96, 102, 247, 38, 86, 2,
+102, 139, 14, 86, 2, 232, 85, 255, 232, 210, 252, 102, 97, 144, 31, 7,
+195, 6, 30, 102, 96, 102, 247, 38, 114, 2, 102, 139, 30, 54, 2, 102,
+139, 14, 114, 2, 102, 139, 54, 42, 2, 30, 7, 102, 139, 62, 70, 2,
+232, 129, 251, 232, 167, 252, 102, 97, 144, 31, 7, 195, 102, 80, 102, 83,
+102, 81, 102, 139, 30, 74, 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, 50, 2, 103, 102, 141, 88, 16, 103,
+ 3, 67, 4, 103, 102, 141, 64, 16, 102, 139, 218, 232, 68, 249, 102, 11,
+192, 15, 132, 5, 0, 102, 89, 102, 89, 195, 102, 161, 54, 2, 102, 11,
+192, 15, 133, 8, 0, 102, 89, 102, 89, 102, 51, 192, 195, 102, 139, 22,
+ 54, 2, 103, 102, 141, 82, 16, 103, 102, 139, 66, 24, 102, 51, 210, 102,
+247, 54, 110, 2, 102, 51, 246, 102, 80, 102, 86, 102, 88, 102, 94, 102,
+ 59, 198, 15, 132, 58, 0, 102, 86, 102, 64, 102, 80, 102, 72, 232, 27,
+254, 114, 232, 232, 235, 253, 102, 90, 102, 94, 102, 89, 102, 91, 102, 83,
+102, 81, 102, 86, 102, 82, 102, 161, 70, 2, 103, 102, 141, 64, 24, 232,
+208, 248, 102, 11, 192, 116, 196, 102, 89, 102, 89, 102, 89, 102, 89, 195,
+102, 89, 102, 89, 102, 51, 192, 195, 102, 81, 102, 80, 102, 184, 5, 0,
+ 0, 0, 30, 7, 102, 139, 249, 232, 141, 253, 102, 139, 193, 102, 187, 32,
+ 0, 0, 0, 102, 185, 0, 0, 0, 0, 102, 186, 0, 0, 0, 0, 232,
+ 51, 248, 102, 91, 102, 89, 102, 133, 192, 15, 133, 21, 0, 102, 139, 193,
+102, 15, 183, 14, 16, 2, 102, 186, 18, 2, 0, 0, 232, 22, 248, 235,
+ 51, 144, 102, 51, 210, 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,
+ 53, 253, 102, 139, 199, 102, 15, 183, 14, 16, 2, 102, 186, 18, 2, 0,
+ 0, 232, 225, 247, 195, 102, 82, 102, 81, 102, 187, 32, 0, 0, 0, 102,
+185, 0, 0, 0, 0, 102, 186, 0, 0, 0, 0, 232, 199, 247, 102, 11,
+192, 15, 132, 99, 0, 102, 139, 216, 30, 7, 102, 139, 62, 26, 2, 102,
+ 51, 192, 232, 89, 248, 30, 7, 102, 139, 30, 26, 2, 102, 89, 102, 90,
+ 38, 102, 57, 15, 15, 133, 12, 0, 38, 102, 57, 87, 8, 15, 132, 49,
+ 0, 235, 19, 144, 38, 102, 131, 63, 255, 15, 132, 47, 0, 38, 131, 127,
+ 4, 0, 15, 132, 38, 0, 38, 102, 15, 183, 71, 4, 3, 216, 139, 195,
+ 37, 0, 128, 116, 203, 140, 192, 5, 0, 8, 142, 192, 129, 227, 255, 127,
+235, 190, 38, 102, 139, 71, 16, 195, 102, 89, 102, 90, 102, 51, 192, 195,
+102, 80, 102, 81, 102, 139, 199, 102, 193, 232, 4, 6, 89, 3, 200, 81,
+ 7, 102, 131, 231, 15, 102, 89, 102, 88, 195, 96, 6, 190, 189, 13, 191,
+ 0, 32, 30, 7, 185, 13, 0, 144, 243, 165, 7, 97, 195, 1, 35, 69,
+103, 137, 171, 205, 239, 254, 220, 186, 152, 118, 84, 50, 16, 240, 225, 210,
+195, 0, 0, 0, 0, 32, 32, 96, 139, 54, 24, 32, 38, 138, 5, 136,
+ 4, 71, 70, 102, 255, 6, 20, 32, 129, 254, 96, 32, 117, 6, 232, 91,
+ 0, 190, 32, 32, 226, 230, 137, 54, 24, 32, 97, 195, 102, 96, 139, 54,
+ 24, 32, 176, 128, 136, 4, 70, 50, 192, 129, 254, 96, 32, 117, 6, 232,
+ 58, 0, 190, 32, 32, 129, 254, 88, 32, 117, 233, 102, 51, 192, 102, 163,
+ 88, 32, 102, 161, 20, 32, 102, 193, 224, 3, 102, 15, 200, 102, 163, 92,
+ 32, 232, 24, 0, 187, 0, 32, 102, 139, 7, 102, 15, 200, 102, 137, 7,
+131, 195, 4, 129, 251, 52, 32, 117, 238, 102, 97, 195, 102, 96, 187, 32,
+ 32, 102, 139, 7, 102, 15, 200, 102, 137, 7, 131, 195, 4, 129, 251, 96,
+ 32, 117, 238, 187, 0, 32, 102, 139, 15, 102, 139, 87, 4, 102, 139, 119,
+ 8, 102, 139, 127, 12, 102, 139, 111, 16, 187, 32, 32, 199, 6, 26, 32,
+ 48, 15, 198, 6, 28, 32, 20, 144, 83, 139, 30, 26, 32, 255, 23, 102,
+ 3, 71, 2, 91, 102, 3, 232, 102, 3, 47, 102, 139, 193, 102, 193, 192,
+ 5, 102, 3, 197, 102, 139, 239, 102, 139, 254, 102, 139, 242, 102, 193, 198,
+ 30, 102, 139, 209, 102, 139, 200, 102, 139, 7, 102, 51, 71, 8, 102, 51,
+ 71, 32, 102, 51, 71, 52, 102, 209, 192, 102, 137, 71, 64, 131, 195, 4,
+254, 14, 28, 32, 117, 178, 131, 6, 26, 32, 6, 129, 62, 26, 32, 72,
+ 15, 117, 159, 187, 0, 32, 102, 1, 15, 102, 1, 87, 4, 102, 1, 119,
+ 8, 102, 1, 127, 12, 102, 1, 111, 16, 102, 97, 195, 102, 139, 198, 102,
+ 51, 199, 102, 35, 194, 102, 51, 199, 195, 102, 139, 194, 102, 51, 198, 102,
+ 51, 199, 195, 102, 83, 102, 139, 194, 102, 35, 198, 102, 139, 218, 102, 35,
+223, 102, 11, 195, 102, 139, 222, 102, 35, 223, 102, 11, 195, 102, 91, 195,
+252, 14, 153, 121, 130, 90, 9, 15, 161, 235, 217, 110, 19, 15, 220, 188,
+ 27, 143, 9, 15, 214, 193, 98, 202, 6, 30, 102, 96, 102, 51, 219, 184,
+ 0, 187, 205, 26, 102, 35, 192, 15, 133, 187, 0, 102, 129, 251, 84, 67,
+ 80, 65, 15, 133, 176, 0, 129, 249, 2, 1, 15, 130, 168, 0, 102, 97,
+144, 31, 7, 6, 30, 102, 96, 103, 128, 123, 8, 0, 15, 133, 12, 0,
+103, 102, 141, 83, 16, 103, 102, 139, 10, 235, 37, 144, 103, 102, 141, 83,
+ 16, 103, 102, 139, 74, 40, 102, 129, 249, 0, 0, 8, 0, 15, 131, 12,
+ 0, 103, 102, 139, 66, 44, 102, 35, 192, 15, 132, 3, 0, 102, 51, 201,
+ 14, 31, 232, 245, 253, 102, 35, 201, 15, 132, 50, 0, 102, 186, 0, 128,
+ 0, 0, 102, 59, 202, 15, 134, 31, 0, 102, 43, 202, 6, 102, 81, 102,
+ 87, 102, 82, 102, 139, 202, 232, 183, 253, 232, 251, 253, 102, 90, 102, 95,
+102, 89, 7, 102, 3, 250, 235, 218, 232, 165, 253, 232, 233, 253, 232, 11,
+254, 14, 7, 102, 187, 84, 67, 80, 65, 102, 191, 0, 32, 0, 0, 102,
+185, 20, 0, 0, 0, 102, 184, 7, 187, 0, 0, 102, 186, 10, 0, 0,
+ 0, 102, 51, 246, 205, 26, 102, 97, 144, 31, 7, 195, 160, 249, 1, 233,
+ 64, 241, 160, 250, 1, 233, 58, 241
+};
diff --git a/ntfsprogs/boot.h b/ntfsprogs/boot.h
new file mode 100755
index 0000000..45d7992
--- a/dev/null
+++ b/ntfsprogs/boot.h
@@ -0,0 +1,7 @@
+#ifndef _NTFS_BOOT_H_
+#define _NTFS_BOOT_H_
+
+extern const unsigned char boot_array[4136];
+
+#endif /* _NTFS_BOOT_H_ */
+
diff --git a/ntfsprogs/cluster.c b/ntfsprogs/cluster.c
new file mode 100755
index 0000000..d22d8e4
--- a/dev/null
+++ b/ntfsprogs/cluster.c
@@ -0,0 +1,118 @@
+/**
+ * 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"
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "cluster.h"
+#include "utils.h"
+#include "logging.h"
+
+/**
+ * cluster_find
+ */
+int cluster_find(ntfs_volume *vol, LCN c_begin, LCN c_end, cluster_cb *cb, void *data)
+{
+ int j;
+ 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;
+
+ m_ctx = mft_get_search_ctx(vol);
+ m_ctx->flags_search = FEMR_IN_USE | FEMR_BASE_RECORD;
+
+ while (mft_next_record(m_ctx) == 0) {
+
+ if (!(m_ctx->flags_match & FEMR_BASE_RECORD))
+ continue;
+
+ 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);
+
+ while ((rec = find_attribute(AT_UNUSED, a_ctx))) {
+
+ if (!rec->non_resident) {
+ 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) {
+ ntfs_log_error("Couldn't read the data runs.\n");
+ goto done;
+ }
+
+ ntfs_log_verbose("\t[0x%02X]\n", a_ctx->attr->type);
+
+ 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;
+
+ if (a_begin < 0)
+ continue; // sparse, discontiguous, etc
+
+ 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 +
+ runs[j].length - 1),
+ (long long)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;
+}
+
diff --git a/ntfsprogs/cluster.h b/ntfsprogs/cluster.h
new file mode 100755
index 0000000..4bc1827
--- a/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_ */
+
diff --git a/ntfsprogs/list.h b/ntfsprogs/list.h
new file mode 100755
index 0000000..4db45d4
--- a/dev/null
+++ b/ntfsprogs/list.h
@@ -0,0 +1,194 @@
+/*
+ * 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
+
+/**
+ * struct ntfs_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
+ * 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 ntfs_list_head {
+ struct ntfs_list_head *next, *prev;
+};
+
+#define NTFS_LIST_HEAD_INIT(name) { &(name), &(name) }
+
+#define NTFS_LIST_HEAD(name) \
+ struct ntfs_list_head name = NTFS_LIST_HEAD_INIT(name)
+
+#define NTFS_INIT_LIST_HEAD(ptr) do { \
+ (ptr)->next = (ptr); (ptr)->prev = (ptr); \
+} while (0)
+
+/**
+ * __ntfs_list_add - Insert a new entry between two known consecutive entries.
+ * @new:
+ * @prev:
+ * @next:
+ *
+ * This is only for internal list manipulation where we know the prev/next
+ * entries already!
+ */
+static __inline__ void __ntfs_list_add(struct ntfs_list_head * new,
+ struct ntfs_list_head * prev, struct ntfs_list_head * next)
+{
+ next->prev = new;
+ new->next = next;
+ new->prev = prev;
+ prev->next = new;
+}
+
+/**
+ * ntfs_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 ntfs_list_add(struct ntfs_list_head *new,
+ struct ntfs_list_head *head)
+{
+ __ntfs_list_add(new, head, head->next);
+}
+
+/**
+ * ntfs_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 ntfs_list_add_tail(struct ntfs_list_head *new,
+ struct ntfs_list_head *head)
+{
+ __ntfs_list_add(new, head->prev, head);
+}
+
+/**
+ * __ntfs_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
+ * entries already!
+ */
+static __inline__ void __ntfs_list_del(struct ntfs_list_head * prev,
+ struct ntfs_list_head * next)
+{
+ next->prev = prev;
+ prev->next = next;
+}
+
+/**
+ * ntfs_list_del - deletes entry from list.
+ * @entry: the element to delete from the list.
+ *
+ * Note: ntfs_list_empty on entry does not return true after this, the entry is
+ * in an undefined state.
+ */
+static __inline__ void ntfs_list_del(struct ntfs_list_head *entry)
+{
+ __ntfs_list_del(entry->prev, entry->next);
+}
+
+/**
+ * ntfs_list_del_init - deletes entry from list and reinitialize it.
+ * @entry: the element to delete from the list.
+ */
+static __inline__ void ntfs_list_del_init(struct ntfs_list_head *entry)
+{
+ __ntfs_list_del(entry->prev, entry->next);
+ NTFS_INIT_LIST_HEAD(entry);
+}
+
+/**
+ * ntfs_list_empty - tests whether a list is empty
+ * @head: the list to test.
+ */
+static __inline__ int ntfs_list_empty(struct ntfs_list_head *head)
+{
+ return head->next == head;
+}
+
+/**
+ * ntfs_list_splice - join two lists
+ * @list: the new list to add.
+ * @head: the place to add it in the first list.
+ */
+static __inline__ void ntfs_list_splice(struct ntfs_list_head *list,
+ struct ntfs_list_head *head)
+{
+ struct ntfs_list_head *first = list->next;
+
+ if (first != list) {
+ struct ntfs_list_head *last = list->prev;
+ struct ntfs_list_head *at = head->next;
+
+ first->prev = head;
+ head->next = first;
+
+ last->next = at;
+ at->prev = last;
+ }
+}
+
+/**
+ * ntfs_list_entry - get the struct for this entry
+ * @ptr: the &struct ntfs_list_head pointer.
+ * @type: the type of the struct this is embedded in.
+ * @member: the name of the list_struct within the struct.
+ */
+#define ntfs_list_entry(ptr, type, member) \
+ ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member)))
+
+/**
+ * ntfs_list_for_each - iterate over a list
+ * @pos: the &struct ntfs_list_head to use as a loop counter.
+ * @head: the head for your list.
+ */
+#define ntfs_list_for_each(pos, head) \
+ for (pos = (head)->next; pos != (head); pos = pos->next)
+
+/**
+ * ntfs_list_for_each_safe - iterate over a list safe against removal of list entry
+ * @pos: the &struct ntfs_list_head to use as a loop counter.
+ * @n: another &struct ntfs_list_head to use as temporary storage
+ * @head: the head for your list.
+ */
+#define ntfs_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 */
+
diff --git a/ntfsprogs/mkntfs.8 b/ntfsprogs/mkntfs.8
new file mode 100644
index 0000000..1037d00
--- a/dev/null
+++ b/ntfsprogs/mkntfs.8
@@ -0,0 +1,290 @@
+.\" 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.
+.\"
+.TH MKNTFS 8 "January 2006" "ntfs-3g 2014.2.15"
+.SH NAME
+mkntfs \- create an NTFS file system
+.SH SYNOPSIS
+.B mkntfs
+[\fIoptions\fR] \fIdevice \fR[\fInumber\-of\-sectors\fR]
+.PP
+.B mkntfs
+[
+.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 \-U
+]
+[
+.B \-V
+]
+[
+.B \-v
+]
+[
+.B \-z
+.I mft\-zone\-multiplier
+]
+[
+.B \-\-debug
+]
+.I device
+[
+.I number\-of\-sectors
+]
+.SH DESCRIPTION
+.B mkntfs
+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 ).
+.I number\-of\-sectors
+is the number of sectors 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
+.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.
+.SS Basic options
+.TP
+\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
+\fB\-L\fR, \fB\-\-label\fR STRING
+Set the volume label for the filesystem.
+.TP
+\fB\-C\fR, \fB\-\-enable\-compression\fR
+Enable compression on the volume.
+.TP
+\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.
+.SS Advanced options
+.TP
+\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
+uses 4096 bytes as the default cluster size.
+.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
+\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
+automatically and if that fails a default of 512 bytes per sector is used.
+.TP
+\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
+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
+\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
+.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
+\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
+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
+\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).
+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
+box;
+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
+.sp
+.TP
+\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
+\fB\-U\fR, \fB\-\-with\-uuid\fR
+Generate a random volume UUID.
+.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
+to run, even if the specified
+.I device
+is not a block special device, or appears to be mounted.
+.SS Output options
+.TP
+\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
+\fB\-v\fR, \fB\-\-verbose\fR
+Verbose execution.
+.TP
+\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.
+.SS Help options
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Print the version number of
+.B mkntfs
+and exit.
+.TP
+\fB\-l\fR, \fB\-\-license\fR
+Print the licensing information of
+.B mkntfs
+and exit.
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Show a list of options with a brief description of each one.
+.SH KNOWN ISSUES
+When applying chkdsk to a file system, it sometimes throws a warning
+"Correcting errors in the uppercase file." The uppercase file is created
+while formatting and it defines the mapping of lower case characters to
+upper case ones, as needed to sort file names in directories. The warning
+means that the uppercase file defined on the file system is not the same as
+the one used by the Windows OS on which chkdsk is running, and this may
+happen because newer versions of Windows take into account new characters
+defined by the Unicode consortium.
+.P
+Currently, mkntfs creates the uppercase table so that no warning is thrown
+by Windows Vista, Windows 7 or Windows 8. A warning may be thrown by
+other Windows versions, or if chkdsk is applied in succession on different
+Windows versions.
+.SH BUGS
+If you find a bug please send an email describing the problem to the
+development team:
+.br
+.nh
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.SH AUTHORS
+.B mkntfs
+was written by Anton Altaparmakov, Richard Russon, Erik Sornes and Szabolcs Szakacsits.
+It was ported to ntfs-3g by Erik Larsson and Jean-Pierre Andre.
+.SH AVAILABILITY
+.B mkntfs
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR badblocks (8),
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/mkntfs.8.in b/ntfsprogs/mkntfs.8.in
new file mode 100755
index 0000000..ce687f7
--- a/dev/null
+++ b/ntfsprogs/mkntfs.8.in
@@ -0,0 +1,290 @@
+.\" 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.
+.\"
+.TH MKNTFS 8 "January 2006" "ntfs-3g @VERSION@"
+.SH NAME
+mkntfs \- create an NTFS file system
+.SH SYNOPSIS
+.B mkntfs
+[\fIoptions\fR] \fIdevice \fR[\fInumber\-of\-sectors\fR]
+.PP
+.B mkntfs
+[
+.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 \-U
+]
+[
+.B \-V
+]
+[
+.B \-v
+]
+[
+.B \-z
+.I mft\-zone\-multiplier
+]
+[
+.B \-\-debug
+]
+.I device
+[
+.I number\-of\-sectors
+]
+.SH DESCRIPTION
+.B mkntfs
+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 ).
+.I number\-of\-sectors
+is the number of sectors 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
+.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.
+.SS Basic options
+.TP
+\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
+\fB\-L\fR, \fB\-\-label\fR STRING
+Set the volume label for the filesystem.
+.TP
+\fB\-C\fR, \fB\-\-enable\-compression\fR
+Enable compression on the volume.
+.TP
+\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.
+.SS Advanced options
+.TP
+\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
+uses 4096 bytes as the default cluster size.
+.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
+\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
+automatically and if that fails a default of 512 bytes per sector is used.
+.TP
+\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
+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
+\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
+.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
+\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
+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
+\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).
+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
+box;
+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
+.sp
+.TP
+\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
+\fB\-U\fR, \fB\-\-with\-uuid\fR
+Generate a random volume UUID.
+.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
+to run, even if the specified
+.I device
+is not a block special device, or appears to be mounted.
+.SS Output options
+.TP
+\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
+\fB\-v\fR, \fB\-\-verbose\fR
+Verbose execution.
+.TP
+\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.
+.SS Help options
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Print the version number of
+.B mkntfs
+and exit.
+.TP
+\fB\-l\fR, \fB\-\-license\fR
+Print the licensing information of
+.B mkntfs
+and exit.
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Show a list of options with a brief description of each one.
+.SH KNOWN ISSUES
+When applying chkdsk to a file system, it sometimes throws a warning
+"Correcting errors in the uppercase file." The uppercase file is created
+while formatting and it defines the mapping of lower case characters to
+upper case ones, as needed to sort file names in directories. The warning
+means that the uppercase file defined on the file system is not the same as
+the one used by the Windows OS on which chkdsk is running, and this may
+happen because newer versions of Windows take into account new characters
+defined by the Unicode consortium.
+.P
+Currently, mkntfs creates the uppercase table so that no warning is thrown
+by Windows Vista, Windows 7 or Windows 8. A warning may be thrown by
+other Windows versions, or if chkdsk is applied in succession on different
+Windows versions.
+.SH BUGS
+If you find a bug please send an email describing the problem to the
+development team:
+.br
+.nh
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.SH AUTHORS
+.B mkntfs
+was written by Anton Altaparmakov, Richard Russon, Erik Sornes and Szabolcs Szakacsits.
+It was ported to ntfs-3g by Erik Larsson and Jean-Pierre Andre.
+.SH AVAILABILITY
+.B mkntfs
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR badblocks (8),
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/mkntfs.c b/ntfsprogs/mkntfs.c
new file mode 100755
index 0000000..f8da9ce
--- a/dev/null
+++ b/ntfsprogs/mkntfs.c
@@ -0,0 +1,5177 @@
+/**
+ * mkntfs - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2000-2011 Anton Altaparmakov
+ * Copyright (c) 2001-2005 Richard Russon
+ * Copyright (c) 2002-2006 Szabolcs Szakacsits
+ * Copyright (c) 2005 Erik Sornes
+ * Copyright (c) 2007 Yura Pakhuchiy
+ * Copyright (c) 2010 Jean-Pierre Andre
+ *
+ * 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
+ * adapted from e2fsprogs-1.19 and lib/ext2fs/ismounted.c and misc/mke2fs.c in
+ * particular.
+ *
+ * This 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
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_LIBGEN_H
+#include <libgen.h>
+#endif
+#ifdef ENABLE_UUID
+#include <uuid/uuid.h>
+#endif
+
+
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#else
+ extern char *optarg;
+ extern int optind;
+#endif
+
+#ifdef HAVE_LINUX_MAJOR_H
+# include <linux/major.h>
+# 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 "security.h"
+#include "types.h"
+#include "attrib.h"
+#include "bitmap.h"
+#include "bootsect.h"
+#include "device.h"
+#include "dir.h"
+#include "mft.h"
+#include "mst.h"
+#include "runlist.h"
+#include "utils.h"
+#include "ntfstime.h"
+#include "sd.h"
+#include "boot.h"
+#include "attrdef.h"
+/* #include "version.h" */
+#include "logging.h"
+#include "support.h"
+#include "unistr.h"
+#include "misc.h"
+
+#if defined(__sun) && defined (__SVR4)
+#undef basename
+#define basename(name) name
+#endif
+
+typedef enum { WRITE_STANDARD, WRITE_BITMAP, WRITE_LOGFILE } WRITE_TYPE;
+
+#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
+
+/* Page size on ia32. Can change to 8192 on Alpha. */
+#define NTFS_PAGE_SIZE 4096
+
+static char EXEC_NAME[] = "mkntfs";
+
+struct BITMAP_ALLOCATION {
+ struct BITMAP_ALLOCATION *next;
+ LCN lcn; /* first allocated cluster */
+ s64 length; /* count of consecutive clusters */
+} ;
+
+ /* Upcase $Info, used since Windows 8 */
+struct UPCASEINFO {
+ le32 len;
+ le32 filler;
+ le64 crc;
+ le32 osmajor;
+ le32 osminor;
+ le32 build;
+ le16 packmajor;
+ le16 packminor;
+} ;
+
+/**
+ * global variables
+ */
+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 int g_dynamic_buf_size = 0;
+static u8 *g_dynamic_buf = NULL;
+static struct UPCASEINFO *g_upcaseinfo = 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 */
+
+static struct BITMAP_ALLOCATION *g_allocation = NULL; /* Head of cluster allocations */
+
+/**
+ * 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. */
+ 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 */
+ 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 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 */
+ BOOL with_uuid; /* -U, request setting an uuid */
+ char *label; /* -L, volume label */
+} 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"
+" -I, --no-indexing Disable indexing on the volume\n"
+" -n, --no-action Do not write to disk\n"
+"\n"
+"Advanced options:\n"
+" -c, --cluster-size BYTES Specify the cluster size for the volume\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"
+" -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));
+ ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home);
+}
+
+/**
+ * mkntfs_version
+ */
+static void mkntfs_version(void)
+{
+ ntfs_log_info("\n%s v%s (libntfs-3g)\n\n", EXEC_NAME, VERSION);
+ ntfs_log_info("Create an NTFS volume on a user specified (block) "
+ "device.\n\n");
+ ntfs_log_info("Copyright (c) 2000-2007 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");
+ ntfs_log_info("Copyright (c) 2007 Yura Pakhuchiy\n");
+ ntfs_log_info("Copyright (c) 2010-2012 Jean-Pierre Andre\n");
+ ntfs_log_info("\n%s\n%s%s\n", ntfs_gpl, ntfs_bugs, ntfs_home);
+}
+
+/*
+ * crc64, adapted from http://rpm5.org/docs/api/digest_8c-source.html
+ * ECMA-182 polynomial, see
+ * http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-182.pdf
+ */
+ /* make sure the needed types are defined */
+#undef byte
+#undef uint32_t
+#undef uint64_t
+#define byte u8
+#define uint32_t u32
+#define uint64_t u64
+static uint64_t crc64(uint64_t crc, const byte * data, size_t size)
+ /*@*/
+{
+ static uint64_t polynomial = 0x9a6c9329ac4bc9b5ULL;
+ static uint64_t xorout = 0xffffffffffffffffULL;
+ static uint64_t table[256];
+
+ crc ^= xorout;
+
+ if (data == NULL) {
+ /* generate the table of CRC remainders for all possible bytes */
+ uint64_t c;
+ uint32_t i, j;
+ for (i = 0; i < 256; i++) {
+ c = i;
+ for (j = 0; j < 8; j++) {
+ if (c & 1)
+ c = polynomial ^ (c >> 1);
+ else
+ c = (c >> 1);
+ }
+ table[i] = c;
+ }
+ } else
+ while (size) {
+ crc = table[(crc ^ *data) & 0xff] ^ (crc >> 8);
+ size--;
+ data++;
+ }
+
+ crc ^= xorout;
+
+ return crc;
+}
+
+/*
+ * Mark a run of clusters as allocated
+ *
+ * Returns FALSE if unsuccessful
+ */
+
+static BOOL bitmap_allocate(LCN lcn, s64 length)
+{
+ BOOL done;
+ struct BITMAP_ALLOCATION *p;
+ struct BITMAP_ALLOCATION *q;
+ struct BITMAP_ALLOCATION *newall;
+
+ done = TRUE;
+ if (length) {
+ p = g_allocation;
+ q = (struct BITMAP_ALLOCATION*)NULL;
+ /* locate the first run which starts beyond the requested lcn */
+ while (p && (p->lcn <= lcn)) {
+ q = p;
+ p = p->next;
+ }
+ /* make sure the requested lcns were not allocated */
+ if ((q && ((q->lcn + q->length) > lcn))
+ || (p && ((lcn + length) > p->lcn))) {
+ ntfs_log_error("Bitmap allocation error\n");
+ done = FALSE;
+ }
+ if (q && ((q->lcn + q->length) == lcn)) {
+ /* extend current run, no overlapping possible */
+ q->length += length;
+ } else {
+ newall = (struct BITMAP_ALLOCATION*)
+ ntfs_malloc(sizeof(struct BITMAP_ALLOCATION));
+ if (newall) {
+ newall->lcn = lcn;
+ newall->length = length;
+ newall->next = p;
+ if (q) q->next = newall;
+ else g_allocation = newall;
+ } else {
+ done = FALSE;
+ ntfs_log_perror("Not enough memory");
+ }
+ }
+ }
+ return (done);
+}
+
+/*
+ * Mark a run of cluster as not allocated
+ *
+ * Returns FALSE if unsuccessful
+ * (freeing free clusters is not considered as an error)
+ */
+
+static BOOL bitmap_deallocate(LCN lcn, s64 length)
+{
+ BOOL done;
+ struct BITMAP_ALLOCATION *p;
+ struct BITMAP_ALLOCATION *q;
+ LCN first, last;
+ s64 begin_length, end_length;
+
+ done = TRUE;
+ if (length) {
+ p = g_allocation;
+ q = (struct BITMAP_ALLOCATION*)NULL;
+ /* locate a run which has a common portion */
+ while (p) {
+ first = (p->lcn > lcn ? p->lcn : lcn);
+ last = ((p->lcn + p->length) < (lcn + length)
+ ? p->lcn + p->length : lcn + length);
+ if (first < last) {
+ /* get the parts which must be kept */
+ begin_length = first - p->lcn;
+ end_length = p->lcn + p->length - last;
+ /* delete the entry */
+ if (q)
+ q->next = p->next;
+ else
+ g_allocation = p->next;
+ free(p);
+ /* reallocate the beginning and the end */
+ if (begin_length
+ && !bitmap_allocate(first - begin_length,
+ begin_length))
+ done = FALSE;
+ if (end_length
+ && !bitmap_allocate(last, end_length))
+ done = FALSE;
+ /* restart a full search */
+ p = g_allocation;
+ q = (struct BITMAP_ALLOCATION*)NULL;
+ } else {
+ q = p;
+ p = p->next;
+ }
+ }
+ }
+ return (done);
+}
+
+/*
+ * Get the allocation status of a single cluster
+ * and mark as allocated
+ *
+ * Returns 1 if the cluster was previously allocated
+ */
+
+static int bitmap_get_and_set(LCN lcn, unsigned long length)
+{
+ struct BITMAP_ALLOCATION *p;
+ struct BITMAP_ALLOCATION *q;
+ int bit;
+
+ if (length == 1) {
+ p = g_allocation;
+ q = (struct BITMAP_ALLOCATION*)NULL;
+ /* locate the first run which starts beyond the requested lcn */
+ while (p && (p->lcn <= lcn)) {
+ q = p;
+ p = p->next;
+ }
+ if (q && (q->lcn <= lcn) && ((q->lcn + q->length) > lcn))
+ bit = 1; /* was allocated */
+ else {
+ bitmap_allocate(lcn, length);
+ bit = 0;
+ }
+ } else {
+ ntfs_log_error("Can only allocate a single cluster at a time\n");
+ bit = 0;
+ }
+ return (bit);
+}
+
+/*
+ * Build a section of the bitmap according to allocation
+ */
+
+static void bitmap_build(u8 *buf, LCN lcn, s64 length)
+{
+ struct BITMAP_ALLOCATION *p;
+ LCN first, last;
+ int j; /* byte number */
+ int bn; /* bit number */
+
+ for (j=0; (8*j)<length; j++)
+ buf[j] = 0;
+ for (p=g_allocation; p; p=p->next) {
+ first = (p->lcn > lcn ? p->lcn : lcn);
+ last = ((p->lcn + p->length) < (lcn + length)
+ ? p->lcn + p->length : lcn + length);
+ if (first < last) {
+ bn = first - lcn;
+ /* initial partial byte, if any */
+ while ((bn < (last - lcn)) && (bn & 7)) {
+ buf[bn >> 3] |= 1 << (bn & 7);
+ bn++;
+ }
+ /* full bytes */
+ while (bn < (last - lcn - 7)) {
+ buf[bn >> 3] = 255;
+ bn += 8;
+ }
+ /* final partial byte, if any */
+ while (bn < (last - lcn)) {
+ buf[bn >> 3] |= 1 << (bn & 7);
+ bn++;
+ }
+ }
+ }
+}
+
+/**
+ * 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)
+{
+ if (!opts2)
+ return;
+
+ 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;
+}
+
+/**
+ * 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:TUvVz:";
+ 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' },
+ { "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' },
+ { "with-uuid", no_argument, NULL, 'U' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, 'V' },
+ { "zero-time", no_argument, NULL, 'T' },
+ { NULL, 0, NULL, 0 }
+ };
+
+ int c = -1;
+ int lic = 0;
+ int err = 0;
+ int ver = 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)) != -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':
+ 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))
+ 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 'U':
+ opts2->with_uuid = TRUE;
+ break;
+ case 'v':
+ ntfs_log_set_levels(NTFS_LOG_LEVEL_QUIET |
+ NTFS_LOG_LEVEL_VERBOSE |
+ NTFS_LOG_LEVEL_PROGRESS);
+ break;
+ case 'V':
+ ver++; /* display version info */
+ 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;
+ 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 == 'c') || (optopt == 'H') ||
+ (optopt == 'L') || (optopt == 'p') ||
+ (optopt == 's') || (optopt == 'S') ||
+ (optopt == 'N') || (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;
+ }
+ }
+
+ if (!err && !ver && !lic) {
+ if (opts2->dev_name == NULL) {
+ if (argc > 1)
+ ntfs_log_error("You must specify a device.\n");
+ err++;
+ }
+ }
+
+ if (ver)
+ mkntfs_version();
+ if (lic)
+ mkntfs_license();
+ if (err)
+ mkntfs_usage();
+
+ return (!err && !ver && !lic);
+}
+
+
+/**
+ * mkntfs_time
+ */
+static ntfs_time mkntfs_time(void)
+{
+ struct timespec ts;
+
+ ts.tv_sec = 0;
+ ts.tv_nsec = 0;
+ if (!opts.use_epoch_time)
+ ts.tv_sec = time(NULL);
+ return timespec2ntfs(ts);
+}
+
+/**
+ * append_to_bad_blocks
+ */
+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) {
+ 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;
+}
+
+/**
+ * mkntfs_write
+ */
+static long long mkntfs_write(struct ntfs_device *dev,
+ const void *b, long long count)
+{
+ long long bytes_written, total;
+ int retry;
+
+ if (opts.no_action)
+ return count;
+ total = 0LL;
+ retry = 0;
+ do {
+ bytes_written = dev->d_ops->write(dev, b, count);
+ if (bytes_written == -1LL) {
+ retry = errno;
+ ntfs_log_perror("Error writing to %s", dev->d_name);
+ errno = retry;
+ return bytes_written;
+ } else if (!bytes_written) {
+ retry++;
+ } else {
+ count -= bytes_written;
+ total += bytes_written;
+ }
+ } while (count && retry < 3);
+ if (count)
+ ntfs_log_error("Failed to complete writing to %s after three retries."
+ "\n", dev->d_name);
+ return total;
+}
+
+/**
+ * Build and write a part of the global bitmap
+ * without overflowing from the allocated buffer
+ *
+ * mkntfs_bitmap_write
+ */
+static s64 mkntfs_bitmap_write(struct ntfs_device *dev,
+ s64 offset, s64 length)
+{
+ s64 partial_length;
+ s64 written;
+
+ partial_length = length;
+ if (partial_length > g_dynamic_buf_size)
+ partial_length = g_dynamic_buf_size;
+ /* create a partial bitmap section, and write it */
+ bitmap_build(g_dynamic_buf,offset << 3,partial_length << 3);
+ written = dev->d_ops->write(dev, g_dynamic_buf, partial_length);
+ return (written);
+}
+
+/**
+ * Build and write a part of the log file
+ * without overflowing from the allocated buffer
+ *
+ * mkntfs_logfile_write
+ */
+static s64 mkntfs_logfile_write(struct ntfs_device *dev,
+ s64 offset __attribute__((unused)), s64 length)
+{
+ s64 partial_length;
+ s64 written;
+
+ partial_length = length;
+ if (partial_length > g_dynamic_buf_size)
+ partial_length = g_dynamic_buf_size;
+ /* create a partial bad cluster section, and write it */
+ memset(g_dynamic_buf, -1, partial_length);
+ written = dev->d_ops->write(dev, g_dynamic_buf, partial_length);
+ return (written);
+}
+
+/**
+ * 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.
+ *
+ * @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.
+ */
+static s64 ntfs_rlwrite(struct ntfs_device *dev, const runlist *rl,
+ const u8 *val, const s64 val_len, s64 *inited_size,
+ WRITE_TYPE write_type)
+{
+ s64 bytes_written, total, length, delta;
+ int retry, i;
+
+ if (inited_size)
+ *inited_size = 0LL;
+ if (opts.no_action)
+ return val_len;
+ total = 0LL;
+ delta = 0LL;
+ for (i = 0; rl[i].length; i++) {
+ length = rl[i].length * g_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;
+ }
+ /*
+ * 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 * g_vol->cluster_size,
+ SEEK_SET) == (off_t)-1)
+ return -1LL;
+ retry = 0;
+ do {
+ /* use specific functions if buffer is not prefilled */
+ switch (write_type) {
+ case WRITE_BITMAP :
+ bytes_written = mkntfs_bitmap_write(dev,
+ total, length);
+ break;
+ case WRITE_LOGFILE :
+ bytes_written = mkntfs_logfile_write(dev,
+ total, length);
+ break;
+ default :
+ bytes_written = dev->d_ops->write(dev,
+ val + total, length);
+ break;
+ }
+ if (bytes_written == -1LL) {
+ retry = errno;
+ ntfs_log_perror("Error writing to %s",
+ dev->d_name);
+ 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) {
+ ntfs_log_error("Failed to complete writing to %s after three "
+ "retries.\n", dev->d_name);
+ return total;
+ }
+ }
+ if (delta) {
+ int eo;
+ char *b = ntfs_calloc(delta);
+ if (!b)
+ return -1;
+ bytes_written = mkntfs_write(dev, b, delta);
+ eo = errno;
+ free(b);
+ errno = eo;
+ if (bytes_written == -1LL)
+ return bytes_written;
+ }
+ return total;
+}
+
+/**
+ * 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 -DDEBUG. Means
+ * the input parameters were faulty.
+ */
+static 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)) {
+ ntfs_log_error("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 > (int)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;
+}
+
+/**
+ * deallocate_scattered_clusters
+ */
+static void deallocate_scattered_clusters(const runlist *rl)
+{
+ int i;
+
+ if (!rl)
+ return;
+ /* Iterate over all runs in the runlist @rl. */
+ for (i = 0; rl[i].length; i++) {
+ /* Skip sparse runs. */
+ if (rl[i].lcn == -1LL)
+ continue;
+ /* Deallocate the current run. */
+ bitmap_deallocate(rl[i].lcn, rl[i].length);
+ }
+}
+
+/**
+ * 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
+ * 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.
+ */
+static runlist * allocate_scattered_clusters(s64 clusters)
+{
+ runlist *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 = g_vol->nr_clusters;
+ /* Loop until all clusters are allocated. */
+ while (clusters) {
+ /* Loop in current zone until we run out of free clusters. */
+ for (lcn = g_mft_zone_end; lcn < end; lcn++) {
+ bit = bitmap_get_and_set(lcn,1);
+ if (bit)
+ continue;
+ /*
+ * Reallocate memory if necessary. Make sure we have
+ * enough for the terminator entry as well.
+ */
+ if ((rlpos + 2) * (int)sizeof(runlist) >= 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 = 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 = 0LL;
+ rl[rlpos].length = 0LL;
+ return rl;
+ }
+
+ }
+ /* Switch to next zone, decreasing mft zone by factor 2. */
+ end = g_mft_zone_end;
+ g_mft_zone_end >>= 1;
+ /* Have we run out of space on the volume? */
+ if (g_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 runlist. */
+ free(rl);
+ }
+ return NULL;
+}
+
+/**
+ * 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 = g_vol->upcase;
+ u32 upcase_len = g_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)) {
+ int rc;
+
+ rc = ntfs_names_full_collate(name, name_len,
+ (ntfschar*)((char*)a +
+ le16_to_cpu(a->name_offset)),
+ a->name_length, 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_full_collate(name, name_len,
+ (ntfschar*)((char*)a +
+ le16_to_cpu(a->name_offset)),
+ a->name_length, 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 {
+ 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) {
+ 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;
+ }
+ }
+ }
+ ntfs_log_trace("File is corrupt. Run chkdsk.\n");
+ 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 be 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.
+ */
+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 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;
+}
+
+/**
+ * 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.
+ *
+ * Return 0 on success and -errno on error.
+ */
+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 u8 *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;
+ ntfschar *uname = NULL;
+ int uname_len = 0;
+ /*
+ if (base record)
+ attr_lookup();
+ else
+ */
+
+ uname = ntfs_str2ucs(name, &uname_len);
+ if (!uname)
+ return -errno;
+
+ /* Check if the attribute is already there. */
+ ctx = ntfs_attr_get_search_ctx(NULL, m);
+ if (!ctx) {
+ ntfs_log_error("Failed to allocate attribute search context.\n");
+ err = -ENOMEM;
+ goto err_out;
+ }
+ if (ic == IGNORE_CASE) {
+ ntfs_log_error("FIXME: Hit unimplemented code path #1.\n");
+ err = -EOPNOTSUPP;
+ goto err_out;
+ }
+ if (!mkntfs_attr_lookup(type, uname, uname_len, ic, 0, NULL, 0, ctx)) {
+ err = -EEXIST;
+ goto err_out;
+ }
+ if (errno != ENOENT) {
+ ntfs_log_error("Corrupt inode.\n");
+ err = -errno;
+ goto err_out;
+ }
+ a = ctx->attr;
+ if (flags & ATTR_COMPRESSION_MASK) {
+ 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)) {
+ ntfs_log_error("Encrypted/sparse attributes not supported.\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) */
+ 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(g_vol, rl, 0, INT_MAX);
+ if (mpa_size < 0) {
+ err = -errno;
+ ntfs_log_error("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 * g_vol->cluster_size < val_len) {
+ 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?
+ */
+ err = -EOPNOTSUPP;
+ goto err_out;
+#ifdef DEBUG
+ } 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;
+ 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_sle64(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_sle64(highest_vcn * g_vol->cluster_size);
+ a->data_size = cpu_to_sle64(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) {
+ 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. */
+ a->compressed_size = cpu_to_le64(0);
+ /* FIXME: Write out the compressed data. */
+ /* FIXME: err = build_mapping_pairs_compressed(); */
+ err = -EOPNOTSUPP;
+ } else {
+ a->compression_unit = 0;
+ if ((type == AT_DATA)
+ && (m->mft_record_number
+ == const_cpu_to_le32(FILE_LogFile)))
+ bw = ntfs_rlwrite(g_vol->dev, rl, val, val_len,
+ &inited_size, WRITE_LOGFILE);
+ else
+ bw = ntfs_rlwrite(g_vol->dev, rl, val, val_len,
+ &inited_size, WRITE_STANDARD);
+ 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);
+ }
+ a->initialized_size = cpu_to_sle64(inited_size);
+ if (err < 0 || bw != val_len) {
+ /* FIXME: Handle error. */
+ /* deallocate clusters */
+ /* remove attribute */
+ if (err >= 0)
+ err = -EIO;
+ ntfs_log_error("insert_positioned_attr_in_mft_record failed "
+ "with error %i.\n", err < 0 ? err : (int)bw);
+ }
+err_out:
+ if (ctx)
+ ntfs_attr_put_search_ctx(ctx);
+ ntfs_ucsfree(uname);
+ return err;
+}
+
+/**
+ * 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,
+ const ATTR_TYPES type, const char *name, u32 name_len,
+ const IGNORE_CASE_BOOL ic, const ATTR_FLAGS flags,
+ const u8 *val, const s64 val_len,
+ WRITE_TYPE write_type)
+{
+ ntfs_attr_search_ctx *ctx;
+ ATTR_RECORD *a;
+ u16 hdr_size;
+ int asize, mpa_size, err, i;
+ runlist *rl = NULL;
+ s64 bw = 0;
+ ntfschar *uname = NULL;
+ int uname_len = 0;
+ /*
+ if (base record)
+ attr_lookup();
+ else
+ */
+
+ uname = ntfs_str2ucs(name, &uname_len);
+ if (!uname)
+ return -errno;
+
+ /* Check if the attribute is already there. */
+ ctx = ntfs_attr_get_search_ctx(NULL, m);
+ if (!ctx) {
+ ntfs_log_error("Failed to allocate attribute search context.\n");
+ err = -ENOMEM;
+ goto err_out;
+ }
+ if (ic == IGNORE_CASE) {
+ ntfs_log_error("FIXME: Hit unimplemented code path #2.\n");
+ err = -EOPNOTSUPP;
+ goto err_out;
+ }
+ if (!mkntfs_attr_lookup(type, uname, uname_len, ic, 0, NULL, 0, ctx)) {
+ err = -EEXIST;
+ goto err_out;
+ }
+ if (errno != ENOENT) {
+ ntfs_log_error("Corrupt inode.\n");
+ err = -errno;
+ goto err_out;
+ }
+ a = ctx->attr;
+ if (flags & ATTR_COMPRESSION_MASK) {
+ 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)) {
+ ntfs_log_error("Encrypted/sparse attributes not supported.\n");
+ err = -EOPNOTSUPP;
+ goto err_out;
+ }
+ if (val_len) {
+ rl = allocate_scattered_clusters((val_len +
+ g_vol->cluster_size - 1) / g_vol->cluster_size);
+ if (!rl) {
+ err = -errno;
+ ntfs_log_perror("Failed to allocate scattered clusters");
+ 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(g_vol, rl, 0, INT_MAX);
+ if (mpa_size < 0) {
+ err = -errno;
+ ntfs_log_error("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 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) {
+ 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;
+ 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_sle64(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_sle64((val_len + (g_vol->cluster_size - 1)) &
+ ~(g_vol->cluster_size - 1));
+ a->data_size = cpu_to_sle64(val_len);
+ a->initialized_size = cpu_to_sle64(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) {
+ 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. */
+ a->compressed_size = cpu_to_le64(0);
+ /* FIXME: Write out the compressed data. */
+ /* FIXME: err = build_mapping_pairs_compressed(); */
+ err = -EOPNOTSUPP;
+ } else {
+ a->compression_unit = 0;
+ bw = ntfs_rlwrite(g_vol->dev, rl, val, val_len, NULL,
+ write_type);
+ 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);
+ }
+ if (err < 0 || bw != val_len) {
+ /* FIXME: Handle error. */
+ /* deallocate clusters */
+ /* remove attribute */
+ if (err >= 0)
+ err = -EIO;
+ ntfs_log_error("insert_non_resident_attr_in_mft_record failed with "
+ "error %lld.\n", (long long) (err < 0 ? err : bw));
+ }
+err_out:
+ if (ctx)
+ ntfs_attr_put_search_ctx(ctx);
+ ntfs_ucsfree(uname);
+ free(rl);
+ return err;
+}
+
+/**
+ * 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,
+ 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 u8 *val, const u32 val_len)
+{
+ ntfs_attr_search_ctx *ctx;
+ ATTR_RECORD *a;
+ int asize, err;
+ ntfschar *uname = NULL;
+ int uname_len = 0;
+ /*
+ if (base record)
+ mkntfs_attr_lookup();
+ else
+ */
+
+ uname = ntfs_str2ucs(name, &uname_len);
+ if (!uname)
+ return -errno;
+
+ /* Check if the attribute is already there. */
+ ctx = ntfs_attr_get_search_ctx(NULL, m);
+ if (!ctx) {
+ ntfs_log_error("Failed to allocate attribute search context.\n");
+ err = -ENOMEM;
+ goto err_out;
+ }
+ if (ic == IGNORE_CASE) {
+ ntfs_log_error("FIXME: Hit unimplemented code path #3.\n");
+ err = -EOPNOTSUPP;
+ goto err_out;
+ }
+ if (!mkntfs_attr_lookup(type, uname, uname_len, ic, 0, val, val_len,
+ ctx)) {
+ err = -EEXIST;
+ goto err_out;
+ }
+ if (errno != ENOENT) {
+ ntfs_log_error("Corrupt inode.\n");
+ err = -errno;
+ goto err_out;
+ }
+ a = ctx->attr;
+ /* sizeof(resident attribute record header) == 24 */
+ asize = ((24 + ((name_len*2 + 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?
+ */
+ err = -EOPNOTSUPP;
+ goto err_out;
+ }
+#ifdef DEBUG
+ if (err == -EINVAL) {
+ ntfs_log_error("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;
+ if (type == AT_OBJECT_ID)
+ a->name_offset = const_cpu_to_le16(0);
+ else
+ 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);
+ a->value_length = cpu_to_le32(val_len);
+ a->value_offset = cpu_to_le16(24 + ((name_len*2 + 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_attr_put_search_ctx(ctx);
+ ntfs_ucsfree(uname);
+ return err;
+}
+
+
+/**
+ * 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,
+ le32 security_id)
+{
+ STANDARD_INFORMATION si;
+ int err, sd_size;
+
+ sd_size = 48;
+
+ si.creation_time = 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;
+ si.file_attributes = flags; /* already LE */
+ si.maximum_versions = cpu_to_le32(0);
+ si.version_number = cpu_to_le32(0);
+ si.class_id = cpu_to_le32(0);
+ si.security_id = security_id;
+ if (si.security_id != const_cpu_to_le32(0))
+ sd_size = 72;
+ /* FIXME: $Quota support... */
+ si.owner_id = cpu_to_le32(0);
+ si.quota_charged = cpu_to_le64(0ULL);
+ /* FIXME: $UsnJrnl support... Not needed on fresh w2k3-volume */
+ si.usn = cpu_to_le64(0ULL);
+ /* 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, CASE_SENSITIVE, const_cpu_to_le16(0),
+ 0, (u8*)&si, sd_size);
+ if (err < 0)
+ ntfs_log_perror("add_attr_std_info failed");
+ return err;
+}
+
+/*
+ * Tell whether the unnamed data is non resident
+ */
+
+static BOOL non_resident_unnamed_data(MFT_RECORD *m)
+{
+ ATTR_RECORD *a;
+ ntfs_attr_search_ctx *ctx;
+ BOOL nonres;
+
+ ctx = ntfs_attr_get_search_ctx(NULL, m);
+ if (ctx && !mkntfs_attr_find(AT_DATA,
+ (const ntfschar*)NULL, 0, CASE_SENSITIVE,
+ (u8*)NULL, 0, ctx)) {
+ a = ctx->attr;
+ nonres = a->non_resident != 0;
+ } else {
+ ntfs_log_error("BUG: Unnamed data not found\n");
+ nonres = TRUE;
+ }
+ if (ctx)
+ ntfs_attr_put_search_ctx(ctx);
+ return (nonres);
+}
+
+/*
+ * Get the time stored in the standard information attribute
+ */
+
+static ntfs_time stdinfo_time(MFT_RECORD *m)
+{
+ STANDARD_INFORMATION *si;
+ ntfs_attr_search_ctx *ctx;
+ ntfs_time info_time;
+
+ ctx = ntfs_attr_get_search_ctx(NULL, m);
+ if (ctx && !mkntfs_attr_find(AT_STANDARD_INFORMATION,
+ (const ntfschar*)NULL, 0, CASE_SENSITIVE,
+ (u8*)NULL, 0, ctx)) {
+ si = (STANDARD_INFORMATION*)((char*)ctx->attr +
+ le16_to_cpu(ctx->attr->value_offset));
+ info_time = si->creation_time;
+ } else {
+ ntfs_log_error("BUG: Standard information not found\n");
+ info_time = mkntfs_time();
+ }
+ if (ctx)
+ ntfs_attr_put_search_ctx(ctx);
+ return (info_time);
+}
+
+/**
+ * add_attr_file_name
+ *
+ * Return 0 on success or -errno on error.
+ */
+static int add_attr_file_name(MFT_RECORD *m, const leMFT_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;
+ ntfschar *uname;
+
+ /* Check if the attribute is already there. */
+ ctx = ntfs_attr_get_search_ctx(NULL, m);
+ if (!ctx) {
+ ntfs_log_error("Failed to get attribute search context.\n");
+ return -ENOMEM;
+ }
+ if (mkntfs_attr_lookup(AT_STANDARD_INFORMATION, AT_UNNAMED, 0,
+ CASE_SENSITIVE, 0, NULL, 0, ctx)) {
+ int eo = errno;
+ ntfs_log_error("BUG: Standard information attribute not "
+ "present in file record.\n");
+ ntfs_attr_put_search_ctx(ctx);
+ return -eo;
+ }
+ si = (STANDARD_INFORMATION*)((char*)ctx->attr +
+ le16_to_cpu(ctx->attr->value_offset));
+ i = (strlen(file_name) + 1) * sizeof(ntfschar);
+ fn_size = sizeof(FILE_NAME_ATTR) + i;
+ fn = ntfs_malloc(fn_size);
+ if (!fn) {
+ ntfs_attr_put_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_attr_put_search_ctx(ctx);
+
+ fn->allocated_size = cpu_to_sle64(allocated_size);
+ fn->data_size = cpu_to_sle64(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;
+ uname = fn->file_name;
+ i = ntfs_mbstoucs_libntfscompat(file_name, &uname, 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);
+ i = insert_resident_attr_in_mft_record(m, AT_FILE_NAME, NULL, 0,
+ CASE_SENSITIVE, const_cpu_to_le16(0),
+ RESIDENT_ATTR_IS_INDEXED, (u8*)fn, fn_size);
+ free(fn);
+ if (i < 0)
+ ntfs_log_error("add_attr_file_name failed: %s\n", strerror(-i));
+ return i;
+}
+
+/**
+ * add_attr_object_id -
+ *
+ * Note we insert only a basic object id which only has the GUID and none of
+ * the extended fields. This is because we currently only use this function
+ * when creating the object id for the volume.
+ *
+ * Return 0 on success or -errno on error.
+ */
+static int add_attr_object_id(MFT_RECORD *m, const GUID *object_id)
+{
+ OBJECT_ID_ATTR oi;
+ int err;
+
+ oi = (OBJECT_ID_ATTR) {
+ .object_id = *object_id,
+ };
+ err = insert_resident_attr_in_mft_record(m, AT_OBJECT_ID, NULL,
+ 0, CASE_SENSITIVE, const_cpu_to_le16(0),
+ 0, (u8*)&oi, sizeof(oi.object_id));
+ if (err < 0)
+ ntfs_log_error("add_attr_vol_info failed: %s\n", strerror(-err));
+ return err;
+}
+
+/**
+ * add_attr_sd
+ *
+ * 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.
+ */
+static int add_attr_sd(MFT_RECORD *m, const u8 *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,
+ CASE_SENSITIVE, const_cpu_to_le16(0), sd,
+ sd_len, WRITE_STANDARD);
+ else
+ err = insert_resident_attr_in_mft_record(m,
+ AT_SECURITY_DESCRIPTOR, NULL, 0,
+ CASE_SENSITIVE, const_cpu_to_le16(0), 0, sd,
+ sd_len);
+ if (err < 0)
+ ntfs_log_error("add_attr_sd failed: %s\n", strerror(-err));
+ return err;
+}
+
+/**
+ * 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,
+ const IGNORE_CASE_BOOL ic, const ATTR_FLAGS flags,
+ const u8 *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,
+ WRITE_STANDARD);
+ else
+ err = insert_resident_attr_in_mft_record(m, AT_DATA, name,
+ name_len, ic, flags, 0, val, val_len);
+
+ if (err < 0)
+ ntfs_log_error("add_attr_data failed: %s\n", strerror(-err));
+ 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.
+ *
+ * Return 0 on success or -errno on error.
+ */
+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 u8 *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)
+ ntfs_log_error("add_attr_data_positioned failed: %s\n",
+ strerror(-err));
+ 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
+ * endian ntfschar string. The name is at least 1 character long (though
+ * Windows accepts zero characters), and at most 128 characters long (not
+ * counting the terminating null).
+ *
+ * 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 __attribute__((unused)))
+{
+ ntfschar *uname = NULL;
+ int uname_len = 0;
+ int i;
+
+ if (vol_name) {
+ uname_len = ntfs_mbstoucs(vol_name, &uname);
+ if (uname_len < 0)
+ return -errno;
+ if (uname_len > 128) {
+ free(uname);
+ return -ENAMETOOLONG;
+ }
+ }
+ i = insert_resident_attr_in_mft_record(m, AT_VOLUME_NAME, NULL, 0,
+ CASE_SENSITIVE, const_cpu_to_le16(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));
+ return i;
+}
+
+/**
+ * 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,
+ 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, CASE_SENSITIVE, const_cpu_to_le16(0),
+ 0, (u8*)&vi, sizeof(vi));
+ if (err < 0)
+ ntfs_log_error("add_attr_vol_info failed: %s\n", strerror(-err));
+ return err;
+}
+
+/**
+ * add_attr_index_root
+ *
+ * Return 0 on success or -errno on error.
+ */
+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)
+{
+ INDEX_ROOT *r;
+ INDEX_ENTRY_HEADER *e;
+ int err, val_len;
+
+ val_len = sizeof(INDEX_ROOT) + sizeof(INDEX_ENTRY_HEADER);
+ r = ntfs_malloc(val_len);
+ if (!r)
+ return -errno;
+ r->type = (indexed_attr_type == AT_FILE_NAME)
+ ? AT_FILE_NAME : const_cpu_to_le32(0);
+ if (indexed_attr_type == AT_FILE_NAME &&
+ collation_rule != COLLATION_FILE_NAME) {
+ free(r);
+ ntfs_log_error("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 >= 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 /
+ 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");
+ free(r);
+ return -EINVAL;
+ }
+ 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");
+ free(r);
+ return -EINVAL;
+ }
+ r->clusters_per_index_block = index_block_size
+ >> NTFS_BLOCK_SIZE_BITS;
+ }
+ memset(&r->reserved, 0, sizeof(r->reserved));
+ 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.ih_flags = SMALL_INDEX;
+ memset(&r->index.reserved, 0, sizeof(r->index.reserved));
+ 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 = 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 = const_cpu_to_le16(0);
+ err = insert_resident_attr_in_mft_record(m, AT_INDEX_ROOT, name,
+ name_len, ic, const_cpu_to_le16(0), 0,
+ (u8*)r, val_len);
+ free(r);
+ if (err < 0)
+ ntfs_log_error("add_attr_index_root failed: %s\n", strerror(-err));
+ return err;
+}
+
+/**
+ * add_attr_index_alloc
+ *
+ * Return 0 on success or -errno on error.
+ */
+static int add_attr_index_alloc(MFT_RECORD *m, const char *name,
+ const u32 name_len, const IGNORE_CASE_BOOL ic,
+ const u8 *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, const_cpu_to_le16(0),
+ index_alloc_val, index_alloc_val_len, WRITE_STANDARD);
+ if (err < 0)
+ ntfs_log_error("add_attr_index_alloc failed: %s\n", strerror(-err));
+ return err;
+}
+
+/**
+ * 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,
+ const IGNORE_CASE_BOOL ic, const u8 *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, const_cpu_to_le16(0), bitmap,
+ bitmap_len, WRITE_STANDARD);
+ else
+ err = insert_resident_attr_in_mft_record(m, AT_BITMAP, name,
+ name_len, ic, const_cpu_to_le16(0), 0,
+ bitmap, bitmap_len);
+
+ if (err < 0)
+ ntfs_log_error("add_attr_bitmap failed: %s\n", strerror(-err));
+ 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.
+ *
+ * Return 0 on success or -errno on error.
+ */
+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 u8 *bitmap, const u32 bitmap_len)
+{
+ int err;
+
+ err = insert_positioned_attr_in_mft_record(m, AT_BITMAP, name, name_len,
+ ic, const_cpu_to_le16(0), rl, bitmap, bitmap_len);
+ if (err < 0)
+ ntfs_log_error("add_attr_bitmap_positioned failed: %s\n",
+ strerror(-err));
+ 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.
+ *
+ * Return 0 on success or -errno on error.
+ */
+static int upgrade_to_large_index(MFT_RECORD *m, const char *name,
+ u32 name_len, const IGNORE_CASE_BOOL ic,
+ INDEX_ALLOCATION **idx)
+{
+ ntfs_attr_search_ctx *ctx;
+ ATTR_RECORD *a;
+ INDEX_ROOT *r;
+ INDEX_ENTRY *re;
+ INDEX_ALLOCATION *ia_val = NULL;
+ ntfschar *uname = NULL;
+ int uname_len = 0;
+ u8 bmp[8];
+ char *re_start, *re_end;
+ int i, err, index_block_size;
+
+ uname = ntfs_str2ucs(name, &uname_len);
+ if (!uname)
+ return -errno;
+
+ /* 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");
+ ntfs_ucsfree(uname);
+ return -ENOMEM;
+ }
+ if (ic == IGNORE_CASE) {
+ ntfs_log_error("FIXME: Hit unimplemented code path #4.\n");
+ err = -EOPNOTSUPP;
+ ntfs_ucsfree(uname);
+ goto err_out;
+ }
+ err = mkntfs_attr_lookup(AT_INDEX_ROOT, uname, uname_len, ic, 0, NULL, 0,
+ ctx);
+ ntfs_ucsfree(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_bit_set(bmp, 0ULL, 1);
+ /* Bitmap has to be at least 8 bytes in size. */
+ err = add_attr_bitmap(m, name, name_len, ic, bmp, sizeof(bmp));
+ if (err)
+ goto err_out;
+ ia_val = ntfs_calloc(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_BLOCK_SIZE) {
+ ia_val->usa_count = cpu_to_le16(index_block_size /
+ NTFS_BLOCK_SIZE + 1);
+ } else {
+ ia_val->usa_count = cpu_to_le16(1);
+ 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. */
+ *(le16*)((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.ih_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->ie_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.ih_flags = LARGE_INDEX;
+ re->ie_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. */
+ 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. */
+ err = -errno;
+ goto err_out;
+ }
+ /* Set VCN pointer to 0LL. */
+ *(leVCN*)((char*)re + cpu_to_le16(re->length) - sizeof(VCN)) =
+ cpu_to_le64(0);
+ err = ntfs_mst_pre_write_fixup((NTFS_RECORD*)ia_val, index_block_size);
+ if (err) {
+ err = -errno;
+ ntfs_log_error("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, (u8*)ia_val,
+ 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. */
+ goto err_out;
+ }
+ *idx = ia_val;
+ ntfs_attr_put_search_ctx(ctx);
+ return 0;
+err_out:
+ ntfs_attr_put_search_ctx(ctx);
+ free(ia_val);
+ return err;
+}
+
+/**
+ * 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.
+ */
+static int make_room_for_index_entry_in_index_block(INDEX_BLOCK *idx,
+ 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)) {
+ ntfs_log_error("make_room_for_index_entry_in_index_block() received "
+ "non 8-byte aligned size.\n");
+ return -EINVAL;
+ }
+ if (!idx || !pos)
+ return -EINVAL;
+ if ((char*)pos < (char*)idx || (char*)pos + size < (char*)idx ||
+ (char*)pos > (char*)idx + sizeof(INDEX_BLOCK) -
+ sizeof(INDEX_HEADER) +
+ le32_to_cpu(idx->index.allocated_size) ||
+ (char*)pos + size > (char*)idx + sizeof(INDEX_BLOCK) -
+ sizeof(INDEX_HEADER) +
+ le32_to_cpu(idx->index.allocated_size))
+ return -EINVAL;
+ /* The - sizeof(INDEX_ENTRY_HEADER) is for the index terminator. */
+ 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(idx->index.index_length);
+ /* Do we have enough space? */
+ 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*)&idx->index));
+ /* Update index block. */
+ idx->index.index_length = cpu_to_le32(biu + size);
+ return 0;
+}
+
+/**
+ * ntfs_index_keys_compare
+ *
+ * not all types of COLLATION_RULES supported yet...
+ * added as needed.. (remove this comment when all are added)
+ */
+static int ntfs_index_keys_compare(u8 *key1, u8 *key2, int key1_length,
+ int key2_length, COLLATION_RULES collation_rule)
+{
+ u32 u1, u2;
+ int i;
+
+ if (collation_rule == COLLATION_NTOFS_ULONG) {
+ /* i.e. $SII or $QUOTA-$Q */
+ u1 = le32_to_cpup((const le32*)key1);
+ u2 = le32_to_cpup((const le32*)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 */
+ i = 0;
+ while (i < min(key1_length, key2_length)) {
+ u1 = le32_to_cpup((const le32*)(key1 + i));
+ u2 = le32_to_cpup((const le32*)(key2 + i));
+ if (u1 < u2)
+ return -1;
+ if (u1 > u2)
+ return 1;
+ /* u1 == u2 */
+ i += sizeof(u32);
+ }
+ 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 */
+ 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) {
+ 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");
+ return 0; /* Claim they're equal. What else can we do? */
+}
+
+/**
+ * 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 (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");
+ err = -ENOMEM;
+ goto err_out;
+ }
+ if (mkntfs_attr_lookup(AT_INDEX_ROOT, name, name_size,
+ CASE_SENSITIVE, 0, NULL, 0, ctx)) {
+ err = -EEXIST;
+ goto err_out;
+ }
+ /* found attribute */
+ a = (ATTR_RECORD*)ctx->attr;
+ 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 (((u8*)idx_entry < (u8*)idx_end) &&
+ !(idx_entry->ie_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);
+ */
+ i = ntfs_names_full_collate(idx->key.file_name.file_name, idx->key.file_name.file_name_length,
+ idx_entry->key.file_name.file_name, idx_entry->key.file_name.file_name_length,
+ IGNORE_CASE, g_vol->upcase,
+ g_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 (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);
+ */
+ i = ntfs_names_full_collate(idx->key.file_name.file_name, idx->key.file_name.file_name_length,
+ idx_entry->key.file_name.file_name, idx_entry->key.file_name.file_name_length,
+ CASE_SENSITIVE, g_vol->upcase,
+ g_vol->upcase_len);
+ if (!i)
+ return -EEXIST;
+ if (i == -1)
+ break;
+do_next:
+ idx_entry = (INDEX_ENTRY*)((u8*)idx_entry +
+ le16_to_cpu(idx_entry->length));
+ }
+ } else if (type == AT_UNUSED) { /* case view */
+ while (((u8*)idx_entry < (u8*)idx_end) &&
+ !(idx_entry->ie_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)
+ break;
+ idx_entry = (INDEX_ENTRY*)((u8*)idx_entry +
+ le16_to_cpu(idx_entry->length));
+ }
+ } else
+ return -EINVAL;
+ 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);
+ return err;
+}
+
+/**
+ * initialize_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 = 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 = ntfs_calloc(sizeof(INDEX_ENTRY));
+ if (!idx_entry_sdh)
+ return -errno;
+ idx_entry_sii = ntfs_calloc(sizeof(INDEX_ENTRY));
+ if (!idx_entry_sii) {
+ free(idx_entry_sdh);
+ return -errno;
+ }
+ err = 0;
+
+ while ((char*)sds_header < (char*)sds + sds_size) {
+ if (!sds_header->length)
+ break;
+ /* SDH index entry */
+ 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->ie_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*)((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 = const_cpu_to_le32(0x00490049);
+
+ /* SII index entry */
+ 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->ie_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*)((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)))
+ break;
+ if ((err = insert_index_entry_in_res_dir_index(idx_entry_sii,
+ sii_size, m, NTFS_INDEX_SII, 4, AT_UNUSED)))
+ break;
+ 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;
+}
+
+/**
+ * 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, i;
+ 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;
+ /* q index entry num 1 */
+ q1_size = 0x48;
+ idx_entry_q1 = ntfs_calloc(q1_size);
+ if (!idx_entry_q1)
+ return errno;
+ 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->ie_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
+ + 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;
+ idx_entry_q1_data->bytes_used = const_cpu_to_le64(0x00);
+ idx_entry_q1_data->change_time = mkntfs_time();
+ idx_entry_q1_data->threshold = cpu_to_sle64(-1);
+ idx_entry_q1_data->limit = cpu_to_sle64(-1);
+ idx_entry_q1_data->exceeded_time = const_cpu_to_le64(0);
+ 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 = 0x58;
+ idx_entry_q2 = ntfs_calloc(q2_size);
+ if (!idx_entry_q2)
+ return errno;
+ 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->ie_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
+ + 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 = const_cpu_to_le64(0x00);
+ idx_entry_q2_data->change_time = mkntfs_time();
+ idx_entry_q2_data->threshold = cpu_to_sle64(-1);
+ idx_entry_q2_data->limit = cpu_to_sle64(-1);
+ idx_entry_q2_data->exceeded_time = const_cpu_to_le64(0);
+ idx_entry_q2_data->sid.revision = 1;
+ idx_entry_q2_data->sid.sub_authority_count = 2;
+ for (i = 0; i < 5; i++)
+ idx_entry_q2_data->sid.identifier_authority.value[i] = 0;
+ idx_entry_q2_data->sid.identifier_authority.value[5] = 0x05;
+ idx_entry_q2_data->sid.sub_authority[0] =
+ const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID);
+ idx_entry_q2_data->sid.sub_authority[1] =
+ 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 = 0x28;
+ idx_entry_o = ntfs_calloc(o_size);
+ if (!idx_entry_o)
+ return errno;
+ 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->ie_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;
+ for (i = 0; i < 5; i++)
+ idx_entry_o->key.sid.identifier_authority.value[i] = 0;
+ idx_entry_o->key.sid.identifier_authority.value[5] = 0x05;
+ idx_entry_o->key.sid.sub_authority[0] =
+ const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID);
+ idx_entry_o->key.sid.sub_authority[1] =
+ const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS);
+ idx_entry_o_data = (QUOTA_O_INDEX_DATA*)((char*)idx_entry_o
+ + 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 = 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;
+}
+
+/**
+ * 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).
+ *
+ * Return 0 on success or -errno on error.
+ */
+static int insert_file_link_in_dir_index(INDEX_BLOCK *idx, leMFT_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 @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*)&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.
+ */
+ while ((char*)ie < index_end && !(ie->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 = 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);
+ free(__buf);
+ }
+ 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 = 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);
+ free(__buf);
+ }
+#endif
+#endif
+ /*
+ i = ntfs_file_values_compare(file_name,
+ (FILE_NAME_ATTR*)&ie->key.file_name, 1,
+ IGNORE_CASE, g_vol->upcase, g_vol->upcase_len);
+ */
+ i = ntfs_names_full_collate(file_name->file_name, file_name->file_name_length,
+ ((FILE_NAME_ATTR*)&ie->key.file_name)->file_name, ((FILE_NAME_ATTR*)&ie->key.file_name)->file_name_length,
+ IGNORE_CASE, g_vol->upcase, g_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_values_compare(file_name,
+ (FILE_NAME_ATTR*)&ie->key.file_name, 1,
+ CASE_SENSITIVE, g_vol->upcase,
+ g_vol->upcase_len);
+ */
+ i = ntfs_names_full_collate(file_name->file_name, file_name->file_name_length,
+ ((FILE_NAME_ATTR*)&ie->key.file_name)->file_name, ((FILE_NAME_ATTR*)&ie->key.file_name)->file_name_length,
+ CASE_SENSITIVE, g_vol->upcase, g_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) {
+ ntfs_log_debug("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(idx, ie, i);
+ if (err) {
+ ntfs_log_error("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->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_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 leMFT_REF ref_parent,
+ MFT_RECORD *m_file, const leMFT_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;
+ ntfschar *uname;
+
+ /* Create the file_name attribute. */
+ i = (strlen(file_name) + 1) * sizeof(ntfschar);
+ fn_size = sizeof(FILE_NAME_ATTR) + i;
+ fn = ntfs_malloc(fn_size);
+ if (!fn)
+ return -errno;
+ fn->parent_directory = ref_parent;
+ fn->creation_time = stdinfo_time(m_file);
+ 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_sle64(allocated_size);
+ fn->data_size = cpu_to_sle64(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;
+ uname = fn->file_name;
+ i = ntfs_mbstoucs_libntfscompat(file_name, &uname, 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) {
+ ntfs_log_error("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,
+ CASE_SENSITIVE, const_cpu_to_le16(0),
+ RESIDENT_ATTR_IS_INDEXED, (u8*)fn, fn_size);
+ if (i < 0) {
+ ntfs_log_error("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. */
+ idx_size = (fn_size + 7) & ~7;
+ idx_entry_new = ntfs_calloc(idx_size + 0x10);
+ if (!idx_entry_new)
+ return -errno;
+ idx_entry_new->indexed_file = ref_file;
+ 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);
+ if (i < 0) {
+ 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;
+}
+
+/**
+ * create_hardlink
+ *
+ * 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 @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 *idx, const leMFT_REF ref_parent,
+ MFT_RECORD *m_file, const leMFT_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;
+ ntfschar *uname;
+
+ /* Create the file_name attribute. */
+ i = (strlen(file_name) + 1) * sizeof(ntfschar);
+ fn_size = sizeof(FILE_NAME_ATTR) + i;
+ fn = ntfs_malloc(fn_size);
+ if (!fn)
+ return -errno;
+ fn->parent_directory = ref_parent;
+ fn->creation_time = stdinfo_time(m_file);
+ fn->last_data_change_time = fn->creation_time;
+ fn->last_mft_change_time = fn->creation_time;
+ fn->last_access_time = fn->creation_time;
+ /* allocated size depends on unnamed data being resident */
+ if (allocated_size && non_resident_unnamed_data(m_file))
+ fn->allocated_size = cpu_to_sle64(allocated_size);
+ else
+ fn->allocated_size = cpu_to_sle64((data_size + 7) & -8);
+ fn->data_size = cpu_to_sle64(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;
+ uname = fn->file_name;
+ i = ntfs_mbstoucs_libntfscompat(file_name, &uname, 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) {
+ ntfs_log_error("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,
+ CASE_SENSITIVE, cpu_to_le16(0),
+ RESIDENT_ATTR_IS_INDEXED, (u8*)fn, fn_size);
+ if (i < 0) {
+ ntfs_log_error("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. */
+ i = insert_file_link_in_dir_index(idx, ref_file, fn, fn_size);
+ if (i < 0) {
+ ntfs_log_error("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;
+}
+
+/**
+ * index_obj_id_insert
+ *
+ * Insert an index entry with the key @guid and data pointing to the mft record
+ * @ref in the $O index root of the mft record @m (which must be the mft record
+ * for $ObjId).
+ *
+ * Return 0 on success or -errno on error.
+ */
+static int index_obj_id_insert(MFT_RECORD *m, const GUID *guid,
+ const leMFT_REF ref)
+{
+ INDEX_ENTRY *idx_entry_new;
+ int data_ofs, idx_size, err;
+ OBJ_ID_INDEX_DATA *oi;
+
+ /*
+ * Insert the index entry for the object id in the index.
+ *
+ * First determine the size of the index entry to be inserted. This
+ * consists of the index entry header, followed by the index key, i.e.
+ * the GUID, followed by the index data, i.e. OBJ_ID_INDEX_DATA.
+ */
+ data_ofs = (sizeof(INDEX_ENTRY_HEADER) + sizeof(GUID) + 7) & ~7;
+ idx_size = (data_ofs + sizeof(OBJ_ID_INDEX_DATA) + 7) & ~7;
+ idx_entry_new = ntfs_calloc(idx_size);
+ if (!idx_entry_new)
+ return -errno;
+ idx_entry_new->data_offset = cpu_to_le16(data_ofs);
+ idx_entry_new->data_length = cpu_to_le16(sizeof(OBJ_ID_INDEX_DATA));
+ idx_entry_new->length = cpu_to_le16(idx_size);
+ idx_entry_new->key_length = cpu_to_le16(sizeof(GUID));
+ idx_entry_new->key.object_id = *guid;
+ oi = (OBJ_ID_INDEX_DATA*)((u8*)idx_entry_new + data_ofs);
+ oi->mft_reference = ref;
+ err = insert_index_entry_in_res_dir_index(idx_entry_new, idx_size, m,
+ NTFS_INDEX_O, 2, AT_UNUSED);
+ free(idx_entry_new);
+ if (err < 0) {
+ ntfs_log_error("index_obj_id_insert failed inserting index "
+ "entry: %s\n", strerror(-err));
+ return err;
+ }
+ return 0;
+}
+
+/**
+ * mkntfs_cleanup
+ */
+static void mkntfs_cleanup(void)
+{
+ struct BITMAP_ALLOCATION *p, *q;
+
+ /* 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->vol_name);
+ free(g_vol->attrdef);
+ 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_index_block); g_index_block = NULL;
+ free(g_dynamic_buf); g_dynamic_buf = 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_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;
+
+ p = g_allocation;
+ while (p) {
+ q = p->next;
+ free(p);
+ p = q;
+ }
+}
+
+
+/**
+ * mkntfs_open_partition -
+ */
+static BOOL mkntfs_open_partition(ntfs_volume *vol)
+{
+ BOOL result = FALSE;
+ int i;
+ struct stat sbuf;
+ unsigned long mnt_flags;
+
+ /*
+ * Allocate and initialize an ntfs device structure and attach it to
+ * the volume.
+ */
+ 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;
+ }
+
+ /* Open the device for reading or reading and writing. */
+ if (opts.no_action) {
+ ntfs_log_quiet("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)
+ ntfs_log_error("The device doesn't exist; did you specify it correctly?\n");
+ else
+ ntfs_log_perror("Could not open %s", vol->dev->d_name);
+ goto done;
+ }
+ /* Verify we are dealing with a block device. */
+ 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", vol->dev->d_name);
+ 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;
+ else
+ opts.num_sectors = ((s64)sbuf.st_blocks << 9) / opts.sector_size;
+ } else {
+ if (sbuf.st_size)
+ opts.num_sectors = sbuf.st_size / 512;
+ else
+ opts.num_sectors = sbuf.st_blocks;
+ opts.sector_size = 512;
+ }
+ }
+ 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", 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(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", 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 = TRUE;
+done:
+ return result;
+}
+
+/**
+ * mkntfs_get_page_size - detect the system's memory page size.
+ */
+static long mkntfs_get_page_size(void)
+{
+ long page_size;
+#ifdef _SC_PAGESIZE
+ page_size = sysconf(_SC_PAGESIZE);
+ if (page_size < 0)
+#endif
+ {
+ ntfs_log_warning("Failed to determine system page size. "
+ "Assuming safe default of 4096 bytes.\n");
+ return 4096;
+ }
+ ntfs_log_debug("System page size is %li bytes.\n", page_size);
+ return page_size;
+}
+
+/**
+ * mkntfs_override_vol_params -
+ */
+static BOOL mkntfs_override_vol_params(ntfs_volume *vol)
+{
+ s64 volume_size;
+ long page_size;
+ int i;
+ BOOL winboot = TRUE;
+
+ /* If user didn't specify the sector size, determine it now. */
+ if (opts.sector_size < 0) {
+ 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) {
+ 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 "
+ "is 256 bytes and the maximum is 4096 bytes.\n");
+ 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);
+ 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);
+ /*
+ * 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 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(
+ 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 "
+ "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_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) {
+ 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(
+ 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 "
+ "obtained automatically. It has been set to "
+ "0.\n", vol->dev->d_name);
+ opts.sectors_per_track = 0;
+ 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 > 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) {
+ opts.heads = ntfs_device_heads_get(vol->dev);
+ if (opts.heads < 0) {
+ 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;
+ 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 > 65535) {
+ 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",
+ (long long)(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) {
+ /*
+ * Windows Vista always uses 4096 bytes as the default cluster
+ * size regardless of the volume size so we do it, too.
+ */
+ 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;
+ /*
+ * 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 (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 %u "
+ "bytes.\n", (unsigned)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");
+ 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) {
+ 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_warning("Windows cannot use compression when the "
+ "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)) {
+ /* 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;
+ }
+ page_size = mkntfs_get_page_size();
+ /*
+ * 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 < (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 "
+ "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 < (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 "
+ "page size (%li bytes). You will not be able "
+ "to mount this volume using the NTFS kernel "
+ "driver.\n", (unsigned)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");
+ ntfs_log_warning("Windows will not be able to boot from this "
+ "device.\n");
+ }
+ return TRUE;
+}
+
+/**
+ * mkntfs_initialize_bitmaps -
+ */
+static BOOL mkntfs_initialize_bitmaps(void)
+{
+ 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;
+ /* 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) &
+ ~(g_vol->cluster_size - 1);
+ ntfs_log_debug("g_lcn_bitmap_byte_size = %i, allocated = %llu\n",
+ g_lcn_bitmap_byte_size, i);
+ g_dynamic_buf_size = mkntfs_get_page_size();
+ g_dynamic_buf = (u8*)ntfs_calloc(g_dynamic_buf_size);
+ if (!g_dynamic_buf)
+ 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.
+ */
+ if (!bitmap_allocate(g_vol->nr_clusters,
+ ((s64)g_lcn_bitmap_byte_size << 3) - g_vol->nr_clusters))
+ return (FALSE);
+ /*
+ * Mft size is 27 (NTFS 3.0+) mft records or one cluster, whichever is
+ * bigger.
+ */
+ g_mft_size = 27;
+ g_mft_size *= 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. */
+ mft_bitmap_size = g_mft_size / g_vol->mft_record_size;
+ /* Convert to bytes, at least one. */
+ 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("mft_bitmap_size = %i, g_mft_bitmap_byte_size = %i\n",
+ mft_bitmap_size, g_mft_bitmap_byte_size);
+ g_mft_bitmap = ntfs_calloc(g_mft_bitmap_byte_size);
+ if (!g_mft_bitmap)
+ return FALSE;
+ /* Create runlist for mft bitmap. */
+ g_rl_mft_bmp = ntfs_malloc(2 * sizeof(runlist));
+ if (!g_rl_mft_bmp)
+ 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;
+ 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.
+ */
+ 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. */
+ return (bitmap_allocate(i,1));
+}
+
+/**
+ * mkntfs_initialize_rl_mft -
+ */
+static BOOL mkntfs_initialize_rl_mft(void)
+{
+ int j;
+ BOOL done;
+
+ /* If user didn't specify the mft lcn, determine it now. */
+ if (!g_mft_lcn) {
+ /*
+ * We start at the higher value out of 16kiB and just after the
+ * mft bitmap.
+ */
+ 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", g_mft_lcn);
+ /* Determine MFT zone size. */
+ 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% */
+ break;
+ case 3:
+ 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% */
+ break;
+ case 1:
+ default:
+ g_mft_zone_end = g_mft_zone_end >> 3; /* 12.5% */
+ break;
+ }
+ 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.
+ */
+ g_mft_zone_end += g_mft_lcn;
+ /* Create runlist for mft. */
+ g_rl_mft = ntfs_malloc(2 * sizeof(runlist));
+ if (!g_rl_mft)
+ return FALSE;
+
+ g_rl_mft[0].vcn = 0LL;
+ 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 = j;
+ g_rl_mft[0].length = j;
+ g_rl_mft[1].lcn = -1LL;
+ g_rl_mft[1].length = 0LL;
+ /* Allocate clusters for mft. */
+ bitmap_allocate(g_mft_lcn,j);
+ /* Determine mftmirr_lcn (middle of volume). */
+ g_mftmirr_lcn = (opts.num_sectors * opts.sector_size >> 1)
+ / g_vol->cluster_size;
+ ntfs_log_debug("$MFTMirr logical cluster number = 0x%llx\n",
+ g_mftmirr_lcn);
+ /* Create runlist for mft mirror. */
+ g_rl_mftmirr = ntfs_malloc(2 * sizeof(runlist));
+ if (!g_rl_mftmirr)
+ return FALSE;
+
+ 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
+ * byte-for-byte identical copy of the beginning of the mft (i.e. either
+ * the first four records (4kb) or the first cluster worth of records,
+ * whichever is bigger).
+ */
+ j = (4 * g_vol->mft_record_size + g_vol->cluster_size - 1) / g_vol->cluster_size;
+ 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. */
+ done = bitmap_allocate(g_mftmirr_lcn,j);
+ g_logfile_lcn = g_mftmirr_lcn + j;
+ ntfs_log_debug("$LogFile logical cluster number = 0x%llx\n",
+ g_logfile_lcn);
+ return (done);
+}
+
+/**
+ * mkntfs_initialize_rl_logfile -
+ */
+static BOOL mkntfs_initialize_rl_logfile(void)
+{
+ int j;
+ u64 volume_size;
+
+ /* Create runlist for log file. */
+ g_rl_logfile = ntfs_malloc(2 * sizeof(runlist));
+ if (!g_rl_logfile)
+ return FALSE;
+
+
+ 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 (volume_size < 2048LL * 1024) /* < 2MiB */
+ g_logfile_size = 256LL * 1024; /* -> 256kiB */
+ else if (volume_size < 4000000LL) /* < 4MB */
+ g_logfile_size = 512LL * 1024; /* -> 512kiB */
+ else if (volume_size <= 200LL * 1024 * 1024) /* < 200MiB */
+ g_logfile_size = 2048LL * 1024; /* -> 2MiB */
+ else {
+ /*
+ * FIXME: The $LogFile size is 64 MiB upwards from 12GiB but
+ * the "200" divider below apparently approximates "100" or
+ * some other value 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) {
+ /*
+ * $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.
+ */
+ g_logfile_size >>= 1;
+ j = g_logfile_size / g_vol->cluster_size;
+ }
+ g_logfile_size = (g_logfile_size + g_vol->cluster_size - 1) &
+ ~(g_vol->cluster_size - 1);
+ ntfs_log_debug("$LogFile (journal) size = %ikiB\n",
+ 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 (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;
+ g_rl_logfile[1].length = 0LL;
+ /* Allocate clusters for log file. */
+ return (bitmap_allocate(g_logfile_lcn,j));
+}
+
+/**
+ * mkntfs_initialize_rl_boot -
+ */
+static BOOL mkntfs_initialize_rl_boot(void)
+{
+ int j;
+ /* Create runlist for $Boot. */
+ g_rl_boot = ntfs_malloc(2 * sizeof(runlist));
+ if (!g_rl_boot)
+ return FALSE;
+
+ 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 + g_vol->cluster_size - 1) / g_vol->cluster_size;
+ 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. */
+ return (bitmap_allocate(0,j));
+}
+
+/**
+ * mkntfs_initialize_rl_bad -
+ */
+static BOOL mkntfs_initialize_rl_bad(void)
+{
+ /* Create runlist for $BadClus, $DATA named stream $Bad. */
+ g_rl_bad = ntfs_malloc(2 * sizeof(runlist));
+ if (!g_rl_bad)
+ return FALSE;
+
+ 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.
+ */
+ 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;
+
+ /* TODO: Mark bad blocks as such. */
+ return TRUE;
+}
+
+/**
+ * mkntfs_fill_device_with_zeroes -
+ */
+static BOOL mkntfs_fill_device_with_zeroes(void)
+{
+ /*
+ * If not quick format, fill the device with 0s.
+ * FIXME: Except bad blocks! (AIA)
+ */
+ int i;
+ ssize_t bw;
+ unsigned long long position;
+ 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("Initializing device with zeroes: 0%%");
+ for (position = 0; position < (unsigned long long)g_vol->nr_clusters;
+ position++) {
+ if (!(position % (int)(progress_inc+1))) {
+ ntfs_log_progress("\b\b\b\b%3.0f%%", position /
+ progress_inc);
+ }
+ 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) {
+ 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;
+ }
+ /* Add the baddie to our bad blocks list. */
+ if (!append_to_bad_blocks(position))
+ return FALSE;
+ ntfs_log_quiet("\nFound bad cluster (%lld). Adding to "
+ "list of bad blocks.\nInitializing "
+ "device with zeroes: %3.0f%%", position,
+ position / progress_inc);
+ /* Seek to next cluster. */
+ g_vol->dev->d_ops->seek(g_vol->dev,
+ ((off_t)position + 1) *
+ g_vol->cluster_size, SEEK_SET);
+ }
+ }
+ ntfs_log_progress("\b\b\b\b100%%");
+ 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);
+ if (bw != opts.sector_size) {
+ if (bw != -1 || errno != EIO) {
+ ntfs_log_error("This should not happen.\n");
+ return FALSE;
+ } else if (i + 1ull == position) {
+ 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;
+}
+
+/**
+ * mkntfs_sync_index_record
+ *
+ * (ERSO) made a function out of this, but the reason for doing that
+ * disappeared during coding....
+ */
+static BOOL 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;
+ runlist *rl_index = NULL;
+
+ i = 5 * sizeof(ntfschar);
+ ctx = ntfs_attr_get_search_ctx(NULL, m);
+ 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,
+ CASE_SENSITIVE, 0, NULL, 0, ctx)) {
+ ntfs_attr_put_search_ctx(ctx);
+ 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);
+ 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);
+ 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) +
+ le32_to_cpu(idx->index.allocated_size);
+ err = ntfs_mst_pre_write_fixup((NTFS_RECORD*)idx, i);
+ if (err) {
+ free(rl_index);
+ 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,
+ WRITE_STANDARD);
+ free(rl_index);
+ 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 BOOL create_file_volume(MFT_RECORD *m, leMFT_REF root_ref,
+ VOLUME_FLAGS fl, const GUID *volume_guid)
+{
+ int i, err;
+ u8 *sd;
+
+ ntfs_log_verbose("Creating $Volume (mft record 3)\n");
+ 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);
+ 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, CASE_SENSITIVE,
+ const_cpu_to_le16(0), NULL, 0);
+ if (!err)
+ 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, g_vol->major_ver,
+ g_vol->minor_ver);
+ }
+ if (!err && opts.with_uuid)
+ err = add_attr_object_id(m, volume_guid);
+ if (err < 0) {
+ ntfs_log_error("Couldn't create $Volume: %s\n",
+ strerror(-err));
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/**
+ * create_backup_boot_sector
+ *
+ * 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;
+
+ 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
+ * is how big $Boot is (and how big our buffer is)..
+ */
+ size = 512;
+ 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) {
+ ntfs_log_perror("Seek failed");
+ goto bb_err;
+ }
+ if (size > 8192)
+ size = 8192;
+ bw = mkntfs_write(g_vol->dev, buff, size);
+ if (bw == size)
+ return 0;
+ e = errno;
+ if (bw == -1LL)
+ s = strerror(e);
+ else
+ s = "unknown error";
+ /* 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\n"
+ "backup boot sector when it is run on your next boot "
+ "into Windows.\n");
+ return -1;
+}
+
+/**
+ * mkntfs_create_root_structures -
+ */
+static BOOL mkntfs_create_root_structures(void)
+{
+ NTFS_BOOT_SECTOR *bs;
+ MFT_RECORD *m;
+ leMFT_REF root_ref;
+ leMFT_REF extend_ref;
+ int i;
+ int j;
+ int err;
+ u8 *sd;
+ FILE_ATTR_FLAGS extend_flags;
+ VOLUME_FLAGS volume_flags = const_cpu_to_le16(0);
+ int nr_sysfiles;
+ int buf_sds_first_size;
+ char *buf_sds;
+ GUID vol_guid;
+
+ ntfs_log_quiet("Creating NTFS volume structures.\n");
+ nr_sysfiles = 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
+ * reference is ignored by ntfs_mft_record_layout().
+ *
+ * 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 = 0; i < nr_sysfiles; i++) {
+ if (ntfs_mft_record_layout(g_vol, 0, m = (MFT_RECORD *)(g_buf +
+ i * g_vol->mft_record_size))) {
+ ntfs_log_error("Failed to layout system mft records."
+ "\n");
+ return FALSE;
+ }
+ 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
+ * 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)) {
+ ntfs_log_error("Failed to layout mft record."
+ "\n");
+ return FALSE;
+ }
+ 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 < nr_sysfiles; i++) {
+ le32 file_attrs;
+
+ m = (MFT_RECORD*)(g_buf + i * g_vol->mft_record_size);
+ if (i < 16 || i > 23) {
+ m->mft_record_number = cpu_to_le32(i);
+ m->flags |= MFT_RECORD_IN_USE;
+ ntfs_bit_set(g_mft_bitmap, 0LL + i, 1);
+ }
+ 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)
+ file_attrs |= FILE_ATTR_COMPRESSED;
+ }
+ /* setting specific security_id flag and */
+ /* 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,
+ cpu_to_le32(0x0100));
+ } else if (i == 9) {
+ file_attrs |= FILE_ATTR_VIEW_INDEX_PRESENT;
+ 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_ARCHIVE;
+ file_attrs |= FILE_ATTR_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));
+ }
+ }
+ /* The root directory mft reference. */
+ 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*)(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,
+ FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM |
+ FILE_ATTR_I30_INDEX_PRESENT, 0, 0, ".",
+ FILE_NAME_WIN32_AND_DOS);
+ if (!err) {
+ init_root_sd(&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, CASE_SENSITIVE,
+ AT_FILE_NAME, COLLATION_FILE_NAME,
+ g_vol->indx_record_size);
+ /* FIXME: This should be IGNORE_CASE */
+ if (!err)
+ err = upgrade_to_large_index(m, "$I30", 4, CASE_SENSITIVE,
+ &g_index_block);
+ if (!err) {
+ ntfs_attr_search_ctx *ctx;
+ ATTR_RECORD *a;
+ ctx = ntfs_attr_get_search_ctx(NULL, m);
+ 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,
+ CASE_SENSITIVE, 0, NULL, 0, ctx)) {
+ ntfs_attr_put_search_ctx(ctx);
+ 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,
+ (FILE_NAME_ATTR*)((char*)a +
+ le16_to_cpu(a->value_offset)),
+ le32_to_cpu(a->value_length));
+ ntfs_attr_put_search_ctx(ctx);
+ }
+ if (err) {
+ ntfs_log_error("Couldn't create root directory: %s\n",
+ strerror(-err));
+ return FALSE;
+ }
+ /* Add all other attributes, on a per-file basis for clarity. */
+ ntfs_log_verbose("Creating $MFT (mft record 0)\n");
+ m = (MFT_RECORD*)g_buf;
+ err = add_attr_data_positioned(m, NULL, 0, CASE_SENSITIVE,
+ const_cpu_to_le16(0), g_rl_mft, g_buf, g_mft_size);
+ if (!err)
+ err = create_hardlink(g_index_block, root_ref, m,
+ MK_LE_MREF(FILE_MFT, 1),
+ ((g_mft_size - 1)
+ | (g_vol->cluster_size - 1)) + 1,
+ g_mft_size, FILE_ATTR_HIDDEN |
+ FILE_ATTR_SYSTEM, 0, 0, "$MFT",
+ FILE_NAME_WIN32_AND_DOS);
+ /* mft_bitmap is not modified in mkntfs; no need to sync it later. */
+ if (!err)
+ err = add_attr_bitmap_positioned(m, NULL, 0, CASE_SENSITIVE,
+ g_rl_mft_bmp,
+ g_mft_bitmap, g_mft_bitmap_byte_size);
+ if (err < 0) {
+ ntfs_log_error("Couldn't create $MFT: %s\n", strerror(-err));
+ return FALSE;
+ }
+ 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, CASE_SENSITIVE,
+ const_cpu_to_le16(0), g_rl_mftmirr, g_buf,
+ g_rl_mftmirr[0].length * g_vol->cluster_size);
+ if (!err)
+ err = create_hardlink(g_index_block, root_ref, m,
+ MK_LE_MREF(FILE_MFTMirr, FILE_MFTMirr),
+ 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 < 0) {
+ ntfs_log_error("Couldn't create $MFTMirr: %s\n",
+ strerror(-err));
+ return FALSE;
+ }
+ ntfs_log_verbose("Creating $LogFile (mft record 2)\n");
+ m = (MFT_RECORD*)(g_buf + 2 * g_vol->mft_record_size);
+ err = add_attr_data_positioned(m, NULL, 0, CASE_SENSITIVE,
+ const_cpu_to_le16(0), g_rl_logfile,
+ (const u8*)NULL, g_logfile_size);
+ if (!err)
+ err = create_hardlink(g_index_block, root_ref, m,
+ MK_LE_MREF(FILE_LogFile, FILE_LogFile),
+ g_logfile_size, g_logfile_size,
+ FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM, 0, 0,
+ "$LogFile", FILE_NAME_WIN32_AND_DOS);
+ if (err < 0) {
+ ntfs_log_error("Couldn't create $LogFile: %s\n",
+ strerror(-err));
+ return FALSE;
+ }
+ ntfs_log_verbose("Creating $AttrDef (mft record 4)\n");
+ m = (MFT_RECORD*)(g_buf + 4 * g_vol->mft_record_size);
+ err = add_attr_data(m, NULL, 0, CASE_SENSITIVE, const_cpu_to_le16(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),
+ (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);
+ if (!err) {
+ init_system_file_sd(FILE_AttrDef, &sd, &i);
+ err = add_attr_sd(m, sd, i);
+ }
+ if (err < 0) {
+ ntfs_log_error("Couldn't create $AttrDef: %s\n",
+ strerror(-err));
+ return FALSE;
+ }
+ ntfs_log_verbose("Creating $Bitmap (mft record 6)\n");
+ 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, CASE_SENSITIVE,
+ const_cpu_to_le16(0), (const u8*)NULL,
+ g_lcn_bitmap_byte_size, WRITE_BITMAP);
+
+
+ if (!err)
+ err = create_hardlink(g_index_block, root_ref, m,
+ MK_LE_MREF(FILE_Bitmap, FILE_Bitmap),
+ (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 < 0) {
+ ntfs_log_error("Couldn't create $Bitmap: %s\n", strerror(-err));
+ return FALSE;
+ }
+ ntfs_log_verbose("Creating $Boot (mft record 7)\n");
+ m = (MFT_RECORD*)(g_buf + 7 * g_vol->mft_record_size);
+ bs = ntfs_calloc(8192);
+ if (!bs)
+ return FALSE;
+ memcpy(bs, boot_array, sizeof(boot_array));
+ /*
+ * 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->bpb.bytes_per_sector = cpu_to_le16(opts.sector_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 = %ld (0x%lx)\n",
+ opts.sectors_per_track, opts.sectors_per_track);
+ bs->bpb.heads = cpu_to_le16(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);
+ bs->physical_drive = 0x80; /* boot from hard disk */
+ bs->extended_boot_signature = 0x80; /* everybody sets this, so we do */
+ bs->number_of_sectors = cpu_to_sle64(opts.num_sectors);
+ 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(g_vol->mft_record_size) -
+ 1);
+ if ((u32)(1 << -bs->clusters_per_mft_record) !=
+ g_vol->mft_record_size) {
+ free(bs);
+ 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",
+ bs->clusters_per_mft_record,
+ bs->clusters_per_mft_record);
+ 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 = -g_vol->indx_record_size_bits;
+ if ((1 << -bs->clusters_per_index_record) !=
+ (s32)g_vol->indx_record_size) {
+ free(bs);
+ 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",
+ bs->clusters_per_index_record,
+ bs->clusters_per_index_record);
+ /* Generate a 64-bit random number for the serial number. */
+ bs->volume_serial_number = cpu_to_le64(((u64)random() << 32) |
+ ((u64)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 (!ntfs_boot_sector_is_ntfs(bs)) {
+ free(bs);
+ ntfs_log_error("FATAL: Generated boot sector is invalid!\n");
+ return FALSE;
+ }
+ err = add_attr_data_positioned(m, NULL, 0, CASE_SENSITIVE,
+ const_cpu_to_le16(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),
+ (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) {
+ init_system_file_sd(FILE_Boot, &sd, &i);
+ err = add_attr_sd(m, sd, i);
+ }
+ if (err < 0) {
+ free(bs);
+ 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 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);
+ /*
+ * We cheat a little here and if the user has requested all times to be
+ * set to zero then we set the GUID to zero as well. This options is
+ * only used for development purposes so that should be fine.
+ */
+ if (!opts.use_epoch_time) {
+ /* Generate a GUID for the volume. */
+#ifdef ENABLE_UUID
+ uuid_generate((void*)&vol_guid);
+#else
+ ntfs_generate_guid(&vol_guid);
+#endif
+ } else
+ memset(&vol_guid, 0, sizeof(vol_guid));
+ if (!create_file_volume(m, root_ref, volume_flags, &vol_guid))
+ 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 */
+ /* Create a sparse named stream of size equal to the volume size. */
+ err = add_attr_data_positioned(m, "$Bad", 4, CASE_SENSITIVE,
+ const_cpu_to_le16(0), g_rl_bad, NULL,
+ g_vol->nr_clusters * g_vol->cluster_size);
+ if (!err) {
+ err = add_attr_data(m, NULL, 0, CASE_SENSITIVE,
+ const_cpu_to_le16(0), NULL, 0);
+ }
+ if (!err) {
+ 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 < 0) {
+ ntfs_log_error("Couldn't create $BadClus: %s\n",
+ strerror(-err));
+ return FALSE;
+ }
+ /* create $Secure (NTFS 3.0+) */
+ 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_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_VIEW_INDEX_PRESENT, 0, 0,
+ "$Secure", FILE_NAME_WIN32_AND_DOS);
+ buf_sds = NULL;
+ buf_sds_first_size = 0;
+ if (!err) {
+ int buf_sds_size;
+
+ buf_sds_first_size = 0xfc;
+ buf_sds_size = 0x40000 + buf_sds_first_size;
+ buf_sds = ntfs_calloc(buf_sds_size);
+ if (!buf_sds)
+ return FALSE;
+ init_secure_sds(buf_sds);
+ memcpy(buf_sds + 0x40000, buf_sds, buf_sds_first_size);
+ err = add_attr_data(m, "$SDS", 4, CASE_SENSITIVE,
+ const_cpu_to_le16(0), (u8*)buf_sds,
+ buf_sds_size);
+ }
+ /* FIXME: This should be IGNORE_CASE */
+ if (!err)
+ err = add_attr_index_root(m, "$SDH", 4, CASE_SENSITIVE,
+ AT_UNUSED, COLLATION_NTOFS_SECURITY_HASH,
+ g_vol->indx_record_size);
+ /* FIXME: This should be IGNORE_CASE */
+ if (!err)
+ err = add_attr_index_root(m, "$SII", 4, CASE_SENSITIVE,
+ AT_UNUSED, COLLATION_NTOFS_ULONG,
+ g_vol->indx_record_size);
+ if (!err)
+ err = initialize_secure(buf_sds, buf_sds_first_size, m);
+ free(buf_sds);
+ if (err < 0) {
+ ntfs_log_error("Couldn't create $Secure: %s\n",
+ strerror(-err));
+ return FALSE;
+ }
+ ntfs_log_verbose("Creating $UpCase (mft record 0xa)\n");
+ m = (MFT_RECORD*)(g_buf + 0xa * g_vol->mft_record_size);
+ err = add_attr_data(m, NULL, 0, CASE_SENSITIVE, const_cpu_to_le16(0),
+ (u8*)g_vol->upcase, g_vol->upcase_len << 1);
+ /*
+ * The $Info only exists since Windows 8, but it apparently
+ * does not disturb chkdsk from earlier versions.
+ */
+ if (!err)
+ err = add_attr_data(m, "$Info", 5, CASE_SENSITIVE,
+ const_cpu_to_le16(0),
+ (u8*)g_upcaseinfo, sizeof(struct UPCASEINFO));
+ if (!err)
+ err = create_hardlink(g_index_block, root_ref, m,
+ MK_LE_MREF(FILE_UpCase, FILE_UpCase),
+ ((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 < 0) {
+ ntfs_log_error("Couldn't create $UpCase: %s\n", strerror(-err));
+ return FALSE;
+ }
+ ntfs_log_verbose("Creating $Extend (mft record 11)\n");
+ /*
+ * $Extend index must be resident. Otherwise, w2k3 will regard the
+ * volume as corrupt. (ERSO)
+ */
+ m = (MFT_RECORD*)(g_buf + 11 * g_vol->mft_record_size);
+ m->flags |= MFT_RECORD_IS_DIRECTORY;
+ if (!err)
+ err = create_hardlink(g_index_block, root_ref, m,
+ MK_LE_MREF(11, 11), 0LL, 0LL,
+ FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM |
+ 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, CASE_SENSITIVE,
+ AT_FILE_NAME, COLLATION_FILE_NAME,
+ g_vol->indx_record_size);
+ if (err < 0) {
+ ntfs_log_error("Couldn't create $Extend: %s\n",
+ strerror(-err));
+ return FALSE;
+ }
+ /* NTFS 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*)(g_buf + i * g_vol->mft_record_size);
+ err = add_attr_data(m, NULL, 0, CASE_SENSITIVE,
+ const_cpu_to_le16(0), NULL, 0);
+ if (!err) {
+ init_system_file_sd(i, &sd, &j);
+ err = add_attr_sd(m, sd, j);
+ }
+ if (err < 0) {
+ ntfs_log_error("Couldn't create system file %i (0x%x): "
+ "%s\n", i, i, strerror(-err));
+ return FALSE;
+ }
+ }
+ /* create systemfiles for ntfs volumes (3.1) */
+ /* starting with file 24 (ignoring file 16-23) */
+ extend_flags = FILE_ATTR_HIDDEN | FILE_ATTR_SYSTEM |
+ 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_VIEW_INDEX;
+ if (!err)
+ err = create_hardlink_res((MFT_RECORD*)(g_buf +
+ 11 * g_vol->mft_record_size), extend_ref, m,
+ 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)
+ err = add_attr_index_root(m, "$Q", 2, CASE_SENSITIVE, AT_UNUSED,
+ COLLATION_NTOFS_ULONG, g_vol->indx_record_size);
+ /* FIXME: This should be IGNORE_CASE */
+ if (!err)
+ err = add_attr_index_root(m, "$O", 2, CASE_SENSITIVE, AT_UNUSED,
+ COLLATION_NTOFS_SID, g_vol->indx_record_size);
+ if (!err)
+ err = initialize_quota(m);
+ 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;
+ 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, MK_LE_MREF(25, 1), 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, CASE_SENSITIVE, AT_UNUSED,
+ COLLATION_NTOFS_ULONGS,
+ g_vol->indx_record_size);
+ if (!err && opts.with_uuid)
+ err = index_obj_id_insert(m, &vol_guid,
+ MK_LE_MREF(FILE_Volume, FILE_Volume));
+ 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;
+ 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, MK_LE_MREF(26, 1),
+ 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, CASE_SENSITIVE, AT_UNUSED,
+ COLLATION_NTOFS_ULONGS, g_vol->indx_record_size);
+ if (err < 0) {
+ ntfs_log_error("Couldn't create $Reparse: %s\n",
+ strerror(-err));
+ return FALSE;
+ }
+ return TRUE;
+}
+
+/**
+ * mkntfs_redirect
+ */
+static int mkntfs_redirect(struct mkntfs_options *opts2)
+{
+ u64 upcase_crc;
+ int result = 1;
+ ntfs_attr_search_ctx *ctx = NULL;
+ long long lw, pos;
+ ATTR_RECORD *a;
+ MFT_RECORD *m;
+ int i, err;
+
+ if (!opts2) {
+ ntfs_log_error("Internal error: invalid parameters to mkntfs_options.\n");
+ goto done;
+ }
+ /* Initialize the random number generator with the current time. */
+ srandom(le64_to_cpu(mkntfs_time())/10000000);
+ /* 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;
+ }
+ /* Create NTFS 3.1 (Windows XP/Vista) volumes. */
+ g_vol->major_ver = 3;
+ g_vol->minor_ver = 1;
+ /* Transfer some options to the volume. */
+ 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.cluster_size >= 0)
+ g_vol->cluster_size = opts.cluster_size;
+ /* Length is in unicode characters. */
+ g_vol->upcase_len = ntfs_upcase_build_default(&g_vol->upcase);
+ /* Since Windows 8, there is a $Info stream in $UpCase */
+ g_upcaseinfo =
+ (struct UPCASEINFO*)ntfs_malloc(sizeof(struct UPCASEINFO));
+ if (!g_vol->upcase_len || !g_upcaseinfo)
+ goto done;
+ /* If the CRC is correct, chkdsk does not warn about obsolete table */
+ crc64(0,(byte*)NULL,0); /* initialize the crc computation */
+ upcase_crc = crc64(0,(byte*)g_vol->upcase,
+ g_vol->upcase_len * sizeof(ntfschar));
+ /* keep the version fields as zero */
+ memset(g_upcaseinfo, 0, sizeof(struct UPCASEINFO));
+ g_upcaseinfo->len = cpu_to_le32(sizeof(struct UPCASEINFO));
+ g_upcaseinfo->crc = cpu_to_le64(upcase_crc);
+ g_vol->attrdef = ntfs_malloc(sizeof(attrdef_ntfs3x_array));
+ if (!g_vol->attrdef) {
+ ntfs_log_perror("Could not create attrdef structure");
+ goto done;
+ }
+ memcpy(g_vol->attrdef, attrdef_ntfs3x_array,
+ sizeof(attrdef_ntfs3x_array));
+ g_vol->attrdef_len = sizeof(attrdef_ntfs3x_array);
+ /* Open the partition. */
+ if (!mkntfs_open_partition(g_vol))
+ goto done;
+ /*
+ * 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(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.
+ * - 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");
+ 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);
+
+ ctx = ntfs_attr_get_search_ctx(NULL, m);
+ if (!ctx) {
+ ntfs_log_perror("Could not create an attribute search context");
+ goto done;
+ }
+
+ if (mkntfs_attr_lookup(AT_DATA, AT_UNNAMED, 0, CASE_SENSITIVE,
+ 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);
+ if (!rl) {
+ ntfs_log_error("ntfs_mapping_pairs_decompress() failed\n");
+ goto done;
+ }
+ lw = ntfs_rlwrite(g_vol->dev, rl, (const u8*)NULL,
+ g_lcn_bitmap_byte_size, NULL, WRITE_BITMAP);
+ err = errno;
+ free(rl);
+ if (lw != g_lcn_bitmap_byte_size) {
+ ntfs_log_error("ntfs_rlwrite: %s\n", lw == -1 ?
+ strerror(err) : "unknown error");
+ goto done;
+ }
+ } else {
+ /* Error : the bitmap must be created non resident */
+ ntfs_log_error("Error : the global bitmap is resident\n");
+ goto done;
+ }
+
+ /*
+ * No need to sync $MFT/$BITMAP as that has never been modified since
+ * its creation.
+ */
+ ntfs_log_verbose("Syncing $MFT.\n");
+ pos = g_mft_lcn * g_vol->cluster_size;
+ 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) {
+ ntfs_log_error("ntfs_mst_pwrite: %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++) {
+ 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
+ * $MFTMirr to have the exact same byte by byte content as
+ * $MFT, rather than just equivalent meaning content.
+ */
+ if (ntfs_mft_usn_dec(m)) {
+ ntfs_log_error("ntfs_mft_usn_dec");
+ goto done;
+ }
+ 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("ntfs_mst_pwrite: %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)) {
+ ntfs_log_error("Syncing device. FAILED");
+ goto done;
+ }
+ ntfs_log_quiet("mkntfs completed successfully. Have a nice day.\n");
+ result = 0;
+done:
+ ntfs_attr_put_search_ctx(ctx);
+ mkntfs_cleanup(); /* 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;
+
+ result = mkntfs_redirect(&opts);
+done:
+ return result;
+}
diff --git a/ntfsprogs/ntfscat.8 b/ntfsprogs/ntfscat.8
new file mode 100644
index 0000000..c240e34
--- a/dev/null
+++ b/ntfsprogs/ntfscat.8
@@ -0,0 +1,136 @@
+.\" Copyright (c) 2003\-2005 Richard Russon.
+.\" Copyright (c) 2007 Yura Pakhuchiy.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH NTFSCAT 8 "September 2007" "ntfs-3g 2014.2.15"
+.SH NAME
+ntfscat \- print NTFS files and streams on the standard output
+.SH SYNOPSIS
+[\fIoptions\fR] \fIdevice \fR[\fIfile\fR]
+.SH DESCRIPTION
+.B ntfscat
+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
+is ignored.
+.SH OPTIONS
+Below is a summary of all the options that
+.B ntfscat
+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\-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
+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"
+.TE
+.sp
+.sp
+.B Notes
+The attribute names may be given without the leading $ symbol.
+.br
+If you use the $ symbol, you must quote the name to prevent the shell
+interpreting the name.
+.TP
+\fB\-n\fR, \fB\-\-attribute\-name\fR NAME
+Display this named attribute, stream.
+.TP
+\fB\-i\fR, \fB\-\-inode\fR NUM
+Specify a file by its inode number instead of its name.
+.TP
+\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
+\fB\-h\fR, \fB\-\-help\fR
+Show a list of options with a brief description of each one.
+.TP
+\fB\-q\fR, \fB\-\-quiet\fR
+Suppress some debug/warning/error messages.
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Show the version number, copyright and license
+.BR ntfscat .
+.TP
+\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.
+.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
+.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 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
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.SH AUTHORS
+.B ntfscat
+was written by Richard Russon, Anton Altaparmakov and Szabolcs Szakacsits.
+It was ported to ntfs-3g by Erik Larsson.
+.SH AVAILABILITY
+.B ntfscat
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+Read \fBlibntfs\fR(8) for details how to access encrypted files.
+.sp
+.BR libntfs (8),
+.BR ntfsls (8),
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfscat.8.in b/ntfsprogs/ntfscat.8.in
new file mode 100755
index 0000000..478d9b4
--- a/dev/null
+++ b/ntfsprogs/ntfscat.8.in
@@ -0,0 +1,136 @@
+.\" Copyright (c) 2003\-2005 Richard Russon.
+.\" Copyright (c) 2007 Yura Pakhuchiy.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH NTFSCAT 8 "September 2007" "ntfs-3g @VERSION@"
+.SH NAME
+ntfscat \- print NTFS files and streams on the standard output
+.SH SYNOPSIS
+[\fIoptions\fR] \fIdevice \fR[\fIfile\fR]
+.SH DESCRIPTION
+.B ntfscat
+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
+is ignored.
+.SH OPTIONS
+Below is a summary of all the options that
+.B ntfscat
+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\-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
+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"
+.TE
+.sp
+.sp
+.B Notes
+The attribute names may be given without the leading $ symbol.
+.br
+If you use the $ symbol, you must quote the name to prevent the shell
+interpreting the name.
+.TP
+\fB\-n\fR, \fB\-\-attribute\-name\fR NAME
+Display this named attribute, stream.
+.TP
+\fB\-i\fR, \fB\-\-inode\fR NUM
+Specify a file by its inode number instead of its name.
+.TP
+\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
+\fB\-h\fR, \fB\-\-help\fR
+Show a list of options with a brief description of each one.
+.TP
+\fB\-q\fR, \fB\-\-quiet\fR
+Suppress some debug/warning/error messages.
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Show the version number, copyright and license
+.BR ntfscat .
+.TP
+\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.
+.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
+.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 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
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.SH AUTHORS
+.B ntfscat
+was written by Richard Russon, Anton Altaparmakov and Szabolcs Szakacsits.
+It was ported to ntfs-3g by Erik Larsson.
+.SH AVAILABILITY
+.B ntfscat
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+Read \fBlibntfs\fR(8) for details how to access encrypted files.
+.sp
+.BR libntfs (8),
+.BR ntfsls (8),
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfscat.c b/ntfsprogs/ntfscat.c
new file mode 100755
index 0000000..823250b
--- a/dev/null
+++ b/ntfsprogs/ntfscat.c
@@ -0,0 +1,440 @@
+/**
+ * ntfscat - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2003-2005 Richard Russon
+ * Copyright (c) 2003-2005 Anton Altaparmakov
+ * Copyright (c) 2003-2005 Szabolcs Szakacsits
+ * Copyright (c) 2007 Yura Pakhuchiy
+ *
+ * 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"
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "types.h"
+#include "attrib.h"
+#include "utils.h"
+#include "volume.h"
+#include "debug.h"
+#include "dir.h"
+#include "ntfscat.h"
+/* #include "version.h" */
+#include "utils.h"
+
+static const char *EXEC_NAME = "ntfscat";
+static struct options opts;
+
+/**
+ * version - Print version information about the program
+ *
+ * Print a copyright statement and a brief description of the program.
+ *
+ * Return: none
+ */
+static void version(void)
+{
+ ntfs_log_info("\n%s v%s (libntfs-3g) - Concatenate files and print "
+ "on the standard output.\n\n", EXEC_NAME, VERSION);
+ ntfs_log_info("Copyright (c) 2003-2005 Richard Russon\n");
+ ntfs_log_info("Copyright (c) 2003-2005 Anton Altaparmakov\n");
+ ntfs_log_info("Copyright (c) 2003-2005 Szabolcs Szakacsits\n");
+ ntfs_log_info("Copyright (c) 2007 Yura Pakhuchiy\n");
+ ntfs_log_info("\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)
+{
+ 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",
+// Does not work for compressed files at present so leave undocumented...
+// " -r --raw Display the raw data (e.g. for compressed or encrypted file)",
+ EXEC_NAME);
+ ntfs_log_info("%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)cpu_to_le32((i + 1) * 16);
+ return 1;
+ }
+ }
+
+ num = strtol(value, NULL, 0);
+ if ((num > 0) && (num < 257)) {
+ *attr = (ATTR_TYPES)cpu_to_le32(num);
+ return 1;
+ }
+
+ return 0;
+}
+
+/**
+ * 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:n:qVvr";
+ static const struct option lopt[] = {
+ { "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' },
+ { "raw", no_argument, NULL, 'r' },
+ { NULL, 0, NULL, 0 }
+ };
+
+ int c = -1;
+ 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. */
+
+ opts.inode = -1;
+ opts.attr = cpu_to_le32(-1);
+ opts.attr_name = NULL;
+ opts.attr_name_len = 0;
+
+ 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 {
+ ntfs_log_error("You must specify exactly one "
+ "file.\n");
+ err++;
+ }
+ break;
+ case 'a':
+ if (opts.attr != cpu_to_le32(-1)) {
+ ntfs_log_error("You must specify exactly one "
+ "attribute.\n");
+ } else if (parse_attribute(optarg, &attr) > 0) {
+ opts.attr = attr;
+ break;
+ } else {
+ ntfs_log_error("Couldn't parse attribute.\n");
+ }
+ err++;
+ break;
+ case 'f':
+ opts.force++;
+ 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)
+ ntfs_log_error("You must specify exactly one inode.\n");
+ else if (utils_parse_size(optarg, &opts.inode, FALSE))
+ break;
+ else
+ ntfs_log_error("Couldn't parse inode number.\n");
+ err++;
+ break;
+
+ case 'n':
+ opts.attr_name_len = ntfs_mbstoucs(optarg,
+ &opts.attr_name);
+ if (opts.attr_name_len < 0) {
+ 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;
+ case 'r':
+ opts.raw = TRUE;
+ break;
+ default:
+ 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) {
+ ntfs_log_error("You must specify a device.\n");
+ err++;
+
+ } else if (opts.file == NULL && opts.inode == -1) {
+ ntfs_log_error("You must specify a file or inode "
+ "with the -i option.\n");
+ err++;
+
+ } else if (opts.file != NULL && opts.inode != -1) {
+ ntfs_log_error("You can't specify both a file and inode.\n");
+ err++;
+ }
+
+ if (opts.quiet && opts.verbose) {
+ ntfs_log_error("You may not use --quiet and --verbose at the "
+ "same time.\n");
+ err++;
+ }
+ }
+
+ if (ver)
+ version();
+ if (help || err)
+ usage();
+
+ 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 le32_to_cpu(iroot->index_block_size);
+}
+
+/**
+ * cat
+ */
+static int cat(ntfs_volume *vol, ntfs_inode *inode, ATTR_TYPES type,
+ ntfschar *name, int namelen)
+{
+ const int bufsize = 4096;
+ char *buffer;
+ ntfs_attr *attr;
+ s64 bytes_read, written;
+ s64 offset;
+ u32 block_size;
+
+ buffer = malloc(bufsize);
+ if (!buffer)
+ return 1;
+
+ attr = ntfs_attr_open(inode, type, name, namelen);
+ if (!attr) {
+ ntfs_log_error("Cannot find attribute type 0x%x.\n",
+ le32_to_cpu(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 (;;) {
+ if (!opts.raw && block_size > 0) {
+ // These types have fixup
+ bytes_read = ntfs_attr_mst_pread(attr, offset, 1, block_size, buffer);
+ if (bytes_read > 0)
+ bytes_read *= block_size;
+ } else {
+ bytes_read = ntfs_attr_pread(attr, offset, bufsize, buffer);
+ }
+ //ntfs_log_info("read %lld bytes\n", bytes_read);
+ if (bytes_read == -1) {
+ ntfs_log_perror("ERROR: Couldn't read file");
+ break;
+ }
+ if (!bytes_read)
+ break;
+
+ written = fwrite(buffer, 1, bytes_read, stdout);
+ if (written != bytes_read) {
+ ntfs_log_perror("ERROR: Couldn't output all data!");
+ break;
+ }
+ offset += bytes_read;
+ }
+
+ 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;
+ ATTR_TYPES attr;
+ int result = 1;
+
+ ntfs_log_set_handler(ntfs_log_handler_stderr);
+
+ if (!parse_options(argc, argv))
+ return 1;
+
+ utils_set_locale();
+
+ vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY |
+ (opts.force ? NTFS_MNT_RECOVER : 0));
+ if (!vol) {
+ ntfs_log_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) {
+ ntfs_log_perror("ERROR: Couldn't open inode");
+ return 1;
+ }
+
+ attr = AT_DATA;
+ if (opts.attr != cpu_to_le32(-1))
+ attr = opts.attr;
+
+ result = cat(vol, inode, attr, opts.attr_name, opts.attr_name_len);
+
+ ntfs_inode_close(inode);
+ ntfs_umount(vol, FALSE);
+
+ return result;
+}
diff --git a/ntfsprogs/ntfscat.h b/ntfsprogs/ntfscat.h
new file mode 100755
index 0000000..cf474b4
--- a/dev/null
+++ b/ntfsprogs/ntfscat.h
@@ -0,0 +1,46 @@
+/*
+ * 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"
+#include "layout.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 */
+ 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 */
+ BOOL raw; /* Raw data output */
+};
+
+#endif /* _NTFSCAT_H_ */
+
+
diff --git a/ntfsprogs/ntfsck.c b/ntfsprogs/ntfsck.c
new file mode 100755
index 0000000..2781601
--- a/dev/null
+++ b/ntfsprogs/ntfsck.c
@@ -0,0 +1,883 @@
+/**
+ * ntfsck - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2006 Yuval Fledel
+ *
+ * This utility will check and fix errors 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"
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#include <layout.h>
+#include <bitmap.h>
+#include <endians.h>
+#include <bootsect.h>
+#include <misc.h>
+
+#include "cluster.h"
+#include "utils.h"
+
+#define RETURN_FS_ERRORS_CORRECTED (1)
+#define RETURN_SYSTEM_NEEDS_REBOOT (2)
+#define RETURN_FS_ERRORS_LEFT_UNCORRECTED (4)
+#define RETURN_OPERATIONAL_ERROR (8)
+#define RETURN_USAGE_OR_SYNTAX_ERROR (16)
+#define RETURN_CANCELLED_BY_USER (32)
+/* Where did 64 go? */
+#define RETURN_SHARED_LIBRARY_ERROR (128)
+
+/* todo: command line: (everything is optional)
+ * fsck-frontend options:
+ * -C [fd] : display progress bar (send it to the file descriptor if specified)
+ * -T : don't show the title on startup
+ * fsck-checker options:
+ * -a : auto-repair. no questions. (optional: if marked clean and -f not specified, just check if mounable)
+ * -p : auto-repair safe. no questions (optional: same)
+ * -n : only check. no repair.
+ * -r : interactively repair.
+ * -y : always yes.
+ * -v : verbose.
+ * -V : version.
+ * taken from fsck.ext2
+ * -b sb : use the superblock from sb. For corrupted volumes. (do we want separete boot/mft options?)
+ * -c : use badblocks(8) to find bad blocks (R/O mode) and add the findings to $Bad.
+ * -C fd : write competion info to fd. If 0, print a completion bar.
+ * -d : debugging output.
+ * -D : rebalance indices.
+ * -f : force checking even if marked clean.
+ * -F : flush buffers before beginning. (for time-benchmarking)
+ * -k : When used with -c, don't erase previous $Bad items.
+ * -n : Open fs as readonly. assume always no. (why is it needed if -r is not specified?)
+ * -t : Print time statistics.
+ * taken from fsck.reiserfs
+ * --rebuild-sb : try to find $MFT start and rebuild the boot sector.
+ * --rebuild-tree : scan for items and rebuild the indices that point to them (0x30, $SDS, etc.)
+ * --clean-reserved: zero rezerved fields. (use with care!)
+ * --adjust-size -z: insert a sparse hole if the data_size is larger than the size marked in the runlist.
+ * --logfile file : report corruptions (unlike other errors) to a file instead of stderr.
+ * --nolog : don't report corruptions at all.
+ * --quiet -q : no progress bar.
+ * taken from fsck.msdos
+ * -w : flush after every write.
+ * - do n passes. (only 2 in fsck.msdos. second should not report errors. Bonus: stop when error list does not change)
+ * taken from fsck.jfs
+ * --omit-journal-reply: self-descriptive (why would someone do that?)
+ * --replay-journal-only: self-descriptive. don't check otherwise.
+ * taken from fsck.xfs
+ * -s : only serious errors should be reported.
+ * -i ino : verbose behaviour only for inode ino.
+ * -b bno : verbose behaviour only for cluster bno.
+ * -L : zero log.
+ * inspired by others
+ * - don't do cluster accounting.
+ * - don't do mft record accounting.
+ * - don't do file names accounting.
+ * - don't do security_id accounting.
+ * - don't check acl inheritance problems.
+ * - undelete unused mft records. (bonus: different options for 100% salvagable and less)
+ * - error-level-report n: only report errors above this error level
+ * - error-level-repair n: only repair errors below this error level
+ * - don't fail on ntfsclone metadata pruning.
+ * signals:
+ * SIGUSR1 : start displaying progress bar
+ * SIGUSR2 : stop displaying progress bar.
+ */
+
+/* Assuming NO_NTFS_DEVICE_DEFAULT_IO_OPS is not set */
+
+static int errors = 0;
+static int unsupported = 0;
+
+static short bytes_per_sector, sectors_per_cluster;
+//static s64 mft_offset, mftmirr_offset;
+static s64 current_mft_record;
+
+/**
+ * This is just a preliminary volume.
+ * Filled while checking the boot sector and used in the preliminary MFT check.
+ */
+//static ntfs_volume vol;
+
+static runlist_element *mft_rl, *mft_bitmap_rl;
+
+#define check_failed(FORMAT, ARGS...) \
+ do { \
+ errors++; \
+ ntfs_log_redirect(__FUNCTION__,__FILE__,__LINE__, \
+ NTFS_LOG_LEVEL_ERROR,NULL,FORMAT,##ARGS); \
+ } while (0);
+
+/**
+ * 0 success.
+ * 1 fail.
+ */
+static int assert_u32_equal(u32 val, u32 ok, const char *name)
+{
+ if (val!=ok) {
+ check_failed("Assertion failed for '%lld:%s'. should be 0x%x, "
+ "was 0x%x.\n", (long long)current_mft_record, name,
+ (int)ok, (int)val);
+ //errors++;
+ return 1;
+ }
+ return 0;
+}
+
+static int assert_u32_noteq(u32 val, u32 wrong, const char *name)
+{
+ if (val==wrong) {
+ check_failed("Assertion failed for '%lld:%s'. should not be "
+ "0x%x.\n", (long long)current_mft_record, name,
+ (int)wrong);
+ return 1;
+ }
+ return 0;
+}
+
+static int assert_u32_lesseq(u32 val1, u32 val2, const char *name)
+{
+ if (val1 > val2) {
+ check_failed("Assertion failed for '%s'. 0x%x > 0x%x\n",
+ name, (int)val1, (int)val2);
+ //errors++;
+ return 1;
+ }
+ return 0;
+}
+
+static int assert_u32_less(u32 val1, u32 val2, const char *name)
+{
+ if (val1 >= val2) {
+ check_failed("Assertion failed for '%s'. 0x%x >= 0x%x\n",
+ name, (int)val1, (int)val2);
+ //errors++;
+ return 1;
+ }
+ return 0;
+}
+
+/**
+ * Return: 0 ok, 1 error.
+ *
+ * todo: may we use ntfs_boot_sector_is_ntfs() instead?
+ * It already does the checks but will not be able to fix anything.
+ */
+static BOOL verify_boot_sector(struct ntfs_device *dev, ntfs_volume *rawvol)
+{
+ u8 buf[512];
+ NTFS_BOOT_SECTOR *ntfs_boot = (NTFS_BOOT_SECTOR *)&buf;
+ //u32 bytes_per_cluster;
+
+ current_mft_record = 9;
+
+ if (ntfs_pread(dev, 0, sizeof(buf), buf) != sizeof(buf)) {
+ check_failed("Failed to read boot sector.\n");
+ return 1;
+ }
+
+ if ((buf[0]!=0xeb) ||
+ ((buf[1]!=0x52) && (buf[1]!=0x5b)) ||
+ (buf[2]!=0x90)) {
+ check_failed("Boot sector: Bad jump.\n");
+ }
+ if (ntfs_boot->oem_id != magicNTFS) {
+ check_failed("Boot sector: Bad NTFS magic.\n");
+ }
+ bytes_per_sector = le16_to_cpu(ntfs_boot->bpb.bytes_per_sector);
+ if (!bytes_per_sector) {
+ check_failed("Boot sector: Bytes per sector is 0.\n");
+ }
+ if (bytes_per_sector%512) {
+ check_failed("Boot sector: Bytes per sector is not a multiple"
+ " of 512.\n");
+ }
+ sectors_per_cluster = ntfs_boot->bpb.sectors_per_cluster;
+
+ // todo: if partition, query bios and match heads/tracks? */
+
+ // Initialize some values into rawvol. We will need those later.
+ rawvol->dev = dev;
+ ntfs_boot_sector_parse(rawvol, (NTFS_BOOT_SECTOR *)buf);
+
+ return 0;
+}
+
+/**
+ * Load the runlist of the <attr_type> attribute.
+ *
+ * Return NULL if an error.
+ * The caller is responsible on freeing the allocated memory if the result is not NULL.
+ *
+ * Set size_of_file_record to some reasonable size when in doubt (the Windows default is 1024.)
+ *
+ * attr_type must be little endian.
+ *
+ * This function has code duplication with check_file_record() and
+ * check_attr_record() but its goal is to be less strict. Thus the
+ * duplicated checks are the minimal required for not crashing.
+ *
+ * Assumes dev is open.
+ */
+static runlist *load_runlist(ntfs_volume *rawvol, s64 offset_to_file_record, u32 attr_type, u32 size_of_file_record)
+{
+ u8 *buf;
+ u16 attrs_offset;
+ u32 length;
+ ATTR_RECORD *attr_rec;
+
+ if (size_of_file_record<22) // offset to attrs_offset
+ return NULL;
+
+ buf = (u8*)ntfs_malloc(size_of_file_record);
+ if (!buf)
+ return NULL;
+
+ if (ntfs_pread(rawvol->dev, offset_to_file_record, size_of_file_record, buf) !=
+ size_of_file_record) {
+ check_failed("Failed to read file record at offset %lld (0x%llx).\n",
+ (long long)offset_to_file_record,
+ (long long)offset_to_file_record);
+ return NULL;
+ }
+
+ attrs_offset = le16_to_cpu(((MFT_RECORD*)buf)->attrs_offset);
+ // first attribute must be after the header.
+ if (attrs_offset<42) {
+ check_failed("First attribute must be after the header (%u).\n", (int)attrs_offset);
+ }
+ attr_rec = (ATTR_RECORD *)(buf + attrs_offset);
+ //printf("uv1.\n");
+
+ while ((u8*)attr_rec<=buf+size_of_file_record-4) {
+
+ //printf("Attr type: 0x%x.\n", attr_rec->type);
+ // Check attribute record. (Only what is in the buffer)
+ if (attr_rec->type==AT_END) {
+ check_failed("Attribute 0x%x not found in file record at offset %lld (0x%llx).\n", (int)le32_to_cpu(attr_rec->type),
+ (long long)offset_to_file_record,
+ (long long)offset_to_file_record);
+ return NULL;
+ }
+ if ((u8*)attr_rec>buf+size_of_file_record-8) {
+ // not AT_END yet no room for the length field.
+ check_failed("Attribute 0x%x is not AT_END, yet no "
+ "room for the length field.\n",
+ (int)le32_to_cpu(attr_rec->type));
+ return NULL;
+ }
+
+ length = le32_to_cpu(attr_rec->length);
+
+ // Check that this attribute does not overflow the mft_record
+ if ((u8*)attr_rec+length >= buf+size_of_file_record) {
+ check_failed("Attribute (0x%x) is larger than FILE record at offset %lld (0x%llx).\n",
+ (int)le32_to_cpu(attr_rec->type),
+ (long long)offset_to_file_record,
+ (long long)offset_to_file_record);
+ return NULL;
+ }
+ // todo: what ATTRIBUTE_LIST (0x20)?
+
+ if (attr_rec->type==attr_type) {
+ // Eurika!
+
+ // ntfs_mapping_pairs_decompress only use two values from vol. Just fake it.
+ // todo: it will also use vol->major_ver if defined(DEBUG). But only for printing purposes.
+
+ // Assume ntfs_boot_sector_parse() was called.
+ return ntfs_mapping_pairs_decompress(rawvol, attr_rec, NULL);
+ }
+
+ attr_rec = (ATTR_RECORD*)((u8*)attr_rec+length);
+ }
+ // If we got here, there was an overflow.
+ check_failed("file record corrupted at offset %lld (0x%llx).\n",
+ (long long)offset_to_file_record,
+ (long long)offset_to_file_record);
+ return NULL;
+}
+
+/**
+ * Return: >=0 last VCN
+ * LCN_EINVAL error.
+ */
+static VCN get_last_vcn(runlist *rl)
+{
+ VCN res;
+
+ if (!rl)
+ return LCN_EINVAL;
+
+ res = LCN_EINVAL;
+ while (rl->length) {
+ ntfs_log_verbose("vcn: %lld, length: %lld.\n",
+ (long long)rl->vcn, (long long)rl->length);
+ if (rl->vcn<0)
+ res = rl->vcn;
+ else
+ res = rl->vcn + rl->length;
+ rl++;
+ }
+
+ return res;
+}
+
+static u32 mft_bitmap_records;
+static u8 *mft_bitmap_buf;
+
+/**
+ * Assumes mft_bitmap_rl is initialized.
+ * return: 0 ok.
+ * RETURN_OPERATIONAL_ERROR on error.
+ */
+static int mft_bitmap_load(ntfs_volume *rawvol)
+{
+ VCN vcn;
+ u32 mft_bitmap_length;
+
+ vcn = get_last_vcn(mft_bitmap_rl);
+ if (vcn<=LCN_EINVAL) {
+ mft_bitmap_buf = NULL;
+ /* This case should not happen, not even with on-disk errors */
+ goto error;
+ }
+
+ mft_bitmap_length = vcn * rawvol->cluster_size;
+ mft_bitmap_records = 8 * mft_bitmap_length * rawvol->cluster_size /
+ rawvol->mft_record_size;
+
+ //printf("sizes: %d, %d.\n", mft_bitmap_length, mft_bitmap_records);
+
+ mft_bitmap_buf = (u8*)ntfs_malloc(mft_bitmap_length);
+ if (!mft_bitmap_buf)
+ goto error;
+ if (ntfs_rl_pread(rawvol, mft_bitmap_rl, 0, mft_bitmap_length,
+ mft_bitmap_buf)!=mft_bitmap_length)
+ goto error;
+ return 0;
+error:
+ mft_bitmap_records = 0;
+ ntfs_log_error("Could not load $MFT/Bitmap.\n");
+ return RETURN_OPERATIONAL_ERROR;
+}
+
+/**
+ * -1 Error.
+ * 0 Unused record
+ * 1 Used record
+ *
+ * Assumes mft_bitmap_rl was initialized.
+ */
+static int mft_bitmap_get_bit(s64 mft_no)
+{
+ if (mft_no>=mft_bitmap_records)
+ return -1;
+ return ntfs_bit_get(mft_bitmap_buf, mft_no);
+}
+
+/**
+ * @attr_rec: The attribute record to check
+ * @mft_rec: The parent FILE record.
+ * @buflen: The size of the FILE record.
+ *
+ * Return:
+ * NULL: Fatal error occured. Not sure where is the next record.
+ * otherwise: pointer to the next attribute record.
+ *
+ * The function only check fields that are inside this attr record.
+ *
+ * Assumes mft_rec is current_mft_record.
+ */
+static ATTR_REC *check_attr_record(ATTR_REC *attr_rec, MFT_RECORD *mft_rec,
+ u16 buflen)
+{
+ u16 name_offset;
+ u16 attrs_offset = le16_to_cpu(mft_rec->attrs_offset);
+ u32 attr_type = le32_to_cpu(attr_rec->type);
+ u32 length = le32_to_cpu(attr_rec->length);
+
+ // Check that this attribute does not overflow the mft_record
+ if ((u8*)attr_rec+length >= ((u8*)mft_rec)+buflen) {
+ check_failed("Attribute (0x%x) is larger than FILE record (%lld).\n",
+ (int)attr_type, (long long)current_mft_record);
+ return NULL;
+ }
+
+ // Attr type must be a multiple of 0x10 and 0x10<=x<=0x100.
+ if ((attr_type & ~0x0F0) && (attr_type != 0x100)) {
+ check_failed("Unknown attribute type 0x%x.\n",
+ (int)attr_type);
+ goto check_attr_record_next_attr;
+ }
+
+ if (length<24) {
+ check_failed("Attribute %lld:0x%x Length too short (%u).\n",
+ (long long)current_mft_record, (int)attr_type,
+ (int)length);
+ goto check_attr_record_next_attr;
+ }
+
+ // If this is the first attribute:
+ // todo: instance number must be smaller than next_instance.
+ if ((u8*)attr_rec == ((u8*)mft_rec) + attrs_offset) {
+ if (!mft_rec->base_mft_record)
+ assert_u32_equal(attr_type, 0x10,
+ "First attribute type");
+ // The following not always holds.
+ // attr 0x10 becomes instance 1 and attr 0x40 becomes 0.
+ //assert_u32_equal(attr_rec->instance, 0,
+ // "First attribute instance number");
+ } else {
+ assert_u32_noteq(attr_type, 0x10,
+ "Not-first attribute type");
+ // The following not always holds.
+ //assert_u32_noteq(attr_rec->instance, 0,
+ // "Not-first attribute instance number");
+ }
+ //if (current_mft_record==938 || current_mft_record==1683 || current_mft_record==3152 || current_mft_record==22410)
+ //printf("Attribute %lld:0x%x instance: %u isbase:%d.\n",
+ // current_mft_record, (int)attr_type, (int)le16_to_cpu(attr_rec->instance), (int)mft_rec->base_mft_record);
+ // todo: instance is unique.
+
+ // Check flags.
+ if (attr_rec->flags & ~(const_cpu_to_le16(0xc0ff))) {
+ check_failed("Attribute %lld:0x%x Unknown flags (0x%x).\n",
+ (long long)current_mft_record, (int)attr_type,
+ (int)le16_to_cpu(attr_rec->flags));
+ }
+
+ if (attr_rec->non_resident>1) {
+ check_failed("Attribute %lld:0x%x Unknown non-resident "
+ "flag (0x%x).\n", (long long)current_mft_record,
+ (int)attr_type, (int)attr_rec->non_resident);
+ goto check_attr_record_next_attr;
+ }
+
+ name_offset = le16_to_cpu(attr_rec->name_offset);
+ /*
+ * todo: name must be legal unicode.
+ * Not really, information below in urls is about filenames, but I
+ * believe it also applies to attribute names. (Yura)
+ * http://blogs.msdn.com/michkap/archive/2006/09/24/769540.aspx
+ * http://blogs.msdn.com/michkap/archive/2006/09/10/748699.aspx
+ */
+
+ if (attr_rec->non_resident) {
+ // Non-Resident
+
+ // Make sure all the fields exist.
+ if (length<64) {
+ check_failed("Non-resident attribute %lld:0x%x too short (%u).\n",
+ (long long)current_mft_record, (int)attr_type,
+ (int)length);
+ goto check_attr_record_next_attr;
+ }
+ if (attr_rec->compression_unit && (length<72)) {
+ check_failed("Compressed attribute %lld:0x%x too short (%u).\n",
+ (long long)current_mft_record, (int)attr_type,
+ (int)length);
+ goto check_attr_record_next_attr;
+ }
+
+ // todo: name comes before mapping pairs, and after the header.
+ // todo: length==mapping_pairs_offset+length of compressed mapping pairs.
+ // todo: mapping_pairs_offset is 8-byte aligned.
+
+ // todo: lowest vcn <= highest_vcn
+ // todo: if base record -> lowest vcn==0
+ // todo: lowest_vcn!=0 -> attribute list is used.
+ // todo: lowest_vcn & highest_vcn are in the drive (0<=x<total clusters)
+ // todo: mapping pairs agree with highest_vcn.
+ // todo: compression unit == 0 or 4.
+ // todo: reserved1 == 0.
+ // todo: if not compressed nor sparse, initialized_size <= allocated_size and data_size <= allocated_size.
+ // todo: if compressed or sparse, allocated_size <= initialized_size and allocated_size <= data_size
+ // todo: if mft_no!=0 and not compressed/sparse, data_size==initialized_size.
+ // todo: if mft_no!=0 and compressed/sparse, allocated_size==initialized_size.
+ // todo: what about compressed_size if compressed?
+ // todo: attribute must not be 0x10, 0x30, 0x40, 0x60, 0x70, 0x90, 0xd0 (not sure about 0xb0, 0xe0, 0xf0)
+ } else {
+ u16 value_offset = le16_to_cpu(attr_rec->value_offset);
+ u32 value_length = le32_to_cpu(attr_rec->value_length);
+ // Resident
+ if (attr_rec->name_length) {
+ if (name_offset < 24)
+ check_failed("Resident attribute with "
+ "name intersecting header.\n");
+ if (value_offset < name_offset +
+ attr_rec->name_length)
+ check_failed("Named resident attribute "
+ "with value before name.\n");
+ }
+ // if resident, length==value_length+value_offset
+ //assert_u32_equal(le32_to_cpu(attr_rec->value_length)+
+ // value_offset, length,
+ // "length==value_length+value_offset");
+ // if resident, length==value_length+value_offset
+ if (value_length+value_offset > length) {
+ check_failed("value_length(%d)+value_offset(%d)>length(%d) for attribute 0x%x.\n", (int)value_length, (int)value_offset, (int)length, (int)attr_type);
+ return NULL;
+ }
+
+ // Check resident_flags.
+ if (attr_rec->resident_flags>0x01) {
+ check_failed("Unknown resident flags (0x%x) for attribute 0x%x.\n", (int)attr_rec->resident_flags, (int)attr_type);
+ } else if (attr_rec->resident_flags && (attr_type!=0x30)) {
+ check_failed("Resident flags mark attribute 0x%x as indexed.\n", (int)attr_type);
+ }
+
+ // reservedR is 0.
+ assert_u32_equal(attr_rec->reservedR, 0, "Resident Reserved");
+
+ // todo: attribute must not be 0xa0 (not sure about 0xb0, 0xe0, 0xf0)
+ // todo: check content well-formness per attr_type.
+ }
+ return 0;
+check_attr_record_next_attr:
+ return (ATTR_REC *)(((u8 *)attr_rec) + length);
+}
+
+/**
+ * All checks that can be satisfied only by data from the buffer.
+ * No other [MFT records/metadata files] are required.
+ *
+ * The buffer is changed by removing the Update Sequence.
+ *
+ * Return:
+ * 0 Everything's cool.
+ * else Consider this record as damaged.
+ */
+static BOOL check_file_record(u8 *buffer, u16 buflen)
+{
+ u16 usa_count, usa_ofs, attrs_offset, usa;
+ u32 bytes_in_use, bytes_allocated, i;
+ MFT_RECORD *mft_rec = (MFT_RECORD *)buffer;
+ ATTR_REC *attr_rec;
+
+ // check record magic
+ assert_u32_equal(mft_rec->magic, magic_FILE, "FILE record magic");
+ // todo: records 16-23 must be filled in order.
+ // todo: what to do with magic_BAAD?
+
+ // check usa_count+offset to update seq <= attrs_offset <
+ // bytes_in_use <= bytes_allocated <= buflen.
+ usa_ofs = le16_to_cpu(mft_rec->usa_ofs);
+ usa_count = le16_to_cpu(mft_rec->usa_count);
+ attrs_offset = le16_to_cpu(mft_rec->attrs_offset);
+ bytes_in_use = le32_to_cpu(mft_rec->bytes_in_use);
+ bytes_allocated = le32_to_cpu(mft_rec->bytes_allocated);
+ if (assert_u32_lesseq(usa_ofs+usa_count, attrs_offset,
+ "usa_ofs+usa_count <= attrs_offset") ||
+ assert_u32_less(attrs_offset, bytes_in_use,
+ "attrs_offset < bytes_in_use") ||
+ assert_u32_lesseq(bytes_in_use, bytes_allocated,
+ "bytes_in_use <= bytes_allocated") ||
+ assert_u32_lesseq(bytes_allocated, buflen,
+ "bytes_allocated <= max_record_size")) {
+ return 1;
+ }
+
+
+ // We should know all the flags.
+ if (mft_rec->flags>0xf) {
+ check_failed("Unknown MFT record flags (0x%x).\n",
+ (unsigned int)mft_rec->flags);
+ }
+ // todo: flag in_use must be on.
+
+ // Remove update seq & check it.
+ usa = *(u16*)(buffer+usa_ofs); // The value that should be at the end of every sector.
+ assert_u32_equal(usa_count-1, buflen/NTFS_BLOCK_SIZE, "USA length");
+ for (i=1;i<usa_count;i++) {
+ u16 *fixup = (u16*)(buffer+NTFS_BLOCK_SIZE*i-2); // the value at the end of the sector.
+ u16 saved_val = *(u16*)(buffer+usa_ofs+2*i); // the actual data value that was saved in the us array.
+
+ assert_u32_equal(*fixup, usa, "fixup");
+ *fixup = saved_val; // remove it.
+ }
+
+ attr_rec = (ATTR_REC *)(buffer + attrs_offset);
+ while ((u8*)attr_rec<=buffer+buflen-4) {
+
+ // Check attribute record. (Only what is in the buffer)
+ if (attr_rec->type==AT_END) {
+ // Done.
+ return 0;
+ }
+ if ((u8*)attr_rec>buffer+buflen-8) {
+ // not AT_END yet no room for the length field.
+ check_failed("Attribute 0x%x is not AT_END, yet no "
+ "room for the length field.\n",
+ (int)le32_to_cpu(attr_rec->type));
+ return 1;
+ }
+
+ attr_rec = check_attr_record(attr_rec, mft_rec, buflen);
+ if (!attr_rec)
+ return 1;
+ }
+ // If we got here, there was an overflow.
+ return 1;
+
+ // todo: an attribute should be at the offset to first attribute, and the offset should be inside the buffer. It should have the value of "next attribute id".
+ // todo: if base record, it should start with attribute 0x10.
+
+ // Highlevel check of attributes.
+ // todo: Attributes are well-formed.
+ // todo: Room for next attribute in the end of the previous record.
+
+ return FALSE;
+}
+
+static void replay_log(ntfs_volume *vol __attribute__((unused)))
+{
+ // At this time, only check that the log is fully replayed.
+ ntfs_log_warning("Unsupported: replay_log()\n");
+ // todo: if logfile is clean, return success.
+ unsupported++;
+}
+
+static void verify_mft_record(ntfs_volume *vol, s64 mft_num)
+{
+ u8 *buffer;
+ int is_used;
+
+ current_mft_record = mft_num;
+
+ is_used = mft_bitmap_get_bit(mft_num);
+ if (is_used<0) {
+ ntfs_log_error("Error getting bit value for record %lld.\n",
+ (long long)mft_num);
+ } else if (!is_used) {
+ ntfs_log_verbose("Record %lld unused. Skipping.\n",
+ (long long)mft_num);
+ return;
+ }
+
+ buffer = ntfs_malloc(vol->mft_record_size);
+ if (!buffer)
+ goto verify_mft_record_error;
+
+ ntfs_log_verbose("MFT record %lld\n", (long long)mft_num);
+ if (ntfs_attr_pread(vol->mft_na, mft_num*vol->mft_record_size, vol->mft_record_size, buffer) < 0) {
+ ntfs_log_perror("Couldn't read $MFT record %lld", (long long)mft_num);
+ goto verify_mft_record_error;
+ }
+
+ check_file_record(buffer, vol->mft_record_size);
+ // todo: if offset to first attribute >= 0x30, number of mft record should match.
+ // todo: Match the "record is used" with the mft bitmap.
+ // todo: if this is not base, check that the parent is a base, and is in use, and pointing to this record.
+
+ // todo: if base record: for each extent record:
+ // todo: verify_file_record
+ // todo: hard link count should be the number of 0x30 attributes.
+ // todo: Order of attributes.
+ // todo: make sure compression_unit is the same.
+
+ return;
+verify_mft_record_error:
+
+ if (buffer)
+ free(buffer);
+ errors++;
+}
+
+/**
+ * This function serves as bootstraping for the more comprehensive checks.
+ * It will load the MFT runlist and MFT/Bitmap runlist.
+ * It should not depend on other checks or we may have a circular dependancy.
+ * Also, this loadng must be forgiving, unlike the comprehensive checks.
+ */
+static int verify_mft_preliminary(ntfs_volume *rawvol)
+{
+ current_mft_record = 0;
+ s64 mft_offset, mftmirr_offset;
+ int res;
+
+ ntfs_log_trace("Entering verify_mft_preliminary().\n");
+ // todo: get size_of_file_record from boot sector
+ // Load the first segment of the $MFT/DATA runlist.
+ mft_offset = rawvol->mft_lcn * rawvol->cluster_size;
+ mftmirr_offset = rawvol->mftmirr_lcn * rawvol->cluster_size;
+ mft_rl = load_runlist(rawvol, mft_offset, AT_DATA, 1024);
+ if (!mft_rl) {
+ check_failed("Loading $MFT runlist failed. Trying $MFTMirr.\n");
+ mft_rl = load_runlist(rawvol, mftmirr_offset, AT_DATA, 1024);
+ }
+ if (!mft_rl) {
+ check_failed("Loading $MFTMirr runlist failed too. Aborting.\n");
+ return RETURN_FS_ERRORS_LEFT_UNCORRECTED | RETURN_OPERATIONAL_ERROR;
+ }
+ // TODO: else { recover $MFT } // Use $MFTMirr to recover $MFT.
+ // todo: support loading the next runlist extents when ATTRIBUTE_LIST is used on $MFT.
+ // If attribute list: Gradually load mft runlist. (parse runlist from first file record, check all referenced file records, continue with the next file record). If no attribute list, just load it.
+
+ // Load the runlist of $MFT/Bitmap.
+ // todo: what about ATTRIBUTE_LIST? Can we reuse code?
+ mft_bitmap_rl = load_runlist(rawvol, mft_offset, AT_BITMAP, 1024);
+ if (!mft_bitmap_rl) {
+ check_failed("Loading $MFT/Bitmap runlist failed. Trying $MFTMirr.\n");
+ mft_bitmap_rl = load_runlist(rawvol, mftmirr_offset, AT_BITMAP, 1024);
+ }
+ if (!mft_bitmap_rl) {
+ check_failed("Loading $MFTMirr/Bitmap runlist failed too. Aborting.\n");
+ return RETURN_FS_ERRORS_LEFT_UNCORRECTED;
+ // todo: rebuild the bitmap by using the "in_use" file record flag or by filling it with 1's.
+ }
+
+ /* Load $MFT/Bitmap */
+ if ((res = mft_bitmap_load(rawvol)))
+ return res;
+ return -1; /* FIXME: Just added to fix compiler warning without
+ thinking about what should be here. (Yura) */
+}
+
+static void check_volume(ntfs_volume *vol)
+{
+ s64 mft_num, nr_mft_records;
+
+ ntfs_log_warning("Unsupported: check_volume()\n");
+ unsupported++;
+
+ // For each mft record, verify that it contains a valid file record.
+ nr_mft_records = vol->mft_na->initialized_size >>
+ vol->mft_record_size_bits;
+ ntfs_log_info("Checking %lld MFT records.\n", (long long)nr_mft_records);
+
+ for (mft_num=0; mft_num < nr_mft_records; mft_num++) {
+ verify_mft_record(vol, mft_num);
+ }
+
+ // todo: Check metadata files.
+
+ // todo: Second pass on mft records. Now check the contents as well.
+ // todo: When going through runlists, build a bitmap.
+
+ // todo: cluster accounting.
+ return;
+}
+
+static int reset_dirty(ntfs_volume *vol)
+{
+ u16 flags;
+
+ if (!(vol->flags | VOLUME_IS_DIRTY))
+ return 0;
+
+ ntfs_log_verbose("Resetting dirty flag.\n");
+
+ flags = vol->flags & ~VOLUME_IS_DIRTY;
+
+ if (ntfs_volume_write_flags(vol, flags)) {
+ ntfs_log_error("Error setting volume flags.\n");
+ return -1;
+ }
+ return 0;
+}
+
+/**
+ * main - Does just what C99 claim it does.
+ *
+ * For more details on arguments and results, check the man page.
+ */
+int main(int argc, char **argv)
+{
+ struct ntfs_device *dev;
+ ntfs_volume rawvol;
+ ntfs_volume *vol;
+ const char *name;
+ int ret;
+
+ if (argc != 2)
+ return RETURN_USAGE_OR_SYNTAX_ERROR;
+ name = argv[1];
+
+ ntfs_log_set_handler(ntfs_log_handler_outerr);
+ //ntfs_log_set_levels(NTFS_LOG_LEVEL_DEBUG | NTFS_LOG_LEVEL_TRACE | NTFS_LOG_LEVEL_QUIET | NTFS_LOG_LEVEL_INFO | NTFS_LOG_LEVEL_VERBOSE | NTFS_LOG_LEVEL_PROGRESS);
+
+ /* Allocate an ntfs_device structure. */
+ dev = ntfs_device_alloc(name, 0, &ntfs_device_default_io_ops, NULL);
+ if (!dev)
+ return RETURN_OPERATIONAL_ERROR;
+ if (dev->d_ops->open(dev, O_RDONLY)) { //O_RDWR/O_RDONLY?
+ ntfs_log_perror("Error opening partition device");
+ ntfs_device_free(dev);
+ return RETURN_OPERATIONAL_ERROR;
+ }
+
+ if ((ret = verify_boot_sector(dev,&rawvol))) {
+ dev->d_ops->close(dev);
+ return ret;
+ }
+ ntfs_log_verbose("Boot sector verification complete. Proceeding to $MFT");
+
+ verify_mft_preliminary(&rawvol);
+
+ /* ntfs_device_mount() expects the device to be closed. */
+ if (dev->d_ops->close(dev))
+ ntfs_log_perror("Failed to close the device.");
+
+ // at this point we know that the volume is valid enough for mounting.
+
+ /* Call ntfs_device_mount() to do the actual mount. */
+ vol = ntfs_device_mount(dev, NTFS_MNT_RDONLY);
+ if (!vol) {
+ ntfs_device_free(dev);
+ return 2;
+ }
+
+ replay_log(vol);
+
+ if (vol->flags & VOLUME_IS_DIRTY)
+ ntfs_log_warning("Volume is dirty.\n");
+
+ check_volume(vol);
+
+ if (errors)
+ ntfs_log_info("Errors found.\n");
+ if (unsupported)
+ ntfs_log_info("Unsupported cases found.\n");
+
+ if (!errors && !unsupported) {
+ reset_dirty(vol);
+ }
+
+ ntfs_umount(vol, FALSE);
+
+ if (errors)
+ return 2;
+ if (unsupported)
+ return 1;
+ return 0;
+}
+
diff --git a/ntfsprogs/ntfsclone.8 b/ntfsprogs/ntfsclone.8
new file mode 100644
index 0000000..c4f44da
--- a/dev/null
+++ b/ntfsprogs/ntfsclone.8
@@ -0,0 +1,391 @@
+.\" Copyright (c) 2003\-2005 Richard Russon.
+.\" 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 "February 2006" "ntfs-3g 2014.2.15"
+.SH NAME
+ntfsclone \- Efficiently clone, image, restore or rescue an NTFS
+.SH SYNOPSIS
+.B ntfsclone
+[\fIOPTIONS\fR]
+.I SOURCE
+.br
+.B ntfsclone \-\-save\-image
+[\fIOPTIONS\fR]
+.I SOURCE
+.br
+.B ntfsclone \-\-restore\-image
+[\fIOPTIONS\fR]
+.I SOURCE
+.br
+.B ntfsclone \-\-metadata
+[\fIOPTIONS\fR]
+.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.
+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),
+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.
+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
+.sp
+.RE
+.SS Windows Cloning
+If you want to copy, move or restore a system or boot partition to another
+computer, or to a different disk or partition (e.g. hda1\->hda2, hda1\->hdb1
+or to a different disk sector offset) then you will need to take extra care.
+
+Usually, Windows will not be able to boot, unless you copy, move or restore
+NTFS to the same partition which starts at the same sector on the same type
+of disk having the same BIOS legacy cylinder setting as the original
+partition and disk had.
+
+The ntfsclone utility guarantees to make an exact copy of NTFS but it
+won't deal with booting issues. This is by design: ntfsclone is a
+filesystem, not system utility. Its aim is only NTFS cloning, not Windows
+cloning. Hereby ntfsclone can be used as a very fast and reliable
+build block for Windows cloning but itself it's not enough.
+.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
+.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.
+.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 (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.
+
+.BR bzip2 (1)
+compresses large sparse files much better than
+.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
+would be using
+.BR tar (1)
+with the options
+.B \-S
+(handle sparse files "efficiently") and
+.B \-j
+(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
+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. Even more sadly, using the \-S option results
+serious data loss since the end of 2004 and the GNU
+.BR tar
+maintainers didn't release 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.
+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.
+.SS Metadata\-only Cloning
+One of the features of
+.BR 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
+reading them back will result always zeros.
+
+The metadata\-only image can be compressed very
+well, usually to not more than 1\-8 MB thus it's 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
+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.
+This mode may be combined with \fB\-\-save\-image\fP to create a
+special image format file instead of a sparse file.
+
+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. Nearly all options have two equivalent names. The short name is
+preceded by
+.B \-
+and the long name is preceded by
+.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
+.B "\-f \-v" .
+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
+.IR FILE .
+If
+.I FILE
+is '\-' then clone to the
+standard output.
+.TP
+\fB\-O\fR, \fB\-\-overwrite\fR FILE
+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
+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
+argument. If the
+.I SOURCE
+is '\-' then the image is read from the standard input.
+.TP
+\fB\-n\fR, \fB\-\-no\-action\fR
+Test the consistency of a saved image by simulating its restoring without
+writing anything. The NTFS data contained in the image is not tested.
+The option \fB\-\-restore\-image\fR must also be present, and the options
+\fB\-\-output\fR and \fB\-\-overwrite\fR must be omitted.
+.TP
+\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
+beginning of such sectors are marked by "BadSectoR\\0".
+.TP
+\fB\-m\fR, \fB\-\-metadata\fR
+Clone
+.B ONLY METADATA
+(for NTFS experts). Only cloning to a (sparse) file is allowed, unless used
+the option \fB\-\-save\-image\fP is also used.
+You can't metadata\-only clone to a device.
+.TP
+\fB\-\-ignore\-fs\-check\fR
+Ignore the result of the filesystem consistency check. This option is allowed
+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\-t\fR, \fB\-\-preserve\-timestamps\fR
+Do not wipe the timestamps, to be used only with the
+.B \-\-metadata
+option.
+
+
+.TP
+\fB\-\-new\-serial\fR, or
+.TP
+\fB\-\-new\-half\-serial\fR
+Set a new random serial number to the clone. The serial number is a 64
+bit number used to identify the device during the mounting process, so
+it has to be changed to enable the original file system
+and the clone to be mounted at the same time on the same computer.
+
+The option \fB\-\-new\-half\-serial\fP only changes the upper part of the
+serial number, keeping the lower part which is used by Windows unchanged.
+
+The options \fB\-\-new\-serial\fP and \fB\-\-new\-half\-serial\fP can
+only be used when cloning a file system of restoring from an image.
+
+The serial number is not the volume UUID used by Windows
+to locate files which have been moved to another volume.
+
+.TP
+\fB\-f\fR, \fB\-\-force\fR
+Forces ntfsclone to proceed if the filesystem is marked
+"dirty" for consistency check.
+.TP
+\fB\-q\fR, \fB\-\-quiet\fR
+Do not display any progress-bars during operation.
+.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.
+.SH EXAMPLES
+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:
+.RS
+.sp
+.B ntfsclone \-\-restore\-image \-\-overwrite /dev/hda1 backup.img
+.sp
+.RE
+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:
+.RS
+.sp
+.B gunzip \-c backup.img.gz | \\\\
+.br
+.B ntfsclone \-\-restore\-image \-\-overwrite /dev/hda1 \-
+.sp
+.RE
+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 | \\\\
+.br
+.B gzip \-c | ssh host 'cat > backup.img.gz'
+.sp
+.RE
+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 | \\\\
+.br
+.B ntfsclone \-\-restore\-image \-\-overwrite /dev/hda1 \-
+.sp
+.RE
+Stream an image file from a web server and restore it to a partition:
+.RS
+.sp
+.B wget \-qO \- http://server/backup.img | \\\\
+.br
+.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. Please note that bzip2 runs
+very long but results usually at least 10 times smaller archives
+than gzip on a sparse file.
+.RS
+.sp
+.B ntfsclone \-\-metadata \-\-output ntfsmeta.img /dev/hda1
+.br
+.B bzip2 ntfsmeta.img
+.sp
+Or, outputting to a compressed image :
+.br
+.B ntfsclone \-mst \-\-output - /dev/hda1 | bzip2 > ntfsmeta.bz2
+.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
+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:
+.nh
+ntfs\-3g\-devel@lists.sf.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
+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 AUTHORS
+.B ntfsclone
+was written by Szabolcs Szakacsits with contributions from Per Olofsson
+(special image format support) and Anton Altaparmakov.
+It was ported to ntfs-3g by Erik Larsson and Jean-Pierre Andre.
+.SH AVAILABILITY
+.B ntfsclone
+is part of the
+.B ntfs-3g
+package and is available at:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR ntfsresize (8)
+.BR ntfsprogs (8)
+.BR xfs_copy (8)
+.BR debugreiserfs (8)
+.BR e2image (8)
diff --git a/ntfsprogs/ntfsclone.8.in b/ntfsprogs/ntfsclone.8.in
new file mode 100755
index 0000000..223ef7f
--- a/dev/null
+++ b/ntfsprogs/ntfsclone.8.in
@@ -0,0 +1,391 @@
+.\" Copyright (c) 2003\-2005 Richard Russon.
+.\" 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 "February 2006" "ntfs-3g @VERSION@"
+.SH NAME
+ntfsclone \- Efficiently clone, image, restore or rescue an NTFS
+.SH SYNOPSIS
+.B ntfsclone
+[\fIOPTIONS\fR]
+.I SOURCE
+.br
+.B ntfsclone \-\-save\-image
+[\fIOPTIONS\fR]
+.I SOURCE
+.br
+.B ntfsclone \-\-restore\-image
+[\fIOPTIONS\fR]
+.I SOURCE
+.br
+.B ntfsclone \-\-metadata
+[\fIOPTIONS\fR]
+.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.
+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),
+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.
+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
+.sp
+.RE
+.SS Windows Cloning
+If you want to copy, move or restore a system or boot partition to another
+computer, or to a different disk or partition (e.g. hda1\->hda2, hda1\->hdb1
+or to a different disk sector offset) then you will need to take extra care.
+
+Usually, Windows will not be able to boot, unless you copy, move or restore
+NTFS to the same partition which starts at the same sector on the same type
+of disk having the same BIOS legacy cylinder setting as the original
+partition and disk had.
+
+The ntfsclone utility guarantees to make an exact copy of NTFS but it
+won't deal with booting issues. This is by design: ntfsclone is a
+filesystem, not system utility. Its aim is only NTFS cloning, not Windows
+cloning. Hereby ntfsclone can be used as a very fast and reliable
+build block for Windows cloning but itself it's not enough.
+.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
+.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.
+.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 (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.
+
+.BR bzip2 (1)
+compresses large sparse files much better than
+.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
+would be using
+.BR tar (1)
+with the options
+.B \-S
+(handle sparse files "efficiently") and
+.B \-j
+(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
+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. Even more sadly, using the \-S option results
+serious data loss since the end of 2004 and the GNU
+.BR tar
+maintainers didn't release 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.
+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.
+.SS Metadata\-only Cloning
+One of the features of
+.BR 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
+reading them back will result always zeros.
+
+The metadata\-only image can be compressed very
+well, usually to not more than 1\-8 MB thus it's 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
+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.
+This mode may be combined with \fB\-\-save\-image\fP to create a
+special image format file instead of a sparse file.
+
+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. Nearly all options have two equivalent names. The short name is
+preceded by
+.B \-
+and the long name is preceded by
+.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
+.B "\-f \-v" .
+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
+.IR FILE .
+If
+.I FILE
+is '\-' then clone to the
+standard output.
+.TP
+\fB\-O\fR, \fB\-\-overwrite\fR FILE
+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
+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
+argument. If the
+.I SOURCE
+is '\-' then the image is read from the standard input.
+.TP
+\fB\-n\fR, \fB\-\-no\-action\fR
+Test the consistency of a saved image by simulating its restoring without
+writing anything. The NTFS data contained in the image is not tested.
+The option \fB\-\-restore\-image\fR must also be present, and the options
+\fB\-\-output\fR and \fB\-\-overwrite\fR must be omitted.
+.TP
+\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
+beginning of such sectors are marked by "BadSectoR\\0".
+.TP
+\fB\-m\fR, \fB\-\-metadata\fR
+Clone
+.B ONLY METADATA
+(for NTFS experts). Only cloning to a (sparse) file is allowed, unless used
+the option \fB\-\-save\-image\fP is also used.
+You can't metadata\-only clone to a device.
+.TP
+\fB\-\-ignore\-fs\-check\fR
+Ignore the result of the filesystem consistency check. This option is allowed
+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\-t\fR, \fB\-\-preserve\-timestamps\fR
+Do not wipe the timestamps, to be used only with the
+.B \-\-metadata
+option.
+
+
+.TP
+\fB\-\-new\-serial\fR, or
+.TP
+\fB\-\-new\-half\-serial\fR
+Set a new random serial number to the clone. The serial number is a 64
+bit number used to identify the device during the mounting process, so
+it has to be changed to enable the original file system
+and the clone to be mounted at the same time on the same computer.
+
+The option \fB\-\-new\-half\-serial\fP only changes the upper part of the
+serial number, keeping the lower part which is used by Windows unchanged.
+
+The options \fB\-\-new\-serial\fP and \fB\-\-new\-half\-serial\fP can
+only be used when cloning a file system of restoring from an image.
+
+The serial number is not the volume UUID used by Windows
+to locate files which have been moved to another volume.
+
+.TP
+\fB\-f\fR, \fB\-\-force\fR
+Forces ntfsclone to proceed if the filesystem is marked
+"dirty" for consistency check.
+.TP
+\fB\-q\fR, \fB\-\-quiet\fR
+Do not display any progress-bars during operation.
+.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.
+.SH EXAMPLES
+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:
+.RS
+.sp
+.B ntfsclone \-\-restore\-image \-\-overwrite /dev/hda1 backup.img
+.sp
+.RE
+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:
+.RS
+.sp
+.B gunzip \-c backup.img.gz | \\\\
+.br
+.B ntfsclone \-\-restore\-image \-\-overwrite /dev/hda1 \-
+.sp
+.RE
+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 | \\\\
+.br
+.B gzip \-c | ssh host 'cat > backup.img.gz'
+.sp
+.RE
+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 | \\\\
+.br
+.B ntfsclone \-\-restore\-image \-\-overwrite /dev/hda1 \-
+.sp
+.RE
+Stream an image file from a web server and restore it to a partition:
+.RS
+.sp
+.B wget \-qO \- http://server/backup.img | \\\\
+.br
+.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. Please note that bzip2 runs
+very long but results usually at least 10 times smaller archives
+than gzip on a sparse file.
+.RS
+.sp
+.B ntfsclone \-\-metadata \-\-output ntfsmeta.img /dev/hda1
+.br
+.B bzip2 ntfsmeta.img
+.sp
+Or, outputting to a compressed image :
+.br
+.B ntfsclone \-mst \-\-output - /dev/hda1 | bzip2 > ntfsmeta.bz2
+.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
+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:
+.nh
+ntfs\-3g\-devel@lists.sf.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
+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 AUTHORS
+.B ntfsclone
+was written by Szabolcs Szakacsits with contributions from Per Olofsson
+(special image format support) and Anton Altaparmakov.
+It was ported to ntfs-3g by Erik Larsson and Jean-Pierre Andre.
+.SH AVAILABILITY
+.B ntfsclone
+is part of the
+.B ntfs-3g
+package and is available at:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR ntfsresize (8)
+.BR ntfsprogs (8)
+.BR xfs_copy (8)
+.BR debugreiserfs (8)
+.BR e2image (8)
diff --git a/ntfsprogs/ntfsclone.c b/ntfsprogs/ntfsclone.c
new file mode 100755
index 0000000..967dd95
--- a/dev/null
+++ b/ntfsprogs/ntfsclone.c
@@ -0,0 +1,2701 @@
+/**
+ * ntfsclone - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2003-2006 Szabolcs Szakacsits
+ * Copyright (c) 2004-2006 Anton Altaparmakov
+ * Copyright (c) 2010-2013 Jean-Pierre Andre
+ * Special image format support copyright (c) 2004 Per Olofsson
+ *
+ * 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
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+
+#include "config.h"
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+#ifdef HAVE_SYS_IOCTL_H
+#include <sys/ioctl.h>
+#endif
+#ifdef HAVE_SYS_VFS_H
+#include <sys/vfs.h>
+#endif
+#ifdef HAVE_SYS_STATVFS_H
+#include <sys/statvfs.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+/*
+ * FIXME: ntfsclone do bad things about endians handling. Fix it and remove
+ * this note and define.
+ */
+#define NTFS_DO_NOT_CHECK_ENDIANS
+
+#include "debug.h"
+#include "types.h"
+#include "support.h"
+#include "endians.h"
+#include "bootsect.h"
+#include "device.h"
+#include "attrib.h"
+#include "mst.h"
+#include "volume.h"
+#include "mft.h"
+#include "bitmap.h"
+#include "inode.h"
+#include "index.h"
+#include "dir.h"
+#include "runlist.h"
+#include "ntfstime.h"
+#include "utils.h"
+/* #include "version.h" */
+#include "misc.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
+
+#if defined(linux) || defined(__uClinux__) || defined(__sun) \
+ || defined(__APPLE__) || defined(__DARWIN__)
+ /* Make sure the presence of <windows.h> means compiling for Windows */
+#undef HAVE_WINDOWS_H
+#endif
+
+#if defined(__sun) | defined(HAVE_WINDOWS_H)
+#define NO_STATFS 1 /* statfs(2) and f_type are not universal */
+#endif
+
+#ifdef HAVE_WINDOWS_H
+/*
+ * Replacements for functions which do not exist on Windows
+ */
+int setmode(int, int); /* from msvcrt.dll */
+
+#define getpid() (0)
+#define srandom(seed) srand(seed)
+#define random() rand()
+#define fsync(fd) (0)
+#define ioctl(fd,code,buf) (0)
+#define ftruncate(fd, size) ntfs_device_win32_ftruncate(dev_out, size)
+#define BINWMODE "wb"
+#else
+#define BINWMODE "w"
+#endif
+
+#ifndef O_BINARY
+#define O_BINARY 0
+#endif
+
+static const char *EXEC_NAME = "ntfsclone";
+
+static const char *bad_sectors_warning_msg =
+"*************************************************************************\n"
+"* WARNING: The disk has one or more bad sectors. This means that damage *\n"
+"* has occurred on the disk surface, possibly caused by deterioration of *\n"
+"* the physical media, manufacturing faults or other reasons. The *\n"
+"* 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";
+
+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";
+
+static struct {
+ int verbose;
+ int quiet;
+ int debug;
+ int force;
+ int overwrite;
+ int std_out;
+ int blkdev_out; /* output file is block device */
+ int metadata; /* metadata only cloning */
+ int no_action; /* do not really restore */
+ int ignore_fs_check;
+ int rescue;
+ int save_image;
+ int new_serial;
+ int metadata_image;
+ int preserve_timestamps;
+ int restore_image;
+ char *output;
+ char *volume;
+#ifndef NO_STATFS
+ struct statfs stfs;
+#endif
+} opt;
+
+struct bitmap {
+ s64 size;
+ u8 *bm;
+};
+
+struct progress_bar {
+ u64 start;
+ u64 stop;
+ int resolution;
+ float unit;
+};
+
+typedef struct {
+ ntfs_inode *ni; /* inode being processed */
+ ntfs_attr_search_ctx *ctx; /* inode attribute being processed */
+ s64 inuse; /* number of clusters in use */
+ int more_use; /* possibly allocated clusters */
+ LCN current_lcn;
+} 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;
+};
+
+
+static ntfs_volume *vol = NULL;
+static struct bitmap lcn_bitmap;
+
+static int fd_in;
+static int fd_out;
+static FILE *stream_out = (FILE*)NULL;
+struct ntfs_device *dev_out = (struct ntfs_device*)NULL;
+static FILE *msg_out = NULL;
+
+static int wipe = 0;
+static unsigned int nr_used_mft_records = 0;
+static unsigned int wiped_unused_mft_data = 0;
+static unsigned int wiped_unused_mft = 0;
+static unsigned int wiped_resident_data = 0;
+static unsigned int wiped_timestamp_data = 0;
+
+static le64 volume_serial_number; /* new random serial number */
+static u64 full_device_size; /* full size, including the backup boot sector */
+
+static BOOL image_is_host_endian = FALSE;
+
+#define IMAGE_MAGIC "\0ntfsclone-image"
+#define IMAGE_MAGIC_SIZE 16
+#define IMAGE_OFFSET_OFFSET 46 /* must be the same for all versions ! */
+#define IMAGE_HDR_ALIGN 8 /* alignment wanted after header */
+
+/* This is the first endianness safe format version. */
+#define NTFSCLONE_IMG_VER_MAJOR_ENDIANNESS_SAFE 10
+#define NTFSCLONE_IMG_VER_MINOR_ENDIANNESS_SAFE 0
+
+/*
+ * Set the version to 10.0 to avoid colisions with old ntfsclone which
+ * stupidly used the volume version as the image version... )-: I hope NTFS
+ * never reaches version 10.0 and if it does one day I hope no-one is using
+ * such an old ntfsclone by then...
+ *
+ * NOTE: Only bump the minor version if the image format and header are still
+ * backwards compatible. Otherwise always bump the major version. If in
+ * doubt, bump the major version.
+ *
+ * Moved to 10.1 : Alternate boot sector now saved. Still compatible.
+ */
+#define NTFSCLONE_IMG_VER_MAJOR 10
+#define NTFSCLONE_IMG_VER_MINOR 1
+
+enum { CMD_GAP, CMD_NEXT } ;
+
+/* All values are in little endian. */
+static struct image_hdr {
+ char magic[IMAGE_MAGIC_SIZE];
+ u8 major_ver;
+ u8 minor_ver;
+ /* the following is aligned dangerously (too late...) */
+ le32 cluster_size;
+ le64 device_size;
+ sle64 nr_clusters;
+ le64 inuse;
+ le32 offset_to_image_data; /* From start of image_hdr. */
+} __attribute__((__packed__)) image_hdr;
+
+static int compare_bitmaps(struct bitmap *a, BOOL copy);
+
+#define NTFSCLONE_IMG_HEADER_SIZE_OLD \
+ (offsetof(struct image_hdr, offset_to_image_data))
+
+#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 NTFS_SECTOR_SIZE 512
+
+#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)
+
+__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, ...)
+{
+ 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);
+}
+
+__attribute__((format(printf, 1, 2)))
+static 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);
+}
+
+__attribute__((noreturn))
+__attribute__((format(printf, 1, 2)))
+static void 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);
+ if (vol)
+ ntfs_umount(vol,FALSE);
+ exit(1);
+}
+
+__attribute__((noreturn))
+__attribute__((format(printf, 1, 2)))
+static void 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);
+ if (vol)
+ ntfs_umount(vol,FALSE);
+ exit(1);
+}
+
+
+__attribute__((noreturn))
+static void usage(void)
+{
+ 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"
+ " -O, --overwrite FILE Clone NTFS to FILE, overwriting if exists\n"
+ " -s, --save-image Save to the special image format\n"
+ " -r, --restore-image Restore from the special image format\n"
+ " --rescue Continue after disk read errors\n"
+ " -m, --metadata Clone *only* metadata (for NTFS experts)\n"
+ " -n, --no-action Test restoring, without outputting anything\n"
+ " --ignore-fs-check Ignore the filesystem check result\n"
+ " --new-serial Set a new serial number\n"
+ " --new-half-serial Set a partial new serial number\n"
+ " -t, --preserve-timestamps Do not clear the timestamps\n"
+ " -q, --quiet Do not display any progress bars\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 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);
+ fprintf(stderr, "%s%s", ntfs_bugs, ntfs_home);
+ exit(1);
+}
+
+static void parse_options(int argc, char **argv)
+{
+ static const char *sopt = "-dfhmno:O:qrst";
+ static const struct option lopt[] = {
+#ifdef DEBUG
+ { "debug", no_argument, NULL, 'd' },
+#endif
+ { "quiet", no_argument, NULL, 'q' },
+ { "force", no_argument, NULL, 'f' },
+ { "help", no_argument, NULL, 'h' },
+ { "metadata", no_argument, NULL, 'm' },
+ { "no-action", no_argument, NULL, 'n' },
+ { "output", required_argument, NULL, 'o' },
+ { "overwrite", required_argument, NULL, 'O' },
+ { "restore-image", no_argument, NULL, 'r' },
+ { "ignore-fs-check", no_argument, NULL, 'C' },
+ { "rescue", no_argument, NULL, 'R' },
+ { "new-serial", no_argument, NULL, 'I' },
+ { "new-half-serial", no_argument, NULL, 'i' },
+ { "save-image", no_argument, NULL, 's' },
+ { "preserve-timestamps", no_argument, NULL, 't' },
+ { NULL, 0, NULL, 0 }
+ };
+
+ int 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 'q':
+ opt.quiet++;
+ break;
+ case 'f':
+ opt.force++;
+ break;
+ case 'h':
+ case '?':
+ usage();
+ case 'i': /* not proposed as a short option */
+ opt.new_serial |= 1;
+ break;
+ case 'I': /* not proposed as a short option */
+ opt.new_serial |= 2;
+ break;
+ case 'm':
+ opt.metadata++;
+ break;
+ case 'n':
+ opt.no_action++;
+ break;
+ case 'O':
+ opt.overwrite++;
+ case 'o':
+ if (opt.output)
+ usage();
+ opt.output = optarg;
+ break;
+ case 'r':
+ opt.restore_image++;
+ break;
+ case 'C':
+ opt.ignore_fs_check++;
+ break;
+ case 'R':
+ opt.rescue++;
+ break;
+ case 's':
+ opt.save_image++;
+ break;
+ case 't':
+ opt.preserve_timestamps++;
+ break;
+ default:
+ err_printf("Unknown option '%s'.\n", argv[optind-1]);
+ usage();
+ }
+ }
+
+ if (!opt.no_action && (opt.output == NULL)) {
+ err_printf("You must specify an output file.\n");
+ usage();
+ }
+
+ if (!opt.no_action && (strcmp(opt.output, "-") == 0))
+ opt.std_out++;
+
+ if (opt.volume == NULL) {
+ err_printf("You must specify a device file.\n");
+ usage();
+ }
+
+ if (!opt.restore_image && !strcmp(opt.volume, "-")) {
+ err_printf("Only special images can be read from standard input\n");
+ usage();
+ }
+
+ if (opt.metadata && opt.save_image) {
+ opt.metadata_image++;
+ opt.save_image = 0;
+ }
+
+ if (opt.metadata && opt.restore_image)
+ err_exit("Restoring only metadata from an image is not "
+ "supported!\n");
+
+ if (opt.metadata && !opt.metadata_image && opt.std_out)
+ err_exit("Cloning only metadata to stdout isn't supported!\n");
+
+ if (opt.ignore_fs_check && !opt.metadata && !opt.rescue)
+ err_exit("Filesystem check can be ignored only for metadata "
+ "cloning or rescue situations!\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.no_action && !opt.restore_image)
+ err_exit("A restoring test requires the restore option!\n");
+
+ if (opt.no_action && opt.output)
+ err_exit("A restoring test requires not defining any output!\n");
+
+ if (!opt.no_action && !opt.std_out) {
+ struct stat st;
+#ifdef HAVE_WINDOWS_H
+ BOOL blkdev = opt.output[0] && (opt.output[1] == ':')
+ && !opt.output[2];
+
+ if (!blkdev && (stat(opt.output, &st) == -1)) {
+#else
+ if (stat(opt.output, &st) == -1) {
+#endif
+ 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);
+
+#ifdef HAVE_WINDOWS_H
+ if (blkdev) {
+#else
+ if (S_ISBLK(st.st_mode)) {
+#endif
+ opt.blkdev_out = 1;
+ if (opt.metadata && !opt.force)
+ err_exit("Cloning only metadata to a "
+ "block device does not usually "
+ "make sense, aborting...\n"
+ "If you were instructed to do "
+ "this by a developer and/or are "
+ "sure that this is what you want "
+ "to do, run this utility again "
+ "but this time add the force "
+ "option, i.e. add '--force' to "
+ "the command line arguments.");
+ }
+ }
+ }
+
+ /*
+ * Send messages, debug information and library messages to stdout,
+ * but, if outputing to stdout send them to stderr
+ */
+ if (opt.std_out) {
+ msg_out = stderr;
+ ntfs_log_set_handler(ntfs_log_handler_stderr);
+ } else {
+ msg_out = stdout;
+ ntfs_log_set_handler(ntfs_log_handler_outerr);
+ }
+}
+
+/*
+ * Initialize the random number generator with the current
+ * time, and generate a 64-bit random number for the serial
+ * number
+ */
+static void generate_serial_number(void) {
+ u64 sn;
+
+ /* different values for parallel processes */
+ srandom(time((time_t*)NULL) ^ (getpid() << 16));
+ sn = ((u64)random() << 32) | ((u64)random() & 0xffffffff);
+ volume_serial_number = cpu_to_le64(sn);
+}
+
+static 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;
+}
+
+
+static void progress_update(struct progress_bar *p, u64 current)
+{
+ float percent = p->unit * current;
+
+ if (opt.quiet)
+ return;
+
+ 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);
+}
+
+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;
+
+ if (image->ctx->attr->type == AT_DATA) {
+
+ /* 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)
+ s = rl->length;
+ return s;
+ }
+ return 0;
+ }
+ }
+
+ if (image->ctx->attr->type != AT_DATA)
+ return rl->length;
+
+ return 0;
+}
+
+static off_t tellin(int in)
+{
+ return (lseek(in, 0, SEEK_CUR));
+}
+
+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) {
+ if (opt.no_action) {
+ i = count;
+ } else {
+ if (opt.save_image || opt.metadata_image)
+ i = fwrite(buf, 1, count, stream_out);
+#ifdef HAVE_WINDOWS_H
+ else if (dev_out)
+ i = dev_out->d_ops->write(dev_out,
+ buf, count);
+#endif
+ else
+ 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) {
+ if (errno != EAGAIN && errno != EINTR)
+ return -1;
+ } else if (i == 0 && !do_write && opt.restore_image) {
+ return -1;
+ } else {
+ count -= i;
+ buf = i + (char *) buf;
+ }
+ }
+ return 0;
+}
+
+
+static void rescue_sector(void *fd, u32 bytes_per_sector, off_t pos, void *buff)
+{
+ const char badsector_magic[] = "BadSectoR";
+ struct ntfs_device *dev = fd;
+
+ if (opt.restore_image) {
+ if (!opt.no_action
+ && (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, bytes_per_sector) == -1) {
+ Printf("WARNING: Can't read sector at %llu, lost data.\n",
+ (unsigned long long)pos);
+ memset(buff, '?', bytes_per_sector);
+ memmove(buff, badsector_magic, sizeof(badsector_magic));
+ }
+}
+
+/*
+ * Read a cluster, try to rescue if cannot read
+ */
+
+static void read_rescue(void *fd, char *buff, u32 csize, u32 bytes_per_sector,
+ u64 rescue_lcn)
+{
+ off_t rescue_pos;
+
+ if (read_all(fd, buff, csize) == -1) {
+
+ if (errno != EIO)
+ perr_exit("read_all");
+ else if (opt.rescue){
+ u32 i;
+
+ rescue_pos = (off_t)(rescue_lcn * csize);
+ for (i = 0; i < csize; i += bytes_per_sector)
+ rescue_sector(fd, bytes_per_sector,
+ rescue_pos + i, buff + i);
+ } else {
+ Printf("%s", bad_sectors_warning_msg);
+ err_exit("Disk is faulty, can't make full backup!");
+ }
+ }
+}
+
+static void copy_cluster(int rescue, u64 rescue_lcn, u64 lcn)
+{
+ char buff[NTFS_MAX_CLUSTER_SIZE]; /* overflow checked at mount time */
+ /* vol is NULL if opt.restore_image is set */
+ s32 csize = le32_to_cpu(image_hdr.cluster_size);
+ BOOL backup_bootsector;
+ void *fd = (void *)&fd_in;
+ off_t rescue_pos;
+ NTFS_BOOT_SECTOR *bs;
+ le64 mask;
+ static u16 bytes_per_sector = NTFS_SECTOR_SIZE;
+
+ if (!opt.restore_image) {
+ csize = vol->cluster_size;
+ bytes_per_sector = vol->sector_size;
+ fd = vol->dev;
+ }
+
+ rescue_pos = (off_t)(rescue_lcn * csize);
+
+ /* possible partial cluster holding the backup boot sector */
+ backup_bootsector = (lcn + 1)*csize >= full_device_size;
+ if (backup_bootsector) {
+ csize = full_device_size - lcn*csize;
+ if (csize < 0) {
+ err_exit("Corrupted input, copy aborted");
+ }
+ }
+
+// need reading when not about to write ?
+ if (read_all(fd, buff, csize) == -1) {
+
+ if (errno != EIO) {
+ if (!errno && opt.restore_image)
+ err_exit("Short image file...\n");
+ else
+ perr_exit("read_all");
+ }
+ else if (rescue){
+ s32 i;
+ for (i = 0; i < csize; i += bytes_per_sector)
+ rescue_sector(fd, bytes_per_sector,
+ rescue_pos + i, buff + i);
+ } else {
+ Printf("%s", bad_sectors_warning_msg);
+ err_exit("Disk is faulty, can't make full backup!");
+ }
+ }
+
+ /* Set the new serial number if requested */
+ if (opt.new_serial
+ && !opt.save_image
+ && (!lcn || backup_bootsector)) {
+ /*
+ * For updating the backup boot sector, we need to
+ * know the sector size, but this is not recorded
+ * in the image header, so we collect it on the fly
+ * while reading the first boot sector.
+ */
+ if (!lcn) {
+ bs = (NTFS_BOOT_SECTOR*)buff;
+ bytes_per_sector = le16_to_cpu(bs->bpb.bytes_per_sector);
+ if ((bytes_per_sector > csize)
+ || (bytes_per_sector < NTFS_SECTOR_SIZE))
+ bytes_per_sector = NTFS_SECTOR_SIZE;
+ } else
+ bs = (NTFS_BOOT_SECTOR*)(buff
+ + csize - bytes_per_sector);
+ if (opt.new_serial & 2)
+ bs->volume_serial_number = volume_serial_number;
+ else {
+ mask = const_cpu_to_le64(~0x0ffffffffULL);
+ bs->volume_serial_number
+ = (volume_serial_number & mask)
+ | (bs->volume_serial_number & ~mask);
+ }
+ /* Show the new full serial after merging */
+ if (!lcn)
+ Printf("New serial number : 0x%llx\n",
+ (long long)le64_to_cpu(
+ bs->volume_serial_number));
+ }
+
+ if (opt.save_image || (opt.metadata_image && wipe)) {
+ char cmd = CMD_NEXT;
+ if (write_all(&fd_out, &cmd, sizeof(cmd)) == -1)
+ perr_exit("write_all");
+ }
+
+ if ((!opt.metadata_image || wipe)
+ && (write_all(&fd_out, buff, csize) == -1)) {
+#ifndef NO_STATFS
+ 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);
+#else
+ perr_printf("Write failed");
+#endif
+ }
+}
+
+static s64 lseek_out(int fd, s64 pos, int mode)
+{
+ s64 ret;
+
+ if (dev_out)
+ ret = (dev_out->d_ops->seek)(dev_out, pos, mode);
+ else
+ ret = lseek(fd, pos, mode);
+ return (ret);
+}
+
+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");
+
+ if (opt.std_out || opt.save_image || opt.metadata_image)
+ return;
+
+ if (lseek_out(fd_out, pos, SEEK_SET) == (off_t)-1)
+ perr_exit("lseek output");
+}
+
+static void gap_to_cluster(s64 gap)
+{
+ sle64 count;
+ char buf[1 + sizeof(count)];
+
+ if (gap) {
+ count = cpu_to_sle64(gap);
+ buf[0] = CMD_GAP;
+ memcpy(&buf[1], &count, sizeof(count));
+ if (write_all(&fd_out, buf, sizeof(buf)) == -1)
+ perr_exit("write_all");
+ }
+}
+
+static void image_skip_clusters(s64 count)
+{
+ if (opt.save_image && count > 0) {
+ s64 count_buf;
+ char buff[1 + sizeof(count)];
+
+ buff[0] = CMD_GAP;
+ count_buf = cpu_to_sle64(count);
+ memcpy(buff + 1, &count_buf, sizeof(count_buf));
+
+ if (write_all(&fd_out, buff, sizeof(buff)) == -1)
+ perr_exit("write_all");
+ }
+}
+
+static void write_image_hdr(void)
+{
+ char alignment[IMAGE_HDR_ALIGN];
+
+ if (opt.save_image || opt.metadata_image) {
+ int alignsize = le32_to_cpu(image_hdr.offset_to_image_data)
+ - sizeof(image_hdr);
+ memset(alignment,0,IMAGE_HDR_ALIGN);
+ if ((alignsize < 0)
+ || write_all(&fd_out, &image_hdr, sizeof(image_hdr))
+ || write_all(&fd_out, alignment, alignsize))
+ perr_exit("write_all");
+ }
+}
+
+static void clone_ntfs(u64 nr_clusters, int more_use)
+{
+ u64 cl, last_cl; /* current and last used cluster */
+ void *buf;
+ u32 csize = vol->cluster_size;
+ u64 p_counter = 0;
+ char alignment[IMAGE_HDR_ALIGN];
+ struct progress_bar progress;
+
+ if (opt.save_image)
+ Printf("Saving NTFS to image ...\n");
+ else
+ Printf("Cloning NTFS ...\n");
+
+ if (opt.new_serial)
+ generate_serial_number();
+
+ buf = ntfs_calloc(csize);
+ if (!buf)
+ perr_exit("clone_ntfs");
+
+ progress_init(&progress, p_counter, nr_clusters, 100);
+
+ if (opt.save_image) {
+ int alignsize = le32_to_cpu(image_hdr.offset_to_image_data)
+ - sizeof(image_hdr);
+ memset(alignment,0,IMAGE_HDR_ALIGN);
+ if ((alignsize < 0)
+ || write_all(&fd_out, &image_hdr, sizeof(image_hdr))
+ || write_all(&fd_out, alignment, alignsize))
+ perr_exit("write_all");
+ }
+
+ /* save suspicious clusters if required */
+ if (more_use && opt.ignore_fs_check) {
+ compare_bitmaps(&lcn_bitmap, TRUE);
+ }
+ /* Examine up to the alternate boot sector */
+ 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, 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)
+ perr_exit("write_all");
+ }
+ }
+ image_skip_clusters(cl - last_cl - 1);
+ free(buf);
+}
+
+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 = le32_to_cpu(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 ?
+ sle64_to_cpu(image_hdr.nr_clusters) + 1 :
+ sle64_to_cpu(image_hdr.inuse) + 1,
+ 100);
+
+ if (opt.new_serial)
+ generate_serial_number();
+
+ /* Restore up to the alternate boot sector */
+ while (pos <= sle64_to_cpu(image_hdr.nr_clusters)) {
+ if (read_all(&fd_in, &cmd, sizeof(cmd)) == -1) {
+ if (pos == sle64_to_cpu(image_hdr.nr_clusters)) {
+ /* alternate boot sector no present in old images */
+ Printf("Warning : no alternate boot"
+ " sector in image\n");
+ break;
+ } else
+ perr_exit("read_all");
+ }
+
+ if (cmd == CMD_GAP) {
+ if (!image_is_host_endian) {
+ le64 lecount;
+
+ /* little endian image, on any computer */
+ if (read_all(&fd_in, &lecount,
+ sizeof(lecount)) == -1)
+ perr_exit("read_all");
+ count = sle64_to_cpu(lecount);
+ } else {
+ /* big endian image on big endian computer */
+ if (read_all(&fd_in, &count,
+ sizeof(count)) == -1)
+ perr_exit("read_all");
+ }
+ if (!count)
+ err_exit("Bad offset at input location 0x%llx\n",
+ (long long)tellin(fd_in) - 9);
+ if (opt.std_out) {
+ if ((!p_counter && count) || (count < 0))
+ err_exit("Cannot restore a metadata"
+ " image to stdout\n");
+ else
+ write_empty_clusters(csize, count,
+ &progress, &p_counter);
+ } else {
+ if (((pos + count) < 0)
+ || ((pos + count)
+ > sle64_to_cpu(image_hdr.nr_clusters)))
+ err_exit("restore_image: corrupt image "
+ "at input offset %lld\n",
+ (long long)tellin(fd_in) - 9);
+ else {
+ if (!opt.no_action
+ && (lseek_out(fd_out, count * csize,
+ SEEK_CUR) == (off_t)-1))
+ perr_exit("restore_image: lseek");
+ }
+ }
+ pos += count;
+ } else if (cmd == CMD_NEXT) {
+ copy_cluster(0, 0, pos);
+ pos++;
+ progress_update(&progress, ++p_counter);
+ } else
+ err_exit("Invalid command code %d at input offset 0x%llx\n",
+ cmd, (long long)tellin(fd_in) - 1);
+ }
+}
+
+static void wipe_index_entry_timestams(INDEX_ENTRY *e)
+{
+ static const struct timespec zero_time = { .tv_sec = 0, .tv_nsec = 0 };
+ le64 timestamp = timespec2ntfs(zero_time);
+
+ /* FIXME: can fall into infinite loop if corrupted */
+ while (!(e->ie_flags & INDEX_ENTRY_END)) {
+
+ e->key.file_name.creation_time = timestamp;
+ e->key.file_name.last_data_change_time = timestamp;
+ e->key.file_name.last_mft_change_time = timestamp;
+ e->key.file_name.last_access_time = timestamp;
+
+ wiped_timestamp_data += 32;
+
+ e = (INDEX_ENTRY *)((u8 *)e + le16_to_cpu(e->length));
+ }
+}
+
+static void wipe_index_allocation_timestamps(ntfs_inode *ni, ATTR_RECORD *attr)
+{
+ INDEX_ALLOCATION *indexa, *tmp_indexa;
+ INDEX_ENTRY *entry;
+ INDEX_ROOT *indexr;
+ u8 *bitmap, *byte;
+ int bit;
+ ntfs_attr *na;
+ ntfschar *name;
+ u32 name_len;
+
+ indexr = ntfs_index_root_get(ni, attr);
+ if (!indexr) {
+ perr_printf("Failed to read $INDEX_ROOT attribute of inode "
+ "%lld", (long long)ni->mft_no);
+ return;
+ }
+
+ if (indexr->type != AT_FILE_NAME)
+ goto out_indexr;
+
+ name = (ntfschar *)((u8 *)attr + le16_to_cpu(attr->name_offset));
+ name_len = attr->name_length;
+
+ byte = bitmap = ntfs_attr_readall(ni, AT_BITMAP, name, name_len,
+ NULL);
+ if (!byte) {
+ perr_printf("Failed to read $BITMAP attribute");
+ goto out_indexr;
+ }
+
+ na = ntfs_attr_open(ni, AT_INDEX_ALLOCATION, name, name_len);
+ if (!na) {
+ perr_printf("Failed to open $INDEX_ALLOCATION attribute");
+ goto out_bitmap;
+ }
+
+ if (!na->data_size)
+ goto out_na;
+
+ tmp_indexa = indexa = ntfs_malloc(na->data_size);
+ if (!tmp_indexa)
+ goto out_na;
+
+ if (ntfs_attr_pread(na, 0, na->data_size, indexa) != na->data_size) {
+ perr_printf("Failed to read $INDEX_ALLOCATION attribute");
+ goto out_indexa;
+ }
+
+ bit = 0;
+ while ((u8 *)tmp_indexa < (u8 *)indexa + na->data_size) {
+ if (*byte & (1 << bit)) {
+ if (ntfs_mst_post_read_fixup((NTFS_RECORD *)tmp_indexa,
+ le32_to_cpu(
+ indexr->index_block_size))) {
+ perr_printf("Damaged INDX record");
+ goto out_indexa;
+ }
+ entry = (INDEX_ENTRY *)((u8 *)tmp_indexa + le32_to_cpu(
+ tmp_indexa->index.entries_offset) + 0x18);
+
+ wipe_index_entry_timestams(entry);
+
+ if (ntfs_mft_usn_dec((MFT_RECORD *)tmp_indexa))
+ perr_exit("ntfs_mft_usn_dec");
+
+ if (ntfs_mst_pre_write_fixup((NTFS_RECORD *)tmp_indexa,
+ le32_to_cpu(
+ indexr->index_block_size))) {
+ perr_printf("INDX write fixup failed");
+ goto out_indexa;
+ }
+ }
+ tmp_indexa = (INDEX_ALLOCATION *)((u8 *)tmp_indexa +
+ le32_to_cpu(indexr->index_block_size));
+ bit++;
+ if (bit > 7) {
+ bit = 0;
+ byte++;
+ }
+ }
+ if (ntfs_rl_pwrite(vol, na->rl, 0, 0, na->data_size, indexa) != na->data_size)
+ perr_printf("ntfs_rl_pwrite failed for inode %lld",
+ (long long)ni->mft_no);
+out_indexa:
+ free(indexa);
+out_na:
+ ntfs_attr_close(na);
+out_bitmap:
+ free(bitmap);
+out_indexr:
+ free(indexr);
+}
+
+static void wipe_index_root_timestamps(ATTR_RECORD *attr, le64 timestamp)
+{
+ 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->ie_flags & INDEX_ENTRY_END)) {
+
+ if (iroot->type == AT_FILE_NAME) {
+
+ entry->key.file_name.creation_time = timestamp;
+ entry->key.file_name.last_access_time = timestamp;
+ entry->key.file_name.last_data_change_time = timestamp;
+ entry->key.file_name.last_mft_change_time = timestamp;
+
+ wiped_timestamp_data += 32;
+
+ } 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, CASE_SENSITIVE, NULL, 0)) {
+
+ QUOTA_CONTROL_ENTRY *quota_q;
+
+ quota_q = (QUOTA_CONTROL_ENTRY *)((u8 *)entry +
+ le16_to_cpu(entry->data_offset));
+ /*
+ * FIXME: no guarantee it's indeed /$Extend/$Quota:$Q.
+ * For now, as a minimal safeguard, we check only for
+ * quota version 2 ...
+ */
+ if (le32_to_cpu(quota_q->version) == 2) {
+ quota_q->change_time = timestamp;
+ wiped_timestamp_data += 4;
+ }
+ }
+
+ entry = (INDEX_ENTRY*)((u8*)entry + le16_to_cpu(entry->length));
+ }
+}
+
+#define WIPE_TIMESTAMPS(atype, attr, timestamp) \
+do { \
+ atype *ats; \
+ ats = (atype *)((char *)(attr) + le16_to_cpu((attr)->value_offset)); \
+ \
+ ats->creation_time = (timestamp); \
+ ats->last_data_change_time = (timestamp); \
+ ats->last_mft_change_time= (timestamp); \
+ ats->last_access_time = (timestamp); \
+ \
+ wiped_timestamp_data += 32; \
+ \
+} while (0)
+
+static void wipe_timestamps(ntfs_walk_clusters_ctx *image)
+{
+ static const struct timespec zero_time = { .tv_sec = 0, .tv_nsec = 0 };
+ ATTR_RECORD *a = image->ctx->attr;
+ le64 timestamp = timespec2ntfs(zero_time);
+
+ if (a->type == AT_FILE_NAME)
+ WIPE_TIMESTAMPS(FILE_NAME_ATTR, a, timestamp);
+
+ else if (a->type == AT_STANDARD_INFORMATION)
+ WIPE_TIMESTAMPS(STANDARD_INFORMATION, a, timestamp);
+
+ else if (a->type == AT_INDEX_ROOT)
+ wipe_index_root_timestamps(a, timestamp);
+}
+
+static void wipe_resident_data(ntfs_walk_clusters_ctx *image)
+{
+ ATTR_RECORD *a;
+ u32 i;
+ int n = 0;
+ u8 *p;
+
+ 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 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;
+}
+
+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);
+}
+
+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);
+}
+
+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);
+
+ if ((lcn + 1) != image->current_lcn) {
+ /* do not duplicate a cluster */
+ if (opt.metadata_image && wipe)
+ gap_to_cluster(lcn - image->current_lcn);
+
+ copy_cluster(opt.rescue, lcn, lcn);
+ }
+ image->current_lcn = lcn + 1;
+ if (opt.metadata_image && !wipe)
+ image->inuse++;
+
+ if (offset == 0)
+ offset = NTFS_BLOCK_SIZE >> 1;
+ else
+ offset <<= 1;
+ }
+}
+
+/*
+ * In-memory wiping of MFT record or MFTMirr record
+ * (only for metadata images)
+ *
+ * The resident data and (optionally) the timestamps are wiped.
+ */
+
+static void wipe_mft(char *mrec, u32 mrecsz, u64 mft_no)
+{
+ ntfs_walk_clusters_ctx image;
+ ntfs_attr_search_ctx *ctx;
+ ntfs_inode ni;
+
+ ni.mft_no = mft_no;
+ ni.mrec = (MFT_RECORD*)mrec;
+ ni.vol = vol; /* Hmm */
+ image.ni = &ni;
+ ntfs_mst_post_read_fixup_warn((NTFS_RECORD*)mrec,mrecsz,FALSE);
+ wipe_unused_mft_data(&ni);
+ if (!(((MFT_RECORD*)mrec)->flags & MFT_RECORD_IN_USE)) {
+ wipe_unused_mft(&ni);
+ } else {
+ /* ctx with no ntfs_inode prevents from searching external attrs */
+ if (!(ctx = ntfs_attr_get_search_ctx((ntfs_inode*)NULL, (MFT_RECORD*)mrec)))
+ perr_exit("ntfs_get_attr_search_ctx");
+
+ while (!ntfs_attr_lookup(AT_UNUSED, NULL, 0, CASE_SENSITIVE, 0,
+ NULL, 0, ctx)) {
+ if (ctx->attr->type == AT_END)
+ break;
+
+ image.ctx = ctx;
+ if (!ctx->attr->non_resident
+ && (mft_no > LAST_METADATA_INODE))
+ wipe_resident_data(&image);
+ if (!opt.preserve_timestamps)
+ wipe_timestamps(&image);
+ }
+ ntfs_attr_put_search_ctx(ctx);
+ }
+ ntfs_mft_usn_dec((MFT_RECORD*)mrec);
+ ntfs_mst_pre_write_fixup((NTFS_RECORD*)mrec,mrecsz);
+}
+
+/*
+ * In-memory wiping of a directory record (I30)
+ * (only for metadata images)
+ *
+ * The timestamps are (optionally) wiped
+ */
+
+static void wipe_indx(char *mrec, u32 mrecsz)
+{
+ INDEX_ENTRY *entry;
+ INDEX_ALLOCATION *indexa;
+
+ if (ntfs_mst_post_read_fixup((NTFS_RECORD *)mrec, mrecsz)) {
+ perr_printf("Damaged INDX record");
+ goto out_indexa;
+ }
+ indexa = (INDEX_ALLOCATION*)mrec;
+ /*
+ * The index bitmap is not checked, obsoleted records are
+ * wiped if they pass the safety checks
+ */
+ if ((indexa->magic == magic_INDX)
+ && (le32_to_cpu(indexa->index.entries_offset) >= sizeof(INDEX_HEADER))
+ && (le32_to_cpu(indexa->index.allocated_size) <= mrecsz)) {
+ entry = (INDEX_ENTRY *)((u8 *)mrec + le32_to_cpu(
+ indexa->index.entries_offset) + 0x18);
+ wipe_index_entry_timestams(entry);
+ }
+
+ if (ntfs_mft_usn_dec((MFT_RECORD *)mrec))
+ perr_exit("ntfs_mft_usn_dec");
+
+ if (ntfs_mst_pre_write_fixup((NTFS_RECORD *)mrec, mrecsz)) {
+ perr_printf("INDX write fixup failed");
+ goto out_indexa;
+ }
+out_indexa : ;
+}
+
+/*
+ * Output a set of related clusters (MFT record or index block)
+ */
+
+static void write_set(char *buff, u32 csize, s64 *current_lcn,
+ runlist_element *rl, u32 wi, u32 wj, u32 cnt)
+{
+ u32 k;
+ s64 target_lcn;
+ char cmd = CMD_NEXT;
+
+ for (k=0; k<cnt; k++) {
+ target_lcn = rl[wi].lcn + wj;
+ if (target_lcn != *current_lcn)
+ gap_to_cluster(target_lcn - *current_lcn);
+ if ((write_all(&fd_out, &cmd, sizeof(cmd)) == -1)
+ || (write_all(&fd_out, &buff[k*csize], csize) == -1))
+ perr_exit("Failed to write_all");
+ *current_lcn = target_lcn + 1;
+
+ if (++wj >= rl[wi].length) {
+ wj = 0;
+ wi++;
+ }
+ }
+}
+
+/*
+ * Copy and wipe the full MFT or MFTMirr data.
+ * (only for metadata images)
+ *
+ * Data are read and written by full clusters, but the wiping is done
+ * per MFT record.
+ */
+
+static void copy_wipe_mft(ntfs_walk_clusters_ctx *image, runlist *rl)
+{
+ char buff[NTFS_MAX_CLUSTER_SIZE]; /* overflow checked at mount time */
+ void *fd;
+ s64 mft_no;
+ u32 mft_record_size;
+ u32 csize;
+ u32 bytes_per_sector;
+ u32 records_per_set;
+ u32 clusters_per_set;
+ u32 wi,wj; /* indexes for reading */
+ u32 ri,rj; /* indexes for writing */
+ u32 k; /* lcn within run */
+ u32 r; /* mft_record within set */
+ s64 current_lcn;
+
+ current_lcn = image->current_lcn;
+ mft_record_size = image->ni->vol->mft_record_size;
+ csize = image->ni->vol->cluster_size;
+ bytes_per_sector = image->ni->vol->sector_size;
+ fd = image->ni->vol->dev;
+ /*
+ * Depending on the sizes, there may be several records
+ * per cluster, or several clusters per record.
+ */
+ if (csize >= mft_record_size) {
+ records_per_set = csize/mft_record_size;
+ clusters_per_set = 1;
+ } else {
+ clusters_per_set = mft_record_size/csize;
+ records_per_set = 1;
+ }
+ mft_no = 0;
+ ri = rj = 0;
+ wi = wj = 0;
+ if (rl[ri].length)
+ lseek_to_cluster(rl[ri].lcn);
+ while (rl[ri].length) {
+ for (k=0; (k<clusters_per_set) && rl[ri].length; k++) {
+ read_rescue(fd, &buff[k*csize], csize, bytes_per_sector,
+ rl[ri].lcn + rj);
+ if (++rj >= rl[ri].length) {
+ rj = 0;
+ if (rl[++ri].length)
+ lseek_to_cluster(rl[ri].lcn);
+ }
+ }
+ if (k == clusters_per_set) {
+ for (r=0; r<records_per_set; r++) {
+ if (!strncmp(&buff[r*mft_record_size],"FILE",4))
+ wipe_mft(&buff[r*mft_record_size],
+ mft_record_size, mft_no);
+ mft_no++;
+ }
+ write_set(buff, csize, &current_lcn,
+ rl, wi, wj, clusters_per_set);
+ wj += clusters_per_set;
+ while (rl[wi].length && (wj >= rl[wi].length))
+ wj -= rl[wi++].length;
+ } else {
+ err_exit("Short last MFT record\n");
+ }
+ }
+ image->current_lcn = current_lcn;
+}
+
+/*
+ * Copy and wipe the non-resident part of a directory index
+ * (only for metadata images)
+ *
+ * Data are read and written by full clusters, but the wiping is done
+ * per index record.
+ */
+
+static void copy_wipe_i30(ntfs_walk_clusters_ctx *image, runlist *rl)
+{
+ char buff[NTFS_MAX_CLUSTER_SIZE]; /* overflow checked at mount time */
+ void *fd;
+ u32 indx_record_size;
+ u32 csize;
+ u32 bytes_per_sector;
+ u32 records_per_set;
+ u32 clusters_per_set;
+ u32 wi,wj; /* indexes for reading */
+ u32 ri,rj; /* indexes for writing */
+ u32 k; /* lcn within run */
+ u32 r; /* mft_record within set */
+ s64 current_lcn;
+
+ current_lcn = image->current_lcn;
+ csize = image->ni->vol->cluster_size;
+ bytes_per_sector = image->ni->vol->sector_size;
+ fd = image->ni->vol->dev;
+ /*
+ * Depending on the sizes, there may be several records
+ * per cluster, or several clusters per record.
+ */
+ indx_record_size = image->ni->vol->indx_record_size;
+ if (csize >= indx_record_size) {
+ records_per_set = csize/indx_record_size;
+ clusters_per_set = 1;
+ } else {
+ clusters_per_set = indx_record_size/csize;
+ records_per_set = 1;
+ }
+ ri = rj = 0;
+ wi = wj = 0;
+ if (rl[ri].length)
+ lseek_to_cluster(rl[ri].lcn);
+ while (rl[ri].length) {
+ for (k=0; (k<clusters_per_set) && rl[ri].length; k++) {
+ read_rescue(fd, &buff[k*csize], csize, bytes_per_sector,
+ rl[ri].lcn + rj);
+ if (++rj >= rl[ri].length) {
+ rj = 0;
+ if (rl[++ri].length)
+ lseek_to_cluster(rl[ri].lcn);
+ }
+ }
+ if (k == clusters_per_set) {
+ /* wipe records_per_set records */
+ if (!opt.preserve_timestamps)
+ for (r=0; r<records_per_set; r++) {
+ if (!strncmp(&buff[r*indx_record_size],"INDX",4))
+ wipe_indx(&buff[r*indx_record_size],
+ indx_record_size);
+ }
+ write_set(buff, csize, &current_lcn,
+ rl, wi, wj, clusters_per_set);
+ wj += clusters_per_set;
+ while (rl[wi].length && (wj >= rl[wi].length))
+ wj -= rl[wi++].length;
+ } else {
+ err_exit("Short last directory index record\n");
+ }
+ }
+ image->current_lcn = current_lcn;
+}
+
+static void dump_clusters(ntfs_walk_clusters_ctx *image, runlist *rl)
+{
+ s64 i, len; /* number of clusters to copy */
+
+ if (opt.restore_image)
+ err_exit("Bug : invalid dump_clusters()\n");
+
+ if ((opt.std_out && !opt.metadata_image) || !opt.metadata)
+ return;
+ if (!(len = is_critical_metadata(image, rl)))
+ return;
+
+ lseek_to_cluster(rl->lcn);
+ if (opt.metadata_image ? wipe : !wipe) {
+ if (opt.metadata_image)
+ gap_to_cluster(rl->lcn - image->current_lcn);
+ /* FIXME: this could give pretty suboptimal performance */
+ for (i = 0; i < len; i++)
+ copy_cluster(opt.rescue, rl->lcn + i, rl->lcn + i);
+ if (opt.metadata_image)
+ image->current_lcn = rl->lcn + len;
+ }
+}
+
+static void walk_runs(struct ntfs_walk_cluster *walk)
+{
+ int i, j;
+ runlist *rl;
+ ATTR_RECORD *a;
+ ntfs_attr_search_ctx *ctx;
+ BOOL mft_data;
+ BOOL index_i30;
+
+ ctx = walk->image->ctx;
+ a = ctx->attr;
+
+ if (!a->non_resident) {
+ if (wipe) {
+ wipe_resident_data(walk->image);
+ if (!opt.preserve_timestamps)
+ wipe_timestamps(walk->image);
+ }
+ return;
+ }
+
+ if (wipe
+ && !opt.preserve_timestamps
+ && walk->image->ctx->attr->type == AT_INDEX_ALLOCATION)
+ wipe_index_allocation_timestamps(walk->image->ni, a);
+
+ if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL)))
+ perr_exit("ntfs_decompress_mapping_pairs");
+
+ /* special wipings for MFT records and directory indexes */
+ mft_data = ((walk->image->ni->mft_no == FILE_MFT)
+ || (walk->image->ni->mft_no == FILE_MFTMirr))
+ && (a->type == AT_DATA);
+ index_i30 = (walk->image->ctx->attr->type == AT_INDEX_ALLOCATION)
+ && (a->name_length == 4)
+ && !memcmp((char*)a + le16_to_cpu(a->name_offset),
+ NTFS_INDEX_I30,8);
+
+ 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",
+ (long long)ctx->ntfs_ino->mft_no,
+ (unsigned int)le32_to_cpu(a->type),
+ (long long)lcn, (long long)lcn_length);
+
+ if (opt.metadata_image ? wipe && !mft_data && !index_i30 : !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 %llu referenced twice!\n"
+ "You didn't shutdown your Windows "
+ "properly?\n", (unsigned long long)k);
+ }
+
+ if (!opt.metadata_image)
+ walk->image->inuse += lcn_length;
+ /*
+ * For a metadata image, we have to compute the
+ * number of metadata clusters for the percentages
+ * to be displayed correctly while restoring.
+ */
+ if (!wipe && opt.metadata_image) {
+ if ((walk->image->ni->mft_no == FILE_LogFile)
+ && (walk->image->ctx->attr->type == AT_DATA)) {
+ /* 16 KiB of FILE_LogFile */
+ walk->image->inuse
+ += is_critical_metadata(walk->image,rl);
+ } else {
+ if ((walk->image->ni->mft_no
+ <= LAST_METADATA_INODE)
+ || (walk->image->ctx->attr->type != AT_DATA))
+ walk->image->inuse += lcn_length;
+ }
+ }
+ }
+ if (wipe && opt.metadata_image) {
+ ntfs_attr *na;
+ /*
+ * Non-resident metadata has to be wiped globally,
+ * because its logical blocks may be larger than
+ * a cluster and split over two extents.
+ */
+ if (mft_data && !a->lowest_vcn) {
+ na = ntfs_attr_open(walk->image->ni,
+ AT_DATA, NULL, 0);
+ if (na) {
+ na->rl = rl;
+ rl = (runlist_element*)NULL;
+ if (!ntfs_attr_map_whole_runlist(na)) {
+ copy_wipe_mft(walk->image,na->rl);
+ } else
+ perr_exit("Failed to map data of inode %lld",
+ (long long)walk->image->ni->mft_no);
+ ntfs_attr_close(na);
+ } else
+ perr_exit("Failed to open data of inode %lld",
+ (long long)walk->image->ni->mft_no);
+ }
+ if (index_i30 && !a->lowest_vcn) {
+ na = ntfs_attr_open(walk->image->ni,
+ AT_INDEX_ALLOCATION, NTFS_INDEX_I30, 4);
+ if (na) {
+ na->rl = rl;
+ rl = (runlist_element*)NULL;
+ if (!ntfs_attr_map_whole_runlist(na)) {
+ copy_wipe_i30(walk->image,na->rl);
+ } else
+ perr_exit("Failed to map index of inode %lld",
+ (long long)walk->image->ni->mft_no);
+ ntfs_attr_close(na);
+ } else
+ perr_exit("Failed to open index of inode %lld",
+ (long long)walk->image->ni->mft_no);
+ }
+ }
+ if (opt.metadata
+ && (opt.metadata_image || !wipe)
+ && (walk->image->ni->mft_no == FILE_LogFile)
+ && (walk->image->ctx->attr->type == AT_DATA))
+ clone_logfile_parts(walk->image, rl);
+
+ free(rl);
+}
+
+
+static 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);
+}
+
+/*
+ * Compare the actual bitmap to the list of clusters
+ * allocated to identified files.
+ *
+ * Clusters found in use, though not marked in the bitmap are copied
+ * if the option --ignore-fs-checks is set.
+ */
+
+static int compare_bitmaps(struct bitmap *a, BOOL copy)
+{
+ s64 i, pos, count;
+ int mismatch = 0;
+ int more_use = 0;
+ s64 new_cl;
+ u8 bm[NTFS_BUF_SIZE];
+
+ Printf("Accounting clusters ...\n");
+
+ pos = 0;
+ new_cl = 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) {
+ /* the backup bootsector need not be accounted for */
+ if (((vol->nr_clusters + 7) >> 3) > pos)
+ err_exit("$Bitmap size is smaller than expected"
+ " (%lld < %lld)\n",
+ (long long)pos, (long long)a->size);
+ 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;
+
+ 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 (!bit)
+ more_use++;
+ if (opt.ignore_fs_check && !bit && copy) {
+ lseek_to_cluster(cl);
+ if (opt.save_image
+ || (opt.metadata
+ && opt.metadata_image)) {
+ gap_to_cluster(cl - new_cl);
+ new_cl = cl + 1;
+ }
+ copy_cluster(opt.rescue, cl, 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");
+ }
+ }
+ }
+done:
+ if (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");
+ if (new_cl) {
+ gap_to_cluster(-new_cl);
+ }
+ return (more_use);
+ }
+ err_exit("Filesystem check failed! Windows wasn't shutdown "
+ "properly or inconsistent\nfilesystem. Please run "
+ "chkdsk /f on Windows then reboot it TWICE.\n");
+ }
+ return (more_use);
+}
+
+
+static void mft_record_write_with_same_usn(ntfs_volume *volume, ntfs_inode *ni)
+{
+ if (ntfs_mft_usn_dec(ni->mrec))
+ perr_exit("ntfs_mft_usn_dec");
+
+ if (ntfs_mft_record_write(volume, ni->mft_no, ni->mrec))
+ perr_exit("ntfs_mft_record_write");
+}
+
+static void mft_inode_write_with_same_usn(ntfs_volume *volume, ntfs_inode *ni)
+{
+ s32 i;
+
+ mft_record_write_with_same_usn(volume, ni);
+
+ if (ni->nr_extents <= 0)
+ return;
+
+ for (i = 0; i < ni->nr_extents; ++i) {
+ ntfs_inode *eni = ni->extent_nis[i];
+ mft_record_write_with_same_usn(volume, eni);
+ }
+}
+
+static int walk_clusters(ntfs_volume *volume, struct ntfs_walk_cluster *walk)
+{
+ s64 inode = 0;
+ s64 last_mft_rec;
+ u64 nr_clusters;
+ ntfs_inode *ni;
+ struct progress_bar progress;
+
+ if (opt.restore_image || (!opt.metadata && wipe))
+ err_exit("Bug : invalid walk_clusters()\n");
+ Printf("Scanning volume ...\n");
+
+ last_mft_rec = (volume->mft_na->initialized_size >>
+ volume->mft_record_size_bits) - 1;
+ walk->image->current_lcn = 0;
+ progress_init(&progress, inode, last_mft_rec, 100);
+
+ NVolSetNoFixupWarn(volume);
+ for (; inode <= last_mft_rec; inode++) {
+
+ int err, deleted_inode;
+ MFT_REF mref = (MFT_REF)inode;
+
+ progress_update(&progress, inode);
+
+ /* FIXME: Terrible kludge for libntfs not being able to return
+ a deleted MFT record as inode */
+ ni = ntfs_calloc(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);
+
+ if (deleted_inode && !opt.metadata_image) {
+
+ ni->mft_no = MREF(mref);
+ if (wipe) {
+ wipe_unused_mft(ni);
+ wipe_unused_mft_data(ni);
+ mft_record_write_with_same_usn(volume, ni);
+ }
+ }
+
+ free(ni->mrec);
+ free(ni);
+
+ 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 */
+ if (errno == EIO || errno == ENOENT)
+ continue;
+ perr_exit("Reading inode %lld failed",
+ (long long)inode);
+ }
+
+ if (wipe)
+ nr_used_mft_records++;
+
+ if (ni->mrec->base_mft_record)
+ goto out;
+
+ walk->image->ni = ni;
+ walk_attributes(walk);
+out:
+ if (wipe && !opt.metadata_image) {
+ int i;
+
+ wipe_unused_mft_data(ni);
+ for (i = 0; i < ni->nr_extents; ++i) {
+ wipe_unused_mft_data(ni->extent_nis[i]);
+ }
+ mft_inode_write_with_same_usn(volume, ni);
+ }
+
+ if (ntfs_inode_close(ni))
+ perr_exit("ntfs_inode_close for inode %lld",
+ (long long)inode);
+ }
+ if (opt.metadata) {
+ if (opt.metadata_image && wipe && opt.ignore_fs_check) {
+ gap_to_cluster(-walk->image->current_lcn);
+ compare_bitmaps(&lcn_bitmap, TRUE);
+ walk->image->current_lcn = 0;
+ }
+ if (opt.metadata_image ? wipe : !wipe) {
+ /* also get the backup bootsector */
+ nr_clusters = vol->nr_clusters;
+ lseek_to_cluster(nr_clusters);
+ if (opt.metadata_image && wipe)
+ gap_to_cluster(nr_clusters
+ - walk->image->current_lcn);
+ copy_cluster(opt.rescue, nr_clusters, nr_clusters);
+ walk->image->current_lcn = nr_clusters;
+ }
+ /* Not counted, for compatibility with older versions */
+ if (!opt.metadata_image)
+ walk->image->inuse++;
+ }
+ 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.
+ */
+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);
+}
+
+
+/*
+ * 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.
+ */
+static void setup_lcn_bitmap(void)
+{
+ /* Determine lcn bitmap byte size and allocate it. */
+ /* include the alternate boot sector in the bitmap count */
+ lcn_bitmap.size = rounded_up_division(vol->nr_clusters + 1, 8);
+
+ lcn_bitmap.bm = ntfs_calloc(lcn_bitmap.size);
+ if (!lcn_bitmap.bm)
+ perr_exit("Failed to allocate internal buffer");
+
+ bitmap_file_data_fixup(vol->nr_clusters, &lcn_bitmap);
+}
+
+
+static s64 volume_size(ntfs_volume *volume, s64 nr_clusters)
+{
+ return nr_clusters * volume->cluster_size;
+}
+
+
+static void print_volume_size(const char *str, s64 bytes)
+{
+ Printf("%s: %lld bytes (%lld MB)\n", str, (long long)bytes,
+ (long long)rounded_up_division(bytes, NTFS_MBYTE));
+}
+
+
+static void print_disk_usage(const char *spacer, u32 cluster_size,
+ s64 nr_clusters, s64 inuse)
+{
+ s64 total, used;
+
+ total = nr_clusters * cluster_size;
+ used = inuse * cluster_size;
+
+ Printf("Space in use %s: %lld MB (%.1f%%) ", spacer,
+ (long long)rounded_up_division(used, NTFS_MBYTE),
+ 100.0 * ((float)used / total));
+
+ Printf("\n");
+}
+
+static void print_image_info(void)
+{
+ Printf("Ntfsclone image version: %d.%d\n",
+ image_hdr.major_ver, image_hdr.minor_ver);
+ Printf("Cluster size : %u bytes\n",
+ (unsigned)le32_to_cpu(image_hdr.cluster_size));
+ print_volume_size("Image volume size ",
+ sle64_to_cpu(image_hdr.nr_clusters) *
+ le32_to_cpu(image_hdr.cluster_size));
+ Printf("Image device size : %lld bytes\n",
+ (long long)sle64_to_cpu(image_hdr.device_size));
+ print_disk_usage(" ", le32_to_cpu(image_hdr.cluster_size),
+ sle64_to_cpu(image_hdr.nr_clusters),
+ sle64_to_cpu(image_hdr.inuse));
+ Printf("Offset to image data : %u (0x%x) bytes\n",
+ (unsigned)le32_to_cpu(image_hdr.offset_to_image_data),
+ (unsigned)le32_to_cpu(image_hdr.offset_to_image_data));
+}
+
+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);
+ }
+}
+
+/**
+ * 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).
+ */
+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;
+
+ 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 "
+ "disk instead of a partition (e.g. /dev/hda, "
+ "not /dev/hda1)?\n", opt.volume);
+ }
+ /*
+ * Retry with recovering the log file enabled.
+ * Normally avoided in order to get the original log file
+ * data, but needed when remounting the metadata of a
+ * volume improperly unmounted from Windows.
+ */
+ if (!(new_mntflag & (NTFS_MNT_RDONLY | NTFS_MNT_RECOVER))) {
+ Printf("Trying to recover...\n");
+ vol = ntfs_mount(opt.volume,
+ new_mntflag | NTFS_MNT_RECOVER);
+ Printf("... %s\n",(vol ? "Successful" : "Failed"));
+ }
+ if (!vol)
+ exit(1);
+ }
+
+ if (vol->flags & VOLUME_IS_DIRTY)
+ if (opt.force-- <= 0)
+ err_exit(dirty_volume_msg, opt.volume);
+
+ if (NTFS_MAX_CLUSTER_SIZE < 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))
+ perr_exit("Unknown NTFS version");
+
+ Printf("Cluster size : %u bytes\n",
+ (unsigned int)vol->cluster_size);
+ print_volume_size("Current volume size",
+ volume_size(vol, vol->nr_clusters));
+}
+
+static struct ntfs_walk_cluster backup_clusters = { NULL, NULL };
+
+static 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;
+}
+
+static s64 device_size_get(int fd)
+{
+ s64 high, low;
+#ifdef BLKGETSIZE64
+ { u64 size;
+
+ if (ioctl(fd, BLKGETSIZE64, &size) >= 0) {
+ ntfs_log_debug("BLKGETSIZE64 nr bytes = %llu "
+ "(0x%llx).\n", (unsigned long long)size,
+ (unsigned long long)size);
+ return (s64)size;
+ }
+ }
+#endif
+#ifdef BLKGETSIZE
+ { unsigned long size;
+
+ if (ioctl(fd, BLKGETSIZE, &size) >= 0) {
+ ntfs_log_debug("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) {
+ ntfs_log_debug("FDGETPRM nr 512 byte blocks = %lu "
+ "(0x%lx).\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);
+}
+
+static void fsync_clone(int fd)
+{
+ Printf("Syncing ...\n");
+ if (opt.save_image && stream_out && fflush(stream_out))
+ perr_exit("fflush");
+ if (fsync(fd) && errno != EINVAL)
+ perr_exit("fsync");
+}
+
+static void set_filesize(s64 filesize)
+{
+#ifndef NO_STATFS
+ 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
+ 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 (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");
+#endif
+
+ if (!opt.no_action && (ftruncate(fd_out, filesize) == -1)) {
+ int err = errno;
+ perr_printf("ftruncate failed for file '%s'", opt.output);
+#ifndef NO_STATFS
+ if (fs_type)
+ Printf("Destination filesystem type is 0x%lx.\n",
+ (unsigned long)fs_type);
+#endif
+ if (err == E2BIG) {
+ Printf("Your system or the destination filesystem "
+ "doesn't support large files.\n");
+#ifndef NO_STATFS
+ 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");
+ }
+#endif
+ } 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);
+ }
+}
+
+static s64 open_image(void)
+{
+ if (strcmp(opt.volume, "-") == 0) {
+ if ((fd_in = fileno(stdin)) == -1)
+ perr_exit("fileno for stdin failed");
+#ifdef HAVE_WINDOWS_H
+ if (setmode(fd_in,O_BINARY) == -1)
+ perr_exit("setting binary stdin failed");
+#endif
+ } else {
+ if ((fd_in = open(opt.volume, O_RDONLY | O_BINARY)) == -1)
+ perr_exit("failed to open image");
+ }
+ if (read_all(&fd_in, &image_hdr, NTFSCLONE_IMG_HEADER_SIZE_OLD) == -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");
+ if (image_hdr.major_ver < NTFSCLONE_IMG_VER_MAJOR_ENDIANNESS_SAFE) {
+ image_hdr.major_ver = NTFSCLONE_IMG_VER_MAJOR;
+ image_hdr.minor_ver = NTFSCLONE_IMG_VER_MINOR;
+#if (__BYTE_ORDER == __BIG_ENDIAN)
+ /*
+ * old image read on a big endian computer,
+ * assuming it was created big endian and read cpu-wise,
+ * so we should translate to little endian
+ */
+ Printf("Old image format detected. If the image was created "
+ "on a little endian architecture it will not "
+ "work. Use a more recent version of "
+ "ntfsclone to recreate the image.\n");
+ image_hdr.cluster_size = cpu_to_le32(image_hdr.cluster_size);
+ image_hdr.device_size = cpu_to_sle64(image_hdr.device_size);
+ image_hdr.nr_clusters = cpu_to_sle64(image_hdr.nr_clusters);
+ image_hdr.inuse = cpu_to_sle64(image_hdr.inuse);
+#endif
+ image_hdr.offset_to_image_data =
+ const_cpu_to_le32((sizeof(image_hdr)
+ + IMAGE_HDR_ALIGN - 1) & -IMAGE_HDR_ALIGN);
+ image_is_host_endian = TRUE;
+ } else {
+ /* safe image : little endian data */
+ le32 offset_to_image_data;
+ int delta;
+
+ if (image_hdr.major_ver > NTFSCLONE_IMG_VER_MAJOR)
+ err_exit("Do not know how to handle image format "
+ "version %d.%d. Please obtain a "
+ "newer version of ntfsclone.\n",
+ image_hdr.major_ver,
+ image_hdr.minor_ver);
+ /* Read the image header data offset. */
+ if (read_all(&fd_in, &offset_to_image_data,
+ sizeof(offset_to_image_data)) == -1)
+ perr_exit("read_all");
+ /* do not translate little endian data */
+ image_hdr.offset_to_image_data = offset_to_image_data;
+ /*
+ * Read any fields from the header that we have not read yet so
+ * that the input stream is positioned correctly. This means
+ * we can support future minor versions that just extend the
+ * header in a backwards compatible way.
+ */
+ delta = le32_to_cpu(offset_to_image_data)
+ - (NTFSCLONE_IMG_HEADER_SIZE_OLD +
+ sizeof(image_hdr.offset_to_image_data));
+ if (delta > 0) {
+ char *dummy_buf;
+
+ dummy_buf = malloc(delta);
+ if (!dummy_buf)
+ perr_exit("malloc dummy_buffer");
+ if (read_all(&fd_in, dummy_buf, delta) == -1)
+ perr_exit("read_all");
+ free(dummy_buf);
+ }
+ }
+ return sle64_to_cpu(image_hdr.device_size);
+}
+
+static s64 open_volume(void)
+{
+ s64 device_size;
+
+ mount_volume(NTFS_MNT_RDONLY);
+
+ device_size = ntfs_device_size_get(vol->dev, 1);
+ if (device_size <= 0)
+ err_exit("Couldn't get device size (%lld)!\n",
+ (long long)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", (long long)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 = NTFSCLONE_IMG_VER_MAJOR;
+ image_hdr.minor_ver = NTFSCLONE_IMG_VER_MINOR;
+ image_hdr.cluster_size = cpu_to_le32(vol->cluster_size);
+ image_hdr.device_size = cpu_to_sle64(device_size);
+ image_hdr.nr_clusters = cpu_to_sle64(vol->nr_clusters);
+ image_hdr.inuse = cpu_to_sle64(inuse);
+ image_hdr.offset_to_image_data = cpu_to_le32((sizeof(image_hdr)
+ + IMAGE_HDR_ALIGN - 1) & -IMAGE_HDR_ALIGN);
+}
+
+static void check_output_device(s64 input_size)
+{
+ if (opt.blkdev_out) {
+ s64 dest_size;
+
+ if (dev_out)
+ dest_size = ntfs_device_size_get(dev_out, 1);
+ else
+ dest_size = device_size_get(fd_out);
+ if (dest_size < input_size)
+ err_exit("Output device is too small (%lld) to fit the "
+ "NTFS image (%lld).\n",
+ (long long)dest_size, (long long)input_size);
+
+ check_if_mounted(opt.output, 0);
+ } else
+ set_filesize(input_size);
+}
+
+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, NULL)) == NULL)
+ perr_printf("ntfs_attr_get_search_ctx");
+
+ return ret;
+}
+
+/**
+ * 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;
+ int len = 0;
+
+ if ((ctx = attr_get_search_ctx(ni)) == NULL)
+ return NULL;
+
+ if ((ustr = ntfs_str2ucs(aname, &len)) == NULL) {
+ perr_printf("Couldn't convert '%s' to Unicode", aname);
+ goto error_out;
+ }
+
+ if (ntfs_attr_lookup(AT_DATA, ustr, len, CASE_SENSITIVE,
+ 0, NULL, 0, ctx)) {
+ perr_printf("ntfs_attr_lookup");
+ goto error_out;
+ }
+ ntfs_ucsfree(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, *rl_bad;
+ 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_bad = ntfs_mapping_pairs_decompress(vol, ctx->attr, NULL)))
+ perr_exit("ntfs_mapping_pairs_decompress");
+
+ for (rl = rl_bad; 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", (long long)nr_bad_clusters);
+ free(rl_bad);
+
+ ntfs_attr_put_search_ctx(ctx);
+ if (ntfs_inode_close(ni))
+ perr_exit("ntfs_inode_close failed for $BadClus");
+}
+
+static void check_dest_free_space(u64 src_bytes)
+{
+#ifndef HAVE_WINDOWS_H
+ u64 dest_bytes;
+ struct statvfs stvfs;
+ struct stat st;
+
+ 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));
+ return;
+ }
+
+ /* If file is a FIFO then there is no point in checking the size. */
+ if (!fstat(fd_out, &st)) {
+ if (S_ISFIFO(st.st_mode))
+ return;
+ } else
+ Printf("WARNING: fstat failed: %s\n", strerror(errno));
+
+ dest_bytes = (u64)stvfs.f_frsize * stvfs.f_bfree;
+ if (!dest_bytes)
+ dest_bytes = (u64)stvfs.f_bsize * stvfs.f_bfree;
+
+ if (dest_bytes < src_bytes)
+ err_exit("Destination doesn't have enough free space: "
+ "%llu MB < %llu MB\n",
+ (unsigned long long)rounded_up_division(dest_bytes, NTFS_MBYTE),
+ (unsigned long long)rounded_up_division(src_bytes, NTFS_MBYTE));
+#endif
+}
+
+int main(int argc, char **argv)
+{
+ ntfs_walk_clusters_ctx image;
+ s64 device_size; /* input device size in bytes */
+ s64 ntfs_size;
+ unsigned int wiped_total = 0;
+
+ /* make sure the layout of header is not affected by alignments */
+ if (offsetof(struct image_hdr, offset_to_image_data)
+ != IMAGE_OFFSET_OFFSET) {
+ fprintf(stderr,"ntfsclone is not compiled properly. "
+ "Please fix\n");
+ exit(1);
+ }
+ /* print to stderr, stdout can be an NTFS image ... */
+ fprintf(stderr, "%s v%s (libntfs-3g)\n", EXEC_NAME, VERSION);
+ msg_out = stderr;
+
+ parse_options(argc, argv);
+
+ utils_set_locale();
+
+ if (opt.restore_image) {
+ device_size = open_image();
+ ntfs_size = sle64_to_cpu(image_hdr.nr_clusters) *
+ le32_to_cpu(image_hdr.cluster_size);
+ } else {
+ device_size = open_volume();
+ ntfs_size = vol->nr_clusters * vol->cluster_size;
+ }
+ // FIXME: This needs to be the cluster size...
+ ntfs_size += 512; /* add backup boot sector */
+ full_device_size = device_size;
+
+ if (opt.std_out) {
+ if ((fd_out = fileno(stdout)) == -1)
+ perr_exit("fileno for stdout failed");
+ stream_out = stdout;
+#ifdef HAVE_WINDOWS_H
+ if (setmode(fileno(stdout),O_BINARY) == -1)
+ perr_exit("setting binary stdout failed");
+#endif
+ } else {
+ /* device_size_get() might need to read() */
+ int flags = O_RDWR | O_BINARY;
+
+ fd_out = 0;
+ if (!opt.blkdev_out) {
+ flags |= O_CREAT | O_TRUNC;
+ if (!opt.overwrite)
+ flags |= O_EXCL;
+ }
+
+ if (opt.save_image || opt.metadata_image) {
+ stream_out = fopen(opt.output,BINWMODE);
+ if (!stream_out)
+ perr_exit("Opening file '%s' failed",
+ opt.output);
+ fd_out = fileno(stream_out);
+ } else {
+#ifdef HAVE_WINDOWS_H
+ if (!opt.no_action) {
+ dev_out = ntfs_device_alloc(opt.output, 0,
+ &ntfs_device_default_io_ops, NULL);
+ if (!dev_out
+ || (dev_out->d_ops->open)(dev_out, flags))
+ perr_exit("Opening volume '%s' failed",
+ opt.output);
+ }
+#else
+ if (!opt.no_action
+ && ((fd_out = open(opt.output, flags,
+ S_IRUSR | S_IWUSR)) == -1))
+ perr_exit("Opening file '%s' failed",
+ opt.output);
+#endif
+ }
+
+ if (!opt.save_image && !opt.metadata_image && !opt.no_action)
+ check_output_device(ntfs_size);
+ }
+
+ if (opt.restore_image) {
+ print_image_info();
+ restore_image();
+ if (!opt.no_action)
+ fsync_clone(fd_out);
+ exit(0);
+ }
+
+ setup_lcn_bitmap();
+ memset(&image, 0, sizeof(image));
+ backup_clusters.image = &image;
+
+ walk_clusters(vol, &backup_clusters);
+ image.more_use = compare_bitmaps(&lcn_bitmap,
+ opt.metadata && !opt.metadata_image);
+ 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)
+ initialise_image_hdr(device_size, image.inuse);
+
+ if ((opt.std_out && !opt.metadata_image) || !opt.metadata) {
+ s64 nr_clusters_to_save = image.inuse;
+ if (opt.std_out && !opt.save_image)
+ nr_clusters_to_save = vol->nr_clusters;
+ nr_clusters_to_save++; /* account for the backup boot sector */
+
+ clone_ntfs(nr_clusters_to_save, image.more_use);
+ fsync_clone(fd_out);
+ if (opt.save_image)
+ fclose(stream_out);
+ ntfs_umount(vol,FALSE);
+ free(lcn_bitmap.bm);
+ exit(0);
+ }
+
+ wipe = 1;
+ if (opt.metadata_image) {
+ initialise_image_hdr(device_size, image.inuse);
+ write_image_hdr();
+ } else {
+ if (dev_out) {
+ (dev_out->d_ops->close)(dev_out);
+ dev_out = NULL;
+ } else
+ fsync_clone(fd_out); /* sync copy before mounting */
+ 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++;
+ ntfs_umount(vol,FALSE);
+ mount_volume(0 /*NTFS_MNT_NOATIME*/);
+ }
+
+ free(lcn_bitmap.bm);
+ setup_lcn_bitmap();
+ memset(&image, 0, sizeof(image));
+ backup_clusters.image = &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);
+ 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);
+
+ if (opt.metadata_image)
+ fclose(stream_out);
+ else
+ fsync_clone(fd_out);
+ ntfs_umount(vol,FALSE);
+ free(lcn_bitmap.bm);
+ return (0);
+}
diff --git a/ntfsprogs/ntfscluster.8 b/ntfsprogs/ntfscluster.8
new file mode 100644
index 0000000..7815272
--- a/dev/null
+++ b/ntfsprogs/ntfscluster.8
@@ -0,0 +1,124 @@
+.\" Copyright (c) 2003\-2005 Richard Russon.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH NTFSCLUSTER 8 "November 2005" "ntfs-3g 2014.2.15"
+.SH NAME
+ntfscluster \- identify files in a specified region of an NTFS volume.
+.SH SYNOPSIS
+.B ntfscluster
+[\fIoptions\fR] \fIdevice\fR
+.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 information 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. 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\-c\fR, \fB\-\-cluster\fR RANGE
+Any files whose data is in this range of clusters will be displayed.
+.TP
+\fB\-F\fR, \fB\-\-filename\fR NAME
+Show information about this file.
+.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\-I\fR, \fB\-\-inode\fR NUM
+Show information about this inode.
+.TP
+\fB\-i\fR, \fB\-\-info\fR
+This option is not yet implemented.
+.TP
+\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
+\fB\-s\fR, \fB\-\-sector\fR RANGE
+Any files whose data is in this range of sectors will be displayed.
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Increase the amount of output that
+.B ntfscluster
+prints.
+.TP
+\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.
+.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
+.RE
+.SH BUGS
+The
+.I info
+mode isn't implemented yet.
+.B ntfscluster
+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
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.SH AUTHORS
+.B ntfscluster
+was written by Richard Russon, with contributions from Anton Altaparmakov.
+It was ported to ntfs-3g by Erik Larsson.
+.SH AVAILABILITY
+.B ntfscluster
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR ntfsinfo (8),
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfscluster.8.in b/ntfsprogs/ntfscluster.8.in
new file mode 100755
index 0000000..9186a64
--- a/dev/null
+++ b/ntfsprogs/ntfscluster.8.in
@@ -0,0 +1,124 @@
+.\" Copyright (c) 2003\-2005 Richard Russon.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH NTFSCLUSTER 8 "November 2005" "ntfs-3g @VERSION@"
+.SH NAME
+ntfscluster \- identify files in a specified region of an NTFS volume.
+.SH SYNOPSIS
+.B ntfscluster
+[\fIoptions\fR] \fIdevice\fR
+.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 information 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. 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\-c\fR, \fB\-\-cluster\fR RANGE
+Any files whose data is in this range of clusters will be displayed.
+.TP
+\fB\-F\fR, \fB\-\-filename\fR NAME
+Show information about this file.
+.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\-I\fR, \fB\-\-inode\fR NUM
+Show information about this inode.
+.TP
+\fB\-i\fR, \fB\-\-info\fR
+This option is not yet implemented.
+.TP
+\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
+\fB\-s\fR, \fB\-\-sector\fR RANGE
+Any files whose data is in this range of sectors will be displayed.
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Increase the amount of output that
+.B ntfscluster
+prints.
+.TP
+\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.
+.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
+.RE
+.SH BUGS
+The
+.I info
+mode isn't implemented yet.
+.B ntfscluster
+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
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.SH AUTHORS
+.B ntfscluster
+was written by Richard Russon, with contributions from Anton Altaparmakov.
+It was ported to ntfs-3g by Erik Larsson.
+.SH AVAILABILITY
+.B ntfscluster
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR ntfsinfo (8),
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfscluster.c b/ntfsprogs/ntfscluster.c
new file mode 100755
index 0000000..ff16a0f
--- a/dev/null
+++ b/ntfsprogs/ntfscluster.c
@@ -0,0 +1,563 @@
+/**
+ * ntfscluster - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2002-2003 Richard Russon
+ * Copyright (c) 2005 Anton Altaparmakov
+ * Copyright (c) 2005-2006 Szabolcs Szakacsits
+ *
+ * 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"
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+#include "ntfscluster.h"
+#include "types.h"
+#include "attrib.h"
+#include "utils.h"
+#include "volume.h"
+#include "debug.h"
+#include "dir.h"
+#include "cluster.h"
+/* #include "version.h" */
+#include "logging.h"
+
+static const char *EXEC_NAME = "ntfscluster";
+static struct options opts;
+
+/**
+ * version - Print version information about the program
+ *
+ * Print a copyright statement and a brief description of the program.
+ *
+ * Return: none
+ */
+static void version(void)
+{
+ ntfs_log_info("\n%s v%s (libntfs-3g) - Find the owner of any given sector or "
+ "cluster.\n\n", EXEC_NAME, VERSION);
+ ntfs_log_info("Copyright (c) 2002-2003 Richard Russon\n");
+ ntfs_log_info("Copyright (c) 2005 Anton Altaparmakov\n");
+ ntfs_log_info("Copyright (c) 2005-2006 Szabolcs Szakacsits\n");
+ ntfs_log_info("\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)
+{
+ ntfs_log_info("\nUsage: %s [options] device\n"
+ " -i, --info Print information about the volume (default)\n"
+ "\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",
+ EXEC_NAME);
+ ntfs_log_info("%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 = "-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' },
+ { "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' },
+ { "version", no_argument, NULL, 'V' },
+ { NULL, 0, NULL, 0 }
+ };
+
+ int c = -1;
+ int err = 0;
+ int ver = 0;
+ int help = 0;
+ int levels = 0;
+ char *end = NULL;
+
+ 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 */
+ if (!opts.device) {
+ opts.device = argv[optind-1];
+ } else {
+ opts.device = NULL;
+ err++;
+ }
+ break;
+
+ case 'c':
+ 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':
+ if (opts.action == act_none) {
+ opts.action = act_file;
+ opts.filename = optarg;
+ } else {
+ opts.action = act_error;
+ }
+ break;
+ case 'f':
+ opts.force++;
+ 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.action == act_none) {
+ opts.action = act_inode;
+ opts.inode = strtol(optarg, &end, 0);
+ if (end && *end)
+ err++;
+ } else {
+ opts.action = act_error;
+ }
+ 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++;
+ ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET);
+ break;
+ case 's':
+ 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++;
+ ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE);
+ break;
+ case 'V':
+ ver++;
+ break;
+ default:
+ if ((optopt == 'c') || (optopt == 's'))
+ ntfs_log_error("Option '%s' requires an argument.\n", argv[optind-1]);
+ else
+ 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.action == act_none)
+ opts.action = act_info;
+ if (opts.action == act_info)
+ opts.quiet = 0;
+
+ if (opts.device == NULL) {
+ if (argc > 1)
+ ntfs_log_error("You must specify exactly one device.\n");
+ err++;
+ }
+
+ if (opts.quiet && opts.verbose) {
+ ntfs_log_error("You may not use --quiet and --verbose at the same time.\n");
+ err++;
+ }
+
+ if (opts.action == act_error) {
+ ntfs_log_error("You may only specify one action: --info, --cluster, --sector or --last.\n");
+ err++;
+ } else if (opts.range_begin > opts.range_end) {
+ ntfs_log_error("The range must be in ascending order.\n");
+ err++;
+ }
+ }
+
+ if (ver)
+ version();
+ if (help || err)
+ usage();
+
+ return (!err && !help && !ver);
+}
+
+
+/**
+ * info
+ */
+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;
+ u64 uc = 0, mc = 0, fc = 0;
+
+ 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(m_ctx->inode, NULL);
+
+ 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 << cb;
+ e = vol->nr_clusters;
+ f = vol->nr_clusters >> cps;
+ g = vol->mft_na->initialized_size >> vol->mft_record_size_bits;
+ 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;
+
+ 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;
+}
+
+/**
+ * dump_file
+ */
+static int dump_file(ntfs_volume *vol, ntfs_inode *ino)
+{
+ char buffer[1024];
+ ntfs_attr_search_ctx *ctx;
+ ATTR_RECORD *rec;
+ int i;
+ runlist *runs;
+
+ utils_inode_get_name(ino, buffer, sizeof(buffer));
+
+ ntfs_log_info("Dump: %s\n", buffer);
+
+ ctx = ntfs_attr_get_search_ctx(ino, NULL);
+
+ while ((rec = find_attribute(AT_UNUSED, ctx))) {
+ ntfs_log_info(" 0x%02x - ", rec->type);
+ if (rec->non_resident) {
+ ntfs_log_info("non-resident\n");
+ runs = ntfs_mapping_pairs_decompress(vol, rec, NULL);
+ if (runs) {
+ ntfs_log_info(" VCN LCN Length\n");
+ for (i = 0; runs[i].length > 0; i++) {
+ ntfs_log_info(" %8lld %8lld %8lld\n",
+ (long long)runs[i].vcn,
+ (long long)runs[i].lcn,
+ (long long)
+ runs[i].length);
+ }
+ free(runs);
+ }
+ } else {
+ ntfs_log_info("resident\n");
+ }
+ }
+
+ ntfs_attr_put_search_ctx(ctx);
+ return 0;
+}
+
+/**
+ * print_match
+ */
+static int print_match(ntfs_inode *ino, ATTR_RECORD *attr,
+ runlist_element *run, void *data __attribute__((unused)))
+{
+ char *buffer;
+
+ if (!ino || !attr || !run)
+ return 1;
+
+ buffer = malloc(MAX_PATH);
+ if (!buffer) {
+ ntfs_log_error("!buffer\n");
+ return 1;
+ }
+
+ utils_inode_get_name(ino, buffer, MAX_PATH);
+ ntfs_log_info("Inode %llu %s", (unsigned long long)ino->mft_no, buffer);
+
+ utils_attr_get_name(ino->vol, attr, buffer, MAX_PATH);
+ ntfs_log_info("/%s\n", buffer);
+
+ free(buffer);
+ return 0;
+}
+
+/**
+ * find_last
+ */
+static 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
+ *
+ * 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 *ino = NULL;
+ struct match m;
+ int result = 1;
+
+ ntfs_log_set_handler(ntfs_log_handler_outerr);
+
+ if (!parse_options(argc, argv))
+ return 1;
+
+ utils_set_locale();
+
+ vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY |
+ (opts.force ? NTFS_MNT_RECOVER : 0));
+ if (!vol)
+ return 1;
+
+ switch (opts.action) {
+ case act_sector:
+ if (opts.range_begin == opts.range_end)
+ ntfs_log_quiet("Searching for sector %llu\n",
+ (unsigned long long)opts.range_begin);
+ else
+ 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);
+ 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)
+ ntfs_log_quiet("Searching for cluster %llu\n",
+ (unsigned long long)opts.range_begin);
+ else
+ 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:
+ ino = ntfs_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 {
+ ntfs_log_error("Cannot open inode %llu\n",
+ (unsigned long long)opts.inode);
+ }
+ break;
+ case act_last:
+ 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 {
+ ntfs_log_error("Cannot open inode %llu\n",
+ (unsigned long long)
+ opts.inode);
+ }
+ result = 0;
+ } else {
+ result = 1;
+ }
+ break;
+ case act_info:
+ default:
+ result = info(vol);
+ break;
+ }
+
+ ntfs_umount(vol, FALSE);
+ return result;
+}
+
+
diff --git a/ntfsprogs/ntfscluster.h b/ntfsprogs/ntfscluster.h
new file mode 100755
index 0000000..5a3d6b3
--- a/dev/null
+++ b/ntfsprogs/ntfscluster.h
@@ -0,0 +1,63 @@
+/*
+ * ntfscluster - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2002-2003 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
+ */
+
+#ifndef _NTFSCLUSTER_H_
+#define _NTFSCLUSTER_H_
+
+#include "types.h"
+#include "layout.h"
+
+enum action {
+ act_none,
+ act_info,
+ act_cluster,
+ act_sector,
+ act_inode,
+ act_file,
+ act_last,
+ act_error,
+};
+
+struct options {
+ 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 */
+ char *filename; /* File to examine */
+ u64 inode; /* Inode to examine */
+ s64 range_begin; /* Look for objects in this range */
+ s64 range_end;
+};
+
+struct match {
+ u64 inum; /* Inode number */
+ LCN lcn; /* Last cluster in use */
+ ATTR_TYPES type; /* Attribute type */
+ ntfschar *name; /* Attribute name */
+ int name_len; /* Length of attribute name */
+};
+
+#endif /* _NTFSCLUSTER_H_ */
+
+
diff --git a/ntfsprogs/ntfscmp.8 b/ntfsprogs/ntfscmp.8
new file mode 100644
index 0000000..6bc2c59
--- a/dev/null
+++ b/ntfsprogs/ntfscmp.8
@@ -0,0 +1,77 @@
+.\" Copyright (c) 2005\-2006 Szabolcs Szakacsits.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH NTFSCMP 8 "April 2006" "ntfs-3g 2014.2.15"
+.SH NAME
+ntfscmp \- compare two NTFS filesystems and tell the differences
+.SH SYNOPSIS
+.B ntfscmp
+[\fIOPTIONS\fR]
+.I DEVICE1
+.I DEVICE2
+.br
+.SH DESCRIPTION
+The
+.B ntfscmp
+program makes a comparison between two NTFS filesystems from all aspects and
+reports all variances it finds.
+The filesystems can be on block devices or images files. Ntfscmp can be used
+for volume verification however its primary purpose was to be an efficient
+development tool, used to quickly locate, identify and check the correctness
+of the metadata changes made to NTFS.
+
+If one is interested only in the NTFS metadata changes then it could be useful
+to compare the metadata images created by
+using the --metadata option of
+.BR ntfsclone (8)
+to eliminate the usually uninteresting timestamp changes.
+
+The terse output of
+.B ntfscmp
+is intentional because the provided information is enough in each case
+to determine the exact differences. This can be achieved, for instance,
+if one compares the verbose outputs of
+.BR ntfsinfo (8)
+for each reported inodes by the
+.BR diff (1)
+utility.
+.SH OPTIONS
+Below is a summary of the options that
+.B ntfscmp
+accepts.
+.TP
+\fB\-P\fR, \fB\-\-no\-progress\-bar\fR
+Don't show progress bars.
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+More informational output.
+.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
+No problem is known. If you would find otherwise then please send
+your report to the development team:
+.nh
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.SH AUTHOR
+.B ntfscmp
+was written by Szabolcs Szakacsits.
+It was ported to ntfs-3g by Erik Larsson.
+.SH AVAILABILITY
+.B ntfscmp
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR ntfsinfo (8),
+.BR ntfscat (8),
+.BR diff (1),
+.BR ntfsclone (8),
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfscmp.8.in b/ntfsprogs/ntfscmp.8.in
new file mode 100755
index 0000000..647cf54
--- a/dev/null
+++ b/ntfsprogs/ntfscmp.8.in
@@ -0,0 +1,77 @@
+.\" Copyright (c) 2005\-2006 Szabolcs Szakacsits.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH NTFSCMP 8 "April 2006" "ntfs-3g @VERSION@"
+.SH NAME
+ntfscmp \- compare two NTFS filesystems and tell the differences
+.SH SYNOPSIS
+.B ntfscmp
+[\fIOPTIONS\fR]
+.I DEVICE1
+.I DEVICE2
+.br
+.SH DESCRIPTION
+The
+.B ntfscmp
+program makes a comparison between two NTFS filesystems from all aspects and
+reports all variances it finds.
+The filesystems can be on block devices or images files. Ntfscmp can be used
+for volume verification however its primary purpose was to be an efficient
+development tool, used to quickly locate, identify and check the correctness
+of the metadata changes made to NTFS.
+
+If one is interested only in the NTFS metadata changes then it could be useful
+to compare the metadata images created by
+using the --metadata option of
+.BR ntfsclone (8)
+to eliminate the usually uninteresting timestamp changes.
+
+The terse output of
+.B ntfscmp
+is intentional because the provided information is enough in each case
+to determine the exact differences. This can be achieved, for instance,
+if one compares the verbose outputs of
+.BR ntfsinfo (8)
+for each reported inodes by the
+.BR diff (1)
+utility.
+.SH OPTIONS
+Below is a summary of the options that
+.B ntfscmp
+accepts.
+.TP
+\fB\-P\fR, \fB\-\-no\-progress\-bar\fR
+Don't show progress bars.
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+More informational output.
+.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
+No problem is known. If you would find otherwise then please send
+your report to the development team:
+.nh
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.SH AUTHOR
+.B ntfscmp
+was written by Szabolcs Szakacsits.
+It was ported to ntfs-3g by Erik Larsson.
+.SH AVAILABILITY
+.B ntfscmp
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR ntfsinfo (8),
+.BR ntfscat (8),
+.BR diff (1),
+.BR ntfsclone (8),
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfscmp.c b/ntfsprogs/ntfscmp.c
new file mode 100755
index 0000000..469d1d9
--- a/dev/null
+++ b/ntfsprogs/ntfscmp.c
@@ -0,0 +1,1012 @@
+/**
+ * ntfscmp - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2005-2006 Szabolcs Szakacsits
+ * Copyright (c) 2005 Anton Altaparmakov
+ * Copyright (c) 2007 Yura Pakhuchiy
+ *
+ * This utility compare two NTFS volumes.
+ *
+ * This 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 <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdarg.h>
+#include <string.h>
+#include <errno.h>
+#include <getopt.h>
+
+#include "mst.h"
+#include "support.h"
+#include "utils.h"
+#include "misc.h"
+/* #include "version.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";
+
+
+static 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;
+};
+
+/* 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 ": "
+
+__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__)
+
+__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.
+ */
+__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
+ */
+__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
+ */
+__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 }
+ };
+
+ int c;
+
+ memset(&opt, 0, sizeof(opt));
+ opt.show_progress = 1;
+
+ while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -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();
+ }
+
+ /* 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 (!freopen("/dev/null", "w", stderr))
+ perr_exit("Failed to redirect stderr to /dev/null");
+#endif
+}
+
+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, NULL)) == 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",
+ (unsigned long long)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
+
+static 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 *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", (long long)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 ", (unsigned long long)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)) + le16_to_cpu((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,
+ 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;
+
+ free_name(&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)
+{
+ char *name = get_attr_name_na(na);
+ print_inode_ni(na->ni);
+ print_attribute(na->type, name);
+ free_name(&name);
+}
+
+static void print_attribute_ctx(ntfs_attr_search_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, name);
+ free_name(&name);
+}
+
+static void print_differ(ntfs_attr *na)
+{
+ print_na(na);
+ printf("content: DIFFER\n");
+}
+
+static int cmp_buffer(u8 *buf1, u8 *buf2, long long int size, ntfs_attr *na)
+{
+ if (memcmp(buf1, buf2, size)) {
+ print_differ(na);
+ return -1;
+ }
+ return 0;
+}
+
+struct cmp_ia {
+ INDEX_ALLOCATION *ia;
+ INDEX_ALLOCATION *tmp_ia;
+ u8 *bitmap;
+ u8 *byte;
+ s64 bm_size;
+};
+
+static int setup_cmp_ia(ntfs_attr *na, struct cmp_ia *cia)
+{
+ cia->bitmap = ntfs_attr_readall(na->ni, AT_BITMAP, na->name,
+ na->name_len, &cia->bm_size);
+ if (!cia->bitmap) {
+ perr_println("Failed to readall BITMAP");
+ return -1;
+ }
+ cia->byte = cia->bitmap;
+
+ cia->tmp_ia = cia->ia = ntfs_malloc(na->data_size);
+ if (!cia->tmp_ia)
+ goto free_bm;
+
+ if (ntfs_attr_pread(na, 0, na->data_size, cia->ia) != na->data_size) {
+ perr_println("Failed to pread INDEX_ALLOCATION");
+ goto free_ia;
+ }
+
+ return 0;
+free_ia:
+ free(cia->ia);
+free_bm:
+ free(cia->bitmap);
+ return -1;
+}
+
+static void cmp_index_allocation(ntfs_attr *na1, ntfs_attr *na2)
+{
+ struct cmp_ia cia1, cia2;
+ int bit, ret1, ret2;
+ u32 ib_size;
+
+ if (setup_cmp_ia(na1, &cia1))
+ return;
+ if (setup_cmp_ia(na2, &cia2))
+ return;
+ /*
+ * FIXME: ia can be the same even if the bitmap sizes are different.
+ */
+ if (cia1.bm_size != cia1.bm_size)
+ goto out;
+
+ if (cmp_buffer(cia1.bitmap, cia2.bitmap, cia1.bm_size, na1))
+ goto out;
+
+ if (cmp_buffer((u8 *)cia1.ia, (u8 *)cia2.ia, 0x18, na1))
+ goto out;
+
+ ib_size = le32_to_cpu(cia1.ia->index.allocated_size) + 0x18;
+
+ bit = 0;
+ while ((u8 *)cia1.tmp_ia < (u8 *)cia1.ia + na1->data_size) {
+ if (*cia1.byte & (1 << bit)) {
+ ret1 = ntfs_mst_post_read_fixup((NTFS_RECORD *)
+ cia1.tmp_ia, ib_size);
+ ret2 = ntfs_mst_post_read_fixup((NTFS_RECORD *)
+ cia2.tmp_ia, ib_size);
+ if (ret1 != ret2) {
+ print_differ(na1);
+ goto out;
+ }
+
+ if (ret1 == -1)
+ continue;
+
+ if (cmp_buffer(((u8 *)cia1.tmp_ia) + 0x18,
+ ((u8 *)cia2.tmp_ia) + 0x18,
+ le32_to_cpu(cia1.ia->
+ index.index_length), na1))
+ goto out;
+ }
+
+ cia1.tmp_ia = (INDEX_ALLOCATION *)((u8 *)cia1.tmp_ia + ib_size);
+ cia2.tmp_ia = (INDEX_ALLOCATION *)((u8 *)cia2.tmp_ia + ib_size);
+
+ bit++;
+ if (bit > 7) {
+ bit = 0;
+ cia1.byte++;
+ }
+ }
+out:
+ free(cia1.ia);
+ free(cia2.ia);
+ free(cia1.bitmap);
+ free(cia2.bitmap);
+ return;
+}
+
+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 ",
+ (long long)na1->data_size,
+ (long long)na2->data_size);
+ printf("(count: %lld != %lld)",
+ (long long)count1, (long long)count2);
+ puts("");
+ return;
+ }
+
+ if (count1 == -1) {
+ err_printf("%s read error: ", __FUNCTION__);
+ print_na(na1);
+ printf("len = %lld, pos = %lld\n",
+ (long long)na1->data_size, (long long)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", (long long)pos + count1,
+ (long long)na1->data_size);
+ exit(1);
+ }
+
+ if (cmp_buffer(buf1, buf2, count1, na1))
+ return;
+ }
+
+ err_printf("%s read overrun: ", __FUNCTION__);
+ print_na(na1);
+ err_printf("(len = %lld, pos = %lld, count = %lld)\n",
+ (long long)na1->data_size, (long long)pos, (long long)count1);
+ exit(1);
+}
+
+static int cmp_attribute_header(ATTR_RECORD *a1, ATTR_RECORD *a2)
+{
+ u32 header_size = offsetof(ATTR_RECORD, resident_end);
+
+ if (a1->non_resident != a2->non_resident)
+ return 1;
+
+ if (a1->non_resident) {
+ /*
+ * FIXME: includes paddings which are not handled by ntfsinfo!
+ */
+ header_size = le32_to_cpu(a1->length);
+ }
+
+ return memcmp(a1, a2, header_size);
+}
+
+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;
+
+ if (cmp_attribute_header(a1, a2)) {
+ print_ctx(ctx1);
+ printf("header: DIFFER\n");
+ }
+
+ 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",
+ (long long)na1->data_size, (long long)na2->data_size);
+ goto close_attribs;
+ }
+
+ if (ntfs_inode_badclus_bad(inumber(ctx1->ntfs_ino), ctx1->attr) == 1) {
+ /*
+ * If difference exists then it's already reported at the
+ * attribute header since the mapping pairs must differ.
+ */
+ goto close_attribs;
+ }
+
+ if (na1->type == AT_INDEX_ALLOCATION)
+ cmp_index_allocation(na1, na2);
+ else
+ cmp_attribute_data(na1, na2);
+
+close_attribs:
+ ntfs_attr_close(na1);
+ ntfs_attr_close(na2);
+}
+
+static void vprint_attribute(ATTR_TYPES atype, char *name)
+{
+ if (!opt.verbose)
+ return;
+
+ printf("0x%x", atype);
+ if (name)
+ printf(":%s", name);
+ printf(" ");
+}
+
+static void print_attributes(ntfs_inode *ni,
+ ATTR_TYPES atype1,
+ ATTR_TYPES atype2,
+ char *name1,
+ char *name2)
+{
+ if (!opt.verbose)
+ return;
+
+ printf("Walking inode %llu attributes: ",
+ (unsigned long long)inumber(ni));
+ vprint_attribute(atype1, name1);
+ vprint_attribute(atype2, name2);
+ printf("\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)
+{
+ 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;
+
+ if (opt.verbose) {
+ print_inode(base_inode(ctx)->mft_no);
+ print_attribute_ctx(ctx);
+ printf("record %llu lowest_vcn %lld: SKIPPED\n",
+ (unsigned long long)ctx->ntfs_ino->mft_no,
+ (long long)ctx->attr->lowest_vcn);
+ }
+
+ return 0;
+}
+
+static void set_prev(char **prev_name, ATTR_TYPES *prev_atype,
+ char *name, ATTR_TYPES atype)
+{
+ 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 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)))
+ return -1;
+ if (!(ctx2 = attr_get_search_ctx(ni2)))
+ goto out;
+
+ set_cmp_attr(ctx1, &atype1, &name1);
+ set_cmp_attr(ctx2, &atype2, &name2);
+
+ while (1) {
+
+ old_atype1 = atype1;
+ old_ret1 = ret1;
+ if (!ret1 && (le32_to_cpu(atype1) <= le32_to_cpu(atype2) ||
+ ret2))
+ ret1 = next_attr(ctx1, &atype1, &name1, &errno1);
+ if (!ret2 && (le32_to_cpu(old_atype1) >= le32_to_cpu(atype2) ||
+ old_ret1))
+ ret2 = next_attr(ctx2, &atype2, &name2, &errno2);
+
+ print_attributes(ni1, atype1, atype2, name1, name2);
+
+ if (ret1 && ret2) {
+ if (errno1 != errno2) {
+ print_inode_ni(ni1);
+ printf("attribute walk (errno): %d != %d\n",
+ errno1, errno2);
+ }
+ break;
+ }
+
+ if (ret2 || le32_to_cpu(atype1) < le32_to_cpu(atype2)) {
+ if (new_attribute(ctx1, prev_atype, prev_name)) {
+ print_ctx(ctx1);
+ printf("presence: EXISTS != MISSING\n");
+ set_prev(&prev_name, &prev_atype, name1,
+ atype1);
+ }
+
+ } else if (ret1 || le32_to_cpu(atype1) > le32_to_cpu(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);
+ set_prev(&prev_name, &prev_atype, name1, atype1);
+ }
+ }
+ }
+
+ free_name(&prev_name);
+ 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",
+ (long long)nr_mft_records, (long long)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++) {
+
+ 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, NTFS_MNT_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)
+ puts(corrupt_volume_msg);
+ else if (err == EPERM)
+ puts(hibernated_volume_msg);
+ exit(1);
+ }
+
+ return vol;
+}
+
+int main(int argc, char **argv)
+{
+ ntfs_volume *vol1;
+ ntfs_volume *vol2;
+
+ printf("%s v%s (libntfs-3g)\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);
+
+ ntfs_umount(vol1, FALSE);
+ ntfs_umount(vol2, FALSE);
+
+ return (0);
+}
+
diff --git a/ntfsprogs/ntfscp.8 b/ntfsprogs/ntfscp.8
new file mode 100644
index 0000000..1ff07c2
--- a/dev/null
+++ b/ntfsprogs/ntfscp.8
@@ -0,0 +1,111 @@
+.\" Copyright (c) 2004\-2007 Yura Pakhuchiy.
+.\" Copyright (c) 2005 Richard Russon.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH NTFSCP 8 "September 2007" "ntfs-3g 2014.2.15"
+.SH NAME
+ntfscp \- copy file to an NTFS volume.
+.SH SYNOPSIS
+\fBntfscp\fR [\fIoptions\fR] \fIdevice source_file destination\fR
+.SH DESCRIPTION
+\fBntfscp\fR will copy file to an NTFS volume. \fIdestination\fR can be either
+file or directory. In case if \fIdestination\fR is directory specified by name
+then \fIsource_file\fR is copied into this directory, in case if
+\fIdestination\fR is directory and specified by inode number then unnamed data
+attribute is created for this inode and \fIsource_file\fR 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. 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\-a\fR, \fB\-\-attribute\fR NUM
+Write to this attribute.
+.TP
+\fB\-i\fR, \fB\-\-inode\fR
+Treat
+.I destination
+as inode number.
+.TP
+\fB\-N\fR, \fB\-\-attr\-name\fR NAME
+Write to attribute with this name.
+.TP
+\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.
+.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\-q\fR, \fB\-\-quiet\fR
+Suppress some debug/warning/error messages.
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Show the version number, copyright and license
+.BR ntfscp .
+.TP
+\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.
+.SH EXAMPLES
+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):
+.RS
+.sp
+.B ntfscp \-N stream /dev/hda1 myfile /some/path
+.sp
+.RE
+.SH BUGS
+There are no known problems with \fBntfscp\fR. If you find a bug please send an
+email describing the problem to the development team:
+.br
+.nh
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.SH AUTHORS
+\fBntfscp\fR was written by Yura Pakhuchiy, with contributions from Anton
+Altaparmakov and Hil Liao.
+It was ported to ntfs-3g by Erik Larsson.
+.SH DEDICATION
+With love to Marina Sapego.
+.SH AVAILABILITY
+.B ntfscp
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfscp.8.in b/ntfsprogs/ntfscp.8.in
new file mode 100755
index 0000000..59b91be
--- a/dev/null
+++ b/ntfsprogs/ntfscp.8.in
@@ -0,0 +1,111 @@
+.\" Copyright (c) 2004\-2007 Yura Pakhuchiy.
+.\" Copyright (c) 2005 Richard Russon.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH NTFSCP 8 "September 2007" "ntfs-3g @VERSION@"
+.SH NAME
+ntfscp \- copy file to an NTFS volume.
+.SH SYNOPSIS
+\fBntfscp\fR [\fIoptions\fR] \fIdevice source_file destination\fR
+.SH DESCRIPTION
+\fBntfscp\fR will copy file to an NTFS volume. \fIdestination\fR can be either
+file or directory. In case if \fIdestination\fR is directory specified by name
+then \fIsource_file\fR is copied into this directory, in case if
+\fIdestination\fR is directory and specified by inode number then unnamed data
+attribute is created for this inode and \fIsource_file\fR 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. 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\-a\fR, \fB\-\-attribute\fR NUM
+Write to this attribute.
+.TP
+\fB\-i\fR, \fB\-\-inode\fR
+Treat
+.I destination
+as inode number.
+.TP
+\fB\-N\fR, \fB\-\-attr\-name\fR NAME
+Write to attribute with this name.
+.TP
+\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.
+.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\-q\fR, \fB\-\-quiet\fR
+Suppress some debug/warning/error messages.
+.TP
+\fB\-V\fR, \fB\-\-version\fR
+Show the version number, copyright and license
+.BR ntfscp .
+.TP
+\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.
+.SH EXAMPLES
+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):
+.RS
+.sp
+.B ntfscp \-N stream /dev/hda1 myfile /some/path
+.sp
+.RE
+.SH BUGS
+There are no known problems with \fBntfscp\fR. If you find a bug please send an
+email describing the problem to the development team:
+.br
+.nh
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.SH AUTHORS
+\fBntfscp\fR was written by Yura Pakhuchiy, with contributions from Anton
+Altaparmakov and Hil Liao.
+It was ported to ntfs-3g by Erik Larsson.
+.SH DEDICATION
+With love to Marina Sapego.
+.SH AVAILABILITY
+.B ntfscp
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfscp.c b/ntfsprogs/ntfscp.c
new file mode 100755
index 0000000..76f2eb4
--- a/dev/null
+++ b/ntfsprogs/ntfscp.c
@@ -0,0 +1,590 @@
+/**
+ * ntfscp - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2004-2007 Yura Pakhuchiy
+ * Copyright (c) 2005 Anton Altaparmakov
+ * Copyright (c) 2006 Hil Liao
+ *
+ * This utility will copy file to 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"
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#include <signal.h>
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_LIBGEN_H
+#include <libgen.h>
+#endif
+
+#include "types.h"
+#include "attrib.h"
+#include "utils.h"
+#include "volume.h"
+#include "dir.h"
+#include "debug.h"
+/* #include "version.h" */
+#include "logging.h"
+
+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";
+static struct options opts;
+static volatile sig_atomic_t caught_terminate = 0;
+
+/**
+ * version - Print version information about the program
+ *
+ * Print a copyright statement and a brief description of the program.
+ *
+ * Return: none
+ */
+static void version(void)
+{
+ ntfs_log_info("\n%s v%s (libntfs-3g) - Copy file to an NTFS "
+ "volume.\n\n", EXEC_NAME, VERSION);
+ ntfs_log_info("Copyright (c) 2004-2007 Yura Pakhuchiy\n");
+ ntfs_log_info("Copyright (c) 2005 Anton Altaparmakov\n");
+ ntfs_log_info("Copyright (c) 2006 Hil Liao\n");
+ ntfs_log_info("\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)
+{
+ 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",
+ EXEC_NAME);
+ ntfs_log_info("%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: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' },
+ { "verbose", no_argument, NULL, 'v' },
+ { NULL, 0, NULL, 0 }
+ };
+
+ char *s;
+ int c = -1;
+ int err = 0;
+ int ver = 0;
+ int help = 0;
+ int levels = 0;
+ s64 attr;
+
+ 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)) != -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 {
+ 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 one "
+ "attribute.\n");
+ err++;
+ break;
+ }
+
+ attr = strtol(optarg, &s, 0);
+ if (*s) {
+ ntfs_log_error("Couldn't parse attribute.\n");
+ err++;
+ } else
+ opts.attribute = (ATTR_TYPES)cpu_to_le32(attr);
+ break;
+ case 'i':
+ opts.inode++;
+ break;
+ case 'f':
+ opts.force++;
+ 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) {
+ ntfs_log_error("You can specify only one "
+ "attribute name.\n");
+ err++;
+ } else
+ opts.attr_name = argv[optind - 1];
+ break;
+ case 'n':
+ opts.noaction++;
+ 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:
+ 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) {
+ ntfs_log_error("You must specify a device.\n");
+ err++;
+ } else if (!opts.src_file) {
+ 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");
+ err++;
+ }
+
+ if (opts.quiet && opts.verbose) {
+ ntfs_log_error("You may not use --quiet and --verbose "
+ "at the same time.\n");
+ err++;
+ }
+ }
+
+ if (ver)
+ version();
+ if (help || err)
+ usage();
+
+ return (!err && !help && !ver);
+}
+
+/**
+ * signal_handler - Handle SIGINT and SIGTERM: abort write, sync and exit.
+ */
+static void signal_handler(int arg __attribute__((unused)))
+{
+ caught_terminate++;
+}
+
+/**
+ * Create a regular file under the given directory inode
+ *
+ * It is a wrapper function to ntfs_create(...)
+ *
+ * Return: the created file inode
+ */
+static ntfs_inode *ntfs_new_file(ntfs_inode *dir_ni,
+ const char *filename)
+{
+ ntfschar *ufilename;
+ /* inode to the file that is being created */
+ ntfs_inode *ni;
+ int ufilename_len;
+
+ /* ntfs_mbstoucs(...) will allocate memory for ufilename if it's NULL */
+ ufilename = NULL;
+ ufilename_len = ntfs_mbstoucs(filename, &ufilename);
+ if (ufilename_len == -1) {
+ ntfs_log_perror("ERROR: Failed to convert '%s' to unicode",
+ filename);
+ return NULL;
+ }
+ ni = ntfs_create(dir_ni, 0, ufilename, ufilename_len, S_IFREG);
+ free(ufilename);
+ return ni;
+}
+
+/**
+ * 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;
+ u64 offset;
+ char *buf;
+ s64 br, bw;
+ ntfschar *attr_name;
+ int attr_name_len = 0;
+
+ ntfs_log_set_handler(ntfs_log_handler_stderr);
+
+ if (!parse_options(argc, argv))
+ return 1;
+
+ utils_set_locale();
+
+ /* Set SIGINT handler. */
+ if (signal(SIGINT, signal_handler) == SIG_ERR) {
+ ntfs_log_perror("Failed to set SIGINT handler");
+ return 1;
+ }
+ /* Set SIGTERM handler. */
+ if (signal(SIGTERM, signal_handler) == SIG_ERR) {
+ ntfs_log_perror("Failed to set SIGTERM handler");
+ return 1;
+ }
+
+ if (opts.noaction)
+ flags = NTFS_MNT_RDONLY;
+ if (opts.force)
+ flags |= NTFS_MNT_RECOVER;
+
+ vol = utils_mount_volume(opts.device, flags);
+ if (!vol) {
+ ntfs_log_perror("ERROR: couldn't mount volume");
+ return 1;
+ }
+
+ if ((vol->flags & VOLUME_IS_DIRTY) && !opts.force)
+ goto umount;
+
+ NVolSetCompression(vol); /* allow compression */
+ if (ntfs_volume_get_free_space(vol)) {
+ ntfs_log_perror("ERROR: couldn't get free space");
+ goto umount;
+ }
+
+ {
+ struct stat fst;
+ if (stat(opts.src_file, &fst) == -1) {
+ ntfs_log_perror("ERROR: Couldn't stat source file");
+ goto umount;
+ }
+ new_size = fst.st_size;
+ }
+ ntfs_log_verbose("New file size: %lld\n", (long long)new_size);
+
+ in = fopen(opts.src_file, "r");
+ if (!in) {
+ ntfs_log_perror("ERROR: Couldn't open source file");
+ goto umount;
+ }
+
+ if (opts.inode) {
+ s64 inode_num;
+ char *s;
+
+ inode_num = strtoll(opts.dest_file, &s, 0);
+ if (*s) {
+ 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) {
+ /* Copy the file if the dest_file's parent dir can be opened. */
+ char *parent_dirname;
+ char *filename;
+ ntfs_inode *dir_ni;
+ ntfs_inode *ni;
+ char *dirname_last_whack;
+
+ filename = basename(opts.dest_file);
+ parent_dirname = strdup(opts.dest_file);
+ if (!parent_dirname) {
+ ntfs_log_perror("strdup() failed");
+ goto close_src;
+ }
+ dirname_last_whack = strrchr(parent_dirname, '/');
+ if (dirname_last_whack) {
+ dirname_last_whack[1] = 0;
+ dir_ni = ntfs_pathname_to_inode(vol, NULL,
+ parent_dirname);
+ } else {
+ ntfs_log_verbose("Target path does not contain '/'. "
+ "Using root directory as parent.\n");
+ dir_ni = ntfs_inode_open(vol, FILE_root);
+ }
+ if (dir_ni) {
+ if (!(dir_ni->mrec->flags & MFT_RECORD_IS_DIRECTORY)) {
+ /* Remove the last '/' for estetic reasons. */
+ dirname_last_whack[0] = 0;
+ ntfs_log_error("The file '%s' already exists "
+ "and is not a directory. "
+ "Aborting.\n", parent_dirname);
+ free(parent_dirname);
+ ntfs_inode_close(dir_ni);
+ goto close_src;
+ }
+ ntfs_log_verbose("Creating a new file '%s' under '%s'"
+ "\n", filename, parent_dirname);
+ ni = ntfs_new_file(dir_ni, filename);
+ ntfs_inode_close(dir_ni);
+ if (!ni) {
+ ntfs_log_perror("Failed to create '%s' under "
+ "'%s'", filename,
+ parent_dirname);
+ free(parent_dirname);
+ goto close_src;
+ }
+ out = ni;
+ } else {
+ ntfs_log_perror("ERROR: Couldn't open '%s'",
+ parent_dirname);
+ free(parent_dirname);
+ goto close_src;
+ }
+ free(parent_dirname);
+ }
+ /* The destination is a directory. */
+ if ((out->mrec->flags & MFT_RECORD_IS_DIRECTORY) && !opts.inode) {
+ char *filename;
+ char *overwrite_filename;
+ int overwrite_filename_len;
+ ntfs_inode *ni;
+ ntfs_inode *dir_ni;
+ int filename_len;
+ int dest_dirname_len;
+
+ filename = basename(opts.src_file);
+ dir_ni = out;
+ filename_len = strlen(filename);
+ dest_dirname_len = strlen(opts.dest_file);
+ overwrite_filename_len = filename_len+dest_dirname_len + 2;
+ overwrite_filename = malloc(overwrite_filename_len);
+ if (!overwrite_filename) {
+ ntfs_log_perror("ERROR: Failed to allocate %i bytes "
+ "memory for the overwrite filename",
+ overwrite_filename_len);
+ ntfs_inode_close(out);
+ goto close_src;
+ }
+ strcpy(overwrite_filename, opts.dest_file);
+ if (opts.dest_file[dest_dirname_len - 1] != '/') {
+ strcat(overwrite_filename, "/");
+ }
+ strcat(overwrite_filename, filename);
+ ni = ntfs_pathname_to_inode(vol, NULL, overwrite_filename);
+ /* Does a file with the same name exist in the dest dir? */
+ if (ni) {
+ ntfs_log_verbose("Destination path has a file with "
+ "the same name\nOverwriting the file "
+ "'%s'\n", overwrite_filename);
+ ntfs_inode_close(out);
+ out = ni;
+ } else {
+ ntfs_log_verbose("Creating a new file '%s' under "
+ "'%s'\n", filename, opts.dest_file);
+ ni = ntfs_new_file(dir_ni, filename);
+ ntfs_inode_close(dir_ni);
+ if (!ni) {
+ ntfs_log_perror("ERROR: Failed to create the "
+ "destination file under '%s'",
+ opts.dest_file);
+ free(overwrite_filename);
+ goto close_src;
+ }
+ out = ni;
+ }
+ free(overwrite_filename);
+ }
+
+ attr_name = ntfs_str2ucs(opts.attr_name, &attr_name_len);
+ if (!attr_name) {
+ ntfs_log_perror("ERROR: Failed to parse attribute name '%s'",
+ opts.attr_name);
+ goto close_dst;
+ }
+
+ na = ntfs_attr_open(out, opts.attribute, attr_name, attr_name_len);
+ if (!na) {
+ if (errno != ENOENT) {
+ 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)) {
+ 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) {
+ ntfs_log_perror("ERROR: Couldn't open just added "
+ "attribute");
+ goto close_dst;
+ }
+ }
+ ntfs_ucsfree(attr_name);
+
+ ntfs_log_verbose("Old file size: %lld\n", (long long)na->data_size);
+ if (na->data_size != new_size) {
+ if (ntfs_attr_truncate_solid(na, new_size)) {
+ ntfs_log_perror("ERROR: Couldn't resize attribute");
+ goto close_attr;
+ }
+ }
+
+ buf = malloc(NTFS_BUF_SIZE);
+ if (!buf) {
+ ntfs_log_perror("ERROR: malloc failed");
+ goto close_attr;
+ }
+
+ ntfs_log_verbose("Starting write.\n");
+ offset = 0;
+ while (!feof(in)) {
+ if (caught_terminate) {
+ ntfs_log_error("SIGTERM or SIGINT received. "
+ "Aborting write.\n");
+ break;
+ }
+ br = fread(buf, 1, NTFS_BUF_SIZE, in);
+ if (!br) {
+ if (!feof(in)) ntfs_log_perror("ERROR: fread failed");
+ break;
+ }
+ bw = ntfs_attr_pwrite(na, offset, br, buf);
+ if (bw != br) {
+ ntfs_log_perror("ERROR: ntfs_attr_pwrite failed");
+ break;
+ }
+ offset += bw;
+ }
+ if ((na->data_flags & ATTR_COMPRESSION_MASK)
+ && ntfs_attr_pclose(na))
+ ntfs_log_perror("ERROR: ntfs_attr_pclose failed");
+ ntfs_log_verbose("Syncing.\n");
+ result = 0;
+ free(buf);
+close_attr:
+ ntfs_attr_close(na);
+close_dst:
+ while (ntfs_inode_close(out)) {
+ if (errno != EBUSY) {
+ ntfs_log_error("Sync failed. Run chkdsk.\n");
+ break;
+ }
+ ntfs_log_error("Device busy. Will retry sync in 3 seconds.\n");
+ sleep(3);
+ }
+close_src:
+ fclose(in);
+umount:
+ ntfs_umount(vol, FALSE);
+ ntfs_log_verbose("Done.\n");
+ return result;
+}
diff --git a/ntfsprogs/ntfsdecrypt.c b/ntfsprogs/ntfsdecrypt.c
new file mode 100755
index 0000000..e69daed
--- a/dev/null
+++ b/ntfsprogs/ntfsdecrypt.c
@@ -0,0 +1,1436 @@
+/**
+ * ntfsdecrypt - Decrypt ntfs encrypted files. Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2005 Yuval Fledel
+ * Copyright (c) 2005-2007 Anton Altaparmakov
+ * Copyright (c) 2007 Yura Pakhuchiy
+ * Copyright (c) 2014 Jean-Pierre Andre
+ *
+ * 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
+ * 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"
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#include <gcrypt.h>
+#include <gnutls/pkcs12.h>
+
+#include "types.h"
+#include "attrib.h"
+#include "utils.h"
+#include "volume.h"
+#include "debug.h"
+#include "dir.h"
+#include "layout.h"
+/* #include "version.h" */
+
+typedef gcry_sexp_t ntfs_rsa_private_key;
+
+#define NTFS_SHA1_THUMBPRINT_SIZE 0x14
+
+#define NTFS_CRED_TYPE_CERT_THUMBPRINT const_cpu_to_le32(3)
+
+#define NTFS_EFS_CERT_PURPOSE_OID_DDF "1.3.6.1.4.1.311.10.3.4"
+#define NTFS_EFS_CERT_PURPOSE_OID_DRF "1.3.6.1.4.1.311.10.3.4.1"
+
+typedef enum {
+ DF_TYPE_UNKNOWN,
+ DF_TYPE_DDF,
+ DF_TYPE_DRF,
+} NTFS_DF_TYPES;
+
+/**
+ * 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\
+ * 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;
+
+typedef struct {
+ u64 in_whitening, out_whitening;
+ u8 des_key[8];
+} ntfs_desx_ctx;
+
+/**
+ * struct ntfs_fek - Decrypted, in-memory file encryption key.
+ */
+
+typedef struct {
+ gcry_cipher_hd_t gcry_cipher_hd;
+ le32 alg_id;
+ u8 *key_data;
+ gcry_cipher_hd_t *des_gcry_cipher_hd_ptr;
+ ntfs_desx_ctx desx_ctx;
+} ntfs_fek;
+
+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 */
+ 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 = "ntfsdecrypt";
+static struct options opts;
+
+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')
+};
+
+/**
+ * version - Print version information about the program
+ *
+ * Print a copyright statement and a brief description of the program.
+ *
+ * Return: none
+ */
+static void version(void)
+{
+ ntfs_log_info("\n%s v%s (libntfs-3g) - Decrypt files and print on the "
+ "standard output.\n\n", EXEC_NAME, VERSION);
+ ntfs_log_info("Copyright (c) 2005 Yuval Fledel\n");
+ ntfs_log_info("Copyright (c) 2005 Anton Altaparmakov\n");
+ ntfs_log_info("Copyright (c) 2014 Jean-Pierre Andre\n");
+ ntfs_log_info("\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)
+{
+ 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"
+ " -h --help Print this help\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);
+}
+
+/**
+ * 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?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'},
+ {NULL, 0, NULL, 0}
+ };
+
+ int 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)) != -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 {
+ ntfs_log_error("You must specify exactly one "
+ "file.\n");
+ err++;
+ }
+ break;
+ case 'f':
+ opts.force++;
+ break;
+ case 'h':
+ case '?':
+ help++;
+ break;
+ case 'k':
+ if (!opts.keyfile)
+ opts.keyfile = argv[optind - 1];
+ else {
+ ntfs_log_error("You must specify exactly one "
+ "key file.\n");
+ err++;
+ }
+ break;
+ case 'i':
+ if (opts.inode != -1)
+ ntfs_log_error("You must specify exactly one "
+ "inode.\n");
+ else if (utils_parse_size(optarg, &opts.inode, FALSE))
+ break;
+ else
+ 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:
+ ntfs_log_error("Unknown option '%s'.\n",
+ argv[optind - 1]);
+ err++;
+ break;
+ }
+ }
+
+ if (help || ver) {
+ opts.quiet = 0;
+ ntfs_log_set_levels(NTFS_LOG_LEVEL_QUIET);
+ } else {
+ if (!opts.keyfile) {
+ ntfs_log_error("You must specify a key file.\n");
+ err++;
+ } else if (opts.device == NULL) {
+ ntfs_log_error("You must specify a device.\n");
+ err++;
+ } else if (opts.file == NULL && opts.inode == -1) {
+ ntfs_log_error("You must specify a file or inode with "
+ "the -i option.\n");
+ err++;
+ } else if (opts.file != NULL && opts.inode != -1) {
+ ntfs_log_error("You can't specify both a file and "
+ "inode.\n");
+ err++;
+ }
+ if (opts.quiet && opts.verbose) {
+ ntfs_log_error("You may not use --quiet and --verbose "
+ "at the same time.\n");
+ err++;
+ }
+ }
+
+ if (ver)
+ version();
+ if (help || err)
+ usage();
+
+ return (!err && !help && !ver);
+}
+
+/**
+ * ntfs_pkcs12_load_pfxfile
+ */
+static int ntfs_pkcs12_load_pfxfile(const char *keyfile, u8 **pfx,
+ unsigned *pfx_size)
+{
+ int f, to_read, total, attempts, br;
+ struct stat key_stat;
+
+ if (!keyfile || !pfx || !pfx_size) {
+ 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.\n");
+ return -1;
+ }
+ f = open(keyfile, O_RDONLY);
+ if (f == -1) {
+ ntfs_log_perror("Failed to open key file");
+ return -1;
+ }
+ if (fstat(f, &key_stat) == -1) {
+ ntfs_log_perror("Failed to stat key file");
+ goto file_out;
+ }
+ if (!S_ISREG(key_stat.st_mode)) {
+ ntfs_log_error("Key file is not a regular file, cannot read "
+ "it.\n");
+ goto file_out;
+ }
+ if (!key_stat.st_size) {
+ ntfs_log_error("Key file has zero size.\n");
+ goto file_out;
+ }
+ *pfx = malloc(key_stat.st_size + 1);
+ if (!*pfx) {
+ ntfs_log_perror("Failed to allocate buffer for key file "
+ "contents");
+ goto file_out;
+ }
+ to_read = key_stat.st_size;
+ total = attempts = 0;
+ do {
+ br = read(f, *pfx + total, to_read);
+ if (br == -1) {
+ ntfs_log_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)[key_stat.st_size] = 0;
+ *pfx_size = key_stat.st_size;
+ return 0;
+free_out:
+ free(*pfx);
+file_out:
+ close(f);
+ 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) {
+ 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) {
+ 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();
+}
+
+/**
+ * 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)
+{
+ int i, j;
+ size_t 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])) {
+ ntfs_log_error("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) != GPG_ERR_NO_ERROR) {
+ ntfs_log_error("Failed to convert RSA parameter %i "
+ "to mpi format (size %d)\n", i,
+ rd[i].size);
+ rsa_key = NULL;
+ break;
+ }
+ }
+ /* Release the no longer needed datum values. */
+ for (j = 0; j < 6; j++) {
+ if (rd[j].data && rd[j].size)
+ gnutls_free(rd[j].data);
+ }
+ /*
+ * 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) {
+ ntfs_log_error("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;
+}
+
+/**
+ * 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);
+}
+
+/**
+ * ntfs_pkcs12_extract_rsa_key
+ */
+static ntfs_rsa_private_key ntfs_pkcs12_extract_rsa_key(u8 *pfx, int pfx_size,
+ char *password, char *thumbprint, int thumbprint_size,
+ NTFS_DF_TYPES *df_type)
+{
+ int err, bag_index, flags;
+ gnutls_datum_t dpfx, dkey;
+ gnutls_pkcs12_t pkcs12 = NULL;
+ gnutls_pkcs12_bag_t bag = NULL;
+ gnutls_x509_privkey_t pkey = NULL;
+ gnutls_x509_crt_t crt = NULL;
+ ntfs_rsa_private_key rsa_key = NULL;
+ char purpose_oid[100];
+ size_t purpose_oid_size = sizeof(purpose_oid);
+ size_t tp_size = thumbprint_size;
+ BOOL have_thumbprint = FALSE;
+
+ *df_type = DF_TYPE_UNKNOWN;
+ /* Create a pkcs12 structure. */
+ err = gnutls_pkcs12_init(&pkcs12);
+ if (err) {
+ ntfs_log_error("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) {
+ ntfs_log_error("Failed to convert the PFX file from DER to "
+ "native PKCS#12 format: %s\n",
+ gnutls_strerror(err));
+ goto err;
+ }
+ /*
+ * Verify that the password is correct and that the key file has not
+ * 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) {
+ if (err == GNUTLS_E_MAC_VERIFY_FAILED &&
+ password && !strlen(password)) {
+ password = NULL;
+ goto retry_verify;
+ }
+ ntfs_log_error("Failed to verify the MAC: %s Is the "
+ "password correct?\n", gnutls_strerror(err));
+ goto err;
+ }
+ for (bag_index = 0; ; bag_index++) {
+ err = gnutls_pkcs12_bag_init(&bag);
+ if (err) {
+ ntfs_log_error("Failed to initialize PKCS#12 Bag "
+ "structure: %s\n",
+ gnutls_strerror(err));
+ goto err;
+ }
+ err = gnutls_pkcs12_get_bag(pkcs12, bag_index, bag);
+ if (err) {
+ if (err == GNUTLS_E_REQUESTED_DATA_NOT_AVAILABLE) {
+ err = 0;
+ break;
+ }
+ ntfs_log_error("Failed to obtain Bag from PKCS#12 "
+ "structure: %s\n",
+ gnutls_strerror(err));
+ goto err;
+ }
+check_again:
+ err = gnutls_pkcs12_bag_get_count(bag);
+ if (err < 0) {
+ ntfs_log_error("Failed to obtain Bag count: %s\n",
+ gnutls_strerror(err));
+ goto err;
+ }
+ err = gnutls_pkcs12_bag_get_type(bag, 0);
+ if (err < 0) {
+ ntfs_log_error("Failed to determine Bag type: %s\n",
+ gnutls_strerror(err));
+ goto err;
+ }
+ flags = 0;
+ switch (err) {
+ case GNUTLS_BAG_PKCS8_KEY:
+ flags = GNUTLS_PKCS_PLAIN;
+ case GNUTLS_BAG_PKCS8_ENCRYPTED_KEY:
+ err = gnutls_pkcs12_bag_get_data(bag, 0, &dkey);
+ if (err < 0) {
+ ntfs_log_error("Failed to obtain Bag data: "
+ "%s\n", gnutls_strerror(err));
+ goto err;
+ }
+ err = gnutls_x509_privkey_init(&pkey);
+ if (err) {
+ ntfs_log_error("Failed to initialized "
+ "private key structure: %s\n",
+ gnutls_strerror(err));
+ goto err;
+ }
+ /* Decrypt the private key into GNU TLS format. */
+ err = gnutls_x509_privkey_import_pkcs8(pkey, &dkey,
+ GNUTLS_X509_FMT_DER, password, flags);
+ if (err) {
+ ntfs_log_error("Failed to convert private "
+ "key from DER to GNU TLS "
+ "format: %s\n",
+ gnutls_strerror(err));
+ goto err;
+ }
+#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) {
+ ntfs_log_error("eek1\n");
+ exit(1);
+ }
+ ntfs_log_error("%s\n", buf);
+ free(buf);
+#endif
+ /* Convert the private key to our internal format. */
+ rsa_key = ntfs_rsa_private_key_import_from_gnutls(pkey);
+ if (!rsa_key)
+ goto err;
+ break;
+ case GNUTLS_BAG_ENCRYPTED:
+ err = gnutls_pkcs12_bag_decrypt(bag, password);
+ if (err) {
+ ntfs_log_error("Failed to decrypt Bag: %s\n",
+ gnutls_strerror(err));
+ goto err;
+ }
+ goto check_again;
+ case GNUTLS_BAG_CERTIFICATE:
+ err = gnutls_pkcs12_bag_get_data(bag, 0, &dkey);
+ if (err < 0) {
+ ntfs_log_error("Failed to obtain Bag data: "
+ "%s\n", gnutls_strerror(err));
+ goto err;
+ }
+ err = gnutls_x509_crt_init(&crt);
+ if (err) {
+ ntfs_log_error("Failed to initialize "
+ "certificate structure: %s\n",
+ gnutls_strerror(err));
+ goto err;
+ }
+ err = gnutls_x509_crt_import(crt, &dkey,
+ GNUTLS_X509_FMT_DER);
+ if (err) {
+ ntfs_log_error("Failed to convert certificate "
+ "from DER to GNU TLS format: "
+ "%s\n", gnutls_strerror(err));
+ goto err;
+ }
+ err = gnutls_x509_crt_get_key_purpose_oid(crt, 0,
+ purpose_oid, &purpose_oid_size, NULL);
+ if (err) {
+ ntfs_log_error("Failed to get key purpose "
+ "OID: %s\n",
+ gnutls_strerror(err));
+ goto err;
+ }
+ purpose_oid[purpose_oid_size - 1] = '\0';
+ if (!strcmp(purpose_oid,
+ NTFS_EFS_CERT_PURPOSE_OID_DRF))
+ *df_type = DF_TYPE_DRF;
+ else if (!strcmp(purpose_oid,
+ NTFS_EFS_CERT_PURPOSE_OID_DDF))
+ *df_type = DF_TYPE_DDF;
+ else {
+ ntfs_log_error("Certificate has unknown "
+ "purpose OID %s.\n",
+ purpose_oid);
+ err = EINVAL;
+ goto err;
+ }
+ /* Return the thumbprint to the caller. */
+ err = gnutls_x509_crt_get_fingerprint(crt,
+ GNUTLS_DIG_SHA1, thumbprint, &tp_size);
+ if (err) {
+ ntfs_log_error("Failed to get thumbprint: "
+ "%s\n", gnutls_strerror(err));
+ goto err;
+ }
+ if (tp_size != NTFS_SHA1_THUMBPRINT_SIZE) {
+ ntfs_log_error("Invalid thumbprint size %zd. "
+ "Should be %d.\n", tp_size,
+ thumbprint_size);
+ err = EINVAL;
+ goto err;
+ }
+ have_thumbprint = TRUE;
+ gnutls_x509_crt_deinit(crt);
+ crt = NULL;
+ break;
+ default:
+ /* We do not care about other types. */
+ break;
+ }
+ gnutls_pkcs12_bag_deinit(bag);
+ }
+err:
+ if (rsa_key && (err || *df_type == DF_TYPE_UNKNOWN ||
+ !have_thumbprint)) {
+ if (!err)
+ ntfs_log_error("Key type or thumbprint not found, "
+ "aborting.\n");
+ ntfs_rsa_private_key_release(rsa_key);
+ rsa_key = NULL;
+ }
+ if (crt)
+ gnutls_x509_crt_deinit(crt);
+ if (pkey)
+ gnutls_x509_privkey_deinit(pkey);
+ if (bag)
+ gnutls_pkcs12_bag_deinit(bag);
+ if (pkcs12)
+ gnutls_pkcs12_deinit(pkcs12);
+ return 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;
+ }
+}
+
+#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 -
+ *
+ * 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) {
+ ntfs_log_error("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) {
+ ntfs_log_error("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) {
+ ntfs_log_error("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) {
+ ntfs_log_error("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) {
+ ntfs_log_error("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) {
+ ntfs_log_error("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((char *)fek, size) + 1;
+ if (padding > size) {
+ ntfs_log_error("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 = (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;
+ gcry_error_t err;
+
+ err = gcry_md_open(&hd1, GCRY_MD_MD5, 0);
+ if (err != GPG_ERR_NO_ERROR) {
+ ntfs_log_error("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) {
+ ntfs_log_error("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_decrypt
+ */
+static void ntfs_desx_decrypt(ntfs_fek *fek, u8 *outbuf, const u8 *inbuf)
+{
+ gcry_error_t err;
+ ntfs_desx_ctx *ctx = &fek->desx_ctx;
+
+ err = gcry_cipher_reset(fek->gcry_cipher_hd);
+ if (err != GPG_ERR_NO_ERROR)
+ 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(fek->gcry_cipher_hd, outbuf, 8, NULL, 0);
+ if (err != GPG_ERR_NO_ERROR)
+ ntfs_log_error("Des decryption failed (error 0x%x).\n", err);
+ *(u64*)outbuf ^= ctx->in_whitening;
+}
+
+//#define DO_CRYPTO_TESTS 1
+
+#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] = {
+ 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;
+ 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] = {
+ 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) {
+ 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) {
+ ntfs_log_error("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) {
+ 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));
+ 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;
+}
+
+#endif /* !defined(DO_CRYPTO_TESTS) */
+
+/**
+ * ntfs_fek_import_from_raw
+ */
+static ntfs_fek *ntfs_fek_import_from_raw(u8 *fek_buf, unsigned fek_size)
+{
+ ntfs_fek *fek;
+ u32 key_size, wanted_key_size, gcry_algo;
+ int gcry_mode;
+ gcry_error_t err;
+ ntfs_desx_ctx *ctx;
+
+ key_size = le32_to_cpup(fek_buf);
+ ntfs_log_debug("key_size 0x%x\n", key_size);
+ if (key_size + 16 > fek_size) {
+ ntfs_log_debug("Invalid FEK. It was probably decrypted with "
+ "the incorrect RSA key.");
+ errno = EINVAL;
+ return NULL;
+ }
+ fek = malloc(((((sizeof(*fek) + 7) & ~7) + key_size + 7) & ~7) +
+ sizeof(gcry_cipher_hd_t));
+ if (!fek) {
+ errno = ENOMEM;
+ return NULL;
+ }
+ ctx = &fek->desx_ctx;
+ fek->alg_id = *(le32*)(fek_buf + 8);
+ //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;
+ *(gcry_cipher_hd_t***)(fek->key_data + ((key_size + 7) & ~7)) =
+ &fek->des_gcry_cipher_hd_ptr;
+ switch (fek->alg_id) {
+ case CALG_DESX:
+ wanted_key_size = 16;
+ gcry_algo = GCRY_CIPHER_DES;
+ gcry_mode = GCRY_CIPHER_MODE_ECB;
+ break;
+ case CALG_3DES:
+ wanted_key_size = 24;
+ gcry_algo = GCRY_CIPHER_3DES;
+ gcry_mode = GCRY_CIPHER_MODE_CBC;
+ break;
+ case CALG_AES_256:
+ wanted_key_size = 32;
+ gcry_algo = GCRY_CIPHER_AES256;
+ gcry_mode = GCRY_CIPHER_MODE_CBC;
+ break;
+ default:
+ wanted_key_size = 8;
+ gcry_algo = GCRY_CIPHER_DES;
+ gcry_mode = GCRY_CIPHER_MODE_CBC;
+ if (fek->alg_id == CALG_DES)
+ ntfs_log_error("DES is not supported at present\n");
+ else
+ ntfs_log_error("Unknown crypto algorithm 0x%x\n",
+ le32_to_cpu(fek->alg_id));
+ ntfs_log_error(". Please email %s and say that you saw this "
+ "message. We will then try to implement "
+ "support for this algorithm.\n", NTFS_DEV_LIST);
+ err = EOPNOTSUPP;
+ goto out;
+ }
+ if (key_size != wanted_key_size) {
+ ntfs_log_error("%s key of %u bytes but needed size is %u "
+ "bytes, assuming corrupt or incorrect key. "
+ "Aborting.\n",
+ gcry_cipher_algo_name(gcry_algo),
+ (unsigned)key_size, (unsigned)wanted_key_size);
+ err = EIO;
+ goto out;
+ }
+ err = gcry_cipher_open(&fek->gcry_cipher_hd, gcry_algo,
+ gcry_mode, 0);
+
+ if (err != GPG_ERR_NO_ERROR) {
+ ntfs_log_error("gcry_cipher_open() failed: %s\n",
+ gcry_strerror(err));
+ err = EINVAL;
+ goto out;
+ }
+ if (fek->alg_id == CALG_DESX) {
+ err = ntfs_desx_key_expand(fek->key_data, (u32*)ctx->des_key,
+ &ctx->out_whitening, &ctx->in_whitening);
+ if (err == GPG_ERR_NO_ERROR)
+ err = gcry_cipher_setkey(fek->gcry_cipher_hd,
+ ctx->des_key, 8);
+ } else {
+ err = gcry_cipher_setkey(fek->gcry_cipher_hd, fek->key_data,
+ key_size);
+ }
+ if (err != GPG_ERR_NO_ERROR) {
+ ntfs_log_error("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;
+}
+
+/**
+ * ntfs_fek_release
+ */
+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);
+}
+
+/**
+ * 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, char *thumbprint,
+ int thumbprint_size)
+{
+ EFS_DF_HEADER *df_header;
+ EFS_DF_CREDENTIAL_HEADER *df_cred;
+ EFS_DF_CERT_THUMBPRINT_HEADER *df_cert;
+ u8 *fek_buf;
+ ntfs_fek *fek;
+ u32 df_count, fek_size;
+ unsigned i;
+
+ df_count = le32_to_cpu(df_array->df_count);
+ if (!df_count)
+ ntfs_log_error("There are no elements in the DF array.\n");
+ df_header = (EFS_DF_HEADER*)(df_array + 1);
+ for (i = 0; i < df_count; i++, df_header = (EFS_DF_HEADER*)(
+ (u8*)df_header + le32_to_cpu(df_header->df_length))) {
+ df_cred = (EFS_DF_CREDENTIAL_HEADER*)((u8*)df_header +
+ le32_to_cpu(df_header->cred_header_offset));
+ if (df_cred->type != NTFS_CRED_TYPE_CERT_THUMBPRINT) {
+ ntfs_log_debug("Credential type is not certificate "
+ "thumbprint, skipping DF entry.\n");
+ continue;
+ }
+ df_cert = (EFS_DF_CERT_THUMBPRINT_HEADER*)((u8*)df_cred +
+ le32_to_cpu(
+ df_cred->cert_thumbprint_header_offset));
+ if ((int)le32_to_cpu(df_cert->thumbprint_size)
+ != thumbprint_size) {
+ ntfs_log_error("Thumbprint size %d is not valid "
+ "(should be %d), skipping this DF "
+ "entry.\n",
+ le32_to_cpu(df_cert->thumbprint_size),
+ thumbprint_size);
+ continue;
+ }
+ if (memcmp((u8*)df_cert +
+ le32_to_cpu(df_cert->thumbprint_offset),
+ thumbprint, thumbprint_size)) {
+ ntfs_log_debug("Thumbprints do not match, skipping "
+ "this DF entry.\n");
+ continue;
+ }
+ /*
+ * The thumbprints match so this is probably the DF entry
+ * matching the RSA key. Try to decrypt the FEK with it.
+ */
+ 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;
+ ntfs_log_error("Failed to convert the decrypted file "
+ "encryption key to internal format.\n");
+ } else
+ ntfs_log_error("Failed to decrypt the file "
+ "encryption key.\n");
+ }
+ return NULL;
+}
+
+/**
+ * ntfs_inode_fek_get -
+ */
+static ntfs_fek *ntfs_inode_fek_get(ntfs_inode *inode,
+ ntfs_rsa_private_key rsa_key, char *thumbprint,
+ int thumbprint_size, NTFS_DF_TYPES df_type)
+{
+ EFS_ATTR_HEADER *efs;
+ EFS_DF_ARRAY_HEADER *df_array = NULL;
+ ntfs_fek *fek = NULL;
+
+ /* Obtain the $EFS contents. */
+ efs = ntfs_attr_readall(inode, AT_LOGGED_UTILITY_STREAM, EFS, 4, NULL);
+ if (!efs) {
+ ntfs_log_perror("Failed to read $EFS attribute");
+ return NULL;
+ }
+ /*
+ * Depending on whether the key is a normal key or a data recovery key,
+ * iterate through the DDF or DRF array, respectively.
+ */
+ if (df_type == DF_TYPE_DDF) {
+ if (efs->offset_to_ddf_array)
+ df_array = (EFS_DF_ARRAY_HEADER*)((u8*)efs +
+ le32_to_cpu(efs->offset_to_ddf_array));
+ else
+ ntfs_log_error("There are no entries in the DDF "
+ "array.\n");
+ } else if (df_type == DF_TYPE_DRF) {
+ if (efs->offset_to_drf_array)
+ df_array = (EFS_DF_ARRAY_HEADER*)((u8*)efs +
+ le32_to_cpu(efs->offset_to_drf_array));
+ else
+ ntfs_log_error("There are no entries in the DRF "
+ "array.\n");
+ } else
+ ntfs_log_error("Invalid DF type.\n");
+ if (df_array)
+ fek = ntfs_df_array_fek_get(df_array, rsa_key, thumbprint,
+ thumbprint_size);
+ free(efs);
+ 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) {
+ ntfs_log_error("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.
+ */
+ if (fek->alg_id == CALG_DESX) {
+ int k;
+
+ for (k=0; k<512; k+=8) {
+ ntfs_desx_decrypt(fek, &data[k], &data[k]);
+ }
+ } else
+ err = gcry_cipher_decrypt(fek->gcry_cipher_hd, data, 512, NULL, 0);
+ if (err != GPG_ERR_NO_ERROR) {
+ ntfs_log_error("Decryption failed: %s\n", gcry_strerror(err));
+ return -1;
+ }
+ /* Apply the IV. */
+ if (fek->alg_id == CALG_AES_256) {
+ ((le64*)data)[0] ^= cpu_to_le64(0x5816657be9161312ULL + offset);
+ ((le64*)data)[1] ^= cpu_to_le64(0x1989adbe44918961ULL + offset);
+ } else {
+ /* All other algos (Des, 3Des, DesX) use the same IV. */
+ ((le64*)data)[0] ^= cpu_to_le64(0x169119629891ad13ULL + offset);
+ }
+ return 512;
+}
+
+/**
+ * ntfs_cat_decrypt - Decrypt the contents of an encrypted file to stdout.
+ * @inode: An encrypted file's inode structure, as obtained by
+ * ntfs_inode_open().
+ * @fek: A file encryption key. As obtained by ntfs_inode_fek_get().
+ */
+static int ntfs_cat_decrypt(ntfs_inode *inode, ntfs_fek *fek)
+{
+ int bufsize = 512;
+ unsigned char *buffer;
+ ntfs_attr *attr;
+ s64 bytes_read, written, offset, total;
+ s64 old_data_size, old_initialized_size;
+ int i;
+
+ buffer = malloc(bufsize);
+ if (!buffer)
+ return 1;
+ attr = ntfs_attr_open(inode, AT_DATA, NULL, 0);
+ if (!attr) {
+ ntfs_log_error("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.
+ old_data_size = attr->data_size;
+ old_initialized_size = attr->initialized_size;
+ 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) {
+ ntfs_log_perror("ERROR: Couldn't read file");
+ break;
+ }
+ if (!bytes_read)
+ break;
+ if ((i = ntfs_fek_decrypt_sector(fek, buffer, offset)) <
+ bytes_read) {
+ 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) {
+ ntfs_log_perror("ERROR: Couldn't output all data!");
+ break;
+ }
+ 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;
+}
+
+/**
+ * main - Begin here
+ *
+ * Start from here.
+ *
+ * Return: 0 Success, the program worked
+ * 1 Error, something went wrong
+ */
+int main(int argc, char *argv[])
+{
+ u8 *pfx_buf;
+ char *password;
+ ntfs_rsa_private_key rsa_key;
+ ntfs_volume *vol;
+ ntfs_inode *inode;
+ ntfs_fek *fek;
+ unsigned pfx_size;
+ int res;
+ NTFS_DF_TYPES df_type;
+ char thumbprint[NTFS_SHA1_THUMBPRINT_SIZE];
+
+ 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()) {
+ 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)) {
+ ntfs_log_error("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) {
+ ntfs_log_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,
+ thumbprint, sizeof(thumbprint), &df_type);
+ /* Destroy the password. */
+ memset(password, 0, strlen(password));
+ /* No longer need the pfx file contents. */
+ free(pfx_buf);
+ if (!rsa_key) {
+ ntfs_log_error("Failed to extract the private RSA key.\n");
+ ntfs_crypto_deinit();
+ return 1;
+ }
+ /* Mount the ntfs volume. */
+ vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY |
+ (opts.force ? NTFS_MNT_RECOVER : 0));
+ if (!vol) {
+ ntfs_log_error("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) {
+ ntfs_log_error("Failed to open encrypted file. Aborting.\n");
+ ntfs_umount(vol, FALSE);
+ ntfs_rsa_private_key_release(rsa_key);
+ ntfs_crypto_deinit();
+ return 1;
+ }
+ /* Obtain the file encryption key of the encrypted file. */
+ fek = ntfs_inode_fek_get(inode, rsa_key, thumbprint,
+ sizeof(thumbprint), df_type);
+ ntfs_rsa_private_key_release(rsa_key);
+ if (fek) {
+ res = ntfs_cat_decrypt(inode, fek);
+ ntfs_fek_release(fek);
+ } else {
+ ntfs_log_error("Failed to obtain file encryption key. "
+ "Aborting.\n");
+ res = 1;
+ }
+ ntfs_inode_close(inode);
+ ntfs_umount(vol, FALSE);
+ ntfs_crypto_deinit();
+ return res;
+}
diff --git a/ntfsprogs/ntfsdump_logfile.c b/ntfsprogs/ntfsdump_logfile.c
new file mode 100755
index 0000000..279ebac
--- a/dev/null
+++ b/ntfsprogs/ntfsdump_logfile.c
@@ -0,0 +1,779 @@
+/**
+ * ntfsdump_logfile - Part of the Linux-NTFS project.
+ *
+ * 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
+ * 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
+ */
+/* TODO:
+ * - Remove the need for clipping at 64MiB.
+ * - Add normal command line switchs (use getopt_long()).
+ * - For a volume: allow dumping only uncommitted records.
+ * - For a file: get an optional command line parameter for the last SN.
+ * - Sanity checks.
+ */
+
+#include "config.h"
+
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#include "types.h"
+#include "endians.h"
+#include "volume.h"
+#include "inode.h"
+#include "attrib.h"
+#include "layout.h"
+#include "logfile.h"
+#include "mst.h"
+#include "utils.h"
+/* #include "version.h" */
+#include "logging.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;
+
+/**
+ * logfile_close
+ */
+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))
+ ntfs_log_perror("Warning: Failed to close $LogFile "
+ "(inode %i)", FILE_LogFile);
+ if (ntfs_umount(logfile->vol, 0))
+ ntfs_log_perror("Warning: Failed to umount %s",
+ logfile->filename);
+ } else {
+ if (close(logfile->fd))
+ ntfs_log_perror("Warning: Failed to close file %s",
+ logfile->filename);
+ }
+ 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.
+ */
+__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;
+
+ if (na)
+ ntfs_attr_close(na);
+ if (ni && ntfs_inode_close(ni))
+ ntfs_log_perror("Warning: Failed to close $LogFile (inode %i)",
+ FILE_LogFile);
+ if (ntfs_umount(vol, 0))
+ ntfs_log_perror("Warning: Failed to umount");
+
+ fprintf(stderr, "ERROR: ");
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+
+ ntfs_log_error("Aborting...\n");
+ exit(1);
+}
+
+/**
+ * log_err_exit -
+ */
+__attribute__((noreturn))
+__attribute__((format(printf, 2, 3)))
+static void log_err_exit(u8 *buf, const char *fmt, ...)
+{
+ va_list ap;
+
+ free(buf);
+
+ fprintf(stderr, "ERROR: ");
+ va_start(ap, fmt);
+ vfprintf(stderr, fmt, ap);
+ va_end(ap);
+
+ ntfs_log_error("Aborting...\n");
+ exit(1);
+}
+
+/**
+ * usage -
+ */
+__attribute__((noreturn))
+static void usage(const char *exec_name)
+{
+ ntfs_log_error("%s v%s (libntfs-3g) - 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,
+ exec_name, exec_name,
+ exec_name, exec_name, exec_name, exec_name);
+ exit(1);
+}
+
+/**
+ * logfile_open
+ */
+static int logfile_open(BOOL is_volume, const char *filename,
+ logfile_file *logfile)
+{
+ if (is_volume) {
+ ntfs_volume *vol;
+ ntfs_inode *ni;
+ ntfs_attr *na;
+
+ /* Porting note: NTFS_MNT_FORENSIC is not needed when we mount
+ * the volume in read-only mode. No changes will be made to the
+ * logfile or anything else when we are in read only-mode. */
+ vol = ntfs_mount(filename, NTFS_MNT_RDONLY);
+ if (!vol)
+ log_err_exit(NULL, "Failed to mount %s: %s\n",
+ filename, strerror(errno));
+ ntfs_log_info("Mounted NTFS volume %s (NTFS v%i.%i) on device %s.\n",
+ vol->vol_name ? vol->vol_name : "<NO_NAME>",
+ vol->major_ver, vol->minor_ver, filename);
+ if (ntfs_version_is_supported(vol))
+ device_err_exit(vol, NULL, NULL,
+ "Unsupported NTFS version.\n");
+ ni = ntfs_inode_open(vol, FILE_LogFile);
+ if (!ni)
+ 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(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(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 (stat(filename, &sbuf) == -1) {
+ if (errno == ENOENT)
+ log_err_exit(NULL, "The file %s does not "
+ "exist. Did you specify it "
+ "correctly?\n", filename);
+ log_err_exit(NULL, "Error getting information about "
+ "%s: %s\n", filename, strerror(errno));
+ }
+
+ fd = open(filename, O_RDONLY);
+ if (fd == -1)
+ log_err_exit(NULL, "Failed to open file %s: %s\n",
+ filename, strerror(errno));
+ logfile->data_size = sbuf.st_size;
+ logfile->fd = fd;
+ }
+
+ 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) {
+ ntfs_log_error("Could not seek to offset %u\n", ofs);
+ return 0;
+ }
+ br = read(logfile->fd, buf, count);
+ }
+ if (br != count) {
+ ntfs_log_error("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))
+ 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");
+ }
+ /* 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_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");
+ 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_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. "
+ "Cannot handle this yet.\n");
+ 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_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 "
+ "yet.\n");
+}
+
+/**
+ * dump_restart_areas_header
+ */
+static void dump_restart_areas_header(RESTART_PAGE_HEADER *rstr)
+{
+ ntfs_log_info("\nRestart page header:\n");
+ ntfs_log_info("magic = %s\n", ntfs_is_rstr_record(rstr->magic) ? "RSTR" :
+ "CHKD");
+ ntfs_log_info("usa_ofs = %u (0x%x)\n", le16_to_cpu(rstr->usa_ofs),
+ le16_to_cpu(rstr->usa_ofs));
+ ntfs_log_info("usa_count = %u (0x%x)\n", le16_to_cpu(rstr->usa_count),
+ le16_to_cpu(rstr->usa_count));
+ 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));
+ 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));
+ 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));
+ 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;
+ RESTART_AREA *ra;
+ int client;
+
+ ra = (RESTART_AREA*)((u8*)rstr +
+ le16_to_cpu(rstr->restart_area_offset));
+ 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));
+ ntfs_log_info("log_clients = %u (0x%x)\n", le16_to_cpu(ra->log_clients),
+ le16_to_cpu(ra->log_clients));
+ 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));
+ 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));
+ 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));
+ ntfs_log_info("restart_area_length = %u (0x%x)\n",
+ le16_to_cpu(ra->restart_area_length),
+ le16_to_cpu(ra->restart_area_length));
+ ntfs_log_info("client_array_offset = %u (0x%x)\n",
+ le16_to_cpu(ra->client_array_offset),
+ le16_to_cpu(ra->client_array_offset));
+ 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));
+ 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));
+ 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));
+ 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));
+ 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 +
+ le16_to_cpu(ra->client_array_offset));
+ for (client = 0; client < le16_to_cpu(ra->log_clients); client++) {
+ char *client_name;
+
+ 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));
+ 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));
+ ntfs_log_info("prev_client = %i (0x%x)\n",
+ (s16)le16_to_cpu(lcr->prev_client),
+ le16_to_cpu(lcr->prev_client));
+ ntfs_log_info("next_client = %i (0x%x)\n",
+ (s16)le16_to_cpu(lcr->next_client),
+ le16_to_cpu(lcr->next_client));
+ ntfs_log_info("seq_number = %u (0x%x)\n", le16_to_cpu(lcr->seq_number),
+ le16_to_cpu(lcr->seq_number));
+ 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)) {
+ client_name = NULL;
+ if (ntfs_ucstombs(lcr->client_name,
+ le32_to_cpu(lcr->client_name_length) /
+ 2, &client_name, 0) < 0) {
+ ntfs_log_perror("Failed to convert log client name");
+ client_name = strdup("<conversion error>");
+ }
+ } else
+ client_name = strdup("<unnamed>");
+ ntfs_log_info("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++;
+ }
+}
+
+/**
+ * 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)
+ ntfs_log_info("$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_area_offset));
+ if (!memcmp(rstr1, rstr, le16_to_cpu(rstr1->usa_ofs)) &&
+ !memcmp((u8*)rstr1 + le16_to_cpu(
+ 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 "
+ "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. */
+ ntfs_log_info("\n%s restart page:\n", pass == 1 ? "1st" : "2nd");
+ dump_restart_areas_header(rstr);
+
+ ntfs_log_info("\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;
+ }
+
+ return rstr;
+}
+
+/**
+ * dump_log_records()
+ */
+static void dump_log_record(LOG_RECORD *lr)
+{
+ unsigned int i;
+ ntfs_log_info("this lsn = 0x%llx\n",
+ (unsigned long long)le64_to_cpu(lr->this_lsn));
+ ntfs_log_info("client previous lsn = 0x%llx\n", (unsigned long long)
+ le64_to_cpu(lr->client_previous_lsn));
+ ntfs_log_info("client undo next lsn = 0x%llx\n", (unsigned long long)
+ le64_to_cpu(lr->client_undo_next_lsn));
+ ntfs_log_info("client data length = 0x%x\n",
+ (unsigned int)le32_to_cpu(lr->client_data_length));
+ ntfs_log_info("client_id.seq_number = 0x%x\n",
+ le16_to_cpu(lr->client_id.seq_number));
+ ntfs_log_info("client_id.client_index = 0x%x\n",
+ le16_to_cpu(lr->client_id.client_index));
+ ntfs_log_info("record type = 0x%x\n",
+ (unsigned int)le32_to_cpu(lr->record_type));
+ ntfs_log_info("transaction_id = 0x%x\n",
+ (unsigned int)le32_to_cpu(lr->transaction_id));
+ ntfs_log_info("flags = 0x%x:", lr->flags);
+ if (!lr->flags)
+ ntfs_log_info(" NONE\n");
+ else {
+ int _b = 0;
+
+ if (lr->flags & LOG_RECORD_MULTI_PAGE) {
+ ntfs_log_info(" LOG_RECORD_MULTI_PAGE");
+ _b = 1;
+ }
+ if (lr->flags & ~LOG_RECORD_MULTI_PAGE) {
+ if (_b)
+ ntfs_log_info(" |");
+ ntfs_log_info(" Unknown flags");
+ }
+ ntfs_log_info("\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)
+ ntfs_log_info("Array of lcns:\n");
+ for (i = 0; i < le16_to_cpu(lr->lcns_to_follow); i++)
+ ntfs_log_info("lcn_list[%u].lcn = 0x%llx\n", i, (unsigned long long)
+ sle64_to_cpu(lr->lcn_list[i].lcn));
+}
+
+/**
+ * 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;
+ 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;
+ 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 */
+ ntfs_log_info("magic = %s\n", ntfs_is_rcrd_record(rcrd->magic) ? "RCRD" :
+ "CHKD");
+// TODO: I am here... (AIA)
+ ntfs_log_info("copy.last_lsn/file_offset = 0x%llx\n", (unsigned long long)
+ le64_to_cpu(rcrd->copy.last_lsn));
+ 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));
+ 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 +
+ * usa_client * 2 + 7 & ~7 or is it derived from somewhere?
+ */
+ lr = (LOG_RECORD*)((u8*)rcrd + 0x40);
+ client = 0;
+ do {
+ ntfs_log_info("\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;
+}
+
+/**
+ * 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;
+
+ ntfs_log_set_handler(ntfs_log_handler_outerr);
+
+ ntfs_log_info("\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
+ 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) {
+ ntfs_log_perror("Failed to allocate buffer for file data");
+ 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.
+ 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.
+ 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);
+ ntfs_log_info("\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;
+}
+
diff --git a/ntfsprogs/ntfsfix.8 b/ntfsprogs/ntfsfix.8
new file mode 100644
index 0000000..a458429
--- a/dev/null
+++ b/ntfsprogs/ntfsfix.8
@@ -0,0 +1,81 @@
+.\" 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 "January 2006" "ntfs-3g 2014.2.15"
+.SH NAME
+ntfsfix \- fix common errors and force Windows to check NTFS
+.SH SYNOPSIS
+.B ntfsfix
+[\fIoptions\fR] \fIdevice\fR
+.SH DESCRIPTION
+.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 was damaged by Windows or some other way
+and it cannot be mounted.
+.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\-b\fR, \fB\-\-clear\-bad\-sectors\fR
+Clear the list of bad sectors. This is useful after cloning an old disk
+with bad sectors to a new disk.
+.TP
+\fB\-d\fR, \fB\-\-clear\-dirty\fR
+Clear the volume dirty flag if the volume can be fixed and mounted.
+If the option is not present or the volume cannot be fixed, the dirty
+volume flag is set to request a volume checking at next mount.
+.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
+Do not write anything, just show what would have been done.
+.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
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.SH AUTHORS
+.B ntfsfix
+was written by Anton Altaparmakov, with contributions from Szabolcs Szakacsits.
+It was ported to ntfs-3g by Erik Larsson and Jean-Pierre Andre.
+.SH AVAILABILITY
+.B ntfsfix
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR mkntfs (8),
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfsfix.8.in b/ntfsprogs/ntfsfix.8.in
new file mode 100755
index 0000000..8976c90
--- a/dev/null
+++ b/ntfsprogs/ntfsfix.8.in
@@ -0,0 +1,81 @@
+.\" 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 "January 2006" "ntfs-3g @VERSION@"
+.SH NAME
+ntfsfix \- fix common errors and force Windows to check NTFS
+.SH SYNOPSIS
+.B ntfsfix
+[\fIoptions\fR] \fIdevice\fR
+.SH DESCRIPTION
+.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 was damaged by Windows or some other way
+and it cannot be mounted.
+.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\-b\fR, \fB\-\-clear\-bad\-sectors\fR
+Clear the list of bad sectors. This is useful after cloning an old disk
+with bad sectors to a new disk.
+.TP
+\fB\-d\fR, \fB\-\-clear\-dirty\fR
+Clear the volume dirty flag if the volume can be fixed and mounted.
+If the option is not present or the volume cannot be fixed, the dirty
+volume flag is set to request a volume checking at next mount.
+.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
+Do not write anything, just show what would have been done.
+.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
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.SH AUTHORS
+.B ntfsfix
+was written by Anton Altaparmakov, with contributions from Szabolcs Szakacsits.
+It was ported to ntfs-3g by Erik Larsson and Jean-Pierre Andre.
+.SH AVAILABILITY
+.B ntfsfix
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR mkntfs (8),
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfsfix.c b/ntfsprogs/ntfsfix.c
new file mode 100755
index 0000000..eaf474c
--- a/dev/null
+++ b/ntfsprogs/ntfsfix.c
@@ -0,0 +1,1657 @@
+/**
+ * ntfsfix - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2000-2006 Anton Altaparmakov
+ * Copyright (c) 2002-2006 Szabolcs Szakacsits
+ * Copyright (c) 2007 Yura Pakhuchiy
+ * Copyright (c) 2011-2012 Jean-Pierre Andre
+ *
+ * This utility fixes some common NTFS problems, resets the NTFS journal file
+ * and schedules an NTFS consistency check for the first boot into Windows.
+ *
+ * Anton Altaparmakov <aia21@cantab.net>
+ *
+ * This 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 <asm/unaligned.h>), 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 <aia21@cantab.net>
+ */
+
+#include "config.h"
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+
+#include "types.h"
+#include "attrib.h"
+#include "volume.h"
+#include "bootsect.h"
+#include "mft.h"
+#include "device.h"
+#include "logfile.h"
+#include "runlist.h"
+#include "mst.h"
+#include "utils.h"
+/* #include "version.h" */
+#include "logging.h"
+#include "misc.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
+
+static const char *EXEC_NAME = "ntfsfix";
+static const char OK[] = "OK\n";
+static const char FAILED[] = "FAILED\n";
+static const char FOUND[] = "FOUND\n";
+
+#define DEFAULT_SECTOR_SIZE 512
+
+static struct {
+ char *volume;
+ BOOL no_action;
+ BOOL clear_bad_sectors;
+ BOOL clear_dirty;
+} opt;
+
+/*
+ * Definitions for fixing the self-located MFT bug
+ */
+
+#define SELFLOC_LIMIT 16
+
+struct MFT_SELF_LOCATED {
+ ntfs_volume *vol;
+ MFT_RECORD *mft0;
+ MFT_RECORD *mft1;
+ MFT_RECORD *mft2;
+ ATTR_LIST_ENTRY *attrlist;
+ ATTR_LIST_ENTRY *attrlist_to_ref1;
+ MFT_REF mft_ref0;
+ MFT_REF mft_ref1;
+ LCN attrlist_lcn;
+ BOOL attrlist_resident;
+} ;
+
+/**
+ * usage
+ */
+__attribute__((noreturn))
+static void usage(void)
+{
+ ntfs_log_info("%s v%s (libntfs-3g)\n"
+ "\n"
+ "Usage: %s [options] device\n"
+ " Attempt to fix an NTFS partition.\n"
+ "\n"
+ " -b, --clear-bad-sectors Clear the bad sector list\n"
+ " -d, --clear-dirty Clear the volume dirty flag\n"
+ " -h, --help Display this help\n"
+ " -n, --no-action Do not write anything\n"
+ " -V, --version Display version information\n"
+ "\n"
+ "For example: %s /dev/hda6\n\n",
+ EXEC_NAME, VERSION, EXEC_NAME,
+ EXEC_NAME);
+ ntfs_log_info("%s%s", ntfs_bugs, ntfs_home);
+ exit(1);
+}
+
+/**
+ * version
+ */
+__attribute__((noreturn))
+static void version(void)
+{
+ ntfs_log_info("%s v%s\n\n"
+ "Attempt to fix an NTFS partition.\n\n"
+ "Copyright (c) 2000-2006 Anton Altaparmakov\n"
+ "Copyright (c) 2002-2006 Szabolcs Szakacsits\n"
+ "Copyright (c) 2007 Yura Pakhuchiy\n\n"
+ "Copyright (c) 2011 Jean-Pierre Andre\n\n",
+ EXEC_NAME, VERSION);
+ 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)
+{
+ int c;
+ static const char *sopt = "-bdhnV";
+ static const struct option lopt[] = {
+ { "help", no_argument, NULL, 'h' },
+ { "no-action", no_argument, NULL, 'n' },
+ { "clear-bad-sectors", no_argument, NULL, 'b' },
+ { "clear-dirty", no_argument, NULL, 'd' },
+ { "version", no_argument, NULL, 'V' },
+ { NULL, 0, NULL, 0 }
+ };
+
+ 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)
+ opt.volume = argv[optind - 1];
+ else {
+ ntfs_log_info("ERROR: Too many arguments.\n");
+ usage();
+ }
+ break;
+ case 'b':
+ opt.clear_bad_sectors = TRUE;
+ break;
+ case 'd':
+ opt.clear_dirty = TRUE;
+ break;
+ case 'n':
+ opt.no_action = TRUE;
+ break;
+ case 'h':
+ case '?':
+ usage();
+ /* fall through */
+ case 'V':
+ version();
+ default:
+ ntfs_log_info("ERROR: Unknown option '%s'.\n", argv[optind - 1]);
+ usage();
+ }
+ }
+
+ if (opt.volume == NULL) {
+ 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 le16 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)) {
+ ntfs_log_perror("Failed to read $Volume");
+ return -1;
+ }
+ /* Sanity check */
+ if (!(m->flags & MFT_RECORD_IN_USE)) {
+ 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) {
+ ntfs_log_debug("Failed to allocate attribute search "
+ "context.\n");
+ goto err_exit;
+ }
+ if (ntfs_attr_lookup(AT_VOLUME_INFORMATION, AT_UNNAMED, 0,
+ CASE_SENSITIVE, 0, NULL, 0, ctx)) {
+ ntfs_log_error("Attribute $VOLUME_INFORMATION was not found in "
+ "$Volume!\n");
+ goto err_out;
+ }
+ a = ctx->attr;
+ /* Sanity check. */
+ if (a->non_resident) {
+ ntfs_log_error("Attribute $VOLUME_INFORMATION must be resident "
+ "(and it isn't)!\n");
+ 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) >
+ (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)) {
+ ntfs_log_error("Attribute $VOLUME_INFORMATION in $Volume is "
+ "corrupt!\n");
+ errno = EIO;
+ goto err_out;
+ }
+ /* Set the volume flags. */
+ vol->flags = c->flags = flags;
+ if (ntfs_mft_record_write(vol, FILE_Volume, m)) {
+ ntfs_log_perror("Error writing $Volume");
+ goto err_out;
+ }
+ ret = 0; /* success */
+err_out:
+ ntfs_attr_put_search_ctx(ctx);
+err_exit:
+ free(m);
+ return ret;
+}
+
+/**
+ * set_dirty_flag
+ */
+static int set_dirty_flag(ntfs_volume *vol)
+{
+ le16 flags;
+
+ /* Porting note: We test for the current state of VOLUME_IS_DIRTY. This
+ * should actually be more appropriate than testing for NVolWasDirty. */
+ if (vol->flags & VOLUME_IS_DIRTY)
+ return 0;
+ 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.
+ */
+ flags = vol->flags | VOLUME_IS_DIRTY;
+ if (!opt.no_action && OLD_ntfs_volume_set_flags(vol, flags)) {
+ ntfs_log_info(FAILED);
+ ntfs_log_error("Error setting volume flags.\n");
+ return -1;
+ }
+ vol->flags = flags;
+
+ /* Porting note: libntfs-3g does not have the 'WasDirty' flag/property,
+ * and never touches the 'dirty' bit except when explicitly told to do
+ * so. Since we just wrote the VOLUME_IS_DIRTY bit to disk, and
+ * vol->flags is up-to-date, we can just ignore the NVolSetWasDirty
+ * statement. */
+ /* NVolSetWasDirty(vol); */
+
+ ntfs_log_info(OK);
+ return 0;
+}
+
+/**
+ * empty_journal
+ */
+static int empty_journal(ntfs_volume *vol)
+{
+ if (NVolLogFileEmpty(vol))
+ return 0;
+ ntfs_log_info("Going to empty the journal ($LogFile)... ");
+ if (ntfs_logfile_reset(vol)) {
+ ntfs_log_info(FAILED);
+ ntfs_log_perror("Failed to reset $LogFile");
+ return -1;
+ }
+ ntfs_log_info(OK);
+ return 0;
+}
+
+/**
+ * Clear the bad cluster marks (option)
+ */
+static int clear_badclus(ntfs_volume *vol)
+{
+ static ntfschar badstream[] = {
+ const_cpu_to_le16('$'), const_cpu_to_le16('B'),
+ const_cpu_to_le16('a'), const_cpu_to_le16('d')
+ } ;
+ ntfs_inode *ni;
+ ntfs_attr *na;
+ BOOL ok;
+
+ ok = FALSE;
+ ntfs_log_info("Going to un-mark the bad clusters ($BadClus)... ");
+ ni = ntfs_inode_open(vol, FILE_BadClus);
+ if (ni) {
+ na = ntfs_attr_open(ni, AT_DATA, badstream, 4);
+ /*
+ * chkdsk does not adjust the data size when
+ * moving clusters to $BadClus, so we have to
+ * check the runlist.
+ */
+ if (na && !ntfs_attr_map_whole_runlist(na)) {
+ if (na->rl
+ && na->rl[0].length && na->rl[1].length) {
+ /*
+ * Truncate the stream to free all its clusters,
+ * (which requires setting the data size according
+ * to allocation), then reallocate a sparse stream
+ * to full size of volume and reset the data size.
+ */
+ na->data_size = na->allocated_size;
+ na->initialized_size = na->allocated_size;
+ if (!ntfs_attr_truncate(na,0)
+ && !ntfs_attr_truncate(na,vol->nr_clusters
+ << vol->cluster_size_bits)) {
+ na->data_size = 0;
+ na->initialized_size = 0;
+ ni->flags |= FILE_ATTR_SPARSE_FILE;
+ NInoFileNameSetDirty(ni);
+ ok = TRUE;
+ } else {
+ ntfs_log_perror("Failed to un-mark the bad clusters");
+ }
+ } else {
+ ntfs_log_info("No bad clusters...");
+ ok = TRUE;
+ }
+ ntfs_attr_close(na);
+ } else {
+ ntfs_log_perror("Failed to open $BadClus::$Bad");
+ }
+ ntfs_inode_close(ni);
+ } else {
+ ntfs_log_perror("Failed to open inode FILE_BadClus");
+ }
+ if (ok)
+ ntfs_log_info(OK);
+ return (ok ? 0 : -1);
+}
+
+/**
+ * fix_mftmirr
+ */
+static int fix_mftmirr(ntfs_volume *vol)
+{
+ s64 l, br;
+ unsigned char *m, *m2;
+ int i, ret = -1; /* failure */
+ BOOL done;
+
+ 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) {
+ ntfs_log_perror("Failed to allocate memory");
+ return -1;
+ }
+ m2 = (u8*)malloc(vol->mftmirr_size << vol->mft_record_size_bits);
+ if (!m2) {
+ ntfs_log_perror("Failed to allocate memory");
+ free(m);
+ return -1;
+ }
+
+ 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) {
+ ntfs_log_info(FAILED);
+ if (l != -1)
+ errno = EIO;
+ ntfs_log_perror("Failed to read $MFT");
+ goto error_exit;
+ }
+ ntfs_log_info(OK);
+
+ 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) {
+ ntfs_log_info(FAILED);
+ if (l != -1)
+ errno = EIO;
+ ntfs_log_perror("Failed to read $MFTMirr");
+ goto error_exit;
+ }
+ ntfs_log_info(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?
+ */
+
+ ntfs_log_info("Comparing $MFTMirr to $MFT... ");
+ done = FALSE;
+ for (i = 0; i < vol->mftmirr_size; ++i) {
+ MFT_RECORD *mrec, *mrec2;
+ const char *ESTR[12] = { "$MFT", "$MFTMirr", "$LogFile",
+ "$Volume", "$AttrDef", "root directory", "$Bitmap",
+ "$Boot", "$BadClus", "$Secure", "$UpCase", "$Extend" };
+ const char *s;
+ BOOL use_mirr;
+
+ if (i < 12)
+ s = ESTR[i];
+ else if (i < 16)
+ s = "system file";
+ else
+ s = "mft record";
+
+ use_mirr = FALSE;
+ mrec = (MFT_RECORD*)(m + i * vol->mft_record_size);
+ if (mrec->flags & MFT_RECORD_IN_USE) {
+ if (ntfs_is_baad_record(mrec->magic)) {
+ 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_record(mrec->magic)) {
+ ntfs_log_info(FAILED);
+ ntfs_log_error("$MFT error: Invalid mft "
+ "record for %s.\nCannot "
+ "handle this yet. )-:\n", s);
+ goto error_exit;
+ }
+ }
+ mrec2 = (MFT_RECORD*)(m2 + i * vol->mft_record_size);
+ if (mrec2->flags & MFT_RECORD_IN_USE) {
+ if (ntfs_is_baad_record(mrec2->magic)) {
+ ntfs_log_info(FAILED);
+ ntfs_log_error("$MFTMirr error: Incomplete "
+ "multi sector transfer "
+ "detected in %s.\n", s);
+ goto error_exit;
+ }
+ if (!ntfs_is_mft_record(mrec2->magic)) {
+ ntfs_log_info(FAILED);
+ ntfs_log_error("$MFTMirr error: Invalid mft "
+ "record for %s.\n", s);
+ goto error_exit;
+ }
+ /* $MFT is corrupt but $MFTMirr is ok, use $MFTMirr. */
+ if (!(mrec->flags & MFT_RECORD_IN_USE) &&
+ !ntfs_is_mft_record(mrec->magic))
+ use_mirr = TRUE;
+ }
+ if (memcmp(mrec, mrec2, ntfs_mft_record_get_data_size(mrec))) {
+ if (!done) {
+ done = TRUE;
+ ntfs_log_info(FAILED);
+ }
+ ntfs_log_info("Correcting differences in $MFT%s "
+ "record %d...", use_mirr ? "" : "Mirr",
+ i);
+ br = ntfs_mft_record_write(vol, i,
+ use_mirr ? mrec2 : mrec);
+ if (br) {
+ ntfs_log_info(FAILED);
+ ntfs_log_perror("Error correcting $MFT%s",
+ use_mirr ? "" : "Mirr");
+ goto error_exit;
+ }
+ ntfs_log_info(OK);
+ }
+ }
+ if (!done)
+ ntfs_log_info(OK);
+ ntfs_log_info("Processing of $MFT and $MFTMirr completed "
+ "successfully.\n");
+ ret = 0;
+error_exit:
+ free(m);
+ free(m2);
+ return ret;
+}
+
+/*
+ * Rewrite the $UpCase file as default
+ *
+ * Returns 0 if could be written
+ */
+
+static int rewrite_upcase(ntfs_volume *vol, ntfs_attr *na)
+{
+ s64 l;
+ int res;
+
+ /* writing the $UpCase may require bitmap updates */
+ res = -1;
+ vol->lcnbmp_ni = ntfs_inode_open(vol, FILE_Bitmap);
+ if (!vol->lcnbmp_ni) {
+ ntfs_log_perror("Failed to open bitmap inode");
+ } else {
+ vol->lcnbmp_na = ntfs_attr_open(vol->lcnbmp_ni, AT_DATA,
+ AT_UNNAMED, 0);
+ if (!vol->lcnbmp_na) {
+ ntfs_log_perror("Failed to open bitmap data attribute");
+ } else {
+ /* minimal consistency check on the bitmap */
+ if (((vol->lcnbmp_na->data_size << 3)
+ < vol->nr_clusters)
+ || ((vol->lcnbmp_na->data_size << 3)
+ >= (vol->nr_clusters << 1))
+ || (vol->lcnbmp_na->data_size
+ > vol->lcnbmp_na->allocated_size)) {
+ ntfs_log_error("Corrupt cluster map size %lld"
+ " (allocated %lld minimum %lld)\n",
+ (long long)vol->lcnbmp_na->data_size,
+ (long long)vol->lcnbmp_na->allocated_size,
+ (long long)(vol->nr_clusters + 7) >> 3);
+ } else {
+ ntfs_log_info("Rewriting $UpCase file\n");
+ l = ntfs_attr_pwrite(na, 0, vol->upcase_len*2,
+ vol->upcase);
+ if (l != vol->upcase_len*2) {
+ ntfs_log_error("Failed to rewrite $UpCase\n");
+ } else {
+ ntfs_log_info("$UpCase has been set to default\n");
+ res = 0;
+ }
+ }
+ ntfs_attr_close(vol->lcnbmp_na);
+ vol->lcnbmp_na = (ntfs_attr*)NULL;
+ }
+ ntfs_inode_close(vol->lcnbmp_ni);
+ vol->lcnbmp_ni = (ntfs_inode*)NULL;
+ }
+ return (res);
+}
+
+/*
+ * Fix the $UpCase file
+ *
+ * Returns 0 if the table is valid or has been fixed
+ */
+
+static int fix_upcase(ntfs_volume *vol)
+{
+ ntfs_inode *ni;
+ ntfs_attr *na;
+ ntfschar *upcase;
+ s64 l;
+ u32 upcase_len;
+ u32 k;
+ int res;
+
+ res = -1;
+ ni = (ntfs_inode*)NULL;
+ na = (ntfs_attr*)NULL;
+ /* Now load the upcase table from $UpCase. */
+ ntfs_log_debug("Loading $UpCase...\n");
+ ni = ntfs_inode_open(vol, FILE_UpCase);
+ if (!ni) {
+ ntfs_log_perror("Failed to open inode FILE_UpCase");
+ goto error_exit;
+ }
+ /* Get an ntfs attribute for $UpCase/$DATA. */
+ na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0);
+ if (!na) {
+ ntfs_log_perror("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) {
+ ntfs_log_error("Error: Upcase table is too big (max 32-bit "
+ "allowed).\n");
+ errno = EINVAL;
+ goto error_exit;
+ }
+ upcase_len = na->data_size >> 1;
+ upcase = (ntfschar*)ntfs_malloc(na->data_size);
+ if (!upcase)
+ goto error_exit;
+ /* Read in the $DATA attribute value into the buffer. */
+ l = ntfs_attr_pread(na, 0, na->data_size, upcase);
+ if (l != na->data_size) {
+ ntfs_log_error("Failed to read $UpCase, unexpected length "
+ "(%lld != %lld).\n", (long long)l,
+ (long long)na->data_size);
+ errno = EIO;
+ goto error_exit;
+ }
+ /* Consistency check of $UpCase, restricted to plain ASCII chars */
+ k = 0x20;
+ while ((k < upcase_len)
+ && (k < 0x7f)
+ && (le16_to_cpu(upcase[k])
+ == ((k < 'a') || (k > 'z') ? k : k + 'A' - 'a')))
+ k++;
+ if (k < 0x7f) {
+ ntfs_log_error("Corrupted file $UpCase\n");
+ if (!opt.no_action) {
+ /* rewrite the $UpCase file from default */
+ res = rewrite_upcase(vol, na);
+ /* free the bad upcase record */
+ if (!res)
+ free(upcase);
+ } else {
+ /* keep the default upcase but return an error */
+ free(upcase);
+ }
+ } else {
+ /* accept the upcase table read from $UpCase */
+ free(vol->upcase);
+ vol->upcase = upcase;
+ vol->upcase_len = upcase_len;
+ res = 0;
+ }
+error_exit :
+ /* Done with the $UpCase mft record. */
+ if (na)
+ ntfs_attr_close(na);
+ if (ni && ntfs_inode_close(ni)) {
+ ntfs_log_perror("Failed to close $UpCase");
+ }
+ return (res);
+}
+
+/*
+ * Rewrite the boot sector
+ *
+ * Returns 0 if successful
+ */
+
+static int rewrite_boot(struct ntfs_device *dev, char *full_bs,
+ s32 sector_size)
+{
+ s64 bw;
+ int res;
+
+ res = -1;
+ ntfs_log_info("Rewriting the bootsector\n");
+ bw = ntfs_pwrite(dev, 0, sector_size, full_bs);
+ if (bw == sector_size)
+ res = 0;
+ else {
+ if (bw != -1)
+ errno = EINVAL;
+ if (!bw)
+ ntfs_log_error("Failed to rewrite the bootsector (size=0)\n");
+ else
+ ntfs_log_perror("Error rewriting the bootsector");
+ }
+ return (res);
+}
+
+/*
+ * Locate an unnamed attribute in an MFT record
+ *
+ * Returns NULL if not found (with no error message)
+ */
+
+static ATTR_RECORD *find_unnamed_attr(MFT_RECORD *mrec, ATTR_TYPES type)
+{
+ ATTR_RECORD *a;
+ u32 offset;
+
+ /* fetch the requested attribute */
+ offset = le16_to_cpu(mrec->attrs_offset);
+ a = (ATTR_RECORD*)((char*)mrec + offset);
+ while ((a->type != AT_END)
+ && ((a->type != type) || a->name_length)
+ && (offset < le32_to_cpu(mrec->bytes_in_use))) {
+ offset += le32_to_cpu(a->length);
+ a = (ATTR_RECORD*)((char*)mrec + offset);
+ }
+ if ((a->type != type)
+ || a->name_length)
+ a = (ATTR_RECORD*)NULL;
+ return (a);
+}
+
+/*
+ * First condition for having a self-located MFT :
+ * only 16 MFT records are defined in MFT record 0
+ *
+ * Only low-level library functions can be used.
+ *
+ * Returns TRUE if the condition is met.
+ */
+
+static BOOL short_mft_selfloc_condition(struct MFT_SELF_LOCATED *selfloc)
+{
+ BOOL ok;
+ ntfs_volume *vol;
+ MFT_RECORD *mft0;
+ ATTR_RECORD *a;
+ runlist_element *rl;
+ u16 seqn;
+
+ ok = FALSE;
+ vol = selfloc->vol;
+ mft0 = selfloc->mft0;
+ if ((ntfs_pread(vol->dev,
+ vol->mft_lcn << vol->cluster_size_bits,
+ vol->mft_record_size, mft0)
+ == vol->mft_record_size)
+ && !ntfs_mst_post_read_fixup((NTFS_RECORD*)mft0,
+ vol->mft_record_size)) {
+ a = find_unnamed_attr(mft0,AT_DATA);
+ if (a
+ && a->non_resident
+ && (((le64_to_cpu(a->highest_vcn) + 1)
+ << vol->cluster_size_bits)
+ == (SELFLOC_LIMIT*vol->mft_record_size))) {
+ rl = ntfs_mapping_pairs_decompress(vol, a, NULL);
+ if (rl) {
+ /*
+ * The first error condition is having only
+ * 16 entries mapped in the first MFT record.
+ */
+ if ((rl[0].lcn >= 0)
+ && ((rl[0].length << vol->cluster_size_bits)
+ == SELFLOC_LIMIT*vol->mft_record_size)
+ && (rl[1].vcn == rl[0].length)
+ && (rl[1].lcn == LCN_RL_NOT_MAPPED)) {
+ ok = TRUE;
+ seqn = le16_to_cpu(
+ mft0->sequence_number);
+ selfloc->mft_ref0
+ = ((MFT_REF)seqn) << 48;
+ }
+ free(rl);
+ }
+ }
+ }
+ return (ok);
+}
+
+/*
+ * Second condition for having a self-located MFT :
+ * The 16th MFT record is defined in MFT record >= 16
+ *
+ * Only low-level library functions can be used.
+ *
+ * Returns TRUE if the condition is met.
+ */
+
+static BOOL attrlist_selfloc_condition(struct MFT_SELF_LOCATED *selfloc)
+{
+ ntfs_volume *vol;
+ ATTR_RECORD *a;
+ ATTR_LIST_ENTRY *attrlist;
+ ATTR_LIST_ENTRY *al;
+ runlist_element *rl;
+ VCN vcn;
+ leVCN levcn;
+ u32 length;
+ int ok;
+
+ ok = FALSE;
+ length = 0;
+ vol = selfloc->vol;
+ a = find_unnamed_attr(selfloc->mft0,AT_ATTRIBUTE_LIST);
+ if (a) {
+ selfloc->attrlist_resident = !a->non_resident;
+ selfloc->attrlist_lcn = 0;
+ if (a->non_resident) {
+ attrlist = selfloc->attrlist;
+ rl = ntfs_mapping_pairs_decompress(vol, a, NULL);
+ if (rl
+ && (rl->lcn >= 0)
+ && (le64_to_cpu(a->data_size) < vol->cluster_size)
+ && (ntfs_pread(vol->dev,
+ rl->lcn << vol->cluster_size_bits,
+ vol->cluster_size, attrlist) == vol->cluster_size)) {
+ selfloc->attrlist_lcn = rl->lcn;
+ al = attrlist;
+ length = le64_to_cpu(a->data_size);
+ }
+ } else {
+ al = (ATTR_LIST_ENTRY*)
+ ((char*)a + le16_to_cpu(a->value_offset));
+ length = le32_to_cpu(a->value_length);
+ }
+ if (length) {
+ /* search for a data attribute defining entry 16 */
+ vcn = (SELFLOC_LIMIT*vol->mft_record_size)
+ >> vol->cluster_size_bits;
+ levcn = cpu_to_le64(vcn);
+ while ((length > 0)
+ && al->length
+ && ((al->type != AT_DATA)
+ || ((leVCN)al->lowest_vcn != levcn))) {
+ length -= le16_to_cpu(al->length);
+ al = (ATTR_LIST_ENTRY*)
+ ((char*)al + le16_to_cpu(al->length));
+ }
+ if ((length > 0)
+ && al->length
+ && (al->type == AT_DATA)
+ && !al->name_length
+ && ((leVCN)al->lowest_vcn == levcn)
+ && (MREF_LE(al->mft_reference) >= SELFLOC_LIMIT)) {
+ selfloc->mft_ref1
+ = le64_to_cpu(al->mft_reference);
+ selfloc->attrlist_to_ref1 = al;
+ ok = TRUE;
+ }
+ }
+ }
+ return (ok);
+}
+
+/*
+ * Third condition for having a self-located MFT :
+ * The location of the second part of the MFT is defined in itself
+ *
+ * To locate the second part, we have to assume the first and the
+ * second part of the MFT data are contiguous.
+ *
+ * Only low-level library functions can be used.
+ *
+ * Returns TRUE if the condition is met.
+ */
+
+static BOOL self_mapped_selfloc_condition(struct MFT_SELF_LOCATED *selfloc)
+{
+ BOOL ok;
+ s64 inum;
+ u64 offs;
+ VCN lowest_vcn;
+ MFT_RECORD *mft1;
+ ATTR_RECORD *a;
+ ntfs_volume *vol;
+ runlist_element *rl;
+
+ ok = FALSE;
+ vol = selfloc->vol;
+ mft1 = selfloc->mft1;
+ inum = MREF(selfloc->mft_ref1);
+ offs = (vol->mft_lcn << vol->cluster_size_bits)
+ + (inum << vol->mft_record_size_bits);
+ if ((ntfs_pread(vol->dev, offs, vol->mft_record_size,
+ mft1) == vol->mft_record_size)
+ && !ntfs_mst_post_read_fixup((NTFS_RECORD*)mft1,
+ vol->mft_record_size)) {
+ lowest_vcn = (SELFLOC_LIMIT*vol->mft_record_size)
+ >> vol->cluster_size_bits;
+ a = find_unnamed_attr(mft1,AT_DATA);
+ if (a
+ && (mft1->flags & MFT_RECORD_IN_USE)
+ && ((VCN)le64_to_cpu(a->lowest_vcn) == lowest_vcn)
+ && (le64_to_cpu(mft1->base_mft_record)
+ == selfloc->mft_ref0)
+ && ((u16)MSEQNO(selfloc->mft_ref1)
+ == le16_to_cpu(mft1->sequence_number))) {
+ rl = ntfs_mapping_pairs_decompress(vol, a, NULL);
+ if ((rl[0].lcn == LCN_RL_NOT_MAPPED)
+ && !rl[0].vcn
+ && (rl[0].length == lowest_vcn)
+ && (rl[1].vcn == lowest_vcn)
+ && ((u64)(rl[1].lcn << vol->cluster_size_bits)
+ <= offs)
+ && ((u64)((rl[1].lcn + rl[1].length)
+ << vol->cluster_size_bits) > offs)) {
+ ok = TRUE;
+ }
+ }
+ }
+ return (ok);
+}
+
+/*
+ * Fourth condition, to be able to fix a self-located MFT :
+ * The MFT record 15 must be available.
+ *
+ * The MFT record 15 is expected to be marked in use, we assume
+ * it is available if it has no parent, no name and no attr list.
+ *
+ * Only low-level library functions can be used.
+ *
+ * Returns TRUE if the condition is met.
+ */
+
+static BOOL spare_record_selfloc_condition(struct MFT_SELF_LOCATED *selfloc)
+{
+ BOOL ok;
+ s64 inum;
+ u64 offs;
+ MFT_RECORD *mft2;
+ ntfs_volume *vol;
+
+ ok = FALSE;
+ vol = selfloc->vol;
+ mft2 = selfloc->mft2;
+ inum = SELFLOC_LIMIT - 1;
+ offs = (vol->mft_lcn << vol->cluster_size_bits)
+ + (inum << vol->mft_record_size_bits);
+ if ((ntfs_pread(vol->dev, offs, vol->mft_record_size,
+ mft2) == vol->mft_record_size)
+ && !ntfs_mst_post_read_fixup((NTFS_RECORD*)mft2,
+ vol->mft_record_size)) {
+ if (!mft2->base_mft_record
+ && (mft2->flags & MFT_RECORD_IN_USE)
+ && !find_unnamed_attr(mft2,AT_ATTRIBUTE_LIST)
+ && !find_unnamed_attr(mft2,AT_FILE_NAME)) {
+ ok = TRUE;
+ }
+ }
+ return (ok);
+}
+
+/*
+ * Fix a self-located MFT by swapping two MFT records
+ *
+ * Only low-level library functions can be used.
+ *
+ * Returns 0 if the MFT corruption could be fixed.
+ */
+static int fix_selfloc_conditions(struct MFT_SELF_LOCATED *selfloc)
+{
+ MFT_RECORD *mft1;
+ MFT_RECORD *mft2;
+ ATTR_RECORD *a;
+ ATTR_LIST_ENTRY *al;
+ ntfs_volume *vol;
+ s64 offs;
+ s64 offsm;
+ s64 offs1;
+ s64 offs2;
+ s64 inum;
+ u16 usa_ofs;
+ int res;
+
+ res = 0;
+ /*
+ * In MFT1, we must fix :
+ * - the self-reference, if present,
+ * - its own sequence number, must be 15
+ * - the sizes of the data attribute.
+ */
+ vol = selfloc->vol;
+ mft1 = selfloc->mft1;
+ mft2 = selfloc->mft2;
+ usa_ofs = le16_to_cpu(mft1->usa_ofs);
+ if (usa_ofs >= 48)
+ mft1->mft_record_number = const_cpu_to_le32(SELFLOC_LIMIT - 1);
+ mft1->sequence_number = const_cpu_to_le16(SELFLOC_LIMIT - 1);
+ a = find_unnamed_attr(mft1,AT_DATA);
+ if (a) {
+ a->allocated_size = const_cpu_to_le64(0);
+ a->data_size = const_cpu_to_le64(0);
+ a->initialized_size = const_cpu_to_le64(0);
+ } else
+ res = -1; /* bug : it has been found earlier */
+
+ /*
+ * In MFT2, we must fix :
+ * - the self-reference, if present
+ */
+ usa_ofs = le16_to_cpu(mft2->usa_ofs);
+ if (usa_ofs >= 48)
+ mft2->mft_record_number = cpu_to_le32(MREF(selfloc->mft_ref1));
+
+ /*
+ * In the attribute list, we must fix :
+ * - the reference to MFT1
+ */
+ al = selfloc->attrlist_to_ref1;
+ al->mft_reference = MK_LE_MREF(SELFLOC_LIMIT - 1, SELFLOC_LIMIT - 1);
+
+ /*
+ * All fixes done, we can write all if allowed
+ */
+ if (!res && !opt.no_action) {
+ inum = SELFLOC_LIMIT - 1;
+ offs2 = (vol->mft_lcn << vol->cluster_size_bits)
+ + (inum << vol->mft_record_size_bits);
+ inum = MREF(selfloc->mft_ref1);
+ offs1 = (vol->mft_lcn << vol->cluster_size_bits)
+ + (inum << vol->mft_record_size_bits);
+
+ /* rewrite the attribute list */
+ if (selfloc->attrlist_resident) {
+ /* write mft0 and mftmirr if it is resident */
+ offs = vol->mft_lcn << vol->cluster_size_bits;
+ offsm = vol->mftmirr_lcn << vol->cluster_size_bits;
+ if (ntfs_mst_pre_write_fixup(
+ (NTFS_RECORD*)selfloc->mft0,
+ vol->mft_record_size)
+ || (ntfs_pwrite(vol->dev, offs, vol->mft_record_size,
+ selfloc->mft0) != vol->mft_record_size)
+ || (ntfs_pwrite(vol->dev, offsm, vol->mft_record_size,
+ selfloc->mft0) != vol->mft_record_size))
+ res = -1;
+ } else {
+ /* write a full cluster if non resident */
+ offs = selfloc->attrlist_lcn << vol->cluster_size_bits;
+ if (ntfs_pwrite(vol->dev, offs, vol->cluster_size,
+ selfloc->attrlist) != vol->cluster_size)
+ res = -1;
+ }
+ /* replace MFT2 by MFT1 and replace MFT1 by MFT2 */
+ if (!res
+ && (ntfs_mst_pre_write_fixup((NTFS_RECORD*)selfloc->mft1,
+ vol->mft_record_size)
+ || ntfs_mst_pre_write_fixup((NTFS_RECORD*)selfloc->mft2,
+ vol->mft_record_size)
+ || (ntfs_pwrite(vol->dev, offs2, vol->mft_record_size,
+ mft1) != vol->mft_record_size)
+ || (ntfs_pwrite(vol->dev, offs1, vol->mft_record_size,
+ mft2) != vol->mft_record_size)))
+ res = -1;
+ }
+ return (res);
+}
+
+/*
+ * Detect and fix a Windows XP bug, leading to a corrupt MFT
+ *
+ * Windows cannot boot anymore, so chkdsk cannot be started, which
+ * is a good point, because chkdsk would have deleted all the files.
+ * Older ntfs-3g fell into an endless recursion (recent versions
+ * refuse to mount).
+ *
+ * This situation is very rare, but it was fun to fix it.
+ *
+ * The corrupted condition is :
+ * - MFT entry 0 has only the runlist for MFT entries 0-15
+ * - The attribute list for MFT shows the second part
+ * in an MFT record beyond 15
+ * Of course, this record has to be read in order to know where it is.
+ *
+ * Sample case, met in 2011 (Windows XP) :
+ * MFT record 0 has : stdinfo, nonres attrlist, the first
+ * part of MFT data (entries 0-15), and bitmap
+ * MFT record 16 has the name
+ * MFT record 17 has the third part of MFT data (16-117731)
+ * MFT record 18 has the second part of MFT data (117732-170908)
+ *
+ * Assuming the second part of the MFT is contiguous to the first
+ * part, we can find it, and fix the condition by relocating it
+ * and swapping it with MFT record 15.
+ * This record number 15 appears to be hardcoded into Windows NTFS.
+ *
+ * Only low-level library functions can be used.
+ *
+ * Returns 0 if the conditions for the error were not met or
+ * the error could be fixed,
+ * -1 if some error was encountered
+ */
+
+static int fix_self_located_mft(ntfs_volume *vol)
+{
+ struct MFT_SELF_LOCATED selfloc;
+ BOOL res;
+
+ ntfs_log_info("Checking for self-located MFT segment... ");
+ res = -1;
+ selfloc.vol = vol;
+ selfloc.mft0 = (MFT_RECORD*)malloc(vol->mft_record_size);
+ selfloc.mft1 = (MFT_RECORD*)malloc(vol->mft_record_size);
+ selfloc.mft2 = (MFT_RECORD*)malloc(vol->mft_record_size);
+ selfloc.attrlist = (ATTR_LIST_ENTRY*)malloc(vol->cluster_size);
+ if (selfloc.mft0 && selfloc.mft1 && selfloc.mft2
+ && selfloc.attrlist) {
+ if (short_mft_selfloc_condition(&selfloc)
+ && attrlist_selfloc_condition(&selfloc)
+ && self_mapped_selfloc_condition(&selfloc)
+ && spare_record_selfloc_condition(&selfloc)) {
+ ntfs_log_info(FOUND);
+ ntfs_log_info("Fixing the self-located MFT segment... ");
+ res = fix_selfloc_conditions(&selfloc);
+ ntfs_log_info(res ? FAILED : OK);
+ } else {
+ ntfs_log_info(OK);
+ res = 0;
+ }
+ free(selfloc.mft0);
+ free(selfloc.mft1);
+ free(selfloc.mft2);
+ free(selfloc.attrlist);
+ }
+ return (res);
+}
+
+/*
+ * Try an alternate boot sector and fix the real one
+ *
+ * Only after successful checks is the boot sector rewritten.
+ *
+ * The alternate boot sector is not rewritten, either because it
+ * was found correct, or because we truncated the file system
+ * and the last actual sector might be part of some file.
+ *
+ * Returns 0 if successful
+ */
+
+static int try_fix_boot(ntfs_volume *vol, char *full_bs,
+ s64 read_sector, s64 fix_sectors, s32 sector_size)
+{
+ s64 br;
+ int res;
+ s64 got_sectors;
+ le16 sector_size_le;
+ NTFS_BOOT_SECTOR *bs;
+
+ res = -1;
+ br = ntfs_pread(vol->dev, read_sector*sector_size,
+ sector_size, full_bs);
+ if (br != sector_size) {
+ if (br != -1)
+ errno = EINVAL;
+ if (!br)
+ ntfs_log_error("Failed to read alternate bootsector (size=0)\n");
+ else
+ ntfs_log_perror("Error reading alternate bootsector");
+ } else {
+ bs = (NTFS_BOOT_SECTOR*)full_bs;
+ got_sectors = le64_to_cpu(bs->number_of_sectors);
+ bs->number_of_sectors = cpu_to_le64(fix_sectors);
+ /* alignment problem on Sparc, even doing memcpy() */
+ sector_size_le = cpu_to_le16(sector_size);
+ if (!memcmp(&sector_size_le, &bs->bpb.bytes_per_sector,2)
+ && ntfs_boot_sector_is_ntfs(bs)
+ && !ntfs_boot_sector_parse(vol, bs)) {
+ ntfs_log_info("The alternate bootsector is usable\n");
+ if (fix_sectors != got_sectors)
+ ntfs_log_info("Set sector count to %lld instead of %lld\n",
+ (long long)fix_sectors,
+ (long long)got_sectors);
+ /* fix the normal boot sector */
+ if (!opt.no_action) {
+ res = rewrite_boot(vol->dev, full_bs,
+ sector_size);
+ } else
+ res = 0;
+ }
+ if (!res && !opt.no_action)
+ ntfs_log_info("The boot sector has been rewritten\n");
+ }
+ return (res);
+}
+
+/*
+ * Try the alternate boot sector if the normal one is bad
+ *
+ * Actually :
+ * - first try the last sector of the partition (expected location)
+ * - then try the last sector as shown in the main boot sector,
+ * (could be meaningful for an undersized partition)
+ * - finally try truncating the file system actual size of partition
+ * (could be meaningful for an oversized partition)
+ *
+ * if successful, rewrite the normal boot sector accordingly
+ *
+ * Returns 0 if successful
+ */
+
+static int try_alternate_boot(ntfs_volume *vol, char *full_bs,
+ s32 sector_size, s64 shown_sectors)
+{
+ s64 actual_sectors;
+ int res;
+
+ res = -1;
+ ntfs_log_info("Trying the alternate boot sector\n");
+
+ /*
+ * We do not rely on the sector size defined in the
+ * boot sector, supposed to be corrupt, so we try to get
+ * the actual sector size and defaulting to 512 if failed
+ * to get. This value is only used to guess the alternate
+ * boot sector location and it is checked against the
+ * value found in the sector itself. It should not damage
+ * anything if wrong.
+ *
+ * Note : the real last sector is not accounted for here.
+ */
+ actual_sectors = ntfs_device_size_get(vol->dev,sector_size) - 1;
+
+ /* first try the actual last sector */
+ if ((actual_sectors > 0)
+ && !try_fix_boot(vol, full_bs, actual_sectors,
+ actual_sectors, sector_size))
+ res = 0;
+
+ /* then try the shown last sector, if less than actual */
+ if (res
+ && (shown_sectors > 0)
+ && (shown_sectors < actual_sectors)
+ && !try_fix_boot(vol, full_bs, shown_sectors,
+ shown_sectors, sector_size))
+ res = 0;
+
+ /* then try reducing the number of sectors to actual value */
+ if (res
+ && (shown_sectors > actual_sectors)
+ && !try_fix_boot(vol, full_bs, 0, actual_sectors, sector_size))
+ res = 0;
+
+ return (res);
+}
+
+/*
+ * Check and fix the alternate boot sector
+ *
+ * The alternate boot sector is usually in the last sector of a
+ * partition, which should not be used by the file system
+ * (the sector count in the boot sector should be less than
+ * the total sector count in the partition).
+ *
+ * chkdsk never changes the count in the boot sector.
+ * - If this is less than the total count, chkdsk place the
+ * alternate boot sector into the sector,
+ * - if the count is the same as the total count, chkdsk place
+ * the alternate boot sector into the middle sector (half
+ * the total count rounded upwards)
+ * - if the count is greater than the total count, chkdsk
+ * declares the file system as raw, and refuses to fix anything.
+ *
+ * Here, we check and fix the alternate boot sector, only in the
+ * first situation where the file system does not overflow on the
+ * last sector.
+ *
+ * Note : when shrinking a partition, ntfsresize cannot determine
+ * the future size of the partition. As a consequence the number of
+ * sectors in the boot sectors may be less than the possible size.
+ *
+ * Returns 0 if successful
+ */
+
+static int check_alternate_boot(ntfs_volume *vol)
+{
+#if 0
+ s64 got_sectors;
+ s64 actual_sectors;
+ s64 last_sector_off;
+ char *full_bs;
+ char *alt_bs;
+ NTFS_BOOT_SECTOR *bs;
+ s64 br;
+ s64 bw;
+ int res;
+
+ res = -1;
+ full_bs = (char*)malloc(vol->sector_size);
+ alt_bs = (char*)malloc(vol->sector_size);
+ if (!full_bs || !alt_bs) {
+ ntfs_log_info("Error : failed to allocate memory\n");
+ goto error_exit;
+ }
+ /* Now read both bootsectors. */
+ br = ntfs_pread(vol->dev, 0, vol->sector_size, full_bs);
+ if (br == vol->sector_size) {
+ bs = (NTFS_BOOT_SECTOR*)full_bs;
+ got_sectors = le64_to_cpu(bs->number_of_sectors);
+ actual_sectors = ntfs_device_size_get(vol->dev,
+ vol->sector_size);
+ if (actual_sectors > got_sectors) {
+ last_sector_off = (actual_sectors - 1)
+ << vol->sector_size_bits;
+ ntfs_log_info("Checking the alternate boot sector... ");
+ br = ntfs_pread(vol->dev, last_sector_off,
+ vol->sector_size, alt_bs);
+ } else {
+ ntfs_log_info("Checking file system overflow... ");
+ br = -1;
+ }
+ /* accept getting no byte, needed for short image files */
+ if (br >= 0) {
+ if ((br != vol->sector_size)
+ || memcmp(full_bs, alt_bs, vol->sector_size)) {
+ if (opt.no_action) {
+ ntfs_log_info("BAD\n");
+ } else {
+ bw = ntfs_pwrite(vol->dev,
+ last_sector_off,
+ vol->sector_size, full_bs);
+ if (bw == vol->sector_size) {
+ ntfs_log_info("FIXED\n");
+ res = 0;
+ } else {
+ ntfs_log_info(FAILED);
+ }
+ }
+ } else {
+ ntfs_log_info(OK);
+ res = 0;
+ }
+ } else {
+ ntfs_log_info(FAILED);
+ }
+ } else {
+ ntfs_log_info("Error : could not read the boot sector again\n");
+ }
+ free(full_bs);
+ free(alt_bs);
+
+error_exit :
+ return (res);
+#endif
+ return (0);
+}
+
+/*
+ * Try to fix problems which may arise in the start up sequence
+ *
+ * This is a replay of the normal start up sequence with fixes when
+ * some problem arise.
+ */
+
+static int fix_startup(struct ntfs_device *dev, unsigned long flags)
+{
+ s64 br;
+ ntfs_volume *vol;
+ BOOL dev_open;
+ s64 shown_sectors;
+ char *full_bs;
+ NTFS_BOOT_SECTOR *bs;
+ s32 sector_size;
+ int res;
+ int eo;
+
+ errno = 0;
+ res = -1;
+ dev_open = FALSE;
+ full_bs = (char*)NULL;
+ if (!dev || !dev->d_ops || !dev->d_name) {
+ errno = EINVAL;
+ ntfs_log_perror("%s: dev = %p", __FUNCTION__, dev);
+ vol = (ntfs_volume*)NULL;
+ goto error_exit;
+ }
+
+ /* Allocate the volume structure. */
+ vol = ntfs_volume_alloc();
+ if (!vol)
+ goto error_exit;
+
+ /* Create the default upcase table. */
+ vol->upcase_len = ntfs_upcase_build_default(&vol->upcase);
+ if (!vol->upcase_len || !vol->upcase)
+ goto error_exit;
+
+ /* Default with no locase table and case sensitive file names */
+ vol->locase = (ntfschar*)NULL;
+ NVolSetCaseSensitive(vol);
+
+ /* by default, all files are shown and not marked hidden */
+ NVolSetShowSysFiles(vol);
+ NVolSetShowHidFiles(vol);
+ NVolClearHideDotFiles(vol);
+ if (flags & NTFS_MNT_RDONLY)
+ NVolSetReadOnly(vol);
+
+ /* ...->open needs bracketing to compile with glibc 2.7 */
+ if ((dev->d_ops->open)(dev, NVolReadOnly(vol) ? O_RDONLY: O_RDWR)) {
+ ntfs_log_perror("Error opening '%s'", dev->d_name);
+ goto error_exit;
+ }
+ dev_open = TRUE;
+ /* Attach the device to the volume. */
+ vol->dev = dev;
+
+ sector_size = ntfs_device_sector_size_get(dev);
+ if (sector_size <= 0)
+ sector_size = DEFAULT_SECTOR_SIZE;
+ full_bs = (char*)malloc(sector_size);
+ if (!full_bs)
+ goto error_exit;
+ /* Now read the bootsector. */
+ br = ntfs_pread(dev, 0, sector_size, full_bs);
+ if (br != sector_size) {
+ if (br != -1)
+ errno = EINVAL;
+ if (!br)
+ ntfs_log_error("Failed to read bootsector (size=0)\n");
+ else
+ ntfs_log_perror("Error reading bootsector");
+ goto error_exit;
+ }
+ bs = (NTFS_BOOT_SECTOR*)full_bs;
+ if (!ntfs_boot_sector_is_ntfs(bs)
+ /* get the bootsector data, only fails when inconsistent */
+ || (ntfs_boot_sector_parse(vol, bs) < 0)) {
+ shown_sectors = le64_to_cpu(bs->number_of_sectors);
+ /* boot sector is wrong, try the alternate boot sector */
+ if (try_alternate_boot(vol, full_bs, sector_size,
+ shown_sectors)) {
+ errno = EINVAL;
+ goto error_exit;
+ }
+ res = 0;
+ } else {
+ res = fix_self_located_mft(vol);
+ }
+error_exit:
+ if (res) {
+ switch (errno) {
+ case ENOMEM :
+ ntfs_log_error("Failed to allocate memory\n");
+ break;
+ case EINVAL :
+ ntfs_log_error("Unrecoverable error\n");
+ break;
+ default :
+ break;
+ }
+ }
+ eo = errno;
+ free(full_bs);
+ if (vol) {
+ free(vol->upcase);
+ free(vol);
+ }
+ if (dev_open) {
+ (dev->d_ops->close)(dev);
+ }
+ errno = eo;
+ return (res);
+}
+
+/**
+ * fix_mount
+ */
+static int fix_mount(void)
+{
+ int ret = 0; /* default success */
+ ntfs_volume *vol;
+ struct ntfs_device *dev;
+ unsigned long flags;
+
+ ntfs_log_info("Attempting to correct errors... ");
+
+ dev = ntfs_device_alloc(opt.volume, 0, &ntfs_device_default_io_ops,
+ NULL);
+ if (!dev) {
+ ntfs_log_info(FAILED);
+ ntfs_log_perror("Failed to allocate device");
+ return -1;
+ }
+ flags = (opt.no_action ? NTFS_MNT_RDONLY : 0);
+ vol = ntfs_volume_startup(dev, flags);
+ if (!vol) {
+ ntfs_log_info(FAILED);
+ ntfs_log_perror("Failed to startup volume");
+
+ /* Try fixing the bootsector and MFT, then redo the startup */
+ if (!fix_startup(dev, flags)) {
+ if (opt.no_action)
+ ntfs_log_info("The startup data can be fixed, "
+ "but no change was requested\n");
+ else
+ vol = ntfs_volume_startup(dev, flags);
+ }
+ if (!vol) {
+ ntfs_log_error("Volume is corrupt. You should run chkdsk.\n");
+ ntfs_device_free(dev);
+ return -1;
+ }
+ if (opt.no_action)
+ ret = -1; /* error present and not fixed */
+ }
+ /* if option -n proceed despite errors, to display them all */
+ if ((!ret || opt.no_action) && (fix_mftmirr(vol) < 0))
+ ret = -1;
+ if ((!ret || opt.no_action) && (fix_upcase(vol) < 0))
+ ret = -1;
+ if ((!ret || opt.no_action) && (set_dirty_flag(vol) < 0))
+ ret = -1;
+ if ((!ret || opt.no_action) && (empty_journal(vol) < 0))
+ ret = -1;
+ /*
+ * ntfs_umount() will invoke ntfs_device_free() for us.
+ * Ignore the returned error resulting from partial mounting.
+ */
+ ntfs_umount(vol, 1);
+ return ret;
+}
+
+/**
+ * main
+ */
+int main(int argc, char **argv)
+{
+ ntfs_volume *vol;
+ unsigned long mnt_flags;
+ unsigned long flags;
+ 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) {
+ ntfs_log_error("Refusing to operate on read-write "
+ "mounted device %s.\n", opt.volume);
+ exit(1);
+ }
+ } else
+ ntfs_log_perror("Failed to determine whether %s is mounted",
+ opt.volume);
+ /* Attempt a full mount first. */
+ flags = (opt.no_action ? NTFS_MNT_RDONLY : 0);
+ ntfs_log_info("Mounting volume... ");
+ vol = ntfs_mount(opt.volume, flags);
+ if (vol) {
+ ntfs_log_info(OK);
+ ntfs_log_info("Processing of $MFT and $MFTMirr completed "
+ "successfully.\n");
+ } else {
+ ntfs_log_info(FAILED);
+ if (fix_mount() < 0) {
+ if (opt.no_action)
+ ntfs_log_info("No change made\n");
+ exit(1);
+ }
+ vol = ntfs_mount(opt.volume, 0);
+ if (!vol) {
+ ntfs_log_perror("Remount failed");
+ exit(1);
+ }
+ }
+ if (check_alternate_boot(vol)) {
+ ntfs_log_error("Error: Failed to fix the alternate boot sector\n");
+ exit(1);
+ }
+ /* So the unmount does not clear it again. */
+
+ /* Porting note: The WasDirty flag was set here to prevent ntfs_unmount
+ * from clearing the dirty bit (which might have been set in
+ * fix_mount()). So the intention is to leave the dirty bit set.
+ *
+ * libntfs-3g does not automatically set or clear dirty flags on
+ * mount/unmount, this means that the assumption that the dirty flag is
+ * now set does not hold. So we need to set it if not already set.
+ *
+ * However clear the flag if requested to do so, at this stage
+ * mounting was successful.
+ */
+ if (opt.clear_dirty)
+ vol->flags &= ~VOLUME_IS_DIRTY;
+ else
+ vol->flags |= VOLUME_IS_DIRTY;
+ if (!opt.no_action && ntfs_volume_write_flags(vol, vol->flags)) {
+ ntfs_log_error("Error: Failed to set volume dirty flag (%d "
+ "(%s))!\n", errno, strerror(errno));
+ }
+
+ /* Check NTFS version is ok for us (in $Volume) */
+ ntfs_log_info("NTFS volume version is %i.%i.\n", vol->major_ver,
+ vol->minor_ver);
+ if (ntfs_version_is_supported(vol)) {
+ ntfs_log_error("Error: Unknown NTFS version.\n");
+ goto error_exit;
+ }
+ if (opt.clear_bad_sectors && !opt.no_action) {
+ if (clear_badclus(vol)) {
+ ntfs_log_error("Error: Failed to un-mark bad sectors.\n");
+ goto error_exit;
+ }
+ }
+ if (vol->major_ver >= 3) {
+ /*
+ * FIXME: If on NTFS 3.0+, check for presence of the usn
+ * journal and stamp it if present.
+ */
+ }
+ /* FIXME: We should be marking the quota out of date, too. */
+ /* That's all for now! */
+ ntfs_log_info("NTFS partition %s was processed successfully.\n",
+ vol->dev->d_name);
+ /* Set return code to 0. */
+ ret = 0;
+error_exit:
+ if (ntfs_umount(vol, 0))
+ ntfs_umount(vol, 1);
+ if (ret)
+ exit(ret);
+ return ret;
+}
+
diff --git a/ntfsprogs/ntfsinfo.8 b/ntfsprogs/ntfsinfo.8
new file mode 100644
index 0000000..7ccb660
--- a/dev/null
+++ b/ntfsprogs/ntfsinfo.8
@@ -0,0 +1,89 @@
+.\" 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 "April 2006" "ntfs-3g 2014.2.15"
+.SH NAME
+ntfsinfo \- dump a file's attributes
+.SH SYNOPSIS
+.B ntfsinfo
+[\fIoptions\fR] \fIdevice\fR
+.SH DESCRIPTION
+.B ntfsinfo
+will dump the attributes of inode
+.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.
+.SH OPTIONS
+Below is a summary of all the options that
+.B ntfsinfo
+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.
+.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
+ntfs\-3g\-devel@lists.sf.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.
+It was ported to ntfs-3g by Erik Larsson and Jean-Pierre Andre.
+.SH AVAILABILITY
+.B ntfsinfo
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfsinfo.8.in b/ntfsprogs/ntfsinfo.8.in
new file mode 100755
index 0000000..e0141c7
--- a/dev/null
+++ b/ntfsprogs/ntfsinfo.8.in
@@ -0,0 +1,89 @@
+.\" 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 "April 2006" "ntfs-3g @VERSION@"
+.SH NAME
+ntfsinfo \- dump a file's attributes
+.SH SYNOPSIS
+.B ntfsinfo
+[\fIoptions\fR] \fIdevice\fR
+.SH DESCRIPTION
+.B ntfsinfo
+will dump the attributes of inode
+.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.
+.SH OPTIONS
+Below is a summary of all the options that
+.B ntfsinfo
+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.
+.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
+ntfs\-3g\-devel@lists.sf.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.
+It was ported to ntfs-3g by Erik Larsson and Jean-Pierre Andre.
+.SH AVAILABILITY
+.B ntfsinfo
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfsinfo.c b/ntfsprogs/ntfsinfo.c
new file mode 100755
index 0000000..32f82e7
--- a/dev/null
+++ b/ntfsprogs/ntfsinfo.c
@@ -0,0 +1,2384 @@
+/**
+ * ntfsinfo - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2002-2004 Matthew J. Fanto
+ * Copyright (c) 2002-2006 Anton Altaparmakov
+ * Copyright (c) 2002-2005 Richard Russon
+ * Copyright (c) 2003-2006 Szabolcs Szakacsits
+ * Copyright (c) 2004-2005 Yuval Fledel
+ * Copyright (c) 2004-2007 Yura Pakhuchiy
+ * Copyright (c) 2005 Cristian Klein
+ *
+ * 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
+ */
+/*
+ * TODO LIST:
+ * - 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.
+ * - 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.
+ *
+ * Still need to do:
+ * $REPARSE_POINT/$SYMBOLIC_LINK
+ * $LOGGED_UTILITY_STREAM
+ */
+
+#include "config.h"
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
+#include "types.h"
+#include "mft.h"
+#include "attrib.h"
+#include "layout.h"
+#include "inode.h"
+#include "index.h"
+#include "utils.h"
+#include "security.h"
+#include "mst.h"
+#include "dir.h"
+#include "ntfstime.h"
+/* #include "version.h" */
+#include "support.h"
+#include "misc.h"
+
+static const char *EXEC_NAME = "ntfsinfo";
+
+static struct options {
+ 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 */
+} opts;
+
+struct RUNCOUNT {
+ unsigned long runs;
+ unsigned long fragments;
+} ;
+
+/**
+ * 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 (libntfs-3g) - Display information about an NTFS "
+ "Volume.\n\n", EXEC_NAME, VERSION);
+ printf("Copyright (c)\n");
+ printf(" 2002-2004 Matthew J. Fanto\n");
+ printf(" 2002-2006 Anton Altaparmakov\n");
+ printf(" 2002-2005 Richard Russon\n");
+ printf(" 2003-2006 Szabolcs Szakacsits\n");
+ printf(" 2003 Leonard Norrgård\n");
+ printf(" 2004-2005 Yuval Fledel\n");
+ printf(" 2004-2007 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\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",
+ 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 = "-:dfhi:F:mqtTvV";
+ static const struct option lopt[] = {
+ { "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' },
+ { "notime", no_argument, NULL, 'T' },
+ { "mft", no_argument, NULL, 'm' },
+ { NULL, 0, NULL, 0 }
+ };
+
+ int c = -1;
+ int err = 0;
+ int ver = 0;
+ int help = 0;
+ int levels = 0;
+
+ opterr = 0; /* We'll handle the errors, thank you. */
+
+ opts.inode = -1;
+ opts.filename = NULL;
+
+ while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) {
+ switch (c) {
+ case 1:
+ if (!opts.device)
+ opts.device = optarg;
+ else
+ err++;
+ break;
+ case 'i':
+ if ((opts.inode != -1) ||
+ (!utils_parse_size(optarg, &opts.inode, FALSE))) {
+ 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;
+ case 'h':
+ help++;
+ break;
+ case 'q':
+ opts.quiet++;
+ ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET);
+ break;
+ case 't':
+ opts.notime++;
+ break;
+ case 'T':
+ /* 'T' is deprecated, notify */
+ 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++;
+ break;
+ case 'm':
+ opts.mft++;
+ break;
+ case '?':
+ if (optopt=='?') {
+ help++;
+ continue;
+ }
+ if (ntfs_log_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;
+ }
+ }
+
+ /* 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)
+ ntfs_log_error("You must specify exactly one "
+ "device.\n");
+ err++;
+ }
+
+ if (opts.inode == -1 && !opts.filename && !opts.mft) {
+ if (argc > 1)
+ ntfs_log_error("You must specify an inode to "
+ "learn about.\n");
+ err++;
+ }
+
+ if (opts.quiet && opts.verbose) {
+ 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)
+ ntfs_log_error("You may not specify --inode "
+ "and --file together.\n");
+ err++;
+ }
+
+ }
+
+ if (ver)
+ version();
+ if (help || err)
+ usage();
+
+ return (!err && !help && !ver);
+}
+
+
+/* *************** utility functions ******************** */
+/**
+ * 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 char *ntfsinfo_time_to_str(const sle64 sle_ntfs_clock)
+{
+ /* JPA display timestamps in UTC */
+ static const char *months[]
+ = { "Jan", "Feb", "Mar", "Apr", "May", "Jun",
+ "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" } ;
+ static const char *wdays[]
+ = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" } ;
+ static char str[30];
+ long long stamp;
+ u32 days;
+ u32 seconds;
+ unsigned int year;
+ unsigned int wday;
+ int mon;
+ int cnt;
+
+ stamp = sle64_to_cpu(sle_ntfs_clock);
+ days = (stamp/(86400*10000000LL)) & 0x7ffff;
+ seconds = ((stamp/10000000LL)%86400) & 0x1ffff;
+ wday = (days + 1)%7;
+ year = 1601;
+ /* periods of 400 years */
+ cnt = days/146097;
+ days -= 146097*cnt;
+ year += 400*cnt;
+ /* periods of 100 years */
+ cnt = (3*days + 3)/109573;
+ days -= 36524*cnt;
+ year += 100*cnt;
+ /* periods of 4 years */
+ cnt = days/1461;
+ days -= 1461*cnt;
+ year += 4*cnt;
+ /* periods of a single year */
+ cnt = (3*days + 3)/1096;
+ days -= 365*cnt;
+ year += cnt;
+
+ if ((!(year % 100) ? (year % 400) : (year % 4))
+ && (days > 58)) days++;
+ if (days > 59) {
+ mon = (5*days + 161)/153;
+ days -= (153*mon - 162)/5;
+ } else {
+ mon = days/31 + 1;
+ days -= 31*(mon - 1) - 1;
+ }
+ sprintf(str,"%3s %3s %2u %02u:%02u:%02u %4u UTC\n",
+ wdays[wday],
+ months[mon-1],(unsigned int)days,
+ (unsigned int)(seconds/3600),
+ (unsigned int)(seconds/60%60),
+ (unsigned int)(seconds%60),
+ (unsigned int)year);
+ return (str);
+}
+
+/**
+ * ntfs_attr_get_name()
+ * @attr: a valid 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
+ */
+static char *ntfs_attr_get_name_mbs(ATTR_RECORD *attr)
+{
+ ntfschar *ucs_attr_name;
+ char *mbs_attr_name = NULL;
+ int mbs_attr_name_size;
+
+ /* Get name in unicode. */
+ ucs_attr_name = ntfs_attr_get_name(attr);
+ /* 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
+ */
+static 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 Flags: 0x%04x", (int)vol->flags);
+ if (vol->flags & VOLUME_IS_DIRTY)
+ printf(" DIRTY");
+ if (vol->flags & VOLUME_MODIFIED_BY_CHKDSK)
+ printf(" MODIFIED_BY_CHKDSK");
+ printf("\n");
+ 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", (unsigned int)vol->cluster_size);
+ printf("\tIndex Block Size: %u\n", (unsigned int)vol->indx_record_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);
+ 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("\tAllocated clusters %lld (%2.1lf%%)\n",
+ (long long)vol->mft_na->allocated_size
+ >> vol->cluster_size_bits,
+ 100.0*(vol->mft_na->allocated_size
+ >> vol->cluster_size_bits)
+ / vol->nr_clusters);
+ 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",
+ (int)vol->attrdef_len);
+ printf("\tNumber of Attached Extent Inodes: %d\n",
+ (int)vol->mft_ni->nr_extents);
+
+ 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",
+ (unsigned int)vol->lcnbmp_ni->attr_list_size);
+ /* JPA printf("\tAttribute List: %s\n", vol->lcnbmp_ni->attr_list); */
+ printf("\tNumber of Attached Extent Inodes: %d\n",
+ (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);
+ printf("\tAttribute Types: not done yet\n");
+ //printf("\tAttribute Name: %s\n", vol->lcnbmp_na->name);
+ 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);
+ 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",
+ (unsigned int)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);
+ if (!ntfs_volume_get_free_space(vol))
+ printf("\tFree Clusters: %lld (%2.1lf%%)\n",
+ (long long)vol->free_clusters,
+ 100.0*vol->free_clusters
+ /(double)vol->nr_clusters);
+
+ //TODO: Still need to add a few more attributes
+}
+
+/**
+ * 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_flags(const char *indent, ATTR_TYPES type, le32 flags)
+{
+ const le32 original_flags = flags;
+
+ printf("%sFile attributes:\t", indent);
+ 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_DIRECTORY) {
+ printf(" DIRECTORY");
+ flags &= ~FILE_ATTR_DIRECTORY;
+ }
+ 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;
+ }
+ /* 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_I30_INDEX_PRESENT) {
+ printf(" I30_INDEX");
+ flags &= ~FILE_ATTR_I30_INDEX_PRESENT;
+ }
+ }
+ if (flags & FILE_ATTR_VIEW_INDEX_PRESENT) {
+ printf(" VIEW_INDEX");
+ flags &= ~FILE_ATTR_VIEW_INDEX_PRESENT;
+ }
+ if (flags)
+ printf(" UNKNOWN: 0x%08x", (unsigned int)le32_to_cpu(flags));
+ /* Print all the flags in hex. */
+ printf(" (0x%08x)\n", (unsigned)le32_to_cpu(original_flags));
+}
+
+/**
+ * ntfs_dump_namespace
+ */
+static void ntfs_dump_namespace(const char *indent, u8 file_name_type)
+{
+ const char *mbs_file_type;
+
+ /* 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;
+ default:
+ mbs_file_type = "(unknown)";
+ }
+ printf("%sNamespace:\t\t %s\n", indent, mbs_file_type);
+}
+
+/* *************** 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));
+
+ /* 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("\t", attr->type, standard_attr->file_attributes);
+
+ value_length = le32_to_cpu(attr->value_length);
+ if (value_length == 48) {
+ /* Only 12 reserved bytes here */
+ } else if (value_length == 72) {
+ printf("\tMaximum versions:\t %u \n", (unsigned int)
+ le32_to_cpu(standard_attr->maximum_versions));
+ printf("\tVersion number:\t\t %u \n", (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));
+ printf("\tUser ID:\t\t %u (0x%x)\n",
+ (unsigned int)le32_to_cpu(standard_attr->owner_id),
+ (unsigned int)le32_to_cpu(standard_attr->owner_id));
+ printf("\tSecurity ID:\t\t %u (0x%x)\n",
+ (unsigned int)le32_to_cpu(standard_attr->security_id),
+ (unsigned int)le32_to_cpu(standard_attr->security_id));
+ printf("\tQuota charged:\t\t %llu (0x%llx)\n",
+ (unsigned long long)
+ le64_to_cpu(standard_attr->quota_charged),
+ (unsigned long long)
+ le64_to_cpu(standard_attr->quota_charged));
+ printf("\tUpdate Sequence Number:\t %llu (0x%llx)\n",
+ (unsigned long long)
+ le64_to_cpu(standard_attr->usn),
+ (unsigned long long)
+ le64_to_cpu(standard_attr->usn));
+ } else {
+ printf("\tSize of STANDARD_INFORMATION is %u (0x%x). It "
+ "should be either 72 or 48, something is "
+ "wrong...\n", (unsigned int)value_length,
+ (unsigned)value_length);
+ }
+}
+
+static void ntfs_dump_bytes(u8 *buf, int start, int stop)
+{
+ int i;
+
+ for (i = start; i < stop; i++) {
+ printf("%02x ", buf[i]);
+ }
+}
+
+/**
+ * ntfs_dump_attr_list()
+ */
+static void ntfs_dump_attr_list(ATTR_RECORD *attr, ntfs_volume *vol)
+{
+ ATTR_LIST_ENTRY *entry;
+ u8 *value;
+ s64 l;
+
+ if (!opts.verbose)
+ return;
+
+ l = ntfs_get_attribute_value_length(attr);
+ if (!l) {
+ ntfs_log_perror("ntfs_get_attribute_value_length failed");
+ return;
+ }
+ value = ntfs_malloc(l);
+ if (!value)
+ return;
+
+ l = ntfs_get_attribute_value(vol, attr, value);
+ if (!l) {
+ ntfs_log_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\tAttribute type:\t0x%x\n",
+ (unsigned int)le32_to_cpu(entry->type));
+ printf("\t\tRecord length:\t%u (0x%x)\n",
+ (unsigned)le16_to_cpu(entry->length),
+ (unsigned)le16_to_cpu(entry->length));
+ printf("\t\tName length:\t%u (0x%x)\n",
+ (unsigned)entry->name_length,
+ (unsigned)entry->name_length);
+ printf("\t\tName offset:\t%u (0x%x)\n",
+ (unsigned)entry->name_offset,
+ (unsigned)entry->name_offset);
+ printf("\t\tStarting VCN:\t%lld (0x%llx)\n",
+ (long long)sle64_to_cpu(entry->lowest_vcn),
+ (unsigned long long)
+ sle64_to_cpu(entry->lowest_vcn));
+ printf("\t\tMFT reference:\t%lld (0x%llx)\n",
+ (unsigned long long)
+ MREF_LE(entry->mft_reference),
+ (unsigned long long)
+ MREF_LE(entry->mft_reference));
+ printf("\t\tInstance:\t%u (0x%x)\n",
+ (unsigned)le16_to_cpu(entry->instance),
+ (unsigned)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
+ ntfs_log_perror("ntfs_ucstombs failed");
+ } else
+ printf("unnamed\n");
+ printf("\t\tPadding:\t");
+ ntfs_dump_bytes((u8 *)entry, entry->name_offset +
+ sizeof(ntfschar) * entry->name_length,
+ le16_to_cpu(entry->length));
+ printf("\n");
+ }
+ free(value);
+ printf("\tEnd of attribute list reached.\n");
+}
+
+/**
+ * ntfs_dump_filename()
+ */
+static void ntfs_dump_filename(const char *indent,
+ FILE_NAME_ATTR *file_name_attr)
+{
+ printf("%sParent directory:\t %lld (0x%llx)\n", indent,
+ (long long)MREF_LE(file_name_attr->parent_directory),
+ (long long)MREF_LE(file_name_attr->parent_directory));
+ /* time stuff */
+ if (!opts.notime) {
+ char *ntfs_time_str;
+
+ ntfs_time_str = ntfsinfo_time_to_str(
+ file_name_attr->creation_time);
+ printf("%sFile Creation Time:\t %s", indent, ntfs_time_str);
+
+ ntfs_time_str = ntfsinfo_time_to_str(
+ file_name_attr->last_data_change_time);
+ printf("%sFile Altered Time:\t %s", indent, ntfs_time_str);
+
+ ntfs_time_str = ntfsinfo_time_to_str(
+ file_name_attr->last_mft_change_time);
+ printf("%sMFT Changed Time:\t %s", indent, ntfs_time_str);
+
+ ntfs_time_str = ntfsinfo_time_to_str(
+ file_name_attr->last_access_time);
+ printf("%sLast Accessed Time:\t %s", indent, ntfs_time_str);
+ }
+ /* other basic stuff about the file */
+ printf("%sAllocated Size:\t\t %lld (0x%llx)\n", indent, (long long)
+ sle64_to_cpu(file_name_attr->allocated_size),
+ (unsigned long long)
+ sle64_to_cpu(file_name_attr->allocated_size));
+ printf("%sData Size:\t\t %lld (0x%llx)\n", indent,
+ (long long)sle64_to_cpu(file_name_attr->data_size),
+ (unsigned long long)
+ sle64_to_cpu(file_name_attr->data_size));
+ printf("%sFilename Length:\t %d (0x%x)\n", indent,
+ (unsigned)file_name_attr->file_name_length,
+ (unsigned)file_name_attr->file_name_length);
+ ntfs_dump_flags(indent, AT_FILE_NAME, file_name_attr->file_attributes);
+ if (file_name_attr->file_attributes & FILE_ATTR_REPARSE_POINT &&
+ file_name_attr->reparse_point_tag)
+ printf("%sReparse point tag:\t 0x%x\n", indent, (unsigned)
+ le32_to_cpu(file_name_attr->reparse_point_tag));
+ else if (file_name_attr->reparse_point_tag) {
+ printf("%sEA Length:\t\t %d (0x%x)\n", indent, (unsigned)
+ le16_to_cpu(file_name_attr->packed_ea_size),
+ (unsigned)
+ le16_to_cpu(file_name_attr->packed_ea_size));
+ if (file_name_attr->reserved)
+ printf("%sReserved:\t\t %d (0x%x)\n", indent,
+ (unsigned)
+ le16_to_cpu(file_name_attr->reserved),
+ (unsigned)
+ le16_to_cpu(file_name_attr->reserved));
+ }
+ /* The filename. */
+ ntfs_dump_namespace(indent, file_name_attr->file_name_type);
+ 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("%sFilename:\t\t '%s'\n", indent, mbs_file_name);
+ free(mbs_file_name);
+ } else {
+ /* an error occurred, errno holds the reason - notify the user */
+ ntfs_log_perror("ntfsinfo error: could not parse file name");
+ }
+ } else {
+ printf("%sFile Name:\t\t unnamed?!?\n", indent);
+ }
+}
+
+/**
+ * ntfs_dump_attr_file_name()
+ */
+static void ntfs_dump_attr_file_name(ATTR_RECORD *attr)
+{
+ ntfs_dump_filename("\t", (FILE_NAME_ATTR*)((u8*)attr +
+ le16_to_cpu(attr->value_offset)));
+}
+
+/**
+ * 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)
+{
+ OBJECT_ID_ATTR *obj_id_attr = NULL;
+
+ obj_id_attr = (OBJECT_ID_ATTR *)((u8*)attr +
+ le16_to_cpu(attr->value_offset));
+
+ if (vol->major_ver >= 3.0) {
+ u32 value_length;
+ char printable_GUID[37];
+
+ 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);
+
+ /* 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:\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);
+ } else
+ 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);
+ } else
+ 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_acl
+ *
+ * given an acl, print it in a beautiful & lovely way.
+ */
+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);
+
+ /*
+ * Do not recalculate le16_to_cpu every iteration (minor speedup on
+ * big-endian machines.
+ */
+ 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 = 1; i <= ace_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)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);
+ free(sid);
+
+ /* proceed to next ACE */
+ ace = (ACCESS_ALLOWED_ACE *)(((char *)ace) +
+ le16_to_cpu(ace->size));
+ }
+}
+
+
+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\tControl:\t\t 0x%04x\n", indent,
+ le16_to_cpu(sec_desc->control));
+
+ if (~sec_desc->control & SE_SELF_RELATIVE) {
+ SECURITY_DESCRIPTOR *sd = (SECURITY_DESCRIPTOR *)sec_desc;
+
+ printf("%s\tOwner SID pointer:\t %p\n", indent, sd->owner);
+ printf("%s\tGroup SID pointer:\t %p\n", indent, sd->group);
+ printf("%s\tSACL pointer:\t\t %p\n", indent, sd->sacl);
+ printf("%s\tDACL pointer:\t\t %p\n", indent, sd->dacl);
+
+ return;
+ }
+
+ if (sec_desc->owner) {
+ 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);
+ } else
+ printf("%s\tOwner SID:\t\t missing\n", indent);
+
+ if (sec_desc->group) {
+ 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);
+ } else
+ printf("%s\tGroup SID:\t\t missing\n", indent);
+
+ 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()
+ *
+ * dump the security information about the file
+ */
+static void ntfs_dump_attr_security_descriptor(ATTR_RECORD *attr, ntfs_volume *vol)
+{
+ SECURITY_DESCRIPTOR_ATTR *sec_desc_attr;
+
+ if (attr->non_resident) {
+ /* FIXME: We don't handle fragmented mapping pairs case. */
+ runlist *rl = ntfs_mapping_pairs_decompress(vol, attr, NULL);
+ if (rl) {
+ s64 data_size, bytes_read;
+
+ data_size = sle64_to_cpu(attr->data_size);
+ sec_desc_attr = ntfs_malloc(data_size);
+ if (!sec_desc_attr) {
+ free(rl);
+ return;
+ }
+ bytes_read = ntfs_rl_pread(vol, rl, 0,
+ data_size, sec_desc_attr);
+ if (bytes_read != data_size) {
+ ntfs_log_error("ntfsinfo error: could not "
+ "read security descriptor\n");
+ free(rl);
+ free(sec_desc_attr);
+ return;
+ }
+ free(rl);
+ } else {
+ ntfs_log_error("ntfsinfo error: could not "
+ "decompress runlist\n");
+ return;
+ }
+ } else {
+ sec_desc_attr = (SECURITY_DESCRIPTOR_ATTR *)((u8*)attr +
+ le16_to_cpu(attr->value_offset));
+ }
+
+ ntfs_dump_security_descriptor(sec_desc_attr, "");
+
+ if (attr->non_resident)
+ free(sec_desc_attr);
+}
+
+/**
+ * ntfs_dump_volume_name()
+ *
+ * dump the name of the volume the inode belongs to
+ */
+static void ntfs_dump_attr_volume_name(ATTR_RECORD *attr)
+{
+ ntfschar *ucs_vol_name = NULL;
+
+ if (le32_to_cpu(attr->value_length) > 0) {
+ char *mbs_vol_name = NULL;
+ int mbs_vol_name_size;
+ /* calculate volume name position */
+ 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(ntfschar), &mbs_vol_name, 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);
+ } else
+ ntfs_log_perror("ntfsinfo error: could not parse "
+ "volume name");
+ } else
+ printf("\tVolume Name:\t\t unnamed\n");
+}
+
+/**
+ * ntfs_dump_volume_information()
+ *
+ * dump the information for the volume the inode belongs to
+ *
+ */
+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("\tVolume Version:\t\t %d.%d\n", vol_information->major_ver,
+ vol_information->minor_ver);
+ printf("\tVolume Flags:\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_CHKDSK_UNDERWAY)
+ printf("CHKDSK_UNDERWAY ");
+ if (vol_information->flags & VOLUME_MODIFIED_BY_CHKDSK)
+ printf("MOD_BY_CHKDSK ");
+ if (vol_information->flags & VOLUME_FLAGS_MASK) {
+ printf("(0x%04x)\n",
+ (unsigned)le16_to_cpu(vol_information->flags));
+ } else
+ printf("none set (0x0000)\n");
+ if (vol_information->flags & (~VOLUME_FLAGS_MASK))
+ printf("\t\t\t\t Unknown Flags: 0x%04x\n",
+ le16_to_cpu(vol_information->flags &
+ (~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("\n");
+ ntfs_log_verbose("\t\tHash:\t\t\t 0x%08x\n",
+ (unsigned)le32_to_cpu(sds->hash));
+ ntfs_log_verbose("\t\tSecurity id:\t\t %u (0x%x)\n",
+ (unsigned)le32_to_cpu(sds->security_id),
+ (unsigned)le32_to_cpu(sds->security_id));
+ ntfs_log_verbose("\t\tOffset:\t\t\t %llu (0x%llx)\n",
+ (unsigned long long)le64_to_cpu(sds->offset),
+ (unsigned long long)le64_to_cpu(sds->offset));
+ ntfs_log_verbose("\t\tLength:\t\t\t %u (0x%x)\n",
+ (unsigned)le32_to_cpu(sds->length),
+ (unsigned)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;
+ ntfschar *name;
+ int name_len;
+ s64 data_size;
+ u64 inode;
+
+ inode = ni->mft_no;
+ if (ni->nr_extents < 0)
+ inode = ni->base_ni->mft_no;
+ if (FILE_Secure != inode)
+ return;
+
+ name_len = 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, CASE_SENSITIVE, NULL, 0))
+ return;
+
+ sd = sds = ntfs_attr_readall(ni, AT_DATA, name, name_len, &data_size);
+ if (!sd) {
+ ntfs_log_perror("Failed to read $SDS attribute");
+ return;
+ }
+ /*
+ * 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)data_size &&
+ le32_to_cpu(sd->length) < (u64)data_size &&
+ le64_to_cpu(sd->offset) +
+ le32_to_cpu(sd->length) < (u64)data_size) {
+ ntfs_dump_sds_entry(sd);
+ sd = (SECURITY_DESCRIPTOR_HEADER *)((char*)sd +
+ ((le32_to_cpu(sd->length) + 15) & ~15));
+ }
+ free(sds);
+}
+
+static const char *get_attribute_type_name(le32 type)
+{
+ switch (type) {
+ case AT_UNUSED: return "$UNUSED";
+ case AT_STANDARD_INFORMATION: return "$STANDARD_INFORMATION";
+ case AT_ATTRIBUTE_LIST: return "$ATTRIBUTE_LIST";
+ case AT_FILE_NAME: return "$FILE_NAME";
+ case AT_OBJECT_ID: return "$OBJECT_ID";
+ case AT_SECURITY_DESCRIPTOR: return "$SECURITY_DESCRIPTOR";
+ case AT_VOLUME_NAME: return "$VOLUME_NAME";
+ case AT_VOLUME_INFORMATION: return "$VOLUME_INFORMATION";
+ case AT_DATA: return "$DATA";
+ case AT_INDEX_ROOT: return "$INDEX_ROOT";
+ case AT_INDEX_ALLOCATION: return "$INDEX_ALLOCATION";
+ case AT_BITMAP: return "$BITMAP";
+ case AT_REPARSE_POINT: return "$REPARSE_POINT";
+ case AT_EA_INFORMATION: return "$EA_INFORMATION";
+ case AT_EA: return "$EA";
+ case AT_PROPERTY_SET: return "$PROPERTY_SET";
+ case AT_LOGGED_UTILITY_STREAM: return "$LOGGED_UTILITY_STREAM";
+ case AT_END: return "$END";
+ }
+
+ return "$UNKNOWN";
+}
+
+static const char * ntfs_dump_lcn(LCN lcn)
+{
+ switch (lcn) {
+ case LCN_HOLE:
+ return "<HOLE>\t";
+ case LCN_RL_NOT_MAPPED:
+ return "<RL_NOT_MAPPED>";
+ case LCN_ENOENT:
+ return "<ENOENT>\t";
+ case LCN_EINVAL:
+ return "<EINVAL>\t";
+ case LCN_EIO:
+ return "<EIO>\t";
+ default:
+ ntfs_log_error("Invalid LCN value %llx passed to "
+ "ntfs_dump_lcn().\n", (long long)lcn);
+ return "???\t";
+ }
+}
+
+static void ntfs_dump_attribute_header(ntfs_attr_search_ctx *ctx,
+ ntfs_volume *vol, struct RUNCOUNT *runcount)
+{
+ ATTR_RECORD *a = ctx->attr;
+
+ printf("Dumping attribute %s (0x%x) from mft record %lld (0x%llx)\n",
+ get_attribute_type_name(a->type),
+ (unsigned)le32_to_cpu(a->type),
+ (unsigned long long)ctx->ntfs_ino->mft_no,
+ (unsigned long long)ctx->ntfs_ino->mft_no);
+
+ ntfs_log_verbose("\tAttribute length:\t %u (0x%x)\n",
+ (unsigned)le32_to_cpu(a->length),
+ (unsigned)le32_to_cpu(a->length));
+ printf("\tResident: \t\t %s\n", a->non_resident ? "No" : "Yes");
+ ntfs_log_verbose("\tName length:\t\t %u (0x%x)\n",
+ (unsigned)a->name_length, (unsigned)a->name_length);
+ ntfs_log_verbose("\tName offset:\t\t %u (0x%x)\n",
+ (unsigned)le16_to_cpu(a->name_offset),
+ (unsigned)le16_to_cpu(a->name_offset));
+
+ /* Dump the attribute (stream) name */
+ if (a->name_length) {
+ char *attribute_name = NULL;
+
+ attribute_name = ntfs_attr_get_name_mbs(a);
+ if (attribute_name) {
+ printf("\tAttribute name:\t\t '%s'\n", attribute_name);
+ free(attribute_name);
+ } else
+ ntfs_log_perror("Error: couldn't parse attribute name");
+ }
+
+ /* TODO: parse the flags */
+ printf("\tAttribute flags:\t 0x%04x\n",
+ (unsigned)le16_to_cpu(a->flags));
+ printf("\tAttribute instance:\t %u (0x%x)\n",
+ (unsigned)le16_to_cpu(a->instance),
+ (unsigned)le16_to_cpu(a->instance));
+
+ /* Resident attribute */
+ if (!a->non_resident) {
+ printf("\tData size:\t\t %u (0x%x)\n",
+ (unsigned)le32_to_cpu(a->value_length),
+ (unsigned)le32_to_cpu(a->value_length));
+ ntfs_log_verbose("\tData offset:\t\t %u (0x%x)\n",
+ (unsigned)le16_to_cpu(a->value_offset),
+ (unsigned)le16_to_cpu(a->value_offset));
+ /* TODO: parse the flags */
+ printf("\tResident flags:\t\t 0x%02x\n",
+ (unsigned)a->resident_flags);
+ ntfs_log_verbose("\tReservedR:\t\t %d (0x%x)\n",
+ (unsigned)a->reservedR, (unsigned)a->reservedR);
+ return;
+ }
+
+ /* Non-resident attribute */
+ ntfs_log_verbose("\tLowest VCN\t\t %lld (0x%llx)\n",
+ (long long)sle64_to_cpu(a->lowest_vcn),
+ (unsigned long long)sle64_to_cpu(a->lowest_vcn));
+ ntfs_log_verbose("\tHighest VCN:\t\t %lld (0x%llx)\n",
+ (long long)sle64_to_cpu(a->highest_vcn),
+ (unsigned long long)sle64_to_cpu(a->highest_vcn));
+ ntfs_log_verbose("\tMapping pairs offset:\t %u (0x%x)\n",
+ (unsigned)le16_to_cpu(a->mapping_pairs_offset),
+ (unsigned)le16_to_cpu(a->mapping_pairs_offset));
+ printf("\tCompression unit:\t %u (0x%x)\n",
+ (unsigned)a->compression_unit,
+ (unsigned)a->compression_unit);
+ /* TODO: dump the 5 reserved bytes here in verbose mode */
+
+ if (!a->lowest_vcn) {
+ printf("\tData size:\t\t %llu (0x%llx)\n",
+ (long long)sle64_to_cpu(a->data_size),
+ (unsigned long long)sle64_to_cpu(a->data_size));
+ printf("\tAllocated size:\t\t %llu (0x%llx)\n",
+ (long long)sle64_to_cpu(a->allocated_size),
+ (unsigned long long)
+ sle64_to_cpu(a->allocated_size));
+ printf("\tInitialized size:\t %llu (0x%llx)\n",
+ (long long)sle64_to_cpu(a->initialized_size),
+ (unsigned long long)
+ sle64_to_cpu(a->initialized_size));
+ if (a->compression_unit || a->flags & ATTR_IS_COMPRESSED ||
+ a->flags & ATTR_IS_SPARSE)
+ printf("\tCompressed size:\t %llu (0x%llx)\n",
+ (signed long long)
+ sle64_to_cpu(a->compressed_size),
+ (signed long long)
+ sle64_to_cpu(a->compressed_size));
+ }
+
+ if (opts.verbose) {
+ runlist *rl;
+
+ rl = ntfs_mapping_pairs_decompress(vol, a, NULL);
+ if (rl) {
+ runlist *rlc = rl;
+ LCN next_lcn;
+
+ next_lcn = LCN_HOLE;
+ // TODO: Switch this to properly aligned hex...
+ printf("\tRunlist:\tVCN\t\tLCN\t\tLength\n");
+ runcount->fragments++;
+ while (rlc->length) {
+ runcount->runs++;
+ if (rlc->lcn >= 0) {
+ printf("\t\t\t0x%llx\t\t0x%llx\t\t"
+ "0x%llx\n",
+ (long long)rlc->vcn,
+ (long long)rlc->lcn,
+ (long long)rlc->length);
+ if ((next_lcn >= 0)
+ && (rlc->lcn != next_lcn))
+ runcount->fragments++;
+ next_lcn = rlc->lcn + rlc->length;
+ } else
+ printf("\t\t\t0x%llx\t\t%s\t"
+ "0x%llx\n",
+ (long long)rlc->vcn,
+ ntfs_dump_lcn(rlc->lcn),
+ (long long)rlc->length);
+ rlc++;
+ }
+ free(rl);
+ } else
+ ntfs_log_error("Error: couldn't decompress runlist\n");
+ }
+}
+
+/**
+ * ntfs_dump_data_attr()
+ *
+ * dump some info about the data attribute if it's metadata
+ */
+static void ntfs_dump_attr_data(ATTR_RECORD *attr, ntfs_inode *ni)
+{
+ if (opts.verbose)
+ ntfs_dump_sds(attr, ni);
+}
+
+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;
+
+static void ntfs_dump_index_key(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type)
+{
+ char *sid;
+ char printable_GUID[37];
+
+ switch (type) {
+ case INDEX_ATTR_SECURE_SII:
+ ntfs_log_verbose("\t\tKey security id:\t %u (0x%x)\n",
+ (unsigned)
+ le32_to_cpu(entry->key.sii.security_id),
+ (unsigned)
+ le32_to_cpu(entry->key.sii.security_id));
+ break;
+ case INDEX_ATTR_SECURE_SDH:
+ ntfs_log_verbose("\t\tKey hash:\t\t 0x%08x\n",
+ (unsigned)le32_to_cpu(entry->key.sdh.hash));
+ ntfs_log_verbose("\t\tKey security id:\t %u (0x%x)\n",
+ (unsigned)
+ le32_to_cpu(entry->key.sdh.security_id),
+ (unsigned)
+ 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%08x\n", (unsigned)
+ le32_to_cpu(entry->key.reparse.reparse_tag));
+ ntfs_log_verbose("\t\tKey file id:\t\t %llu (0x%llx)\n",
+ (unsigned long long)
+ le64_to_cpu(entry->key.reparse.file_id),
+ (unsigned long long)
+ le64_to_cpu(entry->key.reparse.file_id));
+ break;
+ case INDEX_ATTR_QUOTA_O:
+ 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 (0x%x)\n",
+ (unsigned)le32_to_cpu(entry->key.owner_id),
+ (unsigned)le32_to_cpu(entry->key.owner_id));
+ break;
+ default:
+ ntfs_log_verbose("\t\tIndex attr type is UNKNOWN: \t 0x%08x\n",
+ (unsigned)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 +
+ le16_to_cpu(entry->data_offset));
+
+ switch (type) {
+ case INDEX_ATTR_SECURE_SII:
+ ntfs_log_verbose("\t\tHash:\t\t\t 0x%08x\n",
+ (unsigned)le32_to_cpu(data->sii.hash));
+ ntfs_log_verbose("\t\tSecurity id:\t\t %u (0x%x)\n",
+ (unsigned)le32_to_cpu(data->sii.security_id),
+ (unsigned)le32_to_cpu(data->sii.security_id));
+ ntfs_log_verbose("\t\tOffset in $SDS:\t\t %llu (0x%llx)\n",
+ (unsigned long long)
+ le64_to_cpu(data->sii.offset),
+ (unsigned long long)
+ le64_to_cpu(data->sii.offset));
+ ntfs_log_verbose("\t\tLength in $SDS:\t\t %u (0x%x)\n",
+ (unsigned)le32_to_cpu(data->sii.length),
+ (unsigned)le32_to_cpu(data->sii.length));
+ break;
+ case INDEX_ATTR_SECURE_SDH:
+ ntfs_log_verbose("\t\tHash:\t\t\t 0x%08x\n",
+ (unsigned)le32_to_cpu(data->sdh.hash));
+ ntfs_log_verbose("\t\tSecurity id:\t\t %u (0x%x)\n",
+ (unsigned)le32_to_cpu(data->sdh.security_id),
+ (unsigned)le32_to_cpu(data->sdh.security_id));
+ ntfs_log_verbose("\t\tOffset in $SDS:\t\t %llu (0x%llx)\n",
+ (unsigned long long)
+ le64_to_cpu(data->sdh.offset),
+ (unsigned long long)
+ le64_to_cpu(data->sdh.offset));
+ ntfs_log_verbose("\t\tLength in $SDS:\t\t %u (0x%x)\n",
+ (unsigned)le32_to_cpu(data->sdh.length),
+ (unsigned)le32_to_cpu(data->sdh.length));
+ ntfs_log_verbose("\t\tUnknown (padding):\t 0x%08x\n",
+ (unsigned)le32_to_cpu(data->sdh.reserved_II));
+ break;
+ case INDEX_ATTR_OBJID_O: {
+ OBJ_ID_INDEX_DATA *object_id_data;
+ char printable_GUID[37];
+
+ object_id_data = (OBJ_ID_INDEX_DATA*)((u8*)entry +
+ le16_to_cpu(entry->data_offset));
+ ntfs_log_verbose("\t\tMFT Number:\t\t 0x%llx\n",
+ (unsigned long long)
+ MREF_LE(object_id_data->mft_reference));
+ ntfs_log_verbose("\t\tMFT Sequence Number:\t 0x%x\n",
+ (unsigned)
+ MSEQNO_LE(object_id_data->mft_reference));
+ ntfs_guid_to_mbs(&object_id_data->birth_volume_id,
+ printable_GUID);
+ ntfs_log_verbose("\t\tBirth volume id GUID:\t %s\n",
+ printable_GUID);
+ ntfs_guid_to_mbs(&object_id_data->birth_object_id,
+ printable_GUID);
+ ntfs_log_verbose("\t\tBirth object id GUID:\t %s\n",
+ printable_GUID);
+ ntfs_guid_to_mbs(&object_id_data->domain_id, printable_GUID);
+ ntfs_log_verbose("\t\tDomain id GUID:\t\t %s\n",
+ printable_GUID);
+ }
+ break;
+ case INDEX_ATTR_REPARSE_R:
+ /* TODO */
+ break;
+ case INDEX_ATTR_QUOTA_O:
+ ntfs_log_verbose("\t\tOwner id:\t\t %u (0x%x)\n",
+ (unsigned)le32_to_cpu(data->quota_o.owner_id),
+ (unsigned)le32_to_cpu(data->quota_o.owner_id));
+ ntfs_log_verbose("\t\tUnknown:\t\t %u (0x%x)\n",
+ (unsigned)le32_to_cpu(data->quota_o.unknown),
+ (unsigned)le32_to_cpu(data->quota_o.unknown));
+ break;
+ case INDEX_ATTR_QUOTA_Q:
+ ntfs_log_verbose("\t\tVersion:\t\t %u\n",
+ (unsigned)le32_to_cpu(data->quota_q.version));
+ ntfs_log_verbose("\t\tQuota flags:\t\t 0x%08x\n",
+ (unsigned)le32_to_cpu(data->quota_q.flags));
+ ntfs_log_verbose("\t\tBytes used:\t\t %llu (0x%llx)\n",
+ (unsigned long long)
+ le64_to_cpu(data->quota_q.bytes_used),
+ (unsigned long long)
+ 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 (0x%llx)\n",
+ (unsigned long long)
+ sle64_to_cpu(data->quota_q.threshold),
+ (unsigned long long)
+ sle64_to_cpu(data->quota_q.threshold));
+ ntfs_log_verbose("\t\tLimit:\t\t\t %lld (0x%llx)\n",
+ (unsigned long long)
+ sle64_to_cpu(data->quota_q.limit),
+ (unsigned long long)
+ sle64_to_cpu(data->quota_q.limit));
+ ntfs_log_verbose("\t\tExceeded time:\t\t %lld (0x%llx)\n",
+ (unsigned long long)
+ sle64_to_cpu(data->quota_q.exceeded_time),
+ (unsigned long long)
+ sle64_to_cpu(data->quota_q.exceeded_time));
+ if (le16_to_cpu(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",
+ (unsigned)type);
+ break;
+ }
+}
+
+/**
+ * ntfs_dump_index_entries()
+ *
+ * dump sequence of index_entries and return number of entries dumped.
+ */
+static int ntfs_dump_index_entries(INDEX_ENTRY *entry, INDEX_ATTR_TYPE type)
+{
+ int numb_entries = 1;
+ while (1) {
+ if (!opts.verbose) {
+ if (entry->ie_flags & INDEX_ENTRY_END)
+ break;
+ entry = (INDEX_ENTRY *)((u8 *)entry +
+ le16_to_cpu(entry->length));
+ numb_entries++;
+ continue;
+ }
+ ntfs_log_verbose("\t\tEntry length:\t\t %u (0x%x)\n",
+ (unsigned)le16_to_cpu(entry->length),
+ (unsigned)le16_to_cpu(entry->length));
+ ntfs_log_verbose("\t\tKey length:\t\t %u (0x%x)\n",
+ (unsigned)le16_to_cpu(entry->key_length),
+ (unsigned)le16_to_cpu(entry->key_length));
+ ntfs_log_verbose("\t\tIndex entry flags:\t 0x%02x\n",
+ (unsigned)le16_to_cpu(entry->ie_flags));
+
+ if (entry->ie_flags & INDEX_ENTRY_NODE)
+ ntfs_log_verbose("\t\tSubnode VCN:\t\t %lld (0x%llx)\n",
+ (long long)ntfs_ie_get_vcn(entry),
+ (long long)ntfs_ie_get_vcn(entry));
+ if (entry->ie_flags & INDEX_ENTRY_END)
+ break;
+
+ switch (type) {
+ case INDEX_ATTR_DIRECTORY_I30:
+ ntfs_log_verbose("\t\tFILE record number:\t %llu "
+ "(0x%llx)\n", (unsigned long long)
+ MREF_LE(entry->indexed_file),
+ (unsigned long long)
+ MREF_LE(entry->indexed_file));
+ ntfs_dump_filename("\t\t", &entry->key.file_name);
+ break;
+ default:
+ ntfs_log_verbose("\t\tData offset:\t\t %u (0x%x)\n",
+ (unsigned)
+ le16_to_cpu(entry->data_offset),
+ (unsigned)
+ le16_to_cpu(entry->data_offset));
+ ntfs_log_verbose("\t\tData length:\t\t %u (0x%x)\n",
+ (unsigned)
+ le16_to_cpu(entry->data_length),
+ (unsigned)
+ le16_to_cpu(entry->data_length));
+ ntfs_dump_index_key(entry, type);
+ ntfs_log_verbose("\t\tKey Data:\n");
+ ntfs_dump_index_data(entry, type);
+ break;
+ }
+ if (!entry->length) {
+ ntfs_log_verbose("\tWARNING: Corrupt index entry, "
+ "skipping the remainder of this index "
+ "block.\n");
+ break;
+ }
+ entry = (INDEX_ENTRY*)((u8*)entry + le16_to_cpu(entry->length));
+ numb_entries++;
+ ntfs_log_verbose("\n");
+ }
+ ntfs_log_verbose("\tEnd of index block reached\n");
+ 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, CASE_SENSITIVE, NULL, 0)
+
+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 if (!strcmp(file_name, "/$Extend/$ObjId"))
+ 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");
+}
+
+static void ntfs_dump_index_header(const char *indent, INDEX_HEADER *idx)
+{
+ printf("%sEntries Offset:\t\t %u (0x%x)\n", indent,
+ (unsigned)le32_to_cpu(idx->entries_offset),
+ (unsigned)le32_to_cpu(idx->entries_offset));
+ printf("%sIndex Size:\t\t %u (0x%x)\n", indent,
+ (unsigned)le32_to_cpu(idx->index_length),
+ (unsigned)le32_to_cpu(idx->index_length));
+ printf("%sAllocated Size:\t\t %u (0x%x)\n", indent,
+ (unsigned)le32_to_cpu(idx->allocated_size),
+ (unsigned)le32_to_cpu(idx->allocated_size));
+ printf("%sIndex header flags:\t 0x%02x\n", indent, idx->ih_flags);
+
+ /* FIXME: there are 3 reserved bytes here */
+}
+
+/**
+ * ntfs_dump_attr_index_root()
+ *
+ * dump the index_root attribute
+ */
+static void ntfs_dump_attr_index_root(ATTR_RECORD *attr, ntfs_inode *ni)
+{
+ INDEX_ATTR_TYPE type;
+ INDEX_ROOT *index_root = NULL;
+ INDEX_ENTRY *entry;
+
+ index_root = (INDEX_ROOT*)((u8*)attr + le16_to_cpu(attr->value_offset));
+
+ /* attr_type dumping */
+ type = get_index_attr_type(ni, attr, index_root);
+ printf("\tIndexed Attr Type:\t ");
+ ntfs_dump_index_attr_type(type);
+
+ /* collation rule dumping */
+ printf("\tCollation Rule:\t\t %u (0x%x)\n",
+ (unsigned)le32_to_cpu(index_root->collation_rule),
+ (unsigned)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 (0x%x)\n",
+ (unsigned)le32_to_cpu(index_root->index_block_size),
+ (unsigned)le32_to_cpu(index_root->index_block_size));
+ if (le32_to_cpu(index_root->index_block_size) < ni->vol->cluster_size)
+ printf("\t512-byte Units Per Block:\t %u (0x%x)\n",
+ (unsigned)index_root->clusters_per_index_block,
+ (unsigned)index_root->clusters_per_index_block);
+ else
+ printf("\tClusters Per Block:\t %u (0x%x)\n",
+ (unsigned)index_root->clusters_per_index_block,
+ (unsigned)index_root->clusters_per_index_block);
+
+ ntfs_dump_index_header("\t", &index_root->index);
+
+ entry = (INDEX_ENTRY*)((u8*)index_root +
+ le32_to_cpu(index_root->index.entries_offset) + 0x10);
+ ntfs_log_verbose("\tDumping index root:\n");
+ printf("\tIndex entries total:\t %d\n",
+ ntfs_dump_index_entries(entry, type));
+}
+
+static void ntfs_dump_usa_lsn(const char *indent, MFT_RECORD *mrec)
+{
+ printf("%sUpd. Seq. Array Off.:\t %u (0x%x)\n", indent,
+ (unsigned)le16_to_cpu(mrec->usa_ofs),
+ (unsigned)le16_to_cpu(mrec->usa_ofs));
+ printf("%sUpd. Seq. Array Count:\t %u (0x%x)\n", indent,
+ (unsigned)le16_to_cpu(mrec->usa_count),
+ (unsigned)le16_to_cpu(mrec->usa_count));
+ printf("%sUpd. Seq. Number:\t %u (0x%x)\n", indent,
+ (unsigned)le16_to_cpup((le16*)((u8*)mrec +
+ le16_to_cpu(mrec->usa_ofs))),
+ (unsigned)le16_to_cpup((le16*)((u8*)mrec +
+ le16_to_cpu(mrec->usa_ofs))));
+ printf("%sLogFile Seq. Number:\t 0x%llx\n", indent,
+ (unsigned long long)sle64_to_cpu(mrec->lsn));
+}
+
+
+static s32 ntfs_dump_index_block(INDEX_BLOCK *ib, INDEX_ATTR_TYPE type,
+ u32 ib_size)
+{
+ INDEX_ENTRY *entry;
+
+ if (ntfs_mst_post_read_fixup((NTFS_RECORD*)ib, ib_size)) {
+ ntfs_log_perror("Damaged INDX record");
+ return -1;
+ }
+ ntfs_log_verbose("\tDumping index block:\n");
+ if (opts.verbose)
+ ntfs_dump_usa_lsn("\t\t", (MFT_RECORD*)ib);
+
+ ntfs_log_verbose("\t\tNode VCN:\t\t %lld (0x%llx)\n",
+ (unsigned long long)sle64_to_cpu(ib->index_block_vcn),
+ (unsigned long long)sle64_to_cpu(ib->index_block_vcn));
+
+ entry = (INDEX_ENTRY*)((u8*)ib +
+ le32_to_cpu(ib->index.entries_offset) + 0x18);
+
+ if (opts.verbose) {
+ ntfs_dump_index_header("\t\t", &ib->index);
+ printf("\n");
+ }
+
+ return ntfs_dump_index_entries(entry, type);
+}
+
+/**
+ * ntfs_dump_attr_index_allocation()
+ *
+ * dump context of the index_allocation attribute
+ */
+static void ntfs_dump_attr_index_allocation(ATTR_RECORD *attr, ntfs_inode *ni)
+{
+ INDEX_ALLOCATION *allocation, *tmp_alloc;
+ INDEX_ROOT *ir;
+ INDEX_ATTR_TYPE type;
+ int total_entries = 0;
+ int total_indx_blocks = 0;
+ u8 *bitmap, *byte;
+ int bit;
+ ntfschar *name;
+ u32 name_len;
+ s64 data_size;
+
+ ir = ntfs_index_root_get(ni, attr);
+ if (!ir) {
+ ntfs_log_perror("Failed to read $INDEX_ROOT attribute");
+ return;
+ }
+
+ type = get_index_attr_type(ni, attr, ir);
+
+ name = (ntfschar *)((u8 *)attr + le16_to_cpu(attr->name_offset));
+ name_len = attr->name_length;
+
+ byte = bitmap = ntfs_attr_readall(ni, AT_BITMAP, name, name_len, NULL);
+ if (!byte) {
+ ntfs_log_perror("Failed to read $BITMAP attribute");
+ goto out_index_root;
+ }
+
+ tmp_alloc = allocation = ntfs_attr_readall(ni, AT_INDEX_ALLOCATION,
+ name, name_len, &data_size);
+ if (!tmp_alloc) {
+ ntfs_log_perror("Failed to read $INDEX_ALLOCATION attribute");
+ goto out_bitmap;
+ }
+
+ bit = 0;
+ while ((u8 *)tmp_alloc < (u8 *)allocation + data_size) {
+ if (*byte & (1 << bit)) {
+ int entries;
+
+ entries = ntfs_dump_index_block(tmp_alloc, type,
+ le32_to_cpu(
+ ir->index_block_size));
+ if (entries != -1) {
+ total_entries += entries;
+ total_indx_blocks++;
+ ntfs_log_verbose("\tIndex entries:\t\t %d\n",
+ entries);
+ }
+ }
+ tmp_alloc = (INDEX_ALLOCATION *)((u8 *)tmp_alloc +
+ le32_to_cpu(
+ ir->index_block_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);
+out_bitmap:
+ free(bitmap);
+out_index_root:
+ free(ir);
+}
+
+/**
+ * ntfs_dump_attr_bitmap()
+ *
+ * dump the bitmap attribute
+ */
+static void ntfs_dump_attr_bitmap(ATTR_RECORD *attr __attribute__((unused)))
+{
+ /* TODO */
+}
+
+/**
+ * ntfs_dump_attr_reparse_point()
+ *
+ * of ntfs 3.x dumps the reparse_point attribute
+ */
+static void ntfs_dump_attr_reparse_point(ATTR_RECORD *attr __attribute__((unused)))
+{
+ /* TODO */
+}
+
+/**
+ * ntfs_dump_attr_ea_information()
+ *
+ * dump the ea_information attribute
+ */
+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("\tPacked EA length:\t %u (0x%x)\n",
+ (unsigned)le16_to_cpu(ea_info->ea_length),
+ (unsigned)le16_to_cpu(ea_info->ea_length));
+ printf("\tNEED_EA count:\t\t %u (0x%x)\n",
+ (unsigned)le16_to_cpu(ea_info->need_ea_count),
+ (unsigned)le16_to_cpu(ea_info->need_ea_count));
+ printf("\tUnpacked EA length:\t %u (0x%x)\n",
+ (unsigned)le32_to_cpu(ea_info->ea_query_length),
+ (unsigned)le32_to_cpu(ea_info->ea_query_length));
+}
+
+/**
+ * ntfs_dump_attr_ea()
+ *
+ * dump the ea attribute
+ */
+static void ntfs_dump_attr_ea(ATTR_RECORD *attr, ntfs_volume *vol)
+{
+ EA_ATTR *ea;
+ u8 *buf = NULL;
+ le32 *pval;
+ s64 data_size;
+
+ if (attr->non_resident) {
+ runlist *rl;
+
+ data_size = sle64_to_cpu(attr->data_size);
+ if (!opts.verbose)
+ return;
+ /* FIXME: We don't handle fragmented mapping pairs case. */
+ rl = ntfs_mapping_pairs_decompress(vol, attr, NULL);
+ if (rl) {
+ s64 bytes_read;
+
+ buf = ntfs_malloc(data_size);
+ if (!buf) {
+ free(rl);
+ return;
+ }
+ bytes_read = ntfs_rl_pread(vol, rl, 0, data_size, buf);
+ if (bytes_read != data_size) {
+ ntfs_log_perror("ntfs_rl_pread failed");
+ free(buf);
+ free(rl);
+ return;
+ }
+ free(rl);
+ ea = (EA_ATTR*)buf;
+ } else {
+ ntfs_log_perror("ntfs_mapping_pairs_decompress failed");
+ return;
+ }
+ } else {
+ data_size = le32_to_cpu(attr->value_length);
+ if (!opts.verbose)
+ return;
+ ea = (EA_ATTR*)((u8*)attr + le16_to_cpu(attr->value_offset));
+ }
+ while (1) {
+ printf("\n\tEA flags:\t\t ");
+ if (ea->flags) {
+ if (ea->flags == NEED_EA)
+ printf("NEED_EA\n");
+ else
+ printf("Unknown (0x%02x)\n",
+ (unsigned)ea->flags);
+ } else
+ printf("NONE\n");
+ printf("\tName length:\t %d (0x%x)\n",
+ (unsigned)ea->name_length,
+ (unsigned)ea->name_length);
+ printf("\tValue length:\t %d (0x%x)\n",
+ (unsigned)le16_to_cpu(ea->value_length),
+ (unsigned)le16_to_cpu(ea->value_length));
+ printf("\tName:\t\t '%s'\n", ea->name);
+ printf("\tValue:\t\t ");
+ if (ea->name_length == 11 &&
+ !strncmp((const char*)"SETFILEBITS",
+ (const char*)ea->name, 11)) {
+ pval = (le32*)(ea->value + ea->name_length + 1);
+ printf("0%lo\n", (unsigned long)le32_to_cpu(*pval));
+ } else
+ printf("'%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
+ break;
+ if ((u8*)ea - buf >= data_size)
+ break;
+ }
+ free(buf);
+}
+
+/**
+ * ntfs_dump_attr_property_set()
+ *
+ * dump the property_set attribute
+ */
+static void ntfs_dump_attr_property_set(ATTR_RECORD *attr __attribute__((unused)))
+{
+ /* TODO */
+}
+
+static void ntfs_hex_dump(void *buf,unsigned int length);
+
+/**
+ * ntfs_dump_attr_logged_utility_stream()
+ *
+ * dump the property_set attribute
+ */
+static void ntfs_dump_attr_logged_utility_stream(ATTR_RECORD *attr,
+ ntfs_inode *ni)
+{
+ char *buf;
+ s64 size;
+
+ if (!opts.verbose)
+ return;
+ buf = ntfs_attr_readall(ni, AT_LOGGED_UTILITY_STREAM,
+ ntfs_attr_get_name(attr), attr->name_length, &size);
+ if (buf)
+ ntfs_hex_dump(buf, size);
+ free(buf);
+ /* TODO */
+}
+
+/**
+ * ntfs_hex_dump
+ */
+static void ntfs_hex_dump(void *buf,unsigned int length)
+{
+ unsigned int i=0;
+ while (i<length) {
+ unsigned int j;
+
+ /* line start */
+ printf("\t%04X ",i);
+
+ /* hex content */
+ for (j=i;(j<length) && (j<i+16);j++) {
+ unsigned char c = *((char *)buf + j);
+ printf("%02hhX ",c);
+ }
+
+ /* realign */
+ for (;j<i+16;j++) {
+ printf(" ");
+ }
+
+ /* char content */
+ for (j=i;(j<length) && (j<i+16);j++) {
+ unsigned char c = *((char *)buf + j);
+ /* display unprintable chars as '.' */
+ if ((c<32) || (c>126)) {
+ c = '.';
+ }
+ printf("%c",c);
+ }
+
+ /* end line */
+ printf("\n");
+ i=j;
+ }
+}
+
+/**
+ * ntfs_dump_attr_unknown
+ */
+static void ntfs_dump_attr_unknown(ATTR_RECORD *attr)
+{
+ printf("===== Please report this unknown attribute type to %s =====\n",
+ NTFS_DEV_LIST);
+
+ if (!attr->non_resident) {
+ /* hex dump */
+ printf("\tDumping some of the attribute data:\n");
+ ntfs_hex_dump((u8*)attr + le16_to_cpu(attr->value_offset),
+ (le32_to_cpu(attr->value_length) > 128) ?
+ 128 : le32_to_cpu(attr->value_length));
+ }
+}
+
+/**
+ * ntfs_dump_inode_general_info
+ */
+static void ntfs_dump_inode_general_info(ntfs_inode *inode)
+{
+ MFT_RECORD *mrec = inode->mrec;
+ le16 inode_flags = mrec->flags;
+
+ printf("Dumping Inode %llu (0x%llx)\n",
+ (long long)inode->mft_no,
+ (unsigned long long)inode->mft_no);
+
+ ntfs_dump_usa_lsn("", mrec);
+ printf("MFT Record Seq. Numb.:\t %u (0x%x)\n",
+ (unsigned)le16_to_cpu(mrec->sequence_number),
+ (unsigned)le16_to_cpu(mrec->sequence_number));
+ printf("Number of Hard Links:\t %u (0x%x)\n",
+ (unsigned)le16_to_cpu(mrec->link_count),
+ (unsigned)le16_to_cpu(mrec->link_count));
+ printf("Attribute Offset:\t %u (0x%x)\n",
+ (unsigned)le16_to_cpu(mrec->attrs_offset),
+ (unsigned)le16_to_cpu(mrec->attrs_offset));
+
+ printf("MFT Record Flags:\t ");
+ if (inode_flags) {
+ 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;
+ }
+ /* 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%04x", (unsigned)le16_to_cpu(
+ inode_flags));
+ } else {
+ printf("none");
+ }
+ printf("\n");
+
+ printf("Bytes Used:\t\t %u (0x%x) bytes\n",
+ (unsigned)le32_to_cpu(mrec->bytes_in_use),
+ (unsigned)le32_to_cpu(mrec->bytes_in_use));
+ printf("Bytes Allocated:\t %u (0x%x) bytes\n",
+ (unsigned)le32_to_cpu(mrec->bytes_allocated),
+ (unsigned)le32_to_cpu(mrec->bytes_allocated));
+
+ if (mrec->base_mft_record) {
+ printf("Base MFT Record:\t %llu (0x%llx)\n",
+ (unsigned long long)
+ MREF_LE(mrec->base_mft_record),
+ (unsigned long long)
+ MREF_LE(mrec->base_mft_record));
+ }
+ printf("Next Attribute Instance: %u (0x%x)\n",
+ (unsigned)le16_to_cpu(mrec->next_attr_instance),
+ (unsigned)le16_to_cpu(mrec->next_attr_instance));
+
+ printf("MFT Padding:\t");
+ ntfs_dump_bytes((u8 *)mrec, le16_to_cpu(mrec->usa_ofs) +
+ 2 * le16_to_cpu(mrec->usa_count),
+ le16_to_cpu(mrec->attrs_offset));
+ printf("\n");
+}
+
+/**
+ * ntfs_get_file_attributes
+ */
+static void ntfs_dump_file_attributes(ntfs_inode *inode)
+{
+ struct RUNCOUNT runcount;
+ ntfs_attr_search_ctx *ctx = NULL;
+
+ runcount.runs = 0;
+ runcount.fragments = 0;
+ /* then start enumerating attributes
+ see ntfs_attr_lookup documentation for detailed explanation */
+ ctx = ntfs_attr_get_search_ctx(inode, NULL);
+ while (!ntfs_attr_lookup(AT_UNUSED, NULL, 0, CASE_SENSITIVE,
+ 0, NULL, 0, ctx)) {
+ if (ctx->attr->type == AT_END || ctx->attr->type == AT_UNUSED) {
+ printf("Weird: %s attribute type was found, please "
+ "report this.\n",
+ get_attribute_type_name(
+ ctx->attr->type));
+ continue;
+ }
+
+ ntfs_dump_attribute_header(ctx, inode->vol, &runcount);
+
+ switch (ctx->attr->type) {
+ case AT_STANDARD_INFORMATION:
+ ntfs_dump_attr_standard_information(ctx->attr);
+ break;
+ case AT_ATTRIBUTE_LIST:
+ ntfs_dump_attr_list(ctx->attr, inode->vol);
+ break;
+ case AT_FILE_NAME:
+ ntfs_dump_attr_file_name(ctx->attr);
+ break;
+ case AT_OBJECT_ID:
+ ntfs_dump_attr_object_id(ctx->attr, inode->vol);
+ break;
+ case AT_SECURITY_DESCRIPTOR:
+ ntfs_dump_attr_security_descriptor(ctx->attr,
+ inode->vol);
+ 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, inode);
+ break;
+ case AT_INDEX_ROOT:
+ ntfs_dump_attr_index_root(ctx->attr, inode);
+ break;
+ case AT_INDEX_ALLOCATION:
+ ntfs_dump_attr_index_allocation(ctx->attr, inode);
+ 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, inode->vol);
+ 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, inode);
+ break;
+ default:
+ ntfs_dump_attr_unknown(ctx->attr);
+ }
+ }
+
+ /* if we exited the loop before we're done - notify the user */
+ if (errno != ENOENT) {
+ ntfs_log_perror("ntfsinfo error: stopped before finished "
+ "enumerating attributes");
+ } else {
+ printf("End of inode reached\n");
+ if (opts.verbose) {
+ printf("Total runs: %lu (fragments: %lu)\n",
+ runcount.runs, runcount.fragments);
+ }
+ }
+
+ /* close all data-structures we used */
+ ntfs_attr_put_search_ctx(ctx);
+ ntfs_inode_close(inode);
+}
+
+/**
+ * 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;
+
+ setlinebuf(stdout);
+
+ ntfs_log_set_handler(ntfs_log_handler_outerr);
+
+ if (!parse_options(argc, argv)) {
+ printf("Failed to parse command line options\n");
+ exit(1);
+ }
+
+ utils_set_locale();
+
+ vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY |
+ (opts.force ? NTFS_MNT_RECOVER : 0));
+ if (!vol) {
+ printf("Failed to open '%s'.\n", opts.device);
+ 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 (opts.mft)
+ ntfs_dump_volume(vol);
+
+ if ((opts.inode != -1) || opts.filename) {
+ ntfs_inode *inode;
+ /* obtain the inode */
+ if (opts.filename) {
+ inode = ntfs_pathname_to_inode(vol, NULL,
+ opts.filename);
+ } else {
+ inode = ntfs_inode_open(vol, MK_MREF(opts.inode, 0));
+ }
+
+ /* dump the inode information */
+ if (inode) {
+ /* 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, either
+ * EIO or or ESPIPE is returned, we should notify better
+ * in those cases
+ */
+ ntfs_log_perror("Error loading node");
+ }
+ }
+
+ ntfs_umount(vol, FALSE);
+ return 0;
+}
+
diff --git a/ntfsprogs/ntfslabel.8 b/ntfsprogs/ntfslabel.8
new file mode 100644
index 0000000..ea9a410
--- a/dev/null
+++ b/ntfsprogs/ntfslabel.8
@@ -0,0 +1,118 @@
+.\" 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 NTFSLABEL 8 "November 2005" "ntfs-3g 2014.2.15"
+.SH NAME
+ntfslabel \- display/change the label on an ntfs file system
+.SH SYNOPSIS
+.B ntfslabel
+[\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 .
+It can also change the serial number of the
+.IR device .
+.PP
+If the optional argument
+.I new\-label
+is not present, and no option is 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.
+.SH OPTIONS
+Below is a summary of all the options that
+.B ntfslabel
+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\-\-new\-serial\fR[\fI=ssssssssssssssss\fR], or
+.TP
+\fB\-\-new\-half\-serial\fR[\fI=ssssssss\fR]
+Set a new serial number to the device, either the argument value, or a random
+one if no argument is given. The serial number is a 64 bit number,
+represented as a sixteen-digit hexadecimal number, used to identify the
+device during the mounting process. As a consequence, two devices with the
+same serial number cannot be mounted at the same time on the same computer.
+This is not the volume UUID used by Windows to locate files which have been
+moved to another volume.
+
+The option \-\-new\-half\-serial only changes the upper part of the serial
+number, keeping the lower part which is used by Windows unchanged.
+In this case the optional argument is an eight-digit hexadecimal number.
+
+.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. The label and the serial number are displayed.
+.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
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.SH AUTHORS
+.B ntfslabel
+was written by Matthew J. Fanto, with contributions from Anton Altaparmakov and
+Richard Russon.
+It was ported to ntfs-3g by Erik Larsson.
+.SH AVAILABILITY
+.B ntfslabel
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR mkntfs (8),
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfslabel.8.in b/ntfsprogs/ntfslabel.8.in
new file mode 100755
index 0000000..291ba53
--- a/dev/null
+++ b/ntfsprogs/ntfslabel.8.in
@@ -0,0 +1,118 @@
+.\" 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 NTFSLABEL 8 "November 2005" "ntfs-3g @VERSION@"
+.SH NAME
+ntfslabel \- display/change the label on an ntfs file system
+.SH SYNOPSIS
+.B ntfslabel
+[\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 .
+It can also change the serial number of the
+.IR device .
+.PP
+If the optional argument
+.I new\-label
+is not present, and no option is 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.
+.SH OPTIONS
+Below is a summary of all the options that
+.B ntfslabel
+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\-\-new\-serial\fR[\fI=ssssssssssssssss\fR], or
+.TP
+\fB\-\-new\-half\-serial\fR[\fI=ssssssss\fR]
+Set a new serial number to the device, either the argument value, or a random
+one if no argument is given. The serial number is a 64 bit number,
+represented as a sixteen-digit hexadecimal number, used to identify the
+device during the mounting process. As a consequence, two devices with the
+same serial number cannot be mounted at the same time on the same computer.
+This is not the volume UUID used by Windows to locate files which have been
+moved to another volume.
+
+The option \-\-new\-half\-serial only changes the upper part of the serial
+number, keeping the lower part which is used by Windows unchanged.
+In this case the optional argument is an eight-digit hexadecimal number.
+
+.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. The label and the serial number are displayed.
+.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
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.SH AUTHORS
+.B ntfslabel
+was written by Matthew J. Fanto, with contributions from Anton Altaparmakov and
+Richard Russon.
+It was ported to ntfs-3g by Erik Larsson.
+.SH AVAILABILITY
+.B ntfslabel
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR mkntfs (8),
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfslabel.c b/ntfsprogs/ntfslabel.c
new file mode 100755
index 0000000..cde594d
--- a/dev/null
+++ b/ntfsprogs/ntfslabel.c
@@ -0,0 +1,458 @@
+/**
+ * ntfslabel - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2002 Matthew J. Fanto
+ * Copyright (c) 2002-2005 Anton Altaparmakov
+ * Copyright (c) 2002-2003 Richard Russon
+ * Copyright (c) 2012 Jean-Pierre Andre
+ *
+ * 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"
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "debug.h"
+#include "mft.h"
+#include "utils.h"
+/* #include "version.h" */
+#include "logging.h"
+#include "misc.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 new_serial; /* Change the serial number */
+ long long serial; /* Forced serial number value */
+ int noaction; /* Do not write to disk */
+} opts;
+
+/**
+ * version - Print version information about the program
+ *
+ * Print a copyright statement and a brief description of the program.
+ *
+ * Return: none
+ */
+static void version(void)
+{
+ ntfs_log_info("\n%s v%s (libntfs-3g) - Display, or set, the label for an "
+ "NTFS Volume.\n\n", EXEC_NAME, VERSION);
+ 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(" 2012 Jean-Pierre Andre\n");
+ ntfs_log_info("\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)
+{
+ ntfs_log_info("\nUsage: %s [options] device [label]\n"
+ " -n, --no-action Do not write to disk\n"
+ " -f, --force Use less caution\n"
+ " --new-serial Set a new serial number\n"
+ " --new-half-serial Set a partial new serial number\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);
+}
+
+/**
+ * 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?IinqvV";
+ static const struct option lopt[] = {
+ { "force", no_argument, NULL, 'f' },
+ { "help", no_argument, NULL, 'h' },
+ { "new-serial", optional_argument, NULL, 'I' },
+ { "new-half-serial", optional_argument, NULL, 'i' },
+ { "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 },
+ };
+
+ int c = -1;
+ int err = 0;
+ int ver = 0;
+ int help = 0;
+ int levels = 0;
+ char *endserial;
+
+ 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':
+ case '?':
+ if (strncmp (argv[optind-1], "--log-", 6) == 0) {
+ if (!ntfs_log_parse_option (argv[optind-1]))
+ err++;
+ break;
+ }
+ help++;
+ break;
+ case 'I' : /* not proposed as a short option letter */
+ if (optarg) {
+ opts.serial = strtoll(optarg, &endserial, 16);
+ if (*endserial)
+ ntfs_log_error("Bad hexadecimal serial number.\n");
+ }
+ opts.new_serial |= 2;
+ break;
+ case 'i' : /* not proposed as a short option letter */
+ if (optarg) {
+ opts.serial = strtoll(optarg, &endserial, 16)
+ << 32;
+ if (*endserial)
+ ntfs_log_error("Bad hexadecimal serial number.\n");
+ }
+ opts.new_serial |= 1;
+ break;
+ case 'n':
+ opts.noaction++;
+ 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:
+ 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)
+ ntfs_log_error("You must specify a device.\n");
+ err++;
+ }
+
+ if (opts.quiet && opts.verbose) {
+ ntfs_log_error("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 change_serial(ntfs_volume *vol, u64 sector, le64 serial_number,
+ NTFS_BOOT_SECTOR *bs, NTFS_BOOT_SECTOR *oldbs)
+{
+ int res;
+ le64 mask;
+ BOOL same;
+
+ res = -1;
+ if ((ntfs_pread(vol->dev, sector << vol->sector_size_bits,
+ vol->sector_size, bs) == vol->sector_size)) {
+ same = TRUE;
+ if (!sector)
+ /* save the real bootsector */
+ memcpy(oldbs, bs, vol->sector_size);
+ else
+ /* backup bootsector must be similar */
+ same = !memcmp(oldbs, bs, vol->sector_size);
+ if (same) {
+ if (opts.new_serial & 2)
+ bs->volume_serial_number = serial_number;
+ else {
+ mask = const_cpu_to_le64(~0x0ffffffffULL);
+ bs->volume_serial_number
+ = (serial_number & mask)
+ | (bs->volume_serial_number & ~mask);
+ }
+ if (opts.noaction
+ || (ntfs_pwrite(vol->dev,
+ sector << vol->sector_size_bits,
+ vol->sector_size, bs) == vol->sector_size)) {
+ res = 0;
+ }
+ } else {
+ ntfs_log_info("* Warning : the backup boot sector"
+ " does not match (leaving unchanged)\n");
+ res = 0;
+ }
+ }
+ return (res);
+}
+
+static int set_new_serial(ntfs_volume *vol)
+{
+ NTFS_BOOT_SECTOR *bs; /* full boot sectors */
+ NTFS_BOOT_SECTOR *oldbs; /* full original boot sector */
+ le64 serial_number;
+ u64 number_of_sectors;
+ u64 sn;
+ int res;
+
+ res = -1;
+ bs = (NTFS_BOOT_SECTOR*)ntfs_malloc(vol->sector_size);
+ oldbs = (NTFS_BOOT_SECTOR*)ntfs_malloc(vol->sector_size);
+ if (bs && oldbs) {
+ if (opts.serial)
+ serial_number = cpu_to_le64(opts.serial);
+ else {
+ /* different values for parallel processes */
+ srandom(time((time_t*)NULL) ^ (getpid() << 16));
+ sn = ((u64)random() << 32)
+ | ((u64)random() & 0xffffffff);
+ serial_number = cpu_to_le64(sn);
+ }
+ if (!change_serial(vol, 0, serial_number, bs, oldbs)) {
+ number_of_sectors = le64_to_cpu(bs->number_of_sectors);
+ if (!change_serial(vol, number_of_sectors,
+ serial_number, bs, oldbs)) {
+ ntfs_log_info("New serial number : %016llx\n",
+ (long long)le64_to_cpu(
+ bs->volume_serial_number));
+ res = 0;
+ }
+ }
+ free(bs);
+ free(oldbs);
+ }
+ if (res)
+ ntfs_log_info("Error setting a new serial number\n");
+ return (res);
+}
+
+static int print_serial(ntfs_volume *vol)
+{
+ NTFS_BOOT_SECTOR *bs; /* full boot sectors */
+ int res;
+
+ res = -1;
+ bs = (NTFS_BOOT_SECTOR*)ntfs_malloc(vol->sector_size);
+ if (bs
+ && (ntfs_pread(vol->dev, 0,
+ vol->sector_size, bs) == vol->sector_size)) {
+ ntfs_log_info("Serial number : %016llx\n",
+ (long long)le64_to_cpu(bs->volume_serial_number));
+ res = 0;
+ free(bs);
+ }
+ if (res)
+ ntfs_log_info("Error getting the serial number\n");
+ return (res);
+}
+
+/**
+ * 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.
+ */
+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) {
+ ntfs_log_error("%s is mounted read-write, results may be "
+ "unreliable.\n", opts.device);
+ result = 1;
+ }
+
+ if (opts.verbose)
+ ntfs_log_info("Volume label : %s\n", vol->vol_name);
+ else
+ ntfs_log_info("%s\n", vol->vol_name);
+ return result;
+}
+
+/**
+ * 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.
+ */
+static int change_label(ntfs_volume *vol, char *label)
+{
+ ntfschar *new_label = NULL;
+ int label_len;
+ int result = 0;
+
+ label_len = ntfs_mbstoucs(label, &new_label);
+ if (label_len == -1) {
+ ntfs_log_perror("Unable to convert label string to Unicode");
+ return 1;
+ }
+ else if (label_len*sizeof(ntfschar) > 0x100) {
+ ntfs_log_warning("New label is too long. Maximum %u characters "
+ "allowed. Truncating %u excess characters.\n",
+ (unsigned)(0x100 / sizeof(ntfschar)),
+ (unsigned)(label_len -
+ (0x100 / sizeof(ntfschar))));
+ label_len = 0x100 / sizeof(ntfschar);
+ label[label_len] = const_cpu_to_le16(0);
+ }
+
+ if(!opts.noaction)
+ result = ntfs_volume_rename(vol, new_label, label_len) ? 1 : 0;
+
+ free(new_label);
+ 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)
+{
+ unsigned long mnt_flags = 0;
+ int result = 0;
+ ntfs_volume *vol;
+
+ ntfs_log_set_handler(ntfs_log_handler_outerr);
+
+ if (!parse_options(argc, argv))
+ return 1;
+
+ utils_set_locale();
+
+ if ((opts.label || opts.new_serial)
+ && !opts.noaction
+ && !opts.force
+ && !ntfs_check_if_mounted(opts.device, &mnt_flags)
+ && (mnt_flags & NTFS_MF_MOUNTED)) {
+ ntfs_log_error("Cannot make changes to a mounted device\n");
+ result = 1;
+ goto abort;
+ }
+
+ if (!opts.label && !opts.new_serial)
+ opts.noaction++;
+
+ vol = utils_mount_volume(opts.device,
+ (opts.noaction ? NTFS_MNT_RDONLY : 0) |
+ (opts.force ? NTFS_MNT_RECOVER : 0));
+ if (!vol)
+ return 1;
+
+ if (opts.new_serial) {
+ result = set_new_serial(vol);
+ if (result)
+ goto unmount;
+ } else {
+ if (opts.verbose)
+ result = print_serial(vol);
+ }
+ if (opts.label)
+ result = change_label(vol, opts.label);
+ else
+ result = print_label(vol, mnt_flags);
+
+unmount :
+ ntfs_umount(vol, FALSE);
+abort :
+ return result;
+}
+
diff --git a/ntfsprogs/ntfsls.8 b/ntfsprogs/ntfsls.8
new file mode 100644
index 0000000..1890231
--- a/dev/null
+++ b/ntfsprogs/ntfsls.8
@@ -0,0 +1,172 @@
+.\" 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 "November 2005" "ntfs-3g 2014.2.15"
+.SH NAME
+ntfsls \- list directory contents on an NTFS filesystem
+.SH SYNOPSIS
+.B ntfsls
+[\fIoptions\fR] \fIdevice\fR
+.sp
+.B ntfsls
+[
+.B \-a
+|
+.B \-\-all
+]
+[
+.B \-F
+|
+.B \-\-classify
+]
+[
+.B \-f
+|
+.B \-\-force
+]
+[
+.B \-h
+|
+.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
+]
+.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 )
+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
+\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
+\fB\-F\fR, \fB\-\-classify\fR
+Append indicator (one of */=@|) to entries.
+.TP
+\fB\-f\fR, \fB\-\-force\fR
+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
+.B ntfsls
+and exit.
+.TP
+\fB\-i\fR, \fB\-\-inode\fR
+Print inode number of each file. This is the MFT reference number in NTFS
+terminology.
+.TP
+\fB\-l\fR, \fB\-\-long\fR
+Use a long listing format.
+.TP
+\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
+\fB\-q\fR, \fB\-\-quiet\fR
+Suppress some debug/warning/error messages.
+.TP
+\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
+\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
+\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
+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
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.SH AUTHORS
+This version of
+.B ntfsls
+was written by Lode Leroy, Anton Altaparmakov, Richard Russon, Carmelo Kintana
+and Giang Nguyen.
+It was ported to ntfs-3g by Erik Larsson.
+.SH AVAILABILITY
+.B ntfsls
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfsls.8.in b/ntfsprogs/ntfsls.8.in
new file mode 100755
index 0000000..f528a3b
--- a/dev/null
+++ b/ntfsprogs/ntfsls.8.in
@@ -0,0 +1,172 @@
+.\" 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 "November 2005" "ntfs-3g @VERSION@"
+.SH NAME
+ntfsls \- list directory contents on an NTFS filesystem
+.SH SYNOPSIS
+.B ntfsls
+[\fIoptions\fR] \fIdevice\fR
+.sp
+.B ntfsls
+[
+.B \-a
+|
+.B \-\-all
+]
+[
+.B \-F
+|
+.B \-\-classify
+]
+[
+.B \-f
+|
+.B \-\-force
+]
+[
+.B \-h
+|
+.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
+]
+.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 )
+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
+\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
+\fB\-F\fR, \fB\-\-classify\fR
+Append indicator (one of */=@|) to entries.
+.TP
+\fB\-f\fR, \fB\-\-force\fR
+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
+.B ntfsls
+and exit.
+.TP
+\fB\-i\fR, \fB\-\-inode\fR
+Print inode number of each file. This is the MFT reference number in NTFS
+terminology.
+.TP
+\fB\-l\fR, \fB\-\-long\fR
+Use a long listing format.
+.TP
+\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
+\fB\-q\fR, \fB\-\-quiet\fR
+Suppress some debug/warning/error messages.
+.TP
+\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
+\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
+\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
+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
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.SH AUTHORS
+This version of
+.B ntfsls
+was written by Lode Leroy, Anton Altaparmakov, Richard Russon, Carmelo Kintana
+and Giang Nguyen.
+It was ported to ntfs-3g by Erik Larsson.
+.SH AVAILABILITY
+.B ntfsls
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfsls.c b/ntfsprogs/ntfsls.c
new file mode 100755
index 0000000..909e7bb
--- a/dev/null
+++ b/ntfsprogs/ntfsls.c
@@ -0,0 +1,717 @@
+/**
+ * ntfsls - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2003 Lode Leroy
+ * Copyright (c) 2003-2005 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.
+ *
+ * This 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"
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "types.h"
+#include "mft.h"
+#include "attrib.h"
+#include "layout.h"
+#include "inode.h"
+#include "utils.h"
+#include "dir.h"
+#include "list.h"
+#include "ntfstime.h"
+/* #include "version.h" */
+#include "logging.h"
+
+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 ntfs_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 ntfs_list_head list;
+ const 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.
+ */
+static struct ntfs_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
+ */
+static int depth = 0;
+
+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 system;
+ int dos;
+ int lng;
+ int inode;
+ int classify;
+ int recursive;
+ const char *path;
+} opts;
+
+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);
+
+/**
+ * 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 (libntfs-3g) - Display information about an NTFS "
+ "Volume.\n\n", EXEC_NAME, VERSION);
+ printf("Copyright (c) 2003 Lode Leroy\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");
+ 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\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 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);
+
+ printf("NOTE: If neither -a nor -s is specified, the program defaults to -a.\n\n");
+
+ 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 = "-aFfh?ilp:qRsVvx";
+ static const struct option lopt[] = {
+ { "all", no_argument, NULL, 'a' },
+ { "classify", no_argument, NULL, 'F' },
+ { "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' },
+ { "recursive", no_argument, NULL, 'R' },
+ { "quiet", no_argument, NULL, 'q' },
+ { "system", no_argument, NULL, 's' },
+ { "version", no_argument, NULL, 'V' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "dos", no_argument, NULL, 'x' },
+ { NULL, 0, NULL, 0 },
+ };
+
+ int c = -1;
+ int err = 0;
+ int ver = 0;
+ int help = 0;
+ int levels = 0;
+
+ opterr = 0; /* We'll handle the errors, thank you. */
+
+ memset(&opts, 0, sizeof(opts));
+ opts.device = NULL;
+ opts.path = "/";
+
+ while ((c = getopt_long(argc, argv, sopt, lopt, NULL)) != -1) {
+ switch (c) {
+ case 1:
+ if (!opts.device)
+ opts.device = optarg;
+ else
+ err++;
+ break;
+ case 'p':
+ opts.path = optarg;
+ break;
+ case 'f':
+ opts.force++;
+ 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++;
+ break;
+ case 'x':
+ opts.dos = 1;
+ break;
+ case 'l':
+ opts.lng++;
+ break;
+ case 'i':
+ opts.inode++;
+ break;
+ case 'F':
+ opts.classify++;
+ break;
+ case 'a':
+ opts.all++;
+ break;
+ case 's':
+ opts.system++;
+ break;
+ case 'R':
+ opts.recursive++;
+ break;
+ default:
+ 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++;
+
+ if (help || ver)
+ opts.quiet = 0;
+ else {
+ if (opts.device == NULL) {
+ if (argc > 1)
+ ntfs_log_error("You must specify exactly one "
+ "device.\n");
+ err++;
+ }
+
+ if (opts.quiet && opts.verbose) {
+ ntfs_log_error("You may not use --quiet and --verbose at the "
+ "same time.\n");
+ err++;
+ }
+ }
+
+ if (ver)
+ version();
+ if (help || err)
+ usage();
+
+ return (!err && !help && !ver);
+}
+
+/**
+ * free_dir - free one dir
+ * @tofree: the dir to free
+ *
+ * Close the inode and then free the dir
+ */
+static 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 ntfs_list_head of any entry in the list
+ *
+ * Iterate over @dir_list, calling free_dir on each entry
+ */
+static void free_dirs(struct ntfs_list_head *dir_list)
+{
+ struct dir *tofree = NULL;
+ struct ntfs_list_head *walker = NULL;
+
+ if (dir_list) {
+ ntfs_list_for_each(walker, dir_list) {
+ free_dir(tofree);
+ tofree = ntfs_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.
+ */
+static int readdir_recursive(ntfs_inode * ni, s64 * pos, ntfsls_dirent * dirent)
+{
+ /* list of dirs to "ls" recursively */
+ static struct dir dirs = {
+ .list = NTFS_LIST_HEAD_INIT(dirs.list),
+ .ni = NULL,
+ .name = {0},
+ .depth = 0
+ };
+
+ static struct path_component paths = {
+ .list = NTFS_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 ntfs_list_head *dir_walker = NULL;
+ struct ntfs_list_head *comp_walker = NULL;
+ s64 pos2 = 0;
+ int ni_depth = depth;
+ int result = 0;
+
+ if (ntfs_list_empty(&dirs.list)) {
+ base_comp.name = opts.path;
+ ntfs_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) {
+ ntfs_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 */
+ ntfs_list_for_each(dir_walker, &dirs.list) {
+ if (tofree) {
+ free_dir(tofree);
+ tofree = NULL;
+ }
+ subdir = ntfs_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 =
+ ntfs_pathname_to_inode(ni->vol, ni,
+ subdir->name);
+
+ if (!subdir->ni) {
+ ntfs_log_error
+ ("ntfsls::readdir_recursive(): cannot get inode from pathname.\n");
+ result = -1;
+ break;
+ }
+ }
+ puts("");
+
+ comp.name = subdir->name;
+
+ /* print relative path header */
+ ntfs_list_for_each(comp_walker, &paths.list) {
+ tempcomp =
+ ntfs_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;
+ ntfs_list_del(dir_walker);
+ }
+
+ ntfs_list_del(&comp.list);
+ }
+
+ if (tofree)
+ free_dir(tofree);
+
+ /* if at the outer-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_dir_entry(ntfsls_dirent * dirent, const ntfschar * name,
+ const int name_len, const int name_type,
+ const s64 pos __attribute__((unused)),
+ 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;
+
+ if (ntfs_ucstombs(name, name_len, &filename, MAX_PATH) < 0) {
+ ntfs_log_error("Cannot represent filename in current locale.\n");
+ goto free;
+ }
+
+ result = 0; // These are successful
+ if ((MREF(mref) < FILE_first_user) && (!opts.system))
+ goto free;
+ if (name_type == FILE_NAME_POSIX && !opts.all)
+ goto free;
+ if (((name_type & FILE_NAME_WIN32_AND_DOS) == FILE_NAME_WIN32) &&
+ opts.dos)
+ goto free;
+ if (((name_type & FILE_NAME_WIN32_AND_DOS) == FILE_NAME_DOS) &&
+ !opts.dos)
+ goto free;
+ if (dt_type == NTFS_DT_DIR && opts.classify)
+ sprintf(filename + strlen(filename), "/");
+
+ 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) {
+ ntfs_log_error("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);
+ else
+ printf("%7llu %s\n", (unsigned long long)MREF(mref),
+ filename);
+ result = 0;
+ } else {
+ s64 filesize = 0;
+ ntfs_inode *ni;
+ ntfs_attr_search_ctx *ctx = NULL;
+ FILE_NAME_ATTR *file_name_attr;
+ ATTR_RECORD *attr;
+ struct timespec change_time;
+ char t_buf[26];
+
+ result = -1; // Everything else is bad
+
+ ni = ntfs_inode_open(dirent->vol, mref);
+ if (!ni)
+ goto release;
+
+ ctx = ntfs_attr_get_search_ctx(ni, NULL);
+ if (!ctx)
+ goto release;
+
+ if (ntfs_attr_lookup(AT_FILE_NAME, AT_UNNAMED, 0, 0, 0, NULL,
+ 0, ctx))
+ goto release;
+ attr = ctx->attr;
+
+ file_name_attr = (FILE_NAME_ATTR *)((char *)attr +
+ le16_to_cpu(attr->value_offset));
+ if (!file_name_attr)
+ goto release;
+
+ change_time = ntfs2timespec(file_name_attr->last_data_change_time);
+ strcpy(t_buf, ctime(&change_time.tv_sec));
+ 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,
+ NULL, 0, ctx))
+ filesize = ntfs_get_attribute_value_length(
+ ctx->attr);
+ }
+
+ if (opts.inode)
+ printf("%7llu %8lld %s %s\n",
+ (unsigned long long)MREF(mref),
+ (long long)filesize, t_buf + 4,
+ filename);
+ else
+ printf("%8lld %s %s\n", (long long)filesize, t_buf + 4,
+ filename);
+
+ if (dir) {
+ dir->ni = ni;
+ ni = NULL; /* so release does not close inode */
+ }
+
+ result = 0;
+release:
+ /* Release attribute search context and close the inode. */
+ if (ctx)
+ ntfs_attr_put_search_ctx(ctx);
+ if (ni)
+ ntfs_inode_close(ni);
+ }
+
+ if (dir) {
+ if (result == 0) {
+ ntfs_list_add(&dir->list, dir_list_insert_pos);
+ dir_list_insert_pos = &dir->list;
+ } else {
+ free(dir);
+ dir = NULL;
+ }
+ }
+
+free:
+ free(filename);
+ return result;
+}
+
+/**
+ * main - Begin here
+ *
+ * Start from here.
+ *
+ * Return: 0 Success, the program worked
+ * 1 Error, parsing mount options failed
+ * 2 Error, mount attempt failed
+ * 3 Error, failed to open root directory
+ * 4 Error, failed to open directory in search path
+ */
+int main(int argc, char **argv)
+{
+ s64 pos;
+ ntfs_volume *vol;
+ 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;
+ }
+
+ utils_set_locale();
+
+ vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY |
+ (opts.force ? NTFS_MNT_RECOVER : 0));
+ if (!vol) {
+ // FIXME: Print error... (AIA)
+ return 2;
+ }
+
+ ni = ntfs_pathname_to_inode(vol, NULL, opts.path);
+ if (!ni) {
+ // FIXME: Print error... (AIA)
+ ntfs_umount(vol, FALSE);
+ return 3;
+ }
+
+ /*
+ * 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;
+ if (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY) {
+ 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;
+ FILE_NAME_ATTR *attr;
+ ntfs_attr_search_ctx *ctx;
+ int space = 4;
+ ntfschar *name = NULL;
+ int name_len = 0;;
+
+ ctx = ntfs_attr_get_search_ctx(ni, NULL);
+ 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_dir_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. */
+ ntfs_inode_close(ni);
+
+ ntfs_umount(vol, FALSE);
+ return 0;
+}
+
diff --git a/ntfsprogs/ntfsmftalloc.c b/ntfsprogs/ntfsmftalloc.c
new file mode 100755
index 0000000..246ab54
--- a/dev/null
+++ b/ntfsprogs/ntfsmftalloc.c
@@ -0,0 +1,368 @@
+/**
+ * ntfsmftalloc - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2002-2005 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 <unistd.h>
+#endif
+#ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#ifdef HAVE_STDIO_H
+# include <stdio.h>
+#endif
+#ifdef HAVE_STDARG_H
+# include <stdarg.h>
+#endif
+#ifdef HAVE_STRING_H
+# include <string.h>
+#endif
+#ifdef HAVE_ERRNO_H
+# include <errno.h>
+#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+#ifdef HAVE_GETOPT_H
+# include <getopt.h>
+#else
+ extern int optind;
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#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"
+/* #include "version.h" */
+#include "logging.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;
+
+/**
+ * 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);
+}
+
+/**
+ * copyright - print copyright statements
+ */
+static void copyright(void)
+{
+ 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. "
+ "Otherwise,\nan extent mft record is allocated and "
+ "initialized to point to the specified\nbase mft "
+ "record.\n");
+}
+
+/**
+ * license - print license statement
+ */
+static void license(void)
+{
+ ntfs_log_info("%s", ntfs_gpl);
+}
+
+/**
+ * usage - print a list of the parameters to the program
+ */
+__attribute__((noreturn))
+static void usage(void)
+{
+ copyright();
+ 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"
+ " -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);
+ ntfs_log_info("%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;
+ ntfs_log_info("%s v%s (libntfs-3g)\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;
+ 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. */
+ exit(0);
+ case 'l':
+ copyright();
+ license();
+ exit(0);
+ case 'h':
+ case '?':
+ 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++];
+ ntfs_log_verbose("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;
+ ntfs_log_verbose("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;
+
+ ntfs_log_info("-- Beginning dump of mft record. --\n");
+ u = le32_to_cpu(m->magic);
+ 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);
+ 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));
+ 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);
+ 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)
+ ntfs_log_info("MFT_RECORD_IN_USE");
+ else
+ ntfs_log_info("MFT_RECORD_NOT_IN_USE");
+ if (m->flags & MFT_RECORD_IS_DIRECTORY)
+ ntfs_log_info(" | MFT_RECORD_IS_DIRECTORY");
+ ntfs_log_info("\n");
+ u = le32_to_cpu(m->bytes_in_use);
+ ntfs_log_info("Bytes in use = %u (0x%x)\n", u, u);
+ u = le32_to_cpu(m->bytes_allocated);
+ ntfs_log_info("Bytes allocated = %u (0x%x)\n", u, u);
+ r = le64_to_cpu(m->base_mft_record);
+ 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));
+ 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));
+ 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));
+ };
+ ntfs_log_info("-- 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)) {
+ ntfs_log_perror("Warning: Failed to close inode 0x%llx",
+ (long long)ni->mft_no);
+ }
+ /* Unmount the volume. */
+ if (ntfs_umount(vol, 0) == -1)
+ ntfs_log_perror("Warning: Could not umount %s", dev_name);
+}
+
+/**
+ * main
+ */
+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. */
+ parse_options(argc, argv);
+ utils_set_locale();
+ /* Make sure the file system is not mounted. */
+ if (ntfs_check_if_mounted(dev_name, &mnt_flags))
+ ntfs_log_error("Failed to determine whether %s is mounted: %s\n",
+ dev_name, strerror(errno));
+ else if (mnt_flags & NTFS_MF_MOUNTED) {
+ ntfs_log_error("%s is mounted.\n", dev_name);
+ if (!opts.force)
+ err_exit("Refusing to run!\n");
+ ntfs_log_error("ntfsmftalloc forced anyway. Hope /etc/mtab "
+ "is incorrect.\n");
+ }
+ /* Mount the device. */
+ if (opts.no_action) {
+ ntfs_log_quiet("Running in READ-ONLY mode!\n");
+ ul = NTFS_MNT_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) {
+ ntfs_log_error("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));
+ ntfs_log_info("Allocated %s mft record 0x%llx", base_ni ? "extent" : "base",
+ (long long)ni->mft_no);
+ if (base_ni)
+ ntfs_log_info(" with base mft record 0x%llx",
+ (long long)base_mft_no);
+ ntfs_log_info(".\n");
+ if (!opts.quiet && opts.verbose > 1) {
+ ntfs_log_verbose("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)
+ ntfs_log_perror("Warning: Failed to umount %s", dev_name);
+ else
+ ntfs_log_quiet("ntfsmftalloc completed successfully.\n");
+ return 0;
+}
diff --git a/ntfsprogs/ntfsmove.c b/ntfsprogs/ntfsmove.c
new file mode 100755
index 0000000..571808f
--- a/dev/null
+++ b/ntfsprogs/ntfsmove.c
@@ -0,0 +1,923 @@
+/**
+ * ntfsmove - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2003 Richard Russon
+ * Copyright (c) 2003-2005 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"
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#include "types.h"
+#include "attrib.h"
+#include "utils.h"
+#include "volume.h"
+#include "debug.h"
+#include "dir.h"
+#include "bitmap.h"
+#include "ntfsmove.h"
+/* #include "version.h" */
+#include "logging.h"
+
+static const char *EXEC_NAME = "ntfsmove";
+static struct options opts;
+
+/**
+ * version - Print version information about the program
+ *
+ * Print a copyright statement and a brief description of the program.
+ *
+ * Return: none
+ */
+static void version(void)
+{
+ ntfs_log_info("\n%s v%s (libntfs-3g) - Move files and directories on an "
+ "NTFS volume.\n\n", EXEC_NAME, VERSION);
+ ntfs_log_info("Copyright (c) 2003 Richard Russon\n");
+ ntfs_log_info("\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)
+{
+ 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"
+ " -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);
+ ntfs_log_info("%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 = "-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 }
+ };
+
+ int c = -1;
+ int err = 0;
+ int ver = 0;
+ int help = 0;
+ int levels = 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 '?':
+ if (strncmp (argv[optind-1], "--log-", 6) == 0) {
+ if (!ntfs_log_parse_option (argv[optind-1]))
+ err++;
+ break;
+ }
+ help++;
+ break;
+ case 'n':
+ opts.noaction++;
+ break;
+ case 'q':
+ opts.quiet++;
+ ntfs_log_clear_levels(NTFS_LOG_LEVEL_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++;
+ ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE);
+ break;
+ default:
+ 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)
+ ntfs_log_error("You must specify one device and one file.\n");
+ err++;
+ }
+
+ if (opts.quiet && opts.verbose) {
+ ntfs_log_error("You may not use --quiet and --verbose at the "
+ "same time.\n");
+ err++;
+ }
+
+ if (opts.location == -1) {
+ ntfs_log_error("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);
+}
+
+#if 0
+
+/**
+ * ntfs_debug_runlist_dump2 - Dump a runlist.
+ */
+static 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) {
+ ntfs_log_info(" Run list not present.\n");
+ return 0;
+ }
+
+ if (!prefix)
+ prefix = "";
+
+ if (abbr)
+ for (len = 0; rl[len].length; len++) ;
+
+ ntfs_log_info("%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)))
+ ntfs_log_info("%s ... ... ...\n", prefix);
+ if ((i > (abbr-1)) && (i < (len - (abbr-1))))
+ continue;
+ }
+
+ if (rl->vcn < -1)
+ res = -1;
+
+ if (lcn < (LCN)0) {
+ int j = -lcn - 1;
+
+ if ((j < 0) || (j > 4)) {
+ j = 4;
+ res = -1;
+ }
+ ntfs_log_info("%s%8lld %8s %8lld\n", prefix,
+ rl->vcn, lcn_str[j], rl->length);
+ } else
+ ntfs_log_info("%s%8lld %8lld %8lld\n", prefix,
+ rl->vcn, rl->lcn, rl->length);
+ }
+ ntfs_log_info("%s --------\n", prefix);
+ ntfs_log_info("%s %8lld\n", prefix, total);
+ ntfs_log_info("\n");
+ return res;
+}
+
+#endif /* if 0 */
+
+/**
+ * resize_nonres_attr
+ */
+static 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;
+
+ /*
+ 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);
+
+ a->length = new_size;
+ m->bytes_in_use += new_size - old_size;
+
+ return 0;
+}
+
+/**
+ * calc_attr_length
+ */
+static 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;
+}
+
+#if 0
+
+/**
+ * dump_runs
+ */
+static void dump_runs(u8 *buffer, int len)
+{
+ int i;
+ ntfs_log_info("RUN: \e[01;31m");
+
+ for (i = 0; i < len; i++) {
+ ntfs_log_info(" %02x", buffer[i]);
+ }
+ ntfs_log_info("\e[0m\n");
+}
+
+#endif /* if 0 */
+
+/**
+ * find_unused
+ */
+static runlist * find_unused(ntfs_volume *vol, s64 size, u64 loc
+ __attribute__((unused)), int flags __attribute__((unused)))
+{
+ const int bufsize = 8192;
+ u8 *buffer;
+ int clus;
+ int i;
+ int curr = 0;
+ int count = 0;
+ s64 start = 0;
+ int bit = 0;
+ runlist *res = NULL;
+
+ //ntfs_log_info("find_unused\n");
+ buffer = malloc(bufsize);
+ if (!buffer) {
+ ntfs_log_info("!buffer\n");
+ return NULL;
+ }
+
+ //ntfs_log_info("looking for space for %lld clusters\n", size);
+
+ clus = vol->lcnbmp_na->allocated_size / bufsize;
+ //ntfs_log_info("clus = %d\n", clus);
+
+ for (i = 0; i < clus; i++) {
+ int bytes_read, j;
+
+ bytes_read = ntfs_attr_pread(vol->lcnbmp_na, i*bufsize,
+ bufsize, buffer);
+ if (bytes_read != bufsize) {
+ ntfs_log_info("!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 {
+ //ntfs_log_info("%d * %d\n", curr, count);
+ curr = bit;
+ count = 1;
+ start = i*bufsize*8 + j;
+ }
+ }
+ }
+done:
+ //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)) {
+ ntfs_log_info("ERROR cluster %lld in use\n",
+ (long long)res->lcn + i);
+ }
+ }
+ } else {
+ ntfs_log_info("failed\n");
+ }
+
+ return res;
+}
+
+/**
+ * dont_move
+ *
+ * Don't let the user move:
+ * ANY metadata
+ * Any fragmented MFT records
+ * The boot file 'ntldr'
+ */
+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'),
+ 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)) {
+ ntfs_log_error("metadata\n");
+ return 1;
+ }
+
+ rec = find_first_attribute(AT_ATTRIBUTE_LIST, ino->mrec);
+ if (rec) {
+ ntfs_log_error("attribute list\n");
+ return 1;
+ }
+
+ rec = find_first_attribute(AT_FILE_NAME, ino->mrec);
+ if (!rec) {
+ 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)) {
+ ntfs_log_error("ntldr\n");
+ return 1;
+ }
+
+ return 0;
+}
+
+
+/**
+ * bitmap_alloc
+ */
+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);
+ if (res < 0) {
+ ntfs_log_error("bitmap alloc returns %d\n", res);
+ }
+
+ return res;
+}
+
+/**
+ * bitmap_free
+ */
+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);
+ if (res < 0) {
+ ntfs_log_error("bitmap free returns %d\n", res);
+ }
+
+ return res;
+}
+
+/**
+ * data_copy
+ */
+static 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;
+
+ //ntfs_log_info("data_copy: from 0x%llx to 0x%llx\n", from->lcn, to->lcn);
+ buffer = malloc(vol->cluster_size);
+ if (!buffer) {
+ ntfs_log_info("!buffer\n");
+ return -1;
+ }
+
+ for (i = 0; i < from->length; i++) {
+ //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) {
+ ntfs_log_error("!read\n");
+ res = -1;
+ break;
+ }
+
+ //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) {
+ ntfs_log_error("!write %lld\n", (long long)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
+ */
+static 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) {
+ ntfs_log_error("diffsizes\n");
+ return -1;
+ }
+
+ if ((from->lcn < 0) || (to->lcn < 0)) {
+ ntfs_log_error("invalid runs\n");
+ return -1;
+ }
+
+ for (i = 0; i < from->length; i++) {
+ if (!utils_cluster_in_use(vol, from->lcn+i)) {
+ 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)) {
+ ntfs_log_error("to is in use\n");
+ return -1;
+ }
+ }
+
+ if (bitmap_alloc(vol, to) < 0) {
+ ntfs_log_error("cannot bitmap_alloc\n");
+ return -1;
+ }
+
+ if (data_copy(vol, from, to) < 0) {
+ ntfs_log_error("cannot data_copy\n");
+ return -1;
+ }
+
+ if (bitmap_free(vol, from) < 0) {
+ ntfs_log_error("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 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)
+{
+ 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) {
+ ntfs_log_error("!to\n");
+ return -1;
+ }
+
+ to->vcn = run->vcn;
+
+ // copy original runlist
+ from = ntfs_mapping_pairs_decompress(vol, rec, NULL);
+ if (!from) {
+ ntfs_log_info("!from\n");
+ return -1;
+ }
+
+ ntfs_log_info("move %lld,%lld,%lld to %lld,%lld,%lld\n",
+ (long long)run->vcn, (long long)run->lcn, (long long)run->length,
+ (long long)to->vcn, (long long)to->lcn, (long long)to->length);
+
+ need_from = ntfs_get_size_for_mapping_pairs(vol, from, 0, INT_MAX);
+ ntfs_log_info("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, 0, INT_MAX);
+ 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);
+
+ 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) {
+ ntfs_log_info("!resize\n");
+ return -1;
+ }
+ }
+
+ res = move_runlist(vol, run, to);
+ if (res < 0) {
+ ntfs_log_error("!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, 0, NULL);
+
+ // commit
+ ntfs_inode_mark_dirty(ino);
+
+ if (ntfs_inode_sync(ino) < 0) {
+ ntfs_log_info("!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
+ */
+static 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) {
+ ntfs_log_error("!runs\n");
+ return -1;
+ }
+
+ //ntfs_debug_runlist_dump2(runs, 5, "\t");
+
+ //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);
+ //ntfs_log_info(" %8lld %8lld %8lld\n", runs[i].vcn, runs[i].lcn, runs[i].length);
+ if (res < 0) {
+ ntfs_log_error("!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
+ */
+static 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) {
+ ntfs_log_error("Out of memory\n");
+ return -1;
+ }
+
+ utils_inode_get_name(ino, buffer, MAX_PATH);
+
+ if (dont_move(ino)) {
+ ntfs_log_error("can't move\n");
+ return -1;
+ }
+
+ 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.
+ // 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);
+ ntfs_log_info("\tAttribute 0x%02x %s is ", rec->type, buffer);
+
+ if (rec->non_resident) {
+ ntfs_log_info("non-resident. Moving it.\n");
+
+ res = move_attribute(vol, ino, rec, loc, flags);
+ if (res < 0) {
+ count = res;
+ break;
+ }
+ count += res;
+ } else {
+ ntfs_log_info("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;
+
+ ntfs_log_set_handler(ntfs_log_handler_outerr);
+
+ if (!parse_options(argc, argv))
+ return 1;
+
+ utils_set_locale();
+
+ if (opts.noaction)
+ flags |= NTFS_MNT_RDONLY;
+ if (opts.force)
+ flags |= NTFS_MNT_RECOVER;
+
+ vol = utils_mount_volume(opts.device, flags);
+ if (!vol) {
+ ntfs_log_info("!vol\n");
+ return 1;
+ }
+
+ inode = ntfs_pathname_to_inode(vol, NULL, opts.file);
+ if (!inode) {
+ ntfs_log_info("!inode\n");
+ return 1;
+ }
+
+ count = move_file(vol, inode, opts.location, 0);
+ if ((count > 0) && (!opts.nodirty)) {
+
+ /* Porting note: libntfs-3g does not automatically set or clear
+ * dirty flags on mount/unmount. It always preserves them until
+ * they are explicitly changed with ntfs_volume_write_flags.
+ * This means that the dirty flag is possibly not set, but
+ * should be set. So we explicitly set it with a call to
+ * ntfs_volume_write_flags. */
+ if(!(vol->flags & VOLUME_IS_DIRTY) && ntfs_volume_write_flags(
+ vol, vol->flags | VOLUME_IS_DIRTY)) {
+ ntfs_log_error("Error: Failed to set volume dirty "
+ "flag (%d (%s))!\n", errno, strerror(errno));
+ }
+
+ ntfs_log_info("Relocated %lld bytes\n", (long long)count);
+ }
+ if (count >= 0)
+ result = 0;
+
+ if (result)
+ ntfs_log_info("failed\n");
+ else
+ ntfs_log_info("success\n");
+
+ ntfs_inode_close(inode);
+ ntfs_umount(vol, FALSE);
+ return result;
+}
diff --git a/ntfsprogs/ntfsmove.h b/ntfsprogs/ntfsmove.h
new file mode 100755
index 0000000..ffc1519
--- a/dev/null
+++ 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 */
+ 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 */
+};
+
+#endif /* _NTFSMOVE_H_ */
+
+
diff --git a/ntfsprogs/ntfsprogs.8 b/ntfsprogs/ntfsprogs.8
new file mode 100644
index 0000000..c23f48d
--- a/dev/null
+++ b/ntfsprogs/ntfsprogs.8
@@ -0,0 +1,69 @@
+.\" Copyright (c) 2002\-2005 Richard Russon.
+.\" Copyright (c) 2002\-2003 Anton Altaparmakov.
+.\" Copyright (c) 2005\-2006 Szabolcs Szakacsits.
+.\" Copyright (c) 2005\-2007 Yura Pakhuchiy.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH NTFSPROGS 8 "September 2007" "ntfs-3g 2014.2.15"
+.SH NAME
+ntfsprogs \- tools for doing neat things with NTFS
+.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
+.PP
+.BR mkntfs (8)
+\- Create an NTFS filesystem.
+.PP
+.BR ntfscat (8)
+\- Dump a file's content to the standard output.
+.PP
+.BR ntfsclone (8)
+\- Efficiently clone, backup, restore or rescue NTFS.
+.PP
+.BR ntfscluster (8)
+\- Locate the files which use the given sectors or clusters.
+.PP
+.BR ntfscmp (8)
+\- Compare two NTFS filesystems and tell the differences.
+.PP
+.BR ntfscp (8)
+\- Copy a file to an NTFS volume.
+.PP
+.BR ntfsfix (8)
+\- Check and fix some common errors, clear the LogFile and make Windows
+perform a thorough check next time it boots.
+.PP
+.BR ntfsinfo (8)
+\- Show information about NTFS or one of the files or directories within it.
+.PP
+.BR ntfslabel (8)
+\- Show, or set, an NTFS filesystem's volume label.
+.PP
+.BR ntfsls (8)
+\- List information about files in a directory residing on an NTFS.
+.PP
+.BR ntfsresize (8)
+\- Resize NTFS without losing data.
+.PP
+.BR ntfsundelete (8)
+\- Recover deleted files from NTFS.
+.SH AUTHORS
+.PP
+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
+are part of the
+.B ntfs-3g
+package which can be downloaded from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR ntfs\-3g (8)
+
diff --git a/ntfsprogs/ntfsprogs.8.in b/ntfsprogs/ntfsprogs.8.in
new file mode 100755
index 0000000..7210a36
--- a/dev/null
+++ b/ntfsprogs/ntfsprogs.8.in
@@ -0,0 +1,69 @@
+.\" Copyright (c) 2002\-2005 Richard Russon.
+.\" Copyright (c) 2002\-2003 Anton Altaparmakov.
+.\" Copyright (c) 2005\-2006 Szabolcs Szakacsits.
+.\" Copyright (c) 2005\-2007 Yura Pakhuchiy.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH NTFSPROGS 8 "September 2007" "ntfs-3g @VERSION@"
+.SH NAME
+ntfsprogs \- tools for doing neat things with NTFS
+.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
+.PP
+.BR mkntfs (8)
+\- Create an NTFS filesystem.
+.PP
+.BR ntfscat (8)
+\- Dump a file's content to the standard output.
+.PP
+.BR ntfsclone (8)
+\- Efficiently clone, backup, restore or rescue NTFS.
+.PP
+.BR ntfscluster (8)
+\- Locate the files which use the given sectors or clusters.
+.PP
+.BR ntfscmp (8)
+\- Compare two NTFS filesystems and tell the differences.
+.PP
+.BR ntfscp (8)
+\- Copy a file to an NTFS volume.
+.PP
+.BR ntfsfix (8)
+\- Check and fix some common errors, clear the LogFile and make Windows
+perform a thorough check next time it boots.
+.PP
+.BR ntfsinfo (8)
+\- Show information about NTFS or one of the files or directories within it.
+.PP
+.BR ntfslabel (8)
+\- Show, or set, an NTFS filesystem's volume label.
+.PP
+.BR ntfsls (8)
+\- List information about files in a directory residing on an NTFS.
+.PP
+.BR ntfsresize (8)
+\- Resize NTFS without losing data.
+.PP
+.BR ntfsundelete (8)
+\- Recover deleted files from NTFS.
+.SH AUTHORS
+.PP
+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
+are part of the
+.B ntfs-3g
+package which can be downloaded from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR ntfs\-3g (8)
+
diff --git a/ntfsprogs/ntfsresize.8 b/ntfsprogs/ntfsresize.8
new file mode 100644
index 0000000..e3f9ce1
--- a/dev/null
+++ b/ntfsprogs/ntfsresize.8
@@ -0,0 +1,326 @@
+.\" 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 "February 2006" "ntfs-3g 2014.2.15"
+.SH NAME
+ntfsresize \- resize an NTFS filesystem without data loss
+.SH SYNOPSIS
+.B ntfsresize
+[\fIOPTIONS\fR]
+.B \-\-info(\-mb\-only)
+.I DEVICE
+.br
+.B ntfsresize
+[\fIOPTIONS\fR]
+[\fB\-\-size \fISIZE\fR[\fBk\fR|\fBM\fR|\fBG\fR]]
+.I DEVICE
+.SH DESCRIPTION
+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.
+.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
+on an unmounted
+.I DEVICE
+(usually a disk partition). The new filesystem will fit in a DEVICE
+whose desired size is
+.I SIZE
+bytes.
+The
+.I SIZE
+parameter may have one of the optional modifiers
+.BR k ,
+.BR M ,
+.BR G ,
+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.
+
+If both
+.B \-\-info(\-mb\-only)
+and
+.B \-\-size
+are omitted then the
+NTFS filesystem will be enlarged to match the underlying
+.I DEVICE
+size.
+.PP
+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
+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!
+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!
+.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
+.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
+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
+.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.
+You may enlarge upwards (first sector unchanged) or downwards (last
+sector unchanged), but you may not enlarge at both ends in a single step.
+If you merge two NTFS partitions, only one of them can be expanded to the
+merged partition.
+After you have enlarged the partition, you may use
+.B ntfsresize
+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
+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. 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\-c\fR, \fB\-\-check\fR
+By using this option ntfsresize will only check the device to ensure that it
+is ready to be resized. If not, it will print any errors detected.
+If the device is fine, nothing will be printed.
+.TP
+\fB\-i\fR, \fB\-\-info\fR
+By using this option without \fB\-\-expand\fP, 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
+\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.
+
+If used in association with option \fB\-\-expand\fP, ntfsresize will determine
+the smallest downwards expansion size and the possible increments to the
+size. These are exact byte counts which must not be rounded.
+This option may be used after the partition has been expanded
+provided the upper bound has not been changed.
+
+This option never causes any changes to the filesystem, the partition is
+opened read\-only.
+.TP
+\fB\-m\fR, \fB\-\-info\-mb\-only\fR
+Like the info option, only print out the shrinkable size in MB. Print nothing
+if the shrink size is the same as the original size (in MB).
+This option cannot be used in association with option \fB\-\-expand\fP.
+.TP
+\fB\-s\fR, \fB\-\-size\fR SIZE\fR[\fBk\fR|\fBM\fR|\fBG\fR]
+Resize filesystem to fit in a partition whose size is
+\fISIZE\fR[\fBk\fR|\fBM\fR|\fBG\fR] bytes by shifting its end and keeping
+its beginning unchanged. The filesystem size is set to be at least one
+sector smaller than the partition.
+The optional modifiers
+.BR k ,
+.BR M ,
+.B G
+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. ki=2^10, Mi=2^20
+and Gi=2^30 are also allowed. Use this option
+with
+.B \-\-no\-action
+first.
+.TP
+\fB\-x\fR, \fB\-\-expand\fR
+Expand the filesystem to the current partition size, shifting down its
+beginning and keeping its end unchanged. The metadata is recreated in the
+expanded space and no user data is relocated. This is incompatible with
+option \-s (or \-\-size) and can only be made if the expanded space is an
+exact multiple of the cluster size. It must also be large enough to hold the
+new metadata.
+
+If the expansion is interrupted for some reason (power outage, etc), you may
+restart the resizing, as the original data and metadata have been kept
+unchanged.
+
+Note : expanding a Windows system partition and filesystem downwards may lead
+to the registry or some files not matching the new system layout, or to
+some important files being located too far from the beginning of the
+partition, thus making Windows not bootable.
+.TP
+\fB\-f\fR, \fB\-\-force\fR
+Forces ntfsresize to proceed with the resize operation either without
+prompting for an explicit acceptance, or if the filesystem is marked for
+consistency check. Double the option (-ff, --force --force) to avoid
+prompting even if the file system is marked for 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
+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
+\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
+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
+Don't show progress bars.
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+More output.
+.TP
+\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
+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
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.PP
+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
+size is displayed.
+.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 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
+.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 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
+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. You can find more information about this issue
+in the Troubleshooting section of the below referred Ntfsresize FAQ.
+.SH AUTHORS
+.B ntfsresize
+was written by Szabolcs Szakacsits, with contributions from Anton Altaparmakov
+and Richard Russon.
+It was ported to ntfs-3g by Erik Larsson and Jean-Pierre Andre.
+.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 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, Scott Hansen, Alan Evans 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
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.sp
+.B Ntfsresize
+related news, example of usage, troubleshooting, statically linked binary and
+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),
+.BR sfdisk (8),
+.BR parted (8),
+.BR evms (8),
+.BR ntfsclone (8),
+.BR mkntfs (8),
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfsresize.8.in b/ntfsprogs/ntfsresize.8.in
new file mode 100755
index 0000000..6927cc4
--- a/dev/null
+++ b/ntfsprogs/ntfsresize.8.in
@@ -0,0 +1,326 @@
+.\" 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 "February 2006" "ntfs-3g @VERSION@"
+.SH NAME
+ntfsresize \- resize an NTFS filesystem without data loss
+.SH SYNOPSIS
+.B ntfsresize
+[\fIOPTIONS\fR]
+.B \-\-info(\-mb\-only)
+.I DEVICE
+.br
+.B ntfsresize
+[\fIOPTIONS\fR]
+[\fB\-\-size \fISIZE\fR[\fBk\fR|\fBM\fR|\fBG\fR]]
+.I DEVICE
+.SH DESCRIPTION
+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.
+.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
+on an unmounted
+.I DEVICE
+(usually a disk partition). The new filesystem will fit in a DEVICE
+whose desired size is
+.I SIZE
+bytes.
+The
+.I SIZE
+parameter may have one of the optional modifiers
+.BR k ,
+.BR M ,
+.BR G ,
+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.
+
+If both
+.B \-\-info(\-mb\-only)
+and
+.B \-\-size
+are omitted then the
+NTFS filesystem will be enlarged to match the underlying
+.I DEVICE
+size.
+.PP
+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
+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!
+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!
+.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
+.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
+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
+.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.
+You may enlarge upwards (first sector unchanged) or downwards (last
+sector unchanged), but you may not enlarge at both ends in a single step.
+If you merge two NTFS partitions, only one of them can be expanded to the
+merged partition.
+After you have enlarged the partition, you may use
+.B ntfsresize
+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
+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. 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\-c\fR, \fB\-\-check\fR
+By using this option ntfsresize will only check the device to ensure that it
+is ready to be resized. If not, it will print any errors detected.
+If the device is fine, nothing will be printed.
+.TP
+\fB\-i\fR, \fB\-\-info\fR
+By using this option without \fB\-\-expand\fP, 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
+\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.
+
+If used in association with option \fB\-\-expand\fP, ntfsresize will determine
+the smallest downwards expansion size and the possible increments to the
+size. These are exact byte counts which must not be rounded.
+This option may be used after the partition has been expanded
+provided the upper bound has not been changed.
+
+This option never causes any changes to the filesystem, the partition is
+opened read\-only.
+.TP
+\fB\-m\fR, \fB\-\-info\-mb\-only\fR
+Like the info option, only print out the shrinkable size in MB. Print nothing
+if the shrink size is the same as the original size (in MB).
+This option cannot be used in association with option \fB\-\-expand\fP.
+.TP
+\fB\-s\fR, \fB\-\-size\fR SIZE\fR[\fBk\fR|\fBM\fR|\fBG\fR]
+Resize filesystem to fit in a partition whose size is
+\fISIZE\fR[\fBk\fR|\fBM\fR|\fBG\fR] bytes by shifting its end and keeping
+its beginning unchanged. The filesystem size is set to be at least one
+sector smaller than the partition.
+The optional modifiers
+.BR k ,
+.BR M ,
+.B G
+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. ki=2^10, Mi=2^20
+and Gi=2^30 are also allowed. Use this option
+with
+.B \-\-no\-action
+first.
+.TP
+\fB\-x\fR, \fB\-\-expand\fR
+Expand the filesystem to the current partition size, shifting down its
+beginning and keeping its end unchanged. The metadata is recreated in the
+expanded space and no user data is relocated. This is incompatible with
+option \-s (or \-\-size) and can only be made if the expanded space is an
+exact multiple of the cluster size. It must also be large enough to hold the
+new metadata.
+
+If the expansion is interrupted for some reason (power outage, etc), you may
+restart the resizing, as the original data and metadata have been kept
+unchanged.
+
+Note : expanding a Windows system partition and filesystem downwards may lead
+to the registry or some files not matching the new system layout, or to
+some important files being located too far from the beginning of the
+partition, thus making Windows not bootable.
+.TP
+\fB\-f\fR, \fB\-\-force\fR
+Forces ntfsresize to proceed with the resize operation either without
+prompting for an explicit acceptance, or if the filesystem is marked for
+consistency check. Double the option (-ff, --force --force) to avoid
+prompting even if the file system is marked for 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
+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
+\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
+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
+Don't show progress bars.
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+More output.
+.TP
+\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
+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
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.PP
+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
+size is displayed.
+.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 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
+.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 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
+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. You can find more information about this issue
+in the Troubleshooting section of the below referred Ntfsresize FAQ.
+.SH AUTHORS
+.B ntfsresize
+was written by Szabolcs Szakacsits, with contributions from Anton Altaparmakov
+and Richard Russon.
+It was ported to ntfs-3g by Erik Larsson and Jean-Pierre Andre.
+.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 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, Scott Hansen, Alan Evans 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
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.sp
+.B Ntfsresize
+related news, example of usage, troubleshooting, statically linked binary and
+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),
+.BR sfdisk (8),
+.BR parted (8),
+.BR evms (8),
+.BR ntfsclone (8),
+.BR mkntfs (8),
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfsresize.c b/ntfsprogs/ntfsresize.c
new file mode 100755
index 0000000..6f54181
--- a/dev/null
+++ b/ntfsprogs/ntfsresize.c
@@ -0,0 +1,4497 @@
+/**
+ * ntfsresize - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2002-2006 Szabolcs Szakacsits
+ * Copyright (c) 2002-2005 Anton Altaparmakov
+ * Copyright (c) 2002-2003 Richard Russon
+ * Copyright (c) 2007 Yura Pakhuchiy
+ * Copyright (c) 2011-2013 Jean-Pierre Andre
+ *
+ * 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
+ * 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"
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+
+#include "debug.h"
+#include "types.h"
+#include "support.h"
+#include "endians.h"
+#include "bootsect.h"
+#include "device.h"
+#include "attrib.h"
+#include "volume.h"
+#include "mft.h"
+#include "bitmap.h"
+#include "inode.h"
+#include "runlist.h"
+#include "utils.h"
+/* #include "version.h" */
+#include "misc.h"
+
+#define BAN_NEW_TEXT 1 /* Respect the ban on new messages */
+#define CLEAN_EXIT 0 /* traditionnally volume is not closed, there must be a reason */
+
+static const char *EXEC_NAME = "ntfsresize";
+
+static const char *resize_warning_msg =
+"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 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 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 =
+"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 =
+"NTFS is inconsistent. Run chkdsk /f on Windows then reboot it TWICE!\n"
+"The usage of the /f parameter is very IMPORTANT! No modification was\n"
+"and will be made to NTFS by this software until it gets repaired.\n";
+
+static const char *hibernated_volume_msg =
+"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"
+"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_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";
+
+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' on Windows and rebooot it TWICE! Then you can resize *\n"
+"* NTFS safely by additionally using the --bad-sectors option of ntfsresize.*\n"
+"****************************************************************************\n";
+
+static const char *many_bad_sectors_msg =
+"***************************************************************************\n"
+"* WARNING: The disk has many bad sectors. This means physical damage *\n"
+"* on the disk surface caused by deterioration, manufacturing faults or *\n"
+"* other reason. We suggest to get a replacement disk as soon as possible. *\n"
+"***************************************************************************\n";
+
+static struct {
+ int verbose;
+ int debug;
+ int ro_flag;
+ int force;
+ int info;
+ int infombonly;
+ int expand;
+ int reliable_size;
+ int show_progress;
+ int badsectors;
+ int check;
+ s64 bytes;
+ char *volume;
+} opt;
+
+struct bitmap {
+ s64 size;
+ u8 *bm;
+};
+
+#define NTFS_PROGBAR 0x0001
+#define NTFS_PROGBAR_SUPPRESS 0x0002
+
+struct progress_bar {
+ u64 start;
+ u64 stop;
+ int resolution;
+ int flags;
+ float unit;
+};
+
+struct llcn_t {
+ s64 lcn; /* last used LCN for a "special" file/attr type */
+ s64 inode; /* inode using it */
+};
+
+#define NTFSCK_PROGBAR 0x0001
+
+ /* runlists which have to be processed later */
+struct DELAYED {
+ struct DELAYED *next;
+ ATTR_TYPES type;
+ MFT_REF mref;
+ VCN lowest_vcn;
+ int name_len;
+ ntfschar *attr_name;
+ runlist_element *rl;
+ runlist *head_rl;
+} ;
+
+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 outsider; /* num of clusters outside the volume */
+ int show_outsider; /* controls showing the above information */
+ int flags;
+ struct bitmap lcn_bitmap;
+} ntfsck_t;
+
+typedef struct {
+ ntfs_volume *vol;
+ 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 */
+ 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 */
+ int shrink; /* shrink = 1, enlarge = 0 */
+ s64 badclusters; /* num of physically dead clusters */
+ VCN mft_highest_vcn; /* used for relocating the $MFT */
+ runlist_element *new_mft_start; /* new first run for $MFT:$DATA */
+ struct DELAYED *delayed_runlists; /* runlists to process later */
+ 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;
+ struct llcn_t last_multi_mft;
+ struct llcn_t last_sparse;
+ struct llcn_t last_compressed;
+ struct llcn_t last_lcn;
+ s64 last_unsupp; /* last unsupported cluster */
+} ntfs_resize_t;
+
+/* FIXME: This, lcn_bitmap and pos from find_free_cluster() will make a cluster
+ allocation related structure, attached to ntfs_resize_t */
+static 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 ": "
+
+#define DIRTY_NONE (0)
+#define DIRTY_INODE (1)
+#define DIRTY_ATTRIB (2)
+
+#define NTFS_MAX_CLUSTER_SIZE (65536)
+
+static s64 rounded_up_division(s64 numer, s64 denom)
+{
+ return (numer + (denom - 1)) / denom;
+}
+
+/**
+ * perr_printf
+ *
+ * Print an error message.
+ */
+__attribute__((format(printf, 1, 2)))
+static 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);
+ fprintf(stdout, ": %s\n", strerror(eo));
+ fflush(stdout);
+ fflush(stderr);
+}
+
+__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.
+ */
+__attribute__((noreturn))
+__attribute__((format(printf, 1, 2)))
+static void 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
+ */
+__attribute__((noreturn))
+__attribute__((format(printf, 1, 2)))
+static void 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
+ */
+__attribute__((noreturn))
+static void usage(void)
+{
+
+ printf("\nUsage: %s [OPTIONS] DEVICE\n"
+ " Resize an NTFS volume non-destructively, safely move any data if needed.\n"
+ "\n"
+ " -c, --check Check to ensure that the device is ready for resize\n"
+ " -i, --info Estimate the smallest shrunken size or the smallest\n"
+ " expansion size\n"
+ " -m, --info-mb-only Estimate the smallest shrunken size possible,\n"
+ " output size in MB only\n"
+ " -s, --size SIZE Resize volume to SIZE[k|M|G] bytes\n"
+ " -x, --expand Expand to full partition\n"
+ "\n"
+ " -n, --no-action Do not write to disk\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"
+ " -h, --help Display this help\n"
+#ifdef DEBUG
+ " -d, --debug Show debug information\n"
+#endif
+ "\n"
+ " The options -i and -x are exclusive of option -s, and -m is exclusive\n"
+ " of option -x. If options -i, -m, -s and -x are are all omitted\n"
+ " 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");
+ exit(1);
+}
+
+/**
+ * proceed_question
+ *
+ * Force the user to confirm an action before performing it.
+ * Copy-paste from e2fsprogs
+ */
+static 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;
+ if (fgets(buf, sizeof(buf), stdin)
+ && !strchr(short_yes, buf[0])) {
+ 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
+ */
+static void version(void)
+{
+ printf("\nResize an NTFS Volume, without data loss.\n\n");
+ printf("Copyright (c) 2002-2006 Szabolcs Szakacsits\n");
+ printf("Copyright (c) 2002-2005 Anton Altaparmakov\n");
+ printf("Copyright (c) 2002-2003 Richard Russon\n");
+ printf("Copyright (c) 2007 Yura Pakhuchiy\n");
+ printf("Copyright (c) 2011-2012 Jean-Pierre Andre\n");
+ printf("\n%s\n%s%s", ntfs_gpl, ntfs_bugs, ntfs_home);
+}
+
+/**
+ * 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.
+ */
+static 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)
+ err_exit("Illegal new volume size\n");
+
+ if (!*suffix) {
+ opt.reliable_size = 1;
+ return size;
+ }
+
+ if (strlen(suffix) == 2 && suffix[1] == 'i')
+ prefix_kind = 1024;
+ else 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
+ 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)
+ fdisk (DOS) 2^10 2^20
+ */
+ /* FIXME: check for overflow */
+ switch (*suffix) {
+ case 'G':
+ size *= prefix_kind;
+ case 'M':
+ size *= prefix_kind;
+ case 'k':
+ size *= prefix_kind;
+ break;
+ default:
+ usage();
+ }
+
+ return size;
+}
+
+/**
+ * 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 = "-bcdfhimnPs:vVx";
+ static const struct option lopt[] = {
+ { "bad-sectors",no_argument, NULL, 'b' },
+ { "check", no_argument, NULL, 'c' },
+#ifdef DEBUG
+ { "debug", no_argument, NULL, 'd' },
+#endif
+ { "force", no_argument, NULL, 'f' },
+ { "help", no_argument, NULL, 'h' },
+ { "info", no_argument, NULL, 'i' },
+ { "info-mb-only", no_argument, NULL, 'm' },
+ { "no-action", no_argument, NULL, 'n' },
+ { "no-progress-bar", no_argument, NULL, 'P' },
+ { "size", required_argument, NULL, 's' },
+ { "expand", no_argument, NULL, 'x' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, 'V' },
+ { NULL, 0, NULL, 0 }
+ };
+
+ int c;
+ int err = 0;
+ int ver = 0;
+ int help = 0;
+
+ memset(&opt, 0, sizeof(opt));
+ opt.show_progress = 1;
+
+ 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 'b':
+ opt.badsectors++;
+ break;
+ case 'c':
+ opt.check++;
+ break;
+ case 'd':
+ opt.debug++;
+ break;
+ case 'f':
+ opt.force++;
+ break;
+ case 'h':
+ case '?':
+ help++;
+ break;
+ case 'i':
+ opt.info++;
+ break;
+ case 'm':
+ opt.infombonly++;
+ break;
+ case 'n':
+ opt.ro_flag = NTFS_MNT_RDONLY;
+ break;
+ case 'P':
+ opt.show_progress = 0;
+ break;
+ case 's':
+ if (!err && (opt.bytes == 0))
+ opt.bytes = get_new_volume_size(optarg);
+ else
+ err++;
+ break;
+ case 'v':
+ opt.verbose++;
+ ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE);
+ break;
+ case 'V':
+ ver++;
+ break;
+ case 'x':
+ opt.expand++;
+ break;
+ default:
+ if (optopt == 's') {
+ printf("Option '%s' requires an argument.\n", argv[optind-1]);
+ } else {
+ printf("Unknown option '%s'.\n", argv[optind-1]);
+ }
+ err++;
+ break;
+ }
+ }
+
+ if (!help && !ver) {
+ if (opt.volume == NULL) {
+ if (argc > 1)
+ printf("You must specify exactly one device.\n");
+ err++;
+ }
+ if (opt.info || opt.infombonly) {
+ opt.ro_flag = NTFS_MNT_RDONLY;
+ }
+ if (opt.bytes
+ && (opt.expand || opt.info || opt.infombonly)) {
+ printf(NERR_PREFIX "Options --info(-mb-only) and --expand "
+ "cannot be used with --size.\n");
+ usage();
+ }
+ if (opt.expand && opt.infombonly) {
+ printf(NERR_PREFIX "Options --info-mb-only "
+ "cannot be used with --expand.\n");
+ usage();
+ }
+ }
+
+ /* Redirect stderr to stdout, note fflush()es are essential! */
+ fflush(stdout);
+ fflush(stderr);
+ if (dup2(STDOUT_FILENO, STDERR_FILENO) == -1)
+ perr_exit("Failed to redirect stderr to stdout");
+ fflush(stdout);
+ fflush(stderr);
+
+#ifdef DEBUG
+ if (!opt.debug)
+ if (!freopen("/dev/null", "w", stderr))
+ perr_exit("Failed to redirect stderr to /dev/null");
+#endif
+
+ if (ver)
+ version();
+ if (help || err)
+ usage();
+
+ return (!err && !help && !ver);
+}
+
+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);
+
+ /* 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) {
+ 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;
+ 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;
+
+ /* WARNING: don't modify the text, external tools grep for it */
+ if (!opt.infombonly)
+ printf("You might resize at %lld bytes ", (long long)new_b);
+ if ((new_mb * NTFS_MBYTE) < old_b) {
+ if (!opt.infombonly)
+ printf("or %lld MB ", (long long)new_mb);
+ else
+ printf("Minsize (in MB): %lld\n", (long long)new_mb);
+ }
+
+ if (!opt.infombonly) {
+ printf("(freeing ");
+ if (freed_mb && (old_mb - new_mb))
+ printf("%lld MB", (long long)(old_mb - new_mb));
+ 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");
+ }
+}
+
+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)
+{
+ 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)
+{
+ while (rl->length)
+ dump_run(rl++);
+}
+
+/**
+ * nr_clusters_to_bitmap_byte_size
+ *
+ * Take the number of clusters in the volume and calculate the size of $Bitmap.
+ * The size must be always 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;
+
+ return bm_bsize;
+}
+
+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;
+
+ last_lcn = rl->lcn + (rl->length - 1);
+
+ inode = resize->ni->mft_no;
+ flags = resize->ctx->attr->flags;
+ atype = resize->ctx->attr->type;
+
+ if ((ret = ntfs_inode_badclus_bad(inode, resize->ctx->attr)) != 0) {
+ if (ret == -1)
+ perr_exit("Bad sector list check failed");
+ return;
+ }
+
+ 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 (NInoAttrList(resize->ni)) {
+ llcn = &resize->last_multi_mft;
+
+ if (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_MFTMirr) {
+ llcn = &resize->last_mftmir;
+ supported = 1;
+
+ /* Fragmented $MFTMirr DATA attribute isn't supported yet */
+ if (atype == 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 (supported)
+ return;
+
+ if (resize->last_unsupp < last_lcn)
+ resize->last_unsupp = last_lcn;
+}
+
+
+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;
+
+ if (inode == FILE_Bitmap && resize->ctx->attr->type == AT_DATA)
+ return;
+
+ start = lcn;
+ len = lcn_length;
+
+ if (lcn < new_vol_size) {
+ start = new_vol_size;
+ len = lcn_length - (new_vol_size - lcn);
+
+ if ((!opt.info && !opt.infombonly) && (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);
+ }
+ }
+
+ resize->relocations += len;
+
+ if ((!opt.info && !opt.infombonly) || !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),
+ (unsigned long long)start, (long long)len);
+}
+
+/**
+ * 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.
+ */
+static void build_lcn_usage_bitmap(ntfs_volume *vol, ntfsck_t *fsck)
+{
+ s64 inode;
+ ATTR_RECORD *a;
+ runlist *rl;
+ int i, j;
+ struct bitmap *lcn_bitmap = &fsck->lcn_bitmap;
+
+ a = fsck->ctx->attr;
+ inode = fsck->ni->mft_no;
+
+ if (!a->non_resident)
+ return;
+
+ if (!(rl = ntfs_mapping_pairs_decompress(vol, a, NULL))) {
+ int err = errno;
+ perr_printf("ntfs_decompress_mapping_pairs");
+ if (err == EIO)
+ printf("%s", corrupt_volume_msg);
+ exit(1);
+ }
+
+
+ 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;
+
+ /* 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", (long long)inode,
+ (unsigned int)le32_to_cpu(a->type),
+ (long long)lcn, (long long)lcn_length);
+
+ for (j = 0; j < lcn_length; j++) {
+ 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",
+ (long long)inode, (long long)k,
+ (long long)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 "
+ "multiple times!\n",
+ (long long)k);
+ continue;
+ }
+ }
+ fsck->inuse += lcn_length;
+ }
+ 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 int walk_attributes(ntfs_volume *vol, ntfsck_t *fsck)
+{
+ 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)
+ break;
+ build_lcn_usage_bitmap(vol, fsck);
+ }
+
+ ntfs_attr_put_search_ctx(fsck->ctx);
+ return 0;
+}
+
+/**
+ * compare_bitmaps
+ *
+ * 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(ntfs_volume *vol, struct bitmap *a)
+{
+ s64 i, pos, count;
+ int mismatch = 0;
+ int backup_boot = 0;
+ u8 bm[NTFS_BUF_SIZE];
+
+ if (!opt.infombonly)
+ 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 size is smaller than expected"
+ " (%lld != %lld)\n",
+ (long long)a->size, (long long)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;
+
+ 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 && !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 && !opt.verbose)
+ continue;
+
+ printf("Cluster accounting failed at %lld "
+ "(0x%llx): %s cluster in "
+ "$Bitmap\n", (long long)cl,
+ (unsigned long long)cl,
+ bit ? "missing" : "extra");
+ }
+ }
+ }
+done:
+ if (mismatch) {
+ printf("Filesystem check failed! Totally %d cluster "
+ "accounting mismatches.\n", mismatch);
+ err_printf("%s", corrupt_volume_msg);
+ exit(1);
+ }
+}
+
+/**
+ * progress_init
+ *
+ * Create and scale our progress bar.
+ */
+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;
+}
+
+/**
+ * progress_update
+ *
+ * Update the progress bar and tell the user.
+ */
+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 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 int build_allocation_bitmap(ntfs_volume *vol, ntfsck_t *fsck)
+{
+ s64 nr_mft_records, 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 */
+ if (!opt.infombonly)
+ printf("Checking filesystem consistency ...\n");
+
+ if (fsck->flags & NTFSCK_PROGBAR)
+ pb_flags |= NTFS_PROGBAR;
+
+ nr_mft_records = vol->mft_na->initialized_size >>
+ vol->mft_record_size_bits;
+
+ progress_init(&progress, inode, nr_mft_records - 1, pb_flags);
+
+ for (; inode < nr_mft_records; inode++) {
+ if (!opt.infombonly)
+ progress_update(&progress, inode);
+
+ 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 || errno == ENOENT)
+ continue;
+ perr_printf("Reading inode %lld failed",
+ (long long)inode);
+ return -1;
+ }
+
+ if (ni->mrec->base_mft_record)
+ goto close_inode;
+
+ fsck->ni = ni;
+ if (walk_attributes(vol, fsck) != 0) {
+ inode_close(ni);
+ return -1;
+ }
+close_inode:
+ if (inode_close(ni) != 0)
+ return -1;
+ }
+ return 0;
+}
+
+static void build_resize_constraints(ntfs_resize_t *resize)
+{
+ s64 i;
+ runlist *rl;
+
+ if (!resize->ctx->attr->non_resident)
+ return;
+
+ 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++) {
+ /* 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_constraints_by_attributes(ntfs_resize_t *resize)
+{
+ 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)
+ break;
+ build_resize_constraints(resize);
+ }
+
+ ntfs_attr_put_search_ctx(resize->ctx);
+}
+
+static void set_resize_constraints(ntfs_resize_t *resize)
+{
+ s64 nr_mft_records, inode;
+ ntfs_inode *ni;
+
+ if (!opt.infombonly)
+ printf("Collecting resizing constraints ...\n");
+
+ 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) {
+ if (errno == EIO || errno == ENOENT)
+ continue;
+ perr_exit("Reading inode %lld failed",
+ (long long)inode);
+ }
+
+ if (ni->mrec->base_mft_record)
+ goto close_inode;
+
+ resize->ni = ni;
+ resize_constraints_by_attributes(resize);
+close_inode:
+ if (inode_close(ni) != 0)
+ exit(1);
+ }
+}
+
+static void rl_fixup(runlist **rl)
+{
+ runlist *tmp = *rl;
+
+ if (tmp->lcn == LCN_RL_NOT_MAPPED) {
+ s64 unmapped_len = tmp->length;
+
+ ntfs_log_verbose("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) {
+ ntfs_log_verbose("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;
+ }
+ }
+}
+
+/*
+ * Plug a replacement (partial) runlist into full runlist
+ *
+ * Returns 0 if successful
+ * -1 if failed
+ */
+
+static int replace_runlist(ntfs_attr *na, const runlist_element *reprl,
+ VCN lowest_vcn)
+{
+ const runlist_element *prep;
+ const runlist_element *pold;
+ runlist_element *pnew;
+ runlist_element *newrl;
+ VCN nextvcn;
+ s32 oldcnt, newcnt;
+ s32 newsize;
+ int r;
+
+ r = -1; /* default return */
+ /* allocate a new runlist able to hold both */
+ oldcnt = 0;
+ while (na->rl[oldcnt].length)
+ oldcnt++;
+ newcnt = 0;
+ while (reprl[newcnt].length)
+ newcnt++;
+ newsize = ((oldcnt + newcnt)*sizeof(runlist_element) + 4095) & -4096;
+ newrl = (runlist_element*)malloc(newsize);
+ if (newrl) {
+ /* copy old runs until reaching replaced ones */
+ pnew = newrl;
+ pold = na->rl;
+ while (pold->length
+ && ((pold->vcn + pold->length)
+ <= (reprl[0].vcn + lowest_vcn))) {
+ *pnew = *pold;
+ pnew++;
+ pold++;
+ }
+ /* split a possible old run partially overlapped */
+ if (pold->length
+ && (pold->vcn < (reprl[0].vcn + lowest_vcn))) {
+ pnew->vcn = pold->vcn;
+ pnew->lcn = pold->lcn;
+ pnew->length = reprl[0].vcn + lowest_vcn - pold->vcn;
+ pnew++;
+ }
+ /* copy new runs */
+ prep = reprl;
+ nextvcn = prep->vcn + lowest_vcn;
+ while (prep->length) {
+ pnew->vcn = prep->vcn + lowest_vcn;
+ pnew->lcn = prep->lcn;
+ pnew->length = prep->length;
+ nextvcn = pnew->vcn + pnew->length;
+ pnew++;
+ prep++;
+ }
+ /* locate the first fully replaced old run */
+ while (pold->length
+ && ((pold->vcn + pold->length) <= nextvcn)) {
+ pold++;
+ }
+ /* split a possible old run partially overlapped */
+ if (pold->length
+ && (pold->vcn < nextvcn)) {
+ pnew->vcn = nextvcn;
+ pnew->lcn = pold->lcn + nextvcn - pold->vcn;
+ pnew->length = pold->length - nextvcn + pold->vcn;
+ pnew++;
+ }
+ /* copy old runs beyond replaced ones */
+ while (pold->length) {
+ *pnew = *pold;
+ pnew++;
+ pold++;
+ }
+ /* the terminator is same as the old one */
+ *pnew = *pold;
+ /* deallocate the old runlist and replace */
+ free(na->rl);
+ na->rl = newrl;
+ r = 0;
+ }
+ return (r);
+}
+
+/*
+ * Expand the new runlist in new extent(s)
+ *
+ * This implies allocating inode extents and, generally, creating
+ * an attribute list and allocating clusters for the list, and
+ * shuffle the existing attributes accordingly.
+ *
+ * Sometimes the runlist being reallocated is within an extent,
+ * so we have a partial runlist to plug into an existing one
+ * whose other parts have already been processed or will have
+ * to be processed later, and we must not interfere with the
+ * processing of these parts.
+ *
+ * This cannot be done on the runlist part stored in a single
+ * extent, it has to be done globally for the file.
+ *
+ * We use the standard library functions, so we must wait until
+ * the new global bitmap and the new MFT bitmap are saved to
+ * disk and usable for the allocation of a new extent and creation
+ * of an attribute list.
+ *
+ * Aborts if something goes wrong. There should be no data damage,
+ * because the old runlist is still in use and the bootsector has
+ * not been updated yet, so the initial clusters can be accessed.
+ */
+
+static void expand_attribute_runlist(ntfs_volume *vol, struct DELAYED *delayed)
+{
+ ntfs_inode *ni;
+ ntfs_attr *na;
+ ATTR_TYPES type;
+ MFT_REF mref;
+ runlist_element *rl;
+
+ /* open the inode */
+ mref = delayed->mref;
+#ifndef BAN_NEW_TEXT
+ ntfs_log_verbose("Processing a delayed update for inode %lld\n",
+ (long long)mref);
+#endif
+ type = delayed->type;
+ rl = delayed->rl;
+ ni = ntfs_inode_open(vol,mref);
+ if (ni) {
+ na = ntfs_attr_open(ni, type,
+ delayed->attr_name, delayed->name_len);
+ if (na) {
+ if (!ntfs_attr_map_whole_runlist(na)) {
+ if (replace_runlist(na,rl,delayed->lowest_vcn)
+ || ntfs_attr_update_mapping_pairs(na,0))
+ perr_exit("Could not update runlist "
+ "for attribute 0x%lx in inode %lld",
+ (long)le32_to_cpu(type),(long long)mref);
+ } else
+ perr_exit("Could not map attribute 0x%lx in inode %lld",
+ (long)le32_to_cpu(type),(long long)mref);
+ ntfs_attr_close(na);
+ } else
+ perr_exit("Could not open attribute 0x%lx in inode %lld",
+ (long)le32_to_cpu(type),(long long)mref);
+ ntfs_inode_mark_dirty(ni);
+ if (ntfs_inode_close(ni))
+ perr_exit("Failed to close inode %lld through the library",
+ (long long)mref);
+ } else
+ perr_exit("Could not open inode %lld through the library",
+ (long long)mref);
+}
+
+/*
+ * Process delayed runlist updates
+ */
+
+static void delayed_updates(ntfs_resize_t *resize)
+{
+ struct DELAYED *delayed;
+
+ while (resize->delayed_runlists) {
+ delayed = resize->delayed_runlists;
+ expand_attribute_runlist(resize->vol, delayed);
+ resize->delayed_runlists = resize->delayed_runlists->next;
+ if (delayed->attr_name)
+ free(delayed->attr_name);
+ free(delayed->head_rl);
+ free(delayed);
+ }
+}
+
+/*
+ * Queue a runlist replacement for later update
+ *
+ * Store the attribute identification relative to base inode
+ */
+
+static void replace_later(ntfs_resize_t *resize, runlist *rl, runlist *head_rl)
+{
+ struct DELAYED *delayed;
+ ATTR_RECORD *a;
+ MFT_REF mref;
+ leMFT_REF lemref;
+ int name_len;
+ ntfschar *attr_name;
+
+ /* save the attribute parameters, to be able to find it later */
+ a = resize->ctx->attr;
+ name_len = a->name_length;
+ attr_name = (ntfschar*)NULL;
+ if (name_len) {
+ attr_name = (ntfschar*)ntfs_malloc(name_len*sizeof(ntfschar));
+ if (attr_name)
+ memcpy(attr_name,(u8*)a + le16_to_cpu(a->name_offset),
+ name_len*sizeof(ntfschar));
+ }
+ delayed = (struct DELAYED*)ntfs_malloc(sizeof(struct DELAYED));
+ if (delayed && (attr_name || !name_len)) {
+ lemref = resize->ctx->mrec->base_mft_record;
+ if (lemref)
+ mref = le64_to_cpu(lemref);
+ else
+ mref = resize->mref;
+ delayed->mref = MREF(mref);
+ delayed->type = a->type;
+ delayed->attr_name = attr_name;
+ delayed->name_len = name_len;
+ delayed->lowest_vcn = le64_to_cpu(a->lowest_vcn);
+ delayed->rl = rl;
+ delayed->head_rl = head_rl;
+ delayed->next = resize->delayed_runlists;
+ resize->delayed_runlists = delayed;
+ } else
+ perr_exit("Could not store delayed update data");
+}
+
+/*
+ * Replace the runlist in an attribute
+ *
+ * This sometimes requires expanding the runlist into another extent,
+ * which has to be done globally on the attribute. Is so, the action
+ * is put in a delay queue, and the caller must not free the runlist.
+ *
+ * Returns 0 if the replacement could be done
+ * 1 when it has been put in the delay queue.
+ */
+
+static int replace_attribute_runlist(ntfs_resize_t *resize, runlist *rl)
+{
+ int mp_size, l;
+ int must_delay;
+ void *mp;
+ runlist *head_rl;
+ ntfs_volume *vol;
+ ntfs_attr_search_ctx *ctx;
+ ATTR_RECORD *a;
+
+ vol = resize->vol;
+ ctx = resize->ctx;
+ a = ctx->attr;
+ head_rl = rl;
+ rl_fixup(&rl);
+
+ if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl, 0, INT_MAX)) == -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);
+ must_delay = 0;
+ if (mp_size > l) {
+ s32 remains_size;
+ char *next_attr;
+
+ ntfs_log_verbose("Enlarging attribute header ...\n");
+
+ mp_size = (mp_size + 7) & ~7;
+
+ 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 + le32_to_cpu(a->length);
+ l = mp_size - l;
+
+ 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);
+
+ 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)) {
+#ifndef BAN_NEW_TEXT
+ ntfs_log_verbose("Queuing expansion for later processing\n");
+#endif
+ must_delay = 1;
+ replace_later(resize,rl,head_rl);
+ } else {
+ memmove(next_attr + l, next_attr, remains_size);
+ ctx->mrec->bytes_in_use = cpu_to_le32(l +
+ le32_to_cpu(ctx->mrec->bytes_in_use));
+ a->length = cpu_to_le32(le32_to_cpu(a->length) + l);
+ }
+ }
+
+ if (!must_delay) {
+ mp = ntfs_calloc(mp_size);
+ if (!mp)
+ perr_exit("ntfsc_calloc couldn't get memory");
+
+ if (ntfs_mapping_pairs_build(vol, (u8*)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);
+
+ free(mp);
+ }
+ return (must_delay);
+}
+
+static void set_bitmap_range(struct bitmap *bm, s64 pos, s64 length, u8 bit)
+{
+ while (length--)
+ ntfs_bit_set(bm->bm, pos++, bit);
+}
+
+static void set_bitmap_clusters(struct bitmap *bm, runlist *rl, u8 bit)
+{
+ for (; rl->length; rl++)
+ set_bitmap_range(bm, rl->lcn, rl->length, bit);
+}
+
+static void release_bitmap_clusters(struct bitmap *bm, runlist *rl)
+{
+ max_free_cluster_range = 0;
+ set_bitmap_clusters(bm, 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(struct bitmap *bm,
+ 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(bm->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;
+ ntfs_log_verbose("Max free range: %7lld \n",
+ (long long)max_free_cluster_range);
+ }
+ pos = rle->lcn + items;
+ if (pos == nr_vol_clusters)
+ pos = 0;
+
+ set_bitmap_range(bm, rle->lcn, rle->length, 1);
+ return 0;
+}
+
+static runlist *alloc_cluster(struct bitmap *bm,
+ 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(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;
+
+ 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) {
+ ntfs_log_verbose("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(ntfs_volume *v, const MFT_REF mref, MFT_RECORD *buf)
+{
+ if (ntfs_mft_record_write(v, mref, buf))
+ perr_exit("ntfs_mft_record_write");
+
+// if (v->dev->d_ops->sync(v->dev) == -1)
+// perr_exit("Failed to sync device");
+
+ return 0;
+}
+
+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", (long long)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 */
+ ntfs_volume *vol = resize->vol;
+
+ for (i = 0; i < len; i++) {
+
+ lseek_to_cluster(vol, src + i);
+
+ if (read_all(vol->dev, buff, vol->cluster_size) == -1) {
+ perr_printf("Failed to read from the disk");
+ if (errno == EIO)
+ printf("%s", bad_sectors_warning_msg);
+ exit(1);
+ }
+
+ lseek_to_cluster(vol, dest + i);
+
+ if (write_all(vol->dev, buff, vol->cluster_size) == -1) {
+ perr_printf("Failed to write to the disk");
+ if (errno == EIO)
+ printf("%s", bad_sectors_warning_msg);
+ exit(1);
+ }
+
+ 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);
+
+ rl_new = ntfs_malloc(new_size);
+ if (!rl_new)
+ perr_exit("ntfs_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);
+
+ 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);
+ *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: fast path 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 ((resize->mref == FILE_MFT)
+ && (resize->ctx->attr->type == AT_DATA)
+ && !run
+ && resize->new_mft_start) {
+ relocate_rl = resize->new_mft_start;
+ } else
+ if (!(relocate_rl = alloc_cluster(&resize->lcn_bitmap,
+ lcn_length, new_vol_size, hint)))
+ perr_exit("Cluster allocation failed for %llu:%lld",
+ (unsigned long long)resize->mref,
+ (long long)lcn_length);
+
+ /* FIXME: check $MFTMirr DATA isn't multi-run (or support it) */
+ ntfs_log_verbose("Relocate record %7llu:0x%x:%08lld:0x%08llx: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)(*rl + run)->vcn,
+ (unsigned long long)lcn,
+ (unsigned long long)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 */
+
+ /* Do not free the relocated MFT start */
+ if ((resize->mref != FILE_MFT)
+ || (resize->ctx->attr->type != AT_DATA)
+ || run
+ || !resize->new_mft_start)
+ 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(resize->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",
+ (unsigned long long)resize->mref,
+ (unsigned int)le32_to_cpu(a->type),
+ (long long)lcn, (long long)lcn_length);
+
+ relocate_run(resize, &rl, i);
+ }
+
+ if (resize->dirty_inode == DIRTY_ATTRIB) {
+ if (!replace_attribute_runlist(resize, rl))
+ free(rl);
+ resize->dirty_inode = DIRTY_INODE;
+ } else
+ free(rl);
+}
+
+static int is_mftdata(ntfs_resize_t *resize)
+{
+ /*
+ * We must update the MFT own DATA record at the end of the second
+ * step, because the old MFT must be kept available for processing
+ * the other files.
+ */
+
+ if (resize->ctx->attr->type != AT_DATA)
+ return 0;
+
+ if (resize->mref == 0)
+ return 1;
+
+ if (MREF_LE(resize->mrec->base_mft_record) == 0 &&
+ MSEQNO_LE(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;
+
+ 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;
+
+ if (handle_mftdata(resize, do_mftdata) == 0)
+ continue;
+
+ ret = ntfs_inode_badclus_bad(resize->mref, resize->ctx->attr);
+ if (ret == -1)
+ perr_exit("Bad sector list check failed");
+ else if (ret == 1)
+ continue;
+
+ if (resize->mref == FILE_Bitmap &&
+ resize->ctx->attr->type == AT_DATA)
+ continue;
+
+ relocate_attribute(resize);
+ }
+
+ ntfs_attr_put_search_ctx(resize->ctx);
+}
+
+static void relocate_inode(ntfs_resize_t *resize, MFT_REF mref, int do_mftdata)
+{
+ ntfs_volume *vol = resize->vol;
+
+ 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, do_mftdata);
+
+// if (vol->dev->d_ops->sync(vol->dev) == -1)
+// perr_exit("Failed to sync device");
+ /* relocate MFT during second step, even if not dirty */
+ if ((mref == FILE_MFT) && do_mftdata && resize->new_mft_start) {
+ s64 pos;
+
+ /* write the MFT own record at its new location */
+ pos = (resize->new_mft_start->lcn
+ << vol->cluster_size_bits)
+ + (FILE_MFT << vol->mft_record_size_bits);
+ if (!opt.ro_flag
+ && (ntfs_mst_pwrite(vol->dev, pos, 1,
+ vol->mft_record_size, resize->mrec) != 1))
+ perr_exit("Couldn't update MFT own record");
+ } else {
+ if ((resize->dirty_inode == DIRTY_INODE)
+ && write_mft_record(vol, mref, resize->mrec)) {
+ perr_exit("Couldn't update record %llu",
+ (unsigned long long)mref);
+ }
+ }
+}
+
+static void relocate_inodes(ntfs_resize_t *resize)
+{
+ s64 nr_mft_records;
+ MFT_REF mref;
+ VCN highest_vcn;
+ u64 length;
+
+ printf("Relocating needed data ...\n");
+
+ progress_init(&resize->progress, 0, resize->relocations, resize->progress.flags);
+ resize->relocations = 0;
+
+ resize->mrec = ntfs_malloc(resize->vol->mft_record_size);
+ if (!resize->mrec)
+ perr_exit("ntfs_malloc failed");
+
+ nr_mft_records = resize->vol->mft_na->initialized_size >>
+ resize->vol->mft_record_size_bits;
+
+ /*
+ * If we need to relocate the first run of the MFT DATA,
+ * do it now, to have a better chance of getting at least
+ * 16 records in the first chunk. This is mandatory to be
+ * later able to read an MFT extent in record 15.
+ * Should this fail, we can stop with no damage, the volume
+ * is still in its initial state.
+ */
+ if (!resize->vol->mft_na->rl)
+ err_exit("Internal error : no runlist for $MFT\n");
+
+ if ((resize->vol->mft_na->rl->lcn + resize->vol->mft_na->rl->length)
+ >= resize->new_volume_size) {
+ /*
+ * The length of the first run is normally found in
+ * mft_na. However in some rare circumstance, this is
+ * merged with the first run of an extent of MFT,
+ * which implies there is a single run in the base record.
+ * So we have to make sure not to overflow from the
+ * runs present in the base extent.
+ */
+ length = resize->vol->mft_na->rl->length;
+ if (ntfs_file_record_read(resize->vol, FILE_MFT,
+ &resize->mrec, NULL)
+ || !(resize->ctx = attr_get_search_ctx(NULL,
+ resize->mrec))) {
+ err_exit("Could not read the base record of MFT\n");
+ }
+ while (!ntfs_attrs_walk(resize->ctx)
+ && (resize->ctx->attr->type != AT_DATA)) { }
+ if (resize->ctx->attr->type == AT_DATA) {
+ le64 high_le;
+
+ high_le = resize->ctx->attr->highest_vcn;
+ if (le64_to_cpu(high_le) < length)
+ length = le64_to_cpu(high_le) + 1;
+ } else {
+ err_exit("Could not find the DATA of MFT\n");
+ }
+ ntfs_attr_put_search_ctx(resize->ctx);
+ resize->new_mft_start = alloc_cluster(&resize->lcn_bitmap,
+ length, resize->new_volume_size, 0);
+ if (!resize->new_mft_start
+ || (((resize->new_mft_start->length
+ << resize->vol->cluster_size_bits)
+ >> resize->vol->mft_record_size_bits) < 16)) {
+ err_exit("Could not allocate 16 records in"
+ " the first MFT chunk\n");
+ }
+ }
+
+ for (mref = 0; mref < (MFT_REF)nr_mft_records; mref++)
+ relocate_inode(resize, mref, 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!\n", (long long)highest_vcn);
+ }
+done:
+ free(resize->mrec);
+}
+
+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,
+ (long long)llcn.inode);
+}
+
+/**
+ * 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.
+ */
+static void advise_on_resize(ntfs_resize_t *resize)
+{
+ ntfs_volume *vol = resize->vol;
+
+ 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, "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);
+}
+
+static void rl_expand(runlist **rl, const VCN last_vcn)
+{
+ int len;
+ runlist *p = *rl;
+
+ len = rl_items(p) - 1;
+ if (len <= 0)
+ err_exit("rl_expand: bad runlist length: %d\n", len);
+
+ if (p[len].vcn > last_vcn)
+ err_exit("rl_expand: length is already more than requested "
+ "(%lld > %lld)\n",
+ (long long)p[len].vcn, (long long)last_vcn);
+
+ if (p[len - 1].lcn == LCN_HOLE) {
+
+ p[len - 1].length += last_vcn - p[len].vcn;
+ p[len].vcn = last_vcn;
+
+ } else if (p[len - 1].lcn >= 0) {
+
+ p = realloc(*rl, (++len + 1) * sizeof(runlist_element));
+ if (!p)
+ perr_exit("rl_expand: realloc");
+
+ 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",
+ (long long)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
+ *
+ * $Bitmap can overlap the end of the volume. Any bits in this region
+ * must be set. This region also encompasses the backup boot sector.
+ */
+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);
+}
+
+/**
+ * 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_data_attr()"
+ */
+static void truncate_badclust_bad_attr(ntfs_resize_t *resize)
+{
+ ATTR_RECORD *a;
+ runlist *rl_bad;
+ 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 = ntfs_mapping_pairs_decompress(vol, a, NULL)))
+ perr_exit("ntfs_mapping_pairs_decompress");
+
+ rl_truncate(&rl_bad, nr_clusters);
+
+ a->highest_vcn = cpu_to_sle64(nr_clusters - 1LL);
+ a->allocated_size = cpu_to_sle64(nr_clusters * vol->cluster_size);
+ a->data_size = cpu_to_sle64(nr_clusters * vol->cluster_size);
+
+ if (!replace_attribute_runlist(resize, rl_bad))
+ free(rl_bad);
+}
+
+/**
+ * realloc_bitmap_data_attr
+ *
+ * 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_resize_t *resize,
+ runlist **rl,
+ 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);
+
+ for (i = vol->nr_clusters; i < new_size; i++)
+ ntfs_bit_set(bm->bm, i, 0);
+
+ if (!(*rl = alloc_cluster(bm, nr_bm_clusters, new_size, 0)))
+ 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
+ */
+static void truncate_bitmap_data_attr(ntfs_resize_t *resize)
+{
+ ATTR_RECORD *a;
+ runlist *rl;
+ s64 bm_bsize, size;
+ s64 nr_bm_clusters;
+ int truncated;
+ ntfs_volume *vol = resize->vol;
+
+ a = resize->ctx->attr;
+ if (!a->non_resident)
+ /* FIXME: handle resident attribute value */
+ err_exit("Resident attribute in $Bitmap isn't supported!\n");
+
+ bm_bsize = nr_clusters_to_bitmap_byte_size(resize->new_volume_size);
+ nr_bm_clusters = rounded_up_division(bm_bsize, vol->cluster_size);
+
+ 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_sle64(nr_bm_clusters - 1LL);
+ a->allocated_size = cpu_to_sle64(nr_bm_clusters * vol->cluster_size);
+ a->data_size = cpu_to_sle64(bm_bsize);
+ a->initialized_size = cpu_to_sle64(bm_bsize);
+
+ truncated = !replace_attribute_runlist(resize, rl);
+
+ /*
+ * 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, 0, bm_bsize, resize->lcn_bitmap.bm);
+ 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",
+ (long long)size, (long long)bm_bsize);
+ }
+
+ if (truncated)
+ free(rl);
+}
+
+/**
+ * lookup_data_attr
+ *
+ * Find the $DATA attribute (with or without a name) for the given MFT reference
+ * (inode number).
+ */
+static void lookup_data_attr(ntfs_volume *vol,
+ MFT_REF mref,
+ const char *aname,
+ ntfs_attr_search_ctx **ctx)
+{
+ ntfs_inode *ni;
+ ntfschar *ustr;
+ int len = 0;
+
+ if (!(ni = ntfs_inode_open(vol, mref)))
+ perr_exit("ntfs_open_inode");
+
+ if (!(*ctx = attr_get_search_ctx(ni, NULL)))
+ exit(1);
+
+ if ((ustr = ntfs_str2ucs(aname, &len)) == NULL) {
+ perr_printf("Couldn't convert '%s' to Unicode", aname);
+ exit(1);
+ }
+
+ if (ntfs_attr_lookup(AT_DATA, ustr, len, CASE_SENSITIVE,
+ 0, NULL, 0, *ctx))
+ perr_exit("ntfs_lookup_attr");
+
+ ntfs_ucsfree(ustr);
+}
+
+#if CLEAN_EXIT
+
+static void close_inode_and_context(ntfs_attr_search_ctx *ctx)
+{
+ ntfs_inode *ni;
+
+ ni = ctx->base_ntfs_ino;
+ if (!ni)
+ ni = ctx->ntfs_ino;
+ ntfs_attr_put_search_ctx(ctx);
+ if (ni)
+ ntfs_inode_close(ni);
+}
+
+#endif /* CLEAN_EXIT */
+
+static int check_bad_sectors(ntfs_volume *vol)
+{
+ ntfs_attr_search_ctx *ctx;
+ ntfs_inode *base_ni;
+ runlist *rl;
+ s64 i, badclusters = 0;
+
+ ntfs_log_verbose("Checking for bad sectors ...\n");
+
+ lookup_data_attr(vol, FILE_BadClus, "$Bad", &ctx);
+
+ base_ni = ctx->base_ntfs_ino;
+ if (!base_ni)
+ base_ni = ctx->ntfs_ino;
+
+ if (NInoAttrList(base_ni)) {
+ err_printf("Too many bad sectors have been detected!\n");
+ printf("%s", many_bad_sectors_msg);
+ exit(1);
+ }
+
+ if (!ctx->attr->non_resident)
+ err_exit("Resident attribute in $BadClust! Please report to "
+ "%s\n", NTFS_DEV_LIST);
+ /*
+ * FIXME: The below would be partial for non-base records in the
+ * not yet supported multi-record case. Alternatively use audited
+ * ntfs_attr_truncate after an umount & mount.
+ */
+ 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;
+ ntfs_log_verbose("Bad cluster: %#8llx - %#llx (%lld)\n",
+ (long long)rl[i].lcn,
+ (long long)rl[i].lcn + rl[i].length - 1,
+ (long long)rl[i].length);
+ }
+
+ if (badclusters) {
+ printf("%sThis software has detected that the disk has at least"
+ " %lld bad sector%s.\n",
+ !opt.badsectors ? NERR_PREFIX : "WARNING: ",
+ (long long)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);
+#if CLEAN_EXIT
+ close_inode_and_context(ctx);
+#else
+ ntfs_attr_put_search_ctx(ctx);
+#endif
+
+ return badclusters;
+}
+
+/**
+ * truncate_badclust_file
+ *
+ * Shrink the $BadClus file to match the new volume size.
+ */
+static void truncate_badclust_file(ntfs_resize_t *resize)
+{
+ printf("Updating $BadClust file ...\n");
+
+ 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->vol, resize->ctx->ntfs_ino->mft_no,
+ resize->ctx->mrec))
+ perr_exit("Couldn't update $BadClust");
+
+#if CLEAN_EXIT
+ close_inode_and_context(resize->ctx);
+#else
+ ntfs_attr_put_search_ctx(resize->ctx);
+#endif
+}
+
+/**
+ * truncate_bitmap_file
+ *
+ * Shrink the $Bitmap file to match the new volume size.
+ */
+static void truncate_bitmap_file(ntfs_resize_t *resize)
+{
+ ntfs_volume *vol = resize->vol;
+
+ printf("Updating $Bitmap file ...\n");
+
+ lookup_data_attr(resize->vol, FILE_Bitmap, NULL, &resize->ctx);
+ truncate_bitmap_data_attr(resize);
+
+ if (resize->new_mft_start) {
+ s64 pos;
+
+ /* write the MFT record at its new location */
+ pos = (resize->new_mft_start->lcn << vol->cluster_size_bits)
+ + (FILE_Bitmap << vol->mft_record_size_bits);
+ if (!opt.ro_flag
+ && (ntfs_mst_pwrite(vol->dev, pos, 1,
+ vol->mft_record_size, resize->ctx->mrec) != 1))
+ perr_exit("Couldn't update $Bitmap at new location");
+ } else {
+ if (write_mft_record(vol, resize->ctx->ntfs_ino->mft_no,
+ resize->ctx->mrec))
+ perr_exit("Couldn't update $Bitmap");
+ }
+
+#if CLEAN_EXIT
+ close_inode_and_context(resize->ctx);
+#else
+ ntfs_attr_put_search_ctx(resize->ctx);
+#endif
+}
+
+/**
+ * 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.
+ */
+static int setup_lcn_bitmap(struct bitmap *bm, s64 nr_clusters)
+{
+ /* Determine lcn bitmap byte size and allocate it. */
+ bm->size = rounded_up_division(nr_clusters, 8);
+
+ bm->bm = ntfs_calloc(bm->size);
+ if (!bm->bm)
+ return -1;
+
+ bitmap_file_data_fixup(nr_clusters, bm);
+ return 0;
+}
+
+/**
+ * update_bootsector
+ *
+ * FIXME: should be done using ntfs_* functions
+ */
+static void update_bootsector(ntfs_resize_t *r)
+{
+ NTFS_BOOT_SECTOR *bs;
+ ntfs_volume *vol = r->vol;
+ s64 bs_size = vol->sector_size;
+
+ printf("Updating Boot record ...\n");
+
+ bs = (NTFS_BOOT_SECTOR*)ntfs_malloc(vol->sector_size);
+ if (!bs)
+ perr_exit("ntfs_malloc");
+
+ 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, bs_size) == -1)
+ perr_exit("read() error");
+
+ bs->number_of_sectors = cpu_to_sle64(r->new_volume_size *
+ bs->bpb.sectors_per_cluster);
+
+ if (r->mftmir_old) {
+ r->progress.flags |= NTFS_PROGBAR_SUPPRESS;
+ /* Be sure the MFTMirr holds the updated MFT runlist */
+ if (r->new_mft_start)
+ copy_clusters(r, r->mftmir_rl.lcn,
+ r->new_mft_start->lcn, r->mftmir_rl.length);
+ else
+ copy_clusters(r, r->mftmir_rl.lcn, r->mftmir_old,
+ r->mftmir_rl.length);
+ bs->mftmirr_lcn = cpu_to_sle64(r->mftmir_rl.lcn);
+ r->progress.flags &= ~NTFS_PROGBAR_SUPPRESS;
+ }
+ /* Set the start of the relocated MFT */
+ if (r->new_mft_start) {
+ bs->mft_lcn = cpu_to_sle64(r->new_mft_start->lcn);
+ /* no more need for the new MFT start */
+ free(r->new_mft_start);
+ r->new_mft_start = (runlist_element*)NULL;
+ }
+
+ 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, bs_size) == -1)
+ perr_exit("write() error");
+ /*
+ * Set the backup boot sector, if the target size is
+ * either not defined or is defined with no multiplier
+ * suffix and is a multiple of the sector size.
+ * With these conditions we can be confident enough that
+ * the partition size is already defined or it will be
+ * later defined with the same exact value.
+ */
+ if (!opt.ro_flag && opt.reliable_size
+ && !(opt.bytes % vol->sector_size)) {
+ if (vol->dev->d_ops->seek(vol->dev, opt.bytes
+ - vol->sector_size, SEEK_SET) == (off_t)-1)
+ perr_exit("lseek");
+ if (vol->dev->d_ops->write(vol->dev, bs, bs_size) == -1)
+ perr_exit("write() error");
+ }
+ free(bs);
+}
+
+/**
+ * vol_size
+ */
+static s64 vol_size(ntfs_volume *v, s64 nr_clusters)
+{
+ /* add one sector_size for the backup boot sector */
+ return nr_clusters * v->cluster_size + v->sector_size;
+}
+
+/**
+ * print_vol_size
+ *
+ * Print the volume size in bytes and decimal megabytes.
+ */
+static void print_vol_size(const char *str, s64 bytes)
+{
+ printf("%s: %lld bytes (%lld MB)\n", str, (long long)bytes,
+ (long long)rounded_up_division(bytes, NTFS_MBYTE));
+}
+
+/**
+ * print_disk_usage
+ *
+ * Display the amount of disk space in use.
+ */
+static void print_disk_usage(ntfs_volume *vol, s64 nr_used_clusters)
+{
+ s64 total, used;
+
+ total = vol->nr_clusters * vol->cluster_size;
+ used = nr_used_clusters * vol->cluster_size;
+
+ /* WARNING: don't modify the text, external tools grep for it */
+ if (!opt.infombonly) {
+ printf("Space in use : %lld MB (%.1f%%)\n",
+ (long long)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 * resize->vol->cluster_size;
+
+ printf("Needed relocations : %lld (%lld MB)\n",
+ (long long)resize->relocations, (long long)
+ rounded_up_division(relocations, NTFS_MBYTE));
+}
+
+static ntfs_volume *check_volume(void)
+{
+ ntfs_volume *myvol = NULL;
+
+ /*
+ * Pass NTFS_MNT_FORENSIC so that the mount process does not modify the
+ * volume at all. We will do the logfile emptying and dirty setting
+ * later if needed.
+ */
+ if (!(myvol = ntfs_mount(opt.volume, opt.ro_flag | NTFS_MNT_FORENSIC)))
+ {
+ int err = errno;
+
+ perr_printf("Opening '%s' as NTFS failed", opt.volume);
+ switch (err) {
+ case EINVAL :
+ printf(invalid_ntfs_msg, opt.volume);
+ break;
+ case EIO :
+ printf("%s", corrupt_volume_msg);
+ break;
+ case EPERM :
+ printf("%s", hibernated_volume_msg);
+ break;
+ case EOPNOTSUPP :
+ printf("%s", unclean_journal_msg);
+ break;
+ case EBUSY :
+ printf("%s", opened_volume_msg);
+ break;
+ default :
+ break;
+ }
+ exit(1);
+ }
+ return myvol;
+}
+
+
+/**
+ * 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).
+ */
+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);
+ 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", opt.volume);
+ if (!opt.ro_flag)
+ err_exit("Device '%s' is mounted. "
+ "You must 'umount' it first.\n", opt.volume);
+ }
+ vol = check_volume();
+
+ if (vol->flags & VOLUME_IS_DIRTY)
+ if (opt.force-- <= 0)
+ 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",
+ (unsigned int)vol->cluster_size);
+
+ if (!opt.infombonly) {
+ 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");
+
+ if (!opt.infombonly) {
+ 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;
+}
+
+/**
+ * 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.
+ */
+static void prepare_volume_fixup(ntfs_volume *vol)
+{
+ printf("Schedule chkdsk for NTFS consistency check at Windows boot "
+ "time ...\n");
+ vol->flags |= VOLUME_IS_DIRTY;
+ if (ntfs_volume_write_flags(vol, vol->flags))
+ perr_exit("Failed to set the volume dirty");
+
+ /* Porting note: This flag does not exist in libntfs-3g. The dirty flag
+ * is never modified by libntfs-3g on unmount and we set it above. We
+ * can safely comment out this statement. */
+ /* NVolSetWasDirty(vol); */
+
+ if (vol->dev->d_ops->sync(vol->dev) == -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 (vol->dev->d_ops->sync(vol->dev) == -1)
+ perr_exit("Failed to sync device");
+}
+
+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_resize_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 == resize->vol->nr_clusters)
+ err_exit("Volume is full. To shrink it, "
+ "delete unused files.\n");
+
+ if (opt.info || opt.infombonly)
+ 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 estimate the smallest "
+ "shrunken volume size supported.\n");
+
+ 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 multiple"
+ " times.\n", fsck->multi_ref);
+ printf("%s", corrupt_volume_msg);
+ exit(1);
+ }
+
+ compare_bitmaps(vol, &fsck->lcn_bitmap);
+}
+
+/*
+ * Following are functions to expand an NTFS file system
+ * to the beginning of a partition. The old metadata can be
+ * located according to the backup bootsector, provided it can
+ * still be found at the end of the partition.
+ *
+ * The data itself is kept in place, and this is only possible
+ * if the expanded size is a multiple of cluster size, and big
+ * enough to hold the new $Boot, $Bitmap and $MFT
+ *
+ * The volume cannot be mounted because the layout of data does
+ * not match the volume parameters. The alignments of MFT entries
+ * and index blocks may be different in the new volume and the old
+ * one. The "ntfs_volume" structure is only partially usable,
+ * "ntfs_inode" and "search_context" cannot be used until the
+ * metadata has been moved and the volume is opened.
+ *
+ * Currently, no part of this new code is called from old code,
+ * and the only change in old code is the processing of options.
+ * Deduplication of code should be done later when the code is
+ * proved safe.
+ *
+ */
+
+typedef struct EXPAND {
+ ntfs_volume *vol;
+ u64 original_sectors;
+ u64 new_sectors;
+ u64 bitmap_allocated;
+ u64 bitmap_size;
+ u64 boot_size;
+ u64 mft_size;
+ LCN mft_lcn;
+ s64 byte_increment;
+ s64 sector_increment;
+ s64 cluster_increment;
+ u8 *bitmap;
+ u8 *mft_bitmap;
+ char *bootsector;
+ MFT_RECORD *mrec;
+ struct progress_bar *progress;
+ struct DELAYED *delayed_runlists; /* runlists to process later */
+} expand_t;
+
+/*
+ * Locate an attribute in an MFT record
+ *
+ * Returns NULL if not found (with no error message)
+ */
+
+static ATTR_RECORD *find_attr(MFT_RECORD *mrec, ATTR_TYPES type,
+ ntfschar *name, int namelen)
+{
+ ATTR_RECORD *a;
+ u32 offset;
+ ntfschar *attrname;
+
+ /* fetch the requested attribute */
+ offset = le16_to_cpu(mrec->attrs_offset);
+ a = (ATTR_RECORD*)((char*)mrec + offset);
+ attrname = (ntfschar*)((char*)a + le16_to_cpu(a->name_offset));
+ while ((a->type != AT_END)
+ && ((a->type != type)
+ || (a->name_length != namelen)
+ || (namelen && memcmp(attrname,name,2*namelen)))
+ && (offset < le32_to_cpu(mrec->bytes_in_use))) {
+ offset += le32_to_cpu(a->length);
+ a = (ATTR_RECORD*)((char*)mrec + offset);
+ if (namelen)
+ attrname = (ntfschar*)((char*)a
+ + le16_to_cpu(a->name_offset));
+ }
+ if ((a->type != type)
+ || (a->name_length != namelen)
+ || (namelen && memcmp(attrname,name,2*namelen)))
+ a = (ATTR_RECORD*)NULL;
+ return (a);
+}
+
+/*
+ * Read an MFT record and find an unnamed attribute
+ *
+ * Returns NULL if fails to read or attribute is not found
+ */
+
+static ATTR_RECORD *get_unnamed_attr(expand_t *expand, ATTR_TYPES type,
+ s64 inum)
+{
+ ntfs_volume *vol;
+ ATTR_RECORD *a;
+ MFT_RECORD *mrec;
+ s64 pos;
+ BOOL found;
+ int got;
+
+ found = FALSE;
+ a = (ATTR_RECORD*)NULL;
+ mrec = expand->mrec;
+ vol = expand->vol;
+ pos = (vol->mft_lcn << vol->cluster_size_bits)
+ + (inum << vol->mft_record_size_bits)
+ + expand->byte_increment;
+ got = ntfs_mst_pread(vol->dev, pos, 1, vol->mft_record_size, mrec);
+ if ((got == 1) && (mrec->flags & MFT_RECORD_IN_USE)) {
+ a = find_attr(expand->mrec, type, NULL, 0);
+ found = a && (a->type == type) && !a->name_length;
+ }
+ /* not finding the attribute list is not an error */
+ if (!found && (type != AT_ATTRIBUTE_LIST)) {
+ err_printf("Could not find attribute 0x%lx in inode %lld\n",
+ (long)le32_to_cpu(type), (long long)inum);
+ a = (ATTR_RECORD*)NULL;
+ }
+ return (a);
+}
+
+/*
+ * Read an MFT record and find an unnamed attribute
+ *
+ * Returns NULL if fails
+ */
+
+static ATTR_RECORD *read_and_get_attr(expand_t *expand, ATTR_TYPES type,
+ s64 inum, ntfschar *name, int namelen)
+{
+ ntfs_volume *vol;
+ ATTR_RECORD *a;
+ MFT_RECORD *mrec;
+ s64 pos;
+ int got;
+
+ a = (ATTR_RECORD*)NULL;
+ mrec = expand->mrec;
+ vol = expand->vol;
+ pos = (vol->mft_lcn << vol->cluster_size_bits)
+ + (inum << vol->mft_record_size_bits)
+ + expand->byte_increment;
+ got = ntfs_mst_pread(vol->dev, pos, 1, vol->mft_record_size, mrec);
+ if ((got == 1) && (mrec->flags & MFT_RECORD_IN_USE)) {
+ a = find_attr(expand->mrec, type, name, namelen);
+ }
+ if (!a) {
+ err_printf("Could not find attribute 0x%lx in inode %lld\n",
+ (long)le32_to_cpu(type), (long long)inum);
+ }
+ return (a);
+}
+
+/*
+ * Get the size allocated to the unnamed data of some inode
+ *
+ * Returns zero if fails.
+ */
+
+static s64 get_data_size(expand_t *expand, s64 inum)
+{
+ ATTR_RECORD *a;
+ s64 size;
+
+ size = 0;
+ /* get the size of unnamed $DATA */
+ a = get_unnamed_attr(expand, AT_DATA, inum);
+ if (a && a->non_resident)
+ size = le64_to_cpu(a->allocated_size);
+ if (!size) {
+ err_printf("Bad record %lld, could not get its size\n",
+ (long long)inum);
+ }
+ return (size);
+}
+
+/*
+ * Get the MFT bitmap
+ *
+ * Returns NULL if fails.
+ */
+
+static u8 *get_mft_bitmap(expand_t *expand)
+{
+ ATTR_RECORD *a;
+ ntfs_volume *vol;
+ runlist_element *rl;
+ runlist_element *prl;
+ u32 bitmap_size;
+ BOOL ok;
+
+ expand->mft_bitmap = (u8*)NULL;
+ vol = expand->vol;
+ /* get the runlist of unnamed bitmap */
+ a = get_unnamed_attr(expand, AT_BITMAP, FILE_MFT);
+ ok = TRUE;
+ bitmap_size = le64_to_cpu(a->allocated_size);
+ if (a
+ && a->non_resident
+ && ((bitmap_size << (vol->mft_record_size_bits + 3))
+ >= expand->mft_size)) {
+// rl in extent not implemented
+ rl = ntfs_mapping_pairs_decompress(expand->vol, a,
+ (runlist_element*)NULL);
+ expand->mft_bitmap = (u8*)ntfs_calloc(bitmap_size);
+ if (rl && expand->mft_bitmap) {
+ for (prl=rl; prl->length && ok; prl++) {
+ lseek_to_cluster(vol,
+ prl->lcn + expand->cluster_increment);
+ ok = !read_all(vol->dev, expand->mft_bitmap,
+ prl->length << vol->cluster_size_bits);
+ }
+ if (!ok) {
+ err_printf("Could not read the MFT bitmap\n");
+ free(expand->mft_bitmap);
+ expand->mft_bitmap = (u8*)NULL;
+ }
+ free(rl);
+ } else {
+ err_printf("Could not get the MFT bitmap\n");
+ }
+ } else
+ err_printf("Invalid MFT bitmap\n");
+ return (expand->mft_bitmap);
+}
+
+/*
+ * Check for bad sectors
+ *
+ * Deduplication to be done when proved safe
+ */
+
+static int check_expand_bad_sectors(expand_t *expand, ATTR_RECORD *a)
+{
+ runlist *rl;
+ int res;
+ s64 i, badclusters = 0;
+
+ res = 0;
+ ntfs_log_verbose("Checking for bad sectors ...\n");
+
+ if (find_attr(expand->mrec, AT_ATTRIBUTE_LIST, NULL, 0)) {
+ err_printf("Hopelessly many bad sectors have been detected!\n");
+ err_printf("%s", many_bad_sectors_msg);
+ res = -1;
+ } else {
+
+ /*
+ * FIXME: The below would be partial for non-base records in the
+ * not yet supported multi-record case. Alternatively use audited
+ * ntfs_attr_truncate after an umount & mount.
+ */
+ rl = ntfs_mapping_pairs_decompress(expand->vol, a, NULL);
+ if (!rl) {
+ perr_printf("Decompressing $BadClust:"
+ "$Bad mapping pairs failed");
+ res = -1;
+ } else {
+ 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;
+ ntfs_log_verbose("Bad cluster: %#8llx - %#llx"
+ " (%lld)\n",
+ (long long)rl[i].lcn,
+ (long long)rl[i].lcn
+ + rl[i].length - 1,
+ (long long)rl[i].length);
+ }
+
+ if (badclusters) {
+ err_printf("%sThis software has detected that"
+ " the disk has at least"
+ " %lld bad sector%s.\n",
+ !opt.badsectors ? NERR_PREFIX
+ : "WARNING: ",
+ (long long)badclusters,
+ badclusters - 1 ? "s" : "");
+ if (!opt.badsectors) {
+ err_printf("%s", bad_sectors_warning_msg);
+ res = -1;
+ } else
+ err_printf("WARNING: Bad sectors can cause"
+ " reliability problems"
+ " and massive data loss!!!\n");
+ }
+ free(rl);
+ }
+ }
+ return (res);
+}
+
+/*
+ * Check miscellaneous expansion constraints
+ */
+
+static int check_expand_constraints(expand_t *expand)
+{
+ static ntfschar bad[] = {
+ const_cpu_to_le16('$'), const_cpu_to_le16('B'),
+ const_cpu_to_le16('a'), const_cpu_to_le16('d')
+ } ;
+ ATTR_RECORD *a;
+ runlist_element *rl;
+ VOLUME_INFORMATION *volinfo;
+ VOLUME_FLAGS flags;
+ int res;
+
+ if (opt.verbose)
+ ntfs_log_verbose("Checking for expansion constraints...\n");
+ res = 0;
+ /* extents for $MFT are not supported */
+ if (get_unnamed_attr(expand, AT_ATTRIBUTE_LIST, FILE_MFT)) {
+ err_printf("The $MFT is too much fragmented\n");
+ res = -1;
+ }
+ /* fragmented $MFTMirr is not supported */
+ a = get_unnamed_attr(expand, AT_DATA, FILE_MFTMirr);
+ if (a) {
+ rl = ntfs_mapping_pairs_decompress(expand->vol, a, NULL);
+ if (!rl || !rl[0].length || rl[1].length) {
+ err_printf("$MFTMirr is bad or fragmented\n");
+ res = -1;
+ }
+ free(rl);
+ }
+ /* fragmented $Boot is not supported */
+ a = get_unnamed_attr(expand, AT_DATA, FILE_Boot);
+ if (a) {
+ rl = ntfs_mapping_pairs_decompress(expand->vol, a, NULL);
+ if (!rl || !rl[0].length || rl[1].length) {
+ err_printf("$Boot is bad or fragmented\n");
+ res = -1;
+ }
+ free(rl);
+ }
+ /* Volume should not be marked dirty */
+ a = get_unnamed_attr(expand, AT_VOLUME_INFORMATION, FILE_Volume);
+ if (a) {
+ volinfo = (VOLUME_INFORMATION*)
+ (le16_to_cpu(a->value_offset) + (char*)a);
+ flags = volinfo->flags;
+ if ((flags & VOLUME_IS_DIRTY) && (opt.force-- <= 0)) {
+ err_printf("Volume is scheduled for check.\nRun chkdsk /f"
+ " and please try again, or see option -f.\n");
+ res = -1;
+ }
+ } else {
+ err_printf("Could not get Volume flags\n");
+ res = -1;
+ }
+
+ /* There should not be too many bad clusters */
+ a = read_and_get_attr(expand, AT_DATA, FILE_BadClus, bad, 4);
+ if (!a || !a->non_resident) {
+ err_printf("Resident attribute in $BadClust! Please report to "
+ "%s\n", NTFS_DEV_LIST);
+ res = -1;
+ } else
+ if (check_expand_bad_sectors(expand,a))
+ res = -1;
+ return (res);
+}
+
+/*
+ * Compute the new sizes and check whether the NTFS file
+ * system can be expanded
+ *
+ * The partition has to have been expanded,
+ * the extra space must be able to hold the $MFT, $Boot, and $Bitmap
+ * the extra space must be a multiple of cluster size
+ *
+ * Returns TRUE if the partition can be expanded,
+ * FALSE if it canno be expanded or option --info was set
+ */
+
+static BOOL can_expand(expand_t *expand, ntfs_volume *vol)
+{
+ s64 old_sector_count;
+ s64 sectors_needed;
+ s64 clusters;
+ s64 minimum_size;
+ s64 got;
+ s64 advice;
+ s64 bitmap_bits;
+ BOOL ok;
+
+ ok = TRUE;
+ old_sector_count = vol->nr_clusters
+ << (vol->cluster_size_bits - vol->sector_size_bits);
+ /* do not include the space lost near the end */
+ expand->cluster_increment = (expand->new_sectors
+ >> (vol->cluster_size_bits - vol->sector_size_bits))
+ - vol->nr_clusters;
+ expand->byte_increment = expand->cluster_increment
+ << vol->cluster_size_bits;
+ expand->sector_increment = expand->byte_increment
+ >> vol->sector_size_bits;
+ printf("Sectors allocated to volume : old %lld current %lld difference %lld\n",
+ (long long)old_sector_count,
+ (long long)(old_sector_count + expand->sector_increment),
+ (long long)expand->sector_increment);
+ printf("Clusters allocated to volume : old %lld current %lld difference %lld\n",
+ (long long)vol->nr_clusters,
+ (long long)(vol->nr_clusters
+ + expand->cluster_increment),
+ (long long)expand->cluster_increment);
+ /* the new size must be bigger */
+ if ((expand->sector_increment < 0)
+ || (!expand->sector_increment && !opt.info)) {
+ err_printf("Cannot expand volume : the partition has not been expanded\n");
+ ok = FALSE;
+ }
+ /* the old bootsector must match the backup */
+ got = ntfs_pread(expand->vol->dev, expand->byte_increment,
+ vol->sector_size, expand->mrec);
+ if ((got != vol->sector_size)
+ || memcmp(expand->bootsector,expand->mrec,vol->sector_size)) {
+ err_printf("The backup bootsector does not match the old bootsector\n");
+ ok = FALSE;
+ }
+ if (ok) {
+ /* read the first MFT record, to get the MFT size */
+ expand->mft_size = get_data_size(expand, FILE_MFT);
+ /* read the 6th MFT record, to get the $Boot size */
+ expand->boot_size = get_data_size(expand, FILE_Boot);
+ if (!expand->mft_size || !expand->boot_size) {
+ ok = FALSE;
+ } else {
+ /*
+ * The bitmap is one bit per full cluster,
+ * accounting for the backup bootsector.
+ * When evaluating the minimal size, the bitmap
+ * size must be adapted to the minimal size :
+ * bits = clusters + ceil(clusters/clustersize)
+ */
+ if (opt.info) {
+ clusters = (((expand->original_sectors + 1)
+ << vol->sector_size_bits)
+ + expand->mft_size
+ + expand->boot_size)
+ >> vol->cluster_size_bits;
+ bitmap_bits = ((clusters + 1)
+ << vol->cluster_size_bits)
+ / (vol->cluster_size + 1);
+ } else {
+ bitmap_bits = (expand->new_sectors + 1)
+ >> (vol->cluster_size_bits
+ - vol->sector_size_bits);
+ }
+ /* byte size must be a multiple of 8 */
+ expand->bitmap_size = ((bitmap_bits + 63) >> 3) & -8;
+ expand->bitmap_allocated = ((expand->bitmap_size - 1)
+ | (vol->cluster_size - 1)) + 1;
+ expand->mft_lcn = (expand->boot_size
+ + expand->bitmap_allocated)
+ >> vol->cluster_size_bits;
+ /*
+ * Check whether $Boot, $Bitmap and $MFT can fit
+ * into the expanded space.
+ */
+ sectors_needed = (expand->boot_size + expand->mft_size
+ + expand->bitmap_allocated)
+ >> vol->sector_size_bits;
+ if (!opt.info
+ && (sectors_needed >= expand->sector_increment)) {
+ err_printf("The expanded space cannot hold the new metadata\n");
+ err_printf(" expanded space %lld sectors\n",
+ (long long)expand->sector_increment);
+ err_printf(" needed space %lld sectors\n",
+ (long long)sectors_needed);
+ ok = FALSE;
+ }
+ }
+ }
+ if (ok) {
+ advice = expand->byte_increment;
+ /* the increment must be an integral number of clusters */
+ if (expand->byte_increment & (vol->cluster_size - 1)) {
+ err_printf("Cannot expand volume without copying the data :\n");
+ err_printf("There are %d sectors in a cluster,\n",
+ (int)(vol->cluster_size/vol->sector_size));
+ err_printf(" and the sector difference is not a multiple of %d\n",
+ (int)(vol->cluster_size/vol->sector_size));
+ advice = expand->byte_increment & ~vol->cluster_size;
+ ok = FALSE;
+ }
+ if (!ok)
+ err_printf("You should increase the beginning of partition by %d sectors\n",
+ (int)((expand->byte_increment - advice)
+ >> vol->sector_size_bits));
+ }
+ if (ok)
+ ok = !check_expand_constraints(expand);
+ if (ok && opt.info) {
+ minimum_size = (expand->original_sectors
+ << vol->sector_size_bits)
+ + expand->boot_size
+ + expand->mft_size
+ + expand->bitmap_allocated;
+
+ printf("You must expand the partition to at least %lld bytes,\n",
+ (long long)(minimum_size + vol->sector_size));
+ printf("and you may add a multiple of %ld bytes to this size.\n",
+ (long)vol->cluster_size);
+ printf("The minimum NTFS volume size is %lld bytes\n",
+ (long long)minimum_size);
+ ok = FALSE;
+ }
+ return (ok);
+}
+
+static int set_bitmap(expand_t *expand, runlist_element *rl)
+{
+ int res;
+ s64 lcn;
+ s64 lcn_end;
+ BOOL reallocated;
+
+ res = -1;
+ reallocated = FALSE;
+ if ((rl->lcn >= 0)
+ && (rl->length > 0)
+ && ((rl->lcn + rl->length)
+ <= (expand->vol->nr_clusters + expand->cluster_increment))) {
+ lcn = rl->lcn;
+ lcn_end = lcn + rl->length;
+ while ((lcn & 7) && (lcn < lcn_end)) {
+ if (expand->bitmap[lcn >> 3] & 1 << (lcn & 7))
+ reallocated = TRUE;
+ expand->bitmap[lcn >> 3] |= 1 << (lcn & 7);
+ lcn++;
+ }
+ while ((lcn_end - lcn) >= 8) {
+ if (expand->bitmap[lcn >> 3])
+ reallocated = TRUE;
+ expand->bitmap[lcn >> 3] = 255;
+ lcn += 8;
+ }
+ while (lcn < lcn_end) {
+ if (expand->bitmap[lcn >> 3] & 1 << (lcn & 7))
+ reallocated = TRUE;
+ expand->bitmap[lcn >> 3] |= 1 << (lcn & 7);
+ lcn++;
+ }
+ if (reallocated)
+ err_printf("Reallocated cluster found in run"
+ " lcn 0x%llx length %lld\n",
+ (long long)rl->lcn,(long long)rl->length);
+ else
+ res = 0;
+ } else {
+ err_printf("Bad run : lcn 0x%llx length %lld\n",
+ (long long)rl->lcn,(long long)rl->length);
+ }
+ return (res);
+}
+
+/*
+ * Write the backup bootsector
+ *
+ * When this has been done, the resizing cannot be done again
+ */
+
+static int write_bootsector(expand_t *expand)
+{
+ ntfs_volume *vol;
+ s64 bw;
+ int res;
+
+ res = -1;
+ vol = expand->vol;
+ if (opt.verbose)
+ ntfs_log_verbose("Rewriting the backup bootsector\n");
+ if (opt.ro_flag)
+ bw = vol->sector_size;
+ else
+ bw = ntfs_pwrite(vol->dev,
+ expand->new_sectors*vol->sector_size,
+ vol->sector_size, expand->bootsector);
+ if (bw == vol->sector_size)
+ res = 0;
+ else {
+ if (bw != -1)
+ errno = EINVAL;
+ if (!bw)
+ err_printf("Failed to rewrite the bootsector (size=0)\n");
+ else
+ err_printf("Error rewriting the bootsector");
+ }
+ return (res);
+}
+
+/*
+ * Write the new main bitmap
+ */
+
+static int write_bitmap(expand_t *expand)
+{
+ ntfs_volume *vol;
+ s64 bw;
+ u64 cluster;
+ int res;
+
+ res = -1;
+ vol = expand->vol;
+ cluster = vol->nr_clusters + expand->cluster_increment;
+ while (cluster < (expand->bitmap_size << 3)) {
+ expand->bitmap[cluster >> 3] |= 1 << (cluster & 7);
+ cluster++;
+ }
+ if (opt.verbose)
+ ntfs_log_verbose("Writing the new bitmap...\n");
+ /* write the full allocation (to avoid having to read) */
+ if (opt.ro_flag)
+ bw = expand->bitmap_allocated;
+ else
+ bw = ntfs_pwrite(vol->dev, expand->boot_size,
+ expand->bitmap_allocated, expand->bitmap);
+ if (bw == (s64)expand->bitmap_allocated)
+ res = 0;
+ else {
+ if (bw != -1)
+ errno = EINVAL;
+ if (!bw)
+ err_printf("Failed to write the bitmap (size=0)\n");
+ else
+ err_printf("Error rewriting the bitmap");
+ }
+ return (res);
+}
+
+/*
+ * Copy the $MFT to $MFTMirr
+ *
+ * The $MFTMirr is not relocated as it should be kept away from $MFT.
+ * Apart from the backup bootsector, this is the only part which is
+ * overwritten. This has no effect on being able to redo the resizing
+ * if something goes wrong, as the $MFTMirr is never read. However
+ * this is done near the end of the resizing.
+ */
+
+static int copy_mftmirr(expand_t *expand)
+{
+ ntfs_volume *vol;
+ s64 pos;
+ s64 inum;
+ int res;
+ u16 usa_ofs;
+ le16 *pusn;
+ u16 usn;
+
+ if (opt.verbose)
+ ntfs_log_verbose("Copying $MFT to $MFTMirr...\n");
+ vol = expand->vol;
+ res = 0;
+ for (inum=FILE_MFT; !res && (inum<=FILE_Volume); inum++) {
+ /* read the new $MFT */
+ pos = (expand->mft_lcn << vol->cluster_size_bits)
+ + (inum << vol->mft_record_size_bits);
+ if (ntfs_mst_pread(vol->dev, pos, 1, vol->mft_record_size,
+ expand->mrec) == 1) {
+ /* overwrite the old $MFTMirr */
+ pos = (vol->mftmirr_lcn << vol->cluster_size_bits)
+ + (inum << vol->mft_record_size_bits)
+ + expand->byte_increment;
+ usa_ofs = le16_to_cpu(expand->mrec->usa_ofs);
+ pusn = (le16*)((u8*)expand->mrec + usa_ofs);
+ usn = le16_to_cpu(*pusn) - 1;
+ if (!usn || (usn == 0xffff))
+ usn = -2;
+ *pusn = cpu_to_le16(usn);
+ if (!opt.ro_flag
+ && (ntfs_mst_pwrite(vol->dev, pos, 1,
+ vol->mft_record_size, expand->mrec) != 1)) {
+ err_printf("Failed to overwrite the old $MFTMirr\n");
+ res = -1;
+ }
+ } else {
+ err_printf("Failed to write the new $MFT\n");
+ res = -1;
+ }
+ }
+ return (res);
+}
+
+/*
+ * Copy the $Boot, including the bootsector
+ *
+ * When the bootsector has been copied, repair tools are able to
+ * fix things, but this is dangerous if the other metadata do
+ * not point to actual user data. So this must be done near the end
+ * of resizing.
+ */
+
+static int copy_boot(expand_t *expand)
+{
+ NTFS_BOOT_SECTOR *bs;
+ char *buf;
+ ntfs_volume *vol;
+ s64 mftmirr_lcn;
+ s64 written;
+ u32 boot_cnt;
+ u32 hidden_sectors;
+ le32 hidden_sectors_le;
+ int res;
+
+ if (opt.verbose)
+ ntfs_log_verbose("Copying $Boot...\n");
+ vol = expand->vol;
+ res = 0;
+ buf = (char*)ntfs_malloc(vol->cluster_size);
+ if (buf) {
+ /* set the new volume parameters in the bootsector */
+ bs = (NTFS_BOOT_SECTOR*)expand->bootsector;
+ bs->number_of_sectors = cpu_to_le64(expand->new_sectors);
+ bs->mft_lcn = cpu_to_le64(expand->mft_lcn);
+ mftmirr_lcn = vol->mftmirr_lcn + expand->cluster_increment;
+ bs->mftmirr_lcn = cpu_to_le64(mftmirr_lcn);
+ /* the hidden sectors are needed to boot into windows */
+ memcpy(&hidden_sectors_le,&bs->bpb.hidden_sectors,4);
+ /* alignment messed up on the Sparc */
+ if (hidden_sectors_le) {
+ hidden_sectors = le32_to_cpu(hidden_sectors_le);
+ if (hidden_sectors >= expand->sector_increment)
+ hidden_sectors -= expand->sector_increment;
+ else
+ hidden_sectors = 0;
+ hidden_sectors_le = cpu_to_le32(hidden_sectors);
+ memcpy(&bs->bpb.hidden_sectors,&hidden_sectors_le,4);
+ }
+ written = 0;
+ boot_cnt = expand->boot_size >> vol->cluster_size_bits;
+ while (!res && (written < boot_cnt)) {
+ lseek_to_cluster(vol, expand->cluster_increment + written);
+ if (!read_all(vol->dev, buf, vol->cluster_size)) {
+ if (!written)
+ memcpy(buf, expand->bootsector, vol->sector_size);
+ lseek_to_cluster(vol, written);
+ if (!opt.ro_flag
+ && write_all(vol->dev, buf, vol->cluster_size)) {
+ err_printf("Failed to write the new $Boot\n");
+ res = -1;
+ } else
+ written++;
+ } else {
+ err_printf("Failed to read the old $Boot\n");
+ res = -1;
+ }
+ }
+ free(buf);
+ } else {
+ err_printf("Failed to allocate buffer\n");
+ res = -1;
+ }
+ return (res);
+}
+
+/*
+ * Process delayed runlist updates
+ *
+ * This is derived from delayed_updates() and they should
+ * both be merged when the new code is considered safe.
+ */
+
+static void delayed_expand(ntfs_volume *vol, struct DELAYED *delayed,
+ struct progress_bar *progress)
+{
+ unsigned long count;
+ struct DELAYED *current;
+ int step = 100;
+
+ if (delayed) {
+ if (opt.verbose)
+ ntfs_log_verbose("Delayed updating of overflowing runlists...\n");
+ count = 0;
+ /* count by steps because of inappropriate resolution */
+ for (current=delayed; current; current=current->next)
+ count += step;
+ progress_init(progress, 0, count,
+ (opt.show_progress ? NTFS_PROGBAR : 0));
+ current = delayed;
+ count = 0;
+ while (current) {
+ delayed = current;
+ if (!opt.ro_flag)
+ expand_attribute_runlist(vol, delayed);
+ count += step;
+ progress_update(progress, count);
+ current = current->next;
+ if (delayed->attr_name)
+ free(delayed->attr_name);
+ free(delayed->head_rl);
+ free(delayed);
+ }
+ }
+}
+
+/*
+ * Expand the sizes in indexes for inodes which were expanded
+ *
+ * Only the new $Bitmap sizes are identified as needed to be
+ * adjusted in index. The $BadClus is only expanded in an
+ * alternate data stream, whose sizes are not present in the index.
+ *
+ * This is modifying the initial data, and can only be done when
+ * the volume has been reopened after expanding.
+ */
+
+static int expand_index_sizes(expand_t *expand)
+{
+ ntfs_inode *ni;
+ int res;
+
+ res = -1;
+ ni = ntfs_inode_open(expand->vol, FILE_Bitmap);
+ if (ni) {
+ NInoSetDirty(ni);
+ NInoFileNameSetDirty(ni);
+ ntfs_inode_close(ni);
+ res = 0;
+ }
+ return (res);
+}
+
+/*
+ * Update a runlist into an attribute
+ *
+ * This is derived from replace_attribute_runlist() and they should
+ * both be merged when the new code is considered safe.
+ */
+
+static int update_runlist(expand_t *expand, s64 inum,
+ ATTR_RECORD *a, runlist_element *rl)
+{
+ ntfs_resize_t resize;
+ ntfs_attr_search_ctx ctx;
+ ntfs_volume *vol;
+ MFT_RECORD *mrec;
+ runlist *head_rl;
+ int mp_size;
+ int l;
+ int must_delay;
+ void *mp;
+
+ vol = expand->vol;
+ mrec = expand->mrec;
+ head_rl = rl;
+ rl_fixup(&rl);
+ if ((mp_size = ntfs_get_size_for_mapping_pairs(vol, rl,
+ 0, INT_MAX)) == -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);
+ must_delay = 0;
+ if (mp_size > l) {
+ s32 remains_size;
+ char *next_attr;
+
+ ntfs_log_verbose("Enlarging attribute header ...\n");
+
+ mp_size = (mp_size + 7) & ~7;
+
+ 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(mrec->bytes_in_use));
+
+ next_attr = (char *)a + le32_to_cpu(a->length);
+ l = mp_size - l;
+
+ ntfs_log_verbose("Bytes in use new : %u\n", l + (unsigned int)
+ le32_to_cpu(mrec->bytes_in_use));
+ ntfs_log_verbose("Bytes allocated : %u\n", (unsigned int)
+ le32_to_cpu(mrec->bytes_allocated));
+
+ remains_size = le32_to_cpu(mrec->bytes_in_use);
+ remains_size -= (next_attr - (char *)mrec);
+
+ ntfs_log_verbose("increase : %d\n", l);
+ ntfs_log_verbose("shift : %lld\n",
+ (long long)remains_size);
+ if (le32_to_cpu(mrec->bytes_in_use) + l >
+ le32_to_cpu(mrec->bytes_allocated)) {
+ ntfs_log_verbose("Queuing expansion for later processing\n");
+ /* hack for reusing unmodified old code ! */
+ resize.ctx = &ctx;
+ ctx.attr = a;
+ ctx.mrec = mrec;
+ resize.mref = inum;
+ resize.delayed_runlists = expand->delayed_runlists;
+ must_delay = 1;
+ replace_later(&resize,rl,head_rl);
+ expand->delayed_runlists = resize.delayed_runlists;
+ } else {
+ memmove(next_attr + l, next_attr, remains_size);
+ mrec->bytes_in_use = cpu_to_le32(l +
+ le32_to_cpu(mrec->bytes_in_use));
+ a->length = cpu_to_le32(le32_to_cpu(a->length) + l);
+ }
+ }
+
+ if (!must_delay) {
+ mp = ntfs_calloc(mp_size);
+ if (!mp)
+ perr_exit("ntfsc_calloc couldn't get memory");
+
+ if (ntfs_mapping_pairs_build(vol, (u8*)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);
+
+ free(mp);
+ }
+ return (must_delay);
+}
+
+/*
+ * Create a minimal valid MFT record
+ */
+
+static int minimal_record(expand_t *expand, MFT_RECORD *mrec)
+{
+ int usa_count;
+ u32 bytes_in_use;
+
+ memset(mrec,0,expand->vol->mft_record_size);
+ mrec->magic = magic_FILE;
+ mrec->usa_ofs = const_cpu_to_le16(sizeof(MFT_RECORD));
+ usa_count = expand->vol->mft_record_size / NTFS_BLOCK_SIZE + 1;
+ mrec->usa_count = cpu_to_le16(usa_count);
+ bytes_in_use = (sizeof(MFT_RECORD) + 2*usa_count + 7) & -8;
+ memset(((char*)mrec) + bytes_in_use, 255, 4); /* AT_END */
+ bytes_in_use += 8;
+ mrec->bytes_in_use = cpu_to_le32(bytes_in_use);
+ mrec->bytes_allocated = cpu_to_le32(expand->vol->mft_record_size);
+ return (0);
+}
+
+/*
+ * Rebase all runlists of an MFT record
+ *
+ * Iterate through all its attributes and offset the non resident ones
+ */
+
+static int rebase_runlists(expand_t *expand, s64 inum)
+{
+ MFT_RECORD *mrec;
+ ATTR_RECORD *a;
+ runlist_element *rl;
+ runlist_element *prl;
+ u32 offset;
+ int res;
+
+ res = 0;
+ mrec = expand->mrec;
+ offset = le16_to_cpu(mrec->attrs_offset);
+ a = (ATTR_RECORD*)((char*)mrec + offset);
+ while (!res && (a->type != AT_END)
+ && (offset < le32_to_cpu(mrec->bytes_in_use))) {
+ if (a->non_resident) {
+ rl = ntfs_mapping_pairs_decompress(expand->vol, a,
+ (runlist_element*)NULL);
+ if (rl) {
+ for (prl=rl; prl->length; prl++)
+ if (prl->lcn >= 0) {
+ prl->lcn += expand->cluster_increment;
+ if (set_bitmap(expand,prl))
+ res = -1;
+ }
+ if (update_runlist(expand,inum,a,rl)) {
+ ntfs_log_verbose("Runlist updating has to be delayed\n");
+ } else
+ free(rl);
+ } else {
+ err_printf("Could not get a runlist of inode %lld\n",
+ (long long)inum);
+ res = -1;
+ }
+ }
+ offset += le32_to_cpu(a->length);
+ a = (ATTR_RECORD*)((char*)mrec + offset);
+ }
+ return (res);
+}
+
+/*
+ * Rebase the runlists present in records with relocated $DATA
+ *
+ * The returned runlist is the old rebased runlist for $DATA,
+ * which is generally different from the new computed runlist.
+ */
+
+static runlist_element *rebase_runlists_meta(expand_t *expand, s64 inum)
+{
+ MFT_RECORD *mrec;
+ ATTR_RECORD *a;
+ ntfs_volume *vol;
+ runlist_element *rl;
+ runlist_element *old_rl;
+ runlist_element *prl;
+ runlist_element new_rl[2];
+ s64 data_size;
+ s64 allocated_size;
+ s64 lcn;
+ u64 lth;
+ u32 offset;
+ BOOL keeprl;
+ int res;
+
+ res = 0;
+ old_rl = (runlist_element*)NULL;
+ vol = expand->vol;
+ mrec = expand->mrec;
+ switch (inum) {
+ case FILE_Boot :
+ lcn = 0;
+ lth = expand->boot_size >> vol->cluster_size_bits;
+ data_size = expand->boot_size;
+ break;
+ case FILE_Bitmap :
+ lcn = expand->boot_size >> vol->cluster_size_bits;
+ lth = expand->bitmap_allocated >> vol->cluster_size_bits;
+ data_size = expand->bitmap_size;
+ break;
+ case FILE_MFT :
+ lcn = (expand->boot_size + expand->bitmap_allocated)
+ >> vol->cluster_size_bits;
+ lth = expand->mft_size >> vol->cluster_size_bits;
+ data_size = expand->mft_size;
+ break;
+ case FILE_BadClus :
+ lcn = 0; /* not used */
+ lth = vol->nr_clusters + expand->cluster_increment;
+ data_size = lth << vol->cluster_size_bits;
+ break;
+ default :
+ lcn = lth = data_size = 0;
+ res = -1;
+ }
+ allocated_size = lth << vol->cluster_size_bits;
+ offset = le16_to_cpu(mrec->attrs_offset);
+ a = (ATTR_RECORD*)((char*)mrec + offset);
+ while (!res && (a->type != AT_END)
+ && (offset < le32_to_cpu(mrec->bytes_in_use))) {
+ if (a->non_resident) {
+ keeprl = FALSE;
+ rl = ntfs_mapping_pairs_decompress(vol, a,
+ (runlist_element*)NULL);
+ if (rl) {
+ /* rebase the old runlist */
+ for (prl=rl; prl->length; prl++)
+ if (prl->lcn >= 0) {
+ prl->lcn += expand->cluster_increment;
+ if ((a->type != AT_DATA)
+ && set_bitmap(expand,prl))
+ res = -1;
+ }
+ /* relocated unnamed data (not $BadClus) */
+ if ((a->type == AT_DATA)
+ && !a->name_length
+ && (inum != FILE_BadClus)) {
+ old_rl = rl;
+ rl = new_rl;
+ keeprl = TRUE;
+ rl[0].vcn = 0;
+ rl[0].lcn = lcn;
+ rl[0].length = lth;
+ rl[1].vcn = lth;
+ rl[1].lcn = LCN_ENOENT;
+ rl[1].length = 0;
+ if (set_bitmap(expand,rl))
+ res = -1;
+ a->data_size = cpu_to_le64(data_size);
+ a->initialized_size = a->data_size;
+ a->allocated_size
+ = cpu_to_le64(allocated_size);
+ a->highest_vcn = cpu_to_le64(lth - 1);
+ }
+ /* expand the named data for $BadClus */
+ if ((a->type == AT_DATA)
+ && a->name_length
+ && (inum == FILE_BadClus)) {
+ old_rl = rl;
+ keeprl = TRUE;
+ prl = rl;
+ if (prl->length) {
+ while (prl[1].length)
+ prl++;
+ prl->length = lth - prl->vcn;
+ prl[1].vcn = lth;
+ } else
+ prl->vcn = lth;
+ a->data_size = cpu_to_le64(data_size);
+ /* do not change the initialized size */
+ a->allocated_size
+ = cpu_to_le64(allocated_size);
+ a->highest_vcn = cpu_to_le64(lth - 1);
+ }
+ if (!res && update_runlist(expand,inum,a,rl))
+ res = -1;
+ if (!keeprl)
+ free(rl);
+ } else {
+ err_printf("Could not get the data runlist of inode %lld\n",
+ (long long)inum);
+ res = -1;
+ }
+ }
+ offset += le32_to_cpu(a->length);
+ a = (ATTR_RECORD*)((char*)mrec + offset);
+ }
+ if (res && old_rl) {
+ free(old_rl);
+ old_rl = (runlist_element*)NULL;
+ }
+ return (old_rl);
+}
+
+/*
+ * Rebase all runlists in an MFT record
+ *
+ * Read from the old $MFT, rebase the runlists,
+ * and write to the new $MFT
+ */
+
+static int rebase_inode(expand_t *expand, const runlist_element *prl,
+ s64 inum, s64 jnum)
+{
+ MFT_RECORD *mrec;
+ runlist_element *rl;
+ ntfs_volume *vol;
+ s64 pos;
+ int res;
+
+ res = 0;
+ vol = expand->vol;
+ mrec = expand->mrec;
+ if (expand->mft_bitmap[inum >> 3] & (1 << (inum & 7))) {
+ pos = (prl->lcn << vol->cluster_size_bits)
+ + ((inum - jnum) << vol->mft_record_size_bits);
+ if ((ntfs_mst_pread(vol->dev, pos, 1,
+ vol->mft_record_size, mrec) == 1)
+ && (mrec->flags & MFT_RECORD_IN_USE)) {
+ switch (inum) {
+ case FILE_Bitmap :
+ case FILE_Boot :
+ case FILE_BadClus :
+ rl = rebase_runlists_meta(expand, inum);
+ if (rl)
+ free(rl);
+ else
+ res = -1;
+ break;
+ default :
+ res = rebase_runlists(expand, inum);
+ break;
+ }
+ } else {
+ err_printf("Could not read the $MFT entry %lld\n",
+ (long long)inum);
+ res = -1;
+ }
+ } else {
+ /*
+ * Replace unused records (possibly uninitialized)
+ * by minimal valid records, not marked in use
+ */
+ res = minimal_record(expand,mrec);
+ }
+ if (!res) {
+ pos = (expand->mft_lcn << vol->cluster_size_bits)
+ + (inum << vol->mft_record_size_bits);
+ if (opt.verbose)
+ ntfs_log_verbose("Rebasing inode %lld cluster 0x%llx\n",
+ (long long)inum,
+ (long long)(pos >> vol->cluster_size_bits));
+ if (!opt.ro_flag
+ && (ntfs_mst_pwrite(vol->dev, pos, 1,
+ vol->mft_record_size, mrec) != 1)) {
+ err_printf("Could not write the $MFT entry %lld\n",
+ (long long)inum);
+ res = -1;
+ }
+ }
+ return (res);
+}
+
+/*
+ * Rebase all runlists
+ *
+ * First get the $MFT and define its location in the expanded space,
+ * then rebase the other inodes and write them to the new $MFT
+ */
+
+static int rebase_all_inodes(expand_t *expand)
+{
+ ntfs_volume *vol;
+ MFT_RECORD *mrec;
+ s64 inum;
+ s64 jnum;
+ s64 inodecnt;
+ s64 pos;
+ s64 got;
+ int res;
+ runlist_element *mft_rl;
+ runlist_element *prl;
+
+ res = 0;
+ mft_rl = (runlist_element*)NULL;
+ vol = expand->vol;
+ mrec = expand->mrec;
+ inum = 0;
+ pos = (vol->mft_lcn + expand->cluster_increment)
+ << vol->cluster_size_bits;
+ got = ntfs_mst_pread(vol->dev, pos, 1,
+ vol->mft_record_size, mrec);
+ if ((got == 1) && (mrec->flags & MFT_RECORD_IN_USE)) {
+ pos = expand->mft_lcn << vol->cluster_size_bits;
+ if (opt.verbose)
+ ntfs_log_verbose("Rebasing inode %lld cluster 0x%llx\n",
+ (long long)inum,
+ (long long)(pos >> vol->cluster_size_bits));
+ mft_rl = rebase_runlists_meta(expand, FILE_MFT);
+ if (!mft_rl
+ || (!opt.ro_flag
+ && (ntfs_mst_pwrite(vol->dev, pos, 1,
+ vol->mft_record_size, mrec) != 1)))
+ res = -1;
+ else {
+ for (prl=mft_rl; prl->length; prl++) { }
+ inodecnt = (prl->vcn << vol->cluster_size_bits)
+ >> vol->mft_record_size_bits;
+ progress_init(expand->progress, 0, inodecnt,
+ (opt.show_progress ? NTFS_PROGBAR : 0));
+ prl = mft_rl;
+ jnum = 0;
+ do {
+ inum++;
+ while (prl->length
+ && ((inum << vol->mft_record_size_bits)
+ >= ((prl->vcn + prl->length)
+ << vol->cluster_size_bits))) {
+ prl++;
+ jnum = inum;
+ }
+ progress_update(expand->progress, inum);
+ if (prl->length) {
+ res = rebase_inode(expand,
+ prl,inum,jnum);
+ }
+ } while (!res && prl->length);
+ free(mft_rl);
+ }
+ } else {
+ err_printf("Could not read the old $MFT\n");
+ res = -1;
+ }
+ return (res);
+}
+
+
+
+/*
+ * Get the old volume parameters from the backup bootsector
+ *
+ */
+
+static ntfs_volume *get_volume_data(expand_t *expand, struct ntfs_device *dev,
+ s32 sector_size)
+{
+ s64 br;
+ ntfs_volume *vol;
+ le16 sector_size_le;
+ NTFS_BOOT_SECTOR *bs;
+ BOOL ok;
+
+ ok = FALSE;
+ vol = (ntfs_volume*)ntfs_malloc(sizeof(ntfs_volume));
+ expand->bootsector = (char*)ntfs_malloc(sector_size);
+ if (vol && expand->bootsector) {
+ expand->vol = vol;
+ vol->dev = dev;
+ br = ntfs_pread(dev, expand->new_sectors*sector_size,
+ sector_size, expand->bootsector);
+ if (br != sector_size) {
+ if (br != -1)
+ errno = EINVAL;
+ if (!br)
+ err_printf("Failed to read the backup bootsector (size=0)\n");
+ else
+ err_printf("Error reading the backup bootsector");
+ } else {
+ bs = (NTFS_BOOT_SECTOR*)expand->bootsector;
+ /* alignment problem on Sparc, even doing memcpy() */
+ sector_size_le = cpu_to_le16(sector_size);
+ if (!memcmp(&sector_size_le,
+ &bs->bpb.bytes_per_sector,2)
+ && ntfs_boot_sector_is_ntfs(bs)
+ && !ntfs_boot_sector_parse(vol, bs)) {
+ expand->original_sectors
+ = le64_to_cpu(bs->number_of_sectors);
+ expand->mrec = (MFT_RECORD*)
+ ntfs_malloc(vol->mft_record_size);
+ if (expand->mrec
+ && can_expand(expand,vol)) {
+ ntfs_log_verbose("Resizing is possible\n");
+ ok = TRUE;
+ }
+ } else
+ err_printf("Could not get the old volume parameters "
+ "from the backup bootsector\n");
+ }
+ if (!ok) {
+ free(vol);
+ free(expand->bootsector);
+ }
+ }
+ return (ok ? vol : (ntfs_volume*)NULL);
+}
+
+static int really_expand(expand_t *expand)
+{
+ ntfs_volume *vol;
+ struct ntfs_device *dev;
+ int res;
+
+ res = -1;
+
+ expand->bitmap = (u8*)ntfs_calloc(expand->bitmap_allocated);
+ if (expand->bitmap
+ && get_mft_bitmap(expand)) {
+ printf("\n*** WARNING ***\n\n");
+ printf("Expanding a volume is an experimental new feature\n");
+ if (!opt.ro_flag)
+ printf("A first check with option -n is recommended\n");
+ printf("\nShould something go wrong during the actual"
+ " resizing (power outage, etc.),\n");
+ printf("just restart the procedure, but DO NOT TRY to repair"
+ " with chkdsk or similar,\n");
+ printf("until the resizing is over,"
+ " you would LOSE YOUR DATA !\n");
+ printf("\nYou have been warned !\n\n");
+ if (!opt.ro_flag && (opt.force-- <= 0))
+ proceed_question();
+ if (!rebase_all_inodes(expand)
+ && !write_bitmap(expand)
+ && !copy_mftmirr(expand)
+ && !copy_boot(expand)) {
+ free(expand->vol);
+ expand->vol = (ntfs_volume*)NULL;
+ free(expand->mft_bitmap);
+ expand->mft_bitmap = (u8*)NULL;
+ if (!opt.ro_flag) {
+ /* the volume must be dirty, do not check */
+ opt.force++;
+ vol = mount_volume();
+ if (vol) {
+ dev = vol->dev;
+ ntfs_log_verbose("Remounting the updated volume\n");
+ expand->vol = vol;
+ ntfs_log_verbose("Delayed runlist updatings\n");
+ delayed_expand(vol, expand->delayed_runlists,
+ expand->progress);
+ expand->delayed_runlists
+ = (struct DELAYED*)NULL;
+ expand_index_sizes(expand);
+ /* rewriting the backup bootsector, no return ticket now ! */
+ res = write_bootsector(expand);
+ if (dev->d_ops->sync(dev) == -1) {
+ printf("Could not sync\n");
+ res = -1;
+ }
+ ntfs_umount(vol,0);
+ if (!res)
+ printf("\nResizing completed successfully\n");
+ }
+ } else {
+ ntfs_log_verbose("Delayed runlist updatings\n");
+ delayed_expand(expand->vol,
+ expand->delayed_runlists,
+ expand->progress);
+ expand->delayed_runlists
+ = (struct DELAYED*)NULL;
+ printf("\nAll checks have been completed successfully\n");
+ printf("Cannot check further in no-action mode\n");
+ }
+ free(expand->bootsector);
+ free(expand->mrec);
+ }
+ free(expand->bitmap);
+ } else {
+ err_printf("Failed to allocate memory\n");
+ }
+ return (res);
+}
+
+/*
+ * Expand a volume to beginning of partition
+ *
+ * We rely on the backup bootsector to determine the original
+ * volume size and metadata.
+ */
+
+static int expand_to_beginning(void)
+{
+ expand_t expand;
+ struct progress_bar progress;
+ int ret;
+ ntfs_volume *vol;
+ struct ntfs_device *dev;
+ int sector_size;
+ s64 new_sectors;
+
+ ret = -1;
+ dev = ntfs_device_alloc(opt.volume, 0, &ntfs_device_default_io_ops,
+ NULL);
+ if (dev) {
+ if (!(*dev->d_ops->open)(dev,
+ (opt.ro_flag ? O_RDONLY : O_RDWR))) {
+ sector_size = ntfs_device_sector_size_get(dev);
+ if (sector_size <= 0) {
+ sector_size = 512;
+ new_sectors = ntfs_device_size_get(dev,
+ sector_size);
+ if (!new_sectors) {
+ sector_size = 4096;
+ new_sectors = ntfs_device_size_get(dev,
+ sector_size);
+ }
+ } else
+ new_sectors = ntfs_device_size_get(dev,
+ sector_size);
+ if (new_sectors) {
+ new_sectors--; /* last sector not counted */
+ expand.new_sectors = new_sectors;
+ expand.progress = &progress;
+ expand.delayed_runlists = (struct DELAYED*)NULL;
+ vol = get_volume_data(&expand,dev,sector_size);
+ if (vol) {
+ expand.vol = vol;
+ ret = really_expand(&expand);
+ }
+ }
+ (*dev->d_ops->close)(dev);
+ } else {
+ err_exit("Couldn't open volume '%s'!\n", opt.volume);
+ }
+ ntfs_device_free(dev);
+ }
+ return (ret);
+}
+
+
+int main(int argc, char **argv)
+{
+ ntfsck_t fsck;
+ ntfs_resize_t resize;
+ s64 new_size = 0; /* in clusters; 0 = --info w/o --size */
+ s64 device_size; /* in bytes */
+ ntfs_volume *vol = NULL;
+
+ ntfs_log_set_handler(ntfs_log_handler_outerr);
+
+ printf("%s v%s (libntfs-3g)\n", EXEC_NAME, VERSION);
+
+ if (!parse_options(argc, argv))
+ return 1;
+
+ utils_set_locale();
+
+ /*
+ * If we're just checking the device, we'll do it first,
+ * and exit out, no matter what we find.
+ */
+ if (opt.check) {
+ vol = check_volume();
+#if CLEAN_EXIT
+ if (vol)
+ ntfs_umount(vol,0);
+#endif
+ exit(0);
+ } else {
+ if (opt.expand) {
+ /*
+ * If we are to expand to beginning of partition, do
+ * not try to mount : when merging two partitions,
+ * the beginning of the partition would contain an
+ * old filesystem which is not the one to expand.
+ */
+ if (expand_to_beginning() && !opt.info)
+ exit(1);
+ return (0);
+ }
+ }
+
+ if (!(vol = mount_volume()))
+ 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;
+ if (device_size <= 0)
+ err_exit("Couldn't get device size (%lld)!\n",
+ (long long)device_size);
+
+ if (!opt.infombonly)
+ 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!\nCorrupt partition table or incorrect device "
+ "partitioning?\n");
+
+ if (!opt.bytes && !opt.info && !opt.infombonly) {
+ opt.bytes = device_size;
+ opt.reliable_size = 1;
+ }
+
+ /* Backup boot sector at the end of device isn't counted in NTFS
+ volume size thus we have to reserve space for it. */
+ if (opt.bytes > vol->sector_size)
+ new_size = (opt.bytes - vol->sector_size) / vol->cluster_size;
+ else
+ new_size = 0;
+
+ if (!opt.info && !opt.infombonly) {
+ 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 && !opt.infombonly && (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);
+ }
+
+ 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);
+
+ NVolSetNoFixupWarn(vol);
+ check_cluster_allocation(vol, &fsck);
+
+ print_disk_usage(vol, fsck.inuse);
+
+ resize.inuse = fsck.inuse;
+ resize.lcn_bitmap = fsck.lcn_bitmap;
+
+ set_resize_constraints(&resize);
+ set_disk_usage_constraint(&resize);
+ check_resize_constraints(&resize);
+
+ if (opt.info || opt.infombonly) {
+ advise_on_resize(&resize);
+ exit(0);
+ }
+
+ if (opt.force-- <= 0 && !opt.ro_flag) {
+ printf("%s", resize_warning_msg);
+ proceed_question();
+ }
+
+ /* FIXME: performance - relocate logfile here if it's needed */
+ prepare_volume_fixup(vol);
+
+ if (resize.relocations)
+ relocate_inodes(&resize);
+
+ truncate_badclust_file(&resize);
+ truncate_bitmap_file(&resize);
+ delayed_updates(&resize);
+ 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 */
+
+ if (opt.ro_flag) {
+ printf("The read-only test run ended successfully.\n");
+ 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");
+
+ printf("Successfully resized NTFS on device '%s'.\n", vol->dev->d_name);
+ if (resize.shrink)
+ printf("%s", resize_important_msg);
+#if CLEAN_EXIT
+ if (resize.lcn_bitmap.bm)
+ free(resize.lcn_bitmap.bm);
+ if (vol)
+ ntfs_umount(vol,0);
+#endif
+ return 0;
+}
diff --git a/ntfsprogs/ntfstruncate.c b/ntfsprogs/ntfstruncate.c
new file mode 100755
index 0000000..7ac5ae4
--- a/dev/null
+++ b/ntfsprogs/ntfstruncate.c
@@ -0,0 +1,809 @@
+/**
+ * ntfstruncate - Part of the Linux-NTFS project.
+ *
+ * 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.
+ *
+ * This 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 <unistd.h>
+#endif
+#ifdef HAVE_STDLIB_H
+# include <stdlib.h>
+#endif
+#ifdef HAVE_STDIO_H
+# include <stdio.h>
+#endif
+#ifdef HAVE_STDARG_H
+# include <stdarg.h>
+#endif
+#ifdef HAVE_STRING_H
+# include <string.h>
+#endif
+#ifdef HAVE_ERRNO_H
+# include <errno.h>
+#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+#ifdef HAVE_GETOPT_H
+# include <getopt.h>
+#else
+ extern char *optarg;
+ extern int optind;
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifndef LLONG_MAX
+# define LLONG_MAX 9223372036854775807LL
+#endif
+
+#include "types.h"
+#include "attrib.h"
+#include "inode.h"
+#include "layout.h"
+#include "volume.h"
+#include "utils.h"
+#include "attrdef.h"
+/* #include "version.h" */
+#include "logging.h"
+
+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;
+ntfschar *attr_name = NULL;
+u32 attr_name_len;
+s64 new_len;
+
+ntfs_volume *vol;
+ntfs_inode *ni;
+ntfs_attr *na = NULL;
+
+ATTR_DEF *attr_defs;
+
+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 truncation. */
+ /* -V, print version and exit. */
+} opts;
+
+/**
+ * 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);
+}
+
+/**
+ * copyright - print copyright statements
+ */
+static void copyright(void)
+{
+ fprintf(stderr, "Copyright (c) 2002-2005 Anton Altaparmakov\n"
+ "Copyright (c) 2003 Richard Russon\n"
+ "Truncate a specified attribute of a specified "
+ "inode.\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 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"
+ " -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, *s2;
+ int c;
+
+ if (argc && *argv)
+ EXEC_NAME = *argv;
+ fprintf(stderr, "%s v%s (libntfs-3g)\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;
+ 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. */
+ exit(0);
+ case 'l':
+ copyright();
+ license();
+ exit(0);
+ case 'h':
+ case '?':
+ default:
+ usage();
+ }
+ 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++];
+ ntfs_log_verbose("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;
+ ntfs_log_verbose("inode = %lli\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);
+ if ((int)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;
+ }
+ }
+ ntfs_log_verbose("attribute type = 0x%x\n", (unsigned int)attr_type);
+ if (attr_name == AT_UNNAMED)
+ ntfs_log_verbose("attribute name = \"\" (UNNAMED)\n");
+ else
+ ntfs_log_verbose("attribute name = \"%s\" (length %u Unicode "
+ "characters)\n", s2,
+ (unsigned int)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;
+ ntfs_log_verbose("new length = %lli\n", (long long)new_len);
+}
+
+/**
+ * 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;
+}
+
+/**
+ * dump_resident_attr_val
+ */
+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.";
+ const char *skip = "Skipping display of $%s attribute value.\n";
+ const char *todo = "This is still work in progress.";
+ char *buf;
+ int i, j;
+ u32 u;
+
+ 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 = %u\n", (unsigned int)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, (ntfschar*)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:
+ u = le32_to_cpu(type);
+ printf("Cannot display unknown %s defined attribute type 0x%x"
+ ".\n", u >=
+ le32_to_cpu(AT_FIRST_USER_DEFINED_ATTRIBUTE) ?
+ "user" : "system", (unsigned int)u);
+ }
+}
+
+/**
+ * dump_resident_attr
+ */
+static 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));
+}
+
+/**
+ * dump_mapping_pairs_array
+ */
+static void dump_mapping_pairs_array(char *b __attribute__((unused)),
+ unsigned int max_len __attribute__((unused)))
+{
+ // TODO
+ return;
+}
+
+/**
+ * dump_non_resident_attr
+ */
+static void dump_non_resident_attr(ATTR_RECORD *a)
+{
+ s64 l;
+ int i;
+
+ l = sle64_to_cpu(a->lowest_vcn);
+ 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", (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,
+ 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 = %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", (long long)l,
+ (unsigned long long)l);
+ l = sle64_to_cpu(a->initialized_size);
+ 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", (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);
+}
+
+/**
+ * dump_attr_record
+ */
+static 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",
+ (unsigned)((u8*)a - (u8*)m));
+ if (a->type == 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;
+ }
+ 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) {
+ 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
+ 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, (ntfschar*)((char*)a +
+ cpu_to_le16(a->name_offset)),
+ min((int)sizeof(s),
+ a->name_length + 1)) == -1) {
+ ntfs_log_error("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);
+ }
+}
+
+/**
+ * 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 == 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));
+ };
+ printf("-- End of attributes. --\n");
+}
+
+/**
+ * ntfstruncate_exit
+ */
+static 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)) {
+ ntfs_log_perror("Warning: Failed to close inode %lli",
+ (long long)inode);
+ }
+ /* Unmount the volume. */
+ err = ntfs_umount(vol, 0);
+ if (err == -1)
+ ntfs_log_perror("Warning: Could not umount %s", dev_name);
+ /* Free the attribute name if it exists. */
+ ntfs_ucsfree(attr_name);
+}
+
+/**
+ * main
+ */
+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));
+
+ /*
+ * Setup a default $AttrDef. FIXME: Should be reading this from the
+ * volume itself, at ntfs_mount() time.
+ */
+ attr_defs = (ATTR_DEF*)&attrdef_ntfs3x_array;
+
+ /* 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))
+ ntfs_log_perror("Failed to determine whether %s is mounted",
+ dev_name);
+ else if (mnt_flags & NTFS_MF_MOUNTED) {
+ 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 "
+ "is incorrect.\n");
+ }
+
+ /* Mount the device. */
+ if (opts.no_action) {
+ ntfs_log_quiet("Running in READ-ONLY mode!\n");
+ ul = NTFS_MNT_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(&ntfstruncate_exit);
+ if (err == -1) {
+ ntfs_log_error("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 %lli: %s\n", (long long)inode,
+ strerror(errno));
+
+ /* 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",
+ (unsigned int)attr_type, strerror(errno));
+
+ if (!opts.quiet && opts.verbose > 1) {
+ ntfs_log_verbose("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",
+ (unsigned int)attr_type, strerror(errno));
+
+ if (!opts.quiet && opts.verbose > 1) {
+ ntfs_log_verbose("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 %lli: %s\n", (long long)inode,
+ strerror(errno));
+
+ /* Unmount the volume. */
+ err = ntfs_umount(vol, 0);
+ if (err == -1)
+ ntfs_log_perror("Warning: Failed to umount %s", dev_name);
+
+ /* Free the attribute name if it exists. */
+ ntfs_ucsfree(attr_name);
+
+ /* Finally, disable our ntfstruncate_exit() handler. */
+ success = TRUE;
+
+ ntfs_log_quiet("ntfstruncate completed successfully. Have a nice day.\n");
+ return 0;
+}
diff --git a/ntfsprogs/ntfsundelete.8 b/ntfsprogs/ntfsundelete.8
new file mode 100644
index 0000000..18de27f
--- a/dev/null
+++ b/ntfsprogs/ntfsundelete.8
@@ -0,0 +1,324 @@
+.\" Copyright (c) 2002\-2005 Richard Russon.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH NTFSUNDELETE 8 "November 2005" "ntfs-3g 2014.2.15"
+.SH NAME
+ntfsundelete \- recover a deleted file from an NTFS volume.
+.SH SYNOPSIS
+.B ntfsundelete
+[\fIoptions\fR] \fIdevice\fR
+.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 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
+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.
+.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 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
+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
+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\-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
+\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
+\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
+which will be created in the current directory. This option can be combined
+with the
+.B \-\-output
+and
+.B \-\-destination
+options.
+.TP
+\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
+\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\-\-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 "\-".
+.TP
+\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
+\fB\-O\fR, \fB\-\-optimistic\fR
+Recover parts of the file even if they are currently marked as in use.
+.TP
+\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
+\fB\-P\fR, \fB\-\-parent\fR
+Display the parent directory of a deleted file.
+.TP
+\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
+\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
+\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 .
+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 Time Size Filename
+ 6038 FN.. 93% 2002\-07\-17 13:42 26629 thesis.doc
+.fi
+.TS
+box;
+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
+.sp
+.sp
+The percentage field shows how much of the file can potentially be recovered.
+.TP
+\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
+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
+\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
+\fB\-T\fR, \fB\-\-truncate\fR
+If
+.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
+\fB\-u\fR, \fB\-\-undelete\fR
+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
+.BR \-\-byte .
+.sp
+When the file is recovered it will be given its original name, unless the
+.B \-\-output
+option is used.
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Increase the amount of output that
+.B ntfsundelete
+prints.
+.TP
+\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.
+.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 inodes 2, 5 and 100 to 131 of device /dev/sda1
+.RS
+.sp
+.B ntfsundelete /dev/sda1 \-u \-i 2,5,100\-131
+.sp
+.RE
+Undelete inode number 3689, call the file 'work.doc', set it to recovered
+size and put it in the user's home directory.
+.RS
+.sp
+.B ntfsundelete /dev/hda1 \-u \-T \-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
+.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
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.SH AUTHORS
+.B ntfsundelete
+was written by Richard Russon and Holger Ohmacht, with contributions from Anton
+Altaparmakov.
+It was ported to ntfs-3g by Erik Larsson and Jean-Pierre Andre.
+.SH AVAILABILITY
+.B ntfsundelete
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR ntfsinfo (8),
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfsundelete.8.in b/ntfsprogs/ntfsundelete.8.in
new file mode 100755
index 0000000..f80a4d7
--- a/dev/null
+++ b/ntfsprogs/ntfsundelete.8.in
@@ -0,0 +1,324 @@
+.\" Copyright (c) 2002\-2005 Richard Russon.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH NTFSUNDELETE 8 "November 2005" "ntfs-3g @VERSION@"
+.SH NAME
+ntfsundelete \- recover a deleted file from an NTFS volume.
+.SH SYNOPSIS
+.B ntfsundelete
+[\fIoptions\fR] \fIdevice\fR
+.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 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
+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.
+.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 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
+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
+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\-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
+\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
+\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
+which will be created in the current directory. This option can be combined
+with the
+.B \-\-output
+and
+.B \-\-destination
+options.
+.TP
+\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
+\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\-\-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 "\-".
+.TP
+\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
+\fB\-O\fR, \fB\-\-optimistic\fR
+Recover parts of the file even if they are currently marked as in use.
+.TP
+\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
+\fB\-P\fR, \fB\-\-parent\fR
+Display the parent directory of a deleted file.
+.TP
+\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
+\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
+\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 .
+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 Time Size Filename
+ 6038 FN.. 93% 2002\-07\-17 13:42 26629 thesis.doc
+.fi
+.TS
+box;
+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
+.sp
+.sp
+The percentage field shows how much of the file can potentially be recovered.
+.TP
+\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
+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
+\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
+\fB\-T\fR, \fB\-\-truncate\fR
+If
+.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
+\fB\-u\fR, \fB\-\-undelete\fR
+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
+.BR \-\-byte .
+.sp
+When the file is recovered it will be given its original name, unless the
+.B \-\-output
+option is used.
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Increase the amount of output that
+.B ntfsundelete
+prints.
+.TP
+\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.
+.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 inodes 2, 5 and 100 to 131 of device /dev/sda1
+.RS
+.sp
+.B ntfsundelete /dev/sda1 \-u \-i 2,5,100\-131
+.sp
+.RE
+Undelete inode number 3689, call the file 'work.doc', set it to recovered
+size and put it in the user's home directory.
+.RS
+.sp
+.B ntfsundelete /dev/hda1 \-u \-T \-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
+.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
+ntfs\-3g\-devel@lists.sf.net
+.hy
+.SH AUTHORS
+.B ntfsundelete
+was written by Richard Russon and Holger Ohmacht, with contributions from Anton
+Altaparmakov.
+It was ported to ntfs-3g by Erik Larsson and Jean-Pierre Andre.
+.SH AVAILABILITY
+.B ntfsundelete
+is part of the
+.B ntfs-3g
+package and is available from:
+.br
+.nh
+http://www.tuxera.com/community/
+.hy
+.SH SEE ALSO
+.BR ntfsinfo (8),
+.BR ntfsprogs (8)
diff --git a/ntfsprogs/ntfsundelete.c b/ntfsprogs/ntfsundelete.c
new file mode 100755
index 0000000..b74f4c5
--- a/dev/null
+++ b/ntfsprogs/ntfsundelete.c
@@ -0,0 +1,2490 @@
+/**
+ * ntfsundelete - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2002-2005 Richard Russon
+ * Copyright (c) 2004-2005 Holger Ohmacht
+ * Copyright (c) 2005 Anton Altaparmakov
+ * Copyright (c) 2007 Yura Pakhuchiy
+ * Copyright (c) 2013 Jean-Pierre Andre
+ *
+ * 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"
+
+#ifdef HAVE_FEATURES_H
+#include <features.h>
+#endif
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+#ifdef HAVE_UTIME_H
+#include <utime.h>
+#endif
+#ifdef HAVE_REGEX_H
+#include <regex.h>
+#endif
+
+#if !defined(REG_NOERROR) || (REG_NOERROR != 0)
+#define REG_NOERROR 0
+#endif
+
+#ifndef REG_NOMATCH
+#define REG_NOMATCH 1
+#endif
+
+#include "ntfsundelete.h"
+#include "bootsect.h"
+#include "mft.h"
+#include "attrib.h"
+#include "layout.h"
+#include "inode.h"
+#include "device.h"
+#include "utils.h"
+#include "debug.h"
+#include "ntfstime.h"
+/* #include "version.h" */
+#include "logging.h"
+#include "misc.h"
+
+#ifdef HAVE_WINDOWS_H
+/*
+ * Replacements for functions which do not exist on Windows
+ */
+#define ftruncate(fd, size) ntfs_win32_ftruncate(fd, size)
+#endif
+
+static const char *EXEC_NAME = "ntfsundelete";
+static const char *MFTFILE = "mft";
+static const char *UNNAMED = "<unnamed>";
+static const char *NONE = "<none>";
+static const char *UNKNOWN = "unknown";
+static struct options opts;
+
+typedef struct
+{
+ u32 begin;
+ u32 end;
+} range;
+
+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-Ranges for undelete */
+static long nr_entries; /* Number of range entries */
+
+#ifdef HAVE_WINDOWS_H
+/*
+ * Replacement for strftime() on Windows
+ *
+ * strftime() on Windows uses format codes different from those
+ * defined in C99 sect. 7.23.3.5
+ * Use snprintf() instead.
+ */
+static int win32_strftime(char *buffer, int size, const char *format,
+ const struct tm *ptm)
+{
+ int ret;
+
+ if (!strcmp(format, "%F %R"))
+ ret = snprintf(buffer, size, "%4d-%02d-%02d %02d:%02d",
+ ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday,
+ ptm->tm_hour, ptm->tm_min);
+ else
+ ret = snprintf(buffer, size, "%4d-%02d-%02d",
+ ptm->tm_year + 1900, ptm->tm_mon + 1, ptm->tm_mday);
+ return (ret);
+}
+#define strftime(buf, sz, fmt, ptm) win32_strftime(buf, sz, fmt, ptm)
+#endif
+
+#ifndef HAVE_REGEX_H
+
+/*
+ * Pattern matching routing for systems with no regex.
+ */
+
+typedef struct REGEX {
+ ntfschar *upcase;
+ u32 upcase_len;
+ int flags;
+ int pattern_len;
+ ntfschar pattern[1];
+} *regex_t;
+
+enum { REG_NOSUB = 1, REG_ICASE = 2 };
+
+static BOOL patmatch(regex_t *re, const ntfschar *f, int flen,
+ const ntfschar *p, int plen, BOOL dot)
+{
+ regex_t pre;
+ BOOL ok;
+ BOOL anyextens;
+ int i;
+ unsigned int c;
+
+ pre = *re;
+ if (pre->flags & REG_ICASE) {
+ while ((flen > 0) && (plen > 0)
+ && ((*f == *p)
+ || (*p == const_cpu_to_le16('?'))
+ || ((c = le16_to_cpu(*f)) < pre->upcase_len
+ ? pre->upcase[c] : c) == *p)) {
+ flen--;
+ if (*f++ == const_cpu_to_le16('.'))
+ dot = TRUE;
+ plen--;
+ p++;
+ }
+ } else {
+ while ((flen > 0) && (plen > 0)
+ && ((*f == *p) || (*p == const_cpu_to_le16('?')))) {
+ flen--;
+ if (*f++ == const_cpu_to_le16('.'))
+ dot = TRUE;
+ plen--;
+ p++;
+ }
+ }
+ if ((flen <= 0) && (plen <= 0))
+ ok = TRUE;
+ else {
+ ok = FALSE;
+ plen--;
+ if (*p++ == const_cpu_to_le16('*')) {
+ /* special case "*.*" requires the end or a dot */
+ anyextens = FALSE;
+ if ((plen == 2)
+ && (p[0] == const_cpu_to_le16('.'))
+ && (p[1] == const_cpu_to_le16('*'))
+ && !dot) {
+ for (i=0; (i<flen) && !anyextens; i++)
+ if (f[i] == const_cpu_to_le16('.'))
+ anyextens = TRUE;
+ }
+ if (!plen || anyextens)
+ ok = TRUE;
+ else
+ while ((flen > 0) && !ok)
+ if (patmatch(re,f,flen,p,plen,dot))
+ ok = TRUE;
+ else {
+ flen--;
+ f++;
+ }
+ }
+ }
+ return (ok);
+}
+
+static int regcomp(regex_t *re, const char *pattern, int flags)
+{
+ regex_t pre;
+ ntfschar *rp;
+ ntfschar *p;
+ unsigned int c;
+ int lth;
+ int i;
+
+ pre = (regex_t)malloc(sizeof(struct REGEX)
+ + strlen(pattern)*sizeof(ntfschar));
+ *re = pre;
+ if (pre) {
+ pre->flags = flags;
+ pre->upcase_len = 0;
+ rp = pre->pattern;
+ lth = ntfs_mbstoucs(pattern, &rp);
+ pre->pattern_len = lth;
+ p = pre->pattern;
+ if (flags & REG_ICASE) {
+ for (i=0; i<lth; i++) {
+ c = le16_to_cpu(*p);
+ if (c < pre->upcase_len)
+ *p = pre->upcase[c];
+ p++;
+ }
+ }
+ }
+ return (*re && (lth > 0) ? 0 : -1);
+}
+
+static int regexec(regex_t *re, const ntfschar *uname, int len,
+ char *q __attribute__((unused)), int r __attribute__((unused)))
+{
+ BOOL m;
+
+ m = patmatch(re, uname, len, (*re)->pattern, (*re)->pattern_len, FALSE);
+ return (m ? REG_NOERROR : REG_NOMATCH);
+}
+
+static void regfree(regex_t *re)
+{
+ free(*re);
+}
+
+#endif
+
+/**
+ * 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 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;
+
+ /* Check whether optarg is available or not */
+ nr_entries = 0;
+ if (optarg == NULL)
+ return (0); /* bailout if no optarg */
+
+ /* init variables */
+ p = strlen(optarg);
+ 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));
+ if (ranges == NULL) {
+ ntfs_log_error("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);
+ p--;
+
+ /* invalid char at begin */
+ if ((opt_arg_ptr == opt_arg_end1) || (opt_arg_ptr == opt_arg_end2)) {
+ ntfs_log_error("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) {
+ ntfs_log_error("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) {
+ ntfs_log_error("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) {
+ ntfs_log_error("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
+ *
+ * Print a copyright statement and a brief description of the program.
+ *
+ * Return: none
+ */
+static void version(void)
+{
+ ntfs_log_info("\n%s v%s (libntfs-3g) - Recover deleted files from an "
+ "NTFS Volume.\n\n", EXEC_NAME, VERSION);
+ ntfs_log_info("Copyright (c) 2002-2005 Richard Russon\n"
+ "Copyright (c) 2004-2005 Holger Ohmacht\n"
+ "Copyright (c) 2005 Anton Altaparmakov\n"
+ "Copyright (c) 2007 Yura Pakhuchiy\n"
+ "Copyright (c) 2013 Jean-Pierre Andre\n");
+ ntfs_log_info("\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)
+{
+ ntfs_log_info("\nUsage: %s [options] device\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"
+ " -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, --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",
+ EXEC_NAME);
+ ntfs_log_info("%s%s\n", ntfs_bugs, ntfs_home);
+}
+
+/**
+ * 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
+ */
+static int transform(const char *pattern, char **regex)
+{
+ char *result;
+ int length, i;
+#ifdef HAVE_REGEX_H
+ int j;
+#endif
+
+ if (!pattern || !regex)
+ return 0;
+
+ length = strlen(pattern);
+ if (length < 1) {
+ ntfs_log_error("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) {
+ ntfs_log_error("Couldn't allocate memory in transform()\n");
+ return 0;
+ }
+
+#ifdef HAVE_REGEX_H
+ 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;
+ ntfs_log_debug("Pattern '%s' replaced with regex '%s'.\n", pattern,
+ result);
+#else
+ strcpy(result, pattern);
+#endif
+
+ *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
+ */
+static int parse_time(const char *value, time_t *since)
+{
+ long long result;
+ time_t now;
+ char *suffix = NULL;
+
+ if (!value || !since)
+ return -1;
+
+ ntfs_log_trace("Parsing time '%s' ago.\n", value);
+
+ result = strtoll(value, &suffix, 10);
+ if (result < 0 || errno == ERANGE) {
+ ntfs_log_error("Invalid time '%s'.\n", value);
+ return 0;
+ }
+
+ if (!suffix) {
+ ntfs_log_error("Internal error, strtoll didn't return a suffix.\n");
+ return 0;
+ }
+
+ if (strlen(suffix) > 1) {
+ ntfs_log_error("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:
+ ntfs_log_error("Invalid time suffix '%s'. Use Y, M, W, D or H.\n", suffix);
+ return 0;
+ }
+
+ now = time(NULL);
+
+ ntfs_log_debug("Time now = %lld, Time then = %lld.\n", (long long) now,
+ (long long) result);
+ *since = now - result;
+ 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
+ */
+static int parse_options(int argc, char *argv[])
+{
+ 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' },
+ { "help", no_argument, NULL, 'h' },
+ { "inodes", required_argument, NULL, 'i' },
+ //{ "interactive", no_argument, NULL, 'I' },
+ { "match", required_argument, NULL, 'm' },
+ { "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' },
+ { "time", required_argument, NULL, 't' },
+ { "truncate", no_argument, NULL, 'T' },
+ { "undelete", no_argument, NULL, 'u' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, 'V' },
+ { NULL, 0, NULL, 0 }
+ };
+
+ int c = -1;
+ char *end = NULL;
+ int err = 0;
+ int ver = 0;
+ int help = 0;
+ int levels = 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 == (char)-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 (!utils_parse_range(optarg,
+ &opts.mft_begin, &opts.mft_end, TRUE))
+ err++;
+ opts.mode = MODE_COPY;
+ } else {
+ opts.mode = MODE_ERROR;
+ }
+ break;
+ case 'd':
+ if (!opts.dest)
+ opts.dest = optarg;
+ else
+ err++;
+ break;
+ case 'f':
+ opts.force++;
+ break;
+ case 'h':
+ case '?':
+ 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)) {
+ err++;
+ } else {
+ /* set regex-flag on true ;) */
+ with_regex= 1;
+ }
+ } else {
+ err++;
+ }
+ break;
+ case 'o':
+ if (!opts.output) {
+ opts.output = optarg;
+ } else {
+ err++;
+ }
+ break;
+ case 'O':
+ if (!opts.optimistic) {
+ opts.optimistic++;
+ } else {
+ err++;
+ }
+ break;
+ case 'P':
+ if (!opts.parent) {
+ opts.parent++;
+ } 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++;
+ ntfs_log_clear_levels(NTFS_LOG_LEVEL_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) ||
+ !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))
+ err++;
+ } else {
+ err++;
+ }
+ break;
+ case 'T':
+ opts.truncate++;
+ break;
+ case 'u':
+ if (opts.mode == MODE_NONE) {
+ opts.mode = MODE_UNDELETE;
+ } else {
+ opts.mode = MODE_ERROR;
+ }
+ break;
+ case 'v':
+ opts.verbose++;
+ ntfs_log_set_levels(NTFS_LOG_LEVEL_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)) {
+ ntfs_log_error("Option '%s' requires an argument.\n", argv[optind-1]);
+ } else {
+ 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)
+ ntfs_log_error("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.truncate ||
+ (opts.fillbyte != (char)-1)) {
+ ntfs_log_error("Scan can only be used with --percent, "
+ "--match, --ignore-case, --size and --time.\n");
+ err++;
+ }
+ if (opts.match_case && !opts.match) {
+ 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)) {
+ ntfs_log_error("Undelete can only be used with "
+ "--output, --destination, --byte and --truncate.\n");
+ err++;
+ }*/
+ break;
+ case MODE_COPY:
+ if ((opts.fillbyte != (char)-1) || opts.truncate ||
+ (opts.percent != -1) ||
+ opts.match || opts.match_case ||
+ (opts.size_begin > 0) ||
+ (opts.size_end > 0)) {
+ ntfs_log_error("Copy can only be used with --output and --destination.\n");
+ err++;
+ }
+ break;
+ default:
+ ntfs_log_error("You can only select one of Scan, Undelete or Copy.\n");
+ err++;
+ }
+
+ if ((opts.percent < -1) || (opts.percent > 100)) {
+ ntfs_log_error("Percentage value must be in the range 0 - 100.\n");
+ err++;
+ }
+
+ if (opts.quiet) {
+ if (opts.verbose) {
+ ntfs_log_error("You may not use --quiet and --verbose at the same time.\n");
+ err++;
+ } else if (opts.mode == MODE_SCAN) {
+ ntfs_log_error("You may not use --quiet when scanning a volume.\n");
+ err++;
+ }
+ }
+
+ if (opts.parent && !opts.verbose) {
+ ntfs_log_error("To use --parent, you must also use --verbose.\n");
+ err++;
+ }
+ }
+
+ if (opts.fillbyte == (char)-1)
+ opts.fillbyte = 0;
+
+ 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
+ */
+static void free_file(struct ufile *file)
+{
+ struct ntfs_list_head *item, *tmp;
+
+ if (!file)
+ return;
+
+ ntfs_list_for_each_safe(item, tmp, &file->name) {
+ /* List of filenames */
+ struct filename *f = ntfs_list_entry(item, struct filename, list);
+ ntfs_log_debug("freeing filename '%s'", f->name ? f->name :
+ NONE);
+ if (f->name)
+ free(f->name);
+ if (f->parent_name) {
+ ntfs_log_debug(" and parent filename '%s'",
+ f->parent_name);
+ free(f->parent_name);
+ }
+ ntfs_log_debug(".\n");
+ free(f);
+ }
+
+ ntfs_list_for_each_safe(item, tmp, &file->data) {
+ /* List of data streams */
+ struct data *d = ntfs_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);
+ if (d->runlist)
+ free(d->runlist);
+ free(d);
+ }
+
+ free(file->mft);
+ 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 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.
+ */
+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) {
+ ntfs_log_error("ERROR: 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 (ntfs2timespec(filename_attr->creation_time).tv_sec > 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) {
+ 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) {
+ ntfs_log_perror("ERROR: Couldn't open $MFT/$DATA");
+ } else {
+ inode_num = MREF_LE(name->parent_mref);
+
+ if (ntfs_attr_pread(mft_data, vol->mft_record_size * inode_num,
+ vol->mft_record_size, rec) < 1) {
+ 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,
+ &name->parent_name, 0) < 0) {
+ ntfs_log_debug("ERROR: 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;
+}
+
+/*
+ * Rescue the last deleted name of a file
+ *
+ * Under some conditions, when a name is deleted and the MFT
+ * record is shifted to reclaim the space, the name is still
+ * present beyond the end of record.
+ *
+ * For this to be possible, the data record has to be small (less
+ * than 80 bytes), and there must be no other attributes.
+ * So only the names of plain unfragmented files can be rescued.
+ *
+ * Returns NULL when the name cannot be recovered.
+ */
+
+static struct filename *rescue_name(MFT_RECORD *mft, ntfs_attr_search_ctx *ctx)
+{
+ ATTR_RECORD *rec;
+ struct filename *name;
+ int off_name;
+ int length;
+ int type;
+
+ name = (struct filename*)NULL;
+ ntfs_attr_reinit_search_ctx(ctx);
+ rec = find_attribute(AT_DATA, ctx);
+ if (rec) {
+ /*
+ * If the data attribute replaced the name attribute,
+ * the name itself is at offset 0x58 from the data attr.
+ * First be sure this location is within the unused part
+ * of the MFT record, then make extra checks.
+ */
+ off_name = (long)rec - (long)mft + 0x58;
+ if ((off_name >= (int)le32_to_cpu(mft->bytes_in_use))
+ && ((off_name + 4)
+ <= (int)le32_to_cpu(mft->bytes_allocated))) {
+ length = *((char*)mft + off_name);
+ type = *((char*)mft + off_name + 1);
+ /* check whether the name is fully allocated */
+ if ((type <= 3)
+ && (length > 0)
+ && ((off_name + 2*length + 2)
+ <= (int)le32_to_cpu(mft->bytes_allocated))) {
+ /* create a (partial) name record */
+ name = (struct filename*)
+ ntfs_calloc(sizeof(*name));
+ if (name) {
+ name->uname = (ntfschar*)
+ ((char*)mft + off_name + 2);
+ name->uname_len = length;
+ name->name_space = type;
+ if (ntfs_ucstombs(name->uname, length,
+ &name->name, 0) < 0) {
+ free(name);
+ name = (struct filename*)NULL;
+ }
+ }
+ if (name && name->name)
+ ntfs_log_verbose("Recovered file name %s\n",
+ name->name);
+ }
+ }
+ }
+ return (name);
+}
+
+
+
+/**
+ * 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
+ */
+static int get_filenames(struct ufile *file, ntfs_volume* vol)
+{
+ 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_attr_get_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) {
+ ntfs_log_error("ERROR: 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 = ntfs2timespec(attr->creation_time).tv_sec;
+ name->date_a = ntfs2timespec(attr->last_data_change_time).tv_sec;
+ name->date_m = ntfs2timespec(attr->last_mft_change_time).tv_sec;
+ name->date_r = ntfs2timespec(attr->last_access_time).tv_sec;
+
+ if (ntfs_ucstombs(name->uname, name->uname_len, &name->name,
+ 0) < 0) {
+ ntfs_log_debug("ERROR: 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;
+ }
+
+ file->max_size = max(file->max_size, name->size_alloc);
+ file->max_size = max(file->max_size, name->size_data);
+
+ ntfs_list_add_tail(&name->list, &file->name);
+ count++;
+ }
+
+ if (!count) {
+ name = rescue_name(file->mft,ctx);
+ if (name) {
+ /* a name was recovered, get missing attributes */
+ file->pref_name = name->name;
+ ntfs_attr_reinit_search_ctx(ctx);
+ rec = find_attribute(AT_STANDARD_INFORMATION, ctx);
+ if (rec) {
+ attr = (FILE_NAME_ATTR *)((char *)rec +
+ le16_to_cpu(rec->value_offset));
+ name->flags = attr->file_attributes;
+
+ name->date_c = ntfs2timespec(attr->creation_time).tv_sec;
+ name->date_a = ntfs2timespec(attr->last_data_change_time).tv_sec;
+ name->date_m = ntfs2timespec(attr->last_mft_change_time).tv_sec;
+ name->date_r = ntfs2timespec(attr->last_access_time).tv_sec;
+ }
+ rec = find_attribute(AT_DATA, ctx);
+ if (rec) {
+ attr = (FILE_NAME_ATTR *)((char *)rec +
+ le16_to_cpu(rec->value_offset));
+ name->size_alloc = sle64_to_cpu(attr->allocated_size);
+ name->size_data = sle64_to_cpu(attr->data_size);
+ }
+ ntfs_list_add_tail(&name->list, &file->name);
+ count++;
+ }
+ }
+ ntfs_attr_put_search_ctx(ctx);
+ ntfs_log_debug("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
+ */
+static 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_attr_get_search_ctx(NULL, file->mft);
+ if (!ctx)
+ return -1;
+
+ while ((rec = find_attribute(AT_DATA, ctx))) {
+ data = calloc(1, sizeof(*data));
+ if (!data) {
+ ntfs_log_error("ERROR: Couldn't allocate memory in "
+ "get_data().\n");
+ count = -1;
+ break;
+ }
+
+ data->resident = !rec->non_resident;
+ data->compressed = (rec->flags & ATTR_IS_COMPRESSED) ? 1 : 0;
+ data->encrypted = (rec->flags & ATTR_IS_ENCRYPTED) ? 1 : 0;
+
+ if (rec->name_length) {
+ 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, 0) < 0) {
+ ntfs_log_error("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);
+ } 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->runlist = ntfs_mapping_pairs_decompress(vol, rec, NULL);
+ if (!data->runlist) {
+ 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);
+
+ ntfs_list_add_tail(&data->list, &file->data);
+ count++;
+ }
+
+ ntfs_attr_put_search_ctx(ctx);
+ ntfs_log_debug("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
+ */
+static struct ufile * read_record(ntfs_volume *vol, long long record)
+{
+ ATTR_RECORD *attr10, *attr20, *attr90;
+ struct ufile *file;
+ ntfs_attr *mft;
+ u32 log_levels;
+
+ if (!vol)
+ return NULL;
+
+ file = calloc(1, sizeof(*file));
+ if (!file) {
+ ntfs_log_error("ERROR: Couldn't allocate memory in read_record()\n");
+ return NULL;
+ }
+
+ NTFS_INIT_LIST_HEAD(&file->name);
+ NTFS_INIT_LIST_HEAD(&file->data);
+ file->inode = record;
+
+ file->mft = malloc(vol->mft_record_size);
+ if (!file->mft) {
+ 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) {
+ 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) {
+ ntfs_log_error("ERROR: Couldn't read MFT Record %lld.\n", record);
+ ntfs_attr_close(mft);
+ free_file(file);
+ return NULL;
+ }
+
+ ntfs_attr_close(mft);
+ mft = NULL;
+
+ /* disable errors logging, while examining suspicious records */
+ log_levels = ntfs_log_clear_levels(NTFS_LOG_LEVEL_PERROR);
+ 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 = ntfs2timespec(si->last_data_change_time).tv_sec;
+ }
+
+ if (attr20 || !attr10)
+ file->attr_list = 1;
+ if (attr90)
+ file->directory = 1;
+
+ if (get_filenames(file, vol) < 0) {
+ ntfs_log_error("ERROR: Couldn't get filenames.\n");
+ }
+ if (get_data(file, vol) < 0) {
+ ntfs_log_error("ERROR: Couldn't get data streams.\n");
+ }
+ /* restore errors logging */
+ ntfs_log_set_levels(log_levels);
+
+ return file;
+}
+
+/**
+ * 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
+ */
+static int calc_percentage(struct ufile *file, ntfs_volume *vol)
+{
+ runlist_element *rl = NULL;
+ struct ntfs_list_head *pos;
+ struct data *data;
+ long long i, j;
+ long long start, end;
+ int clusters_inuse, clusters_free;
+ int percent = 0;
+
+ if (!file || !vol)
+ return -1;
+
+ if (file->directory) {
+ ntfs_log_debug("Found a directory: not recoverable.\n");
+ return 0;
+ }
+
+ if (ntfs_list_empty(&file->data)) {
+ ntfs_log_verbose("File has no data streams.\n");
+ return 0;
+ }
+
+ ntfs_list_for_each(pos, &file->data) {
+ data = ntfs_list_entry(pos, struct data, list);
+ clusters_inuse = 0;
+ clusters_free = 0;
+
+ if (data->encrypted) {
+ ntfs_log_verbose("File is encrypted, recovery is "
+ "impossible.\n");
+ continue;
+ }
+
+ if (data->compressed) {
+ ntfs_log_verbose("File is compressed, recovery not yet "
+ "implemented.\n");
+ continue;
+ }
+
+ if (data->resident) {
+ ntfs_log_verbose("File is resident, therefore "
+ "recoverable.\n");
+ percent = 100;
+ data->percent = 100;
+ continue;
+ }
+
+ rl = data->runlist;
+ if (!rl) {
+ ntfs_log_verbose("File has no runlist, hence no data."
+ "\n");
+ continue;
+ }
+
+ if (rl[0].length <= 0) {
+ ntfs_log_verbose("File has an empty runlist, hence no "
+ "data.\n");
+ continue;
+ }
+
+ if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */
+ ntfs_log_verbose("Missing segment at beginning, %lld "
+ "clusters\n", (long long)rl[0].length);
+ clusters_inuse += rl[0].length;
+ rl++;
+ }
+
+ for (i = 0; rl[i].length > 0; i++) {
+ if (rl[i].lcn == LCN_RL_NOT_MAPPED) {
+ ntfs_log_verbose("Missing segment at end, %lld "
+ "clusters\n",
+ (long long)rl[i].length);
+ clusters_inuse += rl[i].length;
+ continue;
+ }
+
+ if (rl[i].lcn == LCN_HOLE) {
+ clusters_free += rl[i].length;
+ continue;
+ }
+
+ start = rl[i].lcn;
+ end = rl[i].lcn + rl[i].length;
+
+ for (j = start; j < end; j++) {
+ if (utils_cluster_in_use(vol, j))
+ clusters_inuse++;
+ else
+ clusters_free++;
+ }
+ }
+
+ if ((clusters_inuse + clusters_free) == 0) {
+ ntfs_log_error("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);
+ }
+
+ ntfs_log_verbose("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, "<none>" will be displayed.
+ *
+ * Return: none
+ */
+static void dump_record(struct ufile *file)
+{
+ char buffer[20];
+ struct ntfs_list_head *item;
+ int i;
+
+ if (!file)
+ return;
+
+ 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));
+ ntfs_log_quiet("Date: %s\n", buffer);
+
+ if (file->attr_list)
+ ntfs_log_quiet("Metadata may span more than one MFT record\n");
+
+ ntfs_list_for_each(item, &file->name) {
+ struct filename *f =
+ ntfs_list_entry(item, struct filename, list);
+
+ 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))) {
+ ntfs_log_quiet("%s", NONE);
+ }
+
+ ntfs_log_quiet("\n");
+
+ if (opts.parent) {
+ ntfs_log_quiet("Parent: %s\n", f->parent_name ?
+ f->parent_name : "<non-determined>");
+ }
+
+ 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));
+ ntfs_log_quiet("Date C: %s\n", buffer);
+ strftime(buffer, sizeof(buffer), "%F %R",
+ localtime(&f->date_a));
+ ntfs_log_quiet("Date A: %s\n", buffer);
+ strftime(buffer, sizeof(buffer), "%F %R",
+ localtime(&f->date_m));
+ ntfs_log_quiet("Date M: %s\n", buffer);
+ strftime(buffer, sizeof(buffer), "%F %R",
+ localtime(&f->date_r));
+ ntfs_log_quiet("Date R: %s\n", buffer);
+ }
+
+ ntfs_log_quiet("Data Streams:\n");
+ ntfs_list_for_each(item, &file->data) {
+ struct data *d = ntfs_list_entry(item, struct data, list);
+ 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)
+ ntfs_log_quiet("None\n");
+ else
+ ntfs_log_quiet("\n");
+
+ 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);
+
+ ntfs_log_quiet("Data runs:\n");
+ if ((!d->runlist) || (d->runlist[0].length <= 0)) {
+ ntfs_log_quiet(" None\n");
+ } else {
+ for (i = 0; d->runlist[i].length > 0; i++) {
+ ntfs_log_quiet(" %lld @ %lld\n",
+ (long long)d->runlist[i].length,
+ (long long)d->runlist[i].lcn);
+ }
+ }
+
+ ntfs_log_quiet("Amount potentially recoverable %d%%\n",
+ d->percent);
+ }
+
+ ntfs_log_quiet("________________________________________\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 Time 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, "<none>" will be displayed.
+ *
+ * Return: none
+ */
+static void list_record(struct ufile *file)
+{
+ char buffer[20];
+ struct ntfs_list_head *item;
+ const char *name = NULL;
+ long long size = 0;
+ int percent = 0;
+
+ char flagd = '.', flagr = '.', flagc = '.', flagx = '.';
+
+ strftime(buffer, sizeof(buffer), "%F %R", localtime(&file->date));
+
+ if (file->attr_list)
+ flagx = '!';
+
+ if (file->directory)
+ flagd = 'D';
+ else
+ flagd = 'F';
+
+ ntfs_list_for_each(item, &file->data) {
+ struct data *d = ntfs_list_entry(item, struct data, list);
+
+ if (!d->name) {
+ if (d->resident)
+ flagr = 'R';
+ else
+ flagr = 'N';
+ if (d->compressed)
+ flagc = 'C';
+ 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;
+
+ ntfs_log_quiet("%-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.
+ */
+static int name_match(regex_t *re, struct ufile *file)
+{
+ struct ntfs_list_head *item;
+ int result;
+
+ if (!re || !file)
+ return 0;
+
+ ntfs_list_for_each(item, &file->name) {
+ struct filename *f =
+ ntfs_list_entry(item, struct filename, list);
+
+ if (!f->name)
+ continue;
+#ifdef HAVE_REGEX_H
+ result = regexec(re, f->name, 0, NULL, 0);
+#else
+ result = regexec(re, f->uname, f->uname_len, NULL, 0);
+#endif
+ if (result < 0) {
+ ntfs_log_perror("Couldn't compare filename with regex");
+ return 0;
+ } else if (result == REG_NOERROR) {
+ ntfs_log_debug("Found a matching filename.\n");
+ return 1;
+ }
+ }
+
+ ntfs_log_debug("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
+ */
+static 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;
+}
+
+/**
+ * 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 filename from various pieces. The output will be of the form:
+ * dir/file
+ * dir/file:stream
+ * file
+ * file:stream
+ *
+ * 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
+ */
+static int create_pathname(const char *dir, const char *name,
+ const char *stream, char *buffer, int bufsize)
+{
+ if (!name)
+ name = UNKNOWN;
+
+ if (dir)
+ if (stream)
+ snprintf(buffer, bufsize, "%s/%s:%s", dir, name, stream);
+ else
+ snprintf(buffer, bufsize, "%s/%s", dir, name);
+ else
+ if (stream)
+ snprintf(buffer, bufsize, "%s:%s", name, stream);
+ else
+ snprintf(buffer, bufsize, "%s", name);
+
+ 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
+ */
+static int open_file(const char *pathname)
+{
+ int flags;
+
+ ntfs_log_verbose("Creating file: %s\n", pathname);
+
+ if (opts.force)
+ flags = O_RDWR | O_CREAT | O_TRUNC;
+ else
+ flags = O_RDWR | O_CREAT | O_EXCL;
+#ifdef HAVE_WINDOWS_H
+ flags ^= O_BINARY | O_RDWR | O_WRONLY;
+#endif
+
+ 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
+ */
+static 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)) {
+ ntfs_log_error("ERROR: Couldn't set the file's date and time\n");
+ return 0;
+ }
+ return 1;
+}
+
+/**
+ * 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
+ */
+static 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;
+ runlist_element *rl;
+ struct ntfs_list_head *item;
+ int fd = -1;
+ long long k;
+ int result = 0;
+ char *name;
+ long long cluster_count; /* I'll need this variable (see below). +mabs */
+
+ if (!vol)
+ return 0;
+
+ /* try to get record */
+ file = read_record(vol, inode);
+ if (!file || !file->mft) {
+ ntfs_log_error("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);
+ //ntfs_log_quiet("\n");
+ }
+ }
+
+ bufsize = vol->cluster_size;
+ buffer = malloc(bufsize);
+ if (!buffer)
+ goto free;
+
+ /* 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);
+ return 0;
+ }
+ ntfs_log_verbose("Forced to continue.\n");
+ }
+
+ if (calc_percentage(file, vol) == 0) {
+ ntfs_log_quiet("File has no recoverable data.\n");
+ goto free;
+ }
+
+ if (ntfs_list_empty(&file->data)) {
+ ntfs_log_quiet("File has no data. There is nothing to recover.\n");
+ goto free;
+ }
+
+ ntfs_list_for_each(item, &file->data) {
+ struct data *d = ntfs_list_entry(item, struct data, list);
+ char defname[sizeof(UNKNOWN) + 25];
+
+ if (opts.output)
+ name = opts.output;
+ else
+ if (file->pref_name)
+ name = file->pref_name;
+ else {
+ sprintf(defname,"%s%lld",UNKNOWN,
+ (long long)file->inode);
+ name = defname;
+ }
+
+ create_pathname(opts.dest, name, d->name, pathname, sizeof(pathname));
+ if (d->resident) {
+ fd = open_file(pathname);
+ if (fd < 0) {
+ ntfs_log_perror("Couldn't create file");
+ goto free;
+ }
+
+ ntfs_log_verbose("File has resident data.\n");
+ if (write_data(fd, d->data, d->size_data) < d->size_data) {
+ ntfs_log_perror("Write failed");
+ close(fd);
+ goto free;
+ }
+
+ if (close(fd) < 0) {
+ ntfs_log_perror("Close failed");
+ }
+ fd = -1;
+ } else {
+ rl = d->runlist;
+ if (!rl) {
+ ntfs_log_verbose("File has no runlist, hence no data.\n");
+ continue;
+ }
+
+ if (rl[0].length <= 0) {
+ ntfs_log_verbose("File has an empty runlist, hence no data.\n");
+ continue;
+ }
+
+ fd = open_file(pathname);
+ if (fd < 0) {
+ ntfs_log_perror("Couldn't create output file");
+ goto free;
+ }
+
+ if (rl[0].lcn == LCN_RL_NOT_MAPPED) { /* extended mft record */
+ 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) {
+ ntfs_log_perror("Write failed");
+ close(fd);
+ goto free;
+ }
+ }
+ }
+
+ cluster_count = 0LL;
+ for (i = 0; rl[i].length > 0; i++) {
+
+ if (rl[i].lcn == LCN_RL_NOT_MAPPED) {
+ 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[i].length * vol->cluster_size; k += bufsize) {
+ if (write_data(fd, buffer, bufsize) < bufsize) {
+ ntfs_log_perror("Write failed");
+ close(fd);
+ goto free;
+ }
+ cluster_count++;
+ }
+ continue;
+ }
+
+ if (rl[i].lcn == LCN_HOLE) {
+ ntfs_log_verbose("File has a sparse section.\n");
+ memset(buffer, 0, bufsize);
+ for (k = 0; k < rl[i].length * vol->cluster_size; k += bufsize) {
+ if (write_data(fd, buffer, bufsize) < bufsize) {
+ ntfs_log_perror("Write failed");
+ close(fd);
+ goto free;
+ }
+ }
+ continue;
+ }
+
+ start = rl[i].lcn;
+ 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) {
+ ntfs_log_perror("Write failed");
+ close(fd);
+ goto free;
+ }
+ } else {
+ if (ntfs_cluster_read(vol, j, 1, buffer) < 1) {
+ ntfs_log_perror("Read failed");
+ close(fd);
+ goto free;
+ }
+ if (write_data(fd, buffer, bufsize) < bufsize) {
+ ntfs_log_perror("Write failed");
+ close(fd);
+ goto free;
+ }
+ cluster_count++;
+ }
+ }
+ }
+ ntfs_log_quiet("\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))
+ ntfs_log_perror("Truncation failed");
+ } else ntfs_log_quiet("Truncation not performed because file has an "
+ "inconsistent $MFT record.\n");
+ }
+
+ if (close(fd) < 0) {
+ ntfs_log_perror("Close failed");
+ }
+ fd = -1;
+
+ }
+ set_date(pathname, file->date);
+ if (d->name)
+ ntfs_log_quiet("Undeleted '%s:%s' successfully.\n", file->pref_name, d->name);
+ else
+ ntfs_log_quiet("Undeleted '%s' successfully.\n", file->pref_name);
+ }
+ result = 1;
+free:
+ if (buffer)
+ free(buffer);
+ free_file(file);
+ 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;
+ long long i;
+ int 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) {
+ ntfs_log_perror("ERROR: Couldn't open $MFT/$BITMAP");
+ return -1;
+ }
+ NVolSetNoFixupWarn(vol);
+ bmpsize = attr->initialized_size;
+
+ buffer = malloc(BUFSIZE);
+ if (!buffer) {
+ ntfs_log_error("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)) {
+ ntfs_log_error("ERROR: Couldn't create a regex.\n");
+ goto out;
+ }
+#ifndef HAVE_REGEX_H
+ re->upcase = vol->upcase;
+ re->upcase_len = vol->upcase_len;
+#endif
+ }
+
+ nr_mft_records = vol->mft_na->initialized_size >>
+ vol->mft_record_size_bits;
+
+ ntfs_log_quiet("Inode Flags %%age Date Time 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);
+ 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) {
+ ntfs_log_error("Couldn't read MFT Record %lld.\n",
+ (long long)(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))
+ ntfs_log_verbose("ERROR: Failed to undelete "
+ "inode %lli\n!",
+ file->inode);
+ ntfs_log_info("\n");
+ }
+ }
+ if (((opts.percent == -1) && (percent > 0)) ||
+ ((opts.percent > 0) && (percent >= opts.percent))) {
+ results++;
+ }
+skip:
+ free_file(file);
+ }
+ }
+ }
+done:
+ ntfs_log_quiet("\nFiles with potentially recoverable content: %d\n",
+ results);
+out:
+ if (opts.match)
+ regfree(&re);
+ free(buffer);
+ NVolClearNoFixupWarn(vol);
+ 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
+ * @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
+ */
+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;
+ const char *name;
+ long long i;
+ int result = 1;
+ int fd;
+
+ if (!vol)
+ return 1;
+
+ if (mft_end < mft_begin) {
+ ntfs_log_error("Range to copy is backwards.\n");
+ return 1;
+ }
+
+ buffer = malloc(vol->mft_record_size);
+ if (!buffer) {
+ 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) {
+ ntfs_log_perror("Couldn't open $MFT/$DATA");
+ goto free;
+ }
+
+ name = opts.output;
+ if (!name) {
+ name = MFTFILE;
+ ntfs_log_debug("No output filename, defaulting to '%s'.\n",
+ name);
+ }
+
+ create_pathname(opts.dest, name, NULL, pathname, sizeof(pathname));
+ fd = open_file(pathname);
+ if (fd < 0) {
+ ntfs_log_perror("Couldn't open output file '%s'", name);
+ goto attr;
+ }
+
+ nr_mft_records = vol->mft_na->initialized_size >>
+ vol->mft_record_size_bits;
+
+ mft_end = min(mft_end, nr_mft_records - 1);
+
+ 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) {
+ 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) {
+ ntfs_log_perror("Write failed");
+ goto close;
+ }
+ }
+
+ ntfs_log_verbose("Read %lld MFT Records\n", mft_end - mft_begin + 1);
+ result = 0;
+close:
+ close(fd);
+attr:
+ ntfs_attr_close(mft);
+free:
+ free(buffer);
+ return result;
+}
+
+/**
+ * handle_undelete
+ *
+ * Handles the undelete
+ */
+static 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) {
+ ntfs_log_error("ERROR: NO inode(s) AND NO match-regex "
+ "specified!\n");
+ } else {
+ avoid_duplicate_printing= 1;
+ result = !scan_disk(vol);
+ if (result)
+ ntfs_log_verbose("ERROR: Failed to scan device "
+ "'%s'.\n", opts.device);
+ }
+ } else {
+ /* Normal undelete by specifying inode(s) */
+ 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++) {
+ for (inode = ranges[i].begin; inode <= ranges[i].end; inode ++) {
+ /* Now undelete file */
+ result = !undelete_file(vol, inode);
+ if (result)
+ ntfs_log_verbose("ERROR: Failed to "
+ "undelete inode %lli\n!", inode);
+ }
+ }
+ }
+ 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[])
+{
+ ntfs_volume *vol;
+ int result = 1;
+
+ ntfs_log_set_handler(ntfs_log_handler_outerr);
+
+ with_regex = 0;
+ avoid_duplicate_printing = 0;
+
+ if (!parse_options(argc, argv))
+ goto free;
+
+ utils_set_locale();
+
+ vol = utils_mount_volume(opts.device, NTFS_MNT_RDONLY |
+ (opts.force ? NTFS_MNT_RECOVER : 0));
+ if (!vol)
+ return 1;
+
+ /* handling of the different modes */
+ switch (opts.mode) {
+ /* Scanning */
+ case MODE_SCAN:
+ result = !scan_disk(vol);
+ if (result)
+ ntfs_log_verbose("ERROR: Failed to scan device '%s'.\n",
+ opts.device);
+ break;
+
+ /* Undelete-handling */
+ case MODE_UNDELETE:
+ result= handle_undelete(vol);
+ break;
+
+ /* Handling of copy mft */
+ case MODE_COPY:
+ result = !copy_mft(vol, opts.mft_begin, opts.mft_end);
+ if (result)
+ ntfs_log_verbose("ERROR: Failed to read MFT blocks "
+ "%lld-%lld.\n", (long long)opts.mft_begin,
+ (long long)min((vol->mft_na->initialized_size >>
+ vol->mft_record_size_bits) , opts.mft_end));
+ break;
+ default:
+ ; /* Cannot happen */
+ }
+
+ ntfs_umount(vol, FALSE);
+free:
+ if (opts.match)
+ free(opts.match);
+
+ return result;
+}
+
diff --git a/ntfsprogs/ntfsundelete.h b/ntfsprogs/ntfsundelete.h
new file mode 100755
index 0000000..dd462f2
--- a/dev/null
+++ b/ntfsprogs/ntfsundelete.h
@@ -0,0 +1,112 @@
+/*
+ * ntfsundelete - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2002 Richard Russon
+ * Copyright (c) 2007 Yura Pakhuchiy
+ *
+ * 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"
+#include "utils.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 *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 */
+ 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;
+ s64 mft_begin; /* Range for mft copy */
+ s64 mft_end;
+ char fillbyte; /* Use for unrecoverable sections */
+};
+
+struct filename {
+ struct ntfs_list_head list; /* Previous/Next links */
+ 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 */
+ FILE_ATTR_FLAGS flags;
+ time_t date_c; /* Time created */
+ 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;
+ leMFT_REF parent_mref;
+ char *parent_name;
+};
+
+struct data {
+ struct ntfs_list_head list; /* Previous/Next links */
+ char *name; /* Stream name in current locale */
+ ntfschar *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 */
+ runlist_element *runlist; /* Decoded data runs */
+ int percent; /* Amount 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 ntfs_list_head name; /* A list of filenames */
+ struct ntfs_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 */
+ MFT_RECORD *mft; /* Raw MFT record */
+};
+
+#endif /* _NTFSUNDELETE_H_ */
+
diff --git a/ntfsprogs/ntfswipe.c b/ntfsprogs/ntfswipe.c
new file mode 100755
index 0000000..e432897
--- a/dev/null
+++ b/ntfsprogs/ntfswipe.c
@@ -0,0 +1,2131 @@
+/**
+ * ntfswipe - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2005 Anton Altaparmakov
+ * Copyright (c) 2002-2005 Richard Russon
+ * Copyright (c) 2004 Yura Pakhuchiy
+ *
+ * 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
+ * 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"
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+#ifdef HAVE_GETOPT_H
+#include <getopt.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#else
+#ifdef HAVE_MALLOC_H
+#include <malloc.h>
+#endif
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_TIME_H
+#include <time.h>
+#endif
+
+#include "ntfswipe.h"
+#include "types.h"
+#include "volume.h"
+#include "utils.h"
+#include "debug.h"
+#include "dir.h"
+#include "mst.h"
+/* #include "version.h" */
+#include "logging.h"
+#include "list.h"
+#include "mft.h"
+
+static const char *EXEC_NAME = "ntfswipe";
+static struct options opts;
+static unsigned long int npasses = 0;
+
+struct filename {
+ char *parent_name;
+ struct ntfs_list_head list; /* Previous/Next links */
+ ntfschar *uname; /* Filename in unicode */
+ int uname_len; /* and its length */
+ /* Allocated size (multiple of cluster size) */
+ s64 size_alloc;
+ s64 size_data; /* Actual size of data */
+ long long parent_mref;
+ FILE_ATTR_FLAGS flags;
+ time_t date_c; /* Time created */
+ 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 {
+ struct ntfs_list_head list; /* Previous/Next links */
+ char *name; /* Stream name in current locale */
+ ntfschar *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 */
+ /* Allocated size (multiple of cluster size) */
+ s64 size_alloc;
+ s64 size_data; /* Actual size of data */
+ /* Initialised size, may be less than data size */
+ s64 size_init;
+ VCN size_vcn; /* Highest VCN in the data runs */
+ runlist_element *runlist; /* Decoded data runs */
+ int percent; /* Amount potentially recoverable */
+ void *data; /* If resident, a pointer to the data */
+ char padding[4]; /* Unused: padding to 64 bit. */
+};
+
+struct ufile {
+ s64 inode; /* MFT record number */
+ time_t date; /* Last modification date/time */
+ struct ntfs_list_head name; /* A list of filenames */
+ struct ntfs_list_head data; /* A list of data streams */
+ char *pref_name; /* Preferred filename */
+ char *pref_pname; /* parent filename */
+ s64 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 */
+ char padding[4]; /* Unused: padding to 64 bit. */
+};
+
+#define NPAT 22
+
+/* Taken from `shred' source */
+static const unsigned int patterns[NPAT] = {
+ 0x000, 0xFFF, /* 1-bit */
+ 0x555, 0xAAA, /* 2-bit */
+ 0x249, 0x492, 0x6DB, 0x924, 0xB6D, 0xDB6, /* 3-bit */
+ 0x111, 0x222, 0x333, 0x444, 0x666, 0x777,
+ 0x888, 0x999, 0xBBB, 0xCCC, 0xDDD, 0xEEE /* 4-bit */
+};
+
+
+/**
+ * version - Print version information about the program
+ *
+ * Print a copyright statement and a brief description of the program.
+ *
+ * Return: none
+ */
+static void version(void)
+{
+ ntfs_log_info("\n%s v%s (libntfs-3g) - Overwrite the unused space on an NTFS "
+ "Volume.\n\n", EXEC_NAME, VERSION);
+ 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);
+}
+
+/**
+ * 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)
+{
+ ntfs_log_info("\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"
+ " -s --undel Wipe undelete data\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);
+ ntfs_log_info("%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
+ */
+static int parse_list(char *list, int **result)
+{
+ 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) {
+ ntfs_log_error("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))) {
+ ntfs_log_error("Invalid list '%s'\n", list);
+ free(mem);
+ return 0;
+ }
+
+ if ((mem[i] < 0) || (mem[i] > 255)) {
+ ntfs_log_error("Bytes must be in range 0-255.\n");
+ free(mem);
+ return 0;
+ }
+
+ ptr = end + 1;
+ }
+
+ ntfs_log_debug("Parsing list '%s' - ", list);
+ for (i = 0; i <= count; i++)
+ ntfs_log_debug("0x%02x ", mem[i]);
+ ntfs_log_debug("\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
+ */
+static int parse_options(int argc, char *argv[])
+{
+ static const char *sopt = "-ab:c:dfh?ilmnpqtuvVs";
+ static 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' },
+ //{ "no-wait", no_argument, NULL, 0 },
+ { "pagefile", no_argument, NULL, 'p' },
+ { "quiet", no_argument, NULL, 'q' },
+ { "tails", no_argument, NULL, 't' },
+ { "unused", no_argument, NULL, 'u' },
+ { "undel", no_argument, NULL, 's' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, 'V' },
+ { NULL, 0, NULL, 0 }
+ };
+
+ int c = -1;
+ char *end;
+ int err = 0;
+ int ver = 0;
+ int help = 0;
+ int levels = 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++;
+ opts.undel++;
+ break;
+ case 'b':
+ if (!opts.bytes) {
+ if (!parse_list(optarg, &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 '?':
+ if (strncmp (argv[optind-1], "--log-", 6) == 0) {
+ if (!ntfs_log_parse_option (argv[optind-1]))
+ err++;
+ break;
+ }
+ 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++;
+ ntfs_log_clear_levels(NTFS_LOG_LEVEL_QUIET);
+ break;
+ case 's':
+ opts.undel++;
+ break;
+ case 't':
+ opts.tails++;
+ break;
+ case 'u':
+ opts.unused++;
+ break;
+ case 'v':
+ opts.verbose++;
+ ntfs_log_set_levels(NTFS_LOG_LEVEL_VERBOSE);
+ break;
+ case 'V':
+ ver++;
+ break;
+ default:
+ if ((optopt == 'b') || (optopt == 'c')) {
+ ntfs_log_error("Option '%s' requires an argument.\n", argv[optind-1]);
+ } else {
+ 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)
+ ntfs_log_error("You must specify exactly one device.\n");
+ err++;
+ }
+
+ if (opts.quiet && opts.verbose) {
+ 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)) {
+ ntfs_log_error("You may not use any other options with --info.\n");
+ err++;
+ }
+ */
+
+ if ((opts.count < 1) || (opts.count > 100)) {
+ ntfs_log_error("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 {
+ ntfs_log_error("Couldn't allocate memory for byte list.\n");
+ err++;
+ }
+ }
+
+ if (!opts.directory && !opts.logfile && !opts.mft &&
+ !opts.pagefile && !opts.tails && !opts.unused &&
+ !opts.undel) {
+ 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
+ * @byte: Overwrite with this value
+ * @act: Wipe, test or info
+ *
+ * Read $Bitmap and wipe any clusters that are marked as not in use.
+ *
+ * Return: >0 Success, the attribute was wiped
+ * 0 Nothing to wipe
+ * -1 Error, something went wrong
+ */
+static s64 wipe_unused(ntfs_volume *vol, int byte, enum action act)
+{
+ s64 i;
+ s64 total = 0;
+ s64 result = 0;
+ u8 *buffer = NULL;
+
+ if (!vol || (byte < 0))
+ return -1;
+
+ if (act != act_info) {
+ buffer = malloc(vol->cluster_size);
+ if (!buffer) {
+ ntfs_log_error("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)) {
+ //ntfs_log_verbose("cluster %lld is in use\n", i);
+ continue;
+ }
+
+ if (act == act_wipe) {
+ //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) {
+ ntfs_log_error("write failed\n");
+ goto free;
+ }
+ }
+
+ total += vol->cluster_size;
+ }
+
+ ntfs_log_quiet("wipe_unused 0x%02x, %lld bytes\n", byte, (long long)total);
+free:
+ free(buffer);
+ 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
+ * @na: Opened ntfs attribute
+ *
+ * Return: >0 Success, the attribute was wiped
+ * 0 Nothing to wipe
+ * -1 Error, something went wrong
+ */
+static s64 wipe_compressed_attribute(ntfs_volume *vol, int byte,
+ enum action act, ntfs_attr *na)
+{
+ unsigned char *buf;
+ s64 size, offset, ret, wiped = 0;
+ le16 block_size_le;
+ u16 block_size;
+ VCN cur_vcn = 0;
+ runlist_element *rlc = na->rl;
+ s64 cu_mask = na->compression_block_clusters - 1;
+ runlist_element *restart = na->rl;
+
+ while (rlc->length) {
+ cur_vcn += rlc->length;
+ if ((cur_vcn & cu_mask) ||
+ (((rlc + 1)->length) && (rlc->lcn != LCN_HOLE))) {
+ rlc++;
+ continue;
+ }
+
+ if (rlc->lcn == LCN_HOLE) {
+ runlist_element *rlt;
+
+ offset = cur_vcn - rlc->length;
+ if (offset == (offset & (~cu_mask))) {
+ restart = rlc + 1;
+ rlc++;
+ continue;
+ }
+ offset = (offset & (~cu_mask))
+ << vol->cluster_size_bits;
+ rlt = rlc;
+ while ((rlt - 1)->lcn == LCN_HOLE) rlt--;
+ while (1) {
+ ret = ntfs_rl_pread(vol, restart,
+ offset - (restart->vcn
+ << vol->cluster_size_bits),
+ 2, &block_size_le);
+ block_size = le16_to_cpu(block_size_le);
+ if (ret != 2) {
+ ntfs_log_verbose("Internal error\n");
+ ntfs_log_error("ntfs_rl_pread failed");
+ return -1;
+ }
+ if (block_size == 0) {
+ offset += 2;
+ break;
+ }
+ block_size &= 0x0FFF;
+ block_size += 3;
+ offset += block_size;
+ if (offset >= (((rlt->vcn) <<
+ vol->cluster_size_bits) - 2))
+ goto next;
+ }
+ size = (rlt->vcn << vol->cluster_size_bits) - offset;
+ } else {
+ size = na->allocated_size - na->data_size;
+ offset = (cur_vcn << vol->cluster_size_bits) - size;
+ }
+
+ if (size < 0) {
+ ntfs_log_verbose("Internal error\n");
+ ntfs_log_error("bug or damaged fs: we want "
+ "allocate buffer size %lld bytes",
+ (long long)size);
+ return -1;
+ }
+
+ if ((act == act_info) || (!size)) {
+ wiped += size;
+ if (rlc->lcn == LCN_HOLE)
+ restart = rlc + 1;
+ rlc++;
+ continue;
+ }
+
+ buf = malloc(size);
+ if (!buf) {
+ ntfs_log_verbose("Not enough memory\n");
+ ntfs_log_error("Not enough memory to allocate "
+ "%lld bytes",
+ (long long)size);
+ return -1;
+ }
+ memset(buf, byte, size);
+
+ ret = ntfs_rl_pwrite(vol, restart,
+ restart->vcn << vol->cluster_size_bits,
+ offset, size, buf);
+ free(buf);
+ if (ret != size) {
+ ntfs_log_verbose("Internal error\n");
+ ntfs_log_error("ntfs_rl_pwrite failed, offset %llu, "
+ "size %lld, vcn %lld",
+ (unsigned long long)offset,
+ (long long)size, (long long)rlc->vcn);
+ return -1;
+ }
+ wiped += ret;
+next:
+ if (rlc->lcn == LCN_HOLE)
+ restart = rlc + 1;
+ rlc++;
+ }
+
+ return wiped;
+}
+
+/**
+ * wipe_attribute - Wipe not compressed $DATA attribute
+ * @vol: An ntfs volume obtained from ntfs_mount
+ * @byte: Overwrite with this value
+ * @act: Wipe, test or info
+ * @na: Opened ntfs attribute
+ *
+ * Return: >0 Success, the attribute was wiped
+ * 0 Nothing to wipe
+ * -1 Error, something went wrong
+ */
+static s64 wipe_attribute(ntfs_volume *vol, int byte, enum action act,
+ ntfs_attr *na)
+{
+ unsigned char *buf;
+ s64 wiped;
+ s64 size;
+ u64 offset = na->data_size;
+
+ if (!offset)
+ return 0;
+ if (na->data_flags & ATTR_IS_ENCRYPTED)
+ 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) {
+ ntfs_log_verbose("Not enough memory\n");
+ ntfs_log_error("Not enough memory to allocate %lld bytes",
+ (long long)size);
+ return -1;
+ }
+ memset(buf, byte, size);
+
+ wiped = ntfs_rl_pwrite(vol, na->rl, 0, offset, size, buf);
+ if (wiped == -1) {
+ ntfs_log_verbose("Internal error\n");
+ ntfs_log_error("Couldn't wipe tail");
+ }
+
+ free(buf);
+ return wiped;
+}
+
+/*
+ * Wipe a data attribute tail
+ *
+ * Return: >0 Success, the clusters were wiped
+ * 0 Nothing to wipe
+ * -1 Error, something went wrong
+ */
+
+static s64 wipe_attr_tail(ntfs_inode *ni, ntfschar *name, int namelen,
+ int byte, enum action act)
+{
+ ntfs_attr *na;
+ ntfs_volume *vol = ni->vol;
+ s64 wiped;
+
+ wiped = -1;
+ na = ntfs_attr_open(ni, AT_DATA, name, namelen);
+ if (!na) {
+ ntfs_log_error("Couldn't open $DATA attribute\n");
+ goto close_attr;
+ }
+
+ if (!NAttrNonResident(na)) {
+ ntfs_log_verbose("Resident $DATA attribute. Skipping.\n");
+ goto close_attr;
+ }
+
+ if (ntfs_attr_map_whole_runlist(na)) {
+ ntfs_log_verbose("Internal error\n");
+ ntfs_log_error("Can't map runlist (inode %lld)\n",
+ (long long)ni->mft_no);
+ goto close_attr;
+ }
+
+ if (na->data_flags & ATTR_COMPRESSION_MASK)
+ wiped = wipe_compressed_attribute(vol, byte, act, na);
+ else
+ wiped = wipe_attribute(vol, byte, act, na);
+
+ if (wiped == -1) {
+ ntfs_log_error(" (inode %lld)\n", (long long)ni->mft_no);
+ }
+
+close_attr:
+ ntfs_attr_close(na);
+ return (wiped);
+}
+
+/**
+ * wipe_tails - Wipe the file tails in all its data attributes
+ * @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: >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 nr_mft_records, inode_num;
+ ntfs_attr_search_ctx *ctx;
+ ntfs_inode *ni;
+ ATTR_RECORD *a;
+ ntfschar *name;
+
+ if (!vol || (byte < 0))
+ return -1;
+
+ nr_mft_records = vol->mft_na->initialized_size >>
+ vol->mft_record_size_bits;
+
+ for (inode_num = FILE_first_user; inode_num < nr_mft_records;
+ inode_num++) {
+ s64 attr_wiped;
+ s64 wiped = 0;
+
+ ntfs_log_verbose("Inode %lld - ", (long long)inode_num);
+ ni = ntfs_inode_open(vol, inode_num);
+ if (!ni) {
+ ntfs_log_verbose("Could not open inode\n");
+ continue;
+ }
+
+ if (ni->mrec->base_mft_record) {
+ ntfs_log_verbose("Not base mft record. Skipping\n");
+ goto close_inode;
+ }
+
+ ctx = ntfs_attr_get_search_ctx(ni, (MFT_RECORD*)NULL);
+ if (!ctx) {
+ ntfs_log_error("Can't get a context, aborting\n");
+ ntfs_inode_close(ni);
+ goto close_abort;
+ }
+ while (!ntfs_attr_lookup(AT_DATA, NULL, 0, CASE_SENSITIVE, 0,
+ NULL, 0, ctx)) {
+ a = ctx->attr;
+
+ if (!ctx->al_entry || !ctx->al_entry->lowest_vcn) {
+ name = (ntfschar*)((u8*)a
+ + le16_to_cpu(a->name_offset));
+ attr_wiped = wipe_attr_tail(ni, name,
+ a->name_length, byte, act);
+ if (attr_wiped > 0)
+ wiped += attr_wiped;
+ }
+ }
+ ntfs_attr_put_search_ctx(ctx);
+ if (wiped) {
+ ntfs_log_verbose("Wiped %llu bytes\n",
+ (unsigned long long)wiped);
+ total += wiped;
+ } else
+ ntfs_log_verbose("Nothing to wipe\n");
+close_inode:
+ ntfs_inode_close(ni);
+ }
+close_abort :
+ ntfs_log_quiet("wipe_tails 0x%02x, %lld bytes\n", byte,
+ (long long)total);
+ return total;
+}
+
+/**
+ * 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.
+ *
+ * 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)
+{
+ // by considering the individual attributes we might be able to
+ // wipe a few more bytes at the attr's tail.
+ s64 nr_mft_records, i;
+ s64 total = 0;
+ s64 result = 0;
+ int size = 0;
+ MFT_RECORD *rec = NULL;
+
+ if (!vol || (byte < 0))
+ return -1;
+
+ rec = (MFT_RECORD*)malloc(vol->mft_record_size);
+ if (!rec) {
+ ntfs_log_error("malloc failed\n");
+ return -1;
+ }
+
+ 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, rec);
+ if (result != 1) {
+ ntfs_log_error("error attr mst read %lld\n",
+ (long long)i);
+ total = -1; // XXX just negate result?
+ goto free;
+ }
+
+ // We know that the end marker will only take 4 bytes
+ size = le32_to_cpu(rec->bytes_in_use) - 4;
+
+ if (act == act_info) {
+ //ntfs_log_info("mft %d\n", size);
+ total += size;
+ continue;
+ }
+
+ memset(((u8*) rec) + size, byte, vol->mft_record_size - size);
+ } else {
+ const u16 usa_offset =
+ (vol->major_ver == 3) ? 0x0030 : 0x002A;
+ const u32 usa_size = 1 +
+ (vol->mft_record_size >> NTFS_BLOCK_SIZE_BITS);
+ const u16 attrs_offset =
+ ((usa_offset + usa_size) + 7) & ~((u16) 7);
+ const u32 bytes_in_use = attrs_offset + 8;
+
+ if(usa_size > 0xFFFF || (usa_offset + usa_size) >
+ (NTFS_BLOCK_SIZE - sizeof(u16)))
+ {
+ ntfs_log_error("%d: usa_size out of bounds "
+ "(%u)\n", __LINE__, usa_size);
+ total = -1;
+ goto free;
+ }
+
+ if (act == act_info) {
+ total += vol->mft_record_size;
+ continue;
+ }
+
+ // Build the record from scratch
+ memset(rec, 0, vol->mft_record_size);
+
+ // Common values
+ rec->magic = magic_FILE;
+ rec->usa_ofs = cpu_to_le16(usa_offset);
+ rec->usa_count = cpu_to_le16((u16) usa_size);
+ rec->sequence_number = cpu_to_le16(0x0001);
+ rec->attrs_offset = cpu_to_le16(attrs_offset);
+ rec->bytes_in_use = cpu_to_le32(bytes_in_use);
+ rec->bytes_allocated = cpu_to_le32(vol->mft_record_size);
+ rec->next_attr_instance = cpu_to_le16(0x0001);
+
+ // End marker.
+ *((le32*) (((u8*) rec) + attrs_offset)) = cpu_to_le32(0xFFFFFFFF);
+ }
+
+ result = ntfs_attr_mst_pwrite(vol->mft_na, vol->mft_record_size * i,
+ 1, vol->mft_record_size, rec);
+ if (result != 1) {
+ ntfs_log_error("error attr mst write %lld\n",
+ (long long)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;
+ le16 *usnp;
+ offset = le16_to_cpu(rec->usa_ofs);
+ usnp = (le16*) (((u8*) rec) + offset);
+ *usnp = cpu_to_le16(le16_to_cpu(*usnp) - 1);
+
+ result = ntfs_attr_mst_pwrite(vol->mftmirr_na, vol->mft_record_size * i,
+ 1, vol->mft_record_size, rec);
+ if (result != 1) {
+ ntfs_log_error("error attr mst write %lld\n",
+ (long long)i);
+ total = -1;
+ goto free;
+ }
+ }
+
+ total += vol->mft_record_size;
+ }
+
+ ntfs_log_quiet("wipe_mft 0x%02x, %lld bytes\n", byte, (long long)total);
+free:
+ free(rec);
+ 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 $BITMAP 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
+ __attribute__((unused)), ntfs_attr *naa, ntfs_attr *nab,
+ u32 indx_record_size)
+{
+ 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) {
+ ntfs_log_verbose("malloc failed\n");
+ ntfs_log_error("Couldn't allocate %lld bytes",
+ (long long)nab->data_size);
+ return -1;
+ }
+
+ if (ntfs_attr_pread(nab, 0, nab->data_size, bitmap)
+ != nab->data_size) {
+ 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) {
+ ntfs_log_verbose("malloc failed\n");
+ ntfs_log_error("Couldn't allocate %u bytes",
+ (unsigned int)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) {
+ ntfs_log_verbose("ntfs_rl_pread failed\n");
+ ntfs_log_error("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))
+ ntfs_log_error("damaged fs: mst_post_read_fixup failed");
+
+ if ((le32_to_cpu(indx->index.allocated_size) + 0x18) !=
+ indx_record_size) {
+ 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;
+ }
+
+ 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))
+ ntfs_log_error("damaged fs: mst_pre_write_protect failed");
+ if (opts.verbose > 1)
+ ntfs_log_verbose("+");
+ } else {
+ wipe_size = indx_record_size;
+ memset(buf, byte, wipe_size);
+ if (opts.verbose > 1)
+ ntfs_log_verbose("x");
+ }
+
+ wiped = ntfs_rl_pwrite(vol, naa->rl, 0, offset, indx_record_size, buf);
+ if (wiped != indx_record_size) {
+ ntfs_log_verbose("ntfs_rl_pwrite failed\n");
+ ntfs_log_error("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))
+ ntfs_log_verbose("\n\t");
+free_buf:
+ free(buf);
+free_bitmap:
+ 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;
+ le32 indx_record_size_le;
+
+ if (ntfs_attr_pread(nar, 8, 4, &indx_record_size_le) != 4) {
+ 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_le);
+ if (!indx_record_size) {
+ ntfs_log_verbose("Internal error\n");
+ ntfs_log_error("INDX record should be 0");
+ }
+ return indx_record_size;
+}
+
+/**
+ * wipe_directory - Wipe the directory indexes
+ * @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.
+ *
+ * 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)
+{
+ s64 total = 0;
+ s64 nr_mft_records, inode_num;
+ ntfs_inode *ni;
+ ntfs_attr *naa;
+ ntfs_attr *nab;
+ ntfs_attr *nar;
+
+ if (!vol || (byte < 0))
+ return -1;
+
+ 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;
+
+ ntfs_log_verbose("Inode %lld - ", (long long)inode_num);
+ ni = ntfs_inode_open(vol, inode_num);
+ if (!ni) {
+ if (opts.verbose > 2)
+ ntfs_log_verbose("Could not open inode\n");
+ else
+ ntfs_log_verbose("\r");
+ continue;
+ }
+
+ if (ni->mrec->base_mft_record) {
+ if (opts.verbose > 2)
+ ntfs_log_verbose("Not base mft record. Skipping\n");
+ else
+ 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)
+ ntfs_log_verbose("Couldn't open $INDEX_ALLOCATION\n");
+ else
+ ntfs_log_verbose("\r");
+ goto close_inode;
+ }
+
+ if (!NAttrNonResident(naa)) {
+ ntfs_log_verbose("Resident $INDEX_ALLOCATION\n");
+ ntfs_log_error("damaged fs: Resident $INDEX_ALLOCATION "
+ "(inode %lld)\n", (long long)inode_num);
+ goto close_attr_allocation;
+ }
+
+ if (ntfs_attr_map_whole_runlist(naa)) {
+ ntfs_log_verbose("Internal error\n");
+ ntfs_log_error("Can't map runlist for $INDEX_ALLOCATION "
+ "(inode %lld)\n", (long long)inode_num);
+ goto close_attr_allocation;
+ }
+
+ nab = ntfs_attr_open(ni, AT_BITMAP, NTFS_INDEX_I30, 4);
+ if (!nab) {
+ 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", (long long)inode_num);
+ goto close_attr_allocation;
+ }
+
+ nar = ntfs_attr_open(ni, AT_INDEX_ROOT, NTFS_INDEX_I30, 4);
+ if (!nar) {
+ 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", (long long)inode_num);
+ goto close_attr_bitmap;
+ }
+
+ if (NAttrNonResident(nar)) {
+ ntfs_log_verbose("Not resident $INDEX_ROOT\n");
+ ntfs_log_error("damaged fs: Not resident $INDEX_ROOT "
+ "(inode %lld)\n", (long long)inode_num);
+ goto close_attr_root;
+ }
+
+ indx_record_size = get_indx_record_size(nar);
+ if (!indx_record_size) {
+ ntfs_log_error(" (inode %lld)\n", (long long)inode_num);
+ goto close_attr_root;
+ }
+
+ wiped = wipe_index_allocation(vol, byte, act,
+ naa, nab, indx_record_size);
+ if (wiped == -1) {
+ ntfs_log_error(" (inode %lld)\n",
+ (long long)inode_num);
+ goto close_attr_root;
+ }
+
+ if (wiped) {
+ ntfs_log_verbose("Wiped %llu bytes\n",
+ (unsigned long long)wiped);
+ total += wiped;
+ } else
+ ntfs_log_verbose("Nothing to wipe\n");
+close_attr_root:
+ ntfs_attr_close(nar);
+close_attr_bitmap:
+ ntfs_attr_close(nab);
+close_attr_allocation:
+ ntfs_attr_close(naa);
+close_inode:
+ ntfs_inode_close(ni);
+ }
+
+ ntfs_log_quiet("wipe_directory 0x%02x, %lld bytes\n", byte,
+ (long long)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 consistent state, then this information can be erased.
+ *
+ * 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
+ __attribute__((unused)))
+{
+ 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;
+
+ /* We can wipe logfile only with 0xff. */
+ byte = 0xff;
+
+ if (!vol || (byte < 0))
+ return -1;
+
+ //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");
+ return -1;
+ }
+
+ if ((na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0)) == NULL) {
+ 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)) {
+ ntfs_log_debug("$LogFile $DATA attribute is resident!?!\n");
+ errno = EIO;
+ goto io_error_exit;
+ }
+
+ /* Get length of $LogFile contents. */
+ len = na->data_size;
+ if (!len) {
+ ntfs_log_debug("$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) {
+ ntfs_log_debug("Amount of $LogFile data read does not "
+ "correspond to expected length!\n");
+ if (count != -1)
+ errno = EIO;
+ goto io_error_exit;
+ }
+
+ /* Fill the buffer with @byte's. */
+ 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) {
+ ntfs_log_debug("Failed to set the $LogFile attribute "
+ "value.\n");
+ if (count != -1)
+ errno = EIO;
+ goto io_error_exit;
+ }
+
+ pos += count;
+ }
+
+ ntfs_attr_close(na);
+ ntfs_inode_close(ni);
+ ntfs_log_quiet("wipe_logfile 0x%02x, %lld bytes\n", byte,
+ (long long)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
+ * @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.
+ *
+ * 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
+ __attribute__((unused)))
+{
+ // 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;
+
+ //ntfs_log_quiet("wipe_pagefile(not implemented) 0x%02x\n", byte);
+
+ ni = ntfs_pathname_to_inode(vol, NULL, "pagefile.sys");
+ if (!ni) {
+ 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) {
+ 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)) {
+ ntfs_log_debug("pagefile.sys $DATA attribute is resident!?!\n");
+ errno = EIO;
+ goto io_error_exit;
+ }
+
+ /* Get length of pagefile.sys contents. */
+ len = na->data_size;
+ if (!len) {
+ ntfs_log_debug("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) {
+ ntfs_log_debug("Failed to set the pagefile.sys "
+ "attribute value.\n");
+ if (count != -1)
+ errno = EIO;
+ goto io_error_exit;
+ }
+
+ pos += count;
+ }
+
+ ntfs_attr_close(na);
+ ntfs_inode_close(ni);
+ ntfs_log_quiet("wipe_pagefile 0x%02x, %lld bytes\n", byte,
+ (long long)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;
+}
+
+/**
+ * Part of ntfsprogs.
+ * Modified: removed logging, signal handling, removed data.
+ *
+ * free_file - Release the resources used by a file object
+ * \param 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
+ */
+static void free_file (struct ufile *file)
+{
+ struct ntfs_list_head *item = NULL, *tmp = NULL;
+ struct filename *f = NULL;
+ struct data *d = NULL;
+
+ if (file == NULL)
+ return;
+
+ ntfs_list_for_each_safe(item, tmp, &(file->name)) {
+ /* List of filenames */
+
+ f = ntfs_list_entry(item, struct filename, list);
+ if (f->name != NULL)
+ free(f->name);
+ if (f->parent_name != NULL) {
+ free(f->parent_name);
+ }
+ free(f);
+ }
+
+ ntfs_list_for_each_safe(item, tmp, &(file->data)) {
+ /* List of data streams */
+
+ d = ntfs_list_entry(item, struct data, list);
+ if (d->name != NULL)
+ free(d->name);
+ if (d->runlist != NULL)
+ free(d->runlist);
+ free(d);
+ }
+
+
+ free(file->mft);
+ free(file);
+}
+
+/**
+ * Fills the given buffer with one of predefined patterns.
+ * \param pat_no Pass number.
+ * \param buffer Buffer to be filled.
+ * \param buflen Length of the buffer.
+ */
+static void fill_buffer (
+ unsigned long int pat_no,
+ unsigned char * const buffer,
+ const size_t buflen,
+ int * const selected )
+ /*@requires notnull buffer @*/ /*@sets *buffer @*/
+{
+
+ size_t i;
+#if (!defined HAVE_MEMCPY) && (!defined HAVE_STRING_H)
+ size_t j;
+#endif
+ unsigned int bits;
+
+ if ((buffer == NULL) || (buflen == 0))
+ return;
+
+ /* De-select all patterns once every npasses calls. */
+ if (pat_no % npasses == 0) {
+ for (i = 0; i < NPAT; i++) {
+ selected[i] = 0;
+ }
+ }
+ pat_no %= npasses;
+ /* double check for npasses >= NPAT + 3: */
+ for (i = 0; i < NPAT; i++) {
+ if (selected[i] == 0)
+ break;
+ }
+ if (i >= NPAT) {
+ for (i = 0; i < NPAT; i++) {
+ selected[i] = 0;
+ }
+ }
+
+ /* The first, last and middle passess will be using a random pattern */
+ if ((pat_no == 0) || (pat_no == npasses-1) || (pat_no == npasses/2)) {
+#if (!defined __STRICT_ANSI__) && (defined HAVE_RANDOM)
+ bits = (unsigned int)(random() & 0xFFF);
+#else
+ bits = (unsigned int)(rand() & 0xFFF);
+#endif
+ } else {
+ /* For other passes, one of the fixed patterns is selected. */
+ do {
+#if (!defined __STRICT_ANSI__) && (defined HAVE_RANDOM)
+ i = (size_t)(random() % NPAT);
+#else
+ i = (size_t)(rand() % NPAT);
+#endif
+ } while (selected[i] == 1);
+ bits = opts.bytes[i];
+ selected[i] = 1;
+ }
+
+ buffer[0] = (unsigned char) bits;
+ buffer[1] = (unsigned char) bits;
+ buffer[2] = (unsigned char) bits;
+ for (i = 3; i < buflen / 2; i *= 2) {
+#ifdef HAVE_MEMCPY
+ memcpy(buffer + i, buffer, i);
+#elif defined HAVE_STRING_H
+ strncpy((char *)(buffer + i), (char *)buffer, i);
+#else
+ for (j = 0; j < i; j++) {
+ buffer[i+j] = buffer[j];
+ }
+#endif
+ }
+ if (i < buflen) {
+#ifdef HAVE_MEMCPY
+ memcpy(buffer + i, buffer, buflen - i);
+#elif defined HAVE_STRING_H
+ strncpy((char *)(buffer + i), (char *)buffer, buflen - i);
+#else
+ for (j=0; j<buflen - i; j++) {
+ buffer[i+j] = buffer[j];
+ }
+#endif
+ }
+}
+
+/**
+ * Destroys the specified record's filenames and data.
+ *
+ * \param nv The filesystem.
+ * \param record The record (i-node number), which filenames & data
+ * to destroy.
+ * \return 0 in case of no errors, other values otherwise.
+ */
+static int destroy_record(ntfs_volume *nv, const s64 record,
+ unsigned char * const buf)
+{
+ struct ufile *file = NULL;
+ runlist_element *rl = NULL;
+ ntfs_attr *mft = NULL;
+
+ ntfs_attr_search_ctx *ctx = NULL;
+ int ret_wfs = 0;
+ unsigned long int pass, i;
+ s64 j;
+ unsigned char * a_offset;
+ int selected[NPAT];
+
+ file = (struct ufile *) malloc(sizeof(struct ufile));
+ if (file == NULL) {
+ return -1;
+ }
+
+ NTFS_INIT_LIST_HEAD(&(file->name));
+ NTFS_INIT_LIST_HEAD(&(file->data));
+ file->inode = record;
+
+ file->mft = (MFT_RECORD*)malloc(nv->mft_record_size);
+ if (file->mft == NULL) {
+ free_file (file);
+ return -1;
+ }
+
+ mft = ntfs_attr_open(nv->mft_ni, AT_DATA, AT_UNNAMED, 0);
+ if (mft == NULL) {
+ free_file(file);
+ return -2;
+ }
+
+ /* Read the MFT reocrd of the i-node */
+ if (ntfs_attr_mst_pread(mft, nv->mft_record_size * record, 1LL,
+ nv->mft_record_size, file->mft) < 1) {
+
+ ntfs_attr_close(mft);
+ free_file(file);
+ return -3;
+ }
+ ntfs_attr_close(mft);
+ mft = NULL;
+
+ ctx = ntfs_attr_get_search_ctx(NULL, file->mft);
+ if (ctx == NULL) {
+ free_file(file);
+ return -4;
+ }
+
+ /* Wiping file names */
+ while (1 == 1) {
+
+ if (ntfs_attr_lookup(AT_FILE_NAME, NULL, 0, CASE_SENSITIVE,
+ 0LL, NULL, 0, ctx) != 0) {
+ break; /* None / no more of that type */
+ }
+ if (ctx->attr == NULL)
+ break;
+
+ /* We know this will always be resident.
+ Find the offset of the data, including the MFT record. */
+ a_offset = ((unsigned char *) ctx->attr
+ + le16_to_cpu(ctx->attr->value_offset));
+
+ for (pass = 0; pass < npasses; pass++) {
+ fill_buffer(pass, a_offset,
+ le32_to_cpu(ctx->attr->value_length),
+ selected);
+
+ if ( !opts.noaction ) {
+ if (ntfs_mft_records_write(nv,
+ MK_MREF(record, 0), 1LL,
+ ctx->mrec) != 0) {
+ ret_wfs = -5;
+ break;
+ }
+ /* Flush after each writing, if more than
+ 1 overwriting needs to be done. Allow I/O
+ bufferring (efficiency), if just one
+ pass is needed. */
+ if (npasses > 1) {
+ nv->dev->d_ops->sync(nv->dev);
+ }
+ }
+
+ }
+
+ /* Wiping file name length */
+ for (pass = 0; pass < npasses; pass++) {
+
+ fill_buffer (pass, (unsigned char *)
+ &(ctx->attr->value_length), sizeof(u32),
+ selected);
+
+ if (!opts.noaction) {
+ if (ntfs_mft_records_write(nv,
+ MK_MREF(record, 0),
+ 1LL, ctx->mrec) != 0) {
+ ret_wfs = -5;
+ break;
+ }
+
+ if (npasses > 1) {
+ nv->dev->d_ops->sync(nv->dev);
+ }
+ }
+ }
+ ctx->attr->value_length = cpu_to_le32(0);
+ if (!opts.noaction) {
+ if (ntfs_mft_records_write(nv, MK_MREF(record, 0),
+ 1LL, ctx->mrec) != 0) {
+ ret_wfs = -5;
+ break;
+ }
+ }
+ }
+
+ ntfs_attr_reinit_search_ctx(ctx);
+
+ /* Wiping file data */
+ while (1 == 1) {
+ if (ntfs_attr_lookup(AT_DATA, NULL, 0, CASE_SENSITIVE, 0LL,
+ NULL, 0, ctx) != 0) {
+ break; /* None / no more of that type */
+ }
+ if (ctx->attr == NULL)
+ break;
+
+ if (ctx->attr->non_resident == 0) {
+ /* attribute is resident (part of MFT record) */
+ /* find the offset of the data, including the MFT record */
+ a_offset = ((unsigned char *) ctx->attr
+ + le16_to_cpu(ctx->attr->value_offset));
+
+ /* Wiping the data itself */
+ for (pass = 0; pass < npasses; pass++) {
+
+ fill_buffer (pass, a_offset,
+ le32_to_cpu(ctx->attr->value_length),
+ selected);
+
+ if (!opts.noaction) {
+ if (ntfs_mft_records_write(nv,
+ MK_MREF(record, 0),
+ 1LL, ctx->mrec) != 0) {
+ ret_wfs = -5;
+ break;
+ }
+
+ if (npasses > 1) {
+ nv->dev->d_ops->sync(nv->dev);
+ }
+ }
+ }
+
+ /* Wiping data length */
+ for (pass = 0; pass < npasses; pass++) {
+
+ fill_buffer(pass, (unsigned char *)
+ &(ctx->attr->value_length),
+ sizeof(u32), selected);
+
+ if (!opts.noaction) {
+ if (ntfs_mft_records_write(nv,
+ MK_MREF(record, 0),
+ 1LL, ctx->mrec) != 0) {
+ ret_wfs = -5;
+ break;
+ }
+
+ if (npasses > 1) {
+ nv->dev->d_ops->sync(nv->dev);
+ }
+ }
+ }
+ ctx->attr->value_length = cpu_to_le32(0);
+ if ( !opts.noaction ) {
+ if (ntfs_mft_records_write(nv,
+ MK_MREF(record, 0),
+ 1LL, ctx->mrec) != 0) {
+ ret_wfs = -5;
+ break;
+ }
+ }
+ } else {
+ /* Non-resident here */
+
+ rl = ntfs_mapping_pairs_decompress(nv,
+ ctx->attr, NULL);
+ if (rl == NULL) {
+ continue;
+ }
+
+ if (rl[0].length <= 0) {
+ continue;
+ }
+
+ for (i = 0; (rl[i].length > 0) && (ret_wfs == 0); i++) {
+ if (rl[i].lcn == -1) {
+ continue;
+ }
+ for (j = rl[i].lcn;
+ (j < rl[i].lcn + rl[i].length)
+ && (ret_wfs == 0); j++) {
+
+ if (utils_cluster_in_use(nv, j) != 0)
+ continue;
+ for (pass = 0;
+ pass < npasses;
+ pass++) {
+
+ fill_buffer(pass, buf,
+ (size_t) nv->cluster_size,
+ selected);
+ if (!opts.noaction) {
+ if (ntfs_cluster_write(
+ nv, j, 1LL,
+ buf) < 1) {
+ ret_wfs = -5;
+ break;
+ }
+
+ if (npasses > 1) {
+ nv->dev->d_ops->sync
+ (nv->dev);
+ }
+ }
+ }
+ }
+ }
+
+ /* Wipe the data length here */
+ for (pass = 0; pass < npasses; pass++) {
+ fill_buffer(pass, (unsigned char *)
+ &(ctx->attr->lowest_vcn),
+ sizeof(VCN), selected);
+ fill_buffer(pass, (unsigned char *)
+ &(ctx->attr->highest_vcn),
+ sizeof(VCN), selected);
+ fill_buffer(pass, (unsigned char *)
+ &(ctx->attr->allocated_size),
+ sizeof(s64), selected);
+ fill_buffer(pass, (unsigned char *)
+ &(ctx->attr->data_size),
+ sizeof(s64), selected);
+ fill_buffer(pass, (unsigned char *)
+ &(ctx->attr->initialized_size),
+ sizeof(s64), selected);
+ fill_buffer(pass, (unsigned char *)
+ &(ctx->attr->compressed_size),
+ sizeof(s64), selected);
+
+ if ( !opts.noaction ) {
+ if (ntfs_mft_records_write(nv,
+ MK_MREF (record, 0),
+ 1LL, ctx->mrec) != 0) {
+ ret_wfs = -5;
+ break;
+ }
+
+ if (npasses > 1) {
+ nv->dev->d_ops->sync(nv->dev);
+ }
+ }
+ }
+ ctx->attr->lowest_vcn = cpu_to_le64(0);
+ ctx->attr->highest_vcn = cpu_to_le64(0);
+ ctx->attr->allocated_size = cpu_to_le64(0);
+ ctx->attr->data_size = cpu_to_le64(0);
+ ctx->attr->initialized_size = cpu_to_le64(0);
+ ctx->attr->compressed_size = cpu_to_le64(0);
+ if (!opts.noaction) {
+ if (ntfs_mft_records_write(nv,
+ MK_MREF (record, 0),
+ 1LL, ctx->mrec) != 0) {
+ ret_wfs = -5;
+ break;
+ }
+ }
+ } /* end of resident check */
+ } /* end of 'wiping file data' loop */
+
+ ntfs_attr_put_search_ctx(ctx);
+ free_file(file);
+
+ return ret_wfs;
+}
+
+/**
+ * Starts search for deleted inodes and undelete data on the given
+ * NTFS filesystem.
+ * \param FS The filesystem.
+ * \return 0 in case of no errors, other values otherwise.
+ */
+static int wipe_unrm(ntfs_volume *nv)
+{
+ int ret_wfs = 0, ret;
+ ntfs_attr *bitmapattr = NULL;
+ s64 bmpsize, size, nr_mft_records, i, j, k;
+ unsigned char b;
+ unsigned char * buf = NULL;
+
+#define MYBUF_SIZE 8192
+ unsigned char *mybuf;
+#define MINIM(x, y) ( ((x)<(y))?(x):(y) )
+
+ mybuf = (unsigned char *) malloc(MYBUF_SIZE);
+ if (mybuf == NULL) {
+ return -1;
+ }
+
+ buf = (unsigned char *) malloc(nv->cluster_size);
+ if (buf == NULL) {
+ free (mybuf);
+ return -1;
+ }
+
+ bitmapattr = ntfs_attr_open(nv->mft_ni, AT_BITMAP, AT_UNNAMED, 0);
+ if (bitmapattr == NULL) {
+ free (buf);
+ free (mybuf);
+ return -2;
+ }
+ bmpsize = bitmapattr->initialized_size;
+
+ nr_mft_records = nv->mft_na->initialized_size
+ >> nv->mft_record_size_bits;
+
+ /* just like ntfsundelete; detects i-node numbers fine */
+ for (i = 0; (i < bmpsize) && (ret_wfs==0); i += MYBUF_SIZE) {
+
+ /* read a part of the file bitmap */
+ size = ntfs_attr_pread(bitmapattr, i,
+ MINIM((bmpsize - i), MYBUF_SIZE), mybuf);
+ if (size < 0)
+ break;
+
+ /* parse each byte of the just-read part of the bitmap */
+ for (j = 0; (j < size) && (ret_wfs==0); j++) {
+ b = mybuf[j];
+ /* parse each bit of the byte Bit 1 means 'in use'. */
+ for (k = 0; (k < CHAR_BIT) && (ret_wfs==0);
+ k++, b>>=1) {
+ /* (i+j)*8+k is the i-node bit number */
+ if (((i+j)*CHAR_BIT+k) >= nr_mft_records) {
+ goto done;
+ }
+ if ((b & 1) != 0) {
+ /* i-node is in use, skip it */
+ continue;
+ }
+ /* wiping the i-node here: */
+ ret = destroy_record (nv,
+ (i+j)*CHAR_BIT+k, buf);
+ if (ret != 0) {
+ ret_wfs = ret;
+ }
+ }
+ }
+ }
+done:
+ ntfs_attr_close(bitmapattr);
+ free(buf);
+ free(mybuf);
+
+ ntfs_log_quiet("wipe_undelete\n");
+ return ret_wfs;
+}
+
+
+
+/**
+ * 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.
+ *
+ * Return: none
+ */
+static void print_summary(void)
+{
+ int i;
+
+ if (opts.noaction)
+ ntfs_log_quiet("%s is in 'no-action' mode, it will NOT write to disk."
+ "\n\n", EXEC_NAME);
+
+ ntfs_log_quiet("%s is about to wipe:\n", EXEC_NAME);
+ if (opts.unused)
+ ntfs_log_quiet("\tunused disk space\n");
+ if (opts.tails)
+ ntfs_log_quiet("\tfile tails\n");
+ if (opts.mft)
+ ntfs_log_quiet("\tunused mft areas\n");
+ if (opts.directory)
+ ntfs_log_quiet("\tunused directory index space\n");
+ if (opts.logfile)
+ ntfs_log_quiet("\tthe logfile (journal)\n");
+ if (opts.pagefile)
+ ntfs_log_quiet("\tthe pagefile (swap space)\n");
+ if (opts.undel)
+ ntfs_log_quiet("\tundelete data\n");
+
+ ntfs_log_quiet("\n%s will overwrite these areas with: ", EXEC_NAME);
+ if (opts.bytes) {
+ for (i = 0; opts.bytes[i] >= 0; i++)
+ ntfs_log_quiet("0x%02x ", opts.bytes[i]);
+ }
+ ntfs_log_quiet("\n");
+
+ if (opts.count > 1)
+ ntfs_log_quiet("%s will repeat these operations %d times.\n", EXEC_NAME, opts.count);
+ ntfs_log_quiet("\n");
+}
+
+/**
+ * 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 = 1;
+ int flags = 0;
+ int i, j;
+ enum action act = act_info;
+
+ ntfs_log_set_handler(ntfs_log_handler_outerr);
+
+ if (!parse_options(argc, argv))
+ return 1;
+
+ utils_set_locale();
+
+ if (!opts.info)
+ print_summary();
+
+ if (opts.info || opts.noaction)
+ flags = NTFS_MNT_RDONLY;
+ if (opts.force)
+ flags |= NTFS_MNT_RECOVER;
+
+ vol = utils_mount_volume(opts.device, flags);
+ if (!vol)
+ goto free;
+
+ if ((vol->flags & VOLUME_IS_DIRTY) && !opts.force)
+ goto umount;
+
+ if (opts.info) {
+ 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 ((act == act_wipe) && !opts.force) {
+ ntfs_log_quiet("\n%s will begin in 5 seconds, press CTRL-C to abort.\n", EXEC_NAME);
+ sleep(5);
+ }
+
+ for (i = 0; opts.bytes[i] >= 0; i++) {
+ npasses = i+1;
+ }
+ if (npasses == 0) {
+ npasses = opts.count;
+ }
+#ifdef HAVE_TIME_H
+ srandom(time(NULL));
+#else
+ /* use a pointer as a pseudorandom value */
+ srandom((int)vol + npasses);
+#endif
+ ntfs_log_info("\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.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 (opts.undel) {
+ wiped = wipe_unrm(vol);
+ if (wiped != 0)
+ goto umount;
+ /*
+ else
+ total += wiped;
+ */
+ }
+
+ if (act == act_info)
+ break;
+ }
+
+ ntfs_log_info(
+ "%lld bytes were wiped (excluding undelete data)\n",
+ (long long)total);
+ }
+ 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
new file mode 100755
index 0000000..d22c085
--- a/dev/null
+++ b/ntfsprogs/ntfswipe.h
@@ -0,0 +1,54 @@
+/*
+ * ntfswipe - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2002 Richard Russon
+ *
+ * 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
+ * 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"
+
+enum action {
+ act_info,
+ act_test,
+ act_wipe,
+};
+
+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 */
+ int undel; /* Wipe undelete data */
+};
+
+#endif /* _NTFSWIPE_H_ */
+
diff --git a/ntfsprogs/sd.c b/ntfsprogs/sd.c
new file mode 100755
index 0000000..4e3af97
--- a/dev/null
+++ b/ntfsprogs/sd.c
@@ -0,0 +1,607 @@
+#include "types.h"
+#include "layout.h"
+#include "sd.h"
+
+/**
+ * init_system_file_sd -
+ *
+ * NTFS 3.1 - System files security decriptors
+ * =====================================================
+ *
+ * Create the security descriptor for system file number @sys_file_no and
+ * return a pointer to the descriptor.
+ *
+ * Note the root directory system file (".") is very different and handled by a
+ * different function.
+ *
+ * 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.
+ */
+void init_system_file_sd(int sys_file_no, u8 **sd_val, int *sd_val_len)
+{
+ static u8 sd_array[0x68];
+ SECURITY_DESCRIPTOR_RELATIVE *sd;
+ ACL *acl;
+ ACCESS_ALLOWED_ACE *aa_ace;
+ SID *sid;
+ le32 *sub_authorities;
+
+ if (sys_file_no < 0) {
+ *sd_val = NULL;
+ *sd_val_len = 0;
+ return;
+ }
+ *sd_val = sd_array;
+ sd = (SECURITY_DESCRIPTOR_RELATIVE*)&sd_array;
+ sd->revision = 1;
+ sd->alignment = 0;
+ sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT;
+ *sd_val_len = 0x64;
+ sd->owner = const_cpu_to_le32(0x48);
+ sd->group = const_cpu_to_le32(0x54);
+ 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.
+ */
+ acl = (ACL*)((char*)sd + le32_to_cpu(sd->dacl));
+ acl->revision = 2;
+ acl->alignment1 = 0;
+ acl->size = const_cpu_to_le16(0x34);
+ acl->ace_count = const_cpu_to_le16(2);
+ 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.
+ */
+ aa_ace = (ACCESS_ALLOWED_ACE*)((char*)acl + sizeof(ACL));
+ aa_ace->type = ACCESS_ALLOWED_ACE_TYPE;
+ aa_ace->flags = 0;
+ aa_ace->size = const_cpu_to_le16(0x14);
+ switch (sys_file_no) {
+ case FILE_AttrDef:
+ case FILE_Boot:
+ aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_READ |
+ FILE_READ_ATTRIBUTES | FILE_READ_EA | FILE_READ_DATA;
+ break;
+ default:
+ 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;
+ }
+ 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;
+ /* SECURITY_NT_SID_AUTHORITY (S-1-5) */
+ aa_ace->sid.identifier_authority.value[5] = 5;
+ aa_ace->sid.sub_authority[0] =
+ const_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.
+ */
+ /* 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 = const_cpu_to_le16(0x18);
+ /* Only $AttrDef and $Boot behave differently to everything else. */
+ switch (sys_file_no) {
+ case FILE_AttrDef:
+ case FILE_Boot:
+ aa_ace->mask = SYNCHRONIZE | STANDARD_RIGHTS_READ |
+ FILE_READ_ATTRIBUTES | FILE_READ_EA |
+ FILE_READ_DATA;
+ break;
+ default:
+ 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;
+ sub_authorities = aa_ace->sid.sub_authority;
+ *sub_authorities++ =
+ const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID);
+ *sub_authorities =
+ 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.
+ */
+ sid = (SID*)((char*)sd + le32_to_cpu(sd->owner));
+ sid->revision = 1;
+ sid->sub_authority_count = 1;
+ /* 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] = const_cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID);
+ /*
+ * Now at offset 0x54 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;
+ sub_authorities = sid->sub_authority;
+ *sub_authorities++ = const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID);
+ *sub_authorities = const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS);
+}
+
+/**
+ * init_root_sd -
+ *
+ * Creates the security_descriptor for the root folder on ntfs 3.1 as created
+ * by Windows Vista (when the format is done from the disk management MMC
+ * snap-in, note this is different from the format done from the disk
+ * properties in Windows Explorer).
+ */
+void init_root_sd(u8 **sd_val, int *sd_val_len)
+{
+ SECURITY_DESCRIPTOR_RELATIVE *sd;
+ ACL *acl;
+ ACCESS_ALLOWED_ACE *ace;
+ SID *sid;
+ le32 *sub_authorities;
+
+ static char sd_array[0x102c];
+ *sd_val_len = 0x102c;
+ *sd_val = (u8*)&sd_array;
+
+ //security descriptor relative
+ sd = (SECURITY_DESCRIPTOR_RELATIVE*)sd_array;
+ sd->revision = SECURITY_DESCRIPTOR_REVISION;
+ sd->alignment = 0;
+ sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT;
+ sd->owner = const_cpu_to_le32(0x1014);
+ sd->group = const_cpu_to_le32(0x1020);
+ sd->sacl = 0;
+ sd->dacl = const_cpu_to_le32(sizeof(SECURITY_DESCRIPTOR_RELATIVE));
+
+ //acl
+ acl = (ACL*)((u8*)sd + sizeof(SECURITY_DESCRIPTOR_RELATIVE));
+ acl->revision = ACL_REVISION;
+ acl->alignment1 = 0;
+ acl->size = const_cpu_to_le16(0x1000);
+ acl->ace_count = const_cpu_to_le16(0x08);
+ acl->alignment2 = 0;
+
+ //ace1
+ ace = (ACCESS_ALLOWED_ACE*)((u8*)acl + sizeof(ACL));
+ ace->type = ACCESS_ALLOWED_ACE_TYPE;
+ ace->flags = 0;
+ 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 |
+ FILE_TRAVERSE | FILE_DELETE_CHILD |
+ FILE_READ_ATTRIBUTES;
+ ace->sid.revision = SID_REVISION;
+ 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;
+ sub_authorities = ace->sid.sub_authority;
+ *sub_authorities++ =
+ const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID);
+ *sub_authorities = const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS);
+
+ //ace2
+ ace = (ACCESS_ALLOWED_ACE*)((u8*)ace + le16_to_cpu(ace->size));
+ ace->type = ACCESS_ALLOWED_ACE_TYPE;
+ ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE |
+ INHERIT_ONLY_ACE;
+ ace->size = const_cpu_to_le16(0x18);
+ ace->mask = GENERIC_ALL;
+ ace->sid.revision = SID_REVISION;
+ 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;
+ sub_authorities = ace->sid.sub_authority;
+ *sub_authorities++ =
+ const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID);
+ *sub_authorities = const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS);
+
+ //ace3
+ ace = (ACCESS_ALLOWED_ACE*)((u8*)ace + le16_to_cpu(ace->size));
+ ace->type = ACCESS_ALLOWED_ACE_TYPE;
+ ace->flags = 0;
+ 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 |
+ FILE_TRAVERSE | FILE_DELETE_CHILD |
+ FILE_READ_ATTRIBUTES;
+ ace->sid.revision = SID_REVISION;
+ 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] =
+ const_cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID);
+
+ //ace4
+ ace = (ACCESS_ALLOWED_ACE*)((u8*)ace + le16_to_cpu(ace->size));
+ ace->type = ACCESS_ALLOWED_ACE_TYPE;
+ ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE |
+ INHERIT_ONLY_ACE;
+ ace->size = const_cpu_to_le16(0x14);
+ ace->mask = GENERIC_ALL;
+ ace->sid.revision = SID_REVISION;
+ 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] =
+ const_cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID);
+
+ //ace5
+ ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le16_to_cpu(ace->size));
+ ace->type = ACCESS_ALLOWED_ACE_TYPE;
+ ace->flags = 0;
+ ace->size = const_cpu_to_le16(0x14);
+ ace->mask = SYNCHRONIZE | READ_CONTROL | DELETE |
+ FILE_WRITE_ATTRIBUTES | FILE_READ_ATTRIBUTES |
+ FILE_TRAVERSE | FILE_WRITE_EA | FILE_READ_EA |
+ FILE_ADD_SUBDIRECTORY | FILE_ADD_FILE |
+ FILE_LIST_DIRECTORY;
+ ace->sid.revision = SID_REVISION;
+ 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] =
+ const_cpu_to_le32(SECURITY_AUTHENTICATED_USER_RID);
+
+ //ace6
+ ace = (ACCESS_ALLOWED_ACE*)((u8*)ace + le16_to_cpu(ace->size));
+ ace->type = ACCESS_ALLOWED_ACE_TYPE;
+ ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE |
+ INHERIT_ONLY_ACE;
+ ace->size = const_cpu_to_le16(0x14);
+ ace->mask = GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | DELETE;
+ ace->sid.revision = SID_REVISION;
+ 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] =
+ const_cpu_to_le32(SECURITY_AUTHENTICATED_USER_RID);
+
+ //ace7
+ ace = (ACCESS_ALLOWED_ACE*)((u8*)ace + le16_to_cpu(ace->size));
+ ace->type = ACCESS_ALLOWED_ACE_TYPE;
+ ace->flags = 0;
+ ace->size = const_cpu_to_le16(0x18);
+ ace->mask = SYNCHRONIZE | READ_CONTROL | FILE_READ_ATTRIBUTES |
+ FILE_TRAVERSE | FILE_READ_EA | FILE_LIST_DIRECTORY;
+ ace->sid.revision = SID_REVISION;
+ 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;
+ sub_authorities = ace->sid.sub_authority;
+ *sub_authorities++ =
+ const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID);
+ *sub_authorities = const_cpu_to_le32(DOMAIN_ALIAS_RID_USERS);
+
+ //ace8
+ ace = (ACCESS_ALLOWED_ACE*)((u8*)ace + le16_to_cpu(ace->size));
+ ace->type = ACCESS_ALLOWED_ACE_TYPE;
+ ace->flags = OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE |
+ INHERIT_ONLY_ACE;
+ ace->size = const_cpu_to_le16(0x18);
+ ace->mask = GENERIC_READ | GENERIC_EXECUTE;
+ ace->sid.revision = SID_REVISION;
+ 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;
+ sub_authorities = ace->sid.sub_authority;
+ *sub_authorities++ =
+ const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID);
+ *sub_authorities = const_cpu_to_le32(DOMAIN_ALIAS_RID_USERS);
+
+ //owner sid
+ sid = (SID*)((char*)sd + le32_to_cpu(sd->owner));
+ 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] = const_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] = const_cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID);
+}
+
+/**
+ * init_secure_sds -
+ *
+ * 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_sds(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 = 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 = 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 = 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 = 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) */
+ 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] =
+ const_cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID);
+ //ace2
+ ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le16_to_cpu(ace->size));
+ ace->type = 0x00;
+ ace->flags = 0x00;
+ 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) */
+ 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] =
+ const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID);
+ ace->sid.sub_authority[1] =
+ const_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] =
+ const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID);
+ sid->sub_authority[1] =
+ const_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] =
+ const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID);
+ sid->sub_authority[1] =
+ const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS);
+/*
+ * security descriptor #2
+ */
+ //header
+ sds = (SECURITY_DESCRIPTOR_HEADER*)((char*)sd_val + 0x80);
+ 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 +
+ sizeof(SECURITY_DESCRIPTOR_HEADER));
+ sd->revision = 0x01;
+ sd->alignment = 0x00;
+ sd->control = SE_SELF_RELATIVE | SE_DACL_PRESENT;
+ 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 = 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 = 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) */
+ 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] =
+ const_cpu_to_le32(SECURITY_LOCAL_SYSTEM_RID);
+ //ace2
+ ace = (ACCESS_ALLOWED_ACE*)((char*)ace + le16_to_cpu(ace->size));
+ ace->type = 0x00;
+ ace->flags = 0x00;
+ 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) */
+ 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] =
+ const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID);
+ ace->sid.sub_authority[1] =
+ const_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] =
+ const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID);
+ sid->sub_authority[1] =
+ const_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] =
+ const_cpu_to_le32(SECURITY_BUILTIN_DOMAIN_RID);
+ sid->sub_authority[1] =
+ const_cpu_to_le32(DOMAIN_ALIAS_RID_ADMINS);
+
+ return;
+}
diff --git a/ntfsprogs/sd.h b/ntfsprogs/sd.h
new file mode 100755
index 0000000..7ad3e6a
--- a/dev/null
+++ b/ntfsprogs/sd.h
@@ -0,0 +1,11 @@
+#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(u8 **sd_val, int *sd_val_len);
+void init_secure_sds(char *sd_val);
+
+#endif /* _NTFS_SD_H_ */
+
diff --git a/ntfsprogs/utils.c b/ntfsprogs/utils.c
new file mode 100755
index 0000000..c5e9e23
--- a/dev/null
+++ b/ntfsprogs/utils.c
@@ -0,0 +1,1184 @@
+/**
+ * utils.c - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2002-2005 Richard Russon
+ * Copyright (c) 2003-2006 Anton Altaparmakov
+ * Copyright (c) 2003 Lode Leroy
+ * Copyright (c) 2005-2007 Yura Pakhuchiy
+ *
+ * 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
+ * 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
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#ifdef HAVE_STDIO_H
+#include <stdio.h>
+#endif
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+#ifdef HAVE_LIBINTL_H
+#include <libintl.h>
+#endif
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+#ifdef HAVE_CTYPE_H
+#include <ctype.h>
+#endif
+
+#include "utils.h"
+#include "types.h"
+#include "volume.h"
+#include "debug.h"
+#include "dir.h"
+/* #include "version.h" */
+#include "logging.h"
+#include "misc.h"
+
+const char *ntfs_bugs = "Developers' email address: "NTFS_DEV_LIST"\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";
+
+static const char *invalid_ntfs_msg =
+"The device '%s' doesn't have a valid NTFS.\n"
+"Maybe you selected the wrong device? Or the whole disk instead of a\n"
+"partition (e.g. /dev/hda, not /dev/hda1)? Or the other way around?\n";
+
+static const char *corrupt_volume_msg =
+"NTFS is inconsistent. Run chkdsk /f on Windows then reboot it TWICE!\n"
+"The usage of the /f parameter is very IMPORTANT! No modification was\n"
+"made to NTFS by this software.\n";
+
+static const char *hibernated_volume_msg =
+"The NTFS partition is hibernated. Please resume Windows and turned it \n"
+"off properly, so mounting could be done safely.\n";
+
+static const char *unclean_journal_msg =
+"Access is denied because the NTFS journal file is unclean. Choices are:\n"
+" A) Shutdown Windows properly.\n"
+" B) Click the 'Safely Remove Hardware' icon in the Windows taskbar\n"
+" notification area before disconnecting the device.\n"
+" C) Use 'Eject' from Windows Explorer to safely remove the device.\n"
+" D) If you ran chkdsk previously then boot Windows again which will\n"
+" automatically initialize the journal.\n"
+" E) Submit 'force' option (WARNING: This solution it not recommended).\n"
+" F) ntfsmount: Mount the volume read-only by using the 'ro' mount option.\n";
+
+static const char *opened_volume_msg =
+"Access is denied because the NTFS volume is already exclusively opened.\n"
+"The volume may be already mounted, or another software may use it which\n"
+"could be identified for example by the help of the 'fuser' command.\n";
+
+static const char *dirty_volume_msg =
+"Volume is scheduled for check.\n"
+"Please boot into Windows TWICE, or use the 'force' option.\n"
+"NOTE: If you had not scheduled check and last time accessed this volume\n"
+"using ntfsmount and shutdown system properly, then init scripts in your\n"
+"distribution are broken. Please report to your distribution developers\n"
+"(NOT to us!) that init scripts kill ntfsmount or mount.ntfs-fuse during\n"
+"shutdown instead of proper umount.\n";
+
+static const char *fakeraid_msg =
+"You seem to have a SoftRAID/FakeRAID hardware and must use an activated,\n"
+"different device under /dev/mapper, (e.g. /dev/mapper/nvidia_eahaabcc1)\n"
+"to mount NTFS. Please see the 'dmraid' documentation for help.\n";
+
+/**
+ * utils_set_locale
+ */
+int utils_set_locale(void)
+{
+ const char *locale;
+
+ locale = setlocale(LC_ALL, "");
+ if (!locale) {
+ locale = setlocale(LC_ALL, NULL);
+ ntfs_log_error("Failed to set locale, using default '%s'.\n",
+ locale);
+ return 1;
+ } else {
+ return 0;
+ }
+}
+
+/**
+ * linux-ntfs's ntfs_mbstoucs has different semantics, so we emulate it with
+ * ntfs-3g's.
+ */
+int ntfs_mbstoucs_libntfscompat(const char *ins,
+ ntfschar **outs, int outs_len)
+{
+ if(!outs) {
+ errno = EINVAL;
+ return -1;
+ }
+ else if(*outs != NULL) {
+ /* Note: libntfs's mbstoucs implementation allows the caller to
+ * specify a preallocated buffer while libntfs-3g's always
+ * allocates the output buffer.
+ */
+ ntfschar *tmpstr = NULL;
+ int tmpstr_len;
+
+ tmpstr_len = ntfs_mbstoucs(ins, &tmpstr);
+ if(tmpstr_len >= 0) {
+ if((tmpstr_len + 1) > outs_len) {
+ /* Doing a realloc instead of reusing tmpstr
+ * because it emulates libntfs's mbstoucs more
+ * closely. */
+ ntfschar *re_outs = realloc(*outs,
+ sizeof(ntfschar)*(tmpstr_len + 1));
+ if(!re_outs)
+ tmpstr_len = -1;
+ else
+ *outs = re_outs;
+ }
+
+ if(tmpstr_len >= 0) {
+ /* The extra character is the \0 terminator. */
+ memcpy(*outs, tmpstr,
+ sizeof(ntfschar)*(tmpstr_len + 1));
+ }
+
+ free(tmpstr);
+ }
+
+ return tmpstr_len;
+ }
+ else
+ return ntfs_mbstoucs(ins, outs);
+}
+
+/**
+ * utils_valid_device - Perform some safety checks on the device, before 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;
+
+#if defined(HAVE_WINDOWS_H) | defined(__CYGWIN32__)
+ /* FIXME: This doesn't work for Cygwin, so just return success. */
+ return 1;
+#endif
+ if (!name) {
+ errno = EINVAL;
+ return 0;
+ }
+
+ 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);
+ return 0;
+ }
+
+ /* 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);
+ if (!force) {
+ ntfs_log_error("Use the force option to ignore this "
+ "error.\n");
+ return 0;
+ }
+ ntfs_log_warning("Forced to continue.\n");
+ } else if (mnt_flags & NTFS_MF_MOUNTED) {
+ if (!force) {
+ ntfs_log_error("%s", opened_volume_msg);
+ ntfs_log_error("You can use force option to avoid this "
+ "check, but this is not recommended\n"
+ "and may lead to data corruption.\n");
+ return 0;
+ }
+ ntfs_log_warning("Forced to continue.\n");
+ }
+
+ return 1;
+}
+
+/**
+ * utils_mount_volume - Mount an NTFS volume
+ */
+ntfs_volume * utils_mount_volume(const char *device, unsigned long flags)
+{
+ ntfs_volume *vol;
+
+ if (!device) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ /* Porting notes:
+ *
+ * libntfs-3g does not have the 'force' flag in ntfs_mount_flags.
+ * The 'force' flag in libntfs bypasses two safety checks when mounting
+ * read/write:
+ * 1. Do not mount when the VOLUME_IS_DIRTY flag in
+ * VOLUME_INFORMATION is set.
+ * 2. Do not mount when the logfile is unclean.
+ *
+ * libntfs-3g only has safety check number 2. The dirty flag is simply
+ * ignored because we are confident that we can handle a dirty volume.
+ * So we treat NTFS_MNT_RECOVER like NTFS_MNT_FORCE, knowing that the
+ * first check is always bypassed.
+ */
+
+ if (!utils_valid_device(device, flags & NTFS_MNT_RECOVER))
+ return NULL;
+
+ vol = ntfs_mount(device, flags);
+ if (!vol) {
+ ntfs_log_perror("Failed to mount '%s'", device);
+ if (errno == EINVAL)
+ ntfs_log_error(invalid_ntfs_msg, device);
+ else if (errno == EIO)
+ ntfs_log_error("%s", corrupt_volume_msg);
+ else if (errno == EPERM)
+ ntfs_log_error("%s", hibernated_volume_msg);
+ else if (errno == EOPNOTSUPP)
+ ntfs_log_error("%s", unclean_journal_msg);
+ else if (errno == EBUSY)
+ ntfs_log_error("%s", opened_volume_msg);
+ else if (errno == ENXIO)
+ ntfs_log_error("%s", fakeraid_msg);
+ return NULL;
+ }
+
+ /* Porting notes:
+ * libntfs-3g does not record whether the volume log file was dirty
+ * before mount, so we can only warn if the VOLUME_IS_DIRTY flag is set
+ * in VOLUME_INFORMATION. */
+ if (vol->flags & VOLUME_IS_DIRTY) {
+ if (!(flags & NTFS_MNT_RECOVER)) {
+ ntfs_log_error("%s", dirty_volume_msg);
+ ntfs_umount(vol, FALSE);
+ return NULL;
+ }
+ ntfs_log_error("WARNING: Dirty volume mount was forced by the "
+ "'force' mount option.\n");
+ }
+ return vol;
+}
+
+/**
+ * utils_parse_size - Convert a string representing a size
+ * @value: String to be parsed
+ * @size: Parsed size
+ * @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.
+ *
+ * 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) {
+ errno = EINVAL;
+ return 0;
+ }
+
+ ntfs_log_debug("Parsing size '%s'.\n", value);
+
+ result = strtoll(value, &suffix, 0);
+ if (result < 0 || errno == ERANGE) {
+ ntfs_log_error("Invalid size '%s'.\n", value);
+ return 0;
+ }
+
+ if (!suffix) {
+ ntfs_log_error("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:
+ 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);
+ return 0;
+ }
+ }
+
+ ntfs_log_debug("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) {
+ errno = EINVAL;
+ return 0;
+ }
+
+ middle = strchr(string, '-');
+ if (string == middle) {
+ ntfs_log_debug("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
+ ntfs_log_debug("Range has no end, defaulting to %lld.\n", b);
+ } else {
+ if (!utils_parse_size(middle+1, &b, scale))
+ return 0;
+ }
+ } else {
+ b = a;
+ }
+
+ ntfs_log_debug("Range '%s' = %lld - %lld\n", string, a, b);
+
+ *start = a;
+ *finish = b;
+ 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) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ 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 */
+ }
+
+ ntfs_log_debug("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) {
+ 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)
+ 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);
+ 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
+ */
+#define max_path 20
+int utils_inode_get_name(ntfs_inode *inode, char *buffer, int bufsize)
+{
+ // XXX option: names = posix/win32 or dos
+ // flags: path, filename, or both
+
+
+ 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 ntfs_malloc? and make max bigger?
+ int i, len, offset = 0;
+
+ if (!inode || !buffer) {
+ errno = EINVAL;
+ return 0;
+ }
+
+ vol = inode->vol;
+
+ //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) {
+ 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);
+
+ 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 = le64_to_cpu(attr->parent_directory);
+
+ if (names[i]) {
+ free(names[i]);
+ names[i] = NULL;
+ }
+
+ 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 = ntfs_malloc(30);
+ if (!temp)
+ return 0;
+ snprintf(temp, 30, "<MFT%llu>", (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_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. */
+ //ntfs_log_debug("inode 5\n");
+ break;
+ }
+
+ inode = ntfs_inode_open(vol, parent);
+ if (!inode) {
+ ntfs_log_error("Couldn't open inode %llu.\n",
+ (unsigned long long)MREF(parent));
+ break;
+ }
+ }
+
+ 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);
+ 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)) {
+ ntfs_log_error("Pathname was truncated.\n");
+ break;
+ }
+
+ offset += len;
+ }
+
+ /* Free all the allocated memory */
+ for (i = 0; i < max_path; i++)
+ free(names[i]);
+
+ ntfs_log_debug("Pathname: %s\n", buffer);
+
+ return 1;
+}
+#undef max_path
+
+/**
+ * utils_attr_get_name
+ */
+int utils_attr_get_name(ntfs_volume *vol, ATTR_RECORD *attr, char *buffer, int bufsize)
+{
+ int len, namelen;
+ char *name;
+ ATTR_DEF *attrdef;
+
+ // flags: attr, name, or both
+ if (!attr || !buffer) {
+ errno = EINVAL;
+ return 0;
+ }
+
+ 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");
+ // <UNKNOWN>?
+ return 0;
+ }
+ len = snprintf(buffer, bufsize, "%s", name);
+ } else {
+ ntfs_log_error("Unknown attribute type 0x%02x\n", attr->type);
+ len = snprintf(buffer, bufsize, "<UNKNOWN>");
+ }
+
+ if (len >= bufsize) {
+ ntfs_log_error("Attribute type was truncated.\n");
+ return 0;
+ }
+
+ if (!attr->name_length) {
+ return 0;
+ }
+
+ buffer += len;
+ bufsize -= len;
+
+ name = NULL;
+ namelen = attr->name_length;
+ 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");
+ // <UNKNOWN>?
+ len = snprintf(buffer, bufsize, "<UNKNOWN>");
+ return 0;
+ }
+
+ len = snprintf(buffer, bufsize, "(%s)", name);
+ free(name);
+
+ if (len >= bufsize) {
+ ntfs_log_error("Attribute name was truncated.\n");
+ return 0;
+ }
+
+ 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. @bmplcn stores offset to the first bit (in bits) stored in the
+ * buffer.
+ *
+ * NOTE: Be very carefull with shifts by 3 everywhere in this function.
+ *
+ * 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) << 3);
+ int byte, bit;
+ ntfs_attr *attr;
+
+ if (!vol) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ /* Does lcn lie in the section of $Bitmap we already have cached? */
+ if ((lcn < bmplcn)
+ || (lcn >= (long long)(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_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));
+
+ 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);
+ }
+
+ 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);
+
+ 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) << 3) - 1; /* Which bit of $BITMAP is in the buffer */
+ int byte, bit;
+
+ ntfs_log_trace("Entering.\n");
+
+ 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) >= (s64)(bmpmref + (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));
+
+ 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");
+ }
+
+ 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);
+
+ return (buffer[byte] & bit);
+}
+
+/**
+ * __metadata
+ */
+static int __metadata(ntfs_volume *vol, u64 num)
+{
+ 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;
+ MFT_RECORD *file;
+ u64 num;
+
+ if (!inode) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ vol = inode->vol;
+ if (!vol)
+ return -1;
+
+ num = inode->mft_no;
+ if (__metadata(vol, num) == 1)
+ return 1;
+
+ file = inode->mrec;
+ if (file && (file->base_mft_record != 0)) {
+ num = MREF_LE(file->base_mft_record);
+ 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_LE(attr->parent_directory);
+ if ((num != FILE_root) && (__metadata(vol, num) == 1))
+ return 1;
+
+ 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
+ * @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(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
+
+ 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)
+ ntfs_log_debug("\t");
+ if (flags & DM_BOLD)
+ ntfs_log_debug("\e[01m");
+ if (flags & (DM_RED | DM_BLUE | DM_GREEN | DM_BOLD))
+ ntfs_log_debug("\e[%dm", col);
+ if (off == s)
+ ntfs_log_debug("%6.6x ", start);
+ else
+ ntfs_log_debug("%6.6x ", off);
+
+ for (i = 0; i < 16; i++) {
+ if ((i == 8) && (!(flags & DM_NO_DIVIDER)))
+ ntfs_log_debug(" -");
+ if (((off+i) >= start) && ((off+i) < (start+length)))
+ ntfs_log_debug(" %02X", mem[off+i]);
+ else
+ ntfs_log_debug(" ");
+ }
+ if (!(flags & DM_NO_ASCII)) {
+ 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]);
+ else
+ ntfs_log_debug(".");
+ }
+ }
+ if (flags & (DM_RED | DM_BLUE | DM_GREEN | DM_BOLD))
+ ntfs_log_debug("\e[0m");
+ ntfs_log_debug("\n");
+ }
+}
+
+
+/**
+ * mft_get_search_ctx
+ */
+struct mft_search_ctx * mft_get_search_ctx(ntfs_volume *vol)
+{
+ struct mft_search_ctx *ctx;
+
+ if (!vol) {
+ errno = EINVAL;
+ return NULL;
+ }
+
+ ctx = (struct mft_search_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)
+{
+ s64 nr_mft_records;
+ ATTR_RECORD *attr10 = NULL;
+ ATTR_RECORD *attr20 = NULL;
+ ATTR_RECORD *attr80 = NULL;
+ ntfs_attr_search_ctx *attr_ctx;
+
+ if (!ctx) {
+ errno = EINVAL;
+ return -1;
+ }
+
+ if (ctx->inode) {
+ ntfs_inode_close(ctx->inode);
+ ctx->inode = NULL;
+ }
+
+ 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;
+ 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",
+ (unsigned long long)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) {
+ 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);
+
+ 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(ctx->inode, NULL);
+ if (attr_ctx) {
+ 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);
+ } else {
+ ntfs_log_error("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;
+ //ntfs_log_error("Error reading inode %lld.\n", ctx->mft_num);
+ //return -1;
+ }
+
+ } else { // !in_use
+ ntfs_attr *mft;
+
+ ctx->flags_match |= FEMR_NOT_IN_USE;
+
+ ctx->inode = (ntfs_inode*)calloc(1, sizeof(*ctx->inode));
+ if (!ctx->inode) {
+ 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 = ntfs_malloc(ctx->vol->mft_record_size);
+ if (!ctx->inode->mrec) {
+ free(ctx->inode); // == ntfs_inode_close
+ return -1;
+ }
+
+ mft = ntfs_attr_open(ctx->vol->mft_ni, AT_DATA,
+ AT_UNNAMED, 0);
+ if (!mft) {
+ 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_perror("Couldn't read MFT Record %llu",
+ (unsigned long long) ctx->mft_num);
+ // free / close
+ ntfs_attr_close(mft);
+ return -1;
+ }
+
+ ntfs_attr_close(mft);
+ }
+
+ if (ctx->flags_match & ctx->flags_search) {
+ break;
+ }
+
+ if (ntfs_inode_close(ctx->inode)) {
+ ntfs_log_error("Error closing inode %llu.\n",
+ (unsigned long long)ctx->mft_num);
+ return -errno;
+ }
+
+ ctx->inode = NULL;
+ }
+
+ return (ctx->inode == NULL);
+}
+
+#ifdef HAVE_WINDOWS_H
+
+/*
+ * Translate formats for older Windows
+ *
+ * Up to Windows XP, msvcrt.dll does not support long long format
+ * specifications (%lld, %llx, etc). We have to translate them
+ * to %I64.
+ */
+
+char *ntfs_utils_reformat(char *out, int sz, const char *fmt)
+{
+ const char *f;
+ char *p;
+ int i;
+ enum { F_INIT, F_PERCENT, F_FIRST } state;
+
+ i = 0;
+ f = fmt;
+ p = out;
+ state = F_INIT;
+ while (*f && ((i + 3) < sz)) {
+ switch (state) {
+ case F_INIT :
+ if (*f == '%')
+ state = F_PERCENT;
+ *p++ = *f++;
+ i++;
+ break;
+ case F_PERCENT :
+ if (*f == 'l') {
+ state = F_FIRST;
+ f++;
+ } else {
+ if (((*f < '0') || (*f > '9'))
+ && (*f != '*') && (*f != '-'))
+ state = F_INIT;
+ *p++ = *f++;
+ i++;
+ }
+ break;
+ case F_FIRST :
+ if (*f == 'l') {
+ *p++ = 'I';
+ *p++ = '6';
+ *p++ = '4';
+ f++;
+ i += 3;
+ } else {
+ *p++ = 'l';
+ *p++ = *f++;
+ i += 2;
+ }
+ state = F_INIT;
+ break;
+ }
+ }
+ *p++ = 0;
+ return (out);
+}
+
+#endif
diff --git a/ntfsprogs/utils.h b/ntfsprogs/utils.h
new file mode 100755
index 0000000..8b6bfae
--- a/dev/null
+++ b/ntfsprogs/utils.h
@@ -0,0 +1,137 @@
+/*
+ * utils.h - Part of the Linux-NTFS project.
+ *
+ * Copyright (c) 2002-2005 Richard Russon
+ * Copyright (c) 2004 Anton Altaparmakov
+ *
+ * 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
+ * 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 "config.h"
+
+#include "types.h"
+#include "layout.h"
+#include "volume.h"
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_STDARG_H
+#include <stdarg.h>
+#endif
+
+extern const char *ntfs_bugs;
+extern const char *ntfs_gpl;
+
+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 flags);
+
+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_valid_device(const char *name, int force);
+ntfs_volume * utils_mount_volume(const char *device, unsigned long flags);
+
+/**
+ * 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;
+ ntfs_volume *vol;
+ 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);
+
+// 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)
+
+/* MAX_PATH definition was missing in ntfs-3g's headers. */
+#ifndef MAX_PATH
+#define MAX_PATH 1024
+#endif
+
+#ifdef HAVE_WINDOWS_H
+/*
+ * Macroes to hide the needs to translate formats on older Windows
+ */
+#define MAX_FMT 1536
+char *ntfs_utils_reformat(char *out, int sz, const char *fmt);
+#define ntfs_log_redirect(fn,fi,li,le,d,fmt, args...) \
+ do { char buf[MAX_FMT]; ntfs_log_redirect(fn,fi,li,le,d, \
+ ntfs_utils_reformat(buf,MAX_FMT,fmt), args); } while (0)
+#define printf(fmt, args...) \
+ do { char buf[MAX_FMT]; \
+ printf(ntfs_utils_reformat(buf,MAX_FMT,fmt), args); } while (0)
+#define fprintf(str, fmt, args...) \
+ do { char buf[MAX_FMT]; \
+ fprintf(str, ntfs_utils_reformat(buf,MAX_FMT,fmt), args); } while (0)
+#define vfprintf(file, fmt, args) \
+ do { char buf[MAX_FMT]; vfprintf(file, \
+ ntfs_utils_reformat(buf,MAX_FMT,fmt), args); } while (0)
+#endif
+
+/**
+ * linux-ntfs's ntfs_mbstoucs has different semantics, so we emulate it with
+ * ntfs-3g's.
+ */
+int ntfs_mbstoucs_libntfscompat(const char *ins,
+ ntfschar **outs, int outs_len);
+
+/* This simple utility function was missing from libntfs-3g. */
+static __inline__ ntfschar *ntfs_attr_get_name(ATTR_RECORD *attr)
+{
+ return (ntfschar*)((u8*)attr + le16_to_cpu(attr->name_offset));
+}
+
+#endif /* _NTFS_UTILS_H_ */
diff --git a/prog.IAB b/prog.IAB
deleted file mode 100755
index 167d18e..0000000
--- a/prog.IAB
+++ b/dev/null
@@ -1,1071 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-6
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- (
-
-
-
-
-
-
-
-B
-
-/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-6
-
-
-
-
-
-
-
-
- (
-
-
-
-
-
-
-
-
-
-
-
-B
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-C
-
-
-
-
-
-
-
-
-
-
-6
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-'
-B
-
-/
-'
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-C
-6
-
-
-
-
-
-
-
-'
-'
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-C
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-C
-
-
-
-
-
-
-
-
-
-
- (
-
-
-
-
-
-
-
-
-
-
-B
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-6
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/prog.IAD b/prog.IAD
deleted file mode 100755
index 3329394..0000000
--- a/prog.IAD
+++ b/dev/null
@@ -1,5 +0,0 @@
-’
-
-
-
-
diff --git a/prog.IMB b/prog.IMB
deleted file mode 100755
index 1c9c978..0000000
--- a/prog.IMB
+++ b/dev/null
@@ -1,466 +0,0 @@
-Ÿ
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-C
-
-
-
-
-
-
-
-
-
-
-
-
-
-B
-
-
-
-
-
-/
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-'
-'
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-6
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-C
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-'
-'
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/prog.IMD b/prog.IMD
deleted file mode 100755
index d71a53c..0000000
--- a/prog.IMD
+++ b/dev/null
@@ -1,2 +0,0 @@
-’
-
diff --git a/prog.PFI b/prog.PFI
deleted file mode 100755
index 51211ed..0000000
--- a/prog.PFI
+++ b/dev/null
@@ -1,2 +0,0 @@
-
-
diff --git a/prog.PO b/prog.PO
deleted file mode 100755
index 666d349..0000000
--- a/prog.PO
+++ b/dev/null
@@ -1 +0,0 @@
-1
diff --git a/prog.PR b/prog.PR
deleted file mode 100755
index c3bd870..0000000
--- a/prog.PR
+++ b/dev/null
@@ -1,14 +0,0 @@
-#
-
-
-
-
-
-#
-
-
-
-
-
-
-
diff --git a/prog.PRI b/prog.PRI
deleted file mode 100755
index 6ab7b84..0000000
--- a/prog.PRI
+++ b/dev/null
@@ -1,219 +0,0 @@
-
-@
-
-
-}­D:z7¥ËÞ¨v%§Šg¥[X”€Â
-
-
-b8
-IA
-!H 
-
-@
-P
-@
- %„Aä"`
- @ 
-
-H¡ L
-
-„
-
-
-
-0H 
-X$
-
- 
-
-€
- 2€°  aƒ(Qa`
-
-
-
-” 
-
-%
-
- „H @@ 
-
-
-
-
-
-
-2
-„Hb
-
-
-€¢™@3 †@BR
-
-
-`
-
-
-
-
-($¦Ñ¸—éEáZ‘@
-
-@
-
- 
-@))à
- Ñ° ` €PAA
-
- µÓô"é
-
-@2€ A"
-
-
-!
-
-²,‘ÌÂ"X%€1LIú‰> ð””Âf‰"à "B*
-
-0b’´ x—óù‚Ä{9«¾Kã6l 
-
-„
-
-€
-
-
-$
-
-
-@
-
-
-@
-
-
-
-!
-²,±ÌÂ"x%€qLAø‰> ð”Âf‰Ã("B(
-0¢’· x—óùÀÄ{9«¾Kc>o 
-
-„
-
-
-`
-
-
-$
-
-$ ‚
-€
-
-$
- f„A¢Á&$¡ P@„
-  @
-"B@
-@
-yÿöïoÎa¥}R@€
-EQº#-E
-
-° $0Π
-L,ÕL²}à¡j@=”)
-@b
-
-
-0 DÔ
-P
-
- (
-
-
-
-@@
-
-
-
-‚
-
-iÚo¯gÄI Eä
-("%¥$!J
-
-@H
-
-€
-
-
-€
-@@
-EH "R@
-€
-*
-@
-
-@á 
-
-
-
-Q” A ‚
-a
- B
-
-
-
-
-
-‚
-hõæíCÆé]%L
-‚Ž€: õ„¶D â
-0ÉaL† $
-ðP *
-
-
-@
-
-
-(
- ÃÀ" 2ã€P@€ (
-
-@
-
-
-
-’ ('
-
-  ƒ
-
-HX G‡d`‚
-
-”"j±
-
-”(TÇ‘”za
-
-H# †€ˆ€
-@ð
-
-
-
- ‚€P@
-Bˆ
- ÁŽ À
- "
-D@
-@@
-†H
-B…@2c!›<p@(öD1P@
-
-
-
-
-dB
-
-0
-
-
-
-
-
-
-
-
-@ €
-
diff --git a/prog.PS b/prog.PS
deleted file mode 100755
index fdabd4e..0000000
--- a/prog.PS
+++ b/dev/null
@@ -1,979 +0,0 @@
-
-designates
-
-
-
-
-
-
-
-
-
-
-
-AT_UNNAMED
-
-
-
-
-
-
-
-
-
-
-
-STREAM_SDS
-stuff_hole
-stuff_hole
-
-
-
-
-
-ntfs_flush
-
-HAVE_UTIME
-HAVE__BOOL
-_REENTRANT
-BLKGETSIZE
-ntfs_pread
-INDEX_TYPE
-
-
-generation
-name_table
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-generation
-
-open_count
-OFFSET_MAX
-
-
-
-unref_node
-unref_node
-add_option
-check_perm
-drop_privs
-drop_privs
-fusermount
-
-mount_fuse
-MS_DIRSYNC
-
-
-
-
-
-do_destroy
-do_getattr
-
-do_opendir
-
-do_readdir
-do_release
-do_setattr
-do_symlink
-
-fill_entry
-allow_root
-interrupts
-
-
-FUSE_MAXOP
-
-
-
-
-
-
-iov_length
-OFFSET_MAX
-send_reply
-
-
-
-
-
-
-
-
-
-
-
-
-fuse_mount
-
-
-
-
-
-C
-
-
-
-
-
-ZONE_DATA1
-ZONE_DATA2
-
-
-
-drop_privs
-drop_privs
-
-
-
-
-KERNELACLS
-
-
-mount_fuse
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-ntfs_close
-
-
-
-
-
-
-
-
-
-
-'
-setuid_msg
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-open_files
-
-
-
-old_seq_no
- (
-
-mount_opts
-allow_root
-
-
-
-
-MS_DIRSYNC
-fusermount
-
-
-drop_privs
-drop_privs
-
-
-
-KERNELACLS
-mount_fuse
-ntfs_close
-
-
-B
-
-
-
-/
-'
-
-
-setuid_msg
-
-
-mappingdir
-
-
-
-ntfs_rl_mc
-ntfs_rl_mm
-
-
-
-
-chkisalloc
-
-
-
-
-
-
-firstalloc
-freeblocks
-freeblocks
-
-
-
-
-
-getoptions
-getoptions
-
-
-
-
-
-printerror
-printerror
-recurseset
-recurseset
-recurseset
-same_posix
-showheader
-showheader
-singleshow
-singleshow
-singleshow
-
-
-updatefull
-updatefull
-updatefull
-
-
-alignment1
-alignment2
-
-chkisalloc
-DIR_GWRITE
-FILEREADER
-FILE_GEXEC
-FILE_GREAD
-FILE_WRITE
-
-
-
-{anonGUID}
-MAXSECURID
-keysecurid
-keysecurid
-
-{anonGUID}
-
-
-
-
-
-
-
-
-keysecurid
-sdh_stream
-keysecurid
-sii_stream
-
-
-
-
-
-6
-
-
-ntfs_fsync
-
-
-currentsid
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-ntfs_mount
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-part_start
-
-
-
-
-vol_handle
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-__lockkind
-
-
-
-
-
-
-
-
-
-
-DIR_GWRITE
-
-
-
-
-
-
-FILEREADER
-
-
-FILE_GEXEC
-
-FILE_GREAD
-
-
-
-
-FILE_WRITE
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-AT_UNNAMED
-LCN_EINVAL
-LCN_ENOENT
-_ntfs_attr
-data_flags
-
-
-
-
-
-STREAM_SDS
-ntfs_rol32
-ntfs_ror32
-CACHE_FREE
-cache_free
-cache_hash
-first_hash
-fixed_size
-free_entry
-HASH_ENTRY
-__inline__
-ntfs_pread
-
-BLKGETSIZE
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-releasedir
-async_read
-
-
-
-
-
-
-
-
-
-
-keep_cache
-lock_owner
-
-fuse_mount
-FATTR_MODE
-
-FATTR_SIZE
-attr_valid
-
-attr_valid
-generation
-FUSE_FLUSH
-lock_owner
-FUSE_FSYNC
-FUSE_GETLK
-
-fuse_lk_in
-FUSE_MAJOR
-FUSE_MINOR
-FUSE_MKDIR
-FUSE_MKNOD
-open_flags
-lock_owner
-FUSE_RMDIR
-FUSE_SETLK
-FUSE_WRITE
-lock_owner
-
-generation
-fuse_ino_t
-releasedir
-fuse_req_t
-
-
-
-
-
-block_size
-is_in_root
-parent_pos
-parent_vcn
-ntfs_inode
-extent_nis
-nr_extents
-extent_nis
-
-
-
-
-ACE_HEADER
-ATTR_FLAGS
-ATTR_TYPES
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-INDEX_NODE
-INDEX_ROOT
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-magic_BAAD
-magic_CHKD
-magic_FILE
-magic_HOLE
-magic_INDX
-magic_RCRD
-magic_RSTR
-MFT_RECORD
-MK_LE_MREF
-
-
-
-
-
-
-
-
-
-
-
-media_type
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-link_count
-link_count
-lowest_vcn
-
-reserved12
-lowest_vcn
-
-alignment1
-alignment2
-
-
-
-bytes_used
-key_length
-
-key_length
-
-
-
-
-
-
-
-
-
-
-fek_offset
-
-
-
-
-
-
-
-
-
-
-
-
-sid_offset
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-device_end
-
-
-
-
-
-
-FIRST_ZONE
-LOG_RECORD
-chkdsk_lsn
-oldest_lsn
-
-
-seq_number
-page_count
-seq_number
-
-target_vcn
-
-
-inh_fileid
-pxdescsize
-cachetable
-
-{anonBOOL}
-{anonBOOL}
-MS_RECOVER
-ntfs_mount
-full_zones
-mftmirr_na
-mftmirr_ni
-upcase_len
-
-
-
diff --git a/prog.SearchResults b/prog.SearchResults
deleted file mode 100755
index 1dbb4a8..0000000
--- a/prog.SearchResults
+++ b/dev/null
@@ -1,3 +0,0 @@
----- ntfs_fuse_open Æ¥Åä (2 ÔÚ 0 Îļþ ) ----
-Ntfs-3g.c (src):static int ntfs_fuse_open(const char *org_path,
-Ntfs-3g.c (src): .open = ntfs_fuse_open,
diff --git a/prog.WK3 b/prog.WK3
deleted file mode 100755
index 36e2814..0000000
--- a/prog.WK3
+++ b/dev/null
@@ -1,9 +0,0 @@
-
-
-secaudit.h HAVE_ENDIAN_H_NTFS_ENDIANS_Hntfs_fuse_openvolum
-
-
-rpl_malloc
-gnu_getopt
-USE_UCLIBC
-secaudit.h
diff --git a/src/Makefile.am b/src/Makefile.am
new file mode 100755
index 0000000..89ac5ce
--- a/dev/null
+++ b/src/Makefile.am
@@ -0,0 +1,86 @@
+
+EXTRA_DIST = secaudit.h ntfs-3g_common.h
+
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
+
+if FUSE_INTERNAL
+FUSE_CFLAGS = -I$(top_srcdir)/include/fuse-lite
+FUSE_LIBS = $(top_builddir)/libfuse-lite/libfuse-lite.la
+else
+FUSE_CFLAGS = $(FUSE_MODULE_CFLAGS)
+FUSE_LIBS = $(FUSE_MODULE_LIBS)
+endif
+
+if ENABLE_NTFS_3G
+
+bin_PROGRAMS = ntfs-3g.probe \
+ ntfs-3g.usermap \
+ ntfs-3g.secaudit
+rootbin_PROGRAMS = ntfs-3g lowntfs-3g
+rootsbin_DATA = #Create directory
+man_MANS = ntfs-3g.8 ntfs-3g.probe.8 \
+ ntfs-3g.usermap.8 \
+ ntfs-3g.secaudit.8
+
+ntfs_3g_LDADD = $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la
+if REALLYSTATIC
+ntfs_3g_LDFLAGS = $(AM_LDFLAGS) -all-static
+endif
+ntfs_3g_CFLAGS = \
+ $(AM_CFLAGS) \
+ -DFUSE_USE_VERSION=26 \
+ $(FUSE_CFLAGS) \
+ -I$(top_srcdir)/include/ntfs-3g
+ntfs_3g_SOURCES = ntfs-3g.c ntfs-3g_common.c
+
+lowntfs_3g_LDADD = $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la
+if REALLYSTATIC
+lowntfs_3g_LDFLAGS = $(AM_LDFLAGS) -all-static
+endif
+lowntfs_3g_CFLAGS = \
+ $(AM_CFLAGS) \
+ -DFUSE_USE_VERSION=26 \
+ $(FUSE_CFLAGS) \
+ -I$(top_srcdir)/include/ntfs-3g
+lowntfs_3g_SOURCES = lowntfs-3g.c ntfs-3g_common.c
+
+ntfs_3g_probe_LDADD = $(top_builddir)/libntfs-3g/libntfs-3g.la
+ntfs_3g_usermap_LDADD = $(top_builddir)/libntfs-3g/libntfs-3g.la
+ntfs_3g_secaudit_LDADD = $(top_builddir)/libntfs-3g/libntfs-3g.la
+if REALLYSTATIC
+ntfs_3g_probe_LDFLAGS = $(AM_LDFLAGS) -all-static
+ntfs_3g_usermap_LDFLAGS = $(AM_LDFLAGS) -all-static
+ntfs_3g_secaudit_LDFLAGS = $(AM_LDFLAGS) -all-static
+endif
+ntfs_3g_probe_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/include/ntfs-3g
+ntfs_3g_usermap_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/include/ntfs-3g
+ntfs_3g_secaudit_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/include/ntfs-3g
+ntfs_3g_probe_SOURCES = ntfs-3g.probe.c
+ntfs_3g_usermap_SOURCES = usermap.c
+ntfs_3g_secaudit_SOURCES = secaudit.c
+
+drivers : $(FUSE_LIBS) ntfs-3g lowntfs-3g
+
+if RUN_LDCONFIG
+install-exec-hook:
+ $(LDCONFIG)
+endif
+
+if ENABLE_MOUNT_HELPER
+install-exec-local: install-rootbinPROGRAMS
+ $(MKDIR_P) "$(DESTDIR)/sbin"
+ $(LN_S) -f "$(rootbindir)/ntfs-3g" "$(DESTDIR)/sbin/mount.ntfs-3g"
+ $(LN_S) -f "$(rootbindir)/lowntfs-3g" "$(DESTDIR)/sbin/mount.lowntfs-3g"
+endif
+
+install-data-local: install-man8
+ $(LN_S) -f ntfs-3g.8 "$(DESTDIR)$(man8dir)/mount.ntfs-3g.8"
+ $(LN_S) -f ntfs-3g.8 "$(DESTDIR)$(man8dir)/mount.lowntfs-3g.8"
+
+uninstall-local:
+ $(RM) -f "$(DESTDIR)$(man8dir)/mount.ntfs-3g.8"
+if ENABLE_MOUNT_HELPER
+ $(RM) -f "$(DESTDIR)/sbin/mount.ntfs-3g" "$(DESTDIR)/sbin/mount.lowntfs-3g"
+endif
+
+endif # ENABLE_NTFS_3G
diff --git a/src/Makefile.in b/src/Makefile.in
new file mode 100755
index 0000000..b3a3b70
--- a/dev/null
+++ b/src/Makefile.in
@@ -0,0 +1,938 @@
+# Makefile.in generated by automake 1.11.1 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004, 2005, 2006, 2007, 2008, 2009 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@
+
+
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkglibexecdir = $(libexecdir)/@PACKAGE@
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+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@
+@ENABLE_NTFS_3G_TRUE@bin_PROGRAMS = ntfs-3g.probe$(EXEEXT) \
+@ENABLE_NTFS_3G_TRUE@ ntfs-3g.usermap$(EXEEXT) \
+@ENABLE_NTFS_3G_TRUE@ ntfs-3g.secaudit$(EXEEXT)
+@ENABLE_NTFS_3G_TRUE@rootbin_PROGRAMS = ntfs-3g$(EXEEXT) \
+@ENABLE_NTFS_3G_TRUE@ lowntfs-3g$(EXEEXT)
+subdir = src
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+ $(srcdir)/ntfs-3g.8.in $(srcdir)/ntfs-3g.probe.8.in \
+ $(srcdir)/ntfs-3g.secaudit.8.in $(srcdir)/ntfs-3g.usermap.8.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
+ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
+ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
+ $(top_srcdir)/configure.ac
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(install_sh) -d
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES = ntfs-3g.8 ntfs-3g.probe.8 ntfs-3g.usermap.8 \
+ ntfs-3g.secaudit.8
+CONFIG_CLEAN_VPATH_FILES =
+am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(rootbindir)" \
+ "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(rootsbindir)"
+PROGRAMS = $(bin_PROGRAMS) $(rootbin_PROGRAMS)
+am__lowntfs_3g_SOURCES_DIST = lowntfs-3g.c ntfs-3g_common.c
+@ENABLE_NTFS_3G_TRUE@am_lowntfs_3g_OBJECTS = \
+@ENABLE_NTFS_3G_TRUE@ lowntfs_3g-lowntfs-3g.$(OBJEXT) \
+@ENABLE_NTFS_3G_TRUE@ lowntfs_3g-ntfs-3g_common.$(OBJEXT)
+lowntfs_3g_OBJECTS = $(am_lowntfs_3g_OBJECTS)
+am__DEPENDENCIES_1 =
+@FUSE_INTERNAL_FALSE@am__DEPENDENCIES_2 = $(am__DEPENDENCIES_1)
+@FUSE_INTERNAL_TRUE@am__DEPENDENCIES_2 = $(top_builddir)/libfuse-lite/libfuse-lite.la
+@ENABLE_NTFS_3G_TRUE@lowntfs_3g_DEPENDENCIES = $(am__DEPENDENCIES_2) \
+@ENABLE_NTFS_3G_TRUE@ $(top_builddir)/libntfs-3g/libntfs-3g.la
+lowntfs_3g_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(lowntfs_3g_CFLAGS) \
+ $(CFLAGS) $(lowntfs_3g_LDFLAGS) $(LDFLAGS) -o $@
+am__ntfs_3g_SOURCES_DIST = ntfs-3g.c ntfs-3g_common.c
+@ENABLE_NTFS_3G_TRUE@am_ntfs_3g_OBJECTS = ntfs_3g-ntfs-3g.$(OBJEXT) \
+@ENABLE_NTFS_3G_TRUE@ ntfs_3g-ntfs-3g_common.$(OBJEXT)
+ntfs_3g_OBJECTS = $(am_ntfs_3g_OBJECTS)
+@ENABLE_NTFS_3G_TRUE@ntfs_3g_DEPENDENCIES = $(am__DEPENDENCIES_2) \
+@ENABLE_NTFS_3G_TRUE@ $(top_builddir)/libntfs-3g/libntfs-3g.la
+ntfs_3g_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(ntfs_3g_CFLAGS) $(CFLAGS) \
+ $(ntfs_3g_LDFLAGS) $(LDFLAGS) -o $@
+am__ntfs_3g_probe_SOURCES_DIST = ntfs-3g.probe.c
+@ENABLE_NTFS_3G_TRUE@am_ntfs_3g_probe_OBJECTS = \
+@ENABLE_NTFS_3G_TRUE@ ntfs_3g_probe-ntfs-3g.probe.$(OBJEXT)
+ntfs_3g_probe_OBJECTS = $(am_ntfs_3g_probe_OBJECTS)
+@ENABLE_NTFS_3G_TRUE@ntfs_3g_probe_DEPENDENCIES = \
+@ENABLE_NTFS_3G_TRUE@ $(top_builddir)/libntfs-3g/libntfs-3g.la
+ntfs_3g_probe_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(ntfs_3g_probe_CFLAGS) \
+ $(CFLAGS) $(ntfs_3g_probe_LDFLAGS) $(LDFLAGS) -o $@
+am__ntfs_3g_secaudit_SOURCES_DIST = secaudit.c
+@ENABLE_NTFS_3G_TRUE@am_ntfs_3g_secaudit_OBJECTS = \
+@ENABLE_NTFS_3G_TRUE@ ntfs_3g_secaudit-secaudit.$(OBJEXT)
+ntfs_3g_secaudit_OBJECTS = $(am_ntfs_3g_secaudit_OBJECTS)
+@ENABLE_NTFS_3G_TRUE@ntfs_3g_secaudit_DEPENDENCIES = \
+@ENABLE_NTFS_3G_TRUE@ $(top_builddir)/libntfs-3g/libntfs-3g.la
+ntfs_3g_secaudit_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(ntfs_3g_secaudit_CFLAGS) \
+ $(CFLAGS) $(ntfs_3g_secaudit_LDFLAGS) $(LDFLAGS) -o $@
+am__ntfs_3g_usermap_SOURCES_DIST = usermap.c
+@ENABLE_NTFS_3G_TRUE@am_ntfs_3g_usermap_OBJECTS = \
+@ENABLE_NTFS_3G_TRUE@ ntfs_3g_usermap-usermap.$(OBJEXT)
+ntfs_3g_usermap_OBJECTS = $(am_ntfs_3g_usermap_OBJECTS)
+@ENABLE_NTFS_3G_TRUE@ntfs_3g_usermap_DEPENDENCIES = \
+@ENABLE_NTFS_3G_TRUE@ $(top_builddir)/libntfs-3g/libntfs-3g.la
+ntfs_3g_usermap_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
+ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(ntfs_3g_usermap_CFLAGS) \
+ $(CFLAGS) $(ntfs_3g_usermap_LDFLAGS) $(LDFLAGS) -o $@
+DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+am__mv = mv -f
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
+ --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
+ $(LDFLAGS) -o $@
+SOURCES = $(lowntfs_3g_SOURCES) $(ntfs_3g_SOURCES) \
+ $(ntfs_3g_probe_SOURCES) $(ntfs_3g_secaudit_SOURCES) \
+ $(ntfs_3g_usermap_SOURCES)
+DIST_SOURCES = $(am__lowntfs_3g_SOURCES_DIST) \
+ $(am__ntfs_3g_SOURCES_DIST) $(am__ntfs_3g_probe_SOURCES_DIST) \
+ $(am__ntfs_3g_secaudit_SOURCES_DIST) \
+ $(am__ntfs_3g_usermap_SOURCES_DIST)
+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 = f=`echo $$p | sed -e 's|^.*/||'`;
+am__install_max = 40
+am__nobase_strip_setup = \
+ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
+am__nobase_strip = \
+ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
+am__nobase_list = $(am__nobase_strip_setup); \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
+ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
+ if (++n[$$2] == $(am__install_max)) \
+ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
+ END { for (dir in files) print dir, files[dir] }'
+am__base_list = \
+ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
+ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+man8dir = $(mandir)/man8
+NROFF = nroff
+MANS = $(man_MANS)
+DATA = $(rootsbin_DATA)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+CC = @CC@
+CCDEPMODE = @CCDEPMODE@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFS = @DEFS@
+DEPDIR = @DEPDIR@
+DSYMUTIL = @DSYMUTIL@
+DUMPBIN = @DUMPBIN@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+EXEEXT = @EXEEXT@
+FGREP = @FGREP@
+FUSE_MODULE_CFLAGS = @FUSE_MODULE_CFLAGS@
+FUSE_MODULE_LIBS = @FUSE_MODULE_LIBS@
+GNUTLS_CFLAGS = @GNUTLS_CFLAGS@
+GNUTLS_LIBS = @GNUTLS_LIBS@
+GREP = @GREP@
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LD = @LD@
+LDCONFIG = @LDCONFIG@
+LDFLAGS = @LDFLAGS@
+LIBFUSE_LITE_CFLAGS = @LIBFUSE_LITE_CFLAGS@
+LIBFUSE_LITE_LIBS = @LIBFUSE_LITE_LIBS@
+LIBGCRYPT_CFLAGS = @LIBGCRYPT_CFLAGS@
+LIBGCRYPT_CONFIG = @LIBGCRYPT_CONFIG@
+LIBGCRYPT_LIBS = @LIBGCRYPT_LIBS@
+LIBNTFS_3G_VERSION = @LIBNTFS_3G_VERSION@
+LIBNTFS_CPPFLAGS = @LIBNTFS_CPPFLAGS@
+LIBNTFS_LIBS = @LIBNTFS_LIBS@
+LIBOBJS = @LIBOBJS@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LIPO = @LIPO@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+MAINT = @MAINT@
+MAKEINFO = @MAKEINFO@
+MKDIR_P = @MKDIR_P@
+MKNTFS_CPPFLAGS = @MKNTFS_CPPFLAGS@
+MKNTFS_LIBS = @MKNTFS_LIBS@
+MV = @MV@
+NM = @NM@
+NMEDIT = @NMEDIT@
+NTFSPROGS_STATIC_LIBS = @NTFSPROGS_STATIC_LIBS@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+OTOOL = @OTOOL@
+OTOOL64 = @OTOOL64@
+OUTPUT_FORMAT = @OUTPUT_FORMAT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+PKG_CONFIG = @PKG_CONFIG@
+PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@
+PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
+RANLIB = @RANLIB@
+RM = @RM@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+STRIP = @STRIP@
+VERSION = @VERSION@
+abs_builddir = @abs_builddir@
+abs_srcdir = @abs_srcdir@
+abs_top_builddir = @abs_top_builddir@
+abs_top_srcdir = @abs_top_srcdir@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
+all_includes = @all_includes@
+all_libraries = @all_libraries@
+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@
+builddir = @builddir@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+lt_ECHO = @lt_ECHO@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+ntfs3gincludedir = @ntfs3gincludedir@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+pkgconfigdir = @pkgconfigdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+rootbindir = @rootbindir@
+rootlibdir = @rootlibdir@
+rootsbindir = @rootsbindir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+srcdir = @srcdir@
+sysconfdir = @sysconfdir@
+target = @target@
+target_alias = @target_alias@
+target_cpu = @target_cpu@
+target_os = @target_os@
+target_vendor = @target_vendor@
+top_build_prefix = @top_build_prefix@
+top_builddir = @top_builddir@
+top_srcdir = @top_srcdir@
+EXTRA_DIST = secaudit.h ntfs-3g_common.h
+MAINTAINERCLEANFILES = $(srcdir)/Makefile.in
+@FUSE_INTERNAL_FALSE@FUSE_CFLAGS = $(FUSE_MODULE_CFLAGS)
+@FUSE_INTERNAL_TRUE@FUSE_CFLAGS = -I$(top_srcdir)/include/fuse-lite
+@FUSE_INTERNAL_FALSE@FUSE_LIBS = $(FUSE_MODULE_LIBS)
+@FUSE_INTERNAL_TRUE@FUSE_LIBS = $(top_builddir)/libfuse-lite/libfuse-lite.la
+@ENABLE_NTFS_3G_TRUE@rootsbin_DATA = #Create directory
+@ENABLE_NTFS_3G_TRUE@man_MANS = ntfs-3g.8 ntfs-3g.probe.8 \
+@ENABLE_NTFS_3G_TRUE@ ntfs-3g.usermap.8 \
+@ENABLE_NTFS_3G_TRUE@ ntfs-3g.secaudit.8
+
+@ENABLE_NTFS_3G_TRUE@ntfs_3g_LDADD = $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la
+@ENABLE_NTFS_3G_TRUE@@REALLYSTATIC_TRUE@ntfs_3g_LDFLAGS = $(AM_LDFLAGS) -all-static
+@ENABLE_NTFS_3G_TRUE@ntfs_3g_CFLAGS = \
+@ENABLE_NTFS_3G_TRUE@ $(AM_CFLAGS) \
+@ENABLE_NTFS_3G_TRUE@ -DFUSE_USE_VERSION=26 \
+@ENABLE_NTFS_3G_TRUE@ $(FUSE_CFLAGS) \
+@ENABLE_NTFS_3G_TRUE@ -I$(top_srcdir)/include/ntfs-3g
+
+@ENABLE_NTFS_3G_TRUE@ntfs_3g_SOURCES = ntfs-3g.c ntfs-3g_common.c
+@ENABLE_NTFS_3G_TRUE@lowntfs_3g_LDADD = $(FUSE_LIBS) $(top_builddir)/libntfs-3g/libntfs-3g.la
+@ENABLE_NTFS_3G_TRUE@@REALLYSTATIC_TRUE@lowntfs_3g_LDFLAGS = $(AM_LDFLAGS) -all-static
+@ENABLE_NTFS_3G_TRUE@lowntfs_3g_CFLAGS = \
+@ENABLE_NTFS_3G_TRUE@ $(AM_CFLAGS) \
+@ENABLE_NTFS_3G_TRUE@ -DFUSE_USE_VERSION=26 \
+@ENABLE_NTFS_3G_TRUE@ $(FUSE_CFLAGS) \
+@ENABLE_NTFS_3G_TRUE@ -I$(top_srcdir)/include/ntfs-3g
+
+@ENABLE_NTFS_3G_TRUE@lowntfs_3g_SOURCES = lowntfs-3g.c ntfs-3g_common.c
+@ENABLE_NTFS_3G_TRUE@ntfs_3g_probe_LDADD = $(top_builddir)/libntfs-3g/libntfs-3g.la
+@ENABLE_NTFS_3G_TRUE@ntfs_3g_usermap_LDADD = $(top_builddir)/libntfs-3g/libntfs-3g.la
+@ENABLE_NTFS_3G_TRUE@ntfs_3g_secaudit_LDADD = $(top_builddir)/libntfs-3g/libntfs-3g.la
+@ENABLE_NTFS_3G_TRUE@@REALLYSTATIC_TRUE@ntfs_3g_probe_LDFLAGS = $(AM_LDFLAGS) -all-static
+@ENABLE_NTFS_3G_TRUE@@REALLYSTATIC_TRUE@ntfs_3g_usermap_LDFLAGS = $(AM_LDFLAGS) -all-static
+@ENABLE_NTFS_3G_TRUE@@REALLYSTATIC_TRUE@ntfs_3g_secaudit_LDFLAGS = $(AM_LDFLAGS) -all-static
+@ENABLE_NTFS_3G_TRUE@ntfs_3g_probe_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/include/ntfs-3g
+@ENABLE_NTFS_3G_TRUE@ntfs_3g_usermap_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/include/ntfs-3g
+@ENABLE_NTFS_3G_TRUE@ntfs_3g_secaudit_CFLAGS = $(AM_CFLAGS) -I$(top_srcdir)/include/ntfs-3g
+@ENABLE_NTFS_3G_TRUE@ntfs_3g_probe_SOURCES = ntfs-3g.probe.c
+@ENABLE_NTFS_3G_TRUE@ntfs_3g_usermap_SOURCES = usermap.c
+@ENABLE_NTFS_3G_TRUE@ntfs_3g_secaudit_SOURCES = secaudit.c
+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 ) \
+ && { if test -f $@; then exit 0; else break; fi; }; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \
+ $(am__cd) $(top_srcdir) && \
+ $(AUTOMAKE) --gnu src/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
+$(am__aclocal_m4_deps):
+ntfs-3g.8: $(top_builddir)/config.status $(srcdir)/ntfs-3g.8.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+ntfs-3g.probe.8: $(top_builddir)/config.status $(srcdir)/ntfs-3g.probe.8.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+ntfs-3g.usermap.8: $(top_builddir)/config.status $(srcdir)/ntfs-3g.usermap.8.in
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
+ntfs-3g.secaudit.8: $(top_builddir)/config.status $(srcdir)/ntfs-3g.secaudit.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)'; test -n "$(bindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-binPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(bindir)" && rm -f $$files
+
+clean-binPROGRAMS:
+ @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+install-rootbinPROGRAMS: $(rootbin_PROGRAMS)
+ @$(NORMAL_INSTALL)
+ test -z "$(rootbindir)" || $(MKDIR_P) "$(DESTDIR)$(rootbindir)"
+ @list='$(rootbin_PROGRAMS)'; test -n "$(rootbindir)" || list=; \
+ for p in $$list; do echo "$$p $$p"; done | \
+ sed 's/$(EXEEXT)$$//' | \
+ while read p p1; do if test -f $$p || test -f $$p1; \
+ then echo "$$p"; echo "$$p"; else :; fi; \
+ done | \
+ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \
+ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
+ sed 'N;N;N;s,\n, ,g' | \
+ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \
+ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \
+ if ($$2 == $$4) files[d] = files[d] " " $$1; \
+ else { print "f", $$3 "/" $$4, $$1; } } \
+ END { for (d in files) print "f", d, files[d] }' | \
+ while read type dir files; do \
+ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+ test -z "$$files" || { \
+ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(rootbindir)$$dir'"; \
+ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(rootbindir)$$dir" || exit $$?; \
+ } \
+ ; done
+
+uninstall-rootbinPROGRAMS:
+ @$(NORMAL_UNINSTALL)
+ @list='$(rootbin_PROGRAMS)'; test -n "$(rootbindir)" || list=; \
+ files=`for p in $$list; do echo "$$p"; done | \
+ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \
+ -e 's/$$/$(EXEEXT)/' `; \
+ test -n "$$list" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(rootbindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(rootbindir)" && rm -f $$files
+
+clean-rootbinPROGRAMS:
+ @list='$(rootbin_PROGRAMS)'; test -n "$$list" || exit 0; \
+ echo " rm -f" $$list; \
+ rm -f $$list || exit $$?; \
+ test -n "$(EXEEXT)" || exit 0; \
+ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f" $$list; \
+ rm -f $$list
+lowntfs-3g$(EXEEXT): $(lowntfs_3g_OBJECTS) $(lowntfs_3g_DEPENDENCIES)
+ @rm -f lowntfs-3g$(EXEEXT)
+ $(lowntfs_3g_LINK) $(lowntfs_3g_OBJECTS) $(lowntfs_3g_LDADD) $(LIBS)
+ntfs-3g$(EXEEXT): $(ntfs_3g_OBJECTS) $(ntfs_3g_DEPENDENCIES)
+ @rm -f ntfs-3g$(EXEEXT)
+ $(ntfs_3g_LINK) $(ntfs_3g_OBJECTS) $(ntfs_3g_LDADD) $(LIBS)
+ntfs-3g.probe$(EXEEXT): $(ntfs_3g_probe_OBJECTS) $(ntfs_3g_probe_DEPENDENCIES)
+ @rm -f ntfs-3g.probe$(EXEEXT)
+ $(ntfs_3g_probe_LINK) $(ntfs_3g_probe_OBJECTS) $(ntfs_3g_probe_LDADD) $(LIBS)
+ntfs-3g.secaudit$(EXEEXT): $(ntfs_3g_secaudit_OBJECTS) $(ntfs_3g_secaudit_DEPENDENCIES)
+ @rm -f ntfs-3g.secaudit$(EXEEXT)
+ $(ntfs_3g_secaudit_LINK) $(ntfs_3g_secaudit_OBJECTS) $(ntfs_3g_secaudit_LDADD) $(LIBS)
+ntfs-3g.usermap$(EXEEXT): $(ntfs_3g_usermap_OBJECTS) $(ntfs_3g_usermap_DEPENDENCIES)
+ @rm -f ntfs-3g.usermap$(EXEEXT)
+ $(ntfs_3g_usermap_LINK) $(ntfs_3g_usermap_OBJECTS) $(ntfs_3g_usermap_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lowntfs_3g-lowntfs-3g.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lowntfs_3g-ntfs-3g_common.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfs_3g-ntfs-3g.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfs_3g-ntfs-3g_common.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfs_3g_probe-ntfs-3g.probe.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfs_3g_secaudit-secaudit.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ntfs_3g_usermap-usermap.Po@am__quote@
+
+.c.o:
+@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@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@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
+@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@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
+@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 $@ $<
+
+lowntfs_3g-lowntfs-3g.o: lowntfs-3g.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lowntfs_3g_CFLAGS) $(CFLAGS) -MT lowntfs_3g-lowntfs-3g.o -MD -MP -MF $(DEPDIR)/lowntfs_3g-lowntfs-3g.Tpo -c -o lowntfs_3g-lowntfs-3g.o `test -f 'lowntfs-3g.c' || echo '$(srcdir)/'`lowntfs-3g.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/lowntfs_3g-lowntfs-3g.Tpo $(DEPDIR)/lowntfs_3g-lowntfs-3g.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lowntfs-3g.c' object='lowntfs_3g-lowntfs-3g.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) $(lowntfs_3g_CFLAGS) $(CFLAGS) -c -o lowntfs_3g-lowntfs-3g.o `test -f 'lowntfs-3g.c' || echo '$(srcdir)/'`lowntfs-3g.c
+
+lowntfs_3g-lowntfs-3g.obj: lowntfs-3g.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lowntfs_3g_CFLAGS) $(CFLAGS) -MT lowntfs_3g-lowntfs-3g.obj -MD -MP -MF $(DEPDIR)/lowntfs_3g-lowntfs-3g.Tpo -c -o lowntfs_3g-lowntfs-3g.obj `if test -f 'lowntfs-3g.c'; then $(CYGPATH_W) 'lowntfs-3g.c'; else $(CYGPATH_W) '$(srcdir)/lowntfs-3g.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/lowntfs_3g-lowntfs-3g.Tpo $(DEPDIR)/lowntfs_3g-lowntfs-3g.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='lowntfs-3g.c' object='lowntfs_3g-lowntfs-3g.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) $(lowntfs_3g_CFLAGS) $(CFLAGS) -c -o lowntfs_3g-lowntfs-3g.obj `if test -f 'lowntfs-3g.c'; then $(CYGPATH_W) 'lowntfs-3g.c'; else $(CYGPATH_W) '$(srcdir)/lowntfs-3g.c'; fi`
+
+lowntfs_3g-ntfs-3g_common.o: ntfs-3g_common.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lowntfs_3g_CFLAGS) $(CFLAGS) -MT lowntfs_3g-ntfs-3g_common.o -MD -MP -MF $(DEPDIR)/lowntfs_3g-ntfs-3g_common.Tpo -c -o lowntfs_3g-ntfs-3g_common.o `test -f 'ntfs-3g_common.c' || echo '$(srcdir)/'`ntfs-3g_common.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/lowntfs_3g-ntfs-3g_common.Tpo $(DEPDIR)/lowntfs_3g-ntfs-3g_common.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ntfs-3g_common.c' object='lowntfs_3g-ntfs-3g_common.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) $(lowntfs_3g_CFLAGS) $(CFLAGS) -c -o lowntfs_3g-ntfs-3g_common.o `test -f 'ntfs-3g_common.c' || echo '$(srcdir)/'`ntfs-3g_common.c
+
+lowntfs_3g-ntfs-3g_common.obj: ntfs-3g_common.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lowntfs_3g_CFLAGS) $(CFLAGS) -MT lowntfs_3g-ntfs-3g_common.obj -MD -MP -MF $(DEPDIR)/lowntfs_3g-ntfs-3g_common.Tpo -c -o lowntfs_3g-ntfs-3g_common.obj `if test -f 'ntfs-3g_common.c'; then $(CYGPATH_W) 'ntfs-3g_common.c'; else $(CYGPATH_W) '$(srcdir)/ntfs-3g_common.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/lowntfs_3g-ntfs-3g_common.Tpo $(DEPDIR)/lowntfs_3g-ntfs-3g_common.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ntfs-3g_common.c' object='lowntfs_3g-ntfs-3g_common.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) $(lowntfs_3g_CFLAGS) $(CFLAGS) -c -o lowntfs_3g-ntfs-3g_common.obj `if test -f 'ntfs-3g_common.c'; then $(CYGPATH_W) 'ntfs-3g_common.c'; else $(CYGPATH_W) '$(srcdir)/ntfs-3g_common.c'; fi`
+
+ntfs_3g-ntfs-3g.o: ntfs-3g.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfs_3g_CFLAGS) $(CFLAGS) -MT ntfs_3g-ntfs-3g.o -MD -MP -MF $(DEPDIR)/ntfs_3g-ntfs-3g.Tpo -c -o ntfs_3g-ntfs-3g.o `test -f 'ntfs-3g.c' || echo '$(srcdir)/'`ntfs-3g.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ntfs_3g-ntfs-3g.Tpo $(DEPDIR)/ntfs_3g-ntfs-3g.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ntfs-3g.c' object='ntfs_3g-ntfs-3g.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) $(ntfs_3g_CFLAGS) $(CFLAGS) -c -o ntfs_3g-ntfs-3g.o `test -f 'ntfs-3g.c' || echo '$(srcdir)/'`ntfs-3g.c
+
+ntfs_3g-ntfs-3g.obj: ntfs-3g.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfs_3g_CFLAGS) $(CFLAGS) -MT ntfs_3g-ntfs-3g.obj -MD -MP -MF $(DEPDIR)/ntfs_3g-ntfs-3g.Tpo -c -o ntfs_3g-ntfs-3g.obj `if test -f 'ntfs-3g.c'; then $(CYGPATH_W) 'ntfs-3g.c'; else $(CYGPATH_W) '$(srcdir)/ntfs-3g.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ntfs_3g-ntfs-3g.Tpo $(DEPDIR)/ntfs_3g-ntfs-3g.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ntfs-3g.c' object='ntfs_3g-ntfs-3g.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) $(ntfs_3g_CFLAGS) $(CFLAGS) -c -o ntfs_3g-ntfs-3g.obj `if test -f 'ntfs-3g.c'; then $(CYGPATH_W) 'ntfs-3g.c'; else $(CYGPATH_W) '$(srcdir)/ntfs-3g.c'; fi`
+
+ntfs_3g-ntfs-3g_common.o: ntfs-3g_common.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfs_3g_CFLAGS) $(CFLAGS) -MT ntfs_3g-ntfs-3g_common.o -MD -MP -MF $(DEPDIR)/ntfs_3g-ntfs-3g_common.Tpo -c -o ntfs_3g-ntfs-3g_common.o `test -f 'ntfs-3g_common.c' || echo '$(srcdir)/'`ntfs-3g_common.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ntfs_3g-ntfs-3g_common.Tpo $(DEPDIR)/ntfs_3g-ntfs-3g_common.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ntfs-3g_common.c' object='ntfs_3g-ntfs-3g_common.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) $(ntfs_3g_CFLAGS) $(CFLAGS) -c -o ntfs_3g-ntfs-3g_common.o `test -f 'ntfs-3g_common.c' || echo '$(srcdir)/'`ntfs-3g_common.c
+
+ntfs_3g-ntfs-3g_common.obj: ntfs-3g_common.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfs_3g_CFLAGS) $(CFLAGS) -MT ntfs_3g-ntfs-3g_common.obj -MD -MP -MF $(DEPDIR)/ntfs_3g-ntfs-3g_common.Tpo -c -o ntfs_3g-ntfs-3g_common.obj `if test -f 'ntfs-3g_common.c'; then $(CYGPATH_W) 'ntfs-3g_common.c'; else $(CYGPATH_W) '$(srcdir)/ntfs-3g_common.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ntfs_3g-ntfs-3g_common.Tpo $(DEPDIR)/ntfs_3g-ntfs-3g_common.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ntfs-3g_common.c' object='ntfs_3g-ntfs-3g_common.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) $(ntfs_3g_CFLAGS) $(CFLAGS) -c -o ntfs_3g-ntfs-3g_common.obj `if test -f 'ntfs-3g_common.c'; then $(CYGPATH_W) 'ntfs-3g_common.c'; else $(CYGPATH_W) '$(srcdir)/ntfs-3g_common.c'; fi`
+
+ntfs_3g_probe-ntfs-3g.probe.o: ntfs-3g.probe.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfs_3g_probe_CFLAGS) $(CFLAGS) -MT ntfs_3g_probe-ntfs-3g.probe.o -MD -MP -MF $(DEPDIR)/ntfs_3g_probe-ntfs-3g.probe.Tpo -c -o ntfs_3g_probe-ntfs-3g.probe.o `test -f 'ntfs-3g.probe.c' || echo '$(srcdir)/'`ntfs-3g.probe.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ntfs_3g_probe-ntfs-3g.probe.Tpo $(DEPDIR)/ntfs_3g_probe-ntfs-3g.probe.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ntfs-3g.probe.c' object='ntfs_3g_probe-ntfs-3g.probe.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) $(ntfs_3g_probe_CFLAGS) $(CFLAGS) -c -o ntfs_3g_probe-ntfs-3g.probe.o `test -f 'ntfs-3g.probe.c' || echo '$(srcdir)/'`ntfs-3g.probe.c
+
+ntfs_3g_probe-ntfs-3g.probe.obj: ntfs-3g.probe.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfs_3g_probe_CFLAGS) $(CFLAGS) -MT ntfs_3g_probe-ntfs-3g.probe.obj -MD -MP -MF $(DEPDIR)/ntfs_3g_probe-ntfs-3g.probe.Tpo -c -o ntfs_3g_probe-ntfs-3g.probe.obj `if test -f 'ntfs-3g.probe.c'; then $(CYGPATH_W) 'ntfs-3g.probe.c'; else $(CYGPATH_W) '$(srcdir)/ntfs-3g.probe.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ntfs_3g_probe-ntfs-3g.probe.Tpo $(DEPDIR)/ntfs_3g_probe-ntfs-3g.probe.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='ntfs-3g.probe.c' object='ntfs_3g_probe-ntfs-3g.probe.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) $(ntfs_3g_probe_CFLAGS) $(CFLAGS) -c -o ntfs_3g_probe-ntfs-3g.probe.obj `if test -f 'ntfs-3g.probe.c'; then $(CYGPATH_W) 'ntfs-3g.probe.c'; else $(CYGPATH_W) '$(srcdir)/ntfs-3g.probe.c'; fi`
+
+ntfs_3g_secaudit-secaudit.o: secaudit.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfs_3g_secaudit_CFLAGS) $(CFLAGS) -MT ntfs_3g_secaudit-secaudit.o -MD -MP -MF $(DEPDIR)/ntfs_3g_secaudit-secaudit.Tpo -c -o ntfs_3g_secaudit-secaudit.o `test -f 'secaudit.c' || echo '$(srcdir)/'`secaudit.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ntfs_3g_secaudit-secaudit.Tpo $(DEPDIR)/ntfs_3g_secaudit-secaudit.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='secaudit.c' object='ntfs_3g_secaudit-secaudit.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) $(ntfs_3g_secaudit_CFLAGS) $(CFLAGS) -c -o ntfs_3g_secaudit-secaudit.o `test -f 'secaudit.c' || echo '$(srcdir)/'`secaudit.c
+
+ntfs_3g_secaudit-secaudit.obj: secaudit.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfs_3g_secaudit_CFLAGS) $(CFLAGS) -MT ntfs_3g_secaudit-secaudit.obj -MD -MP -MF $(DEPDIR)/ntfs_3g_secaudit-secaudit.Tpo -c -o ntfs_3g_secaudit-secaudit.obj `if test -f 'secaudit.c'; then $(CYGPATH_W) 'secaudit.c'; else $(CYGPATH_W) '$(srcdir)/secaudit.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ntfs_3g_secaudit-secaudit.Tpo $(DEPDIR)/ntfs_3g_secaudit-secaudit.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='secaudit.c' object='ntfs_3g_secaudit-secaudit.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) $(ntfs_3g_secaudit_CFLAGS) $(CFLAGS) -c -o ntfs_3g_secaudit-secaudit.obj `if test -f 'secaudit.c'; then $(CYGPATH_W) 'secaudit.c'; else $(CYGPATH_W) '$(srcdir)/secaudit.c'; fi`
+
+ntfs_3g_usermap-usermap.o: usermap.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfs_3g_usermap_CFLAGS) $(CFLAGS) -MT ntfs_3g_usermap-usermap.o -MD -MP -MF $(DEPDIR)/ntfs_3g_usermap-usermap.Tpo -c -o ntfs_3g_usermap-usermap.o `test -f 'usermap.c' || echo '$(srcdir)/'`usermap.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ntfs_3g_usermap-usermap.Tpo $(DEPDIR)/ntfs_3g_usermap-usermap.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usermap.c' object='ntfs_3g_usermap-usermap.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) $(ntfs_3g_usermap_CFLAGS) $(CFLAGS) -c -o ntfs_3g_usermap-usermap.o `test -f 'usermap.c' || echo '$(srcdir)/'`usermap.c
+
+ntfs_3g_usermap-usermap.obj: usermap.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(ntfs_3g_usermap_CFLAGS) $(CFLAGS) -MT ntfs_3g_usermap-usermap.obj -MD -MP -MF $(DEPDIR)/ntfs_3g_usermap-usermap.Tpo -c -o ntfs_3g_usermap-usermap.obj `if test -f 'usermap.c'; then $(CYGPATH_W) 'usermap.c'; else $(CYGPATH_W) '$(srcdir)/usermap.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/ntfs_3g_usermap-usermap.Tpo $(DEPDIR)/ntfs_3g_usermap-usermap.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='usermap.c' object='ntfs_3g_usermap-usermap.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) $(ntfs_3g_usermap_CFLAGS) $(CFLAGS) -c -o ntfs_3g_usermap-usermap.obj `if test -f 'usermap.c'; then $(CYGPATH_W) 'usermap.c'; else $(CYGPATH_W) '$(srcdir)/usermap.c'; fi`
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+install-man8: $(man_MANS)
+ @$(NORMAL_INSTALL)
+ test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)"
+ @list=''; test -n "$(man8dir)" || exit 0; \
+ { for i in $$list; do echo "$$i"; done; \
+ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.8[a-z]*$$/p'; \
+ } | while read p; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; echo "$$p"; \
+ done | \
+ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \
+ sed 'N;N;s,\n, ,g' | { \
+ list=; while read file base inst; do \
+ if test "$$base" = "$$inst"; then list="$$list $$file"; else \
+ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
+ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \
+ fi; \
+ done; \
+ for i in $$list; do echo "$$i"; done | $(am__base_list) | \
+ while read files; do \
+ test -z "$$files" || { \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \
+ done; }
+
+uninstall-man8:
+ @$(NORMAL_UNINSTALL)
+ @list=''; test -n "$(man8dir)" || exit 0; \
+ files=`{ for i in $$list; do echo "$$i"; done; \
+ l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \
+ sed -n '/\.8[a-z]*$$/p'; \
+ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \
+ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
+ test -z "$$files" || { \
+ echo " ( cd '$(DESTDIR)$(man8dir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(man8dir)" && rm -f $$files; }
+install-rootsbinDATA: $(rootsbin_DATA)
+ @$(NORMAL_INSTALL)
+ test -z "$(rootsbindir)" || $(MKDIR_P) "$(DESTDIR)$(rootsbindir)"
+ @list='$(rootsbin_DATA)'; test -n "$(rootsbindir)" || list=; \
+ for p in $$list; do \
+ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+ echo "$$d$$p"; \
+ done | $(am__base_list) | \
+ while read files; do \
+ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(rootsbindir)'"; \
+ $(INSTALL_DATA) $$files "$(DESTDIR)$(rootsbindir)" || exit $$?; \
+ done
+
+uninstall-rootsbinDATA:
+ @$(NORMAL_UNINSTALL)
+ @list='$(rootsbin_DATA)'; test -n "$(rootsbindir)" || list=; \
+ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+ test -n "$$files" || exit 0; \
+ echo " ( cd '$(DESTDIR)$(rootsbindir)' && rm -f" $$files ")"; \
+ cd "$(DESTDIR)$(rootsbindir)" && rm -f $$files
+
+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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ set x; \
+ 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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ shift; \
+ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
+ test -n "$$unique" || unique=$$empty_fix; \
+ if test $$# -gt 0; then \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ "$$@" $$unique; \
+ else \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$unique; \
+ fi; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ 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; nonempty = 1; } \
+ END { if (nonempty) { for (i in files) print i; }; }'`; \
+ test -z "$(CTAGS_ARGS)$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && $(am__cd) $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) "$$here"
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @list='$(MANS)'; if test -n "$$list"; then \
+ list=`for p in $$list; do \
+ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
+ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \
+ if test -n "$$list" && \
+ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \
+ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \
+ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \
+ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \
+ echo " typically \`make maintainer-clean' will remove them" >&2; \
+ exit 1; \
+ else :; fi; \
+ else :; fi
+ @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
+ list='$(DISTFILES)'; \
+ dist_files=`for file in $$list; do echo $$file; done | \
+ sed -e "s|^$$srcdirstrip/||;t" \
+ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
+ case $$dist_files in \
+ */*) $(MKDIR_P) `echo "$$dist_files" | \
+ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
+ sort -u` ;; \
+ esac; \
+ for file in $$dist_files; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ if test -d $$d/$$file; then \
+ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test -d "$(distdir)/$$file"; then \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
+ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ fi; \
+ cp -fpR $$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) $(DATA)
+installdirs:
+ for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(rootbindir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(rootsbindir)"; 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)
+ -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+ -test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
+@ENABLE_NTFS_3G_FALSE@uninstall-local:
+@ENABLE_NTFS_3G_FALSE@install-data-local:
+@ENABLE_MOUNT_HELPER_FALSE@install-exec-local:
+@ENABLE_NTFS_3G_FALSE@install-exec-local:
+@ENABLE_NTFS_3G_FALSE@install-exec-hook:
+@RUN_LDCONFIG_FALSE@install-exec-hook:
+clean: clean-am
+
+clean-am: clean-binPROGRAMS clean-generic clean-libtool \
+ clean-rootbinPROGRAMS mostlyclean-am
+
+distclean: distclean-am
+ -rm -rf ./$(DEPDIR)
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+html-am:
+
+info: info-am
+
+info-am:
+
+install-data-am: install-data-local install-man \
+ install-rootbinPROGRAMS install-rootsbinDATA
+
+install-dvi: install-dvi-am
+
+install-dvi-am:
+
+install-exec-am: install-binPROGRAMS install-exec-local
+ @$(NORMAL_INSTALL)
+ $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
+install-html: install-html-am
+
+install-html-am:
+
+install-info: install-info-am
+
+install-info-am:
+
+install-man: install-man8
+
+install-pdf: install-pdf-am
+
+install-pdf-am:
+
+install-ps: install-ps-am
+
+install-ps-am:
+
+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-local uninstall-man \
+ uninstall-rootbinPROGRAMS uninstall-rootsbinDATA
+
+uninstall-man: uninstall-man8
+
+.MAKE: install-am install-exec-am install-strip
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \
+ clean-generic clean-libtool clean-rootbinPROGRAMS 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-data-local install-dvi \
+ install-dvi-am install-exec install-exec-am install-exec-hook \
+ install-exec-local install-html install-html-am install-info \
+ install-info-am install-man install-man8 install-pdf \
+ install-pdf-am install-ps install-ps-am \
+ install-rootbinPROGRAMS install-rootsbinDATA 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-local uninstall-man uninstall-man8 \
+ uninstall-rootbinPROGRAMS uninstall-rootsbinDATA
+
+
+@ENABLE_NTFS_3G_TRUE@drivers : $(FUSE_LIBS) ntfs-3g lowntfs-3g
+
+@ENABLE_NTFS_3G_TRUE@@RUN_LDCONFIG_TRUE@install-exec-hook:
+@ENABLE_NTFS_3G_TRUE@@RUN_LDCONFIG_TRUE@ $(LDCONFIG)
+
+@ENABLE_MOUNT_HELPER_TRUE@@ENABLE_NTFS_3G_TRUE@install-exec-local: install-rootbinPROGRAMS
+@ENABLE_MOUNT_HELPER_TRUE@@ENABLE_NTFS_3G_TRUE@ $(MKDIR_P) "$(DESTDIR)/sbin"
+@ENABLE_MOUNT_HELPER_TRUE@@ENABLE_NTFS_3G_TRUE@ $(LN_S) -f "$(rootbindir)/ntfs-3g" "$(DESTDIR)/sbin/mount.ntfs-3g"
+@ENABLE_MOUNT_HELPER_TRUE@@ENABLE_NTFS_3G_TRUE@ $(LN_S) -f "$(rootbindir)/lowntfs-3g" "$(DESTDIR)/sbin/mount.lowntfs-3g"
+
+@ENABLE_NTFS_3G_TRUE@install-data-local: install-man8
+@ENABLE_NTFS_3G_TRUE@ $(LN_S) -f ntfs-3g.8 "$(DESTDIR)$(man8dir)/mount.ntfs-3g.8"
+@ENABLE_NTFS_3G_TRUE@ $(LN_S) -f ntfs-3g.8 "$(DESTDIR)$(man8dir)/mount.lowntfs-3g.8"
+
+@ENABLE_NTFS_3G_TRUE@uninstall-local:
+@ENABLE_NTFS_3G_TRUE@ $(RM) -f "$(DESTDIR)$(man8dir)/mount.ntfs-3g.8"
+@ENABLE_MOUNT_HELPER_TRUE@@ENABLE_NTFS_3G_TRUE@ $(RM) -f "$(DESTDIR)/sbin/mount.ntfs-3g" "$(DESTDIR)/sbin/mount.lowntfs-3g"
+
+# 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/src/lowntfs-3g.c b/src/lowntfs-3g.c
index a943e60..25940c3 100755
--- a/src/lowntfs-3g.c
+++ b/src/lowntfs-3g.c
@@ -4,7 +4,7 @@
* Copyright (c) 2005-2007 Yura Pakhuchiy
* Copyright (c) 2005 Yuval Fledel
* Copyright (c) 2006-2009 Szabolcs Szakacsits
- * Copyright (c) 2007-2010 Jean-Pierre Andre
+ * Copyright (c) 2007-2013 Jean-Pierre Andre
* Copyright (c) 2009 Erik Larsson
*
* This file is originated from the Linux-NTFS project.
@@ -38,12 +38,6 @@
#error "***********************************************************"
#endif
-#ifdef FUSE_INTERNAL
-#define FUSE_TYPE "integrated FUSE low"
-#else
-#define FUSE_TYPE "external FUSE low"
-#endif
-
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
@@ -69,7 +63,6 @@
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
-#include <getopt.h>
#include <syslog.h>
#include <sys/wait.h>
@@ -102,8 +95,11 @@
#include "object_id.h"
#include "efs.h"
#include "logging.h"
+#include "xattrs.h"
#include "misc.h"
+#include "ntfs-3g_common.h"
+
/*
* The following permission checking modes are governed by
* the LPERMSCONFIG value in param.h
@@ -121,18 +117,17 @@
#endif
#if CACHEING & (KERNELACLS | !KERNELPERMS)
-#warning "Fuse cacheing is broken unless basic permissions checked by kernel"
+#warning "Fuse cacheing is only usable with basic permissions checked by kernel"
#endif
#if !CACHEING
- /*
- * FUSE cacheing is broken except for basic permissions
- * checked by the kernel
- * So do not use cacheing until this is fixed
- */
#define ATTR_TIMEOUT 0.0
#define ENTRY_TIMEOUT 0.0
#else
+ /*
+ * FUSE cacheing is only usable with basic permissions
+ * checked by the kernel with external fuse >= 2.8
+ */
#define ATTR_TIMEOUT (ctx->vol->secure_flags & (1 << SECURITY_DEFAULT) ? 1.0 : 0.0)
#define ENTRY_TIMEOUT (ctx->vol->secure_flags & (1 << SECURITY_DEFAULT) ? 1.0 : 0.0)
#endif
@@ -157,12 +152,6 @@ typedef enum {
FSTYPE_FUSEBLK
} fuse_fstype;
-typedef enum {
- ATIME_ENABLED,
- ATIME_DISABLED,
- ATIME_RELATIVE
-} ntfs_atime_t;
-
typedef struct fill_item {
struct fill_item *next;
size_t bufsize;
@@ -187,57 +176,23 @@ struct open_file {
int state;
} ;
-typedef enum {
- NF_STREAMS_INTERFACE_NONE, /* No access to named data streams. */
- NF_STREAMS_INTERFACE_XATTR, /* Map named data streams to xattrs. */
- NF_STREAMS_INTERFACE_OPENXATTR, /* Same, not limited to "user." */
-} ntfs_fuse_streams_interface;
-
enum {
CLOSE_GHOST = 1,
CLOSE_COMPRESSED = 2,
- CLOSE_ENCRYPTED = 4
+ CLOSE_ENCRYPTED = 4,
+ CLOSE_DMTIME = 8
};
-typedef struct {
- ntfs_volume *vol;
- unsigned int uid;
- unsigned int gid;
- unsigned int fmask;
- unsigned int dmask;
- ntfs_fuse_streams_interface streams;
- ntfs_atime_t atime;
- BOOL ro;
- BOOL show_sys_files;
- BOOL silent;
- BOOL recover;
- BOOL hiberfile;
- BOOL debug;
- BOOL no_detach;
- BOOL blkdev;
- BOOL mounted;
-#ifdef HAVE_SETXATTR /* extended attributes interface required */
- BOOL efs_raw;
-#endif /* HAVE_SETXATTR */
- struct fuse_chan *fc;
- BOOL inherit;
- unsigned int secure_flags;
- char *usermap_path;
- char *abs_mnt_point;
- struct PERMISSIONS_CACHE *seccache;
- struct SECURITY_CONTEXT security;
- struct open_file *open_files;
- u64 latest_ghost;
-} ntfs_fuse_context_t;
-
-static struct options {
- char *mnt_point; /* Mount point */
- char *options; /* Mount options */
- char *device; /* Device to mount */
-} opts;
-
-static const char *EXEC_NAME = "ntfs-3g";
-static char def_opts[] = "silent,allow_other,nonempty,";
+enum RM_TYPES {
+ RM_LINK,
+ RM_DIR,
+ RM_ANY,
+} ;
+
+static struct ntfs_options opts;
+
+const char *EXEC_NAME = "lowntfs-3g";
+
static ntfs_fuse_context_t *ctx;
static u32 ntfs_sequence;
static const char ghostformat[] = ".ghost-ntfs-3g-%020llu";
@@ -259,12 +214,12 @@ static const char *usage_msg =
"\n"
"Copyright (C) 2005-2007 Yura Pakhuchiy\n"
"Copyright (C) 2006-2009 Szabolcs Szakacsits\n"
-"Copyright (C) 2007-2010 Jean-Pierre Andre\n"
+"Copyright (C) 2007-2013 Jean-Pierre Andre\n"
"Copyright (C) 2009 Erik Larsson\n"
"\n"
"Usage: %s [-o option[,...]] <device|image_file> <mount_point>\n"
"\n"
-"Options: ro (read-only mount), remove_hiberfile, uid=, gid=,\n"
+"Options: ro (read-only mount), windows_names, uid=, gid=,\n"
" umask=, fmask=, dmask=, streams_interface=.\n"
" Please see the details in the manual (type: man ntfs-3g).\n"
"\n"
@@ -291,13 +246,14 @@ static const char *setuid_msg =
"Mount is denied because setuid and setgid root ntfs-3g is insecure with the\n"
"external FUSE library. Either remove the setuid/setgid bit from the binary\n"
"or rebuild NTFS-3G with integrated FUSE support and make it setuid root.\n"
-"Please see more information at http://ntfs-3g.org/support.html#unprivileged\n";
+"Please see more information at\n"
+"http://tuxera.com/community/ntfs-3g-faq/#unprivileged\n";
static const char *unpriv_fuseblk_msg =
"Unprivileged user can not mount NTFS block devices using the external FUSE\n"
"library. Either mount the volume as root, or rebuild NTFS-3G with integrated\n"
"FUSE support and make it setuid root. Please see more information at\n"
-"http://ntfs-3g.org/support.html#unprivileged\n";
+"http://tuxera.com/community/ntfs-3g-faq/#unprivileged\n";
#endif
@@ -374,6 +330,11 @@ static u64 ntfs_fuse_inode_lookup(fuse_ino_t parent, const char *name)
if (dir_ni) {
/* Lookup file */
inum = ntfs_inode_lookup_by_mbsname(dir_ni, name);
+ /* never return inodes 0 and 1 */
+ if (MREF(inum) <= 1) {
+ inum = (u64)-1;
+ errno = ENOENT;
+ }
if (ntfs_inode_close(dir_ni)
|| (inum == (u64)-1))
ino = (u64)-1;
@@ -444,7 +405,7 @@ static int ntfs_allowed_dir_access(struct SECURITY_CONTEXT *scx,
*
* Returns 0 on success or -errno on error.
*/
-
+#if HAVE_SYS_STATVFS_H
static void ntfs_fuse_statfs(fuse_req_t req,
fuse_ino_t ino __attribute__((unused)))
{
@@ -491,7 +452,7 @@ static void ntfs_fuse_statfs(fuse_req_t req,
size += vol->free_mft_records;
if (size < 0)
size = 0;
- sfs.f_ffree = /*sfs.f_favail =*/ size;
+ sfs.f_ffree = sfs.f_favail = size;
/* Maximum length of filenames. */
sfs.f_namemax = NTFS_MAX_NAME_LEN;
@@ -500,6 +461,7 @@ static void ntfs_fuse_statfs(fuse_req_t req,
fuse_reply_err(req, ENODEV);
}
+#endif
static void set_fuse_error(int *err)
{
@@ -603,7 +565,8 @@ int ntfs_macfuse_setchgtime(const char *path, const struct timespec *tv)
}
#endif /* defined(__APPLE__) || defined(__DARWIN__) */
-#if defined(FUSE_CAP_DONT_MASK) || (defined(__APPLE__) || defined(__DARWIN__))
+#if defined(FUSE_CAP_DONT_MASK) || defined(FUSE_CAP_BIG_WRITES) \
+ || (defined(__APPLE__) || defined(__DARWIN__))
static void ntfs_init(void *userdata __attribute__((unused)),
struct fuse_conn_info *conn)
{
@@ -614,6 +577,12 @@ static void ntfs_init(void *userdata __attribute__((unused)),
/* request umask not to be enforced by fuse */
conn->want |= FUSE_CAP_DONT_MASK;
#endif /* defined FUSE_CAP_DONT_MASK */
+#ifdef FUSE_CAP_BIG_WRITES
+ if (ctx->big_writes
+ && ((ctx->vol->nr_clusters << ctx->vol->cluster_size_bits)
+ >= SAFE_CAPACITY_FOR_BIG_WRITES))
+ conn->want |= FUSE_CAP_BIG_WRITES;
+#endif
}
#endif /* defined(FUSE_CAP_DONT_MASK) || (defined(__APPLE__) || defined(__DARWIN__)) */
@@ -685,7 +654,9 @@ static int ntfs_fuse_getstat(struct SECURITY_CONTEXT *scx,
* encrypted files to include padding required for decryption
* also include 2 bytes for padding info
*/
- if (ctx->efs_raw && ni->flags & FILE_ATTR_ENCRYPTED)
+ if (ctx->efs_raw
+ && (ni->flags & FILE_ATTR_ENCRYPTED)
+ && ni->data_size)
stbuf->st_size = ((ni->data_size + 511) & ~511) + 2;
#endif /* HAVE_SETXATTR */
/*
@@ -697,7 +668,8 @@ static int ntfs_fuse_getstat(struct SECURITY_CONTEXT *scx,
if (ni->flags & FILE_ATTR_SYSTEM) {
na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0);
if (!na) {
- goto exit;
+ stbuf->st_ino = ni->mft_no;
+ goto nodata;
}
/* Check whether it's Interix FIFO or socket. */
if (!(ni->flags & FILE_ATTR_HIDDEN)) {
@@ -712,9 +684,9 @@ static int ntfs_fuse_getstat(struct SECURITY_CONTEXT *scx,
* Check whether it's Interix symbolic link, block or
* character device.
*/
- if ((size_t)na->data_size <= sizeof(INTX_FILE_TYPES)
+ if ((u64)na->data_size <= sizeof(INTX_FILE_TYPES)
+ sizeof(ntfschar) * PATH_MAX
- && (size_t)na->data_size >
+ && (u64)na->data_size >
sizeof(INTX_FILE_TYPES)) {
INTX_FILE *intx_file;
@@ -767,6 +739,7 @@ static int ntfs_fuse_getstat(struct SECURITY_CONTEXT *scx,
}
if (S_ISLNK(stbuf->st_mode))
stbuf->st_mode |= 0777;
+nodata :
stbuf->st_ino = ni->mft_no;
#ifdef HAVE_STRUCT_STAT_ST_ATIMESPEC
stbuf->st_atimespec = ntfs2timespec(ni->last_access_time);
@@ -878,6 +851,11 @@ static void ntfs_fuse_lookup(fuse_req_t req, fuse_ino_t parent,
#endif
iref = ntfs_inode_lookup_by_mbsname(dir_ni,
name);
+ /* never return inodes 0 and 1 */
+ if (MREF(iref) <= 1) {
+ iref = (u64)-1;
+ errno = ENOENT;
+ }
ok = !ntfs_inode_close(dir_ni)
&& (iref != (u64)-1)
&& ntfs_fuse_fillstat(
@@ -1002,15 +980,34 @@ static int ntfs_fuse_filler(ntfs_fuse_fill_context_t *fill_ctx,
(unsigned long long)MREF(mref));
return -1;
}
-
- if (MREF(mref) == FILE_root || MREF(mref) >= FILE_first_user ||
- ctx->show_sys_files) {
+ /* never return inodes 0 and 1 */
+ if (MREF(mref) > 1) {
struct stat st = { .st_ino = MREF(mref) };
- if (dt_type == NTFS_DT_REG)
- st.st_mode = S_IFREG | (0777 & ~ctx->fmask);
- else if (dt_type == NTFS_DT_DIR)
+ switch (dt_type) {
+ case NTFS_DT_DIR :
st.st_mode = S_IFDIR | (0777 & ~ctx->dmask);
+ break;
+ case NTFS_DT_LNK :
+ st.st_mode = S_IFLNK | 0777;
+ break;
+ case NTFS_DT_FIFO :
+ st.st_mode = S_IFIFO;
+ break;
+ case NTFS_DT_SOCK :
+ st.st_mode = S_IFSOCK;
+ break;
+ case NTFS_DT_BLK :
+ st.st_mode = S_IFBLK;
+ break;
+ case NTFS_DT_CHR :
+ st.st_mode = S_IFCHR;
+ break;
+ default : /* unexpected types shown as plain files */
+ case NTFS_DT_REG :
+ st.st_mode = S_IFREG | (0777 & ~ctx->fmask);
+ break;
+ }
#if defined(__APPLE__) || defined(__DARWIN__)
/*
@@ -1122,14 +1119,17 @@ static void ntfs_fuse_releasedir(fuse_req_t req,
ntfs_fuse_fill_item_t *current;
fill = (ntfs_fuse_fill_context_t*)(long)fi->fh;
- /* make sure to clear results */
- current = fill->first;
- while (current) {
- current = current->next;
- free(fill->first);
- fill->first = current;
- }
- free(fill);
+ if (fill && (fill->ino == ino)) {
+ /* make sure to clear results */
+ current = fill->first;
+ while (current) {
+ current = current->next;
+ free(fill->first);
+ fill->first = current;
+ }
+ fill->ino = 0;
+ free(fill);
+ }
fuse_reply_err(req, 0);
}
@@ -1145,7 +1145,7 @@ static void ntfs_fuse_readdir(fuse_req_t req, fuse_ino_t ino, size_t size,
int err = 0;
fill = (ntfs_fuse_fill_context_t*)(long)fi->fh;
- if (fill) {
+ if (fill && (fill->ino == ino)) {
if (!fill->filled) {
/* initial call : build the full list */
first = (ntfs_fuse_fill_item_t*)ntfs_malloc
@@ -1250,6 +1250,12 @@ static void ntfs_fuse_open(fuse_req_t req, fuse_ino_t ino,
&& (ni->flags & FILE_ATTR_ENCRYPTED))
state |= CLOSE_ENCRYPTED;
#endif /* HAVE_SETXATTR */
+ /* mark a future need to update the mtime */
+ if (ctx->dmtime)
+ state |= CLOSE_DMTIME;
+ /* deny opening metadata files for writing */
+ if (ino < FILE_first_user)
+ res = -EPERM;
}
ntfs_attr_close(na);
} else
@@ -1290,8 +1296,10 @@ static void ntfs_fuse_read(fuse_req_t req, fuse_ino_t ino, size_t size,
s64 total = 0;
s64 max_read;
- if (!size)
+ if (!size) {
+ res = 0;
goto exit;
+ }
buf = (char*)ntfs_malloc(size);
if (!buf) {
res = -errno;
@@ -1311,8 +1319,10 @@ static void ntfs_fuse_read(fuse_req_t req, fuse_ino_t ino, size_t size,
max_read = na->data_size;
#ifdef HAVE_SETXATTR /* extended attributes interface required */
/* limit reads at next 512 byte boundary for encrypted attributes */
- if (ctx->efs_raw && (na->data_flags & ATTR_IS_ENCRYPTED) &&
- NAttrNonResident(na)) {
+ if (ctx->efs_raw
+ && max_read
+ && (na->data_flags & ATTR_IS_ENCRYPTED)
+ && NAttrNonResident(na)) {
max_read = ((na->data_size+511) & ~511) + 2;
}
#endif /* HAVE_SETXATTR */
@@ -1379,7 +1389,10 @@ static void ntfs_fuse_write(fuse_req_t req, fuse_ino_t ino, const char *buf,
total += ret;
}
res = total;
- if (res > 0)
+ if ((res > 0)
+ && (!ctx->dmtime
+ || (le64_to_cpu(ntfs_current_time())
+ - le64_to_cpu(ni->last_data_change_time)) > ctx->dmtime))
ntfs_fuse_update_times(na->ni, NTFS_UPDATE_MCTIME);
exit:
if (na)
@@ -1525,6 +1538,11 @@ static int ntfs_fuse_trunc(struct SECURITY_CONTEXT *scx, fuse_ino_t ino,
if (!ni)
goto exit;
+ /* deny truncating metadata files */
+ if (ino < FILE_first_user) {
+ errno = EPERM;
+ goto exit;
+ }
na = ntfs_attr_open(ni, AT_DATA, AT_UNNAMED, 0);
if (!na)
goto exit;
@@ -1541,16 +1559,9 @@ static int ntfs_fuse_trunc(struct SECURITY_CONTEXT *scx, fuse_ino_t ino,
}
#endif
/*
- * for compressed files, only deleting contents and expanding
- * are implemented. Expanding is done by inserting a final
+ * for compressed files, upsizing is done by inserting a final
* zero, which is optimized as creating a hole when possible.
*/
- if ((na->data_flags & ATTR_COMPRESSION_MASK)
- && size
- && (size < na->initialized_size)) {
- errno = EOPNOTSUPP;
- goto exit;
- }
oldsize = na->data_size;
if ((na->data_flags & ATTR_COMPRESSION_MASK)
&& (size > na->initialized_size)) {
@@ -1574,7 +1585,7 @@ exit:
return res;
}
-#ifdef HAVE_UTIMENSAT
+#if defined(HAVE_UTIMENSAT) & defined(FUSE_SET_ATTR_ATIME_NOW)
static int ntfs_fuse_utimens(struct SECURITY_CONTEXT *scx, fuse_ino_t ino,
struct stat *stin, struct stat *stbuf, int to_set)
@@ -1621,7 +1632,7 @@ static int ntfs_fuse_utimens(struct SECURITY_CONTEXT *scx, fuse_ino_t ino,
return res;
}
-#else /* HAVE_UTIMENSAT */
+#else /* defined(HAVE_UTIMENSAT) & defined(FUSE_SET_ATTR_ATIME_NOW) */
static int ntfs_fuse_utime(struct SECURITY_CONTEXT *scx, fuse_ino_t ino,
struct stat *stin, struct stat *stbuf)
@@ -1692,7 +1703,7 @@ static int ntfs_fuse_utime(struct SECURITY_CONTEXT *scx, fuse_ino_t ino,
return res;
}
-#endif /* HAVE_UTIMENSAT */
+#endif /* defined(HAVE_UTIMENSAT) & defined(FUSE_SET_ATTR_ATIME_NOW) */
static void ntfs_fuse_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
int to_set, struct fuse_file_info *fi __attribute__((unused)))
@@ -1767,11 +1778,11 @@ static void ntfs_fuse_setattr(fuse_req_t req, fuse_ino_t ino, struct stat *attr,
}
/* some set of atime/mtime */
if (!res && (to_set & (FUSE_SET_ATTR_ATIME + FUSE_SET_ATTR_MTIME))) {
-#ifdef HAVE_UTIMENSAT
+#if defined(HAVE_UTIMENSAT) & defined(FUSE_SET_ATTR_ATIME_NOW)
res = ntfs_fuse_utimens(&security, ino, attr, &stbuf, to_set);
-#else /* HAVE_UTIMENSAT */
+#else /* defined(HAVE_UTIMENSAT) & defined(FUSE_SET_ATTR_ATIME_NOW) */
res = ntfs_fuse_utime(&security, ino, attr, &stbuf);
-#endif /* HAVE_UTIMENSAT */
+#endif /* defined(HAVE_UTIMENSAT) & defined(FUSE_SET_ATTR_ATIME_NOW) */
}
if (res)
fuse_reply_err(req, -res);
@@ -1830,6 +1841,8 @@ static int ntfs_fuse_create(fuse_req_t req, fuse_ino_t parent, const char *name,
struct open_file *of;
int state = 0;
le32 securid;
+ gid_t gid;
+ mode_t dsetgid;
mode_t type = typemode & ~07777;
mode_t perm;
struct SECURITY_CONTEXT security;
@@ -1837,7 +1850,9 @@ static int ntfs_fuse_create(fuse_req_t req, fuse_ino_t parent, const char *name,
/* Generate unicode filename. */
uname_len = ntfs_mbstoucs(name, &uname);
- if (uname_len < 0) {
+ if ((uname_len < 0)
+ || (ctx->windows_names
+ && ntfs_forbidden_chars(uname,uname_len))) {
res = -errno;
goto exit;
}
@@ -1850,13 +1865,15 @@ static int ntfs_fuse_create(fuse_req_t req, fuse_ino_t parent, const char *name,
#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
/* make sure parent directory is writeable and executable */
if (!ntfs_fuse_fill_security_context(req, &security)
- || ntfs_allowed_access(&security,
- dir_ni,S_IWRITE + S_IEXEC)) {
+ || ntfs_allowed_create(&security,
+ dir_ni, &gid, &dsetgid)) {
#else
ntfs_fuse_fill_security_context(req, &security);
+ ntfs_allowed_create(&security, dir_ni, &gid, &dsetgid);
#endif
if (S_ISDIR(type))
- perm = typemode & ~ctx->dmask & 0777;
+ perm = (typemode & ~ctx->dmask & 0777)
+ | (dsetgid & S_ISGID);
else
perm = typemode & ~ctx->fmask & 0777;
/*
@@ -1874,11 +1891,11 @@ static int ntfs_fuse_create(fuse_req_t req, fuse_ino_t parent, const char *name,
else
#if POSIXACLS
securid = ntfs_alloc_securid(&security,
- security.uid, security.gid,
+ security.uid, gid,
dir_ni, perm, S_ISDIR(type));
#else
securid = ntfs_alloc_securid(&security,
- security.uid, security.gid,
+ security.uid, gid,
perm & ~security.umask, S_ISDIR(type));
#endif
/* Create object specified in @type. */
@@ -1912,13 +1929,13 @@ static int ntfs_fuse_create(fuse_req_t req, fuse_ino_t parent, const char *name,
#if POSIXACLS
if (!securid
&& ntfs_set_inherited_posix(&security, ni,
- security.uid, security.gid,
+ security.uid, gid,
dir_ni, perm) < 0)
set_fuse_error(&res);
#else
if (!securid
&& ntfs_set_owner_mode(&security, ni,
- security.uid, security.gid,
+ security.uid, gid,
perm & ~security.umask) < 0)
set_fuse_error(&res);
#endif
@@ -1935,6 +1952,8 @@ static int ntfs_fuse_create(fuse_req_t req, fuse_ino_t parent, const char *name,
&& (ni->flags & FILE_ATTR_ENCRYPTED))
state |= CLOSE_ENCRYPTED;
#endif /* HAVE_SETXATTR */
+ if (fi && ctx->dmtime)
+ state |= CLOSE_DMTIME;
ntfs_inode_update_mbsname(dir_ni, name, ni->mft_no);
NInoSetDirty(ni);
e->ino = ni->mft_no;
@@ -2039,9 +2058,17 @@ static int ntfs_fuse_newlink(fuse_req_t req __attribute__((unused)),
goto exit;
}
+ /* Do not accept linking to a directory (except for renaming) */
+ if (e && (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY)) {
+ errno = EPERM;
+ res = -errno;
+ goto exit;
+ }
/* Generate unicode filename. */
uname_len = ntfs_mbstoucs(newname, &uname);
- if (uname_len < 0) {
+ if ((uname_len < 0)
+ || (ctx->windows_names
+ && ntfs_forbidden_chars(uname,uname_len))) {
res = -errno;
goto exit;
}
@@ -2104,11 +2131,14 @@ static void ntfs_fuse_link(fuse_req_t req, fuse_ino_t ino,
fuse_reply_entry(req, &entry);
}
-static int ntfs_fuse_rm(fuse_req_t req, fuse_ino_t parent, const char *name)
+static int ntfs_fuse_rm(fuse_req_t req, fuse_ino_t parent, const char *name,
+ enum RM_TYPES rm_type __attribute__((unused)))
{
ntfschar *uname = NULL;
+ ntfschar *ugname;
ntfs_inode *dir_ni = NULL, *ni = NULL;
int res = 0, uname_len;
+ int ugname_len;
u64 iref;
fuse_ino_t ino;
struct open_file *of;
@@ -2135,72 +2165,121 @@ static int ntfs_fuse_rm(fuse_req_t req, fuse_ino_t parent, const char *name)
res = -errno;
goto exit;
}
-
-{ /* temporary */
-struct open_file *prev = (struct open_file*)NULL;
-for (of=ctx->open_files; of; of=of->next)
-{
-if (of->previous != prev) ntfs_log_error("bad chaining\n");
-prev = of;
-}
-}
- of = ctx->open_files;
ino = (fuse_ino_t)MREF(iref);
- /* improvable search in open files list... */
- while (of
- && (of->ino != ino))
- of = of->next;
- if (of && !(of->state & CLOSE_GHOST)) {
- /* file was open, create a ghost in unlink parent */
- of->state |= CLOSE_GHOST;
- of->parent = parent;
- of->ghost = ++ctx->latest_ghost;
- sprintf(ghostname,ghostformat,of->ghost);
- /* need to close the dir for linking the ghost */
- if (ntfs_inode_close(dir_ni)) {
- res = -errno;
- goto out;
- }
- /* sweep existing ghost if any */
- ntfs_fuse_rm(req, parent, ghostname);
- res = ntfs_fuse_newlink(req, of->ino, parent, ghostname,
- (struct fuse_entry_param*)NULL);
- if (res)
- goto out;
- /* now reopen then parent directory */
- dir_ni = ntfs_inode_open(ctx->vol, INODE(parent));
- if (!dir_ni) {
- res = -errno;
- goto exit;
- }
+ /* deny unlinking metadata files */
+ if (ino < FILE_first_user) {
+ res = -EPERM;
+ goto exit;
}
- ni = ntfs_inode_open(ctx->vol, MREF(iref));
+ ni = ntfs_inode_open(ctx->vol, ino);
if (!ni) {
res = -errno;
goto exit;
}
+#if defined(__sun) && defined (__SVR4)
+ /* on Solaris : deny unlinking directories */
+ if (rm_type
+ == (ni->mrec->flags & MFT_RECORD_IS_DIRECTORY ? RM_LINK : RM_DIR)) {
+ errno = EPERM;
+ res = -errno;
+ goto exit;
+ }
+#endif /* defined(__sun) && defined (__SVR4) */
+
#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
/* JPA deny unlinking if directory is not writable and executable */
- if (!ntfs_fuse_fill_security_context(req, &security)
- || ntfs_allowed_dir_access(&security, dir_ni, ino, ni,
+ if (ntfs_fuse_fill_security_context(req, &security)
+ && !ntfs_allowed_dir_access(&security, dir_ni, ino, ni,
S_IEXEC + S_IWRITE + S_ISVTX)) {
+ errno = EACCES;
+ res = -errno;
+ goto exit;
+ }
#endif
- if (ntfs_delete(ctx->vol, (char*)NULL, ni, dir_ni,
- uname, uname_len))
+ /*
+ * We keep one open_file record per opening, to avoid
+ * having to check the list of open files when opening
+ * and closing (which are more frequent than unlinking).
+ * As a consequence, we may have to create several
+ * ghosts names for the same file.
+ * The file may have been opened with a different name
+ * in a different parent directory. The ghost is
+ * nevertheless created in the parent directory of the
+ * name being unlinked, and permissions to do so are the
+ * same as required for unlinking.
+ */
+ for (of=ctx->open_files; of; of = of->next) {
+ if ((of->ino == ino) && !(of->state & CLOSE_GHOST)) {
+ /* file was open, create a ghost in unlink parent */
+ ntfs_inode *gni;
+ u64 gref;
+
+ /* ni has to be closed for linking ghost */
+ if (ni) {
+ if (ntfs_inode_close(ni)) {
+ res = -errno;
+ goto exit;
+ }
+ ni = (ntfs_inode*)NULL;
+ }
+ of->state |= CLOSE_GHOST;
+ of->parent = parent;
+ of->ghost = ++ctx->latest_ghost;
+ sprintf(ghostname,ghostformat,of->ghost);
+ /* Generate unicode filename. */
+ ugname = (ntfschar*)NULL;
+ ugname_len = ntfs_mbstoucs(ghostname, &ugname);
+ if (ugname_len < 0) {
+ res = -errno;
+ goto exit;
+ }
+ /* sweep existing ghost if any, ignoring errors */
+ gref = ntfs_inode_lookup_by_mbsname(dir_ni, ghostname);
+ if (gref != (u64)-1) {
+ gni = ntfs_inode_open(ctx->vol, MREF(gref));
+ ntfs_delete(ctx->vol, (char*)NULL, gni, dir_ni,
+ ugname, ugname_len);
+ /* ntfs_delete() always closes gni and dir_ni */
+ dir_ni = (ntfs_inode*)NULL;
+ } else {
+ if (ntfs_inode_close(dir_ni)) {
+ res = -errno;
+ goto out;
+ }
+ dir_ni = (ntfs_inode*)NULL;
+ }
+ free(ugname);
+ res = ntfs_fuse_newlink(req, of->ino, parent, ghostname,
+ (struct fuse_entry_param*)NULL);
+ if (res)
+ goto out;
+ /* now reopen then parent directory */
+ dir_ni = ntfs_inode_open(ctx->vol, INODE(parent));
+ if (!dir_ni) {
+ res = -errno;
+ goto exit;
+ }
+ }
+ }
+ if (!ni) {
+ ni = ntfs_inode_open(ctx->vol, ino);
+ if (!ni) {
res = -errno;
+ goto exit;
+ }
+ }
+ if (ntfs_delete(ctx->vol, (char*)NULL, ni, dir_ni,
+ uname, uname_len))
+ res = -errno;
/* ntfs_delete() always closes ni and dir_ni */
- ni = dir_ni = NULL;
-#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
- } else
- res = -EACCES;
-#endif
+ ni = dir_ni = NULL;
exit:
- if (ntfs_inode_close(ni))
- set_fuse_error(&res);
- if (ntfs_inode_close(dir_ni))
- set_fuse_error(&res);
+ if (ntfs_inode_close(ni) && !res)
+ res = -errno;
+ if (ntfs_inode_close(dir_ni) && !res)
+ res = -errno;
out :
free(uname);
return res;
@@ -2211,7 +2290,7 @@ static void ntfs_fuse_unlink(fuse_req_t req, fuse_ino_t parent,
{
int res;
- res = ntfs_fuse_rm(req, parent, name);
+ res = ntfs_fuse_rm(req, parent, name, RM_LINK);
if (res)
fuse_reply_err(req, -res);
else
@@ -2232,7 +2311,7 @@ static int ntfs_fuse_safe_rename(fuse_req_t req, fuse_ino_t ino,
if (ret)
return ret;
- ret = ntfs_fuse_rm(req, newparent, newname);
+ ret = ntfs_fuse_rm(req, newparent, newname, RM_ANY);
if (!ret) {
ret = ntfs_fuse_newlink(req, ino, newparent, newname,
@@ -2240,9 +2319,9 @@ static int ntfs_fuse_safe_rename(fuse_req_t req, fuse_ino_t ino,
if (ret)
goto restore;
- ret = ntfs_fuse_rm(req, parent, name);
+ ret = ntfs_fuse_rm(req, parent, name, RM_ANY);
if (ret) {
- if (ntfs_fuse_rm(req, newparent, newname))
+ if (ntfs_fuse_rm(req, newparent, newname, RM_ANY))
goto err;
goto restore;
}
@@ -2263,7 +2342,7 @@ cleanup:
* fail (unless concurrent access to directories when fuse
* is multithreaded)
*/
- if (ntfs_fuse_rm(req, newparent, tmp) < 0)
+ if (ntfs_fuse_rm(req, newparent, tmp, RM_ANY) < 0)
ntfs_log_perror("Rename failed. Existing file '%s' still present "
"as '%s'", newname, tmp);
}
@@ -2384,9 +2463,9 @@ static void ntfs_fuse_rename(fuse_req_t req, fuse_ino_t parent,
if (ret)
goto out;
- ret = ntfs_fuse_rm(req, parent, name);
+ ret = ntfs_fuse_rm(req, parent, name, RM_ANY);
if (ret)
- ntfs_fuse_rm(req, newparent, newname);
+ ntfs_fuse_rm(req, newparent, newname, RM_ANY);
}
out:
if (ret)
@@ -2406,7 +2485,9 @@ static void ntfs_fuse_release(fuse_req_t req, fuse_ino_t ino,
of = (struct open_file*)(long)fi->fh;
/* Only for marked descriptors there is something to do */
- if (!of || !(of->state & (CLOSE_COMPRESSED | CLOSE_ENCRYPTED))) {
+ if (!of
+ || !(of->state & (CLOSE_COMPRESSED
+ | CLOSE_ENCRYPTED | CLOSE_DMTIME))) {
res = 0;
goto out;
}
@@ -2421,6 +2502,8 @@ static void ntfs_fuse_release(fuse_req_t req, fuse_ino_t ino,
goto exit;
}
res = 0;
+ if (of->state & CLOSE_DMTIME)
+ ntfs_inode_update_times(ni,NTFS_UPDATE_MCTIME);
if (of->state & CLOSE_COMPRESSED)
res = ntfs_attr_pclose(na);
#ifdef HAVE_SETXATTR /* extended attributes interface required */
@@ -2437,7 +2520,7 @@ out:
if (of) {
if (of->state & CLOSE_GHOST) {
sprintf(ghostname,ghostformat,of->ghost);
- ntfs_fuse_rm(req, of->parent, ghostname);
+ ntfs_fuse_rm(req, of->parent, ghostname, RM_ANY);
}
/* remove from open files list */
if (of->next)
@@ -2472,13 +2555,25 @@ static void ntfs_fuse_rmdir(fuse_req_t req, fuse_ino_t parent, const char *name)
{
int res;
- res = ntfs_fuse_rm(req, parent, name);
+ res = ntfs_fuse_rm(req, parent, name, RM_DIR);
if (res)
fuse_reply_err(req, -res);
else
fuse_reply_err(req, 0);
}
+static void ntfs_fuse_fsync(fuse_req_t req,
+ fuse_ino_t ino __attribute__((unused)),
+ int type __attribute__((unused)),
+ struct fuse_file_info *fi __attribute__((unused)))
+{
+ /* sync the full device */
+ if (ntfs_device_sync(ctx->vol->dev))
+ fuse_reply_err(req, errno);
+ else
+ fuse_reply_err(req, 0);
+}
+
static void ntfs_fuse_bmap(fuse_req_t req, fuse_ino_t ino, size_t blocksize,
uint64_t vidx)
{
@@ -2538,67 +2633,15 @@ done :
* Name space identifications and prefixes
*/
-enum { XATTRNS_NONE,
+enum {
+ XATTRNS_NONE,
XATTRNS_USER,
XATTRNS_SYSTEM,
XATTRNS_SECURITY,
XATTRNS_TRUSTED,
- XATTRNS_OPEN } ;
-
-static const char nf_ns_user_prefix[] = "user.";
-static const int nf_ns_user_prefix_len = sizeof(nf_ns_user_prefix) - 1;
-static const char nf_ns_system_prefix[] = "system.";
-static const int nf_ns_system_prefix_len = sizeof(nf_ns_system_prefix) - 1;
-static const char nf_ns_security_prefix[] = "security.";
-static const int nf_ns_security_prefix_len = sizeof(nf_ns_security_prefix) - 1;
-static const char nf_ns_trusted_prefix[] = "trusted.";
-static const int nf_ns_trusted_prefix_len = sizeof(nf_ns_trusted_prefix) - 1;
-
-static const char xattr_ntfs_3g[] = "ntfs-3g.";
-
-/*
- * Identification of data mapped to the system name space
- */
-
-enum { XATTR_UNMAPPED,
- XATTR_NTFS_ACL,
- XATTR_NTFS_ATTRIB,
- XATTR_NTFS_EFSINFO,
- XATTR_NTFS_REPARSE_DATA,
- XATTR_NTFS_OBJECT_ID,
- XATTR_NTFS_DOS_NAME,
- XATTR_NTFS_TIMES,
- XATTR_POSIX_ACC,
- XATTR_POSIX_DEF } ;
-
-static const char nf_ns_xattr_ntfs_acl[] = "system.ntfs_acl";
-static const char nf_ns_xattr_attrib[] = "system.ntfs_attrib";
-static const char nf_ns_xattr_efsinfo[] = "user.ntfs.efsinfo";
-static const char nf_ns_xattr_reparse[] = "system.ntfs_reparse_data";
-static const char nf_ns_xattr_object_id[] = "system.ntfs_object_id";
-static const char nf_ns_xattr_dos_name[] = "system.ntfs_dos_name";
-static const char nf_ns_xattr_times[] = "system.ntfs_times";
-static const char nf_ns_xattr_posix_access[] = "system.posix_acl_access";
-static const char nf_ns_xattr_posix_default[] = "system.posix_acl_default";
-
-struct XATTRNAME {
- int xattr;
- const char *name;
+ XATTRNS_OPEN
} ;
-static struct XATTRNAME nf_ns_xattr_names[] = {
- { XATTR_NTFS_ACL, nf_ns_xattr_ntfs_acl },
- { XATTR_NTFS_ATTRIB, nf_ns_xattr_attrib },
- { XATTR_NTFS_EFSINFO, nf_ns_xattr_efsinfo },
- { XATTR_NTFS_REPARSE_DATA, nf_ns_xattr_reparse },
- { XATTR_NTFS_OBJECT_ID, nf_ns_xattr_object_id },
- { XATTR_NTFS_DOS_NAME, nf_ns_xattr_dos_name },
- { XATTR_NTFS_TIMES, nf_ns_xattr_times },
- { XATTR_POSIX_ACC, nf_ns_xattr_posix_access },
- { XATTR_POSIX_DEF, nf_ns_xattr_posix_default },
- { XATTR_UNMAPPED, (char*)NULL } /* terminator */
-};
-
/*
* Check whether access to internal data as an extended
* attribute in system name space is allowed
@@ -2671,21 +2714,6 @@ static ntfs_inode *ntfs_check_access_xattr(fuse_req_t req,
}
/*
- * Determine whether an extended attribute is in the system
- * name space and mapped to internal data
- */
-
-static int mapped_xattr_system(const char *name)
-{
- struct XATTRNAME *p;
-
- p = nf_ns_xattr_names;
- while (p->name && strcmp(p->name,name))
- p++;
- return (p->xattr);
-}
-
-/*
* Determine the name space of an extended attribute
*/
@@ -2766,7 +2794,6 @@ static void ntfs_fuse_listxattr(fuse_req_t req, fuse_ino_t ino, size_t size)
{
ntfs_attr_search_ctx *actx = NULL;
ntfs_inode *ni;
- char *to;
char *list = (char*)NULL;
int ret = 0;
#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
@@ -2781,9 +2808,11 @@ static void ntfs_fuse_listxattr(fuse_req_t req, fuse_ino_t ino, size_t size)
ret = -errno;
goto out;
}
+ /* Return with no result for symlinks, fifo, etc. */
+ if (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT))
+ goto exit;
+ /* otherwise file must be readable */
#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
- /* file must be readable */
-// condition on fill_security ?
if (!ntfs_allowed_access(&security,ni,S_IREAD)) {
ret = -EACCES;
goto exit;
@@ -2801,72 +2830,14 @@ static void ntfs_fuse_listxattr(fuse_req_t req, fuse_ino_t ino, size_t size)
goto exit;
}
}
- to = list;
if ((ctx->streams == NF_STREAMS_INTERFACE_XATTR)
|| (ctx->streams == NF_STREAMS_INTERFACE_OPENXATTR)) {
- 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;
- }
- /*
- * When using name spaces, do not return
- * security, trusted nor system attributes
- * (filtered elsewhere anyway)
- * otherwise insert "user." prefix
- */
- if (ctx->streams == NF_STREAMS_INTERFACE_XATTR) {
- if ((strlen(tmp_name) > sizeof(xattr_ntfs_3g))
- && !strncmp(tmp_name,xattr_ntfs_3g,
- sizeof(xattr_ntfs_3g)-1))
- tmp_name_len = 0;
- else
- ret += tmp_name_len
- + nf_ns_user_prefix_len + 1;
- } else
- ret += tmp_name_len + 1;
- if (size && tmp_name_len) {
- if ((size_t)ret <= size) {
- if (ctx->streams
- == NF_STREAMS_INTERFACE_XATTR) {
- strcpy(to, nf_ns_user_prefix);
- to += nf_ns_user_prefix_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);
- }
- }
-
- /* List efs info xattr for encrypted files */
- if (ctx->efs_raw && (ni->flags & FILE_ATTR_ENCRYPTED)) {
- ret += sizeof(nf_ns_xattr_efsinfo);
- if ((size_t)ret <= size) {
- memcpy(to, nf_ns_xattr_efsinfo,
- sizeof(nf_ns_xattr_efsinfo));
- to += sizeof(nf_ns_xattr_efsinfo);
- }
+ ret = ntfs_fuse_listxattr_common(ni, actx, list, size,
+ ctx->streams == NF_STREAMS_INTERFACE_XATTR);
+ if (ret < 0)
+ goto exit;
}
-
if (errno != ENOENT)
ret = -errno;
exit:
@@ -2885,82 +2856,22 @@ out :
free(list);
}
-static __inline__ int ntfs_system_getxattr(struct SECURITY_CONTEXT *scx,
- int attr, ntfs_inode *ni, char *value, size_t size)
-{
- int res;
- ntfs_inode *dir_ni;
-
- /*
- * the returned value is the needed
- * size. If it is too small, no copy
- * is done, and the caller has to
- * issue a new call with correct size.
- */
- switch (attr) {
- case XATTR_NTFS_ACL :
- res = ntfs_get_ntfs_acl(scx, ni, value, size);
- break;
-#if POSIXACLS
- case XATTR_POSIX_ACC :
- res = ntfs_get_posix_acl(scx, ni, nf_ns_xattr_posix_access,
- value, size);
- break;
- case XATTR_POSIX_DEF :
- res = ntfs_get_posix_acl(scx, ni, nf_ns_xattr_posix_default,
- value, size);
- break;
-#endif
- case XATTR_NTFS_ATTRIB :
- res = ntfs_get_ntfs_attrib(ni, value, size);
- break;
- case XATTR_NTFS_EFSINFO :
- if (ctx->efs_raw)
- res = ntfs_get_efs_info(ni, value, size);
- else
- res = -EPERM;
- break;
- case XATTR_NTFS_REPARSE_DATA :
- res = ntfs_get_ntfs_reparse_data(ni, value, size);
- break;
- case XATTR_NTFS_OBJECT_ID :
- res = ntfs_get_ntfs_object_id(ni, value, size);
- break;
- case XATTR_NTFS_DOS_NAME:
- dir_ni = ntfs_dir_parent_inode(ni);
- if (dir_ni) {
- res = ntfs_get_ntfs_dos_name(ni, dir_ni, value, size);
- if (ntfs_inode_close(dir_ni))
- set_fuse_error(&res);
- } else
- res = -errno;
- break;
- case XATTR_NTFS_TIMES:
- res = ntfs_inode_get_times(ni, value, size);
- break;
- default :
- errno = EOPNOTSUPP;
- res = -errno;
- break;
- }
- return (res);
-}
-
static void ntfs_fuse_getxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
size_t size)
{
ntfs_inode *ni;
+ ntfs_inode *dir_ni;
ntfs_attr *na = NULL;
char *value = (char*)NULL;
ntfschar *lename = (ntfschar*)NULL;
int lename_len;
int res;
s64 rsize;
- int attr;
+ enum SYSTEMXATTRS attr;
int namespace;
struct SECURITY_CONTEXT security;
- attr = mapped_xattr_system(name);
+ attr = ntfs_xattr_system_type(name,ctx->vol);
if (attr != XATTR_UNMAPPED) {
/*
* hijack internal data and ACL retrieval, whatever
@@ -2974,10 +2885,16 @@ static void ntfs_fuse_getxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
ni = ntfs_check_access_xattr(req, &security, ino,
attr, FALSE);
if (ni) {
- if (ntfs_allowed_access(&security,ni,S_IREAD))
- res = ntfs_system_getxattr(&security,
- attr, ni, value, size);
- else
+ if (ntfs_allowed_access(&security,ni,S_IREAD)) {
+ if (attr == XATTR_NTFS_DOS_NAME)
+ dir_ni = ntfs_dir_parent_inode(ni);
+ else
+ dir_ni = (ntfs_inode*)NULL;
+ res = ntfs_xattr_system_getxattr(&security,
+ attr, ni, dir_ni, value, size);
+ if (dir_ni && ntfs_inode_close(dir_ni))
+ set_fuse_error(&res);
+ } else
res = -errno;
if (ntfs_inode_close(ni))
set_fuse_error(&res);
@@ -2993,8 +2910,14 @@ static void ntfs_fuse_getxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
if (ni) {
/* user mapping not mandatory */
ntfs_fuse_fill_security_context(req, &security);
- res = ntfs_system_getxattr(&security,
- attr, ni, value, size);
+ if (attr == XATTR_NTFS_DOS_NAME)
+ dir_ni = ntfs_dir_parent_inode(ni);
+ else
+ dir_ni = (ntfs_inode*)NULL;
+ res = ntfs_xattr_system_getxattr(&security,
+ attr, ni, dir_ni, value, size);
+ if (dir_ni && ntfs_inode_close(dir_ni))
+ set_fuse_error(&res);
if (ntfs_inode_close(ni))
set_fuse_error(&res);
} else
@@ -3016,10 +2939,6 @@ static void ntfs_fuse_getxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
res = -EOPNOTSUPP;
goto out;
}
- if (ctx->streams == NF_STREAMS_INTERFACE_NONE) {
- res = -EOPNOTSUPP;
- goto out;
- }
namespace = xattr_namespace(name);
if (namespace == XATTRNS_NONE) {
res = -EOPNOTSUPP;
@@ -3030,7 +2949,7 @@ static void ntfs_fuse_getxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
/* trusted only readable by root */
if ((namespace == XATTRNS_TRUSTED)
&& security.uid) {
- res = -EPERM;
+ res = -ENODATA;
goto out;
}
#endif
@@ -3039,9 +2958,13 @@ static void ntfs_fuse_getxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
res = -errno;
goto out;
}
+ /* Return with no result for symlinks, fifo, etc. */
+ if (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT)) {
+ res = -ENODATA;
+ goto exit;
+ }
+ /* otherwise file must be readable */
#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
- /* file must be readable */
-// condition on fill_security
if (!ntfs_allowed_access(&security, ni, S_IREAD)) {
res = -errno;
goto exit;
@@ -3058,10 +2981,11 @@ static void ntfs_fuse_getxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
goto exit;
}
rsize = na->data_size;
- if (ctx->efs_raw &&
- (na->data_flags & ATTR_IS_ENCRYPTED) &&
- NAttrNonResident(na))
- rsize = ((na->data_size + 511) & ~511)+2;
+ if (ctx->efs_raw
+ && rsize
+ && (na->data_flags & ATTR_IS_ENCRYPTED)
+ && NAttrNonResident(na))
+ rsize = ((na->data_size + 511) & ~511) + 2;
if (size) {
if (size >= (size_t)rsize) {
value = (char*)ntfs_malloc(rsize);
@@ -3091,75 +3015,21 @@ out :
free(value);
}
-static __inline__ int ntfs_system_setxattr(struct SECURITY_CONTEXT *scx,
- int attr, ntfs_inode *ni, const char *value,
- size_t size, int flags)
-{
- int res;
- ntfs_inode *dir_ni;
-
- switch (attr) {
- case XATTR_NTFS_ACL :
- res = ntfs_set_ntfs_acl(scx, ni, value, size, flags);
- break;
-#if POSIXACLS
- case XATTR_POSIX_ACC :
- res = ntfs_set_posix_acl(scx ,ni , nf_ns_xattr_posix_access,
- value, size, flags);
- break;
- case XATTR_POSIX_DEF :
- res = ntfs_set_posix_acl(scx, ni, nf_ns_xattr_posix_default,
- value, size, flags);
- break;
-#endif
- case XATTR_NTFS_ATTRIB :
- res = ntfs_set_ntfs_attrib(ni, value, size, flags);
- break;
- case XATTR_NTFS_EFSINFO :
- if (ctx->efs_raw)
- res = ntfs_set_efs_info(ni, value, size, flags);
- else
- res = -EPERM;
- break;
- case XATTR_NTFS_REPARSE_DATA :
- res = ntfs_set_ntfs_reparse_data(ni, value, size, flags);
- break;
- case XATTR_NTFS_OBJECT_ID :
- res = ntfs_set_ntfs_object_id(ni, value, size, flags);
- break;
- case XATTR_NTFS_DOS_NAME:
- dir_ni = ntfs_dir_parent_inode(ni);
- if (dir_ni)
- /* warning : this closes both inodes */
- res = ntfs_set_ntfs_dos_name(ni, dir_ni, value,
- size, flags);
- else
- res = -errno;
- break;
- case XATTR_NTFS_TIMES:
- res = ntfs_inode_set_times(ni, value, size, flags);
- break;
- default :
- errno = EOPNOTSUPP;
- res = -errno;
- break;
- }
- return (res);
-}
-
static void ntfs_fuse_setxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
const char *value, size_t size, int flags)
{
ntfs_inode *ni;
+ ntfs_inode *dir_ni;
ntfs_attr *na = NULL;
ntfschar *lename = NULL;
int res, lename_len;
- size_t part, total;
- int attr;
+ size_t total;
+ s64 part;
+ enum SYSTEMXATTRS attr;
int namespace;
struct SECURITY_CONTEXT security;
- attr = mapped_xattr_system(name);
+ attr = ntfs_xattr_system_type(name,ctx->vol);
if (attr != XATTR_UNMAPPED) {
/*
* hijack internal data and ACL setting, whatever
@@ -3171,8 +3041,13 @@ static void ntfs_fuse_setxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
ni = ntfs_check_access_xattr(req,&security,ino,attr,TRUE);
if (ni) {
if (ntfs_allowed_as_owner(&security, ni)) {
- res = ntfs_system_setxattr(&security,
- attr, ni, value, size, flags);
+ if (attr == XATTR_NTFS_DOS_NAME)
+ dir_ni = ntfs_dir_parent_inode(ni);
+ else
+ dir_ni = (ntfs_inode*)NULL;
+ res = ntfs_xattr_system_setxattr(&security,
+ attr, ni, dir_ni, value, size, flags);
+ /* never have to close dir_ni */
if (res)
res = -errno;
} else
@@ -3196,8 +3071,13 @@ static void ntfs_fuse_setxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
*/
if (!ntfs_fuse_fill_security_context(req, &security)
|| ntfs_allowed_as_owner(&security, ni)) {
- res = ntfs_system_setxattr(&security,
- attr, ni, value, size, flags);
+ if (attr == XATTR_NTFS_DOS_NAME)
+ dir_ni = ntfs_dir_parent_inode(ni);
+ else
+ dir_ni = (ntfs_inode*)NULL;
+ res = ntfs_xattr_system_setxattr(&security,
+ attr, ni, dir_ni, value, size, flags);
+ /* never have to close dir_ni */
if (res)
res = -errno;
} else
@@ -3208,6 +3088,18 @@ static void ntfs_fuse_setxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
} else
res = -errno;
#endif
+#if CACHEING && !defined(FUSE_INTERNAL)
+ /*
+ * Most of system xattr settings cause changes to some
+ * file attribute (st_mode, st_nlink, st_mtime, etc.),
+ * so we must invalidate cached data when cacheing is
+ * in use (not possible with internal fuse or external
+ * fuse before 2.8)
+ */
+ if ((res >= 0)
+ && fuse_lowlevel_notify_inval_inode(ctx->fc, ino, -1, 0))
+ res = -errno;
+#endif
if (res < 0)
fuse_reply_err(req, -res);
else
@@ -3255,15 +3147,29 @@ static void ntfs_fuse_setxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
}
break;
default :
+ /* User xattr not allowed for symlinks, fifo, etc. */
+ if (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT)) {
+ res = -EPERM;
+ goto exit;
+ }
if (!ntfs_allowed_access(&security,ni,S_IWRITE)) {
res = -EACCES;
goto exit;
}
break;
}
+#else
+ /* User xattr not allowed for symlinks, fifo, etc. */
+ if ((namespace == XATTRNS_USER)
+ && (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT))) {
+ res = -EPERM;
+ goto exit;
+ }
#endif
lename_len = fix_xattr_prefix(name, namespace, &lename);
- if (lename_len == -1) {
+ if ((lename_len == -1)
+ || (ctx->windows_names
+ && ntfs_forbidden_chars(lename,lename_len))) {
res = -errno;
goto exit;
}
@@ -3298,6 +3204,7 @@ static void ntfs_fuse_setxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
}
}
total = 0;
+ res = 0;
if (size) {
do {
part = ntfs_attr_pwrite(na, total, size - total,
@@ -3305,20 +3212,20 @@ static void ntfs_fuse_setxattr(fuse_req_t req, fuse_ino_t ino, const char *name,
if (part > 0)
total += part;
} while ((part > 0) && (total < size));
- if (total != size)
- res = -errno;
- else
- if (!(res = ntfs_attr_pclose(na)))
- if (ctx->efs_raw
- && (ni->flags & FILE_ATTR_ENCRYPTED))
- res = ntfs_efs_fixup_attribute(NULL,
- na);
- if (total && !(ni->flags & FILE_ATTR_ARCHIVE)) {
- set_archive(ni);
- NInoFileNameSetDirty(ni);
+ }
+ if ((total != size) || ntfs_attr_pclose(na))
+ res = -errno;
+ else {
+ if (ctx->efs_raw
+ && (ni->flags & FILE_ATTR_ENCRYPTED)) {
+ if (ntfs_efs_fixup_attribute(NULL,na))
+ res = -errno;
}
- } else
- res = 0;
+ }
+ if (!res && !(ni->flags & FILE_ATTR_ARCHIVE)) {
+ set_archive(ni);
+ NInoFileNameSetDirty(ni);
+ }
exit:
if (na)
ntfs_attr_close(na);
@@ -3332,103 +3239,101 @@ out :
fuse_reply_err(req, 0);
}
-static __inline__ int ntfs_system_removexattr(fuse_req_t req, fuse_ino_t ino,
- int attr)
-{
- int res;
- ntfs_inode *dir_ni;
- ntfs_inode *ni;
- struct SECURITY_CONTEXT security;
-
- res = 0;
- switch (attr) {
- /*
- * Removal of NTFS ACL, ATTRIB, EFSINFO or TIMES
- * is never allowed
- */
- case XATTR_NTFS_ACL :
- case XATTR_NTFS_ATTRIB :
- case XATTR_NTFS_EFSINFO :
- case XATTR_NTFS_TIMES :
- res = -EPERM;
- break;
-#if POSIXACLS
- case XATTR_POSIX_ACC :
- case XATTR_POSIX_DEF :
- ni = ntfs_check_access_xattr(req,&security,ino,attr,TRUE);
- if (ni) {
- if (!ntfs_allowed_as_owner(&security, ni)
- || ntfs_remove_posix_acl(&security, ni,
- (attr == XATTR_POSIX_ACC ?
- nf_ns_xattr_posix_access :
- nf_ns_xattr_posix_default)))
- res = -errno;
- if (ntfs_inode_close(ni))
- set_fuse_error(&res);
- } else
- res = -errno;
- break;
-#endif
- case XATTR_NTFS_REPARSE_DATA :
- ni = ntfs_check_access_xattr(req, &security, ino, attr, TRUE);
- if (ni) {
- if (!ntfs_allowed_as_owner(&security, ni)
- || ntfs_remove_ntfs_reparse_data(ni))
- res = -errno;
- if (ntfs_inode_close(ni))
- set_fuse_error(&res);
- } else
- res = -errno;
- break;
- case XATTR_NTFS_OBJECT_ID :
- ni = ntfs_check_access_xattr(req, &security, ino, attr, TRUE);
- if (ni) {
- if (!ntfs_allowed_as_owner(&security, ni)
- || ntfs_remove_ntfs_object_id(ni))
- res = -errno;
- if (ntfs_inode_close(ni))
- set_fuse_error(&res);
- } else
- res = -errno;
- break;
- case XATTR_NTFS_DOS_NAME:
- ni = ntfs_check_access_xattr(req,&security,ino,attr,TRUE);
- if (ni) {
- dir_ni = ntfs_dir_parent_inode(ni);
- if (!dir_ni
- || ntfs_remove_ntfs_dos_name(ni,dir_ni))
- res = -errno;
- } else
- res = -errno;
- break;
- default :
- errno = EOPNOTSUPP;
- res = -errno;
- break;
- }
- return (res);
-}
-
static void ntfs_fuse_removexattr(fuse_req_t req, fuse_ino_t ino, const char *name)
{
ntfs_inode *ni;
+ ntfs_inode *dir_ni;
ntfschar *lename = NULL;
int res = 0, lename_len;
- int attr;
+ enum SYSTEMXATTRS attr;
int namespace;
-#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
struct SECURITY_CONTEXT security;
-#endif
- attr = mapped_xattr_system(name);
+ attr = ntfs_xattr_system_type(name,ctx->vol);
if (attr != XATTR_UNMAPPED) {
+ switch (attr) {
+ /*
+ * Removal of NTFS ACL, ATTRIB, EFSINFO or TIMES
+ * is never allowed
+ */
+ case XATTR_NTFS_ACL :
+ case XATTR_NTFS_ATTRIB :
+ case XATTR_NTFS_ATTRIB_BE :
+ case XATTR_NTFS_EFSINFO :
+ case XATTR_NTFS_TIMES :
+ case XATTR_NTFS_TIMES_BE :
+ case XATTR_NTFS_CRTIME :
+ case XATTR_NTFS_CRTIME_BE :
+ res = -EPERM;
+ break;
+ default :
+#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
+ ni = ntfs_check_access_xattr(req, &security, ino,
+ attr,TRUE);
+ if (ni) {
+ if (ntfs_allowed_as_owner(&security, ni)) {
+ if (attr == XATTR_NTFS_DOS_NAME)
+ dir_ni = ntfs_dir_parent_inode(ni);
+ else
+ dir_ni = (ntfs_inode*)NULL;
+ res = ntfs_xattr_system_removexattr(&security,
+ attr, ni, dir_ni);
+ if (res)
+ res = -errno;
+ /* never have to close dir_ni */
+ } else
+ res = -errno;
+ if ((attr != XATTR_NTFS_DOS_NAME)
+ && ntfs_inode_close(ni))
+ set_fuse_error(&res);
+ } else
+ res = -errno;
+#else
+ /* creation of a new name is not controlled by fuse */
+ if (attr == XATTR_NTFS_DOS_NAME)
+ ni = ntfs_check_access_xattr(req, &security,
+ ino, attr, TRUE);
+ else
+ ni = ntfs_inode_open(ctx->vol, INODE(ino));
+ if (ni) {
+ /*
+ * user mapping is not mandatory
+ * if defined, only owner is allowed
+ */
+ if (!ntfs_fuse_fill_security_context(req, &security)
+ || ntfs_allowed_as_owner(&security, ni)) {
+ if (attr == XATTR_NTFS_DOS_NAME)
+ dir_ni = ntfs_dir_parent_inode(ni);
+ else
+ dir_ni = (ntfs_inode*)NULL;
+ res = ntfs_xattr_system_removexattr(&security,
+ attr, ni, dir_ni);
+ /* never have to close dir_ni */
+ if (res)
+ res = -errno;
+ } else
+ res = -errno;
+ if ((attr != XATTR_NTFS_DOS_NAME)
+ && ntfs_inode_close(ni))
+ set_fuse_error(&res);
+ } else
+ res = -errno;
+#endif
+#if CACHEING && !defined(FUSE_INTERNAL)
/*
- * hijack internal data and ACL removal, whatever
- * mode was selected for xattr (from the user's
- * point of view, ACLs are not xattr)
- * Note : updating an ACL does not set ctime
+ * Some allowed system xattr removals cause changes to
+ * some file attribute (st_mode, st_nlink, etc.),
+ * so we must invalidate cached data when cacheing is
+ * in use (not possible with internal fuse or external
+ * fuse before 2.8)
*/
- res = ntfs_system_removexattr(req, ino, attr);
+ if ((res >= 0)
+ && fuse_lowlevel_notify_inval_inode(ctx->fc,
+ ino, -1, 0))
+ res = -errno;
+#endif
+ break;
+ }
if (res < 0)
fuse_reply_err(req, -res);
else
@@ -3476,12 +3381,24 @@ static void ntfs_fuse_removexattr(fuse_req_t req, fuse_ino_t ino, const char *na
}
break;
default :
+ /* User xattr not allowed for symlinks, fifo, etc. */
+ if (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT)) {
+ res = -EPERM;
+ goto exit;
+ }
if (!ntfs_allowed_access(&security,ni,S_IWRITE)) {
res = -EACCES;
goto exit;
}
break;
}
+#else
+ /* User xattr not allowed for symlinks, fifo, etc. */
+ if ((namespace == XATTRNS_USER)
+ && (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT))) {
+ res = -EPERM;
+ goto exit;
+ }
#endif
lename_len = fix_xattr_prefix(name, namespace, &lename);
if (lename_len == -1) {
@@ -3567,7 +3484,9 @@ static struct fuse_lowlevel_ops ntfs_3g_ops = {
.read = ntfs_fuse_read,
.write = ntfs_fuse_write,
.setattr = ntfs_fuse_setattr,
+#if HAVE_SYS_STATVFS_H
.statfs = ntfs_fuse_statfs,
+#endif
.create = ntfs_fuse_create_file,
.mknod = ntfs_fuse_mknod,
.symlink = ntfs_fuse_symlink,
@@ -3576,6 +3495,8 @@ static struct fuse_lowlevel_ops ntfs_3g_ops = {
.rename = ntfs_fuse_rename,
.mkdir = ntfs_fuse_mkdir,
.rmdir = ntfs_fuse_rmdir,
+ .fsync = ntfs_fuse_fsync,
+ .fsyncdir = ntfs_fuse_fsync,
.bmap = ntfs_fuse_bmap,
.destroy = ntfs_fuse_destroy2,
#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
@@ -3594,7 +3515,8 @@ static struct fuse_lowlevel_ops ntfs_3g_ops = {
.setbkuptime = ntfs_macfuse_setbkuptime,
.setchgtime = ntfs_macfuse_setchgtime,
#endif /* defined(__APPLE__) || defined(__DARWIN__) */
-#if defined(FUSE_CAP_DONT_MASK) || (defined(__APPLE__) || defined(__DARWIN__))
+#if defined(FUSE_CAP_DONT_MASK) || defined(FUSE_CAP_BIG_WRITES) \
+ || (defined(__APPLE__) || defined(__DARWIN__))
.init = ntfs_init
#endif
};
@@ -3623,38 +3545,57 @@ static int ntfs_fuse_init(void)
static int ntfs_open(const char *device)
{
unsigned long flags = 0;
+ ntfs_volume *vol;
if (!ctx->blkdev)
- flags |= MS_EXCLUSIVE;
+ flags |= NTFS_MNT_EXCLUSIVE;
if (ctx->ro)
- flags |= MS_RDONLY;
+ flags |= NTFS_MNT_RDONLY;
if (ctx->recover)
- flags |= MS_RECOVER;
+ flags |= NTFS_MNT_RECOVER;
if (ctx->hiberfile)
- flags |= MS_IGNORE_HIBERFILE;
+ flags |= NTFS_MNT_IGNORE_HIBERFILE;
- ctx->vol = ntfs_mount(device, flags);
- if (!ctx->vol) {
+ ctx->vol = vol = ntfs_mount(device, flags);
+ if (!vol) {
ntfs_log_perror("Failed to mount '%s'", device);
goto err_out;
}
+ if (ctx->sync && ctx->vol->dev)
+ NDevSetSync(ctx->vol->dev);
+ if (ctx->compression)
+ NVolSetCompression(ctx->vol);
+ else
+ NVolClearCompression(ctx->vol);
+#ifdef HAVE_SETXATTR
+ /* archivers must see hidden files */
+ if (ctx->efs_raw)
+ ctx->hide_hid_files = FALSE;
+#endif
+ if (ntfs_set_shown_files(ctx->vol, ctx->show_sys_files,
+ !ctx->hide_hid_files, ctx->hide_dot_files))
+ goto err_out;
+
+ if (ctx->ignore_case && ntfs_set_ignore_case(vol))
+ goto err_out;
- ctx->vol->free_clusters = ntfs_attr_get_free_bits(ctx->vol->lcnbmp_na);
- if (ctx->vol->free_clusters < 0) {
+ vol->free_clusters = ntfs_attr_get_free_bits(vol->lcnbmp_na);
+ if (vol->free_clusters < 0) {
ntfs_log_perror("Failed to read NTFS $Bitmap");
goto err_out;
}
- ctx->vol->free_mft_records = ntfs_get_nr_free_mft_records(ctx->vol);
- if (ctx->vol->free_mft_records < 0) {
+ vol->free_mft_records = ntfs_get_nr_free_mft_records(vol);
+ if (vol->free_mft_records < 0) {
ntfs_log_perror("Failed to calculate free MFT records");
goto err_out;
}
- if (ctx->hiberfile && ntfs_volume_check_hiberfile(ctx->vol, 0)) {
+ if (ctx->hiberfile && ntfs_volume_check_hiberfile(vol, 0)) {
if (errno != EPERM)
goto err_out;
- if (ntfs_fuse_rm((fuse_req_t)NULL,FILE_root,"hiberfil.sys"))
+ if (ntfs_fuse_rm((fuse_req_t)NULL,FILE_root,"hiberfil.sys",
+ RM_LINK))
goto err_out;
}
@@ -3664,300 +3605,6 @@ err_out:
}
-#define STRAPPEND_MAX_INSIZE 8192
-#define strappend_is_large(x) ((x) > STRAPPEND_MAX_INSIZE)
-
-static int strappend(char **dest, const char *append)
-{
- char *p;
- size_t size_append, size_dest = 0;
-
- if (!dest)
- return -1;
- if (!append)
- return 0;
-
- size_append = strlen(append);
- if (*dest)
- size_dest = strlen(*dest);
-
- if (strappend_is_large(size_dest) || strappend_is_large(size_append)) {
- errno = EOVERFLOW;
- ntfs_log_perror("%s: Too large input buffer", EXEC_NAME);
- return -1;
- }
-
- p = (char*)realloc(*dest, size_dest + size_append + 1);
- if (!p) {
- ntfs_log_perror("%s: Memory reallocation failed", EXEC_NAME);
- return -1;
- }
-
- *dest = p;
- strcpy(*dest + size_dest, append);
-
- return 0;
-}
-
-static int bogus_option_value(char *val, const char *s)
-{
- if (val) {
- ntfs_log_error("'%s' option shouldn't have value.\n", s);
- return -1;
- }
- return 0;
-}
-
-static int missing_option_value(char *val, const char *s)
-{
- if (!val) {
- ntfs_log_error("'%s' option should have a value.\n", s);
- return -1;
- }
- return 0;
-}
-
-static char *parse_mount_options(const char *orig_opts)
-{
- char *options, *s, *opt, *val, *ret = NULL;
- BOOL no_def_opts = FALSE;
- int default_permissions = 0;
- int want_permissions = 0;
-
- ctx->secure_flags = 0;
-#ifdef HAVE_SETXATTR /* extended attributes interface required */
- ctx->efs_raw = FALSE;
-#endif /* HAVE_SETXATTR */
- options = strdup(orig_opts ? orig_opts : "");
- if (!options) {
- ntfs_log_perror("%s: strdup failed", EXEC_NAME);
- return NULL;
- }
-
- s = options;
- while (s && *s && (val = strsep(&s, ","))) {
- opt = strsep(&val, "=");
- if (!strcmp(opt, "ro")) { /* Read-only mount. */
- if (bogus_option_value(val, "ro"))
- goto err_exit;
- ctx->ro = TRUE;
- if (strappend(&ret, "ro,"))
- goto err_exit;
- } else if (!strcmp(opt, "noatime")) {
- if (bogus_option_value(val, "noatime"))
- goto err_exit;
- ctx->atime = ATIME_DISABLED;
- } else if (!strcmp(opt, "atime")) {
- if (bogus_option_value(val, "atime"))
- goto err_exit;
- ctx->atime = ATIME_ENABLED;
- } else if (!strcmp(opt, "relatime")) {
- if (bogus_option_value(val, "relatime"))
- goto err_exit;
- ctx->atime = ATIME_RELATIVE;
- } else if (!strcmp(opt, "fake_rw")) {
- if (bogus_option_value(val, "fake_rw"))
- 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.
- */
- ntfs_log_error("'fsname' is unsupported option.\n");
- goto err_exit;
- } else if (!strcmp(opt, "no_def_opts")) {
- if (bogus_option_value(val, "no_def_opts"))
- goto err_exit;
- no_def_opts = TRUE; /* Don't add default options. */
- } else if (!strcmp(opt, "default_permissions")) {
- default_permissions = 1;
- } else if (!strcmp(opt, "umask")) {
- if (missing_option_value(val, "umask"))
- goto err_exit;
- sscanf(val, "%o", &ctx->fmask);
- ctx->dmask = ctx->fmask;
- want_permissions = 1;
- } else if (!strcmp(opt, "fmask")) {
- if (missing_option_value(val, "fmask"))
- goto err_exit;
- sscanf(val, "%o", &ctx->fmask);
- want_permissions = 1;
- } else if (!strcmp(opt, "dmask")) {
- if (missing_option_value(val, "dmask"))
- goto err_exit;
- sscanf(val, "%o", &ctx->dmask);
- want_permissions = 1;
- } else if (!strcmp(opt, "uid")) {
- if (missing_option_value(val, "uid"))
- goto err_exit;
- sscanf(val, "%i", &ctx->uid);
- want_permissions = 1;
- } else if (!strcmp(opt, "gid")) {
- if (missing_option_value(val, "gid"))
- goto err_exit;
- sscanf(val, "%i", &ctx->gid);
- want_permissions = 1;
- } else if (!strcmp(opt, "show_sys_files")) {
- if (bogus_option_value(val, "show_sys_files"))
- goto err_exit;
- ctx->show_sys_files = TRUE;
- } else if (!strcmp(opt, "silent")) {
- if (bogus_option_value(val, "silent"))
- goto err_exit;
- ctx->silent = TRUE;
- } else if (!strcmp(opt, "recover")) {
- if (bogus_option_value(val, "recover"))
- goto err_exit;
- ctx->recover = TRUE;
- } else if (!strcmp(opt, "norecover")) {
- if (bogus_option_value(val, "norecover"))
- goto err_exit;
- ctx->recover = FALSE;
- } else if (!strcmp(opt, "remove_hiberfile")) {
- if (bogus_option_value(val, "remove_hiberfile"))
- goto err_exit;
- ctx->hiberfile = TRUE;
- } else if (!strcmp(opt, "locale")) {
- if (missing_option_value(val, "locale"))
- goto err_exit;
- ntfs_set_char_encoding(val);
-#if defined(__APPLE__) || defined(__DARWIN__)
-#ifdef ENABLE_NFCONV
- } else if (!strcmp(opt, "nfconv")) {
- if (bogus_option_value(val, "nfconv"))
- goto err_exit;
- if (ntfs_macosx_normalize_filenames(1)) {
- ntfs_log_error("ntfs_macosx_normalize_filenames(1) failed!\n");
- goto err_exit;
- }
- } else if (!strcmp(opt, "nonfconv")) {
- if (bogus_option_value(val, "nonfconv"))
- goto err_exit;
- if (ntfs_macosx_normalize_filenames(0)) {
- ntfs_log_error("ntfs_macosx_normalize_filenames(0) failed!\n");
- goto err_exit;
- }
-#endif /* ENABLE_NFCONV */
-#endif /* defined(__APPLE__) || defined(__DARWIN__) */
- } else if (!strcmp(opt, "streams_interface")) {
- if (missing_option_value(val, "streams_interface"))
- goto err_exit;
- if (!strcmp(val, "none"))
- ctx->streams = NF_STREAMS_INTERFACE_NONE;
- else if (!strcmp(val, "xattr"))
- ctx->streams = NF_STREAMS_INTERFACE_XATTR;
- else if (!strcmp(val, "openxattr"))
- ctx->streams = NF_STREAMS_INTERFACE_OPENXATTR;
- else {
- ntfs_log_error("Invalid named data streams "
- "access interface.\n");
- goto err_exit;
- }
- } else if (!strcmp(opt, "user_xattr")) {
- ctx->streams = NF_STREAMS_INTERFACE_XATTR;
- } else if (!strcmp(opt, "noauto")) {
- /* Don't pass noauto option to fuse. */
- } else if (!strcmp(opt, "debug")) {
- if (bogus_option_value(val, "debug"))
- 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, "no_detach")) {
- if (bogus_option_value(val, "no_detach"))
- goto err_exit;
- ctx->no_detach = TRUE;
- } 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 if (!strcmp(opt, "blksize")) {
- ntfs_log_info("WARNING: blksize option is ignored "
- "because ntfs-3g must calculate it.\n");
- } else if (!strcmp(opt, "inherit")) {
- /*
- * JPA do not overwrite inherited permissions
- * in create()
- */
- ctx->inherit = TRUE;
- } else if (!strcmp(opt, "addsecurids")) {
- /*
- * JPA create security ids for files being read
- * with an individual security attribute
- */
- ctx->secure_flags |= (1 << SECURITY_ADDSECURIDS);
- } else if (!strcmp(opt, "staticgrps")) {
- /*
- * JPA use static definition of groups
- * for file access control
- */
- ctx->secure_flags |= (1 << SECURITY_STATICGRPS);
- } else if (!strcmp(opt, "usermapping")) {
- if (!val) {
- ntfs_log_error("'usermapping' option should have "
- "a value.\n");
- goto err_exit;
- }
- ctx->usermap_path = strdup(val);
- if (!ctx->usermap_path) {
- ntfs_log_error("no more memory to store "
- "'usermapping' option.\n");
- goto err_exit;
- }
-#ifdef HAVE_SETXATTR /* extended attributes interface required */
- } else if (!strcmp(opt, "efs_raw")) {
- if (bogus_option_value(val, "efs_raw"))
- goto err_exit;
- ctx->efs_raw = TRUE;
-#endif /* HAVE_SETXATTR */
- } else { /* Probably FUSE option. */
- if (strappend(&ret, opt))
- goto err_exit;
- if (val) {
- if (strappend(&ret, "="))
- goto err_exit;
- if (strappend(&ret, val))
- goto err_exit;
- }
- if (strappend(&ret, ","))
- goto err_exit;
- }
- }
- if (!no_def_opts && strappend(&ret, def_opts))
- goto err_exit;
-#if KERNELPERMS
- if (default_permissions && strappend(&ret, "default_permissions,"))
- goto err_exit;
-#endif
-
- if (ctx->atime == ATIME_RELATIVE && strappend(&ret, "relatime,"))
- goto err_exit;
- else if (ctx->atime == ATIME_ENABLED && strappend(&ret, "atime,"))
- goto err_exit;
- else if (ctx->atime == ATIME_DISABLED && strappend(&ret, "noatime,"))
- goto err_exit;
-
- if (strappend(&ret, "fsname="))
- goto err_exit;
- if (strappend(&ret, opts.device))
- goto err_exit;
- if (default_permissions)
- ctx->secure_flags |= (1 << SECURITY_DEFAULT);
- if (want_permissions)
- ctx->secure_flags |= (1 << SECURITY_WANTED);
- if (ctx->ro)
- ctx->secure_flags &= ~(1 << SECURITY_ADDSECURIDS);
-exit:
- free(options);
- return ret;
-err_exit:
- free(ret);
- ret = NULL;
- goto exit;
-}
-
static void usage(void)
{
ntfs_log_info(usage_msg, EXEC_NAME, VERSION, FUSE_TYPE, fuse_version(),
@@ -3965,101 +3612,6 @@ static void usage(void)
EXEC_NAME, ntfs_home);
}
-#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
- * Read the command line, verify the syntax and parse the options.
- *
- * Return: 0 success, -1 error.
- */
-static int parse_options(int argc, char *argv[])
-{
- int c;
-
- static const char *sopt = "-o:hvV";
- static const struct option lopt[] = {
- { "options", required_argument, NULL, 'o' },
- { "help", no_argument, NULL, 'h' },
- { "verbose", no_argument, NULL, 'v' },
- { "version", no_argument, NULL, 'V' },
- { NULL, 0, NULL, 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 = (char*)ntfs_malloc(PATH_MAX + 1);
- if (!opts.device)
- return -1;
-
- /* Canonicalize device name (mtab, etc) */
- if (!realpath(optarg, opts.device)) {
- ntfs_log_perror("%s: Failed to access "
- "volume '%s'", EXEC_NAME, optarg);
- free(opts.device);
- opts.device = NULL;
- return -1;
- }
- } else if (!opts.mnt_point) {
- opts.mnt_point = optarg;
- } else {
- ntfs_log_error("%s: You must specify exactly one "
- "device and exactly one mount "
- "point.\n", EXEC_NAME);
- return -1;
- }
- break;
- case 'o':
- if (opts.options)
- if (strappend(&opts.options, ","))
- return -1;
- if (strappend(&opts.options, optarg))
- return -1;
- break;
- case 'h':
- usage();
- exit(9);
- case 'v':
- /*
- * We must handle the 'verbose' option even if
- * we don't use it because mount(8) passes it.
- */
- break;
- case 'V':
- ntfs_log_info("%s %s %s %d\n", EXEC_NAME, VERSION,
- FUSE_TYPE, fuse_version());
- exit(0);
- default:
- ntfs_log_error("%s: Unknown option '%s'.\n", EXEC_NAME,
- argv[optind - 1]);
- return -1;
- }
- }
-
- if (!opts.device) {
- ntfs_log_error("%s: No device is specified.\n", EXEC_NAME);
- return -1;
- }
- if (!opts.mnt_point) {
- ntfs_log_error("%s: No mountpoint is specified.\n", EXEC_NAME);
- return -1;
- }
-
- return 0;
-}
-
#if defined(linux) || defined(__uClinux__)
static const char *dev_fuse_msg =
@@ -4076,7 +3628,7 @@ static const char *fuse26_kmod_msg =
" message to disappear then you should upgrade to at least kernel\n"
" version 2.6.20, or request help from your distribution to fix\n"
" the kernel problem. The below web page has more information:\n"
-" http://ntfs-3g.org/support.html#fuse26\n"
+" http://tuxera.com/community/ntfs-3g-faq/#fuse26\n"
"\n";
static void mknod_dev_fuse(const char *dev)
@@ -4205,7 +3757,7 @@ static int set_fuseblk_options(char **parsed_options)
blksize = pagesize;
snprintf(options, sizeof(options), ",blkdev,blksize=%u", blksize);
- if (strappend(parsed_options, options))
+ if (ntfs_strappend(parsed_options, options))
return -1;
return 0;
}
@@ -4261,6 +3813,9 @@ static void setup_logging(char *parsed_options)
ctx->seccache = (struct PERMISSIONS_CACHE*)NULL;
ntfs_log_info("Version %s %s %d\n", VERSION, FUSE_TYPE, fuse_version());
+ if (strcmp(opts.arg_device,opts.device))
+ ntfs_log_info("Requested device %s canonicalized as %s\n",
+ opts.arg_device,opts.device);
ntfs_log_info("Mounted %s (%s, label \"%s\", NTFS %d.%d)\n",
opts.device, (ctx->ro) ? "Read-Only" : "Read-Write",
ctx->vol->vol_name, ctx->vol->major_ver,
@@ -4278,7 +3833,11 @@ int main(int argc, char *argv[])
#endif
const char *permissions_mode = (const char*)NULL;
const char *failed_secure = (const char*)NULL;
+#if defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS)
+ struct XATTRMAPPING *xattr_mapping = (struct XATTRMAPPING*)NULL;
+#endif /* defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS) */
struct stat sbuf;
+ unsigned long existing_mount;
int err, fd;
/*
@@ -4303,7 +3862,7 @@ int main(int argc, char *argv[])
ntfs_set_locale();
ntfs_log_set_handler(ntfs_log_handler_stderr);
- if (parse_options(argc, argv)) {
+ if (ntfs_parse_options(&opts, usage, argc, argv)) {
usage();
return NTFS_VOLUME_SYNTAX_ERROR;
}
@@ -4313,12 +3872,19 @@ int main(int argc, char *argv[])
goto err2;
}
- parsed_options = parse_mount_options(opts.options);
+ parsed_options = parse_mount_options(ctx, &opts, TRUE);
if (!parsed_options) {
err = NTFS_VOLUME_SYNTAX_ERROR;
goto err_out;
}
-
+ if (!ntfs_check_if_mounted(opts.device,&existing_mount)
+ && (existing_mount & NTFS_MF_MOUNTED)
+ /* accept multiple read-only mounts */
+ && (!(existing_mount & NTFS_MF_READONLY) || !ctx->ro)) {
+ err = NTFS_VOLUME_LOCKED;
+ goto err_out;
+ }
+
/* need absolute mount point for junctions */
if (opts.mnt_point[0] == '/')
ctx->abs_mnt_point = strdup(opts.mnt_point);
@@ -4329,6 +3895,10 @@ int main(int argc, char *argv[])
PATH_MAX - strlen(opts.mnt_point) - 1)) {
strcat(ctx->abs_mnt_point, "/");
strcat(ctx->abs_mnt_point, opts.mnt_point);
+#if defined(__sun) && defined (__SVR4)
+ /* Solaris also wants the absolute mount point */
+ opts.mnt_point = ctx->abs_mnt_point;
+#endif /* defined(__sun) && defined (__SVR4) */
}
}
}
@@ -4383,6 +3953,12 @@ int main(int argc, char *argv[])
if (err)
goto err_out;
+ /* Force read-only mount if the device was found read-only */
+ if (!ctx->ro && NVolReadOnly(ctx->vol)) {
+ ctx->ro = TRUE;
+ if (ntfs_strinsert(&parsed_options, ",ro"))
+ goto err_out;
+ }
/* We must do this after ntfs_open() to be able to set the blksize */
if (ctx->blkdev && set_fuseblk_options(&parsed_options))
goto err_out;
@@ -4396,14 +3972,18 @@ int main(int argc, char *argv[])
/* to initialize security data */
if (ntfs_open_secure(ctx->vol) && (ctx->vol->major_ver >= 3))
failed_secure = "Could not open file $Secure";
- if (!ntfs_build_mapping(&ctx->security,ctx->usermap_path)) {
+ if (!ntfs_build_mapping(&ctx->security,ctx->usermap_path,
+ (ctx->vol->secure_flags
+ & ((1 << SECURITY_DEFAULT) | (1 << SECURITY_ACL)))
+ && !(ctx->vol->secure_flags & (1 << SECURITY_WANTED)))) {
#if POSIXACLS
+ /* use basic permissions if requested */
if (ctx->vol->secure_flags & (1 << SECURITY_DEFAULT))
permissions_mode = "User mapping built, Posix ACLs not used";
else {
permissions_mode = "User mapping built, Posix ACLs in use";
#if KERNELACLS
- if (strappend(&parsed_options,
+ if (ntfs_strinsert(&parsed_options,
",default_permissions,acl")) {
err = NTFS_VOLUME_SYNTAX_ERROR;
goto err_out;
@@ -4411,14 +3991,15 @@ int main(int argc, char *argv[])
#endif /* KERNELACLS */
}
#else /* POSIXACLS */
- if (!(ctx->vol->secure_flags & (1 << SECURITY_DEFAULT))) {
+ if (!(ctx->vol->secure_flags
+ & ((1 << SECURITY_DEFAULT) | (1 << SECURITY_ACL)))) {
/*
* No explicit option but user mapping found
* force default security
*/
#if KERNELPERMS
ctx->vol->secure_flags |= (1 << SECURITY_DEFAULT);
- if (strappend(&parsed_options, ",default_permissions")) {
+ if (ntfs_strinsert(&parsed_options, ",default_permissions")) {
err = NTFS_VOLUME_SYNTAX_ERROR;
goto err_out;
}
@@ -4435,7 +4016,7 @@ int main(int argc, char *argv[])
if ((ctx->vol->secure_flags & (1 << SECURITY_WANTED))
&& !(ctx->vol->secure_flags & (1 << SECURITY_DEFAULT))) {
ctx->vol->secure_flags |= (1 << SECURITY_DEFAULT);
- if (strappend(&parsed_options, ",default_permissions")) {
+ if (ntfs_strinsert(&parsed_options, ",default_permissions")) {
err = NTFS_VOLUME_SYNTAX_ERROR;
goto err_out;
}
@@ -4451,6 +4032,18 @@ int main(int argc, char *argv[])
if (ctx->usermap_path)
free (ctx->usermap_path);
+#if defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS)
+ xattr_mapping = ntfs_xattr_build_mapping(ctx->vol,
+ ctx->xattrmap_path);
+ ctx->vol->xattr_mapping = xattr_mapping;
+ /*
+ * Errors are logged, do not refuse mounting, it would be
+ * too difficult to fix the unmountable mapping file.
+ */
+ if (ctx->xattrmap_path)
+ free(ctx->xattrmap_path);
+#endif /* defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS) */
+
se = mount_fuse(parsed_options);
if (!se) {
err = NTFS_VOLUME_FUSE_ERROR;
@@ -4481,6 +4074,9 @@ err_out:
ntfs_mount_error(opts.device, opts.mnt_point, err);
if (ctx->abs_mnt_point)
free(ctx->abs_mnt_point);
+#if defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS)
+ ntfs_xattr_free_mapping(xattr_mapping);
+#endif /* defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS) */
err2:
ntfs_close();
free(ctx);
diff --git a/src/ntfs-3g.8 b/src/ntfs-3g.8
new file mode 100644
index 0000000..ee5f7f8
--- a/dev/null
+++ b/src/ntfs-3g.8
@@ -0,0 +1,448 @@
+.\" Copyright (c) 2005-2006 Yura Pakhuchiy.
+.\" Copyright (c) 2005 Richard Russon.
+.\" Copyright (c) 2006-2009 Szabolcs Szakacsits.
+.\" Copyright (c) 2009-2012 Jean-Pierre Andre
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH NTFS-3G 8 "May 2012" "ntfs-3g 2014.2.15"
+.SH NAME
+ntfs-3g \- Third Generation Read/Write NTFS Driver
+.SH SYNOPSIS
+.B ntfs-3g
+\fB[-o \fIoption\fP\fB[,...]]\fR
+.I volume mount_point
+.br
+.B mount \-t ntfs-3g
+\fB[-o \fIoption\fP\fB[,...]]\fR
+.I volume mount_point
+.br
+.B lowntfs-3g
+\fB[-o \fIoption\fP\fB[,...]]\fR
+.I volume mount_point
+.br
+.B mount \-t lowntfs-3g
+\fB[-o \fIoption\fP\fB[,...]]\fR
+.I volume mount_point
+.SH DESCRIPTION
+\fBntfs-3g\fR is an NTFS driver, which can create, remove, rename, move
+files, directories, hard links, and streams; it can read and write files,
+including streams, sparse files and transparently compressed files; it can
+handle special files like symbolic links, devices, and FIFOs; moreover it
+provides standard management of file ownership and permissions, including
+POSIX ACLs.
+.PP
+It comes in two variants \fBntfs-3g\fR and \fBlowntfs-3g\fR with
+a few differences mentioned below in relevant options descriptions.
+.PP
+The \fIvolume\fR to be mounted can be either a block device or
+an image file.
+.SS Windows hibernation and fast restarting
+On computers which can be dual-booted into Windows or Linux, Windows has
+to be fully shut down before booting into Linux, otherwise the NTFS file
+systems on internal disks may be left in an inconsistent state and changes
+made by Linux may be ignored by Windows.
+.P
+So, Windows may not be left in hibernation when starting Linux, in order
+to avoid inconsistencies. Moreover, the fast restart feature available on
+recent Windows systems has to be disabled. This can be achieved by issuing
+as an Administrator the Windows command which disables both
+hibernation and fast restarting :
+.RS
+.sp
+powercfg /h off
+.sp
+.RE
+.SS Access Handling and Security
+By default, files and directories are owned by the effective
+user and group of the mounting process, and everybody has
+full read, write, execution and directory browsing permissions.
+You can also assign permissions to a single user by using the
+.B uid
+and/or the
+.B gid
+options together with the
+.B umask,
+or
+.B fmask
+and
+.B dmask
+options.
+.PP
+Doing so, Windows users have full access to the files created by
+.B ntfs-3g.
+.PP
+But, by setting the \fBpermissions\fR option, you can benefit from the full
+ownership and permissions features as defined by POSIX. Moreover, by defining
+a Windows-to-Linux user mapping, the ownerships and permissions are even
+applied to Windows users and conversely.
+.PP
+If
+.B ntfs-3g
+is set setuid-root then non-root users will
+be also able to mount volumes.
+.SS Windows Filename Compatibility
+NTFS supports several filename namespaces: DOS, Win32 and POSIX. While the
+\fBntfs-3g\fR driver handles all of them, it always creates new files in the
+POSIX namespace for maximum portability and interoperability reasons.
+This means that filenames are case sensitive and all characters are
+allowed except '/' and '\\0'. This is perfectly legal on Windows, though
+some application may get confused. The option \fBwindows_names\fP may be
+used to apply Windows restrictions to new file names.
+.SS Alternate Data Streams (ADS)
+NTFS stores all data 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, \fBntfs-3g\fR will only read
+the unnamed data stream.
+.PP
+By using the options "streams_interface=windows", with the ntfs-3g driver
+(not possible with lowntfs-3g), you will be able to read any named data
+streams, simply by specifying the stream's name after a colon.
+For example:
+.RS
+.sp
+cat some.mp3:artist
+.sp
+.RE
+Named data streams act like normal 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.
+.SH OPTIONS
+Below is a summary of the options that \fBntfs-3g\fR accepts.
+.TP
+\fBuid=\fP\fIvalue\fP and \fBgid=\fP\fIvalue\fP
+Set the owner and the group of files and directories. The values are numerical.
+The defaults are the uid and gid of the current process.
+.TP
+.BI umask= value
+Set the bitmask of the file and directory permissions that are not
+present. The value is given in octal. The default value is 0 which
+means full access to everybody.
+.TP
+.BI fmask= value
+Set the bitmask of the file permissions that are not present.
+The value is given in octal. The default value is 0 which
+means full access to everybody.
+.TP
+.BI dmask= value
+Set the bitmask of the directory permissions that are not
+present. The value is given in octal. The default value is 0 which
+means full access to everybody.
+.TP
+.BI usermapping= file-name
+Use file \fIfile-name\fP as the user mapping file instead of the default
+\fB.NTFS-3G/UserMapping\fP. If \fIfile-name\fP defines a full path, the
+file must be located on a partition previously mounted. If it defines a
+relative path, it is interpreted relative to the root of NTFS partition
+being mounted.
+.P
+.RS
+When a user mapping file is defined, the options \fBuid=\fP, \fBgid=\fP,
+\fBumask=\fP, \fBfmask=\fP, \fBdmask=\fP and \fBsilent\fP are ignored.
+.RE
+.TP
+.B permissions
+Set standard permissions on created files and use standard access control.
+This option is set by default when a user mapping file is present.
+.TP
+.B acl
+Enable setting Posix ACLs on created files and use them for access control.
+This option is only available on specific builds. It is set by default
+when a user mapping file is present and the
+.B permissions
+mount option is not set.
+.TP
+.B inherit
+When creating a new file, set its initial protections
+according to inheritance rules defined in parent directory. These rules
+deviate from Posix specifications, but yield a better Windows
+compatibility. The \fBcompression\fR option or a valid user mapping file
+is required for this option to be effective.
+.TP
+.B ro
+Mount filesystem read\-only. Useful if Windows is hibernated or the
+NTFS journal file is unclean.
+.TP
+.BI locale= value
+This option can be useful when wanting a language specific locale environment.
+It is however discouraged as it leads to files with untranslatable chars
+to not be visible.
+.TP
+.B force
+This option is obsolete. It has been superseded by the \fBrecover\fR and
+\fBnorecover\fR options.
+.TP
+.B recover
+Recover and try to mount a partition which was not unmounted properly by
+Windows. The Windows logfile is cleared, which may cause inconsistencies.
+Currently this is the default option.
+.TP
+.B norecover
+Do not try to mount a partition which was not unmounted properly by Windows.
+.TP
+.B ignore_case \fP(only with lowntfs-3g)
+Ignore character case when accessing a file (\fBFOO\fR, \fBFoo\fR, \fBfoo\fR,
+etc. designate the same file). All files are displayed with lower case in
+directory listings.
+.TP
+.B remove_hiberfile
+Unlike in case of read-only mount, the read-write mount is denied if
+the NTFS volume is hibernated. One needs either to resume Windows and
+shutdown it properly, or use this option which will remove the Windows
+hibernation file. Please note, this means that the saved Windows
+session will be completely lost. Use this option under your own
+responsibility.
+.TP
+.B atime, noatime, relatime
+The
+.B atime
+option updates inode access time for each access.
+
+The
+.B noatime
+option disables inode access time updates which can speed up
+file operations and prevent sleeping (notebook) disks spinning
+up too often thus saving energy and disk lifetime.
+
+The
+.B relatime
+option is very similar to
+.B noatime.
+It updates inode access times relative to modify or change time.
+The access time is only updated if the previous access time was earlier
+than the current modify or change time. Unlike
+.B noatime
+this option doesn't break applications that need to know
+if a file has been read since the last time it was modified.
+This is the default behaviour.
+.TP
+.B delay_mtime[= value]
+Only update the file modification time and the file change time of a file
+when it is closed or when the indicated delay since the previous update has
+elapsed. The argument is a number of seconds, with a default value of 60.
+This is mainly useful for big files which are kept open for a long
+time and written to without changing their size, such as databases or file
+system images mounted as loop.
+.TP
+.B show_sys_files
+Show the metafiles in directory listings. Otherwise the default behaviour is
+to hide the metafiles, which are special files used to store the NTFS
+structure. Please note that even when this option is specified, "$MFT" may
+not be visible due to a glibc bug. Furthermore, irrespectively of
+show_sys_files, all files are accessible by name, for example you can always
+do
+"ls \-l '$UpCase'".
+.TP
+.B hide_hid_files
+Hide the hidden files and directories in directory listings, the hidden files
+and directories being the ones whose NTFS attribute have the hidden flag set.
+The hidden files will not be selected when using wildcards in commands,
+but all files and directories remain accessible by full name, for example you
+can always display the Windows trash bin directory by :
+"ls \-ld '$RECYCLE.BIN'".
+.TP
+.B hide_dot_files
+Set the hidden flag in the NTFS attribute for created files and directories
+whose first character of the name is a dot. Such files and directories
+normally do not appear in directory listings, and when the flag is set
+they do not appear in Windows directory displays either.
+When a file is renamed or linked with a new name, the hidden flag is
+adjusted to the latest name.
+.TP
+.B windows_names
+This option prevents files, directories and extended attributes to be
+created with a name not allowed by windows, either because it contains
+some not allowed character (which are the nine characters " * / : < > ? \\ | and
+those whose code is less than 0x20) or because the last character is a space
+or a dot. Existing such files can still be read (and renamed).
+.TP
+.B allow_other
+This option overrides the security measure restricting file access
+to the user mounting the filesystem. This option is only
+allowed to root, but this restriction can be overridden by
+the 'user_allow_other' option in the /etc/fuse.conf file.
+.TP
+.BI max_read= value
+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 silent
+Do nothing, without returning any error, on chmod and chown operations,
+when the \fBpermissions\fR option is not set and no user mapping file
+is defined. This option is on by default.
+.TP
+.B no_def_opts
+By default ntfs-3g acts as if "silent" (ignore errors on chmod and chown),
+"allow_other" (allow any user to access files) and "nonempty"
+(allow mounting on non-empty directories) were set, and "no_def_opts"
+cancels these default options.
+.TP
+.BI streams_interface= value
+This option controls how the user can access Alternate Data Streams (ADS) or
+in other words, named data streams. It can be set 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 is set to \fBwindows\fR
+(not possible with lowntfs-3g), 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. The default is \fBxattr\fR.
+.TP
+.B user_xattr
+Same as \fBstreams_interface=\fP\fIxattr\fP.
+.TP
+.B efs_raw
+This option should only be used in backup or restore situation.
+It changes the apparent size of files and the behavior of read and
+write operation so that encrypted files can be saved and restored
+without being decrypted. The \fBuser.ntfs.efsinfo\fP extended attribute
+has also to be saved and restored for the file to be decrypted.
+.TP
+.B compression
+This option enables creating new transparently compressed files in
+directories marked for compression. A directory is marked for compression by
+setting the bit 11 (value 0x00000800) in its Windows attribute. In such a
+directory, new files are created compressed and new subdirectories are
+themselves marked for compression. The option and the flag have no effect
+on existing files.
+.TP
+.B nocompression
+This option disables creating new transparently compressed files in directories
+marked for compression. Existing compressed files can still be read and
+updated. Currently this is the default option.
+.TP
+.B big_writes
+This option prevents fuse from splitting write buffers into 4K chunks,
+enabling big write buffers to be transferred from the application in a
+single step (up to some system limit, generally 128K bytes).
+.TP
+.B debug
+Makes ntfs-3g to print a lot of debug output from libntfs-3g and FUSE.
+.TP
+.B no_detach
+Makes ntfs-3g to not detach from terminal and print some debug output.
+.SH USER MAPPING
+NTFS uses specific ids to record the ownership of files instead of
+the \fBuid\fP and \fBgid\fP used by Linux. As a consequence a mapping
+between the ids has to be defined for ownerships to be recorded into
+NTFS and recognized.
+.P
+By default, this mapping is fetched from the file \fB.NTFS-3G/UserMapping\fP
+located in the NTFS partition. The option \fBusermapping=\fP may be used
+to define another location. When the option permissions is set and
+no mapping file is found, a default mapping is used.
+.P
+Each line in the user mapping file defines a mapping. It is organized
+in three fields separated by colons. The first field identifies a \fBuid\fP,
+the second field identifies a \fBgid\fP and the third one identifies the
+corresponding NTFS id, known as a \fBSID\fP. The \fBuid\fP and the \fBgid\fP
+are optional and defining both of them for the same \fBSID\fP is not
+recommended.
+.P
+If no interoperation with Windows is needed, you can use the option
+\fBpermissions\fP to define a standard mapping. Alternately, you may define
+your own mapping by setting a single default mapping with no uid and gid. In
+both cases, files created on Linux will appear to Windows as owned by a
+foreign user, and files created on Windows will appear to Linux as owned by
+root. Just copy the example below and replace the 9 and 10-digit numbers by
+any number not greater than 4294967295. The resulting behavior is the same as
+the one with the option permission set with no ownership option and no user
+mapping file available.
+.RS
+.sp
+.B ::S-1-5-21-3141592653-589793238-462643383-10000
+.sp
+.RE
+If a strong interoperation with Windows is needed, the mapping has to be
+defined for each user and group known in both system, and the \fBSID\fPs used
+by Windows has to be collected. This will lead to a user mapping file like :
+.RS
+.sp
+.B john::S-1-5-21-3141592653-589793238-462643383-1008
+.B mary::S-1-5-21-3141592653-589793238-462643383-1009
+.B :smith:S-1-5-21-3141592653-589793238-462643383-513
+.B ::S-1-5-21-3141592653-589793238-462643383-10000
+.sp
+.RE
+.P
+The utility \fBntfs-3g.usermap\fP may be used to create such a user
+mapping file.
+.SH EXAMPLES
+Mount /dev/sda1 to /mnt/windows:
+.RS
+.sp
+.B ntfs-3g /dev/sda1 /mnt/windows
+.RE
+or
+.RS
+.B mount -t ntfs-3g /dev/sda1 /mnt/windows
+.sp
+.RE
+Mount the ntfs data partition /dev/sda3 to /mnt/data with standard Linux
+permissions applied :
+.RS
+.sp
+.B ntfs-3g -o permissions /dev/sda3 /mnt/data
+.RE
+or
+.RS
+.B mount -t ntfs-3g -o permissions /dev/sda3 /mnt/data
+.sp
+.RE
+Read\-only mount /dev/sda5 to /home/user/mnt and make user with uid 1000
+to be the owner of all files:
+.RS
+.sp
+.B ntfs-3g /dev/sda5 /home/user/mnt \-o ro,uid=1000
+.sp
+.RE
+/etc/fstab entry for the above (the sixth and last field has to be zero to
+avoid a file system check at boot time) :
+.RS
+.sp
+.B /dev/sda5 /home/user/mnt ntfs\-3g ro,uid=1000 0 0
+.sp
+.RE
+Unmount /mnt/windows:
+.RS
+.sp
+.B umount /mnt/windows
+.sp
+.RE
+.SH EXIT CODES
+To facilitate the use of the
+.B ntfs-3g
+driver in scripts, an exit code is returned to give an indication of the
+mountability status of a volume. Value 0 means success, and all other
+ones mean an error. The unique error codes are documented in the
+.BR ntfs-3g.probe (8)
+manual page.
+.SH KNOWN ISSUES
+Please see
+.RS
+.sp
+http://www.tuxera.com/support/
+.sp
+.RE
+for common questions and known issues.
+If you would find a new one in the latest release of
+the software then please send an email describing it
+in detail. You can contact the
+development team on the ntfs\-3g\-devel@lists.sf.net
+address.
+.SH AUTHORS
+.B ntfs-3g
+was based on and a major improvement to ntfsmount and libntfs which were
+written by Yura Pakhuchiy and the Linux-NTFS team. The improvements were
+made, the ntfs-3g project was initiated and currently led by long time
+Linux-NTFS team developer Szabolcs Szakacsits (szaka@tuxera.com).
+.SH THANKS
+Several people made heroic efforts, often over five or more
+years which resulted the ntfs-3g driver. Most importantly they are
+Anton Altaparmakov, Jean-Pierre André, Richard Russon, Szabolcs Szakacsits,
+Yura Pakhuchiy, Yuval Fledel, and the author of the groundbreaking FUSE
+filesystem development framework, Miklos Szeredi.
+.SH SEE ALSO
+.BR ntfs-3g.probe (8),
+.BR ntfsprogs (8),
+.BR attr (5),
+.BR getfattr (1)
diff --git a/src/ntfs-3g.8.in b/src/ntfs-3g.8.in
index 3134d21..42f2e2b 100755
--- a/src/ntfs-3g.8.in
+++ b/src/ntfs-3g.8.in
@@ -1,10 +1,10 @@
.\" Copyright (c) 2005-2006 Yura Pakhuchiy.
.\" Copyright (c) 2005 Richard Russon.
.\" Copyright (c) 2006-2009 Szabolcs Szakacsits.
-.\" Copyright (c) 2009 Jean-Pierre Andre
+.\" Copyright (c) 2009-2012 Jean-Pierre Andre
.\" This file may be copied under the terms of the GNU Public License.
.\"
-.TH NTFS-3G 8 "February 2010" "ntfs-3g @VERSION@"
+.TH NTFS-3G 8 "May 2012" "ntfs-3g @VERSION@"
.SH NAME
ntfs-3g \- Third Generation Read/Write NTFS Driver
.SH SYNOPSIS
@@ -36,9 +36,25 @@ a few differences mentioned below in relevant options descriptions.
.PP
The \fIvolume\fR to be mounted can be either a block device or
an image file.
+.SS Windows hibernation and fast restarting
+On computers which can be dual-booted into Windows or Linux, Windows has
+to be fully shut down before booting into Linux, otherwise the NTFS file
+systems on internal disks may be left in an inconsistent state and changes
+made by Linux may be ignored by Windows.
+.P
+So, Windows may not be left in hibernation when starting Linux, in order
+to avoid inconsistencies. Moreover, the fast restart feature available on
+recent Windows systems has to be disabled. This can be achieved by issuing
+as an Administrator the Windows command which disables both
+hibernation and fast restarting :
+.RS
+.sp
+powercfg /h off
+.sp
+.RE
.SS Access Handling and Security
By default, files and directories are owned by the effective
-user and group of the mounting process and everybody has
+user and group of the mounting process, and everybody has
full read, write, execution and directory browsing permissions.
You can also assign permissions to a single user by using the
.B uid
@@ -55,10 +71,10 @@ options.
Doing so, Windows users have full access to the files created by
.B ntfs-3g.
.PP
-But, by defining a Windows-to-Linux user mapping in the file
-\fB.NTFS-3G/UserMapping\fP, you can benefit from the full ownership and
-permissions features as defined by Posix and those ownership and
-permissions will be applied to Windows users and conversely.
+But, by setting the \fBpermissions\fR option, you can benefit from the full
+ownership and permissions features as defined by POSIX. Moreover, by defining
+a Windows-to-Linux user mapping, the ownerships and permissions are even
+applied to Windows users and conversely.
.PP
If
.B ntfs-3g
@@ -70,8 +86,8 @@ NTFS supports several filename namespaces: DOS, Win32 and POSIX. While the
POSIX namespace for maximum portability and interoperability reasons.
This means that filenames are case sensitive and all characters are
allowed except '/' and '\\0'. This is perfectly legal on Windows, though
-some application may get confused. If you find so then please report it
-to the developer of the relevant Windows software.
+some application may get confused. The option \fBwindows_names\fP may be
+used to apply Windows restrictions to new file names.
.SS Alternate Data Streams (ADS)
NTFS stores all data in streams. Every file has exactly one unnamed
data stream and can have many named data streams. The size of a file is the
@@ -121,21 +137,26 @@ being mounted.
.P
.RS
When a user mapping file is defined, the options \fBuid=\fP, \fBgid=\fP,
-\fBumask=\fP, \fBfmask=\fP, \fBdmask=\fP and \fBdsilent=\fP are ignored.
+\fBumask=\fP, \fBfmask=\fP, \fBdmask=\fP and \fBsilent\fP are ignored.
.RE
.TP
-.B default_permissions
-Use standard access control. This option requires either a user mapping
-file to be present, or the options \fIuid=\fP and \fIgid=\fP of a user
-to be defined. This option is set by default when a user mapping file
-or an ownership related option is present.
+.B permissions
+Set standard permissions on created files and use standard access control.
+This option is set by default when a user mapping file is present.
+.TP
+.B acl
+Enable setting Posix ACLs on created files and use them for access control.
+This option is only available on specific builds. It is set by default
+when a user mapping file is present and the
+.B permissions
+mount option is not set.
.TP
.B inherit
-When creating a new file, set its initial ownership and protections
+When creating a new file, set its initial protections
according to inheritance rules defined in parent directory. These rules
deviate from Posix specifications, but yield a better Windows
-compatibility. A valid user mapping file is required for this option
-to be effective.
+compatibility. The \fBcompression\fR option or a valid user mapping file
+is required for this option to be effective.
.TP
.B ro
Mount filesystem read\-only. Useful if Windows is hibernated or the
@@ -144,20 +165,31 @@ NTFS journal file is unclean.
.BI locale= value
This option can be useful when wanting a language specific locale environment.
It is however discouraged as it leads to files with untranslatable chars
-to not be visible. Please see more information about this topic at
-http://ntfs-3g.org/support.html#locale
+to not be visible.
.TP
.B force
-Force the mounting even if the NTFS logfile is unclean. The logfile
-will be unconditionally cleared. Use this option with caution and for
-your own responsibility.
+This option is obsolete. It has been superseded by the \fBrecover\fR and
+\fBnorecover\fR options.
+.TP
+.B recover
+Recover and try to mount a partition which was not unmounted properly by
+Windows. The Windows logfile is cleared, which may cause inconsistencies.
+Currently this is the default option.
+.TP
+.B norecover
+Do not try to mount a partition which was not unmounted properly by Windows.
+.TP
+.B ignore_case \fP(only with lowntfs-3g)
+Ignore character case when accessing a file (\fBFOO\fR, \fBFoo\fR, \fBfoo\fR,
+etc. designate the same file). All files are displayed with lower case in
+directory listings.
.TP
.B remove_hiberfile
Unlike in case of read-only mount, the read-write mount is denied if
the NTFS volume is hibernated. One needs either to resume Windows and
shutdown it properly, or use this option which will remove the Windows
hibernation file. Please note, this means that the saved Windows
-session will be completely lost. Use this option for your own
+session will be completely lost. Use this option under your own
responsibility.
.TP
.B atime, noatime, relatime
@@ -183,15 +215,46 @@ this option doesn't break applications that need to know
if a file has been read since the last time it was modified.
This is the default behaviour.
.TP
+.B delay_mtime[= value]
+Only update the file modification time and the file change time of a file
+when it is closed or when the indicated delay since the previous update has
+elapsed. The argument is a number of seconds, with a default value of 60.
+This is mainly useful for big files which are kept open for a long
+time and written to without changing their size, such as databases or file
+system images mounted as loop.
+.TP
.B show_sys_files
-Show the system files in directory listings.
-Otherwise the default behaviour is to hide the system files.
-Please note that even when this option is specified, "$MFT"
-may not be visible due to a glibc bug.
-Furthermore, irrespectively of show_sys_files, all
-files are accessible by name, for example you can always do
+Show the metafiles in directory listings. Otherwise the default behaviour is
+to hide the metafiles, which are special files used to store the NTFS
+structure. Please note that even when this option is specified, "$MFT" may
+not be visible due to a glibc bug. Furthermore, irrespectively of
+show_sys_files, all files are accessible by name, for example you can always
+do
"ls \-l '$UpCase'".
.TP
+.B hide_hid_files
+Hide the hidden files and directories in directory listings, the hidden files
+and directories being the ones whose NTFS attribute have the hidden flag set.
+The hidden files will not be selected when using wildcards in commands,
+but all files and directories remain accessible by full name, for example you
+can always display the Windows trash bin directory by :
+"ls \-ld '$RECYCLE.BIN'".
+.TP
+.B hide_dot_files
+Set the hidden flag in the NTFS attribute for created files and directories
+whose first character of the name is a dot. Such files and directories
+normally do not appear in directory listings, and when the flag is set
+they do not appear in Windows directory displays either.
+When a file is renamed or linked with a new name, the hidden flag is
+adjusted to the latest name.
+.TP
+.B windows_names
+This option prevents files, directories and extended attributes to be
+created with a name not allowed by windows, either because it contains
+some not allowed character (which are the nine characters " * / : < > ? \\ | and
+those whose code is less than 0x20) or because the last character is a space
+or a dot. Existing such files can still be read (and renamed).
+.TP
.B allow_other
This option overrides the security measure restricting file access
to the user mounting the filesystem. This option is only
@@ -204,23 +267,25 @@ The default is infinite. Note that the size of read requests is
limited anyway to 32 pages (which is 128kbyte on i386).
.TP
.B silent
-Do nothing on chmod and chown operations, but do not return error
-when the user mapping file required by these operations is not defined.
-This option is on by default.
+Do nothing, without returning any error, on chmod and chown operations,
+when the \fBpermissions\fR option is not set and no user mapping file
+is defined. This option is on by default.
.TP
.B no_def_opts
-By default ntfs-3g acts as if "silent" were set, and
-this option cancel this default behavior.
+By default ntfs-3g acts as if "silent" (ignore errors on chmod and chown),
+"allow_other" (allow any user to access files) and "nonempty"
+(allow mounting on non-empty directories) were set, and "no_def_opts"
+cancels these default options.
.TP
.BI streams_interface= value
-This option controls how the user can access Alternate Data Streams (ADS)
-or in other words, named data streams. It can be set
-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. The default is \fBxattr\fR.
+This option controls how the user can access Alternate Data Streams (ADS) or
+in other words, named data streams. It can be set 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 is set to \fBwindows\fR
+(not possible with lowntfs-3g), 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. The default is \fBxattr\fR.
.TP
.B user_xattr
Same as \fBstreams_interface=\fP\fIxattr\fP.
@@ -232,21 +297,39 @@ write operation so that encrypted files can be saved and restored
without being decrypted. The \fBuser.ntfs.efsinfo\fP extended attribute
has also to be saved and restored for the file to be decrypted.
.TP
+.B compression
+This option enables creating new transparently compressed files in
+directories marked for compression. A directory is marked for compression by
+setting the bit 11 (value 0x00000800) in its Windows attribute. In such a
+directory, new files are created compressed and new subdirectories are
+themselves marked for compression. The option and the flag have no effect
+on existing files.
+.TP
+.B nocompression
+This option disables creating new transparently compressed files in directories
+marked for compression. Existing compressed files can still be read and
+updated. Currently this is the default option.
+.TP
+.B big_writes
+This option prevents fuse from splitting write buffers into 4K chunks,
+enabling big write buffers to be transferred from the application in a
+single step (up to some system limit, generally 128K bytes).
+.TP
.B debug
-Makes ntfs-3g to not detach from terminal and print a lot of debug output from
-libntfs-3g and FUSE.
+Makes ntfs-3g to print a lot of debug output from libntfs-3g and FUSE.
.TP
.B no_detach
-Same as above but with less debug output.
+Makes ntfs-3g to not detach from terminal and print some debug output.
.SH USER MAPPING
NTFS uses specific ids to record the ownership of files instead of
the \fBuid\fP and \fBgid\fP used by Linux. As a consequence a mapping
between the ids has to be defined for ownerships to be recorded into
NTFS and recognized.
.P
-By default this mapping is fetched from the file \fB.NTFS-3G/UserMapping\fP
+By default, this mapping is fetched from the file \fB.NTFS-3G/UserMapping\fP
located in the NTFS partition. The option \fBusermapping=\fP may be used
-to define another location.
+to define another location. When the option permissions is set and
+no mapping file is found, a default mapping is used.
.P
Each line in the user mapping file defines a mapping. It is organized
in three fields separated by colons. The first field identifies a \fBuid\fP,
@@ -255,18 +338,23 @@ corresponding NTFS id, known as a \fBSID\fP. The \fBuid\fP and the \fBgid\fP
are optional and defining both of them for the same \fBSID\fP is not
recommended.
.P
-If no interoperation with Windows is needed, a single default mapping
-with no uid and gid can be used. Just copy the example below and replace
-the 9 and 10-digit numbers by any number not greater than 4294967295.
+If no interoperation with Windows is needed, you can use the option
+\fBpermissions\fP to define a standard mapping. Alternately, you may define
+your own mapping by setting a single default mapping with no uid and gid. In
+both cases, files created on Linux will appear to Windows as owned by a
+foreign user, and files created on Windows will appear to Linux as owned by
+root. Just copy the example below and replace the 9 and 10-digit numbers by
+any number not greater than 4294967295. The resulting behavior is the same as
+the one with the option permission set with no ownership option and no user
+mapping file available.
.RS
.sp
.B ::S-1-5-21-3141592653-589793238-462643383-10000
.sp
.RE
-If interoperation with Windows is needed, the mapping has to be defined
-for each user and group known in both system, and the \fBSID\fPs used
-by Windows has to be collected. This will lead to a user mapping file
-like :
+If a strong interoperation with Windows is needed, the mapping has to be
+defined for each user and group known in both system, and the \fBSID\fPs used
+by Windows has to be collected. This will lead to a user mapping file like :
.RS
.sp
.B john::S-1-5-21-3141592653-589793238-462643383-1008
@@ -276,20 +364,30 @@ like :
.sp
.RE
.P
-The utility \fBntfs-3g.usermap\fP may be used to create the user mapping file.
+The utility \fBntfs-3g.usermap\fP may be used to create such a user
+mapping file.
.SH EXAMPLES
Mount /dev/sda1 to /mnt/windows:
.RS
.sp
.B ntfs-3g /dev/sda1 /mnt/windows
-.sp
.RE
or
.RS
-.sp
.B mount -t ntfs-3g /dev/sda1 /mnt/windows
.sp
.RE
+Mount the ntfs data partition /dev/sda3 to /mnt/data with standard Linux
+permissions applied :
+.RS
+.sp
+.B ntfs-3g -o permissions /dev/sda3 /mnt/data
+.RE
+or
+.RS
+.B mount -t ntfs-3g -o permissions /dev/sda3 /mnt/data
+.sp
+.RE
Read\-only mount /dev/sda5 to /home/user/mnt and make user with uid 1000
to be the owner of all files:
.RS
@@ -297,7 +395,8 @@ to be the owner of all files:
.B ntfs-3g /dev/sda5 /home/user/mnt \-o ro,uid=1000
.sp
.RE
-/etc/fstab entry for the above:
+/etc/fstab entry for the above (the sixth and last field has to be zero to
+avoid a file system check at boot time) :
.RS
.sp
.B /dev/sda5 /home/user/mnt ntfs\-3g ro,uid=1000 0 0
diff --git a/src/ntfs-3g.c b/src/ntfs-3g.c
index 0643c8b..efd9891 100755
--- a/src/ntfs-3g.c
+++ b/src/ntfs-3g.c
@@ -4,7 +4,7 @@
* Copyright (c) 2005-2007 Yura Pakhuchiy
* Copyright (c) 2005 Yuval Fledel
* Copyright (c) 2006-2009 Szabolcs Szakacsits
- * Copyright (c) 2007-2010 Jean-Pierre Andre
+ * Copyright (c) 2007-2013 Jean-Pierre Andre
* Copyright (c) 2009 Erik Larsson
*
* This file is originated from the Linux-NTFS project.
@@ -37,12 +37,6 @@
#error "***********************************************************"
#endif
-#ifdef FUSE_INTERNAL
-#define FUSE_TYPE "integrated FUSE"
-#else
-#define FUSE_TYPE "external FUSE"
-#endif
-
#ifdef HAVE_STDIO_H
#include <stdio.h>
#endif
@@ -68,7 +62,6 @@
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
-#include <getopt.h>
#include <syslog.h>
#include <sys/wait.h>
@@ -101,8 +94,11 @@
#include "object_id.h"
#include "efs.h"
#include "logging.h"
+#include "xattrs.h"
#include "misc.h"
+#include "ntfs-3g_common.h"
+
/*
* The following permission checking modes are governed by
* the HPERMSCONFIG value in param.h
@@ -137,66 +133,21 @@ typedef enum {
FSTYPE_FUSEBLK
} fuse_fstype;
-typedef enum {
- ATIME_ENABLED,
- ATIME_DISABLED,
- ATIME_RELATIVE
-} ntfs_atime_t;
-
typedef struct {
fuse_fill_dir_t filler;
void *buf;
} ntfs_fuse_fill_context_t;
-typedef enum {
- NF_STREAMS_INTERFACE_NONE, /* No access to named data streams. */
- NF_STREAMS_INTERFACE_XATTR, /* Map named data streams to xattrs. */
- NF_STREAMS_INTERFACE_OPENXATTR, /* Same, not limited to "user." */
- NF_STREAMS_INTERFACE_WINDOWS, /* "file:stream" interface. */
-} ntfs_fuse_streams_interface;
-
enum {
CLOSE_COMPRESSED = 1,
- CLOSE_ENCRYPTED = 2
+ CLOSE_ENCRYPTED = 2,
+ CLOSE_DMTIME = 4
};
-typedef struct {
- ntfs_volume *vol;
- unsigned int uid;
- unsigned int gid;
- unsigned int fmask;
- unsigned int dmask;
- ntfs_fuse_streams_interface streams;
- ntfs_atime_t atime;
- BOOL ro;
- BOOL show_sys_files;
- BOOL silent;
- BOOL recover;
- BOOL hiberfile;
- BOOL debug;
- BOOL no_detach;
- BOOL blkdev;
- BOOL mounted;
-#ifdef HAVE_SETXATTR /* extended attributes interface required */
- BOOL efs_raw;
-#endif /* HAVE_SETXATTR */
- struct fuse_chan *fc;
- BOOL inherit;
- unsigned int secure_flags;
- char *usermap_path;
- char *abs_mnt_point;
- struct PERMISSIONS_CACHE *seccache;
- struct SECURITY_CONTEXT security;
-} ntfs_fuse_context_t;
+static struct ntfs_options opts;
-static struct options {
- char *mnt_point; /* Mount point */
- char *options; /* Mount options */
- char *device; /* Device to mount */
-} opts;
+const char *EXEC_NAME = "ntfs-3g";
-static const char *EXEC_NAME = "ntfs-3g";
-static char def_opts[] = "silent,allow_other,nonempty,";
static ntfs_fuse_context_t *ctx;
static u32 ntfs_sequence;
@@ -217,12 +168,12 @@ static const char *usage_msg =
"\n"
"Copyright (C) 2005-2007 Yura Pakhuchiy\n"
"Copyright (C) 2006-2009 Szabolcs Szakacsits\n"
-"Copyright (C) 2007-2010 Jean-Pierre Andre\n"
+"Copyright (C) 2007-2012 Jean-Pierre Andre\n"
"Copyright (C) 2009 Erik Larsson\n"
"\n"
"Usage: %s [-o option[,...]] <device|image_file> <mount_point>\n"
"\n"
-"Options: ro (read-only mount), remove_hiberfile, uid=, gid=,\n"
+"Options: ro (read-only mount), windows_names, uid=, gid=,\n"
" umask=, fmask=, dmask=, streams_interface=.\n"
" Please see the details in the manual (type: man ntfs-3g).\n"
"\n"
@@ -249,13 +200,14 @@ static const char *setuid_msg =
"Mount is denied because setuid and setgid root ntfs-3g is insecure with the\n"
"external FUSE library. Either remove the setuid/setgid bit from the binary\n"
"or rebuild NTFS-3G with integrated FUSE support and make it setuid root.\n"
-"Please see more information at http://ntfs-3g.org/support.html#unprivileged\n";
+"Please see more information at\n"
+"http://tuxera.com/community/ntfs-3g-faq/#unprivileged\n";
static const char *unpriv_fuseblk_msg =
"Unprivileged user can not mount NTFS block devices using the external FUSE\n"
"library. Either mount the volume as root, or rebuild NTFS-3G with integrated\n"
"FUSE support and make it setuid root. Please see more information at\n"
-"http://ntfs-3g.org/support.html#unprivileged\n";
+"http://tuxera.com/community/ntfs-3g-faq/#unprivileged\n";
#endif
@@ -449,6 +401,28 @@ static int ntfs_allowed_real_dir_access(struct SECURITY_CONTEXT *scx,
return (allowed);
}
+static ntfs_inode *get_parent_dir(const char *path)
+{
+ ntfs_inode *dir_ni;
+ char *dirpath;
+ char *p;
+
+ dirpath = strdup(path);
+ dir_ni = (ntfs_inode*)NULL;
+ if (dirpath) {
+ p = strrchr(dirpath,'/');
+ if (p) { /* always present, be safe */
+ *p = 0;
+ dir_ni = ntfs_pathname_to_inode(ctx->vol,
+ NULL, dirpath);
+ }
+ free(dirpath);
+ } else
+ errno = ENOMEM;
+ return (dir_ni);
+}
+
+
#endif /* HAVE_SETXATTR */
/**
@@ -468,9 +442,9 @@ static int ntfs_allowed_real_dir_access(struct SECURITY_CONTEXT *scx,
*
* Returns 0 on success or -errno on error.
*/
-#if HAVE_SYS_STATVFS_H
+#if HAVE_SYS_STATVFS_H
static int ntfs_fuse_statfs(const char *path __attribute__((unused)),
- struct statfs *sfs)
+ struct statvfs *sfs)
{
s64 size;
int delta_bits;
@@ -516,15 +490,14 @@ static int ntfs_fuse_statfs(const char *path __attribute__((unused)),
size += vol->free_mft_records;
if (size < 0)
size = 0;
- sfs->f_ffree = /*sfs->f_favail = */size;
+ sfs->f_ffree = sfs->f_favail = size;
/* Maximum length of filenames. */
- sfs->f_namelen = NTFS_MAX_NAME_LEN;
+ sfs->f_namemax = NTFS_MAX_NAME_LEN;
return 0;
}
#endif
-
/**
* ntfs_fuse_parse_path - split path to path and stream name.
* @org_path: path to split
@@ -665,7 +638,8 @@ int ntfs_macfuse_setchgtime(const char *path, const struct timespec *tv)
}
#endif /* defined(__APPLE__) || defined(__DARWIN__) */
-#if defined(FUSE_CAP_DONT_MASK) || (defined(__APPLE__) || defined(__DARWIN__))
+#if defined(FUSE_CAP_DONT_MASK) || defined(FUSE_CAP_BIG_WRITES) \
+ || (defined(__APPLE__) || defined(__DARWIN__))
static void *ntfs_init(struct fuse_conn_info *conn)
{
#if defined(__APPLE__) || defined(__DARWIN__)
@@ -675,6 +649,12 @@ static void *ntfs_init(struct fuse_conn_info *conn)
/* request umask not to be enforced by fuse */
conn->want |= FUSE_CAP_DONT_MASK;
#endif /* defined FUSE_CAP_DONT_MASK */
+#ifdef FUSE_CAP_BIG_WRITES
+ if (ctx->big_writes
+ && ((ctx->vol->nr_clusters << ctx->vol->cluster_size_bits)
+ >= SAFE_CAPACITY_FOR_BIG_WRITES))
+ conn->want |= FUSE_CAP_BIG_WRITES;
+#endif
return NULL;
}
#endif /* defined(FUSE_CAP_DONT_MASK) || (defined(__APPLE__) || defined(__DARWIN__)) */
@@ -767,7 +747,9 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf)
* encrypted files to include padding required for decryption
* also include 2 bytes for padding info
*/
- if (ctx->efs_raw && ni->flags & FILE_ATTR_ENCRYPTED)
+ if (ctx->efs_raw
+ && (ni->flags & FILE_ATTR_ENCRYPTED)
+ && ni->data_size)
stbuf->st_size = ((ni->data_size + 511) & ~511) + 2;
#endif /* HAVE_SETXATTR */
/*
@@ -780,9 +762,11 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf)
na = ntfs_attr_open(ni, AT_DATA, stream_name,
stream_name_len);
if (!na) {
- if (stream_name_len)
+ if (stream_name_len) {
res = -ENOENT;
- goto exit;
+ goto exit;
+ } else
+ goto nodata;
}
if (stream_name_len) {
stbuf->st_size = na->data_size;
@@ -810,9 +794,9 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf)
* Check whether it's Interix symbolic link, block or
* character device.
*/
- if ((size_t)na->data_size <= sizeof(INTX_FILE_TYPES)
+ if ((u64)na->data_size <= sizeof(INTX_FILE_TYPES)
+ sizeof(ntfschar) * PATH_MAX
- && (size_t)na->data_size >
+ && (u64)na->data_size >
sizeof(INTX_FILE_TYPES)
&& !stream_name_len) {
@@ -866,6 +850,7 @@ static int ntfs_fuse_getattr(const char *org_path, struct stat *stbuf)
}
if (S_ISLNK(stbuf->st_mode))
stbuf->st_mode |= 0777;
+nodata :
stbuf->st_ino = ni->mft_no;
#ifdef HAVE_STRUCT_STAT_ST_ATIMESPEC
stbuf->st_atimespec = ntfs2timespec(ni->last_access_time);
@@ -1031,16 +1016,33 @@ static int ntfs_fuse_filler(ntfs_fuse_fill_context_t *fill_ctx,
filename, (unsigned long long)MREF(mref));
free(filename);
return 0;
- }
-
- if (MREF(mref) == FILE_root || MREF(mref) >= FILE_first_user ||
- ctx->show_sys_files) {
+ } else {
struct stat st = { .st_ino = MREF(mref) };
- if (dt_type == NTFS_DT_REG)
- st.st_mode = S_IFREG | (0777 & ~ctx->fmask);
- else if (dt_type == NTFS_DT_DIR)
+ switch (dt_type) {
+ case NTFS_DT_DIR :
st.st_mode = S_IFDIR | (0777 & ~ctx->dmask);
+ break;
+ case NTFS_DT_LNK :
+ st.st_mode = S_IFLNK | 0777;
+ break;
+ case NTFS_DT_FIFO :
+ st.st_mode = S_IFIFO;
+ break;
+ case NTFS_DT_SOCK :
+ st.st_mode = S_IFSOCK;
+ break;
+ case NTFS_DT_BLK :
+ st.st_mode = S_IFBLK;
+ break;
+ case NTFS_DT_CHR :
+ st.st_mode = S_IFCHR;
+ break;
+ default : /* unexpected types shown as plain files */
+ case NTFS_DT_REG :
+ st.st_mode = S_IFREG | (0777 & ~ctx->fmask);
+ break;
+ }
#if defined(__APPLE__) || defined(__DARWIN__)
/*
@@ -1188,6 +1190,12 @@ static int ntfs_fuse_open(const char *org_path,
&& (ni->flags & FILE_ATTR_ENCRYPTED))
fi->fh |= CLOSE_ENCRYPTED;
#endif /* HAVE_SETXATTR */
+ /* mark a future need to update the mtime */
+ if (ctx->dmtime)
+ fi->fh |= CLOSE_DMTIME;
+ /* deny opening metadata files for writing */
+ if (ni->mft_no < FILE_first_user)
+ res = -EPERM;
}
ntfs_attr_close(na);
} else
@@ -1232,8 +1240,10 @@ static int ntfs_fuse_read(const char *org_path, char *buf, size_t size,
max_read = na->data_size;
#ifdef HAVE_SETXATTR /* extended attributes interface required */
/* limit reads at next 512 byte boundary for encrypted attributes */
- if (ctx->efs_raw && (na->data_flags & ATTR_IS_ENCRYPTED) &&
- NAttrNonResident(na)) {
+ if (ctx->efs_raw
+ && max_read
+ && (na->data_flags & ATTR_IS_ENCRYPTED)
+ && NAttrNonResident(na)) {
max_read = ((na->data_size+511) & ~511) + 2;
}
#endif /* HAVE_SETXATTR */
@@ -1305,7 +1315,10 @@ static int ntfs_fuse_write(const char *org_path, const char *buf, size_t size,
total += ret;
}
res = total;
- if (res > 0)
+ if ((res > 0)
+ && (!ctx->dmtime
+ || (le64_to_cpu(ntfs_current_time())
+ - le64_to_cpu(ni->last_data_change_time)) > ctx->dmtime))
ntfs_fuse_update_times(na->ni, NTFS_UPDATE_MCTIME);
exit:
if (na)
@@ -1331,7 +1344,7 @@ static int ntfs_fuse_release(const char *org_path,
int stream_name_len, res;
/* Only for marked descriptors there is something to do */
- if (!(fi->fh & (CLOSE_COMPRESSED | CLOSE_ENCRYPTED))) {
+ if (!(fi->fh & (CLOSE_COMPRESSED | CLOSE_ENCRYPTED | CLOSE_DMTIME))) {
res = 0;
goto out;
}
@@ -1351,6 +1364,8 @@ static int ntfs_fuse_release(const char *org_path,
goto exit;
}
res = 0;
+ if (fi->fh & CLOSE_DMTIME)
+ ntfs_inode_update_times(na->ni,NTFS_UPDATE_MCTIME);
if (fi->fh & CLOSE_COMPRESSED)
res = ntfs_attr_pclose(na);
#ifdef HAVE_SETXATTR /* extended attributes interface required */
@@ -1397,6 +1412,11 @@ static int ntfs_fuse_trunc(const char *org_path, off_t size,
ni = ntfs_pathname_to_inode(ctx->vol, NULL, path);
if (!ni)
goto exit;
+ /* deny truncating metadata files */
+ if (ni->mft_no < FILE_first_user) {
+ errno = EPERM;
+ goto exit;
+ }
na = ntfs_attr_open(ni, AT_DATA, stream_name, stream_name_len);
if (!na)
@@ -1416,16 +1436,9 @@ static int ntfs_fuse_trunc(const char *org_path, off_t size,
}
#endif
/*
- * for compressed files, only deleting contents and expanding
- * are implemented. Expanding is done by inserting a final
+ * For compressed files, upsizing is done by inserting a final
* zero, which is optimized as creating a hole when possible.
*/
- if ((na->data_flags & ATTR_COMPRESSION_MASK)
- && size
- && (size < na->initialized_size)) {
- errno = EOPNOTSUPP;
- goto exit;
- }
oldsize = na->data_size;
if ((na->data_flags & ATTR_COMPRESSION_MASK)
&& (size > na->initialized_size)) {
@@ -1607,6 +1620,8 @@ static int ntfs_fuse_create(const char *org_path, mode_t typemode, dev_t dev,
char *dir_path;
le32 securid;
char *path;
+ gid_t gid;
+ mode_t dsetgid;
ntfschar *stream_name;
int stream_name_len;
mode_t type = typemode & ~07777;
@@ -1621,12 +1636,15 @@ static int ntfs_fuse_create(const char *org_path, mode_t typemode, dev_t dev,
name = strrchr(dir_path, '/');
name++;
uname_len = ntfs_mbstoucs(name, &uname);
- if (uname_len < 0) {
+ if ((uname_len < 0)
+ || (ctx->windows_names
+ && ntfs_forbidden_chars(uname,uname_len))) {
res = -errno;
goto exit;
}
stream_name_len = ntfs_fuse_parse_path(org_path,
&path, &stream_name);
+ /* stream name validity has been checked previously */
if (stream_name_len < 0) {
res = stream_name_len;
goto exit;
@@ -1642,13 +1660,15 @@ static int ntfs_fuse_create(const char *org_path, mode_t typemode, dev_t dev,
#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
/* make sure parent directory is writeable and executable */
if (!ntfs_fuse_fill_security_context(&security)
- || ntfs_allowed_access(&security,
- dir_ni,S_IWRITE + S_IEXEC)) {
+ || ntfs_allowed_create(&security,
+ dir_ni, &gid, &dsetgid)) {
#else
ntfs_fuse_fill_security_context(&security);
+ ntfs_allowed_create(&security, dir_ni, &gid, &dsetgid);
#endif
if (S_ISDIR(type))
- perm = typemode & ~ctx->dmask & 0777;
+ perm = (typemode & ~ctx->dmask & 0777)
+ | (dsetgid & S_ISGID);
else
perm = typemode & ~ctx->fmask & 0777;
/*
@@ -1666,11 +1686,11 @@ static int ntfs_fuse_create(const char *org_path, mode_t typemode, dev_t dev,
else
#if POSIXACLS
securid = ntfs_alloc_securid(&security,
- security.uid, security.gid,
+ security.uid, gid,
dir_ni, perm, S_ISDIR(type));
#else
securid = ntfs_alloc_securid(&security,
- security.uid, security.gid,
+ security.uid, gid,
perm & ~security.umask, S_ISDIR(type));
#endif
/* Create object specified in @type. */
@@ -1704,13 +1724,13 @@ static int ntfs_fuse_create(const char *org_path, mode_t typemode, dev_t dev,
#if POSIXACLS
if (!securid
&& ntfs_set_inherited_posix(&security, ni,
- security.uid, security.gid,
+ security.uid, gid,
dir_ni, perm) < 0)
set_fuse_error(&res);
#else
if (!securid
&& ntfs_set_owner_mode(&security, ni,
- security.uid, security.gid,
+ security.uid, gid,
perm & ~security.umask) < 0)
set_fuse_error(&res);
#endif
@@ -1727,6 +1747,9 @@ static int ntfs_fuse_create(const char *org_path, mode_t typemode, dev_t dev,
&& (ni->flags & FILE_ATTR_ENCRYPTED))
fi->fh |= CLOSE_ENCRYPTED;
#endif /* HAVE_SETXATTR */
+ /* mark a need to update the mtime */
+ if (fi && ctx->dmtime)
+ fi->fh |= CLOSE_DMTIME;
NInoSetDirty(ni);
/*
* closing ni requires access to dir_ni to
@@ -1781,10 +1804,12 @@ 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;
+ else
+ set_archive(ni);
if ((res >= 0)
+ && fi
&& (fi->flags & (O_WRONLY | O_RDWR))) {
- set_archive(ni);
/* mark a future need to compress the last block */
if (ni->flags & FILE_ATTR_COMPRESSED)
fi->fh |= CLOSE_COMPRESSED;
@@ -1794,6 +1819,8 @@ static int ntfs_fuse_create_stream(const char *path,
&& (ni->flags & FILE_ATTR_ENCRYPTED))
fi->fh |= CLOSE_ENCRYPTED;
#endif /* HAVE_SETXATTR */
+ if (ctx->dmtime)
+ fi->fh |= CLOSE_DMTIME;
}
if (ntfs_inode_close(ni))
@@ -1812,7 +1839,10 @@ static int ntfs_fuse_mknod_common(const char *org_path, mode_t mode, dev_t dev,
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 && !S_ISREG(mode)) {
+ if (stream_name_len
+ && (!S_ISREG(mode)
+ || (ctx->windows_names
+ && ntfs_forbidden_chars(stream_name,stream_name_len)))) {
res = -EINVAL;
goto exit;
}
@@ -1879,7 +1909,9 @@ static int ntfs_fuse_link(const char *old_path, const char *new_path)
name = strrchr(path, '/');
name++;
uname_len = ntfs_mbstoucs(name, &uname);
- if (uname_len < 0) {
+ if ((uname_len < 0)
+ || (ctx->windows_names
+ && ntfs_forbidden_chars(uname,uname_len))) {
res = -errno;
goto exit;
}
@@ -1946,6 +1978,13 @@ static int ntfs_fuse_rm(const char *org_path)
res = -errno;
goto exit;
}
+ /* deny unlinking metadata files */
+ if (ni->mft_no < FILE_first_user) {
+ errno = EPERM;
+ res = -errno;
+ goto exit;
+ }
+
/* Generate unicode filename. */
name = strrchr(path, '/');
name++;
@@ -2362,6 +2401,19 @@ static int ntfs_fuse_utime(const char *path, struct utimbuf *buf)
#endif /* HAVE_UTIMENSAT */
+static int ntfs_fuse_fsync(const char *path __attribute__((unused)),
+ int type __attribute__((unused)),
+ struct fuse_file_info *fi __attribute__((unused)))
+{
+ int ret;
+
+ /* sync the full device */
+ ret = ntfs_device_sync(ctx->vol->dev);
+ if (ret)
+ ret = -errno;
+ return (ret);
+}
+
static int ntfs_fuse_bmap(const char *path, size_t blocksize, uint64_t *idx)
{
ntfs_inode *ni;
@@ -2414,67 +2466,15 @@ close_inode:
* Name space identifications and prefixes
*/
-enum { XATTRNS_NONE,
+enum {
+ XATTRNS_NONE,
XATTRNS_USER,
XATTRNS_SYSTEM,
XATTRNS_SECURITY,
XATTRNS_TRUSTED,
- XATTRNS_OPEN } ;
-
-static const char nf_ns_user_prefix[] = "user.";
-static const int nf_ns_user_prefix_len = sizeof(nf_ns_user_prefix) - 1;
-static const char nf_ns_system_prefix[] = "system.";
-static const int nf_ns_system_prefix_len = sizeof(nf_ns_system_prefix) - 1;
-static const char nf_ns_security_prefix[] = "security.";
-static const int nf_ns_security_prefix_len = sizeof(nf_ns_security_prefix) - 1;
-static const char nf_ns_trusted_prefix[] = "trusted.";
-static const int nf_ns_trusted_prefix_len = sizeof(nf_ns_trusted_prefix) - 1;
-
-static const char xattr_ntfs_3g[] = "ntfs-3g.";
-
-/*
- * Identification of data mapped to the system name space
- */
-
-enum { XATTR_UNMAPPED,
- XATTR_NTFS_ACL,
- XATTR_NTFS_ATTRIB,
- XATTR_NTFS_EFSINFO,
- XATTR_NTFS_REPARSE_DATA,
- XATTR_NTFS_OBJECT_ID,
- XATTR_NTFS_DOS_NAME,
- XATTR_NTFS_TIMES,
- XATTR_POSIX_ACC,
- XATTR_POSIX_DEF } ;
-
-static const char nf_ns_xattr_ntfs_acl[] = "system.ntfs_acl";
-static const char nf_ns_xattr_attrib[] = "system.ntfs_attrib";
-static const char nf_ns_xattr_efsinfo[] = "user.ntfs.efsinfo";
-static const char nf_ns_xattr_reparse[] = "system.ntfs_reparse_data";
-static const char nf_ns_xattr_object_id[] = "system.ntfs_object_id";
-static const char nf_ns_xattr_dos_name[] = "system.ntfs_dos_name";
-static const char nf_ns_xattr_times[] = "system.ntfs_times";
-static const char nf_ns_xattr_posix_access[] = "system.posix_acl_access";
-static const char nf_ns_xattr_posix_default[] = "system.posix_acl_default";
-
-struct XATTRNAME {
- int xattr;
- const char *name;
+ XATTRNS_OPEN
} ;
-static struct XATTRNAME nf_ns_xattr_names[] = {
- { XATTR_NTFS_ACL, nf_ns_xattr_ntfs_acl },
- { XATTR_NTFS_ATTRIB, nf_ns_xattr_attrib },
- { XATTR_NTFS_EFSINFO, nf_ns_xattr_efsinfo },
- { XATTR_NTFS_REPARSE_DATA, nf_ns_xattr_reparse },
- { XATTR_NTFS_OBJECT_ID, nf_ns_xattr_object_id },
- { XATTR_NTFS_DOS_NAME, nf_ns_xattr_dos_name },
- { XATTR_NTFS_TIMES, nf_ns_xattr_times },
- { XATTR_POSIX_ACC, nf_ns_xattr_posix_access },
- { XATTR_POSIX_DEF, nf_ns_xattr_posix_default },
- { XATTR_UNMAPPED, (char*)NULL } /* terminator */
-};
-
/*
* Check whether access to internal data as an extended
* attribute in system name space is allowed
@@ -2531,21 +2531,6 @@ static ntfs_inode *ntfs_check_access_xattr(struct SECURITY_CONTEXT *security,
}
/*
- * Determine whether an extended attribute is in the system
- * name space and mapped to internal data
- */
-
-static int mapped_xattr_system(const char *name)
-{
- struct XATTRNAME *p;
-
- p = nf_ns_xattr_names;
- while (p->name && strcmp(p->name,name))
- p++;
- return (p->xattr);
-}
-
-/*
* Determine the name space of an extended attribute
*/
@@ -2626,7 +2611,6 @@ static int ntfs_fuse_listxattr(const char *path, char *list, size_t size)
{
ntfs_attr_search_ctx *actx = NULL;
ntfs_inode *ni;
- char *to = list;
int ret = 0;
#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
struct SECURITY_CONTEXT security;
@@ -2642,8 +2626,11 @@ static int ntfs_fuse_listxattr(const char *path, char *list, size_t size)
ni = ntfs_pathname_to_inode(ctx->vol, NULL, path);
if (!ni)
return -errno;
+ /* Return with no result for symlinks, fifo, etc. */
+ if (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT))
+ goto exit;
+ /* otherwise file must be readable */
#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
- /* file must be readable */
if (!ntfs_allowed_access(&security,ni,S_IREAD)) {
ret = -EACCES;
goto exit;
@@ -2657,68 +2644,11 @@ static int ntfs_fuse_listxattr(const char *path, char *list, size_t size)
if ((ctx->streams == NF_STREAMS_INTERFACE_XATTR)
|| (ctx->streams == NF_STREAMS_INTERFACE_OPENXATTR)) {
- 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;
- }
- /*
- * When using name spaces, do not return
- * security, trusted nor system attributes
- * (filtered elsewhere anyway)
- * otherwise insert "user." prefix
- */
- if (ctx->streams == NF_STREAMS_INTERFACE_XATTR) {
- if ((strlen(tmp_name) > sizeof(xattr_ntfs_3g))
- && !strncmp(tmp_name,xattr_ntfs_3g,
- sizeof(xattr_ntfs_3g)-1))
- tmp_name_len = 0;
- else
- ret += tmp_name_len
- + nf_ns_user_prefix_len + 1;
- } else
- ret += tmp_name_len + 1;
- if (size && tmp_name_len) {
- if ((size_t)ret <= size) {
- if (ctx->streams
- == NF_STREAMS_INTERFACE_XATTR) {
- strcpy(to, nf_ns_user_prefix);
- to += nf_ns_user_prefix_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);
- }
- }
-
- /* List efs info xattr for encrypted files */
- if (ctx->efs_raw && (ni->flags & FILE_ATTR_ENCRYPTED)) {
- ret += sizeof(nf_ns_xattr_efsinfo);
- if ((size_t)ret <= size) {
- memcpy(to, nf_ns_xattr_efsinfo,
- sizeof(nf_ns_xattr_efsinfo));
- to += sizeof(nf_ns_xattr_efsinfo);
- }
+ ret = ntfs_fuse_listxattr_common(ni, actx, list, size,
+ ctx->streams == NF_STREAMS_INTERFACE_XATTR);
+ if (ret < 0)
+ goto exit;
}
-
if (errno != ENOENT)
ret = -errno;
exit:
@@ -2808,99 +2738,20 @@ exit:
return ret;
}
-static __inline__ int ntfs_system_getxattr(struct SECURITY_CONTEXT *scx,
- const char *path, int attr, ntfs_inode *ni,
- char *value, size_t size)
-{
- int res;
- ntfs_inode *dir_ni;
- char *dirpath;
- char *p;
- /*
- * the returned value is the needed
- * size. If it is too small, no copy
- * is done, and the caller has to
- * issue a new call with correct size.
- */
- switch (attr) {
- case XATTR_NTFS_ACL :
- res = ntfs_get_ntfs_acl(scx, ni, value, size);
- break;
-#if POSIXACLS
- case XATTR_POSIX_ACC :
- res = ntfs_get_posix_acl(scx, ni, nf_ns_xattr_posix_access,
- value, size);
- break;
- case XATTR_POSIX_DEF :
- res = ntfs_get_posix_acl(scx, ni, nf_ns_xattr_posix_default,
- value, size);
- break;
-#endif
- case XATTR_NTFS_ATTRIB :
- res = ntfs_get_ntfs_attrib(ni, value, size);
- break;
- case XATTR_NTFS_EFSINFO :
- if (ctx->efs_raw)
- res = ntfs_get_efs_info(ni, value, size);
- else
- res = -EPERM;
- break;
- case XATTR_NTFS_REPARSE_DATA :
- res = ntfs_get_ntfs_reparse_data(ni, value, size);
- break;
- case XATTR_NTFS_OBJECT_ID :
- res = ntfs_get_ntfs_object_id(ni, value, size);
- break;
- case XATTR_NTFS_DOS_NAME:
- res = 0;
- dirpath = strdup(path);
- if (dirpath) {
- p = strrchr(dirpath,'/'); /* always present */
- *p = 0;
- dir_ni = ntfs_pathname_to_inode(ni->vol,
- NULL, dirpath);
- if (dir_ni) {
- res = ntfs_get_ntfs_dos_name(ni,
- dir_ni, value, size);
- if (ntfs_inode_close(dir_ni))
- set_fuse_error(&res);
- } else
- res = -errno;
- free(dirpath);
- } else
- res = -ENOMEM;
- if (res < 0)
- errno = -res;
- break;
- case XATTR_NTFS_TIMES:
- res = ntfs_inode_get_times(ni, value, size);
- break;
- default :
- /*
- * make sure applications do not see
- * Posix ACL not consistent with mode
- */
- errno = EOPNOTSUPP;
- res = -errno;
- break;
- }
- return (res);
-}
-
-
static int ntfs_fuse_getxattr(const char *path, const char *name,
char *value, size_t size)
{
ntfs_inode *ni;
+ ntfs_inode *dir_ni;
ntfs_attr *na = NULL;
ntfschar *lename = NULL;
int res, lename_len;
s64 rsize;
- int attr;
+ enum SYSTEMXATTRS attr;
int namespace;
struct SECURITY_CONTEXT security;
- attr = mapped_xattr_system(name);
+ attr = ntfs_xattr_system_type(name,ctx->vol);
if (attr != XATTR_UNMAPPED) {
#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
/*
@@ -2911,8 +2762,14 @@ static int ntfs_fuse_getxattr(const char *path, const char *name,
ni = ntfs_check_access_xattr(&security, path, attr, FALSE);
if (ni) {
if (ntfs_allowed_access(&security,ni,S_IREAD)) {
- res = ntfs_system_getxattr(&security,
- path, attr, ni, value, size);
+ if (attr == XATTR_NTFS_DOS_NAME)
+ dir_ni = get_parent_dir(path);
+ else
+ dir_ni = (ntfs_inode*)NULL;
+ res = ntfs_xattr_system_getxattr(&security,
+ attr, ni, dir_ni, value, size);
+ if (dir_ni && ntfs_inode_close(dir_ni))
+ set_fuse_error(&res);
} else {
res = -errno;
}
@@ -2933,8 +2790,14 @@ static int ntfs_fuse_getxattr(const char *path, const char *name,
if (ni) {
/* user mapping not mandatory */
ntfs_fuse_fill_security_context(&security);
- res = ntfs_system_getxattr(&security,
- path, attr, ni, value, size);
+ if (attr == XATTR_NTFS_DOS_NAME)
+ dir_ni = get_parent_dir(path);
+ else
+ dir_ni = (ntfs_inode*)NULL;
+ res = ntfs_xattr_system_getxattr(&security,
+ attr, ni, dir_ni, value, size);
+ if (dir_ni && ntfs_inode_close(dir_ni))
+ set_fuse_error(&res);
if (ntfs_inode_close(ni))
set_fuse_error(&res);
} else
@@ -2960,13 +2823,18 @@ static int ntfs_fuse_getxattr(const char *path, const char *name,
/* trusted only readable by root */
if ((namespace == XATTRNS_TRUSTED)
&& security.uid)
- return -EPERM;
+ return -ENODATA;
#endif
ni = ntfs_pathname_to_inode(ctx->vol, NULL, path);
if (!ni)
return -errno;
+ /* Return with no result for symlinks, fifo, etc. */
+ if (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT)) {
+ res = -ENODATA;
+ goto exit;
+ }
+ /* otherwise file must be readable */
#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
- /* file must be readable */
if (!ntfs_allowed_access(&security, ni, S_IREAD)) {
res = -errno;
goto exit;
@@ -2983,10 +2851,11 @@ static int ntfs_fuse_getxattr(const char *path, const char *name,
goto exit;
}
rsize = na->data_size;
- if (ctx->efs_raw &&
- (na->data_flags & ATTR_IS_ENCRYPTED) &&
- NAttrNonResident(na))
- rsize = ((na->data_size + 511) & ~511)+2;
+ if (ctx->efs_raw
+ && rsize
+ && (na->data_flags & ATTR_IS_ENCRYPTED)
+ && NAttrNonResident(na))
+ rsize = ((na->data_size + 511) & ~511) + 2;
if (size) {
if (size >= (size_t)rsize) {
res = ntfs_attr_pread(na, 0, rsize, value);
@@ -3005,93 +2874,21 @@ exit:
return res;
}
-static __inline__ int ntfs_system_setxattr(struct SECURITY_CONTEXT *scx,
- const char *path, int attr, ntfs_inode *ni,
- const char *value, size_t size, int flags)
-{
- int res;
- char *dirpath;
- char *p;
- ntfs_inode *dir_ni;
-
- switch (attr) {
- case XATTR_NTFS_ACL :
- res = ntfs_set_ntfs_acl(scx, ni, value, size, flags);
- break;
-#if POSIXACLS
- case XATTR_POSIX_ACC :
- res = ntfs_set_posix_acl(scx,ni, nf_ns_xattr_posix_access,
- value, size, flags);
- break;
- case XATTR_POSIX_DEF :
- res = ntfs_set_posix_acl(scx, ni, nf_ns_xattr_posix_default,
- value, size, flags);
- break;
-#endif
- case XATTR_NTFS_ATTRIB :
- res = ntfs_set_ntfs_attrib(ni, value, size, flags);
- break;
- case XATTR_NTFS_EFSINFO :
- if (ctx->efs_raw)
- res = ntfs_set_efs_info(ni, value, size, flags);
- else
- res = -EPERM;
- break;
- case XATTR_NTFS_REPARSE_DATA :
- res = ntfs_set_ntfs_reparse_data(ni, value, size, flags);
- break;
- case XATTR_NTFS_OBJECT_ID :
- res = ntfs_set_ntfs_object_id(ni, value, size, flags);
- break;
- case XATTR_NTFS_DOS_NAME:
- res = 0;
- dirpath = strdup(path);
- if (dirpath) {
- p = strrchr(dirpath,'/'); /* always present */
- *p = 0;
- dir_ni = ntfs_pathname_to_inode(ni->vol,
- NULL, dirpath);
- if (dir_ni)
- /* warning : this closes both inodes */
- res = ntfs_set_ntfs_dos_name(ni, dir_ni,
- value,size,flags);
- else
- res = -errno;
- free(dirpath);
- } else
- res = -ENOMEM;
- if (res < 0)
- errno = -res;
- break;
- case XATTR_NTFS_TIMES:
- res = ntfs_inode_set_times(ni, value, size, flags);
- break;
- default :
- /*
- * make sure applications do not see
- * Posix ACL not consistent with mode
- */
- errno = EOPNOTSUPP;
- res = -errno;
- break;
- }
- return (res);
-}
-
-
static int ntfs_fuse_setxattr(const char *path, const char *name,
const char *value, size_t size, int flags)
{
ntfs_inode *ni;
+ ntfs_inode *dir_ni;
ntfs_attr *na = NULL;
ntfschar *lename = NULL;
int res, lename_len;
- size_t part, total;
- int attr;
+ size_t total;
+ s64 part;
+ enum SYSTEMXATTRS attr;
int namespace;
struct SECURITY_CONTEXT security;
- attr = mapped_xattr_system(name);
+ attr = ntfs_xattr_system_type(name,ctx->vol);
if (attr != XATTR_UNMAPPED) {
#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
/*
@@ -3103,8 +2900,13 @@ static int ntfs_fuse_setxattr(const char *path, const char *name,
ni = ntfs_check_access_xattr(&security,path,attr,TRUE);
if (ni) {
if (ntfs_allowed_as_owner(&security,ni)) {
- res = ntfs_system_setxattr(&security,
- path, attr, ni, value, size, flags);
+ if (attr == XATTR_NTFS_DOS_NAME)
+ dir_ni = get_parent_dir(path);
+ else
+ dir_ni = (ntfs_inode*)NULL;
+ res = ntfs_xattr_system_setxattr(&security,
+ attr, ni, dir_ni, value, size, flags);
+ /* never have to close dir_ni */
if (res)
res = -errno;
} else
@@ -3135,9 +2937,14 @@ static int ntfs_fuse_setxattr(const char *path, const char *name,
*/
if (!ntfs_fuse_fill_security_context(&security)
|| ntfs_allowed_as_owner(&security,ni)) {
- res = ntfs_system_setxattr(&security,
- path, attr, ni, value,
+ if (attr == XATTR_NTFS_DOS_NAME)
+ dir_ni = get_parent_dir(path);
+ else
+ dir_ni = (ntfs_inode*)NULL;
+ res = ntfs_xattr_system_setxattr(&security,
+ attr, ni, dir_ni, value,
size, flags);
+ /* never have to close dir_ni */
if (res)
res = -errno;
} else
@@ -3189,15 +2996,29 @@ static int ntfs_fuse_setxattr(const char *path, const char *name,
}
break;
default :
+ /* User xattr not allowed for symlinks, fifo, etc. */
+ if (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT)) {
+ res = -EPERM;
+ goto exit;
+ }
if (!ntfs_allowed_access(&security,ni,S_IWRITE)) {
res = -EACCES;
goto exit;
}
break;
}
+#else
+ /* User xattr not allowed for symlinks, fifo, etc. */
+ if ((namespace == XATTRNS_USER)
+ && (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT))) {
+ res = -EPERM;
+ goto exit;
+ }
#endif
lename_len = fix_xattr_prefix(name, namespace, &lename);
- if (lename_len == -1) {
+ if ((lename_len == -1)
+ || (ctx->windows_names
+ && ntfs_forbidden_chars(lename,lename_len))) {
res = -errno;
goto exit;
}
@@ -3232,6 +3053,7 @@ static int ntfs_fuse_setxattr(const char *path, const char *name,
}
}
total = 0;
+ res = 0;
if (size) {
do {
part = ntfs_attr_pwrite(na, total, size - total,
@@ -3239,20 +3061,20 @@ static int ntfs_fuse_setxattr(const char *path, const char *name,
if (part > 0)
total += part;
} while ((part > 0) && (total < size));
- if (total != size)
- res = -errno;
- else
- if (!(res = ntfs_attr_pclose(na)))
- if (ctx->efs_raw
- && (ni->flags & FILE_ATTR_ENCRYPTED))
- res = ntfs_efs_fixup_attribute(NULL,
- na);
- if (total && !(ni->flags & FILE_ATTR_ARCHIVE)) {
- set_archive(ni);
- NInoFileNameSetDirty(ni);
+ }
+ if ((total != size) || ntfs_attr_pclose(na))
+ res = -errno;
+ else {
+ if (ctx->efs_raw
+ && (ni->flags & FILE_ATTR_ENCRYPTED)) {
+ if (ntfs_efs_fixup_attribute(NULL,na))
+ res = -errno;
}
- } else
- res = 0;
+ }
+ if (!res && !(ni->flags & FILE_ATTR_ARCHIVE)) {
+ set_archive(ni);
+ NInoFileNameSetDirty(ni);
+ }
exit:
if (na)
ntfs_attr_close(na);
@@ -3262,134 +3084,104 @@ exit:
return res;
}
-static __inline__ int ntfs_system_removexattr(const char *path,
- int attr)
-{
- int res;
- ntfs_inode *dir_ni;
- ntfs_inode *ni;
- char *dirpath;
- char *p;
- struct SECURITY_CONTEXT security;
-
- res = 0;
- switch (attr) {
- /*
- * Removal of NTFS ACL, ATTRIB, EFSINFO or TIMES
- * is never allowed
- */
- case XATTR_NTFS_ACL :
- case XATTR_NTFS_ATTRIB :
- case XATTR_NTFS_EFSINFO :
- case XATTR_NTFS_TIMES :
- res = -EPERM;
- break;
-#if POSIXACLS
- case XATTR_POSIX_ACC :
- case XATTR_POSIX_DEF :
- ni = ntfs_check_access_xattr(&security, path, attr, TRUE);
- if (ni) {
- if (!ntfs_allowed_as_owner(&security,ni)
- || ntfs_remove_posix_acl(&security,ni,
- (attr == XATTR_POSIX_ACC ?
- nf_ns_xattr_posix_access :
- nf_ns_xattr_posix_default)))
- res = -errno;
- if (ntfs_inode_close(ni))
- set_fuse_error(&res);
- } else
- res = -errno;
- break;
-#endif
- case XATTR_NTFS_REPARSE_DATA :
- ni = ntfs_check_access_xattr(&security, path, attr, TRUE);
- if (ni) {
- if (!ntfs_allowed_as_owner(&security,ni)
- || ntfs_remove_ntfs_reparse_data(ni))
- res = -errno;
- if (ntfs_inode_close(ni))
- set_fuse_error(&res);
- } else
- res = -errno;
- break;
- case XATTR_NTFS_OBJECT_ID :
- ni = ntfs_check_access_xattr(&security,path,attr,TRUE);
- if (ni) {
- if (!ntfs_allowed_as_owner(&security,ni)
- || ntfs_remove_ntfs_object_id(ni))
- res = -errno;
- if (ntfs_inode_close(ni))
- set_fuse_error(&res);
- } else
- res = -errno;
- break;
- case XATTR_NTFS_DOS_NAME:
- res = 0;
- ni = ntfs_check_access_xattr(&security,path,attr,TRUE);
- if (ni) {
- dirpath = strdup(path);
- if (dirpath) {
- p = strrchr(dirpath,'/'); /* always present */
- *p = 0;
- dir_ni = ntfs_pathname_to_inode(ni->vol,
- NULL, dirpath);
- if (!dir_ni
- || ntfs_remove_ntfs_dos_name(ni, dir_ni))
- res = -errno;
- free(dirpath);
- } else
- res = -ENOMEM;
- if (res < 0)
- errno = -res;
- } else
- res = -errno;
- break;
- default :
- /*
- * make sure applications do not see
- * Posix ACL not consistent with mode
- */
- errno = EOPNOTSUPP;
- res = -errno;
- break;
- }
- return (res);
-}
-
static int ntfs_fuse_removexattr(const char *path, const char *name)
{
ntfs_inode *ni;
+ ntfs_inode *dir_ni;
ntfschar *lename = NULL;
int res = 0, lename_len;
- int attr;
+ enum SYSTEMXATTRS attr;
int namespace;
-#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
struct SECURITY_CONTEXT security;
-#endif
- attr = mapped_xattr_system(name);
+ attr = ntfs_xattr_system_type(name,ctx->vol);
if (attr != XATTR_UNMAPPED) {
+ switch (attr) {
+ /*
+ * Removal of NTFS ACL, ATTRIB, EFSINFO or TIMES
+ * is never allowed
+ */
+ case XATTR_NTFS_ACL :
+ case XATTR_NTFS_ATTRIB :
+ case XATTR_NTFS_ATTRIB_BE :
+ case XATTR_NTFS_EFSINFO :
+ case XATTR_NTFS_TIMES :
+ case XATTR_NTFS_TIMES_BE :
+ case XATTR_NTFS_CRTIME :
+ case XATTR_NTFS_CRTIME_BE :
+ res = -EPERM;
+ break;
+ default :
#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
-
/*
* hijack internal data and ACL removal, whatever
* mode was selected for xattr (from the user's
* point of view, ACLs are not xattr)
* Note : updating an ACL does not set ctime
*/
- res = ntfs_system_removexattr(path, attr);
+ ni = ntfs_check_access_xattr(&security,path,attr,TRUE);
+ if (ni) {
+ if (ntfs_allowed_as_owner(&security,ni)) {
+ if (attr == XATTR_NTFS_DOS_NAME)
+ dir_ni = get_parent_dir(path);
+ else
+ dir_ni = (ntfs_inode*)NULL;
+ res = ntfs_xattr_system_removexattr(&security,
+ attr, ni, dir_ni);
+ /* never have to close dir_ni */
+ if (res)
+ res = -errno;
+ } else
+ res = -errno;
+ if ((attr != XATTR_NTFS_DOS_NAME)
+ && ntfs_inode_close(ni))
+ set_fuse_error(&res);
+ } else
+ res = -errno;
#else
/*
- * Only hijack NTFS ACL and ATTRIB removal if POSIX ACLS
+ * Only hijack NTFS ACL setting if POSIX ACLS
* option is not selected
* Access control is partially done by fuse
*/
- if (ntfs_fuse_is_named_data_stream(path))
- res = -EINVAL; /* n/a for named data streams. */
- else {
- res = ntfs_system_removexattr(path, attr);
- }
+ /* creation of a new name is not controlled by fuse */
+ if (attr == XATTR_NTFS_DOS_NAME)
+ ni = ntfs_check_access_xattr(&security,
+ path, attr, TRUE);
+ else {
+ if (ntfs_fuse_is_named_data_stream(path)) {
+ ni = (ntfs_inode*)NULL;
+ errno = EINVAL; /* n/a for named data streams. */
+ } else
+ ni = ntfs_pathname_to_inode(ctx->vol,
+ NULL, path);
+ }
+ if (ni) {
+ /*
+ * user mapping is not mandatory
+ * if defined, only owner is allowed
+ */
+ if (!ntfs_fuse_fill_security_context(&security)
+ || ntfs_allowed_as_owner(&security,ni)) {
+ if (attr == XATTR_NTFS_DOS_NAME)
+ dir_ni = get_parent_dir(path);
+ else
+ dir_ni = (ntfs_inode*)NULL;
+ res = ntfs_xattr_system_removexattr(&security,
+ attr, ni, dir_ni);
+ /* never have to close dir_ni */
+ if (res)
+ res = -errno;
+ } else
+ res = -errno;
+ if ((attr != XATTR_NTFS_DOS_NAME)
+ && ntfs_inode_close(ni))
+ set_fuse_error(&res);
+ } else
+ res = -errno;
#endif
+ break;
+ }
return (res);
}
if ((ctx->streams != NF_STREAMS_INTERFACE_XATTR)
@@ -3430,12 +3222,24 @@ static int ntfs_fuse_removexattr(const char *path, const char *name)
}
break;
default :
+ /* User xattr not allowed for symlinks, fifo, etc. */
+ if (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT)) {
+ res = -EPERM;
+ goto exit;
+ }
if (!ntfs_allowed_access(&security,ni,S_IWRITE)) {
res = -EACCES;
goto exit;
}
break;
}
+#else
+ /* User xattr not allowed for symlinks, fifo, etc. */
+ if ((namespace == XATTRNS_USER)
+ && (ni->flags & (FILE_ATTR_SYSTEM | FILE_ATTR_REPARSE_POINT))) {
+ res = -EPERM;
+ goto exit;
+ }
#endif
lename_len = fix_xattr_prefix(name, namespace, &lename);
if (lename_len == -1) {
@@ -3504,14 +3308,6 @@ static void ntfs_fuse_destroy2(void *unused __attribute__((unused)))
}
static struct fuse_operations ntfs_3g_ops = {
-#if defined(HAVE_UTIMENSAT) && (defined(FUSE_INTERNAL) || (FUSE_VERSION > 28))
- /*
- * Accept UTIME_NOW and UTIME_OMIT in utimens, when
- * using internal fuse or a fuse version since 2.9
- * (this field is not present in older versions)
- */
- .flag_utime_omit_ok = 1,
-#endif
.getattr = ntfs_fuse_getattr,
.readlink = ntfs_fuse_readlink,
.readdir = ntfs_fuse_readdir,
@@ -3521,9 +3317,9 @@ static struct fuse_operations ntfs_3g_ops = {
.write = ntfs_fuse_write,
.truncate = ntfs_fuse_truncate,
.ftruncate = ntfs_fuse_ftruncate,
-#if HAVE_SYS_STATVFS_H
+#if HAVE_SYS_STATVFS_H
.statfs = ntfs_fuse_statfs,
-#endif
+#endif
.chmod = ntfs_fuse_chmod,
.chown = ntfs_fuse_chown,
.create = ntfs_fuse_create_file,
@@ -3539,6 +3335,8 @@ static struct fuse_operations ntfs_3g_ops = {
#else
.utime = ntfs_fuse_utime,
#endif
+ .fsync = ntfs_fuse_fsync,
+ .fsyncdir = ntfs_fuse_fsync,
.bmap = ntfs_fuse_bmap,
.destroy = ntfs_fuse_destroy2,
#if !KERNELPERMS | (POSIXACLS & !KERNELACLS)
@@ -3558,7 +3356,8 @@ static struct fuse_operations ntfs_3g_ops = {
.setbkuptime = ntfs_macfuse_setbkuptime,
.setchgtime = ntfs_macfuse_setchgtime,
#endif /* defined(__APPLE__) || defined(__DARWIN__) */
-#if defined(FUSE_CAP_DONT_MASK) || (defined(__APPLE__) || defined(__DARWIN__))
+#if defined(FUSE_CAP_DONT_MASK) || defined(FUSE_CAP_BIG_WRITES) \
+ || (defined(__APPLE__) || defined(__DARWIN__))
.init = ntfs_init
#endif
};
@@ -3589,19 +3388,33 @@ static int ntfs_open(const char *device)
unsigned long flags = 0;
if (!ctx->blkdev)
- flags |= MS_EXCLUSIVE;
+ flags |= NTFS_MNT_EXCLUSIVE;
if (ctx->ro)
- flags |= MS_RDONLY;
+ flags |= NTFS_MNT_RDONLY;
if (ctx->recover)
- flags |= MS_RECOVER;
+ flags |= NTFS_MNT_RECOVER;
if (ctx->hiberfile)
- flags |= MS_IGNORE_HIBERFILE;
+ flags |= NTFS_MNT_IGNORE_HIBERFILE;
ctx->vol = ntfs_mount(device, flags);
if (!ctx->vol) {
ntfs_log_perror("Failed to mount '%s'", device);
goto err_out;
}
+ if (ctx->sync && ctx->vol->dev)
+ NDevSetSync(ctx->vol->dev);
+ if (ctx->compression)
+ NVolSetCompression(ctx->vol);
+ else
+ NVolClearCompression(ctx->vol);
+#ifdef HAVE_SETXATTR
+ /* archivers must see hidden files */
+ if (ctx->efs_raw)
+ ctx->hide_hid_files = FALSE;
+#endif
+ if (ntfs_set_shown_files(ctx->vol, ctx->show_sys_files,
+ !ctx->hide_hid_files, ctx->hide_dot_files))
+ goto err_out;
ctx->vol->free_clusters = ntfs_attr_get_free_bits(ctx->vol->lcnbmp_na);
if (ctx->vol->free_clusters < 0) {
@@ -3628,300 +3441,6 @@ err_out:
}
-#define STRAPPEND_MAX_INSIZE 8192
-#define strappend_is_large(x) ((x) > STRAPPEND_MAX_INSIZE)
-
-static int strappend(char **dest, const char *append)
-{
- char *p;
- size_t size_append, size_dest = 0;
-
- if (!dest)
- return -1;
- if (!append)
- return 0;
-
- size_append = strlen(append);
- if (*dest)
- size_dest = strlen(*dest);
-
- if (strappend_is_large(size_dest) || strappend_is_large(size_append)) {
- errno = EOVERFLOW;
- ntfs_log_perror("%s: Too large input buffer", EXEC_NAME);
- return -1;
- }
-
- p = realloc(*dest, size_dest + size_append + 1);
- if (!p) {
- ntfs_log_perror("%s: Memory realloction failed", EXEC_NAME);
- return -1;
- }
-
- *dest = p;
- strcpy(*dest + size_dest, append);
-
- return 0;
-}
-
-static int bogus_option_value(char *val, const char *s)
-{
- if (val) {
- ntfs_log_error("'%s' option shouldn't have value.\n", s);
- return -1;
- }
- return 0;
-}
-
-static int missing_option_value(char *val, const char *s)
-{
- if (!val) {
- ntfs_log_error("'%s' option should have a value.\n", s);
- return -1;
- }
- return 0;
-}
-
-static char *parse_mount_options(const char *orig_opts)
-{
- char *options, *s, *opt, *val, *ret = NULL;
- BOOL no_def_opts = FALSE;
- int default_permissions = 0;
- int want_permissions = 0;
-
- ctx->secure_flags = 0;
-#ifdef HAVE_SETXATTR /* extended attributes interface required */
- ctx->efs_raw = FALSE;
-#endif /* HAVE_SETXATTR */
- options = strdup(orig_opts ? orig_opts : "");
- if (!options) {
- ntfs_log_perror("%s: strdup failed", EXEC_NAME);
- return NULL;
- }
-
- s = options;
- while (s && *s && (val = strsep(&s, ","))) {
- opt = strsep(&val, "=");
- if (!strcmp(opt, "ro")) { /* Read-only mount. */
- if (bogus_option_value(val, "ro"))
- goto err_exit;
- ctx->ro = TRUE;
- if (strappend(&ret, "ro,"))
- goto err_exit;
- } else if (!strcmp(opt, "noatime")) {
- if (bogus_option_value(val, "noatime"))
- goto err_exit;
- ctx->atime = ATIME_DISABLED;
- } else if (!strcmp(opt, "atime")) {
- if (bogus_option_value(val, "atime"))
- goto err_exit;
- ctx->atime = ATIME_ENABLED;
- } else if (!strcmp(opt, "relatime")) {
- if (bogus_option_value(val, "relatime"))
- goto err_exit;
- ctx->atime = ATIME_RELATIVE;
- } else if (!strcmp(opt, "fake_rw")) {
- if (bogus_option_value(val, "fake_rw"))
- 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.
- */
- ntfs_log_error("'fsname' is unsupported option.\n");
- goto err_exit;
- } else if (!strcmp(opt, "no_def_opts")) {
- if (bogus_option_value(val, "no_def_opts"))
- goto err_exit;
- no_def_opts = TRUE; /* Don't add default options. */
- } else if (!strcmp(opt, "default_permissions")) {
- default_permissions = 1;
- } else if (!strcmp(opt, "umask")) {
- if (missing_option_value(val, "umask"))
- goto err_exit;
- sscanf(val, "%o", &ctx->fmask);
- ctx->dmask = ctx->fmask;
- want_permissions = 1;
- } else if (!strcmp(opt, "fmask")) {
- if (missing_option_value(val, "fmask"))
- goto err_exit;
- sscanf(val, "%o", &ctx->fmask);
- want_permissions = 1;
- } else if (!strcmp(opt, "dmask")) {
- if (missing_option_value(val, "dmask"))
- goto err_exit;
- sscanf(val, "%o", &ctx->dmask);
- want_permissions = 1;
- } else if (!strcmp(opt, "uid")) {
- if (missing_option_value(val, "uid"))
- goto err_exit;
- sscanf(val, "%i", &ctx->uid);
- want_permissions = 1;
- } else if (!strcmp(opt, "gid")) {
- if (missing_option_value(val, "gid"))
- goto err_exit;
- sscanf(val, "%i", &ctx->gid);
- want_permissions = 1;
- } else if (!strcmp(opt, "show_sys_files")) {
- if (bogus_option_value(val, "show_sys_files"))
- goto err_exit;
- ctx->show_sys_files = TRUE;
- } else if (!strcmp(opt, "silent")) {
- if (bogus_option_value(val, "silent"))
- goto err_exit;
- ctx->silent = TRUE;
- } else if (!strcmp(opt, "recover")) {
- if (bogus_option_value(val, "recover"))
- goto err_exit;
- ctx->recover = TRUE;
- } else if (!strcmp(opt, "norecover")) {
- if (bogus_option_value(val, "norecover"))
- goto err_exit;
- ctx->recover = FALSE;
- } else if (!strcmp(opt, "remove_hiberfile")) {
- if (bogus_option_value(val, "remove_hiberfile"))
- goto err_exit;
- ctx->hiberfile = TRUE;
- } else if (!strcmp(opt, "locale")) {
- if (missing_option_value(val, "locale"))
- goto err_exit;
- ntfs_set_char_encoding(val);
-#if defined(__APPLE__) || defined(__DARWIN__)
-#ifdef ENABLE_NFCONV
- } else if (!strcmp(opt, "nfconv")) {
- if (bogus_option_value(val, "nfconv"))
- goto err_exit;
- if (ntfs_macosx_normalize_filenames(1)) {
- ntfs_log_error("ntfs_macosx_normalize_filenames(1) failed!\n");
- goto err_exit;
- }
- } else if (!strcmp(opt, "nonfconv")) {
- if (bogus_option_value(val, "nonfconv"))
- goto err_exit;
- if (ntfs_macosx_normalize_filenames(0)) {
- ntfs_log_error("ntfs_macosx_normalize_filenames(0) failed!\n");
- goto err_exit;
- }
-#endif /* ENABLE_NFCONV */
-#endif /* defined(__APPLE__) || defined(__DARWIN__) */
- } else if (!strcmp(opt, "streams_interface")) {
- if (missing_option_value(val, "streams_interface"))
- goto err_exit;
- if (!strcmp(val, "none"))
- ctx->streams = NF_STREAMS_INTERFACE_NONE;
- else if (!strcmp(val, "xattr"))
- ctx->streams = NF_STREAMS_INTERFACE_XATTR;
- else if (!strcmp(val, "openxattr"))
- ctx->streams = NF_STREAMS_INTERFACE_OPENXATTR;
- else if (!strcmp(val, "windows"))
- ctx->streams = NF_STREAMS_INTERFACE_WINDOWS;
- else {
- ntfs_log_error("Invalid named data streams "
- "access interface.\n");
- goto err_exit;
- }
- } else if (!strcmp(opt, "user_xattr")) {
- ctx->streams = NF_STREAMS_INTERFACE_XATTR;
- } else if (!strcmp(opt, "noauto")) {
- /* Don't pass noauto option to fuse. */
- } else if (!strcmp(opt, "debug")) {
- if (bogus_option_value(val, "debug"))
- 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, "no_detach")) {
- if (bogus_option_value(val, "no_detach"))
- goto err_exit;
- ctx->no_detach = TRUE;
- } 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 if (!strcmp(opt, "blksize")) {
- ntfs_log_info("WARNING: blksize option is ignored "
- "because ntfs-3g must calculate it.\n");
- } else if (!strcmp(opt, "inherit")) {
- /*
- * JPA do not overwrite inherited permissions
- * in create()
- */
- ctx->inherit = TRUE;
- } else if (!strcmp(opt, "addsecurids")) {
- /*
- * JPA create security ids for files being read
- * with an individual security attribute
- */
- ctx->secure_flags |= (1 << SECURITY_ADDSECURIDS);
- } else if (!strcmp(opt, "staticgrps")) {
- /*
- * JPA use static definition of groups
- * for file access control
- */
- ctx->secure_flags |= (1 << SECURITY_STATICGRPS);
- } else if (!strcmp(opt, "usermapping")) {
- if (!val) {
- ntfs_log_error("'usermapping' option should have "
- "a value.\n");
- goto err_exit;
- }
- ctx->usermap_path = strdup(val);
- if (!ctx->usermap_path) {
- ntfs_log_error("no more memory to store "
- "'usermapping' option.\n");
- goto err_exit;
- }
-#ifdef HAVE_SETXATTR /* extended attributes interface required */
- } else if (!strcmp(opt, "efs_raw")) {
- if (bogus_option_value(val, "efs_raw"))
- goto err_exit;
- ctx->efs_raw = TRUE;
-#endif /* HAVE_SETXATTR */
- } else { /* Probably FUSE option. */
- if (strappend(&ret, opt))
- goto err_exit;
- if (val) {
- if (strappend(&ret, "="))
- goto err_exit;
- if (strappend(&ret, val))
- goto err_exit;
- }
- if (strappend(&ret, ","))
- goto err_exit;
- }
- }
- if (!no_def_opts && strappend(&ret, def_opts))
- goto err_exit;
- if (default_permissions && strappend(&ret, "default_permissions,"))
- goto err_exit;
-
- if (ctx->atime == ATIME_RELATIVE && strappend(&ret, "relatime,"))
- goto err_exit;
- else if (ctx->atime == ATIME_ENABLED && strappend(&ret, "atime,"))
- goto err_exit;
- else if (ctx->atime == ATIME_DISABLED && strappend(&ret, "noatime,"))
- goto err_exit;
-
- if (strappend(&ret, "fsname="))
- goto err_exit;
- if (strappend(&ret, opts.device))
- goto err_exit;
- if (default_permissions)
- ctx->secure_flags |= (1 << SECURITY_DEFAULT);
- if (want_permissions)
- ctx->secure_flags |= (1 << SECURITY_WANTED);
- if (ctx->ro)
- ctx->secure_flags &= ~(1 << SECURITY_ADDSECURIDS);
-exit:
- free(options);
- return ret;
-err_exit:
- free(ret);
- ret = NULL;
- goto exit;
-}
-
static void usage(void)
{
ntfs_log_info(usage_msg, EXEC_NAME, VERSION, FUSE_TYPE, fuse_version(),
@@ -3929,101 +3448,6 @@ static void usage(void)
EXEC_NAME, ntfs_home);
}
-#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
- * Read the command line, verify the syntax and parse the options.
- *
- * Return: 0 success, -1 error.
- */
-static int parse_options(int argc, char *argv[])
-{
- int c;
-
- static const char *sopt = "-o:hvV";
- static const struct option lopt[] = {
- { "options", required_argument, NULL, 'o' },
- { "help", no_argument, NULL, 'h' },
- { "verbose", no_argument, NULL, 'v' },
- { "version", no_argument, NULL, 'V' },
- { NULL, 0, NULL, 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 = ntfs_malloc(PATH_MAX + 1);
- if (!opts.device)
- return -1;
-
- /* Canonicalize device name (mtab, etc) */
- if (!realpath(optarg, opts.device)) {
- ntfs_log_perror("%s: Failed to access "
- "volume '%s'", EXEC_NAME, optarg);
- free(opts.device);
- opts.device = NULL;
- return -1;
- }
- } else if (!opts.mnt_point) {
- opts.mnt_point = optarg;
- } else {
- ntfs_log_error("%s: You must specify exactly one "
- "device and exactly one mount "
- "point.\n", EXEC_NAME);
- return -1;
- }
- break;
- case 'o':
- if (opts.options)
- if (strappend(&opts.options, ","))
- return -1;
- if (strappend(&opts.options, optarg))
- return -1;
- break;
- case 'h':
- usage();
- exit(9);
- case 'v':
- /*
- * We must handle the 'verbose' option even if
- * we don't use it because mount(8) passes it.
- */
- break;
- case 'V':
- ntfs_log_info("%s %s %s %d\n", EXEC_NAME, VERSION,
- FUSE_TYPE, fuse_version());
- exit(0);
- default:
- ntfs_log_error("%s: Unknown option '%s'.\n", EXEC_NAME,
- argv[optind - 1]);
- return -1;
- }
- }
-
- if (!opts.device) {
- ntfs_log_error("%s: No device is specified.\n", EXEC_NAME);
- return -1;
- }
- if (!opts.mnt_point) {
- ntfs_log_error("%s: No mountpoint is specified.\n", EXEC_NAME);
- return -1;
- }
-
- return 0;
-}
-
#if defined(linux) || defined(__uClinux__)
static const char *dev_fuse_msg =
@@ -4040,7 +3464,7 @@ static const char *fuse26_kmod_msg =
" message to disappear then you should upgrade to at least kernel\n"
" version 2.6.20, or request help from your distribution to fix\n"
" the kernel problem. The below web page has more information:\n"
-" http://ntfs-3g.org/support.html#fuse26\n"
+" http://tuxera.com/community/ntfs-3g-faq/#fuse26\n"
"\n";
static void mknod_dev_fuse(const char *dev)
@@ -4169,7 +3593,7 @@ static int set_fuseblk_options(char **parsed_options)
blksize = pagesize;
snprintf(options, sizeof(options), ",blkdev,blksize=%u", blksize);
- if (strappend(parsed_options, options))
+ if (ntfs_strappend(parsed_options, options))
return -1;
return 0;
}
@@ -4230,6 +3654,9 @@ static void setup_logging(char *parsed_options)
ctx->seccache = (struct PERMISSIONS_CACHE*)NULL;
ntfs_log_info("Version %s %s %d\n", VERSION, FUSE_TYPE, fuse_version());
+ if (strcmp(opts.arg_device,opts.device))
+ ntfs_log_info("Requested device %s canonicalized as %s\n",
+ opts.arg_device,opts.device);
ntfs_log_info("Mounted %s (%s, label \"%s\", NTFS %d.%d)\n",
opts.device, (ctx->ro) ? "Read-Only" : "Read-Write",
ctx->vol->vol_name, ctx->vol->major_ver,
@@ -4247,7 +3674,11 @@ int main(int argc, char *argv[])
#endif
const char *permissions_mode = (const char*)NULL;
const char *failed_secure = (const char*)NULL;
+#if defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS)
+ struct XATTRMAPPING *xattr_mapping = (struct XATTRMAPPING*)NULL;
+#endif /* defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS) */
struct stat sbuf;
+ unsigned long existing_mount;
int err, fd;
/*
@@ -4272,7 +3703,7 @@ int main(int argc, char *argv[])
ntfs_set_locale();
ntfs_log_set_handler(ntfs_log_handler_stderr);
- if (parse_options(argc, argv)) {
+ if (ntfs_parse_options(&opts, usage, argc, argv)) {
usage();
return NTFS_VOLUME_SYNTAX_ERROR;
}
@@ -4282,12 +3713,19 @@ int main(int argc, char *argv[])
goto err2;
}
- parsed_options = parse_mount_options(opts.options);
+ parsed_options = parse_mount_options(ctx, &opts, FALSE);
if (!parsed_options) {
err = NTFS_VOLUME_SYNTAX_ERROR;
goto err_out;
}
-
+ if (!ntfs_check_if_mounted(opts.device,&existing_mount)
+ && (existing_mount & NTFS_MF_MOUNTED)
+ /* accept multiple read-only mounts */
+ && (!(existing_mount & NTFS_MF_READONLY) || !ctx->ro)) {
+ err = NTFS_VOLUME_LOCKED;
+ goto err_out;
+ }
+
/* need absolute mount point for junctions */
if (opts.mnt_point[0] == '/')
ctx->abs_mnt_point = strdup(opts.mnt_point);
@@ -4298,6 +3736,10 @@ int main(int argc, char *argv[])
PATH_MAX - strlen(opts.mnt_point) - 1)) {
strcat(ctx->abs_mnt_point, "/");
strcat(ctx->abs_mnt_point, opts.mnt_point);
+#if defined(__sun) && defined (__SVR4)
+ /* Solaris also wants the absolute mount point */
+ opts.mnt_point = ctx->abs_mnt_point;
+#endif /* defined(__sun) && defined (__SVR4) */
}
}
}
@@ -4352,6 +3794,12 @@ int main(int argc, char *argv[])
if (err)
goto err_out;
+ /* Force read-only mount if the device was found read-only */
+ if (!ctx->ro && NVolReadOnly(ctx->vol)) {
+ ctx->ro = TRUE;
+ if (ntfs_strinsert(&parsed_options, ",ro"))
+ goto err_out;
+ }
/* We must do this after ntfs_open() to be able to set the blksize */
if (ctx->blkdev && set_fuseblk_options(&parsed_options))
goto err_out;
@@ -4365,14 +3813,18 @@ int main(int argc, char *argv[])
/* to initialize security data */
if (ntfs_open_secure(ctx->vol) && (ctx->vol->major_ver >= 3))
failed_secure = "Could not open file $Secure";
- if (!ntfs_build_mapping(&ctx->security,ctx->usermap_path)) {
+ if (!ntfs_build_mapping(&ctx->security,ctx->usermap_path,
+ (ctx->vol->secure_flags
+ & ((1 << SECURITY_DEFAULT) | (1 << SECURITY_ACL)))
+ && !(ctx->vol->secure_flags & (1 << SECURITY_WANTED)))) {
#if POSIXACLS
+ /* use basic permissions if requested */
if (ctx->vol->secure_flags & (1 << SECURITY_DEFAULT))
permissions_mode = "User mapping built, Posix ACLs not used";
else {
permissions_mode = "User mapping built, Posix ACLs in use";
#if KERNELACLS
- if (strappend(&parsed_options, ",default_permissions,acl")) {
+ if (ntfs_strinsert(&parsed_options, ",default_permissions,acl")) {
err = NTFS_VOLUME_SYNTAX_ERROR;
goto err_out;
}
@@ -4380,13 +3832,14 @@ int main(int argc, char *argv[])
}
#else /* POSIXACLS */
#if KERNELPERMS
- if (!(ctx->vol->secure_flags & (1 << SECURITY_DEFAULT))) {
+ if (!(ctx->vol->secure_flags
+ & ((1 << SECURITY_DEFAULT) | (1 << SECURITY_ACL)))) {
/*
* No explicit option but user mapping found
* force default security
*/
ctx->vol->secure_flags |= (1 << SECURITY_DEFAULT);
- if (strappend(&parsed_options, ",default_permissions")) {
+ if (ntfs_strinsert(&parsed_options, ",default_permissions")) {
err = NTFS_VOLUME_SYNTAX_ERROR;
goto err_out;
}
@@ -4403,7 +3856,7 @@ int main(int argc, char *argv[])
if ((ctx->vol->secure_flags & (1 << SECURITY_WANTED))
&& !(ctx->vol->secure_flags & (1 << SECURITY_DEFAULT))) {
ctx->vol->secure_flags |= (1 << SECURITY_DEFAULT);
- if (strappend(&parsed_options, ",default_permissions")) {
+ if (ntfs_strinsert(&parsed_options, ",default_permissions")) {
err = NTFS_VOLUME_SYNTAX_ERROR;
goto err_out;
}
@@ -4419,6 +3872,18 @@ int main(int argc, char *argv[])
if (ctx->usermap_path)
free (ctx->usermap_path);
+#if defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS)
+ xattr_mapping = ntfs_xattr_build_mapping(ctx->vol,
+ ctx->xattrmap_path);
+ ctx->vol->xattr_mapping = xattr_mapping;
+ /*
+ * Errors are logged, do not refuse mounting, it would be
+ * too difficult to fix the unmountable mapping file.
+ */
+ if (ctx->xattrmap_path)
+ free(ctx->xattrmap_path);
+#endif /* defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS) */
+
fh = mount_fuse(parsed_options);
if (!fh) {
err = NTFS_VOLUME_FUSE_ERROR;
@@ -4451,6 +3916,9 @@ err_out:
ntfs_mount_error(opts.device, opts.mnt_point, err);
if (ctx->abs_mnt_point)
free(ctx->abs_mnt_point);
+#if defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS)
+ ntfs_xattr_free_mapping(xattr_mapping);
+#endif /* defined(HAVE_SETXATTR) && defined(XATTR_MAPPINGS) */
err2:
ntfs_close();
free(ctx);
@@ -4459,8 +3927,3 @@ err2:
free(opts.device);
return err;
}
-
-void dummy(void)
-{
- raise(0);
-}
diff --git a/src/ntfs-3g.probe.8 b/src/ntfs-3g.probe.8
new file mode 100644
index 0000000..edff7fd
--- a/dev/null
+++ b/src/ntfs-3g.probe.8
@@ -0,0 +1,81 @@
+.\" Copyright (c) 2008 Szabolcs Szakacsits.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH NTFS-3G.PROBE 8 "January 2008" "ntfs-3g.probe 2014.2.15"
+.SH NAME
+ntfs-3g.probe \- Probe an NTFS volume mountability
+.SH SYNOPSIS
+.B ntfs-3g.probe
+.I <\-\-readonly|\-\-readwrite>
+.I volume
+.br
+.SH DESCRIPTION
+The \fBntfs-3g.probe\fR utility tests a volume if it's NTFS mountable
+read-only or read-write, and exits with a status value accordingly.
+The \fIvolume\fR can be a block device or image file.
+.SH OPTIONS
+Below is a summary of the options that \fBntfs-3g.probe\fR accepts.
+.TP
+.B \-r, \-\-readonly
+Test if the volume can be mounted read-only.
+.TP
+.B \-w, \-\-readwrite
+Test if the volume can be mounted read-write.
+.TP
+.B \-h, \-\-help
+Display help and exit.
+.SH EXAMPLE
+Test if /dev/sda1 can be mounted read-write:
+.RS
+.sp
+.B ntfs-3g.probe --readwrite /dev/sda1
+.sp
+.RE
+.SH EXIT CODES
+The exit codes are as follows:
+.IP 0
+Volume is mountable.
+.IP 11
+Syntax error, command line parsing failed.
+.IP 12
+The volume doesn't have a valid NTFS.
+.IP 13
+Inconsistent NTFS, hardware or device driver fault, or unsetup
+SoftRAID/FakeRAID hardware.
+.IP 14
+The NTFS partition is hibernated.
+.IP 15
+The volume was not cleanly unmounted.
+.IP 16
+The volume is already exclusively opened and in use by a kernel
+driver or software.
+.IP 17
+Unsetup SoftRAID/FakeRAID hardware.
+.IP 18
+Unknown reason.
+.IP 19
+Not enough privilege to mount.
+.IP 20
+Out of memory.
+.IP 21
+Unclassified FUSE error.
+.SH KNOWN ISSUES
+Please see
+.RS
+.sp
+http://tuxera.com/community/ntfs-3g-faq/
+.sp
+.RE
+for common questions and known issues.
+If you think you have found an undocumented problem in the latest release of
+the software then please send an email describing it in detail.
+You can contact the development team on the ntfs\-3g\-devel@lists.sf.net
+address.
+.SH AUTHORS
+.B ntfs-3g.probe
+was written by Szabolcs Szakacsits.
+.SH THANKS
+Alon Bar-Lev has integrated the utility into the NTFS-3G build process and
+tested it with Erik Larsson before the public release.
+.SH SEE ALSO
+.BR ntfs-3g (8)
diff --git a/src/ntfs-3g.probe.8.in b/src/ntfs-3g.probe.8.in
index 3e8a267..62ce57e 100755
--- a/src/ntfs-3g.probe.8.in
+++ b/src/ntfs-3g.probe.8.in
@@ -63,7 +63,7 @@ Unclassified FUSE error.
Please see
.RS
.sp
-http://ntfs-3g.org/support.html
+http://tuxera.com/community/ntfs-3g-faq/
.sp
.RE
for common questions and known issues.
@@ -73,7 +73,7 @@ You can contact the development team on the ntfs\-3g\-devel@lists.sf.net
address.
.SH AUTHORS
.B ntfs-3g.probe
-was written by Szabolcs Szakacsits (szaka@ntfs-3g.org).
+was written by Szabolcs Szakacsits.
.SH THANKS
Alon Bar-Lev has integrated the utility into the NTFS-3G build process and
tested it with Erik Larsson before the public release.
diff --git a/src/ntfs-3g.probe.c b/src/ntfs-3g.probe.c
index 592abd7..cb73aee 100755
--- a/src/ntfs-3g.probe.c
+++ b/src/ntfs-3g.probe.c
@@ -68,13 +68,14 @@ static int ntfs_open(const char *device)
int ret = NTFS_VOLUME_OK;
if (opts.probetype == PROBE_READONLY)
- flags |= MS_RDONLY;
+ flags |= NTFS_MNT_RDONLY;
vol = ntfs_mount(device, flags);
if (!vol)
ret = ntfs_volume_error(errno);
- ntfs_umount(vol, FALSE);
+ if (ret == 0 && ntfs_umount(vol, FALSE) == -1)
+ ret = ntfs_volume_error(errno);
return ret;
}
@@ -158,6 +159,8 @@ int main(int argc, char *argv[])
err = ntfs_open(opts.device);
free(opts.device);
- exit(err);
+ if (err)
+ exit(err);
+ return (0);
}
diff --git a/src/ntfs-3g.secaudit.8 b/src/ntfs-3g.secaudit.8
new file mode 100644
index 0000000..669828e
--- a/dev/null
+++ b/src/ntfs-3g.secaudit.8
@@ -0,0 +1,184 @@
+.\" Copyright (c) 2007-2009 Jean-Pierre André.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH NTFS-3G.SECAUDIT 8 "February 2010" "ntfs-3g.secaudit 1.4.1"
+.SH NAME
+ntfs-3g.secaudit \- NTFS Security Data Auditing
+.SH SYNOPSIS
+.B ntfs-3g.secaudit
+\fB[\fIoptions\fP\fB]\fR
+.I args
+.PP
+Where \fIoptions\fP is a combination of :
+.RS
+-a full auditing of security data (Linux only)
+.RE
+.RS
+-b backup ACLs
+.RE
+.RS
+-e setting extra backed-up parameters (in conjunction with -s)
+.RE
+.RS
+-h displaying hexadecimal security descriptors saved in a file
+.RE
+.RS
+-r recursing in a directory
+.RE
+.RS
+-s setting backed-up ACLs
+.RE
+.RS
+-u getting a user mapping proposal
+.RE
+.RS
+-v verbose (very verbose if set twice)
+.RE
+.PP
+and args define the parameters and the set of files acted upon.
+.PP
+Typing secaudit with no args will display a summary of available options.
+.SH DESCRIPTION
+\fBntfs-3g.secaudit\fR
+displays the ownership and permissions of a set of files on an NTFS
+file system, and checks their consistency. It can be started in terminal
+mode only (no graphical user interface is available.)
+.PP
+When a \fIvolume\fR is required, it has to be unmounted, and the command
+has to be issued as \fBroot\fP. The \fIvolume\fR can be either a block
+device (i.e. a disk partition) or an image file.
+.PP
+When acting on a directory or volume, the command may produce a lot
+of information. It is therefore advisable to redirect the output to
+a file or pipe it to a text editor for examination.
+.SH OPTIONS
+Below are the valid combinations of options and arguments that
+\fBntfs-3g.secaudit\fR accepts. All the indicated arguments are
+mandatory and must be unique (if wildcards are used, they must
+resolve to a single name.)
+.TP
+\fB-h\fP \fIfile\fP
+Displays in an human readable form the hexadecimal security descriptors
+saved in \fIfile\fP. This can be used to turn a verbose output into a very
+verbose output.
+.TP
+\fB-a[rv]\fP \fIvolume\fP
+Audits the volume : all the global security data on \fIvolume\fP are scanned
+and errors are displayed. If option \fB-r\fP is present, all files and
+directories are also scanned and their relations to global security data
+are checked. This can produce a lot of data.
+
+This option is not effective on volumes formatted for old NTFS versions (pre
+NTFS 3.0). Such volumes have no global security data.
+
+When errors are signalled, it is advisable to repair the volume with an
+appropriate tool (such as \fBchkdsk\fP on Windows.)
+.TP
+\fB[-v]\fP \fIvolume\fP \fIfile\fP
+Displays the security parameters of \fIfile\fP : its interpreted Linux mode
+(rwx flags in octal) and Posix ACL[1], its security key if any, and its
+security descriptor if verbose output.
+.TP
+\fB-r[v]\fP \fIvolume\fP \fIdirectory\fP
+displays the security parameters of all files and subdirectories in
+\fIdirectory\fP : their interpreted Linux mode (rwx flags in octal) and Posix
+ACL[1], their security key if any, and their security descriptor if
+verbose output.
+.TP
+.B -b[v] \fIvolume\fP \fI[directory]\fP
+Recursively extracts to standard output the NTFS ACLs of files in \fIvolume\fP
+and \fIdirectory\fP.
+.TP
+\fB-s[ev]\fP \fIvolume\fP \fI[backup-file]\fP
+Sets the NTFS ACLS as indicated in \fIbackup-file\fP or standard input. The
+input data must have been created on Linux. With option \fB-e\fP, also sets
+extra parameters (currently Windows attrib).
+.TP
+\fIvolume\fP \fIperms\fP \fIfile\fP
+Sets the security parameters of file to perms. Perms is the Linux
+requested mode (rwx flags, expressed in octal form as in chmod) or
+a Posix ACL[1] (expressed like in setfacl -m). This sets a new ACL
+which is effective for Linux and Windows.
+.TP
+\fB-r[v]\fP \fIvolume\fP \fIperms\fP \fIdirectory\fP
+Sets the security parameters of all files and subdirectories in
+\fIdirectory\fP to \fIperms\fP. Perms is the Linux requested mode (rwx flags,
+expressed in octal form as in \fBchmod\fP), or a Posix ACL[1] (expressed like
+in \fBsetfacl -m\fP.) This sets new ACLs which are effective for Linux and
+Windows.
+.TP
+\fB[-v]\fP \fImounted-file\fP
+Displays the security parameters of \fImounted-file\fP : its interpreted
+Linux mode (rwx flags in octal) and Posix ACL[1], its security key if any,
+and its security descriptor if verbose output. This is a special case which
+acts on a mounted file (or directory) and does not require being root. The
+Posix ACL interpretation can only be displayed if the full path to
+\fImounted-file\fP from the root of the global file tree is provided.
+.TP
+\fB-u[v]\fP \fImounted-file\fP
+Displays a proposed contents for a user mapping file, based on the
+ownership parameters set by Windows on \fImounted-file\fP, assuming
+this file was created on Windows by the user who should be mapped to the
+current Linux user. The displayed information has to be copied to the
+file \fB.NTFS-3G/UserMapping\fP where \fB.NTFS-3G\fP is a hidden
+subdirectory of the root of the partition for which the mapping is to
+be defined. This will cause the ownership of files created on that
+partition to be the same as the original \fImounted-file\fP.
+.SH NOTE
+[1] provided the POSIX ACL option was selected at compile time. A Posix ACL
+specification looks like "\fB[d:]{ugmo}:[id]:[perms],...\fP" where id is a
+numeric user or group id, and perms an octal digit or a set from the letters
+r, w and x.
+.RS
+Example : "\fBu::7,g::5,o:0,u:510:rwx,g:500:5,d:u:510:7\fP"
+.SH EXAMPLES
+Audit the global security data on /dev/sda1
+.RS
+.sp
+.B ntfs-3g.secaudit -ar /dev/sda1
+.sp
+.RE
+Display the ownership and permissions parameters for files in directory
+/audio/music on device /dev/sda5, excluding sub-directories :
+.RS
+.sp
+.B ntfs-3g.secaudit /dev/sda5 /audio/music
+.sp
+.RE
+Set all files in directory /audio/music on device /dev/sda5 as writeable
+by owner and read-only for everybody :
+.RS
+.sp
+.B ntfs-3g.secaudit -r /dev/sda5 644 /audio/music
+.sp
+.RE
+.SH EXIT CODES
+.B ntfs-3g.secaudit
+exits with a value of 0 when no error was detected, and with a value
+of 1 when an error was detected.
+.SH KNOWN ISSUES
+Please see
+.RS
+.sp
+http://www.tuxera.com/community/ntfs-3g-faq/
+.sp
+.RE
+for common questions and known issues.
+If you would find a new one in the latest release of
+the software then please send an email describing it
+in detail. You can contact the
+development team on the ntfs\-3g\-devel@lists.sf.net
+address.
+.SH AUTHORS
+.B ntfs-3g.secaudit
+has been developed by Jean-Pierre André.
+.SH THANKS
+Several people made heroic efforts, often over five or more
+years which resulted the ntfs-3g driver. Most importantly they are
+Anton Altaparmakov, Richard Russon, Szabolcs Szakacsits, Yura Pakhuchiy,
+Yuval Fledel, and the author of the groundbreaking FUSE filesystem development
+framework, Miklos Szeredi.
+.SH SEE ALSO
+.BR ntfsprogs (8),
+.BR attr (5),
+.BR getfattr (1)
diff --git a/src/ntfs-3g.secaudit.8.in b/src/ntfs-3g.secaudit.8.in
index 79c05ac..669828e 100755
--- a/src/ntfs-3g.secaudit.8.in
+++ b/src/ntfs-3g.secaudit.8.in
@@ -1,7 +1,7 @@
.\" Copyright (c) 2007-2009 Jean-Pierre André.
.\" This file may be copied under the terms of the GNU Public License.
.\"
-.TH NTFS-3G.SECAUDIT 8 "February 2010" "ntfs-3g.secaudit 1.3.8"
+.TH NTFS-3G.SECAUDIT 8 "February 2010" "ntfs-3g.secaudit 1.4.1"
.SH NAME
ntfs-3g.secaudit \- NTFS Security Data Auditing
.SH SYNOPSIS
@@ -29,6 +29,9 @@ Where \fIoptions\fP is a combination of :
-s setting backed-up ACLs
.RE
.RS
+-u getting a user mapping proposal
+.RE
+.RS
-v verbose (very verbose if set twice)
.RE
.PP
@@ -111,6 +114,16 @@ and its security descriptor if verbose output. This is a special case which
acts on a mounted file (or directory) and does not require being root. The
Posix ACL interpretation can only be displayed if the full path to
\fImounted-file\fP from the root of the global file tree is provided.
+.TP
+\fB-u[v]\fP \fImounted-file\fP
+Displays a proposed contents for a user mapping file, based on the
+ownership parameters set by Windows on \fImounted-file\fP, assuming
+this file was created on Windows by the user who should be mapped to the
+current Linux user. The displayed information has to be copied to the
+file \fB.NTFS-3G/UserMapping\fP where \fB.NTFS-3G\fP is a hidden
+subdirectory of the root of the partition for which the mapping is to
+be defined. This will cause the ownership of files created on that
+partition to be the same as the original \fImounted-file\fP.
.SH NOTE
[1] provided the POSIX ACL option was selected at compile time. A Posix ACL
specification looks like "\fB[d:]{ugmo}:[id]:[perms],...\fP" where id is a
diff --git a/src/ntfs-3g.usermap.8 b/src/ntfs-3g.usermap.8
new file mode 100644
index 0000000..6efd47b
--- a/dev/null
+++ b/src/ntfs-3g.usermap.8
@@ -0,0 +1,96 @@
+.\" Copyright (c) 2007-2009 Jean-Pierre André.
+.\" This file may be copied under the terms of the GNU Public License.
+.\"
+.TH NTFS-3G.USERMAP 8 "February 2010" "ntfs-3g.usermap 1.1.2"
+.SH NAME
+ntfs-3g.usermap \- NTFS Building a User Mapping File
+.SH SYNOPSIS
+.B ntfs-3g.usermap
+\fIwindows-system-device\fP
+\fB[\fIother-ntfs-device\fP...\fB]\fR
+.PP
+Where \fIwindows-system-device\fP is the device containing the Windows system
+whose users are to be mapped to current Linux system.
+.PP
+And \fIother-ntfs-device\fP is another device containing files which are
+to be accessed both by the Windows mentioned above and current Linux system.
+.PP
+the ntfs-3g.usermap command must be started as root, and the designated devices
+must not be mounted.
+.PP
+Typing ntfs-3g.usermap with no args will display a summary of command
+arguments.
+.SH DESCRIPTION
+\fBntfs-3g.usermap\fR
+creates the file defining the mapping of Windows accounts to Linux logins for
+users who owns files which should be visible from both Windows and
+Linux.
+.PP
+It relies on existing files which were created on Windows, trying
+to locate significant files and asking which Linux user or group should
+own them. When a Linux owner or group is requested, the reply may be :
+.PP
+- the uid or gid (numeric or symbolic) of Linux owner or group of the file.
+.RS
+In that situation, no more file with the same Windows owner will be selected.
+.RE
+- or no answer, when not able to define the owner or group.
+.RS
+In that situation another file owned by the same Windows user or group
+may be selected later so that a mapping can be defined.
+.RE
+.PP
+The mappings for standard Windows users, such as "Administrator" or
+"All Users" are defined implicitly. As a consequence a user mapping should
+never be defined as Linux root.
+.PP
+When there are no more significant files, ntfs-3g.usermap create the
+mapping file into the file UserMapping in the current directory. This
+file has to be moved to the hidden directory .NTFS-3G in the root of
+all the NTFS file systems to be shared between Windows and Linux. This
+requires the file system to be mounted, but the created file will not
+be taken into account if not present at mount time, which means the
+file system has to be unmounted and mounted again for the new mapping
+file to be taken into account.
+.SH OPTIONS
+No option is defined for ntfs-3g.usermap.
+.SH EXAMPLES
+Map the users defined on the Windows system present on /dev/sda1 :
+.RS
+.sp
+.B ntfs-3g.usermap /dev/sda1
+.sp
+.RE
+.PP
+A detailed example, with screen displays is available on
+http://pagesperso-orange.fr/b.andre/usermap.html
+.SH EXIT CODES
+.B ntfs-3g.usermap
+exits with a value of 0 when no error was detected, and with a value
+of 1 when an error was detected.
+.SH KNOWN ISSUES
+Please see
+.RS
+.sp
+http://www.tuxera.com/community/ntfs-3g-faq/
+.sp
+.RE
+for common questions and known issues.
+If you would find a new one in the latest release of
+the software then please send an email describing it
+in detail. You can contact the
+development team on the ntfs\-3g\-devel@lists.sf.net
+address.
+.SH AUTHORS
+.B ntfs-3g.secaudit
+has been developed by Jean-Pierre André.
+.SH THANKS
+Several people made heroic efforts, often over five or more
+years which resulted the ntfs-3g driver. Most importantly they are
+Anton Altaparmakov, Richard Russon, Szabolcs Szakacsits, Yura Pakhuchiy,
+Yuval Fledel, and the author of the groundbreaking FUSE filesystem development
+framework, Miklos Szeredi.
+.SH SEE ALSO
+.BR ntfsprogs (8),
+.BR attr (5),
+.BR getfattr (1)
diff --git a/src/ntfs-3g_common.c b/src/ntfs-3g_common.c
new file mode 100755
index 0000000..ca805d6
--- a/dev/null
+++ b/src/ntfs-3g_common.c
@@ -0,0 +1,745 @@
+/**
+ * ntfs-3g_common.c - Common definitions for ntfs-3g and lowntfs-3g.
+ *
+ * Copyright (c) 2010-2012 Jean-Pierre Andre
+ * Copyright (c) 2010 Erik Larsson
+ *
+ * This program/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 NTFS-3G
+ * 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
+
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
+#ifdef HAVE_STRING_H
+#include <string.h>
+#endif
+
+#ifdef HAVE_LIMITS_H
+#include <limits.h>
+#endif
+
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+
+#include <getopt.h>
+#include <fuse.h>
+
+#include "inode.h"
+#include "security.h"
+#include "xattrs.h"
+#include "ntfs-3g_common.h"
+#include "realpath.h"
+#include "misc.h"
+
+const char xattr_ntfs_3g[] = "ntfs-3g.";
+
+const char nf_ns_user_prefix[] = "user.";
+const int nf_ns_user_prefix_len = sizeof(nf_ns_user_prefix) - 1;
+const char nf_ns_system_prefix[] = "system.";
+const int nf_ns_system_prefix_len = sizeof(nf_ns_system_prefix) - 1;
+const char nf_ns_security_prefix[] = "security.";
+const int nf_ns_security_prefix_len = sizeof(nf_ns_security_prefix) - 1;
+const char nf_ns_trusted_prefix[] = "trusted.";
+const int nf_ns_trusted_prefix_len = sizeof(nf_ns_trusted_prefix) - 1;
+
+static const char nf_ns_alt_xattr_efsinfo[] = "user.ntfs.efsinfo";
+
+static const char def_opts[] = "allow_other,nonempty,";
+
+ /*
+ * Table of recognized options
+ * Their order may be significant
+ * The options invalid in some configuration should still
+ * be present, so that an error can be returned
+ */
+const struct DEFOPTION optionlist[] = {
+ { "ro", OPT_RO, FLGOPT_APPEND | FLGOPT_BOGUS },
+ { "noatime", OPT_NOATIME, FLGOPT_BOGUS },
+ { "atime", OPT_ATIME, FLGOPT_BOGUS },
+ { "relatime", OPT_RELATIME, FLGOPT_BOGUS },
+ { "delay_mtime", OPT_DMTIME, FLGOPT_DECIMAL | FLGOPT_OPTIONAL },
+ { "fake_rw", OPT_FAKE_RW, FLGOPT_BOGUS },
+ { "fsname", OPT_FSNAME, FLGOPT_NOSUPPORT },
+ { "no_def_opts", OPT_NO_DEF_OPTS, FLGOPT_BOGUS },
+ { "default_permissions", OPT_DEFAULT_PERMISSIONS, FLGOPT_BOGUS },
+ { "permissions", OPT_PERMISSIONS, FLGOPT_BOGUS },
+ { "acl", OPT_ACL, FLGOPT_BOGUS },
+ { "umask", OPT_UMASK, FLGOPT_OCTAL },
+ { "fmask", OPT_FMASK, FLGOPT_OCTAL },
+ { "dmask", OPT_DMASK, FLGOPT_OCTAL },
+ { "uid", OPT_UID, FLGOPT_DECIMAL },
+ { "gid", OPT_GID, FLGOPT_DECIMAL },
+ { "show_sys_files", OPT_SHOW_SYS_FILES, FLGOPT_BOGUS },
+ { "hide_hid_files", OPT_HIDE_HID_FILES, FLGOPT_BOGUS },
+ { "hide_dot_files", OPT_HIDE_DOT_FILES, FLGOPT_BOGUS },
+ { "ignore_case", OPT_IGNORE_CASE, FLGOPT_BOGUS },
+ { "windows_names", OPT_WINDOWS_NAMES, FLGOPT_BOGUS },
+ { "compression", OPT_COMPRESSION, FLGOPT_BOGUS },
+ { "nocompression", OPT_NOCOMPRESSION, FLGOPT_BOGUS },
+ { "silent", OPT_SILENT, FLGOPT_BOGUS },
+ { "recover", OPT_RECOVER, FLGOPT_BOGUS },
+ { "norecover", OPT_NORECOVER, FLGOPT_BOGUS },
+ { "remove_hiberfile", OPT_REMOVE_HIBERFILE, FLGOPT_BOGUS },
+ { "sync", OPT_SYNC, FLGOPT_BOGUS | FLGOPT_APPEND },
+ { "big_writes", OPT_BIG_WRITES, FLGOPT_BOGUS },
+ { "locale", OPT_LOCALE, FLGOPT_STRING },
+ { "nfconv", OPT_NFCONV, FLGOPT_BOGUS },
+ { "nonfconv", OPT_NONFCONV, FLGOPT_BOGUS },
+ { "streams_interface", OPT_STREAMS_INTERFACE, FLGOPT_STRING },
+ { "user_xattr", OPT_USER_XATTR, FLGOPT_BOGUS },
+ { "noauto", OPT_NOAUTO, FLGOPT_BOGUS },
+ { "debug", OPT_DEBUG, FLGOPT_BOGUS },
+ { "no_detach", OPT_NO_DETACH, FLGOPT_BOGUS },
+ { "remount", OPT_REMOUNT, FLGOPT_BOGUS },
+ { "blksize", OPT_BLKSIZE, FLGOPT_STRING },
+ { "inherit", OPT_INHERIT, FLGOPT_BOGUS },
+ { "addsecurids", OPT_ADDSECURIDS, FLGOPT_BOGUS },
+ { "staticgrps", OPT_STATICGRPS, FLGOPT_BOGUS },
+ { "usermapping", OPT_USERMAPPING, FLGOPT_STRING },
+ { "xattrmapping", OPT_XATTRMAPPING, FLGOPT_STRING },
+ { "efs_raw", OPT_EFS_RAW, FLGOPT_BOGUS },
+ { (const char*)NULL, 0, 0 } /* end marker */
+} ;
+
+#define STRAPPEND_MAX_INSIZE 8192
+#define strappend_is_large(x) ((x) > STRAPPEND_MAX_INSIZE)
+
+int ntfs_strappend(char **dest, const char *append)
+{
+ char *p;
+ size_t size_append, size_dest = 0;
+
+ if (!dest)
+ return -1;
+ if (!append)
+ return 0;
+
+ size_append = strlen(append);
+ if (*dest)
+ size_dest = strlen(*dest);
+
+ if (strappend_is_large(size_dest) || strappend_is_large(size_append)) {
+ errno = EOVERFLOW;
+ ntfs_log_perror("%s: Too large input buffer", EXEC_NAME);
+ return -1;
+ }
+
+ p = (char*)realloc(*dest, size_dest + size_append + 1);
+ if (!p) {
+ ntfs_log_perror("%s: Memory realloction failed", EXEC_NAME);
+ return -1;
+ }
+
+ *dest = p;
+ strcpy(*dest + size_dest, append);
+
+ return 0;
+}
+
+/*
+ * Insert an option before ",fsname="
+ * This is for keeping "fsname" as the last option, because on
+ * Solaris device names may contain commas.
+ */
+
+int ntfs_strinsert(char **dest, const char *append)
+{
+ char *p, *q;
+ size_t size_append, size_dest = 0;
+
+ if (!dest)
+ return -1;
+ if (!append)
+ return 0;
+
+ size_append = strlen(append);
+ if (*dest)
+ size_dest = strlen(*dest);
+
+ if (strappend_is_large(size_dest) || strappend_is_large(size_append)) {
+ errno = EOVERFLOW;
+ ntfs_log_perror("%s: Too large input buffer", EXEC_NAME);
+ return -1;
+ }
+
+ p = (char*)malloc(size_dest + size_append + 1);
+ if (!p) {
+ ntfs_log_perror("%s: Memory reallocation failed", EXEC_NAME);
+ return -1;
+ }
+ strcpy(p, *dest);
+ q = strstr(p, ",fsname=");
+ if (q) {
+ strcpy(q, append);
+ q = strstr(*dest, ",fsname=");
+ if (q)
+ strcat(p, q);
+ free(*dest);
+ *dest = p;
+ } else {
+ free(*dest);
+ *dest = p;
+ strcpy(*dest + size_dest, append);
+ }
+ return 0;
+}
+
+static int bogus_option_value(char *val, const char *s)
+{
+ if (val) {
+ ntfs_log_error("'%s' option shouldn't have value.\n", s);
+ return -1;
+ }
+ return 0;
+}
+
+static int missing_option_value(char *val, const char *s)
+{
+ if (!val) {
+ ntfs_log_error("'%s' option should have a value.\n", s);
+ return -1;
+ }
+ return 0;
+}
+
+char *parse_mount_options(ntfs_fuse_context_t *ctx,
+ const struct ntfs_options *popts, BOOL low_fuse)
+{
+ char *options, *s, *opt, *val, *ret = NULL;
+ const char *orig_opts = popts->options;
+ BOOL no_def_opts = FALSE;
+ int default_permissions = 0;
+ int permissions = 0;
+ int acl = 0;
+ int want_permissions = 0;
+ int intarg;
+ const struct DEFOPTION *poptl;
+
+ ctx->secure_flags = 0;
+#ifdef HAVE_SETXATTR /* extended attributes interface required */
+ ctx->efs_raw = FALSE;
+#endif /* HAVE_SETXATTR */
+ ctx->compression = DEFAULT_COMPRESSION;
+ options = strdup(orig_opts ? orig_opts : "");
+ if (!options) {
+ ntfs_log_perror("%s: strdup failed", EXEC_NAME);
+ return NULL;
+ }
+
+ s = options;
+ while (s && *s && (val = strsep(&s, ","))) {
+ opt = strsep(&val, "=");
+ poptl = optionlist;
+ while (poptl->name && strcmp(poptl->name,opt))
+ poptl++;
+ if (poptl->name) {
+ if ((poptl->flags & FLGOPT_BOGUS)
+ && bogus_option_value(val, opt))
+ goto err_exit;
+ if ((poptl->flags & FLGOPT_OCTAL)
+ && (!val
+ || !sscanf(val, "%o", &intarg))) {
+ ntfs_log_error("'%s' option needs an octal value\n",
+ opt);
+ goto err_exit;
+ }
+ if (poptl->flags & FLGOPT_DECIMAL) {
+ if ((poptl->flags & FLGOPT_OPTIONAL) && !val)
+ intarg = 0;
+ else
+ if (!val
+ || !sscanf(val, "%i", &intarg)) {
+ ntfs_log_error("'%s' option "
+ "needs a decimal value\n",
+ opt);
+ goto err_exit;
+ }
+ }
+ if ((poptl->flags & FLGOPT_STRING)
+ && missing_option_value(val, opt))
+ goto err_exit;
+
+ switch (poptl->type) {
+ case OPT_RO :
+ case OPT_FAKE_RW :
+ ctx->ro = TRUE;
+ break;
+ case OPT_NOATIME :
+ ctx->atime = ATIME_DISABLED;
+ break;
+ case OPT_ATIME :
+ ctx->atime = ATIME_ENABLED;
+ break;
+ case OPT_RELATIME :
+ ctx->atime = ATIME_RELATIVE;
+ break;
+ case OPT_DMTIME :
+ if (!intarg)
+ intarg = DEFAULT_DMTIME;
+ ctx->dmtime = intarg*10000000LL;
+ break;
+ case OPT_NO_DEF_OPTS :
+ no_def_opts = TRUE; /* Don't add default options. */
+ ctx->silent = FALSE; /* cancel default silent */
+ break;
+ case OPT_DEFAULT_PERMISSIONS :
+ default_permissions = 1;
+ break;
+ case OPT_PERMISSIONS :
+ permissions = 1;
+ break;
+#if POSIXACLS
+ case OPT_ACL :
+ acl = 1;
+ break;
+#endif
+ case OPT_UMASK :
+ ctx->dmask = ctx->fmask = intarg;
+ want_permissions = 1;
+ break;
+ case OPT_FMASK :
+ ctx->fmask = intarg;
+ want_permissions = 1;
+ break;
+ case OPT_DMASK :
+ ctx->dmask = intarg;
+ want_permissions = 1;
+ break;
+ case OPT_UID :
+ ctx->uid = intarg;
+ want_permissions = 1;
+ break;
+ case OPT_GID :
+ ctx->gid = intarg;
+ want_permissions = 1;
+ break;
+ case OPT_SHOW_SYS_FILES :
+ ctx->show_sys_files = TRUE;
+ break;
+ case OPT_HIDE_HID_FILES :
+ ctx->hide_hid_files = TRUE;
+ break;
+ case OPT_HIDE_DOT_FILES :
+ ctx->hide_dot_files = TRUE;
+ break;
+ case OPT_WINDOWS_NAMES :
+ ctx->windows_names = TRUE;
+ break;
+ case OPT_IGNORE_CASE :
+ if (low_fuse)
+ ctx->ignore_case = TRUE;
+ else {
+ ntfs_log_error("'%s' is an unsupported option.\n",
+ poptl->name);
+ goto err_exit;
+ }
+ break;
+ case OPT_COMPRESSION :
+ ctx->compression = TRUE;
+ break;
+ case OPT_NOCOMPRESSION :
+ ctx->compression = FALSE;
+ break;
+ case OPT_SILENT :
+ ctx->silent = TRUE;
+ break;
+ case OPT_RECOVER :
+ ctx->recover = TRUE;
+ break;
+ case OPT_NORECOVER :
+ ctx->recover = FALSE;
+ break;
+ case OPT_REMOVE_HIBERFILE :
+ ctx->hiberfile = TRUE;
+ break;
+ case OPT_SYNC :
+ ctx->sync = TRUE;
+ break;
+#ifdef FUSE_CAP_BIG_WRITES
+ case OPT_BIG_WRITES :
+ ctx->big_writes = TRUE;
+ break;
+#endif
+ case OPT_LOCALE :
+ ntfs_set_char_encoding(val);
+ break;
+#if defined(__APPLE__) || defined(__DARWIN__)
+#ifdef ENABLE_NFCONV
+ case OPT_NFCONV :
+ if (ntfs_macosx_normalize_filenames(1)) {
+ ntfs_log_error("ntfs_macosx_normalize_filenames(1) failed!\n");
+ goto err_exit;
+ }
+ break;
+ case OPT_NONFCONV :
+ if (ntfs_macosx_normalize_filenames(0)) {
+ ntfs_log_error("ntfs_macosx_normalize_filenames(0) failed!\n");
+ goto err_exit;
+ }
+ break;
+#endif /* ENABLE_NFCONV */
+#endif /* defined(__APPLE__) || defined(__DARWIN__) */
+ case OPT_STREAMS_INTERFACE :
+ if (!strcmp(val, "none"))
+ ctx->streams = NF_STREAMS_INTERFACE_NONE;
+ else if (!strcmp(val, "xattr"))
+ ctx->streams = NF_STREAMS_INTERFACE_XATTR;
+ else if (!strcmp(val, "openxattr"))
+ ctx->streams = NF_STREAMS_INTERFACE_OPENXATTR;
+ else if (!low_fuse && !strcmp(val, "windows"))
+ ctx->streams = NF_STREAMS_INTERFACE_WINDOWS;
+ else {
+ ntfs_log_error("Invalid named data streams "
+ "access interface.\n");
+ goto err_exit;
+ }
+ break;
+ case OPT_USER_XATTR :
+ ctx->streams = NF_STREAMS_INTERFACE_XATTR;
+ break;
+ case OPT_NOAUTO :
+ /* Don't pass noauto option to fuse. */
+ break;
+ case OPT_DEBUG :
+ ctx->debug = TRUE;
+ ntfs_log_set_levels(NTFS_LOG_LEVEL_DEBUG);
+ ntfs_log_set_levels(NTFS_LOG_LEVEL_TRACE);
+ break;
+ case OPT_NO_DETACH :
+ ctx->no_detach = TRUE;
+ break;
+ case 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;
+ case OPT_BLKSIZE :
+ ntfs_log_info("WARNING: blksize option is ignored "
+ "because ntfs-3g must calculate it.\n");
+ break;
+ case OPT_INHERIT :
+ /*
+ * do not overwrite inherited permissions
+ * in create()
+ */
+ ctx->inherit = TRUE;
+ break;
+ case OPT_ADDSECURIDS :
+ /*
+ * create security ids for files being read
+ * with an individual security attribute
+ */
+ ctx->secure_flags |= (1 << SECURITY_ADDSECURIDS);
+ break;
+ case OPT_STATICGRPS :
+ /*
+ * use static definition of groups
+ * for file access control
+ */
+ ctx->secure_flags |= (1 << SECURITY_STATICGRPS);
+ break;
+ case OPT_USERMAPPING :
+ ctx->usermap_path = strdup(val);
+ if (!ctx->usermap_path) {
+ ntfs_log_error("no more memory to store "
+ "'usermapping' option.\n");
+ goto err_exit;
+ }
+ break;
+#ifdef HAVE_SETXATTR /* extended attributes interface required */
+#ifdef XATTR_MAPPINGS
+ case OPT_XATTRMAPPING :
+ ctx->xattrmap_path = strdup(val);
+ if (!ctx->xattrmap_path) {
+ ntfs_log_error("no more memory to store "
+ "'xattrmapping' option.\n");
+ goto err_exit;
+ }
+ break;
+#endif /* XATTR_MAPPINGS */
+ case OPT_EFS_RAW :
+ ctx->efs_raw = TRUE;
+ break;
+#endif /* HAVE_SETXATTR */
+ case OPT_FSNAME : /* Filesystem name. */
+ /*
+ * We need this to be able to check whether filesystem
+ * mounted or not.
+ * (falling through to default)
+ */
+ default :
+ ntfs_log_error("'%s' is an unsupported option.\n",
+ poptl->name);
+ goto err_exit;
+ }
+ if ((poptl->flags & FLGOPT_APPEND)
+ && (ntfs_strappend(&ret, poptl->name)
+ || ntfs_strappend(&ret, ",")))
+ goto err_exit;
+ } else { /* Probably FUSE option. */
+ if (ntfs_strappend(&ret, opt))
+ goto err_exit;
+ if (val) {
+ if (ntfs_strappend(&ret, "="))
+ goto err_exit;
+ if (ntfs_strappend(&ret, val))
+ goto err_exit;
+ }
+ if (ntfs_strappend(&ret, ","))
+ goto err_exit;
+ }
+ }
+ if (!no_def_opts && ntfs_strappend(&ret, def_opts))
+ goto err_exit;
+ if ((default_permissions || (permissions && !acl))
+ && ntfs_strappend(&ret, "default_permissions,"))
+ goto err_exit;
+ /* The atime options exclude each other */
+ if (ctx->atime == ATIME_RELATIVE && ntfs_strappend(&ret, "relatime,"))
+ goto err_exit;
+ else if (ctx->atime == ATIME_ENABLED && ntfs_strappend(&ret, "atime,"))
+ goto err_exit;
+ else if (ctx->atime == ATIME_DISABLED && ntfs_strappend(&ret, "noatime,"))
+ goto err_exit;
+
+ if (ntfs_strappend(&ret, "fsname="))
+ goto err_exit;
+ if (ntfs_strappend(&ret, popts->device))
+ goto err_exit;
+ if (permissions && !acl)
+ ctx->secure_flags |= (1 << SECURITY_DEFAULT);
+ if (acl)
+ ctx->secure_flags |= (1 << SECURITY_ACL);
+ if (want_permissions)
+ ctx->secure_flags |= (1 << SECURITY_WANTED);
+ if (ctx->ro)
+ ctx->secure_flags &= ~(1 << SECURITY_ADDSECURIDS);
+exit:
+ free(options);
+ return ret;
+err_exit:
+ free(ret);
+ ret = NULL;
+ goto exit;
+}
+
+/**
+ * parse_options - Read and validate the programs command line
+ * Read the command line, verify the syntax and parse the options.
+ *
+ * Return: 0 success, -1 error.
+ */
+int ntfs_parse_options(struct ntfs_options *popts, void (*usage)(void),
+ int argc, char *argv[])
+{
+ int c;
+
+ static const char *sopt = "-o:hnvV";
+ static const struct option lopt[] = {
+ { "options", required_argument, NULL, 'o' },
+ { "help", no_argument, NULL, 'h' },
+ { "no-mtab", no_argument, NULL, 'n' },
+ { "verbose", no_argument, NULL, 'v' },
+ { "version", no_argument, NULL, 'V' },
+ { NULL, 0, NULL, 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 (!popts->device) {
+ popts->device = ntfs_malloc(PATH_MAX + 1);
+ if (!popts->device)
+ return -1;
+
+ /* Canonicalize device name (mtab, etc) */
+ popts->arg_device = optarg;
+ if (!ntfs_realpath_canonicalize(optarg,
+ popts->device)) {
+ ntfs_log_perror("%s: Failed to access "
+ "volume '%s'", EXEC_NAME, optarg);
+ free(popts->device);
+ popts->device = NULL;
+ return -1;
+ }
+ } else if (!popts->mnt_point) {
+ popts->mnt_point = optarg;
+ } else {
+ ntfs_log_error("%s: You must specify exactly one "
+ "device and exactly one mount "
+ "point.\n", EXEC_NAME);
+ return -1;
+ }
+ break;
+ case 'o':
+ if (popts->options)
+ if (ntfs_strappend(&popts->options, ","))
+ return -1;
+ if (ntfs_strappend(&popts->options, optarg))
+ return -1;
+ break;
+ case 'h':
+ usage();
+ exit(9);
+ case 'n':
+ /*
+ * no effect - automount passes it, meaning 'no-mtab'
+ */
+ break;
+ case 'v':
+ /*
+ * We must handle the 'verbose' option even if
+ * we don't use it because mount(8) passes it.
+ */
+ break;
+ case 'V':
+ ntfs_log_info("%s %s %s %d\n", EXEC_NAME, VERSION,
+ FUSE_TYPE, fuse_version());
+ exit(0);
+ default:
+ ntfs_log_error("%s: Unknown option '%s'.\n", EXEC_NAME,
+ argv[optind - 1]);
+ return -1;
+ }
+ }
+
+ if (!popts->device) {
+ ntfs_log_error("%s: No device is specified.\n", EXEC_NAME);
+ return -1;
+ }
+ if (!popts->mnt_point) {
+ ntfs_log_error("%s: No mountpoint is specified.\n", EXEC_NAME);
+ return -1;
+ }
+
+ return 0;
+}
+
+#ifdef HAVE_SETXATTR
+
+int ntfs_fuse_listxattr_common(ntfs_inode *ni, ntfs_attr_search_ctx *actx,
+ char *list, size_t size, BOOL prefixing)
+{
+ int ret = 0;
+ char *to = list;
+#ifdef XATTR_MAPPINGS
+ BOOL accepted;
+ const struct XATTRMAPPING *item;
+#endif /* XATTR_MAPPINGS */
+
+ /* first list the regular user attributes (ADS) */
+ 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;
+ }
+ /*
+ * When using name spaces, do not return
+ * security, trusted or system attributes
+ * (filtered elsewhere anyway)
+ * otherwise insert "user." prefix
+ */
+ if (prefixing) {
+ if ((strlen(tmp_name) > sizeof(xattr_ntfs_3g))
+ && !strncmp(tmp_name,xattr_ntfs_3g,
+ sizeof(xattr_ntfs_3g)-1))
+ tmp_name_len = 0;
+ else
+ ret += tmp_name_len
+ + nf_ns_user_prefix_len + 1;
+ } else
+ ret += tmp_name_len + 1;
+ if (size && tmp_name_len) {
+ if ((size_t)ret <= size) {
+ if (prefixing) {
+ strcpy(to, nf_ns_user_prefix);
+ to += nf_ns_user_prefix_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);
+ }
+#ifdef XATTR_MAPPINGS
+ /* now append the system attributes mapped to user space */
+ for (item=ni->vol->xattr_mapping; item; item=item->next) {
+ switch (item->xattr) {
+ case XATTR_NTFS_EFSINFO :
+ accepted = ni->vol->efs_raw
+ && (ni->flags & FILE_ATTR_ENCRYPTED);
+ break;
+ case XATTR_NTFS_REPARSE_DATA :
+ accepted = (ni->flags & FILE_ATTR_REPARSE_POINT)
+ != const_cpu_to_le32(0);
+ break;
+// TODO : we are supposed to only return xattrs which are set
+// this is more complex for OBJECT_ID and DOS_NAME
+ default : accepted = TRUE;
+ break;
+ }
+ if (accepted) {
+ ret += strlen(item->name) + 1;
+ if (size) {
+ if ((size_t)ret <= size) {
+ strcpy(to, item->name);
+ to += strlen(item->name);
+ *to++ = 0;
+ } else {
+ ret = -ERANGE;
+ goto exit;
+ }
+ }
+#else /* XATTR_MAPPINGS */
+ /* List efs info xattr for encrypted files */
+ if (ni->vol->efs_raw && (ni->flags & FILE_ATTR_ENCRYPTED)) {
+ ret += sizeof(nf_ns_alt_xattr_efsinfo);
+ if ((size_t)ret <= size) {
+ memcpy(to, nf_ns_alt_xattr_efsinfo,
+ sizeof(nf_ns_alt_xattr_efsinfo));
+ to += sizeof(nf_ns_alt_xattr_efsinfo);
+#endif /* XATTR_MAPPINGS */
+ }
+ }
+exit :
+ return (ret);
+}
+
+#endif /* HAVE_SETXATTR */
diff --git a/src/ntfs-3g_common.h b/src/ntfs-3g_common.h
new file mode 100755
index 0000000..e68c699
--- a/dev/null
+++ b/src/ntfs-3g_common.h
@@ -0,0 +1,185 @@
+/*
+ * ntfs-3g_common.h - Common declarations for ntfs-3g and lowntfs-3g.
+ *
+ * Copyright (c) 2010-2011 Jean-Pierre Andre
+ * Copyright (c) 2010 Erik Larsson
+ *
+ * This program/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 NTFS-3G
+ * 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_3G_COMMON_H
+#define _NTFS_3G_COMMON_H
+
+#include "inode.h"
+
+struct ntfs_options {
+ char *mnt_point; /* Mount point */
+ char *options; /* Mount options */
+ char *device; /* Device to mount */
+ char *arg_device; /* Device requested in argv */
+} ;
+
+typedef enum {
+ NF_STREAMS_INTERFACE_NONE, /* No access to named data streams. */
+ NF_STREAMS_INTERFACE_XATTR, /* Map named data streams to xattrs. */
+ NF_STREAMS_INTERFACE_OPENXATTR, /* Same, not limited to "user." */
+ NF_STREAMS_INTERFACE_WINDOWS, /* "file:stream" interface. */
+} ntfs_fuse_streams_interface;
+
+struct DEFOPTION {
+ const char *name;
+ int type;
+ int flags;
+} ;
+ /* Options, order not significant */
+enum {
+ OPT_RO,
+ OPT_NOATIME,
+ OPT_ATIME,
+ OPT_RELATIME,
+ OPT_DMTIME,
+ OPT_FAKE_RW,
+ OPT_FSNAME,
+ OPT_NO_DEF_OPTS,
+ OPT_DEFAULT_PERMISSIONS,
+ OPT_PERMISSIONS,
+ OPT_ACL,
+ OPT_UMASK,
+ OPT_FMASK,
+ OPT_DMASK,
+ OPT_UID,
+ OPT_GID,
+ OPT_SHOW_SYS_FILES,
+ OPT_HIDE_HID_FILES,
+ OPT_HIDE_DOT_FILES,
+ OPT_IGNORE_CASE,
+ OPT_WINDOWS_NAMES,
+ OPT_COMPRESSION,
+ OPT_NOCOMPRESSION,
+ OPT_SILENT,
+ OPT_RECOVER,
+ OPT_NORECOVER,
+ OPT_REMOVE_HIBERFILE,
+ OPT_SYNC,
+ OPT_BIG_WRITES,
+ OPT_LOCALE,
+ OPT_NFCONV,
+ OPT_NONFCONV,
+ OPT_STREAMS_INTERFACE,
+ OPT_USER_XATTR,
+ OPT_NOAUTO,
+ OPT_DEBUG,
+ OPT_NO_DETACH,
+ OPT_REMOUNT,
+ OPT_BLKSIZE,
+ OPT_INHERIT,
+ OPT_ADDSECURIDS,
+ OPT_STATICGRPS,
+ OPT_USERMAPPING,
+ OPT_XATTRMAPPING,
+ OPT_EFS_RAW,
+} ;
+
+ /* Option flags */
+enum {
+ FLGOPT_BOGUS = 1,
+ FLGOPT_STRING = 2,
+ FLGOPT_OCTAL = 4,
+ FLGOPT_DECIMAL = 8,
+ FLGOPT_APPEND = 16,
+ FLGOPT_NOSUPPORT = 32,
+ FLGOPT_OPTIONAL = 64
+} ;
+
+typedef enum {
+ ATIME_ENABLED,
+ ATIME_DISABLED,
+ ATIME_RELATIVE
+} ntfs_atime_t;
+
+typedef struct {
+ ntfs_volume *vol;
+ unsigned int uid;
+ unsigned int gid;
+ unsigned int fmask;
+ unsigned int dmask;
+ ntfs_fuse_streams_interface streams;
+ ntfs_atime_t atime;
+ u64 dmtime;
+ BOOL ro;
+ BOOL show_sys_files;
+ BOOL hide_hid_files;
+ BOOL hide_dot_files;
+ BOOL windows_names;
+ BOOL ignore_case;
+ BOOL compression;
+ BOOL acl;
+ BOOL silent;
+ BOOL recover;
+ BOOL hiberfile;
+ BOOL sync;
+ BOOL big_writes;
+ BOOL debug;
+ BOOL no_detach;
+ BOOL blkdev;
+ BOOL mounted;
+#ifdef HAVE_SETXATTR /* extended attributes interface required */
+ BOOL efs_raw;
+#ifdef XATTR_MAPPINGS
+ char *xattrmap_path;
+#endif /* XATTR_MAPPINGS */
+#endif /* HAVE_SETXATTR */
+ struct fuse_chan *fc;
+ BOOL inherit;
+ unsigned int secure_flags;
+ char *usermap_path;
+ char *abs_mnt_point;
+ struct PERMISSIONS_CACHE *seccache;
+ struct SECURITY_CONTEXT security;
+ struct open_file *open_files; /* only defined in lowntfs-3g */
+ u64 latest_ghost;
+} ntfs_fuse_context_t;
+
+extern const char *EXEC_NAME;
+
+#ifdef FUSE_INTERNAL
+#define FUSE_TYPE "integrated FUSE"
+#else
+#define FUSE_TYPE "external FUSE"
+#endif
+
+extern const char xattr_ntfs_3g[];
+
+extern const char nf_ns_user_prefix[];
+extern const int nf_ns_user_prefix_len;
+extern const char nf_ns_system_prefix[];
+extern const int nf_ns_system_prefix_len;
+extern const char nf_ns_security_prefix[];
+extern const int nf_ns_security_prefix_len;
+extern const char nf_ns_trusted_prefix[];
+extern const int nf_ns_trusted_prefix_len;
+
+int ntfs_strappend(char **dest, const char *append);
+int ntfs_strinsert(char **dest, const char *append);
+char *parse_mount_options(ntfs_fuse_context_t *ctx,
+ const struct ntfs_options *popts, BOOL low_fuse);
+int ntfs_parse_options(struct ntfs_options *popts, void (*usage)(void),
+ int argc, char *argv[]);
+
+int ntfs_fuse_listxattr_common(ntfs_inode *ni, ntfs_attr_search_ctx *actx,
+ char *list, size_t size, BOOL prefixing);
+
+#endif /* _NTFS_3G_COMMON_H */
diff --git a/src/secaudit.c b/src/secaudit.c
index 3e098d5..ca2264f 100755
--- a/src/secaudit.c
+++ b/src/secaudit.c
@@ -1,7 +1,7 @@
/*
* Display and audit security attributes in an NTFS volume
*
- * Copyright (c) 2007-2010 Jean-Pierre Andre
+ * Copyright (c) 2007-2013 Jean-Pierre Andre
*
* Options :
* -a auditing security data
@@ -10,6 +10,7 @@
* -h displaying hexadecimal security descriptors within a file
* -r recursing in a directory
* -s setting backed-up NTFS ACLs
+ * -u getting a user mapping proposal
* -v verbose (very verbose if set twice)
* also, if compile-time option is set
* -t run internal tests (with no access to storage)
@@ -173,7 +174,38 @@
* - repeated the fix for return code of dorestore()
*
* Mar 2010, version 1.3.17
+ * - adapted to new default user mapping
* - fixed #ifdef'd code for selftest
+ *
+ * May 2010, version 1.3.18
+ * - redefined early error logging
+ *
+ * Mar 2011, version 1.3.19
+ * - fixed interface to ntfs_initialize_file_security()
+ *
+ * Apr 2011, version 1.3.20
+ * - fixed false memory leak detection
+ *
+ * Jun 2011, version 1.3.21
+ * - cleaned a few unneeded variables
+ *
+ * Nov 2011, version 1.3.22
+ * - added a distinctive prefix to owner and group SID
+ * - fixed a false memory leak detection
+ *
+ * Jun 2012, version 1.3.23
+ * - added support for SACL (nickgarvey)
+ *
+ * Jul 2012, version 1.3.24
+ * - added self-tests for authenticated users
+ * - added display of ace-inherited flag
+ * - made runnable on OpenIndiana
+ *
+ * Aug 2012, version 1.4.0
+ * - added an option for user mapping proposal
+ *
+ * Sep 2013, version 1.4.1
+ * - silenced an aliasing warning by gcc >= 4.8
*/
/*
@@ -197,7 +229,7 @@
* General parameters which may have to be adapted to needs
*/
-#define AUDT_VERSION "1.3.17"
+#define AUDT_VERSION "1.4.1"
#define GET_FILE_SECURITY "ntfs_get_file_security"
#define SET_FILE_SECURITY "ntfs_set_file_security"
@@ -222,10 +254,7 @@
#include <time.h>
#include <string.h>
#include <stdlib.h>
-#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
-#endif
-
#include <fcntl.h>
#include <errno.h>
#include <stdarg.h>
@@ -278,7 +307,7 @@
#ifndef STSC
-#if !defined(HAVE_CONFIG_H) && POSIXACLS
+#if !defined(HAVE_CONFIG_H) && POSIXACLS && !defined(__SVR4)
/* require <sys/xattr.h> if not integrated into ntfs-3g package */
#define HAVE_SETXATTR 1
#endif
@@ -305,8 +334,8 @@
#endif /* STSC */
-#define MS_NONE 0 /* no flag for mounting the device */
-#define MS_RDONLY 1 /* flag for mounting the device read-only */
+#define NTFS_MNT_NONE 0 /* no flag for mounting the device */
+#define NTFS_MNT_RDONLY 1 /* flag for mounting the device read-only */
struct CALLBACK;
@@ -314,6 +343,11 @@ typedef int (*dircallback)(struct CALLBACK *context, char *ntfsname,
int length, int type, long long pos, u64 mft_ref,
unsigned int dt_type);
+#ifndef HAVE_SYSLOG_H
+void ntfs_log_early_error(const char *format, ...)
+ __attribute__((format(printf, 1, 2)));
+#endif
+
#if USESTUBS | defined(STSC)
int ntfs_get_file_security(void *scapi,
@@ -337,7 +371,7 @@ int ntfs_get_gsid(void *scapi, gid_t gid, char *buf);
int ntfs_get_user(void *scapi, const char *usid);
int ntfs_get_group(void *scapi, const char *gsid);
-void *ntfs_initialize_file_security(const char *device, int flags);
+void *ntfs_initialize_file_security(const char *device, unsigned long flags);
BOOL ntfs_leave_file_security(void *scapi);
#else
@@ -363,7 +397,8 @@ typedef int (*type_get_gsid)(void *scapi, gid_t gid, char *buf);
typedef int (*type_get_user)(void *scapi, const char *usid);
typedef int (*type_get_group)(void *scapi, const char *gsid);
-typedef void *(*type_initialize_file_security)(const char *device, int flags);
+typedef void *(*type_initialize_file_security)(const char *device,
+ unsigned long flags);
typedef BOOL (*type_leave_file_security)(void *scapi);
type_get_file_security ntfs_get_file_security;
@@ -394,7 +429,7 @@ type_leave_file_security ntfs_leave_file_security;
BOOL open_security_api(void);
BOOL close_security_api(void);
#ifndef WIN32
-BOOL open_volume(const char*, int flags);
+BOOL open_volume(const char*, unsigned long flags);
BOOL close_volume(const char*);
#endif
unsigned int get2l(const char*, int);
@@ -414,7 +449,7 @@ unsigned int utf16len(const char*);
void printname(FILE*, const char*);
void printerror(FILE*);
BOOL guess_dir(const char*);
-void showsid(const char*, int, int);
+void showsid(const char*, int, const char*, int);
void showusid(const char*, int);
void showgsid(const char*, int);
void showheader(const char*, int);
@@ -450,7 +485,9 @@ unsigned int getfull(char*, const char*);
BOOL updatefull(const char *name, DWORD flags, char *attr);
BOOL setfull(const char*, int, BOOL);
BOOL singleshow(const char*);
-void showmounted(const char*);
+BOOL proposal(const char*, const char*);
+BOOL showmounted(const char*);
+BOOL processmounted(const char*);
BOOL recurseshow(const char*);
BOOL singleset(const char*, int);
BOOL recurseset(const char*, int);
@@ -465,6 +502,7 @@ BOOL iterate(RECURSE, const char*, mode_t);
#else
BOOL backup(const char*, const char*);
BOOL listfiles(const char*, const char*);
+BOOL mapproposal(const char*, const char*);
#endif
#if POSIXACLS
BOOL setfull_posix(const char *, const struct POSIX_SECURITY*, BOOL);
@@ -473,6 +511,7 @@ BOOL recurseset_posix(const char*, const struct POSIX_SECURITY*);
BOOL singleset_posix(const char*, const struct POSIX_SECURITY*);
struct POSIX_SECURITY *encode_posix_acl(const char*);
#endif
+static void *stdmalloc(size_t);
static void stdfree(void*);
BOOL valid_sds(const char*, unsigned int, unsigned int,
@@ -545,8 +584,21 @@ static const char worldsidbytes[] = {
} ;
static const SID *worldsid = (const SID*)worldsidbytes;
+/*
+ * SID for authenticated user (S-1-5-11)
+ */
+
+static const char authsidbytes[] = {
+ 1, /* revision */
+ 1, /* auth count */
+ 0, 0, 0, 0, 0, 5, /* base */
+ 11, 0, 0, 0 /* 1st level */
+};
+
+static const SID *authsid = (const SID*)authsidbytes;
+
/*
- * SID for administrator
+ * SID for administrator (S-1-5-32-544)
*/
static const char adminsidbytes[] = {
@@ -559,8 +611,22 @@ static const char adminsidbytes[] = {
static const SID *adminsid = (const SID*)adminsidbytes;
+/*
+ * SID for local users (S-1-5-32-545)
+ */
+
+static const char localsidbytes[] = {
+ 1, /* revision */
+ 2, /* auth count */
+ 0, 0, 0, 0, 0, 5, /* base */
+ 32, 0, 0, 0, /* 1st level */
+ 33, 2, 0, 0 /* 2nd level */
+};
+
+static const SID *localsid = (const SID*)localsidbytes;
+
/*
- * SID for system
+ * SID for system (S-1-5-18)
*/
static const char systemsidbytes[] = {
@@ -584,6 +650,7 @@ BOOL opt_e; /* restore extra (currently windows attribs) */
BOOL opt_h; /* display an hexadecimal descriptor in a file */
BOOL opt_r; /* recursively apply to subdirectories */
BOOL opt_s; /* restore NTFS ACLs */
+BOOL opt_u; /* user mapping proposal */
#if SELFTESTS & !USESTUBS
BOOL opt_t; /* run self-tests */
#endif
@@ -626,7 +693,12 @@ BOOL open_security_api(void)
libfile = getenv(ENVNTFS3G);
if (!libfile)
libfile = (sizeof(char*) == 8 ? LIBFILE64 : LIBFILE);
+#ifdef __SVR4
+ /* do not override library functions by caller ones */
+ ntfs_handle = dlopen(libfile,RTLD_LAZY | RTLD_GROUP);
+#else
ntfs_handle = dlopen(libfile,RTLD_LAZY);
+#endif
if (ntfs_handle) {
ntfs_initialize_file_security = (type_initialize_file_security)
dlsym(ntfs_handle,INIT_FILE_SECURITY);
@@ -701,13 +773,13 @@ BOOL close_security_api(void)
* Assumes a single volume is opened
*/
-BOOL open_volume(const char *volume, int flags)
+BOOL open_volume(const char *volume, unsigned long flags)
{
BOOL ok;
ok = FALSE;
if (!ntfs_context) {
- ntfs_context = (*ntfs_initialize_file_security)(volume,flags);
+ ntfs_context = ntfs_initialize_file_security(volume,flags);
if (ntfs_context) {
if (*(u32*)ntfs_context != MAGIC_API) {
fprintf(stderr,"Versions of ntfs-3g and secaudit"
@@ -730,7 +802,7 @@ BOOL close_volume(const char *volume)
{
BOOL r;
- r = (*ntfs_leave_file_security)(ntfs_context);
+ r = ntfs_leave_file_security(ntfs_context);
if (r)
fprintf(stderr,"\"%s\" closed\n",volume);
else
@@ -1273,6 +1345,23 @@ void printerror(FILE *file)
#endif
}
+#ifndef HAVE_SYSLOG_H
+
+/*
+ * Redefine early error messages in stand-alone situations
+ */
+
+void ntfs_log_early_error(const char *format, ...)
+{
+ va_list args;
+
+ va_start(args, format);
+ vfprintf(stderr,format,args);
+ va_end(args);
+}
+
+#endif
+
/*
* Guess whether a security attribute is intended for a directory
* based on the presence of inheritable ACE
@@ -1306,7 +1395,7 @@ BOOL guess_dir(const char *attr)
* See http://msdn2.microsoft.com/en-us/library/aa379649.aspx
*/
-void showsid(const char *attr, int off, int level)
+void showsid(const char *attr, int off, const char *prefix, int level)
{
int cnt;
int i;
@@ -1433,12 +1522,12 @@ void showsid(const char *attr, int off, int level)
}
if (!known)
printf("%*cUnknown SID\n",-level,marker);
- printf("%*chex S-%d-",-level,marker,attr[off] & 255);
+ printf("%*c%shex S-%d-",-level,marker,prefix,attr[off] & 255);
printf("%llx",auth);
for (i=0; i<cnt; i++)
printf("-%lx",get4l(attr,off+8+4*i));
printf("\n");
- printf("%*cdec S-%d-",-level,marker,attr[off] & 255);
+ printf("%*c%sdec S-%d-",-level,marker,prefix,attr[off] & 255);
printf("%llu",auth);
for (i=0; i<cnt; i++)
printf("-%lu",get4l(attr,off+8+4*i));
@@ -1456,9 +1545,9 @@ void showusid(const char *attr, int level)
marker = ' ';
if (level)
printf("%*c",-level,marker);
- printf("User SID\n");
+ printf("Owner SID\n");
off = get4l(attr,4);
- showsid(attr,off,level+4);
+ showsid(attr,off,"O:",level+4);
}
void showgsid(const char *attr, int level)
@@ -1474,7 +1563,7 @@ void showgsid(const char *attr, int level)
printf("%*c",-level,marker);
printf("Group SID\n");
off = get4l(attr,8);
- showsid(attr,off,level+4);
+ showsid(attr,off,"G:",level+4);
}
void showheader(const char *attr, int level)
@@ -1562,6 +1651,8 @@ void showace(const char *attr, int off, int isdir, int level)
printf("%*cDon\'t propagate inherits ACE\n",-level-4,marker);
if (flags & 8)
printf("%*cInherit only ACE\n",-level-4,marker);
+ if (flags & 0x10)
+ printf("%*cACE was inherited\n",-level-4,marker);
if (flags & 0x40)
printf("%*cAudit on success\n",-level-4,marker);
if (flags & 0x80)
@@ -1634,7 +1725,7 @@ void showace(const char *attr, int off, int isdir, int level)
printf("%*cGeneric read\n",-level-4,marker);
printf("%*cSID at 0x%x\n",-level,marker,off+8);
- showsid(attr,off+8,level+4);
+ showsid(attr,off+8,"",level+4);
printf("%*cSummary :",-level,marker);
if (attr[off] == 0)
printf(" grant");
@@ -1994,14 +2085,15 @@ int linux_permissions(const char *attr, BOOL isdir)
uid_t linux_owner(const char *attr)
{
- const SECURITY_DESCRIPTOR_RELATIVE *phead;
const SID *usid;
uid_t uid;
- phead = (const SECURITY_DESCRIPTOR_RELATIVE*)attr;
#if OWNERFROMACL
usid = ntfs_acl_owner((const char*)attr);
#else
+ const SECURITY_DESCRIPTOR_RELATIVE *phead;
+
+ phead = (const SECURITY_DESCRIPTOR_RELATIVE*)attr;
usid = (const SID*)&attr[le32_to_cpu(phead->owner)];
#endif
#if defined(WIN32) | defined(STSC)
@@ -2105,6 +2197,56 @@ int dummyread(void *fileid __attribute__((unused)),
#endif /* POSIXACLS & SELFTESTS & !USESTUBS */
/*
+ * Apply default single user mapping
+ * returns zero if successful
+ */
+
+static int do_default_mapping(struct MAPPING *mapping[],
+ const SID *usid)
+{
+ struct MAPPING *usermapping;
+ struct MAPPING *groupmapping;
+ SID *sid;
+ int sidsz;
+ int res;
+
+ res = -1;
+ sidsz = ntfs_sid_size(usid);
+#if USESTUBS
+ sid = (SID*)stdmalloc(sidsz); /* will be freed within the library */
+#else
+ sid = (SID*)ntfs_malloc(sidsz);
+#endif
+ if (sid) {
+ memcpy(sid,usid,sidsz);
+#if USESTUBS
+ usermapping = (struct MAPPING*)stdmalloc(sizeof(struct MAPPING));
+#else
+ usermapping = (struct MAPPING*)ntfs_malloc(sizeof(struct MAPPING));
+#endif
+ if (usermapping) {
+#if USESTUBS
+ groupmapping = (struct MAPPING*)stdmalloc(sizeof(struct MAPPING));
+#else
+ groupmapping = (struct MAPPING*)ntfs_malloc(sizeof(struct MAPPING));
+#endif
+ if (groupmapping) {
+ usermapping->sid = sid;
+ usermapping->xid = 0;
+ usermapping->next = (struct MAPPING*)NULL;
+ groupmapping->sid = sid;
+ groupmapping->xid = 0;
+ groupmapping->next = (struct MAPPING*)NULL;
+ mapping[MAPUSERS] = usermapping;
+ mapping[MAPGROUPS] = groupmapping;
+ res = 0;
+ }
+ }
+ }
+ return (res);
+}
+
+/*
* Build the user mapping
* - according to a mapping file if defined (or default present),
* - or try default single user mapping if possible
@@ -2120,6 +2262,7 @@ int local_build_mapping(struct MAPPING *mapping[], const char *usermap_path)
{
#ifdef WIN32
char mapfile[sizeof(MAPDIR) + sizeof(MAPFILE) + 6];
+ char currpath[261];
#else
char *mapfile;
char *p;
@@ -2129,6 +2272,22 @@ int local_build_mapping(struct MAPPING *mapping[], const char *usermap_path)
struct MAPLIST *firstitem = (struct MAPLIST*)NULL;
struct MAPPING *usermapping;
struct MAPPING *groupmapping;
+ static struct {
+ u8 revision;
+ u8 levels;
+ be16 highbase;
+ be32 lowbase;
+ le32 level1;
+ le32 level2;
+ le32 level3;
+ le32 level4;
+ le32 level5;
+ } defmap = {
+ 1, 5, const_cpu_to_be16(0), const_cpu_to_be32(5),
+ const_cpu_to_le32(21),
+ const_cpu_to_le32(DEFSECAUTH1), const_cpu_to_le32(DEFSECAUTH2),
+ const_cpu_to_le32(DEFSECAUTH3), const_cpu_to_le32(DEFSECBASE)
+ } ;
/* be sure not to map anything until done */
mapping[MAPUSERS] = (struct MAPPING*)NULL;
@@ -2140,8 +2299,10 @@ int local_build_mapping(struct MAPPING *mapping[], const char *usermap_path)
strcpy(mapfile,"x:\\" MAPDIR "\\" MAPFILE);
if (((le16*)usermap_path)[1] == ':')
mapfile[0] = usermap_path[0];
- else
- mapfile[0] = getdrive() + 'A' - 1;
+ else {
+ GetModuleFileName(NULL, currpath, 261);
+ mapfile[0] = currpath[0];
+ }
fd = open(mapfile,O_RDONLY);
#else
fd = 0;
@@ -2204,6 +2365,8 @@ int local_build_mapping(struct MAPPING *mapping[], const char *usermap_path)
#endif
firstitem = item;
}
+ } else {
+ do_default_mapping(mapping,(const SID*)&defmap);
}
if (mapping[MAPUSERS])
mappingtype = MAPLOCAL;
@@ -2314,17 +2477,16 @@ void showhex(FILE *fd)
int lth;
int first;
unsigned int pos;
- unsigned char b;
u32 v;
int c;
int isdir;
int mode;
unsigned int off;
int i;
+ le32 *pattr;
BOOL isdump;
BOOL done;
- b = 0;
pos = 0;
off = 0;
done = FALSE;
@@ -2381,8 +2543,9 @@ void showhex(FILE *fd)
/* decode it into attribute */
if (isdump && (off == pos)) {
for (i=first+8; i<lth; i+=9) {
+ pattr = (le32*)&attr[pos];
v = getlsbhex(&line[i]);
- *(le32*)&attr[pos] = cpu_to_le32(v);
+ *pattr = cpu_to_le32(v);
pos += 4;
}
}
@@ -2405,7 +2568,6 @@ void showhex(FILE *fd)
BOOL applyattr(const char *fullname, const char *attr,
BOOL withattr, int attrib, s32 key)
{
- const SECURITY_DESCRIPTOR_RELATIVE *phead;
struct SECURITY_DATA *psecurdata;
const char *curattr;
char *newattr;
@@ -2413,6 +2575,10 @@ BOOL applyattr(const char *fullname, const char *attr,
BOOL bad;
BOOL badattrib;
BOOL err;
+#ifdef WIN32
+ HANDLE htoken;
+ TOKEN_PRIVILEGES tkp;
+#endif
err = FALSE;
psecurdata = (struct SECURITY_DATA*)NULL;
@@ -2463,28 +2629,43 @@ BOOL applyattr(const char *fullname, const char *attr,
if (curattr) {
- phead = (const SECURITY_DESCRIPTOR_RELATIVE*)curattr;
#ifdef WIN32
- /* SACL currently not set, need some special privilege */
selection = OWNER_SECURITY_INFORMATION
| GROUP_SECURITY_INFORMATION
| DACL_SECURITY_INFORMATION;
+ if (OpenProcessToken(GetCurrentProcess(),
+ TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &htoken)) {
+ if (LookupPrivilegeValue(NULL, SE_SECURITY_NAME,
+ &tkp.Privileges[0].Luid)) {
+ tkp.PrivilegeCount = 1;
+ tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+ if (AdjustTokenPrivileges(htoken, FALSE, &tkp, 0, NULL, 0)) {
+ selection |= SACL_SECURITY_INFORMATION;
+ }
+ }
+ }
bad = !SetFileSecurityW((LPCWSTR)fullname,
selection, (char*)curattr);
if (bad)
switch (GetLastError()) {
case 1307 :
case 1314 :
- printf("** Could not set owner of ");
+ printf("** Could not set owner or SACL of ");
printname(stdout,fullname);
- printf(", retrying with no owner setting\n");
+ printf(", retrying with no owner or SACL setting\n");
warnings++;
bad = !SetFileSecurityW((LPCWSTR)fullname,
- selection & ~OWNER_SECURITY_INFORMATION, (char*)curattr);
+ selection & ~OWNER_SECURITY_INFORMATION
+ & ~SACL_SECURITY_INFORMATION, (char*)curattr);
break;
default :
break;
}
+ /* Release privileges once we are done*/
+ if (selection ^ SACL_SECURITY_INFORMATION) {
+ tkp.Privileges[0].Attributes = 0;
+ AdjustTokenPrivileges(htoken, FALSE, &tkp, 0, NULL, 0);
+ }
#else
selection = OWNER_SECURITY_INFORMATION
| GROUP_SECURITY_INFORMATION
@@ -2531,8 +2712,6 @@ BOOL restore(FILE *fd)
int lth;
int first;
unsigned int pos;
- unsigned int size;
- unsigned char b;
int c;
int isdir;
int mode;
@@ -2544,12 +2723,11 @@ BOOL restore(FILE *fd)
int i;
int count;
int attrib;
+ le32 *pattr;
BOOL withattr;
BOOL done;
- b = 0;
pos = 0;
- size = 0;
off = 0;
done = FALSE;
withattr = FALSE;
@@ -2594,7 +2772,6 @@ BOOL restore(FILE *fd)
mode = linux_permissions(attr,isdir);
printf("Interpreted Unix mode 0%03o\n",mode);
}
- size = pos;
pos = 0;
}
if (isdump && !off)
@@ -2603,8 +2780,9 @@ BOOL restore(FILE *fd)
/* decode it into attribute */
if (isdump && (off == pos)) {
for (i=first+8; i<lth; i+=9) {
+ pattr = (le32*)&attr[pos];
v = getlsbhex(&line[i]);
- *(le32*)&attr[pos] = cpu_to_le32(v);
+ *pattr = cpu_to_le32(v);
pos += 4;
}
}
@@ -2698,7 +2876,7 @@ BOOL dorestore(const char *volume, FILE *fd)
err = FALSE;
if (!getuid()) {
if (open_security_api()) {
- if (open_volume(volume,MS_NONE)) {
+ if (open_volume(volume,NTFS_MNT_NONE)) {
if (restore(fd)) err = TRUE;
close_volume(volume);
} else {
@@ -2787,14 +2965,14 @@ void tryposix(struct POSIX_SECURITY *pxdesc)
le32 owner_sid[] = /* S-1-5-21-3141592653-589793238-462843383-1016 */
{
cpu_to_le32(0x501), cpu_to_le32(0x05000000), cpu_to_le32(21),
- cpu_to_le32(AUTH1), cpu_to_le32(AUTH2),
- cpu_to_le32(AUTH3), cpu_to_le32(1016)
+ cpu_to_le32(DEFSECAUTH1), cpu_to_le32(DEFSECAUTH2),
+ cpu_to_le32(DEFSECAUTH3), cpu_to_le32(1016)
} ;
le32 group_sid[] = /* S-1-5-21-3141592653-589793238-462843383-513 */
{
cpu_to_le32(0x501), cpu_to_le32(0x05000000), cpu_to_le32(21),
- cpu_to_le32(AUTH1), cpu_to_le32(AUTH2),
- cpu_to_le32(AUTH3), cpu_to_le32(513)
+ cpu_to_le32(DEFSECAUTH1), cpu_to_le32(DEFSECAUTH2),
+ cpu_to_le32(DEFSECAUTH3), cpu_to_le32(513)
} ;
char *attr;
@@ -3042,14 +3220,14 @@ void check_samples()
le32 owner3[] = /* S-1-5-21-3141592653-589793238-462843383-1016 */
{
cpu_to_le32(0x501), cpu_to_le32(0x05000000), cpu_to_le32(21),
- cpu_to_le32(AUTH1), cpu_to_le32(AUTH2),
- cpu_to_le32(AUTH3), cpu_to_le32(1016)
+ cpu_to_le32(DEFSECAUTH1), cpu_to_le32(DEFSECAUTH2),
+ cpu_to_le32(DEFSECAUTH3), cpu_to_le32(1016)
} ;
le32 group3[] = /* S-1-5-21-3141592653-589793238-462843383-513 */
{
cpu_to_le32(0x501), cpu_to_le32(0x05000000), cpu_to_le32(21),
- cpu_to_le32(AUTH1), cpu_to_le32(AUTH2),
- cpu_to_le32(AUTH3), cpu_to_le32(513)
+ cpu_to_le32(DEFSECAUTH1), cpu_to_le32(DEFSECAUTH2),
+ cpu_to_le32(DEFSECAUTH3), cpu_to_le32(513)
} ;
#if POSIXACLS
@@ -3251,7 +3429,7 @@ void check_samples()
* which cannot be generated by Linux
*/
- for (cnt=1; cnt<=8; cnt++) {
+ for (cnt=1; cnt<=10; cnt++) {
switch(cnt) {
case 1 : /* hp/tmp */
isdir = TRUE;
@@ -3349,6 +3527,32 @@ void check_samples()
expectacc = expect = 0700;
expectdef = 0700;
break;
+ case 9 : /* Win8/bin */
+ isdir = TRUE;
+ descr = build_dummy_descr(isdir,
+ (const SID*)owner3, (const SID*)owner3,
+ 6,
+ (int)TRUE, authsid, (int)0x3, (u32)0x1f01ff,
+ (int)TRUE, adminsid, (int)0x13, (u32)0x1f01ff,
+ (int)TRUE, systemsid, (int)0x13, (u32)0x1f01ff,
+ (int)TRUE, localsid, (int)0x13, (u32)0x1200a9,
+ (int)TRUE, authsid, (int)0x10, (u32)0x1301bf,
+ (int)TRUE, authsid, (int)0x1b, (u32)0xe0010000);
+ expectacc = expect = 0777;
+ expectdef = 0777;
+ break;
+ case 10 : /* Win8/bin/linem.exe */
+ isdir = FALSE;
+ descr = build_dummy_descr(isdir,
+ (const SID*)owner3, (const SID*)owner3,
+ 4,
+ (int)TRUE, authsid, (int)0x10, (u32)0x1f01ff,
+ (int)TRUE, adminsid, (int)0x10, (u32)0x1f01ff,
+ (int)TRUE, systemsid, (int)0x10, (u32)0x1ff,
+ (int)TRUE, localsid, (int)0x10, (u32)0x1200a9);
+ expectacc = expect = 0777;
+ expectdef = 0;
+ break;
default :
expectacc = expectdef = 0;
break;
@@ -3858,14 +4062,14 @@ void selftests(void)
le32 owner_sid[] = /* S-1-5-21-3141592653-589793238-462843383-1016 */
{
cpu_to_le32(0x501), cpu_to_le32(0x05000000), cpu_to_le32(21),
- cpu_to_le32(AUTH1), cpu_to_le32(AUTH2),
- cpu_to_le32(AUTH3), cpu_to_le32(1016)
+ cpu_to_le32(DEFSECAUTH1), cpu_to_le32(DEFSECAUTH2),
+ cpu_to_le32(DEFSECAUTH3), cpu_to_le32(1016)
} ;
le32 group_sid[] = /* S-1-5-21-3141592653-589793238-462843383-513 */
{
cpu_to_le32(0x501), cpu_to_le32(0x05000000), cpu_to_le32(21),
- cpu_to_le32(AUTH1), cpu_to_le32(AUTH2),
- cpu_to_le32(AUTH3), cpu_to_le32(513)
+ cpu_to_le32(DEFSECAUTH1), cpu_to_le32(DEFSECAUTH2),
+ cpu_to_le32(DEFSECAUTH3), cpu_to_le32(513)
} ;
#if POSIXACLS
#ifdef STSC
@@ -3943,6 +4147,9 @@ unsigned int getfull(char *attr, const char *fullname)
ULONG attrsz;
ULONG partsz;
BOOL overflow;
+ HANDLE htoken;
+ TOKEN_PRIVILEGES tkp;
+ BOOL saclsuccess;
attrsz = 0;
partsz = 0;
@@ -3963,9 +4170,27 @@ unsigned int getfull(char *attr, const char *fullname)
}
/*
* SACL : just feed in or clean
+ * This requires the SE_SECURITY_NAME privilege
*/
- if (!GetFileSecurityW((LPCWSTR)fullname,SACL_SECURITY_INFORMATION,
- (char*)attr,MAXATTRSZ,&attrsz)) {
+ saclsuccess = FALSE;
+ if (OpenProcessToken(GetCurrentProcess(),
+ TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY, &htoken)) {
+ if (LookupPrivilegeValue(NULL, SE_SECURITY_NAME,
+ &tkp.Privileges[0].Luid)) {
+ tkp.PrivilegeCount = 1;
+ tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
+ if (AdjustTokenPrivileges(htoken, FALSE, &tkp, 0, NULL, 0)) {
+ if (GetFileSecurityW((LPCWSTR)fullname,
+ SACL_SECURITY_INFORMATION,
+ (char*)attr,MAXATTRSZ,&attrsz)) {
+ saclsuccess = TRUE;
+ }
+ tkp.Privileges[0].Attributes = 0;
+ AdjustTokenPrivileges(htoken, FALSE, &tkp, 0, NULL, 0);
+ }
+ }
+ }
+ if (!saclsuccess) {
attrsz = 20;
set4l(attr,0);
attr[0] = SECURITY_DESCRIPTOR_REVISION;
@@ -4439,6 +4664,127 @@ BOOL setfull(const char *fullname, int mode, BOOL isdir)
return (err);
}
+BOOL proposal(const char *name, const char *attr)
+{
+ char fullname[MAXFILENAME];
+ int uoff, goff;
+ int i;
+ u64 uauth, gauth;
+ int ucnt, gcnt;
+ int uid, gid;
+ BOOL err;
+#ifdef WIN32
+ char driveletter;
+#else
+ struct stat st;
+ char *p,*q;
+#endif
+
+ err = FALSE;
+#ifdef WIN32
+ uid = gid = 0;
+#else
+ uid = getuid();
+ gid = getgid();
+#endif
+ uoff = get4l(attr,4);
+ uauth = get6h(attr,uoff+2);
+ ucnt = attr[uoff+1] & 255;
+ goff = get4l(attr,8);
+ gauth = get6h(attr,goff+2);
+ gcnt = attr[goff+1] & 255;
+
+ if ((ucnt == 5) && (gcnt == 5)
+ && (uauth == 5) && (gauth == 5)
+ && (get4l(attr,uoff+8) == 21) && (get4l(attr,goff+8) == 21)) {
+ printf("# User mapping proposal :\n");
+ printf("# -------------------- cut here -------------------\n");
+ if (uid)
+ printf("%d::",uid);
+ else
+ printf("user::");
+ printf("S-%d-%llu",attr[uoff] & 255,uauth);
+ for (i=0; i<ucnt; i++)
+ printf("-%lu",get4l(attr,uoff+8+4*i));
+ printf("\n");
+ if (gid)
+ printf(":%d:",gid);
+ else
+ printf(":group:");
+ printf("S-%d-%llu",attr[goff] & 255,gauth);
+ for (i=0; i<gcnt; i++)
+ printf("-%lu",get4l(attr,goff+8+4*i));
+ printf("\n");
+ /* generic rule, based on group */
+ printf("::S-%d-%llu",attr[goff] & 255,gauth);
+ for (i=0; i<gcnt-1; i++)
+ printf("-%lu",get4l(attr,goff+8+4*i));
+ printf("-10000\n");
+ printf("# -------------------- cut here -------------------\n");
+ if (!uid || !gid) {
+ printf("# Please replace \"user\" and \"group\" above by the uid\n");
+ printf("# and gid of the Linux owner and group of ");
+ printname(stdout,name);
+ printf(", then\n");
+ printf("# insert the modified lines into .NTFS-3G/Usermapping, with .NTFS-3G\n");
+ } else
+ printf("# Insert the above lines into .NTFS-3G/Usermapping, with .NTFS-3G\n");
+#ifdef WIN32
+ printf("# being a directory of the root of the NTFS file system.\n");
+
+ /* Get the drive letter to the file system */
+ driveletter = 0;
+ if ((((name[0] >= 'a') && (name[0] <= 'z'))
+ || ((name[0] >= 'A') && (name[0] <= 'Z')))
+ && (name[1] == ':'))
+ driveletter = name[0];
+ else {
+ if (GetCurrentDirectoryA(MAXFILENAME, fullname)
+ && (fullname[1] == ':'))
+ driveletter = fullname[0];
+ }
+ if (driveletter) {
+ printf("# Example : %c:\\.NTFS-3G\\UserMapping\n",
+ driveletter);
+ }
+#else
+ printf("# being a hidden subdirectory of the root of the NTFS file system.\n");
+
+ /* Get the path to the root of the file system */
+ if (name[0] != '/') {
+ p = getcwd(fullname,MAXFILENAME);
+ if (p) {
+ strcat(fullname,"/");
+ strcat(fullname,name);
+ }
+ } else {
+ strcpy(fullname,name);
+ p = fullname;
+ }
+ if (p) {
+ /* go down the path to inode 5 (fails on symlinks) */
+ do {
+ lstat(fullname,&st);
+ q = strrchr(p,'/');
+ if (q && (st.st_ino != 5))
+ *q = 0;
+ } while (strchr(p,'/') && (st.st_ino != 5));
+ }
+ if (p && (st.st_ino == 5)) {
+ printf("# Example : ");
+ printname(stdout,p);
+ printf("/.NTFS-3G/UserMapping\n");
+ }
+#endif
+ } else {
+ printf("** Not possible : ");
+ printname(stdout,name);
+ printf(" was not created by a Windows user\n");
+ err = TRUE;
+ }
+ return (err);
+}
+
#ifdef WIN32
/*
@@ -4676,6 +5022,31 @@ BOOL singleshow(const char *fullname)
return (err);
}
+BOOL mapproposal(const char *fullname)
+{
+ char attr[256];
+ ULONG attrsz;
+ int attrib;
+ int err;
+
+ err = FALSE;
+ attrsz = 0;
+ attrib = GetFileAttributesW((LPCWSTR)fullname);
+ if ((attrib != INVALID_FILE_ATTRIBUTES)
+ && GetFileSecurityW((LPCWSTR)fullname,
+ OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION,
+ (char*)attr,256,&attrsz)) {
+ err = proposal(fullname,attr);
+ } else {
+ printf("** Could not access ");
+ printname(stdout,fullname);
+ printf("\n");
+ printerror(stdout);
+ err = TRUE;
+ }
+ return (err);
+}
+
#if POSIXACLS
BOOL recurseset_posix(const char *fullname, const struct POSIX_SECURITY *pxdesc)
@@ -4932,7 +5303,11 @@ void showfull(const char *fullname, BOOL isdir)
| POSIX_ACL_GROUP
| POSIX_ACL_MASK))))
showposix(pxdesc);
+#if USESTUBS
+ stdfree(pxdesc); /* allocated within library */
+#else
free(pxdesc);
+#endif
}
#endif
if ((opt_r || opt_b) && (securindex < MAXSECURID)
@@ -5060,7 +5435,7 @@ static ssize_t ntfs_getxattr(const char *path, const char *name, void *value, si
* Display all the parameters associated to a mounted file
*/
-void showmounted(const char *fullname)
+BOOL showmounted(const char *fullname)
{
static char attr[MAXATTRSZ];
@@ -5076,7 +5451,9 @@ void showmounted(const char *fullname)
u32 attrib;
int level;
BOOL isdir;
+ BOOL err;
+ err = FALSE;
if (!stat(fullname,&st)) {
isdir = S_ISDIR(st.st_mode);
printf("%s ",(isdir ? "Directory" : "File"));
@@ -5147,21 +5524,65 @@ void showmounted(const char *fullname)
if (mapped)
ntfs_free_mapping(context.mapping);
#endif
- } else
+ } else {
printf("Descriptor fails sanity check\n");
+ errors++;
+ }
} else {
printf("** Could not get the NTFS ACL, check whether file is on NTFS\n");
errors++;
}
- } else
+ } else {
+ printf("%s not found\n",fullname);
+ err = TRUE;
+ }
+ return (err);
+}
+
+BOOL processmounted(const char *fullname)
+{
+
+ static char attr[MAXATTRSZ];
+ struct stat st;
+ int attrsz;
+ BOOL err;
+
+ err = FALSE;
+ if (!opt_u)
+ err = showmounted(fullname);
+ else
+ if (!stat(fullname,&st)) {
+ attrsz = ntfs_getxattr(fullname,"system.ntfs_acl",attr,MAXATTRSZ);
+ if (attrsz > 0) {
+ if (opt_v) {
+ hexdump(attr,attrsz,8);
+ printf("Computed hash : 0x%08lx\n",
+ (unsigned long)hash((le32*)attr,attrsz));
+ }
+ if (ntfs_valid_descr(attr,attrsz)) {
+ err = proposal(fullname, attr);
+ } else {
+ printf("*** Descriptor fails sanity check\n");
+ errors++;
+ }
+ } else {
+ printf("** Could not get the NTFS ACL, check whether file is on NTFS\n");
+ errors++;
+ }
+ } else {
printf("%s not found\n",fullname);
+ err = TRUE;
+ }
+ return (err);
}
#else /* HAVE_SETXATTR */
-void showmounted(const char *fullname __attribute__((unused)))
+BOOL processmounted(const char *fullname __attribute__((unused)))
{
- fprintf(stderr,"Not possible on this configuration\n");
+ fprintf(stderr,"Not possible on this configuration,\n");
+ fprintf(stderr,"you have to use an unmounted partition\n");
+ return (TRUE);
}
#endif /* HAVE_SETXATTR */
@@ -5379,7 +5800,7 @@ BOOL backup(const char *volume, const char *root)
now = time((time_t*)NULL);
txtime = ctime(&now);
if (!getuid() && open_security_api()) {
- if (open_volume(volume,MS_RDONLY)) {
+ if (open_volume(volume,NTFS_MNT_RDONLY)) {
printf("#\n# Recursive ACL collection on %s#\n",txtime);
err = recurseshow(root);
count = 0;
@@ -5440,7 +5861,7 @@ BOOL listfiles(const char *volume, const char *root)
int count;
if (!getuid() && open_security_api()) {
- if (open_volume(volume,MS_RDONLY)) {
+ if (open_volume(volume,NTFS_MNT_RDONLY)) {
if (opt_r) {
printf("\nRecursive file check\n");
err = recurseshow(root);
@@ -5475,6 +5896,47 @@ BOOL listfiles(const char *volume, const char *root)
return (err);
}
+BOOL mapproposal(const char *volume, const char *name)
+{
+ BOOL err;
+ u32 attrsz;
+ int securindex;
+ char attr[256]; /* header (20) and a couple of SIDs (max 40 each) */
+
+ err = FALSE;
+ if (!getuid() && open_security_api()) {
+ if (open_volume(volume,NTFS_MNT_RDONLY)) {
+
+ attrsz = 0;
+ securindex = ntfs_get_file_security(ntfs_context,name,
+ OWNER_SECURITY_INFORMATION
+ | GROUP_SECURITY_INFORMATION,
+ (char*)attr,MAXATTRSZ,&attrsz);
+ if (securindex)
+ err = proposal(name,attr);
+ else {
+ fprintf(stderr,"*** Could not get the ACL of %s\n",
+ name);
+ printerror(stdout);
+ errors++;
+ }
+ close_volume(volume);
+ } else {
+ fprintf(stderr,"Could not open volume %s\n",volume);
+ printerror(stdout);
+ err = TRUE;
+ }
+ close_security_api();
+ } else {
+ if (getuid())
+ fprintf(stderr,"This is only possible as root\n");
+ else
+ fprintf(stderr,"Could not open security API\n");
+ err = TRUE;
+ }
+ return (err);
+}
+
#endif
#ifndef WIN32
@@ -6170,7 +6632,7 @@ BOOL audit(const char *volume)
err = FALSE;
if (!getuid() && open_security_api()) {
- if (open_volume(volume,MS_RDONLY)) {
+ if (open_volume(volume,NTFS_MNT_RDONLY)) {
if (audit_sds(FALSE)) err = TRUE;
if (audit_sds(TRUE)) err = TRUE;
if (audit_sii()) err = TRUE;
@@ -6505,7 +6967,7 @@ int getoptions(int argc, char *argv[])
opt_a = FALSE;
opt_b = FALSE;
- opt_e = FALSE;
+ opt_e = FALSE;
opt_h = FALSE;
#if FORCEMASK
opt_m = FALSE;
@@ -6515,6 +6977,7 @@ int getoptions(int argc, char *argv[])
#if SELFTESTS & !USESTUBS
opt_t = FALSE;
#endif
+ opt_u = FALSE;
opt_v = 0;
xarg = 1;
err = FALSE;
@@ -6554,6 +7017,9 @@ int getoptions(int argc, char *argv[])
opt_t = TRUE;
break;
#endif
+ case 'u' :
+ opt_u = TRUE;
+ break;
case 'v' :
opt_v++;
break;
@@ -6565,7 +7031,7 @@ int getoptions(int argc, char *argv[])
narg = argc - xarg;
#ifdef WIN32
if ( ((opt_h || opt_s) && (narg > 1))
- || ((opt_r || opt_b) && ((narg < 1) || (narg > 2)))
+ || ((opt_r || opt_b || opt_u) && ((narg < 1) || (narg > 2)))
#if SELFTESTS & !USESTUBS
|| (opt_t && (narg > 0))
#endif
@@ -6599,6 +7065,8 @@ int getoptions(int argc, char *argv[])
fprintf(stderr," set the security parameters of file to perms\n");
fprintf(stderr," secaudit -r[v] perms directory\n");
fprintf(stderr," set the security parameters of files in directory to perms\n");
+ fprintf(stderr," secaudit -u file\n");
+ fprintf(stderr," get a user mapping proposal applicable to file\n");
#if POSIXACLS
fprintf(stderr," Note: perms can be an octal mode or a Posix ACL description\n");
#else
@@ -6609,12 +7077,13 @@ int getoptions(int argc, char *argv[])
#else
if ( (opt_h && (narg > 1))
|| (opt_a && (narg != 1))
- || ((opt_r || opt_b || opt_s) && ((narg < 1) || (narg > 3)))
+ || ((opt_r || opt_b || opt_s || opt_u)
+ && ((narg < 1) || (narg > 3)))
#if SELFTESTS & !USESTUBS
|| (opt_t && (narg > 0))
#endif
|| (opt_e && !opt_s)
- || (!opt_h && !opt_a && !opt_r && !opt_b && !opt_s
+ || (!opt_h && !opt_a && !opt_r && !opt_b && !opt_s && !opt_u
#if SELFTESTS & !USESTUBS
&& !opt_t
#endif
@@ -6648,8 +7117,12 @@ int getoptions(int argc, char *argv[])
fprintf(stderr," set the security parameters of file to perms\n");
fprintf(stderr," secaudit -r[v] volume perms directory\n");
fprintf(stderr," set the security parameters of files in directory to perms\n");
+ fprintf(stderr," secaudit -u volume file\n");
+ fprintf(stderr," get a user mapping proposal applicable to file\n");
#ifdef HAVE_SETXATTR
- fprintf(stderr," special case, does not require being root :\n");
+ fprintf(stderr," special cases, do not require being root :\n");
+ fprintf(stderr," secaudit -u mounted-file\n");
+ fprintf(stderr," get a user mapping proposal applicable to mounted file\n");
fprintf(stderr," secaudit [-v] mounted-file\n");
fprintf(stderr," display the security parameters of a mounted file\n");
#endif
@@ -6756,6 +7229,11 @@ void chkfree(void *p, const char *file, int line)
}
}
+void *stdmalloc(size_t size)
+{
+ return (malloc(size));
+}
+
void stdfree(void *p)
{
free(p);
@@ -6847,23 +7325,27 @@ char *argv[];
filename = (char*)malloc(2*size + 2);
if (filename) {
makeutf16(filename,argv[xarg]);
+ if (opt_u) {
+ cmderr = mapproposal(filename);
+ } else {
#if POSIXACLS
- if (local_build_mapping(context.mapping,filename)) {
- printf("*** Could not get user mapping data\n");
- warnings++;
- }
+ if (local_build_mapping(context.mapping,filename)) {
+ printf("*** Could not get user mapping data\n");
+ warnings++;
+ }
#endif
- if (opt_b)
- cmderr = backup(filename);
- else {
- if (opt_r)
- cmderr = listfiles(filename);
- else
- cmderr = singleshow(filename);
- }
+ if (opt_b)
+ cmderr = backup(filename);
+ else {
+ if (opt_r)
+ cmderr = listfiles(filename);
+ else
+ cmderr = singleshow(filename);
+ }
#if POSIXACLS
- ntfs_free_mapping(context.mapping);
+ ntfs_free_mapping(context.mapping);
#endif
+ }
free(filename);
} else {
fprintf(stderr,"No more memory\n");
@@ -6977,7 +7459,8 @@ char *argv[];
printf("** %u %s found\n",errors,
(errors > 1 ? "errors were" : "error was"));
else
- printf("No errors were found\n");
+ if (!cmderr)
+ printf("No errors were found\n");
if (!isatty(1)) {
fflush(stdout);
if (warnings)
@@ -7006,13 +7489,14 @@ char *argv[];
int main(int argc, char *argv[])
{
FILE *fd;
- unsigned int mode;
const char *p;
int xarg;
BOOL cmderr;
int i;
#if POSIXACLS
struct POSIX_SECURITY *pxdesc;
+#else
+ unsigned int mode;
#endif
printf("%s\n",BANNER);
@@ -7061,7 +7545,7 @@ int main(int argc, char *argv[])
if (opt_s)
cmderr = dorestore(argv[xarg],stdin);
else
- showmounted(argv[xarg]);
+ cmderr = processmounted(argv[xarg]);
break;
case 2 :
if (opt_b)
@@ -7078,16 +7562,18 @@ int main(int argc, char *argv[])
cmderr = TRUE;
}
} else
- cmderr = listfiles(argv[xarg],argv[xarg+1]);
+ if (opt_u)
+ cmderr = mapproposal(argv[xarg],argv[xarg+1]);
+ else
+ cmderr = listfiles(argv[xarg],argv[xarg+1]);
break;
case 3 :
- mode = 0;
p = argv[xarg+1];
#if POSIXACLS
pxdesc = encode_posix_acl(p);
if (pxdesc) {
if (!getuid() && open_security_api()) {
- if (open_volume(argv[xarg],MS_NONE)) {
+ if (open_volume(argv[xarg],NTFS_MNT_NONE)) {
if (opt_r) {
for (i=0; i<(MAXSECURID + (1 << SECBLKSZ) - 1)/(1 << SECBLKSZ); i++)
securdata[i] = (struct SECURITY_DATA*)NULL;
@@ -7112,6 +7598,7 @@ int main(int argc, char *argv[])
} else
cmderr = TRUE;
#else
+ mode = 0;
while ((*p >= '0') && (*p <= '7'))
mode = (mode << 3) + (*p++) - '0';
if (*p) {
@@ -7119,7 +7606,7 @@ int main(int argc, char *argv[])
cmderr = TRUE;
} else
if (!getuid() && open_security_api()) {
- if (open_volume(argv[xarg],MS_NONE)) {
+ if (open_volume(argv[xarg],NTFS_MNT_NONE)) {
if (opt_r) {
for (i=0; i<(MAXSECURID + (1 << SECBLKSZ) - 1)/(1 << SECBLKSZ); i++)
securdata[i] = (struct SECURITY_DATA*)NULL;
diff --git a/src/secaudit.h b/src/secaudit.h
index 7f0d6da..ce59d68 100755
--- a/src/secaudit.h
+++ b/src/secaudit.h
@@ -154,8 +154,8 @@ typedef int BOOL; /* Already defined in windows.h */
typedef u32 DWORD; /* must be 32 bits whatever the platform */
typedef DWORD *LPDWORD;
-#define MS_NONE 0 /* no flag for mounting the device */
-#define MS_RDONLY 1 /* flag for mounting the device read-only */
+#define NTFS_MNT_NONE 0 /* no flag for mounting the device */
+#define NTFS_MNT_RDONLY 1 /* flag for mounting the device read-only */
#endif /* WIN32 */
@@ -221,14 +221,6 @@ typedef DWORD *LPDWORD;
typedef le16 ntfschar;
-typedef struct {
- le32 a;
- le16 b,c;
- struct {
- le16 m,n,o,p, q,r,s,t;
- } ;
-} GUID;
-
#define ntfs_log_error(args...) do { printf("** " args); if (!isatty(1)) fprintf(stderr,args); } while(0)
/*
@@ -260,9 +252,14 @@ struct SECURITY_DATA {
unsigned int flags:4;
} ;
-#define AUTH1 3141592653U
-#define AUTH2 589793238
-#define AUTH3 462843383
+ /* default security sub-authorities */
+enum {
+ DEFSECAUTH1 = -1153374643, /* 3141592653 */
+ DEFSECAUTH2 = 589793238,
+ DEFSECAUTH3 = 462843383,
+ DEFSECBASE = 10000
+};
+
#define OWNERID 1016
#define GROUPID 513
@@ -519,7 +516,8 @@ enum {
#define CONTAINER_INHERIT_ACE (0x2)
#define NO_PROPAGATE_INHERIT_ACE (0x4)
#define INHERIT_ONLY_ACE (0x8)
-#define VALID_INHERIT_FLAGS (0xF)
+#define INHERITED_ACE (0x10)
+#define VALID_INHERIT_FLAGS (0x1F)
/*
* Other useful definitions
@@ -536,6 +534,12 @@ enum {
#define ACL_REVISION_DS 4
#endif
+#ifndef INHERITED_ACE /* not always defined in <windows.h> */
+#define INHERITED_ACE (0x10)
+#undef VALID_INHERIT_FLAGS
+#define VALID_INHERIT_FLAGS (0x1F)
+#endif
+
/*
* Matching of ntfs permissions to Linux permissions
* these constants are adapted to endianness
diff --git a/src/usermap.c b/src/usermap.c
index 7548aee..3d8ce6d 100755
--- a/src/usermap.c
+++ b/src/usermap.c
@@ -114,10 +114,7 @@
#include <string.h>
#include <stdlib.h>
#include <fcntl.h>
-#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
-#endif
-
#include <sys/stat.h>
#include <errno.h>
diff --git a/stamp-h1 b/stamp-h1
index 4547fe1..4547fe1 100755..100644
--- a/stamp-h1
+++ b/stamp-h1