├── NEWS ├── AUTHORS ├── Makefile.am ├── configure.in ├── ufi_detect.h ├── ufi_command.h ├── README ├── ufiformat.spec ├── ChangeLog ├── config.h.in ├── ufiformat.man ├── mkinstalldirs ├── ufi_command.c ├── ufi_detect.c ├── INSTALL ├── missing ├── ufi_format.c ├── install-sh ├── COPYING ├── depcomp ├── Makefile.in └── aclocal.m4 /NEWS: -------------------------------------------------------------------------------- 1 | Please refer to ChangeLog. 2 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | Kazuhiro Hayashi 2 | John Floyd 3 | 4 | Working parts are written in ChangeLog. 5 | -------------------------------------------------------------------------------- /Makefile.am: -------------------------------------------------------------------------------- 1 | bin_PROGRAMS = ufiformat 2 | ufiformat_SOURCES = ufi_format.c ufi_command.c ufi_detect.c ufi_command.h ufi_detect.h 3 | man8_MANS = ufiformat.man 4 | EXTRA_DIST = ufiformat.man 5 | -------------------------------------------------------------------------------- /configure.in: -------------------------------------------------------------------------------- 1 | # -*- Autoconf -*- 2 | # Process this file with autoconf to produce a configure script. 3 | 4 | AC_PREREQ(2.61) 5 | AC_INIT(ufiformat, 0.9.9) 6 | AM_INIT_AUTOMAKE 7 | AC_CONFIG_SRCDIR([ufi_format.c]) 8 | AC_CONFIG_HEADER([config.h]) 9 | 10 | # Checks for programs. 11 | AC_PROG_CC 12 | 13 | # Checks for libraries. 14 | AC_CHECK_LIB(ext2fs, ext2fs_check_if_mounted,, 15 | AC_MSG_ERROR([ext2fs:ext2fs_check_if_mounted not found])) 16 | 17 | # Checks for header files. 18 | AC_HEADER_STDC 19 | AC_CHECK_HEADERS([fcntl.h stdlib.h string.h sys/ioctl.h sys/param.h unistd.h],, 20 | AC_MSG_ERROR([system headers not found])) 21 | AC_CHECK_HEADER([ext2fs/ext2fs.h],, 22 | AC_MSG_ERROR([ext2fs:ext2fs/ext2fs.h not found])) 23 | 24 | # Checks for typedefs, structures, and compiler characteristics. 25 | AC_C_CONST 26 | AC_TYPE_SIZE_T 27 | AC_CHECK_MEMBERS([struct stat.st_rdev],, 28 | AC_MSG_ERROR([struct stat.st_rdev not found])) 29 | 30 | # Checks for library functions. 31 | AC_PROG_GCC_TRADITIONAL 32 | AC_HEADER_MAJOR 33 | AC_FUNC_MALLOC 34 | AC_FUNC_STAT 35 | AC_CHECK_FUNCS([memset strdup],, AC_MSG_ERROR([system functions not found])) 36 | 37 | AC_CONFIG_FILES([Makefile]) 38 | AC_OUTPUT 39 | -------------------------------------------------------------------------------- /ufi_detect.h: -------------------------------------------------------------------------------- 1 | /* 2 | ufiformat Version 0.9.9 2011/01/29 3 | 4 | Copyright (C) 2005-2011 Kazuhiro Hayashi 5 | Copyright (C) 2005 John Floyd 6 | 7 | The method of formatting a floppy on USB-FDD used in this program 8 | is introduced by Bruce M Simpson. 9 | 10 | This program is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU General Public License 12 | as published by the Free Software Foundation; either version 2 13 | of the License, or (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 23 | */ 24 | 25 | #ifndef UFI_DETECT_H 26 | #define UFI_DETECT_H 27 | 28 | struct ufi_path_info { 29 | int host_id; 30 | char *sg_path; 31 | char *sd_path; 32 | struct ufi_path_info *next; 33 | }; 34 | 35 | int convert_to_sg_path(const char *sd, char *sg, size_t len); 36 | int convert_to_sd_path(const char *sg, char *sd, size_t len); 37 | int is_usb_fdd(const char *dev); 38 | int get_usb_fdds(struct ufi_path_info **info); 39 | void free_ufi_path_info(struct ufi_path_info *info); 40 | 41 | #endif 42 | 43 | -------------------------------------------------------------------------------- /ufi_command.h: -------------------------------------------------------------------------------- 1 | /* 2 | ufiformat Version 0.9.9 2011/01/29 3 | 4 | Copyright (C) 2005-2011 Kazuhiro Hayashi 5 | Copyright (C) 2005 John Floyd 6 | 7 | The method of formatting a floppy on USB-FDD used in this program 8 | is introduced by Bruce M Simpson. 9 | 10 | This program is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU General Public License 12 | as published by the Free Software Foundation; either version 2 13 | of the License, or (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 23 | */ 24 | 25 | #ifndef UFI_COMMAND_H 26 | #define UFI_COMMAND_H 27 | 28 | struct ufi_capacities { 29 | int blocks; 30 | int block_size; 31 | struct ufi_capacities *next; 32 | }; 33 | 34 | struct ufi_product { 35 | char *vendor; 36 | char *product; 37 | }; 38 | 39 | void ufi_set_verbose(int verbose); 40 | int ufi_test_unit_ready(int fd); 41 | struct ufi_capacities *ufi_read_format_capacities(int fd, int *type); 42 | struct ufi_product *ufi_inquiry(int fd); 43 | int ufi_mode_sense(int fd, int *write_protected); 44 | int ufi_format_unit(int fd, int blocks, int block_size, int track, int head); 45 | int ufi_reset(int fd); 46 | 47 | #define UFI_GOOD 0 48 | #define UFI_ERROR -1 49 | #define UFI_UNFORMATTED_MEDIA 1 50 | #define UFI_FORMATTED_MEDIA 2 51 | #define UFI_NO_MEDIA 3 52 | 53 | #define UFI_PROTECTED 1 54 | #define UFI_NOT_PROTECTED 0 55 | #endif 56 | -------------------------------------------------------------------------------- /README: -------------------------------------------------------------------------------- 1 | This is formatting disk utility for USB floppy devices. 2 | 3 | Usage: ufiformat [OPTION]... [DEVICE] 4 | Format a floppy disk in a USB floppy disk DEVICE. 5 | 6 | -f, --format [SIZE] specify format capacity SIZE in KB 7 | without -f option, the format of the current media will be used 8 | -F, --force do not perform any safety checks 9 | -i, --inquire show device information, instead of performing format 10 | without DEVICE argument, list USB floppy disk devices 11 | -v, --verbose show detailed output 12 | -q, --quiet suppress minor output 13 | -h, --help show this message 14 | 15 | NOTE: ufiformat supports only the following format capacities. 16 | 1440/1232/1200 (for 2hd disk) 17 | 720/640 (for 2dd disk) 18 | The device should support the capacities also, 19 | otherwise ufiformat shows an error message. 20 | 21 | The above format capacities are predefined in the program, but 22 | each usb floppy device also has a limited set of formats (defined internally) 23 | that it can format media to. The allowed format capacities are obtained by 24 | querying the device, but this only returns the total format capacity 25 | and not CHS (cylinder, heads and sectors), hence a mapping is 26 | required in the program. 27 | 28 | This program is based around the following document: 29 | "Universal Serial Bus Mass Storage Class - UFI Command Specification" 30 | Revision 1.0 December 14 1998 31 | http://www.usb.org/developers/devclass_docs/usbmass-ufi10.pdf 32 | 33 | Currently it is known to work under the following environment. 34 | * Plamo Linux 4.0.2(kernel 2.6) + YE-DATA USB-FDU(OEM) 35 | * Plamo Linux 4.0.2(kernel 2.4) + YE-DATA USB-FDU(OEM) 36 | * SuSE-10 + TEAC FD-05PUB(OEM) 37 | * Linux Zaurus SL-C700(kernel 2.4) + REX-CFU1 + YE-DATA USB-FDU 38 | (some kernel modules and recent libext2 are needed) 39 | -------------------------------------------------------------------------------- /ufiformat.spec: -------------------------------------------------------------------------------- 1 | %define version 0.9.9 2 | %define program ufiformat 3 | 4 | %if %{?_dist_release:1}%{!?_dist_release:0} 5 | # change this to >=1 on official release 6 | # Vine Linux uses %%_dist_release 7 | %define release 0%{_dist_release} 8 | %else 9 | # Red Hat uses %%dist 10 | %define release 0%{?dist:%{dist}} 11 | %endif 12 | 13 | # %%define _prefix /usr/local 14 | 15 | ## nullify both of these 16 | %global _enable_debug_packages 0 17 | %define debug_package %{nil} 18 | 19 | Summary: This is formatting disk utility for USB floppy devices. 20 | Name: %{program} 21 | Version: %{version} 22 | Release: %{release} 23 | License: GPLv2 24 | Provides: %{program} 25 | Prefix: %{_prefix} 26 | Group: Applications/System 27 | URL: http://www.geocities.jp/tedi_world/format_usbfdd.html 28 | BuildRoot: %{_tmppath}/%{name}-%{version} 29 | BuildArch: %{_target_cpu} 30 | BuildRequires: gcc e2fsprogs-devel 31 | #Requires: e2fsprogs 32 | 33 | Source0: %{name}-%{version}.tar.gz 34 | #Patch0: ufiformat-sgmissing-msg.patch 35 | #Patch1: ufiformat-man8.patch 36 | #Patch2: ufiformat.detect.patch 37 | 38 | %description 39 | %{program} is a disk formatting utility for USB floppy devices. 40 | Requires /dev/sg* SCSI pass-thru device. Invoke "modprobe sg" if needed. 41 | 42 | %prep 43 | %setup 44 | #%patch0 -p1 45 | #%patch1 -p1 46 | #%patch2 -p1 47 | 48 | %configure 49 | %build 50 | make 51 | %install 52 | rm -fr $RPM_BUILD_ROOT 53 | make DESTDIR=$RPM_BUILD_ROOT install 54 | # copy over documents to /usr/share/doc/ 55 | docdir=$RPM_DOC_DIR/%{name}-%{version} 56 | test -d ${RPM_BUILD_ROOT}${docdir} || mkdir -p ${RPM_BUILD_ROOT}${docdir} 57 | cp -p AUTHORS COPYING ChangeLog INSTALL NEWS README ${RPM_BUILD_ROOT}${docdir} 58 | find $RPM_BUILD_ROOT -type f -ls 59 | 60 | %clean 61 | rm -fr $RPM_BUILD_ROOT 62 | 63 | %post 64 | #test -x /etc/cron.weekly/makewhatis.cron && sh /etc/cron.weekly/makewhatis.cron 65 | 66 | %postun 67 | #rm -f /var/cache/man/cat8/%{program}.* 68 | 69 | %files 70 | %defattr(-,root,root) 71 | %{_prefix} 72 | %{_mandir} 73 | %doc 74 | %defattr(-,root,root) 75 | %{_docdir}/%{name}-%{version} 76 | 77 | %changelog 78 | * Thu Jan 27 2011 kabe 0.9.9 79 | - Updated to ufiformat-0.9.9 80 | 81 | * Mon Jan 25 2011 kabe 0.9.8-2 82 | - Check for /sys/class/scsi_host/host%d/device/../driver, not just /sys/class 83 | for UFI detection (/sys/class/ did exist for Red Hat 4, kernel 2.6.9) 84 | 85 | * Fri Jan 21 2011 kabe 86 | - Updated to ufiformat-0.9.8 87 | 88 | * Tue Nov 13 2007 kabe 89 | - Updated to ufiformat-0.9.4 90 | 91 | * Thu Nov 8 2007 kabe 92 | - Diag output to "modprobe sg" when /dev/sg* is missing. 93 | - Add specfile. 94 | - Add roff manual. 95 | -------------------------------------------------------------------------------- /ChangeLog: -------------------------------------------------------------------------------- 1 | 2011-Jan-29 Kazuhiro Hayashi 2 | 3 | Version 0.9.9 4 | * support for old sysfs, patch contributed by Kabe 5 | * add spec file, also contributed by Kabe 6 | 7 | 2010-Nov-29 Kazuhiro Hayashi 8 | 9 | Version 0.9.8 10 | * verification support for some unusual devices 11 | * fix typo 12 | 13 | 2010-Nov-21 Kazuhiro Hayashi 14 | 15 | Version 0.9.7 16 | * add verification feature, thanks to Robert M. Stockmann 17 | 18 | 2009-Nov-02 Kazuhiro Hayashi 19 | 20 | Version 0.9.6 21 | * bug fix of the method of usb floppy detection with sysfs 22 | 23 | 2009-Oct-03 Kazuhiro Hayashi 24 | 25 | Version 0.9.5 26 | * use sysfs if it exists 27 | 28 | 2007-Nov-10 Kazuhiro Hayashi 29 | 30 | Version 0.9.4 31 | * add path info in a error message when /dev/sg* is unavailable 32 | suggested by 33 | * add manpage 34 | contributed by 35 | * store ufiformat binary to (prefix)/bin instead of sbin 36 | 37 | 2006-Nov-25 Kazuhiro Hayashi 38 | 39 | Version 0.9.3 40 | * bug fix for device detection 41 | patch contributed by Martin 42 | 43 | 2006-Mar-08 Kazuhiro Hayashi 44 | 45 | Version 0.9.2(beta release) 46 | * show error with device path if possible 47 | * small bug fix 48 | * add some documents 49 | 50 | 2006-Feb-19 Kazuhiro Hayashi 51 | 52 | Version 0.9.1 53 | * show error messages properly 54 | 55 | 2006-Feb-19 Kazuhiro Hayashi 56 | 57 | Version 0.9.0 58 | * total refactoring for the release 59 | * clean up of command line options 60 | * add some safety check 61 | * modify to work under kernel-2.4/2.6 (using procfs) 62 | 63 | 2005-Dec-15 John Floyd 64 | 65 | Version 0.3 66 | * Small cleanups of output. Free all sysfs lists. 67 | * Added usage, -h/--help to options. 68 | * Changed program name to ufiformat. 69 | 70 | 2005-Dec-14 John Floyd 71 | 72 | Version 0.2.2 73 | * Fix readcapacities to allow an non-ready drive to move into an 74 | active state. Loop around the READCAPACITIES sg command until 75 | ready. 76 | 77 | 2005-Dec-11 John Floyd 78 | 79 | Version 0.2.1 80 | * Test for null return on sysfs attrib query (in 81 | ufi_sysfs:get_floppy_devices). 82 | * Return no devices found (in ufi_sysfs:floppy_list_print) 83 | 84 | 2005-Dec-10 John Floyd 85 | 86 | Version 0.2 87 | * Added SySFS Scan to determine ufi capable devices (ufi_sysfs.c) 88 | * Added SySFS Scan to map block devices to generic scsii device. 89 | * Added Read_Format_Capacities (ufi command) to determine allowed formats. 90 | (ufi_read_capacities.c) 91 | * using autoconf & automake 92 | 93 | 2005-Jan-14 Kazuhiro Hayashi 94 | 95 | * initial version 96 | -------------------------------------------------------------------------------- /config.h.in: -------------------------------------------------------------------------------- 1 | /* config.h.in. Generated from configure.in by autoheader. */ 2 | 3 | /* Define to 1 if you have the header file. */ 4 | #undef HAVE_FCNTL_H 5 | 6 | /* Define to 1 if you have the header file. */ 7 | #undef HAVE_INTTYPES_H 8 | 9 | /* Define to 1 if you have the `ext2fs' library (-lext2fs). */ 10 | #undef HAVE_LIBEXT2FS 11 | 12 | /* Define to 1 if your system has a GNU libc compatible `malloc' function, and 13 | to 0 otherwise. */ 14 | #undef HAVE_MALLOC 15 | 16 | /* Define to 1 if you have the header file. */ 17 | #undef HAVE_MEMORY_H 18 | 19 | /* Define to 1 if you have the `memset' function. */ 20 | #undef HAVE_MEMSET 21 | 22 | /* Define to 1 if `stat' has the bug that it succeeds when given the 23 | zero-length file name argument. */ 24 | #undef HAVE_STAT_EMPTY_STRING_BUG 25 | 26 | /* Define to 1 if you have the header file. */ 27 | #undef HAVE_STDINT_H 28 | 29 | /* Define to 1 if you have the header file. */ 30 | #undef HAVE_STDLIB_H 31 | 32 | /* Define to 1 if you have the `strdup' function. */ 33 | #undef HAVE_STRDUP 34 | 35 | /* Define to 1 if you have the header file. */ 36 | #undef HAVE_STRINGS_H 37 | 38 | /* Define to 1 if you have the header file. */ 39 | #undef HAVE_STRING_H 40 | 41 | /* Define to 1 if `st_rdev' is a member of `struct stat'. */ 42 | #undef HAVE_STRUCT_STAT_ST_RDEV 43 | 44 | /* Define to 1 if you have the header file. */ 45 | #undef HAVE_SYS_IOCTL_H 46 | 47 | /* Define to 1 if you have the header file. */ 48 | #undef HAVE_SYS_PARAM_H 49 | 50 | /* Define to 1 if you have the header file. */ 51 | #undef HAVE_SYS_STAT_H 52 | 53 | /* Define to 1 if you have the header file. */ 54 | #undef HAVE_SYS_TYPES_H 55 | 56 | /* Define to 1 if you have the header file. */ 57 | #undef HAVE_UNISTD_H 58 | 59 | /* Define to 1 if `lstat' dereferences a symlink specified with a trailing 60 | slash. */ 61 | #undef LSTAT_FOLLOWS_SLASHED_SYMLINK 62 | 63 | /* Define to 1 if `major', `minor', and `makedev' are declared in . 64 | */ 65 | #undef MAJOR_IN_MKDEV 66 | 67 | /* Define to 1 if `major', `minor', and `makedev' are declared in 68 | . */ 69 | #undef MAJOR_IN_SYSMACROS 70 | 71 | /* Name of package */ 72 | #undef PACKAGE 73 | 74 | /* Define to the address where bug reports for this package should be sent. */ 75 | #undef PACKAGE_BUGREPORT 76 | 77 | /* Define to the full name of this package. */ 78 | #undef PACKAGE_NAME 79 | 80 | /* Define to the full name and version of this package. */ 81 | #undef PACKAGE_STRING 82 | 83 | /* Define to the one symbol short name of this package. */ 84 | #undef PACKAGE_TARNAME 85 | 86 | /* Define to the home page for this package. */ 87 | #undef PACKAGE_URL 88 | 89 | /* Define to the version of this package. */ 90 | #undef PACKAGE_VERSION 91 | 92 | /* Define to 1 if you have the ANSI C header files. */ 93 | #undef STDC_HEADERS 94 | 95 | /* Version number of package */ 96 | #undef VERSION 97 | 98 | /* Define to empty if `const' does not conform to ANSI C. */ 99 | #undef const 100 | 101 | /* Define to rpl_malloc if the replacement function should be used. */ 102 | #undef malloc 103 | 104 | /* Define to `unsigned int' if does not define. */ 105 | #undef size_t 106 | -------------------------------------------------------------------------------- /ufiformat.man: -------------------------------------------------------------------------------- 1 | .\" 2 | .\" 3 | .\" 4 | .TH ufiformat 8 5 | .SH NAME 6 | .ad l 7 | .hy 0 8 | .nf 9 | ufiformat \- Format a USB floppy disk. 10 | .SH SYNOPSIS 11 | .B ufiformat 12 | [ \fB\-hiqvV\fP ] 13 | [ \fB\-f\fR|\fB\-\-format\fP [\fIsize\fP\|]] 14 | [ 15 | .I devicepath 16 | ] 17 | . 18 | .SH OPTIONS 19 | .TP 20 | \fB\-f\fP, \fB\-\-format\fP [\fIsize\fP\|] 21 | Specify format capacity SIZE in KB. 22 | Without \fB\-f\fP option, the format of the current media will be used. 23 | .TP 24 | .BR \-V , \ \-\-verify 25 | Verify the medium after formatting. Only meaningful without \fB\-i\fP option. 26 | .TP 27 | .BR \-F , \ \-\-force 28 | Do not perform any safety checks. 29 | .TP 30 | .BR \-i , \ \-\-inquire 31 | Show device information, instead of performing format. 32 | Without \fIdevicepath\fP argument, list all USB floppy disk devices 33 | attached to the system. 34 | .TP 35 | .BR \-v , \ \-\-verbose 36 | Be verbose. 37 | .TP 38 | .BR \-q , \ \-\-quiet 39 | Suppress minor diagnostics. 40 | .TP 41 | .BR \-h , \ \-\-help 42 | Show help message. 43 | . 44 | .SH DESCRIPTION 45 | .B ufiformat 46 | is a raw level formatting disk utility for USB floppy devices. 47 | .PP 48 | Raw level format is to write gap,index,sectors to the unformatted disk 49 | using special commands specific to the disk controller, 50 | to make the plain magneto-sensitive film into sector-addressable medium. 51 | Note that raw level format is \fBNOT\fP about creating filesystems 52 | (\fIfs\fP(5)) 53 | on the disk. 54 | .PP 55 | After mid-1990's, floppy disks are sold generally pre-formatted in 56 | MS-DOS 2HD format: 57 | 80 cylinder, 2 heads, 18 sectors/track, 512 bytes/sector; 58 | it is seldom in need for raw formatting. 59 | Nevertheless raw formatting could cure some disk and drive mismatchings. 60 | .PP 61 | .I WARNING: 62 | You will \fBNOT\fP raw format an LS-120 disks or (removable) hard disks; 63 | they are precision formatted in factory and cannot be raw reformatted. 64 | .PP 65 | .B ufiformat 66 | supports only the following format capacities: 67 | .RS 68 | 1440/1232/1200 (for 2HD disk) 69 | 720/640 (for 2DD disk) 70 | .RE 71 | The device should support the capacities also, 72 | otherwise \fBufiformat\fP shows an error message. 73 | 74 | The above format capacities are predefined in the program, but 75 | each USB floppy device also has a limited set of formats (defined internally) 76 | that it can format media to. The allowed format capacities are obtained by 77 | querying 78 | .RB ( \-i ) 79 | the device, but this only returns the total format capacity 80 | and not CHS (cylinder, heads and sectors), hence a mapping is 81 | required in the program. 82 | 83 | .\"Currently it is known to work under the following environment. 84 | .\" * Plamo Linux 4.0.2(kernel 2.6) + YE-DATA USB-FDU(OEM) 85 | .\" * Plamo Linux 4.0.2(kernel 2.4) + YE-DATA USB-FDU(OEM) 86 | .\" * SuSE-10 + TEAC FD-05PUB(OEM) 87 | .\" * Linux Zaurus SL-C700(kernel 2.4) + REX-CFU1 + YE-DATA USB-FDU 88 | .\" (some kernel modules and recent libext2 are needed) 89 | .SH EXAMPLES 90 | .TP 91 | Inquiry the device for available format: 92 | .nf 93 | # modprobe sg 94 | # ufiformat \-i /dev/sda 95 | vendor: Y\-E DATA 96 | product: USB-FDU 97 | write protect: off 98 | media type: 2HD 99 | status block size kb 100 | formatted 2880 512 1440 101 | formattable 2880 512 1440 102 | formattable 1232 1024 1232 103 | formattable 2400 512 1200 104 | .fi 105 | .TP 106 | Format the floppy disk in 1.44MB, and create a FAT filesystem: 107 | .nf 108 | # ufiformat \-f 1440 /dev/sda 109 | # mkdosfs \-I /dev/sda 110 | .fi 111 | . 112 | .SH PREREQUISTES 113 | .B ufiformat 114 | needs 115 | .BR /dev/sg * 116 | SCSI pass-thru device to operate. 117 | If the device does not exist, add the driver by invoking 118 | \fBmodprobe sg\fP. 119 | .PP 120 | You often need to be root to do anything with \fB/dev/sd\fP*. 121 | . 122 | .SH "SEE ALSO" 123 | .IR fdformat (8), 124 | .IR floppy (8), 125 | .IR sg (4) 126 | .PP 127 | "Universal Serial Bus Mass Storage Class - UFI Command Specification" 128 | Revision 1.0 December 14 1998 129 | .br 130 | http://www.usb.org/developers/devclass_docs/usbmass-ufi10.pdf 131 | 132 | -------------------------------------------------------------------------------- /mkinstalldirs: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # mkinstalldirs --- make directory hierarchy 3 | 4 | scriptversion=2009-04-28.21; # UTC 5 | 6 | # Original author: Noah Friedman 7 | # Created: 1993-05-16 8 | # Public domain. 9 | # 10 | # This file is maintained in Automake, please report 11 | # bugs to or send patches to 12 | # . 13 | 14 | nl=' 15 | ' 16 | IFS=" "" $nl" 17 | errstatus=0 18 | dirmode= 19 | 20 | usage="\ 21 | Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ... 22 | 23 | Create each directory DIR (with mode MODE, if specified), including all 24 | leading file name components. 25 | 26 | Report bugs to ." 27 | 28 | # process command line arguments 29 | while test $# -gt 0 ; do 30 | case $1 in 31 | -h | --help | --h*) # -h for help 32 | echo "$usage" 33 | exit $? 34 | ;; 35 | -m) # -m PERM arg 36 | shift 37 | test $# -eq 0 && { echo "$usage" 1>&2; exit 1; } 38 | dirmode=$1 39 | shift 40 | ;; 41 | --version) 42 | echo "$0 $scriptversion" 43 | exit $? 44 | ;; 45 | --) # stop option processing 46 | shift 47 | break 48 | ;; 49 | -*) # unknown option 50 | echo "$usage" 1>&2 51 | exit 1 52 | ;; 53 | *) # first non-opt arg 54 | break 55 | ;; 56 | esac 57 | done 58 | 59 | for file 60 | do 61 | if test -d "$file"; then 62 | shift 63 | else 64 | break 65 | fi 66 | done 67 | 68 | case $# in 69 | 0) exit 0 ;; 70 | esac 71 | 72 | # Solaris 8's mkdir -p isn't thread-safe. If you mkdir -p a/b and 73 | # mkdir -p a/c at the same time, both will detect that a is missing, 74 | # one will create a, then the other will try to create a and die with 75 | # a "File exists" error. This is a problem when calling mkinstalldirs 76 | # from a parallel make. We use --version in the probe to restrict 77 | # ourselves to GNU mkdir, which is thread-safe. 78 | case $dirmode in 79 | '') 80 | if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then 81 | echo "mkdir -p -- $*" 82 | exec mkdir -p -- "$@" 83 | else 84 | # On NextStep and OpenStep, the `mkdir' command does not 85 | # recognize any option. It will interpret all options as 86 | # directories to create, and then abort because `.' already 87 | # exists. 88 | test -d ./-p && rmdir ./-p 89 | test -d ./--version && rmdir ./--version 90 | fi 91 | ;; 92 | *) 93 | if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 && 94 | test ! -d ./--version; then 95 | echo "mkdir -m $dirmode -p -- $*" 96 | exec mkdir -m "$dirmode" -p -- "$@" 97 | else 98 | # Clean up after NextStep and OpenStep mkdir. 99 | for d in ./-m ./-p ./--version "./$dirmode"; 100 | do 101 | test -d $d && rmdir $d 102 | done 103 | fi 104 | ;; 105 | esac 106 | 107 | for file 108 | do 109 | case $file in 110 | /*) pathcomp=/ ;; 111 | *) pathcomp= ;; 112 | esac 113 | oIFS=$IFS 114 | IFS=/ 115 | set fnord $file 116 | shift 117 | IFS=$oIFS 118 | 119 | for d 120 | do 121 | test "x$d" = x && continue 122 | 123 | pathcomp=$pathcomp$d 124 | case $pathcomp in 125 | -*) pathcomp=./$pathcomp ;; 126 | esac 127 | 128 | if test ! -d "$pathcomp"; then 129 | echo "mkdir $pathcomp" 130 | 131 | mkdir "$pathcomp" || lasterr=$? 132 | 133 | if test ! -d "$pathcomp"; then 134 | errstatus=$lasterr 135 | else 136 | if test ! -z "$dirmode"; then 137 | echo "chmod $dirmode $pathcomp" 138 | lasterr= 139 | chmod "$dirmode" "$pathcomp" || lasterr=$? 140 | 141 | if test ! -z "$lasterr"; then 142 | errstatus=$lasterr 143 | fi 144 | fi 145 | fi 146 | fi 147 | 148 | pathcomp=$pathcomp/ 149 | done 150 | done 151 | 152 | exit $errstatus 153 | 154 | # Local Variables: 155 | # mode: shell-script 156 | # sh-indentation: 2 157 | # eval: (add-hook 'write-file-hooks 'time-stamp) 158 | # time-stamp-start: "scriptversion=" 159 | # time-stamp-format: "%:y-%02m-%02d.%02H" 160 | # time-stamp-time-zone: "UTC" 161 | # time-stamp-end: "; # UTC" 162 | # End: 163 | -------------------------------------------------------------------------------- /ufi_command.c: -------------------------------------------------------------------------------- 1 | /* 2 | ufiformat Version 0.9.9 2011/01/29 3 | 4 | Copyright (C) 2005-2011 Kazuhiro Hayashi 5 | Copyright (C) 2005 John Floyd 6 | 7 | The method of formatting a floppy on USB-FDD used in this program 8 | is introduced by Bruce M Simpson. 9 | 10 | This program is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU General Public License 12 | as published by the Free Software Foundation; either version 2 13 | of the License, or (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 23 | */ 24 | 25 | #ifdef HAVE_CONFIG_H 26 | # include "config.h" 27 | #endif 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include "ufi_command.h" 36 | 37 | #define TIME_OUT (100 * 1000) /* milliseconds */ 38 | 39 | static const unsigned char TEST_UNIT_READY_CMD[] = { 40 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 41 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 42 | }; 43 | 44 | static const unsigned char READ_FORMAT_CAPACITIES_CMD[] = { 45 | 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 46 | 0x00, 0x00, 0x40, 0x00, 0x00, 0x00 47 | }; 48 | 49 | static const unsigned char INQUIRY_CMD[] = { 50 | 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 51 | 0x00, 0x00, 0x40, 0x00, 0x00, 0x00 52 | }; 53 | 54 | static const unsigned char MODE_SENSE_CMD[] = { 55 | 0x5A, 0x00, 0x05, 0x00, 0x00, 0x00, 56 | 0x00, 0x00, 0x40, 0x00, 0x00, 0x00 57 | }; 58 | 59 | static const unsigned char FORMAT_UNIT_CMD[] = { 60 | 0x04, 0x17, 0x00, 0x00, 0x00, 0x00, 61 | 0x00, 0x00, 0x0C, 0x00, 0x00, 0x00 62 | }; 63 | 64 | static const unsigned char FORMAT_UNIT_DATA[] = { 65 | 0x00, 0xB0, 0x00, 0x08, 0x00, 0x00, 66 | 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 67 | }; 68 | 69 | static int verbose = 0; 70 | 71 | void ufi_set_verbose(int v) 72 | { 73 | verbose = v; 74 | } 75 | 76 | static int ufi_invoke(int fd, const char *cmd, size_t cmd_size, char *data, size_t data_size, int direction) 77 | { 78 | sg_io_hdr_t sg_io_hdr; 79 | unsigned char sense_buffer[32]; 80 | 81 | memset(&sg_io_hdr, 0, sizeof(sg_io_hdr)); 82 | sg_io_hdr.interface_id = 'S'; 83 | sg_io_hdr.cmdp = (char *)cmd; 84 | sg_io_hdr.cmd_len = cmd_size; 85 | sg_io_hdr.dxfer_direction = direction; 86 | sg_io_hdr.dxferp = data; 87 | sg_io_hdr.dxfer_len = data_size; 88 | sg_io_hdr.sbp = sense_buffer; 89 | sg_io_hdr.mx_sb_len = sizeof(sense_buffer); 90 | sg_io_hdr.timeout = TIME_OUT; 91 | 92 | if (ioctl(fd, SG_IO, &sg_io_hdr) < 0) { 93 | return UFI_ERROR; 94 | } 95 | if (cmd[0] == TEST_UNIT_READY_CMD[0]) { 96 | if (sg_io_hdr.masked_status == CHECK_CONDITION && 97 | (sense_buffer[2] & 0xf) == 0x6 && sense_buffer[12] == 0x28 && sense_buffer[13] == 0x00) { 98 | /* media change */ 99 | if (ioctl(fd, SG_IO, &sg_io_hdr) < 0) { 100 | return UFI_ERROR; 101 | } 102 | } 103 | if (sg_io_hdr.masked_status == CHECK_CONDITION && 104 | (sense_buffer[2] & 0xf) == 0x3 && sense_buffer[12] == 0x30 && sense_buffer[13] == 0x01) { 105 | /* unformatted media */ 106 | return UFI_UNFORMATTED_MEDIA; 107 | } 108 | if (sg_io_hdr.masked_status == CHECK_CONDITION && 109 | (sense_buffer[2] & 0xf) == 0x2 && sense_buffer[12] == 0x3a && sense_buffer[13] == 0x00) { 110 | /* no media */ 111 | return UFI_NO_MEDIA; 112 | } 113 | } 114 | if (sg_io_hdr.masked_status != GOOD) { 115 | if (verbose) { 116 | int i; 117 | fprintf(stderr, "SCSI error(command=%02x, status=%02x)\n", *cmd, sg_io_hdr.masked_status); 118 | for (i = 0; i < sizeof(sense_buffer); i++) { 119 | printf("%02x ", sense_buffer[i]); 120 | if (i % 16 == 15) printf("\n"); 121 | } 122 | } 123 | errno = EPROTO; 124 | return UFI_ERROR; 125 | } 126 | return UFI_GOOD; 127 | } 128 | 129 | #define ufi_invoke_to(fd, cmd, data) \ 130 | ufi_invoke(fd, cmd, sizeof(cmd), data, sizeof(data), SG_DXFER_TO_DEV) 131 | #define ufi_invoke_from(fd, cmd, data) \ 132 | ufi_invoke(fd, cmd, sizeof(cmd), data, sizeof(data), SG_DXFER_FROM_DEV) 133 | #define ufi_invoke_no(fd, cmd) \ 134 | ufi_invoke(fd, cmd, sizeof(cmd), NULL, 0, SG_DXFER_TO_DEV) 135 | 136 | static char *dup_name(const char *src, int offset, int count) 137 | { 138 | int i; 139 | char *name; 140 | 141 | for (i = count; i > 0; i--) { 142 | if (src[offset + i - 1] != ' ') { 143 | break; 144 | } 145 | } 146 | name = malloc(i + 1); 147 | memcpy(name, src + offset, i); 148 | name[i] = '\0'; 149 | return name; 150 | } 151 | 152 | #define TWO_BYTES_TO_INT(ptr) ((*(ptr) << 8) + *((ptr) + 1)) 153 | #define THREE_BYTES_TO_INT(ptr) ((TWO_BYTES_TO_INT(ptr) << 8) + *((ptr) + 2)) 154 | #define FOUR_BYTES_TO_INT(ptr) ((THREE_BYTES_TO_INT(ptr) << 8) + *((ptr) + 3)) 155 | 156 | int ufi_test_unit_ready(int fd) 157 | { 158 | int result; 159 | result = ufi_invoke_no(fd, TEST_UNIT_READY_CMD); 160 | return result == UFI_GOOD ? UFI_FORMATTED_MEDIA : result; 161 | } 162 | 163 | struct ufi_capacities *ufi_read_format_capacities(int fd, int *type) 164 | { 165 | unsigned char response[READ_FORMAT_CAPACITIES_CMD[8]]; 166 | struct ufi_capacities *top = NULL; 167 | struct ufi_capacities *last = NULL; 168 | struct ufi_capacities *current; 169 | int i; 170 | 171 | if (ufi_invoke_from(fd, READ_FORMAT_CAPACITIES_CMD, response) != 0) { 172 | return NULL; 173 | } 174 | for (i = 0; i < response[3]; i += 8) { 175 | current = malloc(sizeof(struct ufi_capacities)); 176 | current->blocks = FOUR_BYTES_TO_INT(response + 4 + i); 177 | current->block_size = THREE_BYTES_TO_INT(response + 4 + i + 5); 178 | current->next = NULL; 179 | if (last != NULL) { 180 | last->next = current; 181 | } 182 | if (top == NULL) { 183 | top = current; 184 | } 185 | last = current; 186 | } 187 | if (top == NULL) { 188 | errno = EPROTO; 189 | return NULL; 190 | } 191 | *type = response[4 + 4] & 0x3; 192 | return top; 193 | } 194 | 195 | struct ufi_product *ufi_inquiry(int fd) 196 | { 197 | unsigned char response[INQUIRY_CMD[8]]; 198 | struct ufi_product *product; 199 | 200 | if (ufi_invoke_from(fd, INQUIRY_CMD, response) != 0) { 201 | return NULL; 202 | } 203 | product = malloc(sizeof(struct ufi_product)); 204 | product->vendor = dup_name(response, 8, 8); 205 | product->product = dup_name(response, 16, 16); 206 | return product; 207 | } 208 | 209 | int ufi_mode_sense(int fd, int *write_protected) 210 | { 211 | unsigned char response[MODE_SENSE_CMD[8]]; 212 | 213 | if (ufi_invoke_from(fd, MODE_SENSE_CMD, response) != 0) { 214 | return UFI_ERROR; 215 | } 216 | *write_protected = (response[3] & 0x80) ? UFI_PROTECTED : UFI_NOT_PROTECTED; 217 | return UFI_GOOD; 218 | } 219 | 220 | int ufi_format_unit(int fd, int blocks, int block_size, int track, int head) 221 | { 222 | unsigned char command[sizeof(FORMAT_UNIT_CMD)]; 223 | unsigned char data[sizeof(FORMAT_UNIT_DATA)]; 224 | 225 | memcpy(command, FORMAT_UNIT_CMD, sizeof(command)); 226 | memcpy(data, FORMAT_UNIT_DATA, sizeof(data)); 227 | command[2] = track; 228 | data[1] |= head; 229 | data[4] = (blocks >> 24) & 0xff; 230 | data[5] = (blocks >> 16) & 0xff; 231 | data[6] = (blocks >> 8) & 0xff; 232 | data[7] = blocks & 0xff; 233 | data[9] = (block_size >> 16) & 0xff; 234 | data[10] = (block_size >> 8) & 0xff; 235 | data[11] = block_size & 0xff; 236 | 237 | if (ufi_invoke_to(fd, command, data) != 0) { 238 | return UFI_ERROR; 239 | } 240 | return UFI_GOOD; 241 | } 242 | 243 | #ifndef SG_SCSI_RESET_TARGET 244 | #define SG_SCSI_RESET_TARGET 4 245 | #endif 246 | 247 | int ufi_reset(int fd) 248 | { 249 | int mode = SG_SCSI_RESET_TARGET; 250 | if (ioctl(fd, SG_SCSI_RESET, &mode) < 0) { 251 | mode = SG_SCSI_RESET_BUS; 252 | if (ioctl(fd, SG_SCSI_RESET, &mode) < 0) { 253 | return UFI_ERROR; 254 | } 255 | } 256 | return UFI_GOOD; 257 | } 258 | -------------------------------------------------------------------------------- /ufi_detect.c: -------------------------------------------------------------------------------- 1 | /* 2 | ufiformat Version 0.9.9 2011/01/29 3 | 4 | Copyright (C) 2005-2011 Kazuhiro Hayashi 5 | Copyright (C) 2005 John Floyd 6 | 7 | The method of formatting a floppy on USB-FDD used in this program 8 | is introduced by Bruce M Simpson. 9 | 10 | This program is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU General Public License 12 | as published by the Free Software Foundation; either version 2 13 | of the License, or (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 23 | */ 24 | 25 | #ifdef HAVE_CONFIG_H 26 | # include "config.h" 27 | #endif 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #include "ufi_detect.h" 43 | 44 | #ifndef SCSI_DISK_MAJOR 45 | #define SCSI_DISK_MAJOR(M) ((M) == SCSI_DISK0_MAJOR || \ 46 | ((M) >= SCSI_DISK1_MAJOR && (M) <= SCSI_DISK7_MAJOR) || \ 47 | ((M) >= SCSI_DISK8_MAJOR && (M) <= SCSI_DISK15_MAJOR)) 48 | #endif 49 | 50 | #define HOST_ID(idlun) ((idlun >> 24) & 0xff) 51 | 52 | static char *pathcpy(char *dst, const char *src, size_t len) 53 | { 54 | if (strlen(src) >= len) { 55 | errno = ENAMETOOLONG; 56 | return NULL; 57 | } 58 | return strcpy(dst, src); 59 | } 60 | 61 | static int is_sd_device(const char *dev) 62 | { 63 | struct stat st; 64 | 65 | if (stat(dev, &st) < 0) { 66 | return -1; 67 | } 68 | return S_ISBLK(st.st_mode) && SCSI_DISK_MAJOR(major(st.st_rdev)) && (minor(st.st_rdev) & 0xf) == 0 ? 1 : 0; 69 | } 70 | 71 | static int is_sg_device(const char *dev) 72 | { 73 | struct stat st; 74 | 75 | if (stat(dev, &st) < 0) { 76 | return -1; 77 | } 78 | return S_ISCHR(st.st_mode) && major(st.st_rdev) == SCSI_GENERIC_MAJOR ? 1 : 0; 79 | } 80 | 81 | static int get_id_lun(const char *dev) 82 | { 83 | int fd; 84 | int idlun[2]; 85 | 86 | if ((fd = open(dev, O_RDONLY | O_NONBLOCK)) < 0) { 87 | return -1; 88 | } 89 | if (ioctl(fd, SCSI_IOCTL_GET_IDLUN, idlun) < 0) { 90 | close(fd); 91 | return -1; 92 | } 93 | close(fd); 94 | return idlun[0]; 95 | } 96 | 97 | static int get_sd_path(int idlun, char *path, size_t len, int host_id_only) 98 | { 99 | char tmp[PATH_MAX]; 100 | int i; 101 | int eacces; 102 | int idlun2; 103 | 104 | eacces = 0; 105 | /* BUG: only single usb fdd is supported for one host_id */ 106 | if (host_id_only) { 107 | idlun = (idlun & 0xff) << 24; 108 | } 109 | for (i = 0; i < 256; i++) { 110 | if (i < 26) { 111 | sprintf(tmp, "/dev/sd%c", 'a' + i); 112 | } else { 113 | sprintf(tmp, "/dev/sd%c%c", 'a' + (i / 26), 'a' + (i % 26)); 114 | } 115 | if ((idlun2 = get_id_lun(tmp)) == -1) { 116 | if (errno == EACCES) { 117 | eacces = 1; 118 | } 119 | } else if (idlun == idlun2) { 120 | if (pathcpy(path, tmp, len) == NULL) { 121 | return -1; 122 | } 123 | return 0; 124 | } 125 | } 126 | errno = eacces ? EACCES : ENOENT; 127 | return -1; 128 | } 129 | 130 | static int get_sg_path(int idlun, char *path, size_t len, int host_id_only) 131 | { 132 | char tmp[PATH_MAX]; 133 | int i; 134 | int eacces; 135 | int idlun2; 136 | 137 | eacces = 0; 138 | /* BUG: only single usb fdd is supported for one host_id */ 139 | if (host_id_only) { 140 | idlun = (idlun & 0xff) << 24; 141 | } 142 | for (i = 0; i < 256; i++) { 143 | sprintf(tmp, "/dev/sg%d", i); 144 | if ((idlun2 = get_id_lun(tmp)) == -1) { 145 | if (errno == EACCES) { 146 | eacces = 1; 147 | } 148 | } else if (idlun == idlun2) { 149 | if (pathcpy(path, tmp, len) == NULL) { 150 | return -1; 151 | } 152 | return 0; 153 | } 154 | } 155 | errno = eacces ? EACCES : ENOENT; 156 | return -1; 157 | } 158 | 159 | int convert_to_sg_path(const char *sd, char *sg, size_t len) 160 | { 161 | int idlun; 162 | int flag; 163 | 164 | if ((flag = is_sg_device(sd)) < 0) { 165 | return -1; 166 | } 167 | if (flag) { 168 | if (pathcpy(sg, sd, len) == NULL) { 169 | return -1; 170 | } 171 | return 0; 172 | } 173 | if ((flag = is_sd_device(sd)) < 0) { 174 | return -1; 175 | } 176 | if (!flag) { 177 | errno = ENODEV; 178 | return -1; 179 | } 180 | if ((idlun = get_id_lun(sd)) == -1) { 181 | return -1; 182 | } 183 | if (get_sg_path(idlun, sg, len, 0) < 0) { 184 | errno = -errno; 185 | return -1; 186 | } 187 | return 0; 188 | } 189 | 190 | int convert_to_sd_path(const char *sg, char *sd, size_t len) 191 | { 192 | int idlun; 193 | int flag; 194 | 195 | if ((flag = is_sd_device(sg)) < 0) { 196 | return -1; 197 | } 198 | if (flag) { 199 | if (pathcpy(sd, sg, len) == NULL) { 200 | return -1; 201 | } 202 | return 0; 203 | } 204 | if ((flag = is_sg_device(sg)) < 0) { 205 | return -1; 206 | } 207 | if (!flag) { 208 | errno = ENODEV; 209 | return -1; 210 | } 211 | if ((idlun = get_id_lun(sg)) == -1) { 212 | return -1; 213 | } 214 | if (get_sd_path(idlun, sd, len, 0) < 0) { 215 | errno = -errno; 216 | return -1; 217 | } 218 | return 0; 219 | } 220 | 221 | static int is_usb_fdd_for_host(int host_id) 222 | { 223 | int i; 224 | char path[PATH_MAX]; 225 | char buf[1024]; 226 | FILE *fp; 227 | struct stat st; 228 | 229 | sprintf(path, "/sys/class/scsi_host/host%d/device/../driver", host_id); 230 | if (stat(path, &st) == 0) { 231 | int n; 232 | 233 | if ((n = readlink(path, buf, sizeof(buf))) < 12 || strncmp(buf + n - 12, "/usb-storage", 12) != 0) { 234 | return 0; 235 | } 236 | 237 | sprintf(path, "/sys/class/scsi_host/host%d/device/../bInterfaceClass", host_id); 238 | if ((fp = fopen(path, "r")) == NULL) { 239 | return 0; 240 | } 241 | if (fgets(buf, sizeof(buf), fp) == NULL || strcmp(buf, "08\n") != 0) { 242 | fclose(fp); 243 | return 0; 244 | } 245 | fclose(fp); 246 | 247 | sprintf(path, "/sys/class/scsi_host/host%d/device/../bInterfaceSubClass", host_id); 248 | if ((fp = fopen(path, "r")) == NULL) { 249 | return 0; 250 | } 251 | if (fgets(buf, sizeof(buf), fp) == NULL || strcmp(buf, "04\n") != 0) { 252 | fclose(fp); 253 | return 0; 254 | } 255 | fclose(fp); 256 | 257 | return 1; 258 | } 259 | 260 | sprintf(path, "/proc/scsi/usb-storage/%d", host_id); 261 | if ((fp = fopen(path, "r")) == NULL) { 262 | for (i = 0; i < 256; i++) { 263 | sprintf(path, "/proc/scsi/usb-storage-%d/%d", i, host_id); 264 | if ((fp = fopen(path, "r")) != NULL) { 265 | break; 266 | } 267 | } 268 | if (fp == NULL) { 269 | return 0; 270 | } 271 | } 272 | while (fgets(buf, sizeof(buf), fp) != NULL) { 273 | if (strcmp(buf, " Protocol: Uniform Floppy Interface (UFI)\n") == 0) { 274 | fclose(fp); 275 | return 1; 276 | } 277 | } 278 | fclose(fp); 279 | return 0; 280 | } 281 | 282 | int is_usb_fdd(const char *dev) 283 | { 284 | int idlun; 285 | int is_sd; 286 | int is_sg; 287 | 288 | if ((is_sd = is_sd_device(dev)) < 0 || (is_sg = is_sg_device(dev)) < 0) { 289 | return -1; 290 | } 291 | if (!is_sd && !is_sg) { 292 | return 0; 293 | } 294 | if ((idlun = get_id_lun(dev)) == -1) { 295 | return -1; 296 | } 297 | return is_usb_fdd_for_host(HOST_ID(idlun)); 298 | } 299 | 300 | int get_usb_fdds(struct ufi_path_info **info) 301 | { 302 | int i; 303 | struct ufi_path_info *top = NULL; 304 | struct ufi_path_info *last = NULL; 305 | struct ufi_path_info *current; 306 | char sg_path[PATH_MAX]; 307 | char sd_path[PATH_MAX]; 308 | 309 | for (i = 0; i < 256; i++) { 310 | if (is_usb_fdd_for_host(i)) { 311 | if (get_sg_path(i, sg_path, sizeof(sg_path), 1) < 0) { 312 | if (errno != ENOENT) { 313 | free_ufi_path_info(top); 314 | return -1; 315 | } 316 | sg_path[0] = '\0'; 317 | } 318 | if (get_sd_path(i, sd_path, sizeof(sd_path), 1) < 0) { 319 | if (errno != ENOENT) { 320 | free_ufi_path_info(top); 321 | return -1; 322 | } 323 | sd_path[0] = '\0'; 324 | } 325 | current = malloc(sizeof(struct ufi_path_info)); 326 | current->host_id = i; 327 | current->sg_path = sg_path[0] != '\0' ? strdup(sg_path) : NULL; 328 | current->sd_path = sd_path[0] != '\0' ? strdup(sd_path) : NULL; 329 | current->next = NULL; 330 | if (last != NULL) { 331 | last->next = current; 332 | } 333 | if (top == NULL) { 334 | top = current; 335 | } 336 | last = current; 337 | } 338 | } 339 | *info = top; 340 | return 0; 341 | } 342 | 343 | void free_ufi_path_info(struct ufi_path_info *info) 344 | { 345 | while (info != NULL) { 346 | if (info->sg_path != NULL) { 347 | free(info->sg_path); 348 | } 349 | if (info->sd_path != NULL) { 350 | free(info->sd_path); 351 | } 352 | info = info->next; 353 | } 354 | } 355 | -------------------------------------------------------------------------------- /INSTALL: -------------------------------------------------------------------------------- 1 | Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software 2 | Foundation, Inc. 3 | 4 | This file is free documentation; the Free Software Foundation gives 5 | unlimited permission to copy, distribute and modify it. 6 | 7 | Basic Installation 8 | ================== 9 | 10 | These are generic installation instructions. 11 | 12 | The `configure' shell script attempts to guess correct values for 13 | various system-dependent variables used during compilation. It uses 14 | those values to create a `Makefile' in each directory of the package. 15 | It may also create one or more `.h' files containing system-dependent 16 | definitions. Finally, it creates a shell script `config.status' that 17 | you can run in the future to recreate the current configuration, and a 18 | file `config.log' containing compiler output (useful mainly for 19 | debugging `configure'). 20 | 21 | It can also use an optional file (typically called `config.cache' 22 | and enabled with `--cache-file=config.cache' or simply `-C') that saves 23 | the results of its tests to speed up reconfiguring. (Caching is 24 | disabled by default to prevent problems with accidental use of stale 25 | cache files.) 26 | 27 | If you need to do unusual things to compile the package, please try 28 | to figure out how `configure' could check whether to do them, and mail 29 | diffs or instructions to the address given in the `README' so they can 30 | be considered for the next release. If you are using the cache, and at 31 | some point `config.cache' contains results you don't want to keep, you 32 | may remove or edit it. 33 | 34 | The file `configure.ac' (or `configure.in') is used to create 35 | `configure' by a program called `autoconf'. You only need 36 | `configure.ac' if you want to change it or regenerate `configure' using 37 | a newer version of `autoconf'. 38 | 39 | The simplest way to compile this package is: 40 | 41 | 1. `cd' to the directory containing the package's source code and type 42 | `./configure' to configure the package for your system. If you're 43 | using `csh' on an old version of System V, you might need to type 44 | `sh ./configure' instead to prevent `csh' from trying to execute 45 | `configure' itself. 46 | 47 | Running `configure' takes awhile. While running, it prints some 48 | messages telling which features it is checking for. 49 | 50 | 2. Type `make' to compile the package. 51 | 52 | 3. Optionally, type `make check' to run any self-tests that come with 53 | the package. 54 | 55 | 4. Type `make install' to install the programs and any data files and 56 | documentation. 57 | 58 | 5. You can remove the program binaries and object files from the 59 | source code directory by typing `make clean'. To also remove the 60 | files that `configure' created (so you can compile the package for 61 | a different kind of computer), type `make distclean'. There is 62 | also a `make maintainer-clean' target, but that is intended mainly 63 | for the package's developers. If you use it, you may have to get 64 | all sorts of other programs in order to regenerate files that came 65 | with the distribution. 66 | 67 | Compilers and Options 68 | ===================== 69 | 70 | Some systems require unusual options for compilation or linking that 71 | the `configure' script does not know about. Run `./configure --help' 72 | for details on some of the pertinent environment variables. 73 | 74 | You can give `configure' initial values for configuration parameters 75 | by setting variables in the command line or in the environment. Here 76 | is an example: 77 | 78 | ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix 79 | 80 | *Note Defining Variables::, for more details. 81 | 82 | Compiling For Multiple Architectures 83 | ==================================== 84 | 85 | You can compile the package for more than one kind of computer at the 86 | same time, by placing the object files for each architecture in their 87 | own directory. To do this, you must use a version of `make' that 88 | supports the `VPATH' variable, such as GNU `make'. `cd' to the 89 | directory where you want the object files and executables to go and run 90 | the `configure' script. `configure' automatically checks for the 91 | source code in the directory that `configure' is in and in `..'. 92 | 93 | If you have to use a `make' that does not support the `VPATH' 94 | variable, you have to compile the package for one architecture at a 95 | time in the source code directory. After you have installed the 96 | package for one architecture, use `make distclean' before reconfiguring 97 | for another architecture. 98 | 99 | Installation Names 100 | ================== 101 | 102 | By default, `make install' will install the package's files in 103 | `/usr/local/bin', `/usr/local/man', etc. You can specify an 104 | installation prefix other than `/usr/local' by giving `configure' the 105 | option `--prefix=PATH'. 106 | 107 | You can specify separate installation prefixes for 108 | architecture-specific files and architecture-independent files. If you 109 | give `configure' the option `--exec-prefix=PATH', the package will use 110 | PATH as the prefix for installing programs and libraries. 111 | Documentation and other data files will still use the regular prefix. 112 | 113 | In addition, if you use an unusual directory layout you can give 114 | options like `--bindir=PATH' to specify different values for particular 115 | kinds of files. Run `configure --help' for a list of the directories 116 | you can set and what kinds of files go in them. 117 | 118 | If the package supports it, you can cause programs to be installed 119 | with an extra prefix or suffix on their names by giving `configure' the 120 | option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. 121 | 122 | Optional Features 123 | ================= 124 | 125 | Some packages pay attention to `--enable-FEATURE' options to 126 | `configure', where FEATURE indicates an optional part of the package. 127 | They may also pay attention to `--with-PACKAGE' options, where PACKAGE 128 | is something like `gnu-as' or `x' (for the X Window System). The 129 | `README' should mention any `--enable-' and `--with-' options that the 130 | package recognizes. 131 | 132 | For packages that use the X Window System, `configure' can usually 133 | find the X include and library files automatically, but if it doesn't, 134 | you can use the `configure' options `--x-includes=DIR' and 135 | `--x-libraries=DIR' to specify their locations. 136 | 137 | Specifying the System Type 138 | ========================== 139 | 140 | There may be some features `configure' cannot figure out 141 | automatically, but needs to determine by the type of machine the package 142 | will run on. Usually, assuming the package is built to be run on the 143 | _same_ architectures, `configure' can figure that out, but if it prints 144 | a message saying it cannot guess the machine type, give it the 145 | `--build=TYPE' option. TYPE can either be a short name for the system 146 | type, such as `sun4', or a canonical name which has the form: 147 | 148 | CPU-COMPANY-SYSTEM 149 | 150 | where SYSTEM can have one of these forms: 151 | 152 | OS KERNEL-OS 153 | 154 | See the file `config.sub' for the possible values of each field. If 155 | `config.sub' isn't included in this package, then this package doesn't 156 | need to know the machine type. 157 | 158 | If you are _building_ compiler tools for cross-compiling, you should 159 | use the `--target=TYPE' option to select the type of system they will 160 | produce code for. 161 | 162 | If you want to _use_ a cross compiler, that generates code for a 163 | platform different from the build platform, you should specify the 164 | "host" platform (i.e., that on which the generated programs will 165 | eventually be run) with `--host=TYPE'. 166 | 167 | Sharing Defaults 168 | ================ 169 | 170 | If you want to set default values for `configure' scripts to share, 171 | you can create a site shell script called `config.site' that gives 172 | default values for variables like `CC', `cache_file', and `prefix'. 173 | `configure' looks for `PREFIX/share/config.site' if it exists, then 174 | `PREFIX/etc/config.site' if it exists. Or, you can set the 175 | `CONFIG_SITE' environment variable to the location of the site script. 176 | A warning: not all `configure' scripts look for a site script. 177 | 178 | Defining Variables 179 | ================== 180 | 181 | Variables not defined in a site shell script can be set in the 182 | environment passed to `configure'. However, some packages may run 183 | configure again during the build, and the customized values of these 184 | variables may be lost. In order to avoid this problem, you should set 185 | them in the `configure' command line, using `VAR=value'. For example: 186 | 187 | ./configure CC=/usr/local2/bin/gcc 188 | 189 | will cause the specified gcc to be used as the C compiler (unless it is 190 | overridden in the site shell script). 191 | 192 | `configure' Invocation 193 | ====================== 194 | 195 | `configure' recognizes the following options to control how it 196 | operates. 197 | 198 | `--help' 199 | `-h' 200 | Print a summary of the options to `configure', and exit. 201 | 202 | `--version' 203 | `-V' 204 | Print the version of Autoconf used to generate the `configure' 205 | script, and exit. 206 | 207 | `--cache-file=FILE' 208 | Enable the cache: use and save the results of the tests in FILE, 209 | traditionally `config.cache'. FILE defaults to `/dev/null' to 210 | disable caching. 211 | 212 | `--config-cache' 213 | `-C' 214 | Alias for `--cache-file=config.cache'. 215 | 216 | `--quiet' 217 | `--silent' 218 | `-q' 219 | Do not print messages saying which checks are being made. To 220 | suppress all normal output, redirect it to `/dev/null' (any error 221 | messages will still be shown). 222 | 223 | `--srcdir=DIR' 224 | Look for the package's source code in directory DIR. Usually 225 | `configure' can determine that directory automatically. 226 | 227 | `configure' also accepts some other, not widely useful, options. Run 228 | `configure --help' for more details. 229 | 230 | -------------------------------------------------------------------------------- /missing: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # Common stub for a few missing GNU programs while installing. 3 | 4 | scriptversion=2009-04-28.21; # UTC 5 | 6 | # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, 7 | # 2008, 2009 Free Software Foundation, Inc. 8 | # Originally by Fran,cois Pinard , 1996. 9 | 10 | # This program is free software; you can redistribute it and/or modify 11 | # it under the terms of the GNU General Public License as published by 12 | # the Free Software Foundation; either version 2, or (at your option) 13 | # any later version. 14 | 15 | # This program is distributed in the hope that it will be useful, 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | # GNU General Public License for more details. 19 | 20 | # You should have received a copy of the GNU General Public License 21 | # along with this program. If not, see . 22 | 23 | # As a special exception to the GNU General Public License, if you 24 | # distribute this file as part of a program that contains a 25 | # configuration script generated by Autoconf, you may include it under 26 | # the same distribution terms that you use for the rest of that program. 27 | 28 | if test $# -eq 0; then 29 | echo 1>&2 "Try \`$0 --help' for more information" 30 | exit 1 31 | fi 32 | 33 | run=: 34 | sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' 35 | sed_minuso='s/.* -o \([^ ]*\).*/\1/p' 36 | 37 | # In the cases where this matters, `missing' is being run in the 38 | # srcdir already. 39 | if test -f configure.ac; then 40 | configure_ac=configure.ac 41 | else 42 | configure_ac=configure.in 43 | fi 44 | 45 | msg="missing on your system" 46 | 47 | case $1 in 48 | --run) 49 | # Try to run requested program, and just exit if it succeeds. 50 | run= 51 | shift 52 | "$@" && exit 0 53 | # Exit code 63 means version mismatch. This often happens 54 | # when the user try to use an ancient version of a tool on 55 | # a file that requires a minimum version. In this case we 56 | # we should proceed has if the program had been absent, or 57 | # if --run hadn't been passed. 58 | if test $? = 63; then 59 | run=: 60 | msg="probably too old" 61 | fi 62 | ;; 63 | 64 | -h|--h|--he|--hel|--help) 65 | echo "\ 66 | $0 [OPTION]... PROGRAM [ARGUMENT]... 67 | 68 | Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an 69 | error status if there is no known handling for PROGRAM. 70 | 71 | Options: 72 | -h, --help display this help and exit 73 | -v, --version output version information and exit 74 | --run try to run the given command, and emulate it if it fails 75 | 76 | Supported PROGRAM values: 77 | aclocal touch file \`aclocal.m4' 78 | autoconf touch file \`configure' 79 | autoheader touch file \`config.h.in' 80 | autom4te touch the output file, or create a stub one 81 | automake touch all \`Makefile.in' files 82 | bison create \`y.tab.[ch]', if possible, from existing .[ch] 83 | flex create \`lex.yy.c', if possible, from existing .c 84 | help2man touch the output file 85 | lex create \`lex.yy.c', if possible, from existing .c 86 | makeinfo touch the output file 87 | tar try tar, gnutar, gtar, then tar without non-portable flags 88 | yacc create \`y.tab.[ch]', if possible, from existing .[ch] 89 | 90 | Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and 91 | \`g' are ignored when checking the name. 92 | 93 | Send bug reports to ." 94 | exit $? 95 | ;; 96 | 97 | -v|--v|--ve|--ver|--vers|--versi|--versio|--version) 98 | echo "missing $scriptversion (GNU Automake)" 99 | exit $? 100 | ;; 101 | 102 | -*) 103 | echo 1>&2 "$0: Unknown \`$1' option" 104 | echo 1>&2 "Try \`$0 --help' for more information" 105 | exit 1 106 | ;; 107 | 108 | esac 109 | 110 | # normalize program name to check for. 111 | program=`echo "$1" | sed ' 112 | s/^gnu-//; t 113 | s/^gnu//; t 114 | s/^g//; t'` 115 | 116 | # Now exit if we have it, but it failed. Also exit now if we 117 | # don't have it and --version was passed (most likely to detect 118 | # the program). This is about non-GNU programs, so use $1 not 119 | # $program. 120 | case $1 in 121 | lex*|yacc*) 122 | # Not GNU programs, they don't have --version. 123 | ;; 124 | 125 | tar*) 126 | if test -n "$run"; then 127 | echo 1>&2 "ERROR: \`tar' requires --run" 128 | exit 1 129 | elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 130 | exit 1 131 | fi 132 | ;; 133 | 134 | *) 135 | if test -z "$run" && ($1 --version) > /dev/null 2>&1; then 136 | # We have it, but it failed. 137 | exit 1 138 | elif test "x$2" = "x--version" || test "x$2" = "x--help"; then 139 | # Could not run --version or --help. This is probably someone 140 | # running `$TOOL --version' or `$TOOL --help' to check whether 141 | # $TOOL exists and not knowing $TOOL uses missing. 142 | exit 1 143 | fi 144 | ;; 145 | esac 146 | 147 | # If it does not exist, or fails to run (possibly an outdated version), 148 | # try to emulate it. 149 | case $program in 150 | aclocal*) 151 | echo 1>&2 "\ 152 | WARNING: \`$1' is $msg. You should only need it if 153 | you modified \`acinclude.m4' or \`${configure_ac}'. You might want 154 | to install the \`Automake' and \`Perl' packages. Grab them from 155 | any GNU archive site." 156 | touch aclocal.m4 157 | ;; 158 | 159 | autoconf*) 160 | echo 1>&2 "\ 161 | WARNING: \`$1' is $msg. You should only need it if 162 | you modified \`${configure_ac}'. You might want to install the 163 | \`Autoconf' and \`GNU m4' packages. Grab them from any GNU 164 | archive site." 165 | touch configure 166 | ;; 167 | 168 | autoheader*) 169 | echo 1>&2 "\ 170 | WARNING: \`$1' is $msg. You should only need it if 171 | you modified \`acconfig.h' or \`${configure_ac}'. You might want 172 | to install the \`Autoconf' and \`GNU m4' packages. Grab them 173 | from any GNU archive site." 174 | files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` 175 | test -z "$files" && files="config.h" 176 | touch_files= 177 | for f in $files; do 178 | case $f in 179 | *:*) touch_files="$touch_files "`echo "$f" | 180 | sed -e 's/^[^:]*://' -e 's/:.*//'`;; 181 | *) touch_files="$touch_files $f.in";; 182 | esac 183 | done 184 | touch $touch_files 185 | ;; 186 | 187 | automake*) 188 | echo 1>&2 "\ 189 | WARNING: \`$1' is $msg. You should only need it if 190 | you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. 191 | You might want to install the \`Automake' and \`Perl' packages. 192 | Grab them from any GNU archive site." 193 | find . -type f -name Makefile.am -print | 194 | sed 's/\.am$/.in/' | 195 | while read f; do touch "$f"; done 196 | ;; 197 | 198 | autom4te*) 199 | echo 1>&2 "\ 200 | WARNING: \`$1' is needed, but is $msg. 201 | You might have modified some files without having the 202 | proper tools for further handling them. 203 | You can get \`$1' as part of \`Autoconf' from any GNU 204 | archive site." 205 | 206 | file=`echo "$*" | sed -n "$sed_output"` 207 | test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 208 | if test -f "$file"; then 209 | touch $file 210 | else 211 | test -z "$file" || exec >$file 212 | echo "#! /bin/sh" 213 | echo "# Created by GNU Automake missing as a replacement of" 214 | echo "# $ $@" 215 | echo "exit 0" 216 | chmod +x $file 217 | exit 1 218 | fi 219 | ;; 220 | 221 | bison*|yacc*) 222 | echo 1>&2 "\ 223 | WARNING: \`$1' $msg. You should only need it if 224 | you modified a \`.y' file. You may need the \`Bison' package 225 | in order for those modifications to take effect. You can get 226 | \`Bison' from any GNU archive site." 227 | rm -f y.tab.c y.tab.h 228 | if test $# -ne 1; then 229 | eval LASTARG="\${$#}" 230 | case $LASTARG in 231 | *.y) 232 | SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` 233 | if test -f "$SRCFILE"; then 234 | cp "$SRCFILE" y.tab.c 235 | fi 236 | SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` 237 | if test -f "$SRCFILE"; then 238 | cp "$SRCFILE" y.tab.h 239 | fi 240 | ;; 241 | esac 242 | fi 243 | if test ! -f y.tab.h; then 244 | echo >y.tab.h 245 | fi 246 | if test ! -f y.tab.c; then 247 | echo 'main() { return 0; }' >y.tab.c 248 | fi 249 | ;; 250 | 251 | lex*|flex*) 252 | echo 1>&2 "\ 253 | WARNING: \`$1' is $msg. You should only need it if 254 | you modified a \`.l' file. You may need the \`Flex' package 255 | in order for those modifications to take effect. You can get 256 | \`Flex' from any GNU archive site." 257 | rm -f lex.yy.c 258 | if test $# -ne 1; then 259 | eval LASTARG="\${$#}" 260 | case $LASTARG in 261 | *.l) 262 | SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` 263 | if test -f "$SRCFILE"; then 264 | cp "$SRCFILE" lex.yy.c 265 | fi 266 | ;; 267 | esac 268 | fi 269 | if test ! -f lex.yy.c; then 270 | echo 'main() { return 0; }' >lex.yy.c 271 | fi 272 | ;; 273 | 274 | help2man*) 275 | echo 1>&2 "\ 276 | WARNING: \`$1' is $msg. You should only need it if 277 | you modified a dependency of a manual page. You may need the 278 | \`Help2man' package in order for those modifications to take 279 | effect. You can get \`Help2man' from any GNU archive site." 280 | 281 | file=`echo "$*" | sed -n "$sed_output"` 282 | test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 283 | if test -f "$file"; then 284 | touch $file 285 | else 286 | test -z "$file" || exec >$file 287 | echo ".ab help2man is required to generate this page" 288 | exit $? 289 | fi 290 | ;; 291 | 292 | makeinfo*) 293 | echo 1>&2 "\ 294 | WARNING: \`$1' is $msg. You should only need it if 295 | you modified a \`.texi' or \`.texinfo' file, or any other file 296 | indirectly affecting the aspect of the manual. The spurious 297 | call might also be the consequence of using a buggy \`make' (AIX, 298 | DU, IRIX). You might want to install the \`Texinfo' package or 299 | the \`GNU make' package. Grab either from any GNU archive site." 300 | # The file to touch is that specified with -o ... 301 | file=`echo "$*" | sed -n "$sed_output"` 302 | test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` 303 | if test -z "$file"; then 304 | # ... or it is the one specified with @setfilename ... 305 | infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` 306 | file=`sed -n ' 307 | /^@setfilename/{ 308 | s/.* \([^ ]*\) *$/\1/ 309 | p 310 | q 311 | }' $infile` 312 | # ... or it is derived from the source name (dir/f.texi becomes f.info) 313 | test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info 314 | fi 315 | # If the file does not exist, the user really needs makeinfo; 316 | # let's fail without touching anything. 317 | test -f $file || exit 1 318 | touch $file 319 | ;; 320 | 321 | tar*) 322 | shift 323 | 324 | # We have already tried tar in the generic part. 325 | # Look for gnutar/gtar before invocation to avoid ugly error 326 | # messages. 327 | if (gnutar --version > /dev/null 2>&1); then 328 | gnutar "$@" && exit 0 329 | fi 330 | if (gtar --version > /dev/null 2>&1); then 331 | gtar "$@" && exit 0 332 | fi 333 | firstarg="$1" 334 | if shift; then 335 | case $firstarg in 336 | *o*) 337 | firstarg=`echo "$firstarg" | sed s/o//` 338 | tar "$firstarg" "$@" && exit 0 339 | ;; 340 | esac 341 | case $firstarg in 342 | *h*) 343 | firstarg=`echo "$firstarg" | sed s/h//` 344 | tar "$firstarg" "$@" && exit 0 345 | ;; 346 | esac 347 | fi 348 | 349 | echo 1>&2 "\ 350 | WARNING: I can't seem to be able to run \`tar' with the given arguments. 351 | You may want to install GNU tar or Free paxutils, or check the 352 | command line arguments." 353 | exit 1 354 | ;; 355 | 356 | *) 357 | echo 1>&2 "\ 358 | WARNING: \`$1' is needed, and is $msg. 359 | You might have modified some files without having the 360 | proper tools for further handling them. Check the \`README' file, 361 | it often tells you about the needed prerequisites for installing 362 | this package. You may also peek at any GNU archive site, in case 363 | some other package would contain this missing \`$1' program." 364 | exit 1 365 | ;; 366 | esac 367 | 368 | exit 0 369 | 370 | # Local variables: 371 | # eval: (add-hook 'write-file-hooks 'time-stamp) 372 | # time-stamp-start: "scriptversion=" 373 | # time-stamp-format: "%:y-%02m-%02d.%02H" 374 | # time-stamp-time-zone: "UTC" 375 | # time-stamp-end: "; # UTC" 376 | # End: 377 | -------------------------------------------------------------------------------- /ufi_format.c: -------------------------------------------------------------------------------- 1 | /* 2 | ufiformat Version 0.9.9 2011/01/29 3 | 4 | Copyright (C) 2005-2011 Kazuhiro Hayashi 5 | Copyright (C) 2005 John Floyd 6 | 7 | The method of formatting a floppy on USB-FDD used in this program 8 | is introduced by Bruce M Simpson. 9 | 10 | This program is free software; you can redistribute it and/or 11 | modify it under the terms of the GNU General Public License 12 | as published by the Free Software Foundation; either version 2 13 | of the License, or (at your option) any later version. 14 | 15 | This program is distributed in the hope that it will be useful, 16 | but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | GNU General Public License for more details. 19 | 20 | You should have received a copy of the GNU General Public License 21 | along with this program; if not, write to the Free Software 22 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 23 | */ 24 | 25 | #ifdef HAVE_CONFIG_H 26 | # include "config.h" 27 | #endif 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include "ufi_detect.h" 40 | #include "ufi_command.h" 41 | 42 | #ifndef PACKAGE 43 | #define PACKAGE "ufiformat" 44 | #endif 45 | 46 | static void list_devices(int verbose) 47 | { 48 | struct ufi_path_info *path_info_p; 49 | 50 | if (verbose > 1) { 51 | printf("list usb fdd devices\n"); 52 | } 53 | if (verbose) { 54 | printf("%-12s %-12s\n", "disk", "generic"); 55 | } 56 | if (get_usb_fdds(&path_info_p) < 0) { 57 | goto error; 58 | } 59 | while (path_info_p != NULL) { 60 | if (path_info_p->sd_path != NULL || path_info_p->sg_path != NULL) { 61 | printf("%-12s %-12s\n", 62 | path_info_p->sd_path != NULL ? path_info_p->sd_path : "", 63 | path_info_p->sg_path != NULL ? path_info_p->sg_path : ""); 64 | } else { 65 | if (verbose > 1) { 66 | printf("ignoreing unattached fdd: host_id = %d\n", path_info_p->host_id); 67 | } 68 | } 69 | path_info_p = path_info_p->next; 70 | } 71 | return; 72 | 73 | error: 74 | perror(""); 75 | exit(1); 76 | } 77 | 78 | static void show_capacity(const char *status, int blocks, int block_size) 79 | { 80 | printf("%-12s %4d %4d %4d\n", status, blocks, block_size, blocks * block_size / 1024); 81 | } 82 | 83 | #define IS_2HD(size) ((size) > 1024 ? 1 : 0) 84 | 85 | static void inquire(const char *path, int verbose, int force) 86 | { 87 | char *sg = NULL; 88 | int fd = -1; 89 | struct ufi_product *product; 90 | struct ufi_capacities *capacities; 91 | int type; 92 | int wp; 93 | int is_fdd; 94 | 95 | if (verbose > 1) { 96 | printf("inquire on device=%s\n", path); 97 | } 98 | if (!force) { 99 | if ((is_fdd = is_usb_fdd(path)) < 0) { 100 | goto error; 101 | } 102 | if (!is_fdd) { 103 | fprintf(stderr, "%s: device is not usb fdd\n", path); 104 | goto error2; 105 | } 106 | sg = malloc(PATH_MAX); 107 | if (convert_to_sg_path(path, sg, PATH_MAX)) { 108 | if (verbose > 1 && errno == -ENOENT) { 109 | fprintf(stderr, "\"modprobe sg\" might be needed to prepare SCSI pass-thru device.\n"); 110 | } 111 | sg = errno < 0 ? "/dev/sg* family" : NULL; 112 | errno = errno < 0 ? -errno : errno; 113 | goto error; 114 | } 115 | } else { 116 | sg = strdup(path); 117 | } 118 | if ((fd = open(sg, O_RDWR | O_NONBLOCK)) < 0) { 119 | goto error; 120 | } 121 | if (ufi_test_unit_ready(fd) == UFI_ERROR && !force) { 122 | goto error; 123 | } 124 | if ((capacities = ufi_read_format_capacities(fd, &type)) == NULL) { 125 | goto error; 126 | } 127 | if (type == UFI_UNFORMATTED_MEDIA || type == UFI_FORMATTED_MEDIA) { 128 | if (ufi_mode_sense(fd, &wp) != UFI_GOOD) { 129 | goto error; 130 | } 131 | } 132 | if ((product = ufi_inquiry(fd)) == NULL) { 133 | goto error; 134 | } 135 | 136 | if (verbose) { 137 | printf("vendor: %s\n", product->vendor); 138 | printf("product: %s\n", product->product); 139 | if (type == UFI_UNFORMATTED_MEDIA || type == UFI_FORMATTED_MEDIA) { 140 | printf("write protect: %s\n", wp == UFI_PROTECTED ? "on" : "off"); 141 | printf("media type: %s\n", IS_2HD(capacities->blocks * capacities->block_size / 1024) ? "2HD" : "2DD"); 142 | } 143 | printf("status block size kb\n"); 144 | } 145 | switch (type) { 146 | case UFI_UNFORMATTED_MEDIA: 147 | show_capacity("unformatted", capacities->blocks, capacities->block_size); 148 | break; 149 | case UFI_FORMATTED_MEDIA: 150 | show_capacity("formatted", capacities->blocks, capacities->block_size); 151 | while (capacities->next != NULL) { 152 | capacities = capacities->next; 153 | show_capacity("formattable", capacities->blocks, capacities->block_size); 154 | } 155 | break; 156 | case UFI_NO_MEDIA: 157 | show_capacity("no", capacities->blocks, capacities->block_size); 158 | break; 159 | default: 160 | errno = EPROTO; 161 | goto error; 162 | } 163 | close(fd); 164 | return; 165 | 166 | error: 167 | perror(sg == NULL ? path : sg); 168 | error2: 169 | if (fd >= 0) { 170 | close(fd); 171 | } 172 | exit(1); 173 | } 174 | 175 | static const int geometry[][5] = { 176 | { 1440, 80, 2, 18, 512 }, 177 | { 1232, 77, 2, 8, 1024 }, 178 | { 1200, 80, 2, 15, 512 }, 179 | { 720, 80, 2, 9, 512 }, 180 | { 640, 80, 2, 8, 512 }, 181 | { 0, 0, 0, 0 } 182 | }; 183 | 184 | static int size_to_geometry(int size, int *track, int *head, int *sector, int *block) 185 | { 186 | int i; 187 | 188 | for (i = 0; geometry[i][0] != 0; i++) { 189 | if (geometry[i][0] == size) { 190 | *track = geometry[i][1]; 191 | *head = geometry[i][2]; 192 | *sector = geometry[i][3]; 193 | *block = geometry[i][4]; 194 | return 0; 195 | } 196 | } 197 | return 1; 198 | } 199 | 200 | static void format(const char *path, int size, int verify, int verbose, int force) 201 | { 202 | char *sg = NULL; 203 | int fd = -1; 204 | int wp; 205 | struct ufi_capacities *capacities; 206 | int type; 207 | int track, head, sector, block, t, h; 208 | int mount_flags; 209 | int is_fdd; 210 | int need_reset = force; 211 | char *buf = NULL; 212 | char c; 213 | int i, n; 214 | time_t tt; 215 | 216 | if (verbose > 1) { 217 | printf("format on device=%s, size=%d\n", path, size); 218 | } 219 | if (!force) { 220 | if ((is_fdd = is_usb_fdd(path)) < 0) { 221 | goto error; 222 | } 223 | if (!is_fdd) { 224 | fprintf(stderr, "%s: device is not usb fdd\n", path); 225 | goto error2; 226 | } 227 | sg = malloc(PATH_MAX); 228 | if (convert_to_sd_path(path, sg, PATH_MAX) < 0) { 229 | sg = errno < 0 ? "/dev/sd* family" : NULL; 230 | errno = errno < 0 ? -errno : errno; 231 | goto error; 232 | } 233 | if (ext2fs_check_if_mounted(sg, &mount_flags) != 0) { 234 | goto error; 235 | } 236 | if (mount_flags & EXT2_MF_MOUNTED) { 237 | fprintf(stderr, "%s: device is mounted\n", sg); 238 | goto error2; 239 | } 240 | if (convert_to_sg_path(path, sg, PATH_MAX) < 0) { 241 | if (verbose > 1 && errno == -ENOENT) { 242 | fprintf(stderr, "\"modprobe sg\" might be needed to prepare SCSI pass-thru device.\n"); 243 | } 244 | sg = errno < 0 ? "/dev/sg* family" : NULL; 245 | errno = errno < 0 ? -errno : errno; 246 | goto error; 247 | } 248 | } else { 249 | sg = strdup(path); 250 | } 251 | if ((fd = open(sg, O_RDWR | O_NONBLOCK)) < 0) { 252 | goto error; 253 | } 254 | if ((type = ufi_test_unit_ready(fd)) == UFI_ERROR && !force) { 255 | goto error; 256 | } 257 | if (!force) { 258 | if (type == UFI_NO_MEDIA) { 259 | fprintf(stderr, "%s: no media\n", path); 260 | goto error2; 261 | } 262 | if (ufi_mode_sense(fd, &wp) != UFI_GOOD) { 263 | goto error; 264 | } 265 | if (wp == UFI_PROTECTED) { 266 | fprintf(stderr, "%s: write protected\n", path); 267 | goto error2; 268 | } 269 | } 270 | if (size == 0) { 271 | if ((capacities = ufi_read_format_capacities(fd, &type)) == NULL) { 272 | goto error; 273 | } 274 | size = (capacities->blocks * capacities->block_size) / 1024; 275 | if (type != UFI_FORMATTED_MEDIA) { 276 | need_reset = 1; 277 | } 278 | if (size_to_geometry(size, &track, &head, §or, &block) != 0 || block != capacities->block_size) { 279 | fprintf(stderr, "unable to figure out geometry for current media\n"); 280 | goto error2; 281 | } 282 | } else { 283 | if (size_to_geometry(size, &track, &head, §or, &block) != 0) { 284 | fprintf(stderr, "unable to figure out geometry for size=%d\n", size); 285 | goto error2; 286 | } 287 | if (!force) { 288 | if ((capacities = ufi_read_format_capacities(fd, &type)) == NULL) { 289 | goto error; 290 | } 291 | if (type == UFI_NO_MEDIA) { 292 | fprintf(stderr, "%s: no media\n", path); 293 | goto error2; 294 | } 295 | if (IS_2HD(capacities->blocks * capacities->block_size / 1024) != IS_2HD(size)) { 296 | fprintf(stderr, "%s: media type mismatch\n", path); 297 | goto error2; 298 | } 299 | need_reset = (type != UFI_FORMATTED_MEDIA) || (capacities->blocks * capacities->block_size / 1024 != size); 300 | } 301 | } 302 | if (verbose) { 303 | printf("geometry: track=%d, head=%d, sector=%d, block=%d\n", track, head, sector, block); 304 | } 305 | for (t = 0; t < track; t++) { 306 | for (h = 0; h < head; h++) { 307 | if (verbose) { 308 | printf("formatting track=%02d, head=%d\r", t, h); 309 | fflush(stdout); 310 | } 311 | if (ufi_format_unit(fd, track * head * sector, block, t, h) != UFI_GOOD) { 312 | goto error; 313 | } 314 | } 315 | } 316 | if (need_reset) { 317 | if (ufi_reset(fd) != UFI_GOOD) { 318 | goto error; 319 | } 320 | } 321 | close(fd); 322 | fd = -1; 323 | 324 | if (verify) { 325 | sg = realloc(sg, PATH_MAX); 326 | if (convert_to_sd_path(path, sg, PATH_MAX) < 0) { 327 | sg = errno < 0 ? "/dev/sd* family" : NULL; 328 | errno = errno < 0 ? -errno : errno; 329 | goto error; 330 | } 331 | tt = time(NULL); 332 | // some devices need retry 333 | while ((fd = open(sg, O_RDONLY)) < 0 && errno == ENOMEDIUM && time(NULL) - tt < 10) { 334 | sleep(1); 335 | } 336 | if (fd < 0) { 337 | goto error; 338 | } 339 | buf = malloc(sector * block); 340 | for (t = 0; t < track; t++) { 341 | for (h = 0; h < head; h++) { 342 | if (verbose) { 343 | printf("verifying track=%02d, head=%d\r", t, h); 344 | fflush(stdout); 345 | } 346 | if ((n = read(fd, buf, sector * block)) != sector * block) { 347 | if (n < 0) { 348 | goto error; 349 | } 350 | fprintf(stderr, "%s: short read from floppy disk on verification\n", sg); 351 | goto error2; 352 | } 353 | if (t == 0 && h == 0) { 354 | c = buf[0]; // normally 0xe5 355 | } 356 | for (i = 0; i < sector * block; i++) { 357 | if (buf[i] != c) { 358 | fprintf(stderr, "%s: bad value in floppy disk on verification\n", sg); 359 | goto error2; 360 | } 361 | } 362 | } 363 | } 364 | } 365 | if (verbose) { 366 | printf("done \n"); 367 | } 368 | return; 369 | 370 | error: 371 | perror(sg == NULL ? path : sg); 372 | error2: 373 | if (fd >= 0) { 374 | close(fd); 375 | } 376 | exit(1); 377 | } 378 | 379 | static void usage(int exit_code) 380 | { 381 | fputs( 382 | "Usage: " PACKAGE " [OPTION]... [DEVICE]\n" 383 | "Format a floppy disk in a USB floppy disk DEVICE.\n" 384 | "\n" 385 | " -f, --format [SIZE] specify format capacity SIZE in KB\n" 386 | " without -f option, the format of the current media will be used\n" 387 | " -V, --verify verify the medium after formatting\n" 388 | " -F, --force do not perform any safety checks\n" 389 | " -i, --inquire show device information, instead of performing format\n" 390 | " without DEVICE argument, list USB floppy disk devices\n" 391 | " -v, --verbose show detailed output\n" 392 | " -q, --quiet suppress minor output\n" 393 | " -h, --help show this message\n" 394 | "\n", 395 | exit_code == 0 ? stdout : stderr); 396 | exit(exit_code); 397 | } 398 | 399 | static const struct option long_options[] = { 400 | { "inquire", no_argument, 0, 'i' }, 401 | { "format", required_argument, 0, 'f' }, 402 | { "verify", no_argument, 0, 'V' }, 403 | { "force", no_argument, 0, 'F' }, 404 | { "verbose", no_argument, 0, 'v' }, 405 | { "quiet", no_argument, 0, 'q' }, 406 | { "help", no_argument, 0, 'h' }, 407 | { 0, 0, 0, 0 } 408 | }; 409 | 410 | static const char short_options[] = "if:VFvqh"; 411 | 412 | int main(int argc, char **argv) 413 | { 414 | int c; 415 | int opt_inquire = 0; 416 | int opt_format = 0; 417 | int opt_verify = 0; 418 | int opt_force = 0; 419 | int opt_verbose = 1; 420 | int format_size = 0; 421 | char tmp[256]; 422 | 423 | while ((c = getopt_long(argc, argv, short_options, long_options, NULL)) != -1) { 424 | switch (c) { 425 | case 'i': 426 | opt_inquire = 1; 427 | break; 428 | case 'f': 429 | opt_format = 1; 430 | format_size = atoi(optarg); 431 | sprintf(tmp, "%d", format_size); 432 | if (strcmp(optarg, tmp) != 0 || format_size < 0) { 433 | printf("format parameter should be numeric\n"); 434 | usage(1); 435 | } 436 | break; 437 | case 'V': 438 | opt_verify = 1; 439 | break; 440 | case 'F': 441 | opt_force = 1; 442 | break; 443 | case 'v': 444 | opt_verbose = 2; 445 | break; 446 | case 'q': 447 | opt_verbose = 0; 448 | break; 449 | case 'h': 450 | usage(0); 451 | break; 452 | case '?': 453 | default: 454 | usage(1); 455 | } 456 | } 457 | 458 | if (!opt_inquire && !opt_format) { 459 | opt_format = 1; 460 | format_size = 0; 461 | } 462 | if (opt_format && opt_inquire) { 463 | fprintf(stderr, "%s: both inquire and format options specified\n", argv[0]); 464 | usage(1); 465 | } else if ((opt_format || opt_inquire) && argc - optind > 1) { 466 | fprintf(stderr, "%s: two or more devices specified\n", argv[0]); 467 | usage(1); 468 | } else if (opt_format && argc == optind) { 469 | fprintf(stderr, "%s: no device specified\n", argv[0]); 470 | usage(1); 471 | } 472 | 473 | ufi_set_verbose(opt_verbose); 474 | if (opt_inquire) { 475 | if (argc == optind) { 476 | list_devices(opt_verbose); 477 | } else { 478 | inquire(argv[optind], opt_verbose, opt_force); 479 | } 480 | } else if (opt_format) { 481 | format(argv[optind], format_size, opt_verify, opt_verbose, opt_force); 482 | } 483 | exit(0); 484 | } 485 | -------------------------------------------------------------------------------- /install-sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # install - install a program, script, or datafile 3 | 4 | scriptversion=2009-04-28.21; # UTC 5 | 6 | # This originates from X11R5 (mit/util/scripts/install.sh), which was 7 | # later released in X11R6 (xc/config/util/install.sh) with the 8 | # following copyright and license. 9 | # 10 | # Copyright (C) 1994 X Consortium 11 | # 12 | # Permission is hereby granted, free of charge, to any person obtaining a copy 13 | # of this software and associated documentation files (the "Software"), to 14 | # deal in the Software without restriction, including without limitation the 15 | # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or 16 | # sell copies of the Software, and to permit persons to whom the Software is 17 | # furnished to do so, subject to the following conditions: 18 | # 19 | # The above copyright notice and this permission notice shall be included in 20 | # all copies or substantial portions of the Software. 21 | # 22 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 23 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 24 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 25 | # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 26 | # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- 27 | # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28 | # 29 | # Except as contained in this notice, the name of the X Consortium shall not 30 | # be used in advertising or otherwise to promote the sale, use or other deal- 31 | # ings in this Software without prior written authorization from the X Consor- 32 | # tium. 33 | # 34 | # 35 | # FSF changes to this file are in the public domain. 36 | # 37 | # Calling this script install-sh is preferred over install.sh, to prevent 38 | # `make' implicit rules from creating a file called install from it 39 | # when there is no Makefile. 40 | # 41 | # This script is compatible with the BSD install script, but was written 42 | # from scratch. 43 | 44 | nl=' 45 | ' 46 | IFS=" "" $nl" 47 | 48 | # set DOITPROG to echo to test this script 49 | 50 | # Don't use :- since 4.3BSD and earlier shells don't like it. 51 | doit=${DOITPROG-} 52 | if test -z "$doit"; then 53 | doit_exec=exec 54 | else 55 | doit_exec=$doit 56 | fi 57 | 58 | # Put in absolute file names if you don't have them in your path; 59 | # or use environment vars. 60 | 61 | chgrpprog=${CHGRPPROG-chgrp} 62 | chmodprog=${CHMODPROG-chmod} 63 | chownprog=${CHOWNPROG-chown} 64 | cmpprog=${CMPPROG-cmp} 65 | cpprog=${CPPROG-cp} 66 | mkdirprog=${MKDIRPROG-mkdir} 67 | mvprog=${MVPROG-mv} 68 | rmprog=${RMPROG-rm} 69 | stripprog=${STRIPPROG-strip} 70 | 71 | posix_glob='?' 72 | initialize_posix_glob=' 73 | test "$posix_glob" != "?" || { 74 | if (set -f) 2>/dev/null; then 75 | posix_glob= 76 | else 77 | posix_glob=: 78 | fi 79 | } 80 | ' 81 | 82 | posix_mkdir= 83 | 84 | # Desired mode of installed file. 85 | mode=0755 86 | 87 | chgrpcmd= 88 | chmodcmd=$chmodprog 89 | chowncmd= 90 | mvcmd=$mvprog 91 | rmcmd="$rmprog -f" 92 | stripcmd= 93 | 94 | src= 95 | dst= 96 | dir_arg= 97 | dst_arg= 98 | 99 | copy_on_change=false 100 | no_target_directory= 101 | 102 | usage="\ 103 | Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE 104 | or: $0 [OPTION]... SRCFILES... DIRECTORY 105 | or: $0 [OPTION]... -t DIRECTORY SRCFILES... 106 | or: $0 [OPTION]... -d DIRECTORIES... 107 | 108 | In the 1st form, copy SRCFILE to DSTFILE. 109 | In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. 110 | In the 4th, create DIRECTORIES. 111 | 112 | Options: 113 | --help display this help and exit. 114 | --version display version info and exit. 115 | 116 | -c (ignored) 117 | -C install only if different (preserve the last data modification time) 118 | -d create directories instead of installing files. 119 | -g GROUP $chgrpprog installed files to GROUP. 120 | -m MODE $chmodprog installed files to MODE. 121 | -o USER $chownprog installed files to USER. 122 | -s $stripprog installed files. 123 | -t DIRECTORY install into DIRECTORY. 124 | -T report an error if DSTFILE is a directory. 125 | 126 | Environment variables override the default commands: 127 | CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG 128 | RMPROG STRIPPROG 129 | " 130 | 131 | while test $# -ne 0; do 132 | case $1 in 133 | -c) ;; 134 | 135 | -C) copy_on_change=true;; 136 | 137 | -d) dir_arg=true;; 138 | 139 | -g) chgrpcmd="$chgrpprog $2" 140 | shift;; 141 | 142 | --help) echo "$usage"; exit $?;; 143 | 144 | -m) mode=$2 145 | case $mode in 146 | *' '* | *' '* | *' 147 | '* | *'*'* | *'?'* | *'['*) 148 | echo "$0: invalid mode: $mode" >&2 149 | exit 1;; 150 | esac 151 | shift;; 152 | 153 | -o) chowncmd="$chownprog $2" 154 | shift;; 155 | 156 | -s) stripcmd=$stripprog;; 157 | 158 | -t) dst_arg=$2 159 | shift;; 160 | 161 | -T) no_target_directory=true;; 162 | 163 | --version) echo "$0 $scriptversion"; exit $?;; 164 | 165 | --) shift 166 | break;; 167 | 168 | -*) echo "$0: invalid option: $1" >&2 169 | exit 1;; 170 | 171 | *) break;; 172 | esac 173 | shift 174 | done 175 | 176 | if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then 177 | # When -d is used, all remaining arguments are directories to create. 178 | # When -t is used, the destination is already specified. 179 | # Otherwise, the last argument is the destination. Remove it from $@. 180 | for arg 181 | do 182 | if test -n "$dst_arg"; then 183 | # $@ is not empty: it contains at least $arg. 184 | set fnord "$@" "$dst_arg" 185 | shift # fnord 186 | fi 187 | shift # arg 188 | dst_arg=$arg 189 | done 190 | fi 191 | 192 | if test $# -eq 0; then 193 | if test -z "$dir_arg"; then 194 | echo "$0: no input file specified." >&2 195 | exit 1 196 | fi 197 | # It's OK to call `install-sh -d' without argument. 198 | # This can happen when creating conditional directories. 199 | exit 0 200 | fi 201 | 202 | if test -z "$dir_arg"; then 203 | trap '(exit $?); exit' 1 2 13 15 204 | 205 | # Set umask so as not to create temps with too-generous modes. 206 | # However, 'strip' requires both read and write access to temps. 207 | case $mode in 208 | # Optimize common cases. 209 | *644) cp_umask=133;; 210 | *755) cp_umask=22;; 211 | 212 | *[0-7]) 213 | if test -z "$stripcmd"; then 214 | u_plus_rw= 215 | else 216 | u_plus_rw='% 200' 217 | fi 218 | cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; 219 | *) 220 | if test -z "$stripcmd"; then 221 | u_plus_rw= 222 | else 223 | u_plus_rw=,u+rw 224 | fi 225 | cp_umask=$mode$u_plus_rw;; 226 | esac 227 | fi 228 | 229 | for src 230 | do 231 | # Protect names starting with `-'. 232 | case $src in 233 | -*) src=./$src;; 234 | esac 235 | 236 | if test -n "$dir_arg"; then 237 | dst=$src 238 | dstdir=$dst 239 | test -d "$dstdir" 240 | dstdir_status=$? 241 | else 242 | 243 | # Waiting for this to be detected by the "$cpprog $src $dsttmp" command 244 | # might cause directories to be created, which would be especially bad 245 | # if $src (and thus $dsttmp) contains '*'. 246 | if test ! -f "$src" && test ! -d "$src"; then 247 | echo "$0: $src does not exist." >&2 248 | exit 1 249 | fi 250 | 251 | if test -z "$dst_arg"; then 252 | echo "$0: no destination specified." >&2 253 | exit 1 254 | fi 255 | 256 | dst=$dst_arg 257 | # Protect names starting with `-'. 258 | case $dst in 259 | -*) dst=./$dst;; 260 | esac 261 | 262 | # If destination is a directory, append the input filename; won't work 263 | # if double slashes aren't ignored. 264 | if test -d "$dst"; then 265 | if test -n "$no_target_directory"; then 266 | echo "$0: $dst_arg: Is a directory" >&2 267 | exit 1 268 | fi 269 | dstdir=$dst 270 | dst=$dstdir/`basename "$src"` 271 | dstdir_status=0 272 | else 273 | # Prefer dirname, but fall back on a substitute if dirname fails. 274 | dstdir=` 275 | (dirname "$dst") 2>/dev/null || 276 | expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ 277 | X"$dst" : 'X\(//\)[^/]' \| \ 278 | X"$dst" : 'X\(//\)$' \| \ 279 | X"$dst" : 'X\(/\)' \| . 2>/dev/null || 280 | echo X"$dst" | 281 | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ 282 | s//\1/ 283 | q 284 | } 285 | /^X\(\/\/\)[^/].*/{ 286 | s//\1/ 287 | q 288 | } 289 | /^X\(\/\/\)$/{ 290 | s//\1/ 291 | q 292 | } 293 | /^X\(\/\).*/{ 294 | s//\1/ 295 | q 296 | } 297 | s/.*/./; q' 298 | ` 299 | 300 | test -d "$dstdir" 301 | dstdir_status=$? 302 | fi 303 | fi 304 | 305 | obsolete_mkdir_used=false 306 | 307 | if test $dstdir_status != 0; then 308 | case $posix_mkdir in 309 | '') 310 | # Create intermediate dirs using mode 755 as modified by the umask. 311 | # This is like FreeBSD 'install' as of 1997-10-28. 312 | umask=`umask` 313 | case $stripcmd.$umask in 314 | # Optimize common cases. 315 | *[2367][2367]) mkdir_umask=$umask;; 316 | .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; 317 | 318 | *[0-7]) 319 | mkdir_umask=`expr $umask + 22 \ 320 | - $umask % 100 % 40 + $umask % 20 \ 321 | - $umask % 10 % 4 + $umask % 2 322 | `;; 323 | *) mkdir_umask=$umask,go-w;; 324 | esac 325 | 326 | # With -d, create the new directory with the user-specified mode. 327 | # Otherwise, rely on $mkdir_umask. 328 | if test -n "$dir_arg"; then 329 | mkdir_mode=-m$mode 330 | else 331 | mkdir_mode= 332 | fi 333 | 334 | posix_mkdir=false 335 | case $umask in 336 | *[123567][0-7][0-7]) 337 | # POSIX mkdir -p sets u+wx bits regardless of umask, which 338 | # is incompatible with FreeBSD 'install' when (umask & 300) != 0. 339 | ;; 340 | *) 341 | tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ 342 | trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 343 | 344 | if (umask $mkdir_umask && 345 | exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 346 | then 347 | if test -z "$dir_arg" || { 348 | # Check for POSIX incompatibilities with -m. 349 | # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or 350 | # other-writeable bit of parent directory when it shouldn't. 351 | # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. 352 | ls_ld_tmpdir=`ls -ld "$tmpdir"` 353 | case $ls_ld_tmpdir in 354 | d????-?r-*) different_mode=700;; 355 | d????-?--*) different_mode=755;; 356 | *) false;; 357 | esac && 358 | $mkdirprog -m$different_mode -p -- "$tmpdir" && { 359 | ls_ld_tmpdir_1=`ls -ld "$tmpdir"` 360 | test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" 361 | } 362 | } 363 | then posix_mkdir=: 364 | fi 365 | rmdir "$tmpdir/d" "$tmpdir" 366 | else 367 | # Remove any dirs left behind by ancient mkdir implementations. 368 | rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null 369 | fi 370 | trap '' 0;; 371 | esac;; 372 | esac 373 | 374 | if 375 | $posix_mkdir && ( 376 | umask $mkdir_umask && 377 | $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" 378 | ) 379 | then : 380 | else 381 | 382 | # The umask is ridiculous, or mkdir does not conform to POSIX, 383 | # or it failed possibly due to a race condition. Create the 384 | # directory the slow way, step by step, checking for races as we go. 385 | 386 | case $dstdir in 387 | /*) prefix='/';; 388 | -*) prefix='./';; 389 | *) prefix='';; 390 | esac 391 | 392 | eval "$initialize_posix_glob" 393 | 394 | oIFS=$IFS 395 | IFS=/ 396 | $posix_glob set -f 397 | set fnord $dstdir 398 | shift 399 | $posix_glob set +f 400 | IFS=$oIFS 401 | 402 | prefixes= 403 | 404 | for d 405 | do 406 | test -z "$d" && continue 407 | 408 | prefix=$prefix$d 409 | if test -d "$prefix"; then 410 | prefixes= 411 | else 412 | if $posix_mkdir; then 413 | (umask=$mkdir_umask && 414 | $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break 415 | # Don't fail if two instances are running concurrently. 416 | test -d "$prefix" || exit 1 417 | else 418 | case $prefix in 419 | *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; 420 | *) qprefix=$prefix;; 421 | esac 422 | prefixes="$prefixes '$qprefix'" 423 | fi 424 | fi 425 | prefix=$prefix/ 426 | done 427 | 428 | if test -n "$prefixes"; then 429 | # Don't fail if two instances are running concurrently. 430 | (umask $mkdir_umask && 431 | eval "\$doit_exec \$mkdirprog $prefixes") || 432 | test -d "$dstdir" || exit 1 433 | obsolete_mkdir_used=true 434 | fi 435 | fi 436 | fi 437 | 438 | if test -n "$dir_arg"; then 439 | { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && 440 | { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && 441 | { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || 442 | test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 443 | else 444 | 445 | # Make a couple of temp file names in the proper directory. 446 | dsttmp=$dstdir/_inst.$$_ 447 | rmtmp=$dstdir/_rm.$$_ 448 | 449 | # Trap to clean up those temp files at exit. 450 | trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 451 | 452 | # Copy the file name to the temp name. 453 | (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && 454 | 455 | # and set any options; do chmod last to preserve setuid bits. 456 | # 457 | # If any of these fail, we abort the whole thing. If we want to 458 | # ignore errors from any of these, just make sure not to ignore 459 | # errors from the above "$doit $cpprog $src $dsttmp" command. 460 | # 461 | { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && 462 | { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && 463 | { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && 464 | { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && 465 | 466 | # If -C, don't bother to copy if it wouldn't change the file. 467 | if $copy_on_change && 468 | old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && 469 | new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && 470 | 471 | eval "$initialize_posix_glob" && 472 | $posix_glob set -f && 473 | set X $old && old=:$2:$4:$5:$6 && 474 | set X $new && new=:$2:$4:$5:$6 && 475 | $posix_glob set +f && 476 | 477 | test "$old" = "$new" && 478 | $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 479 | then 480 | rm -f "$dsttmp" 481 | else 482 | # Rename the file to the real destination. 483 | $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || 484 | 485 | # The rename failed, perhaps because mv can't rename something else 486 | # to itself, or perhaps because mv is so ancient that it does not 487 | # support -f. 488 | { 489 | # Now remove or move aside any old file at destination location. 490 | # We try this two ways since rm can't unlink itself on some 491 | # systems and the destination file might be busy for other 492 | # reasons. In this case, the final cleanup might fail but the new 493 | # file should still install successfully. 494 | { 495 | test ! -f "$dst" || 496 | $doit $rmcmd -f "$dst" 2>/dev/null || 497 | { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && 498 | { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } 499 | } || 500 | { echo "$0: cannot unlink or rename $dst" >&2 501 | (exit 1); exit 1 502 | } 503 | } && 504 | 505 | # Now rename the file to the real destination. 506 | $doit $mvcmd "$dsttmp" "$dst" 507 | } 508 | fi || exit 1 509 | 510 | trap '' 0 511 | fi 512 | done 513 | 514 | # Local variables: 515 | # eval: (add-hook 'write-file-hooks 'time-stamp) 516 | # time-stamp-start: "scriptversion=" 517 | # time-stamp-format: "%:y-%02m-%02d.%02H" 518 | # time-stamp-time-zone: "UTC" 519 | # time-stamp-end: "; # UTC" 520 | # End: 521 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc. 5 | 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Library General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License 307 | along with this program; if not, write to the Free Software 308 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 309 | 310 | 311 | Also add information on how to contact you by electronic and paper mail. 312 | 313 | If the program is interactive, make it output a short notice like this 314 | when it starts in an interactive mode: 315 | 316 | Gnomovision version 69, Copyright (C) year name of author 317 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 318 | This is free software, and you are welcome to redistribute it 319 | under certain conditions; type `show c' for details. 320 | 321 | The hypothetical commands `show w' and `show c' should show the appropriate 322 | parts of the General Public License. Of course, the commands you use may 323 | be called something other than `show w' and `show c'; they could even be 324 | mouse-clicks or menu items--whatever suits your program. 325 | 326 | You should also get your employer (if you work as a programmer) or your 327 | school, if any, to sign a "copyright disclaimer" for the program, if 328 | necessary. Here is a sample; alter the names: 329 | 330 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 331 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 332 | 333 | , 1 April 1989 334 | Ty Coon, President of Vice 335 | 336 | This General Public License does not permit incorporating your program into 337 | proprietary programs. If your program is a subroutine library, you may 338 | consider it more useful to permit linking proprietary applications with the 339 | library. If this is what you want to do, use the GNU Library General 340 | Public License instead of this License. 341 | -------------------------------------------------------------------------------- /depcomp: -------------------------------------------------------------------------------- 1 | #! /bin/sh 2 | # depcomp - compile a program generating dependencies as side-effects 3 | 4 | scriptversion=2009-04-28.21; # UTC 5 | 6 | # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free 7 | # Software Foundation, Inc. 8 | 9 | # This program is free software; you can redistribute it and/or modify 10 | # it under the terms of the GNU General Public License as published by 11 | # the Free Software Foundation; either version 2, or (at your option) 12 | # any later version. 13 | 14 | # This program is distributed in the hope that it will be useful, 15 | # but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | # GNU General Public License for more details. 18 | 19 | # You should have received a copy of the GNU General Public License 20 | # along with this program. If not, see . 21 | 22 | # As a special exception to the GNU General Public License, if you 23 | # distribute this file as part of a program that contains a 24 | # configuration script generated by Autoconf, you may include it under 25 | # the same distribution terms that you use for the rest of that program. 26 | 27 | # Originally written by Alexandre Oliva . 28 | 29 | case $1 in 30 | '') 31 | echo "$0: No command. Try \`$0 --help' for more information." 1>&2 32 | exit 1; 33 | ;; 34 | -h | --h*) 35 | cat <<\EOF 36 | Usage: depcomp [--help] [--version] PROGRAM [ARGS] 37 | 38 | Run PROGRAMS ARGS to compile a file, generating dependencies 39 | as side-effects. 40 | 41 | Environment variables: 42 | depmode Dependency tracking mode. 43 | source Source file read by `PROGRAMS ARGS'. 44 | object Object file output by `PROGRAMS ARGS'. 45 | DEPDIR directory where to store dependencies. 46 | depfile Dependency file to output. 47 | tmpdepfile Temporary file to use when outputing dependencies. 48 | libtool Whether libtool is used (yes/no). 49 | 50 | Report bugs to . 51 | EOF 52 | exit $? 53 | ;; 54 | -v | --v*) 55 | echo "depcomp $scriptversion" 56 | exit $? 57 | ;; 58 | esac 59 | 60 | if test -z "$depmode" || test -z "$source" || test -z "$object"; then 61 | echo "depcomp: Variables source, object and depmode must be set" 1>&2 62 | exit 1 63 | fi 64 | 65 | # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. 66 | depfile=${depfile-`echo "$object" | 67 | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} 68 | tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} 69 | 70 | rm -f "$tmpdepfile" 71 | 72 | # Some modes work just like other modes, but use different flags. We 73 | # parameterize here, but still list the modes in the big case below, 74 | # to make depend.m4 easier to write. Note that we *cannot* use a case 75 | # here, because this file can only contain one case statement. 76 | if test "$depmode" = hp; then 77 | # HP compiler uses -M and no extra arg. 78 | gccflag=-M 79 | depmode=gcc 80 | fi 81 | 82 | if test "$depmode" = dashXmstdout; then 83 | # This is just like dashmstdout with a different argument. 84 | dashmflag=-xM 85 | depmode=dashmstdout 86 | fi 87 | 88 | cygpath_u="cygpath -u -f -" 89 | if test "$depmode" = msvcmsys; then 90 | # This is just like msvisualcpp but w/o cygpath translation. 91 | # Just convert the backslash-escaped backslashes to single forward 92 | # slashes to satisfy depend.m4 93 | cygpath_u="sed s,\\\\\\\\,/,g" 94 | depmode=msvisualcpp 95 | fi 96 | 97 | case "$depmode" in 98 | gcc3) 99 | ## gcc 3 implements dependency tracking that does exactly what 100 | ## we want. Yay! Note: for some reason libtool 1.4 doesn't like 101 | ## it if -MD -MP comes after the -MF stuff. Hmm. 102 | ## Unfortunately, FreeBSD c89 acceptance of flags depends upon 103 | ## the command line argument order; so add the flags where they 104 | ## appear in depend2.am. Note that the slowdown incurred here 105 | ## affects only configure: in makefiles, %FASTDEP% shortcuts this. 106 | for arg 107 | do 108 | case $arg in 109 | -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; 110 | *) set fnord "$@" "$arg" ;; 111 | esac 112 | shift # fnord 113 | shift # $arg 114 | done 115 | "$@" 116 | stat=$? 117 | if test $stat -eq 0; then : 118 | else 119 | rm -f "$tmpdepfile" 120 | exit $stat 121 | fi 122 | mv "$tmpdepfile" "$depfile" 123 | ;; 124 | 125 | gcc) 126 | ## There are various ways to get dependency output from gcc. Here's 127 | ## why we pick this rather obscure method: 128 | ## - Don't want to use -MD because we'd like the dependencies to end 129 | ## up in a subdir. Having to rename by hand is ugly. 130 | ## (We might end up doing this anyway to support other compilers.) 131 | ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like 132 | ## -MM, not -M (despite what the docs say). 133 | ## - Using -M directly means running the compiler twice (even worse 134 | ## than renaming). 135 | if test -z "$gccflag"; then 136 | gccflag=-MD, 137 | fi 138 | "$@" -Wp,"$gccflag$tmpdepfile" 139 | stat=$? 140 | if test $stat -eq 0; then : 141 | else 142 | rm -f "$tmpdepfile" 143 | exit $stat 144 | fi 145 | rm -f "$depfile" 146 | echo "$object : \\" > "$depfile" 147 | alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz 148 | ## The second -e expression handles DOS-style file names with drive letters. 149 | sed -e 's/^[^:]*: / /' \ 150 | -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" 151 | ## This next piece of magic avoids the `deleted header file' problem. 152 | ## The problem is that when a header file which appears in a .P file 153 | ## is deleted, the dependency causes make to die (because there is 154 | ## typically no way to rebuild the header). We avoid this by adding 155 | ## dummy dependencies for each header file. Too bad gcc doesn't do 156 | ## this for us directly. 157 | tr ' ' ' 158 | ' < "$tmpdepfile" | 159 | ## Some versions of gcc put a space before the `:'. On the theory 160 | ## that the space means something, we add a space to the output as 161 | ## well. 162 | ## Some versions of the HPUX 10.20 sed can't process this invocation 163 | ## correctly. Breaking it into two sed invocations is a workaround. 164 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 165 | rm -f "$tmpdepfile" 166 | ;; 167 | 168 | hp) 169 | # This case exists only to let depend.m4 do its work. It works by 170 | # looking at the text of this script. This case will never be run, 171 | # since it is checked for above. 172 | exit 1 173 | ;; 174 | 175 | sgi) 176 | if test "$libtool" = yes; then 177 | "$@" "-Wp,-MDupdate,$tmpdepfile" 178 | else 179 | "$@" -MDupdate "$tmpdepfile" 180 | fi 181 | stat=$? 182 | if test $stat -eq 0; then : 183 | else 184 | rm -f "$tmpdepfile" 185 | exit $stat 186 | fi 187 | rm -f "$depfile" 188 | 189 | if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files 190 | echo "$object : \\" > "$depfile" 191 | 192 | # Clip off the initial element (the dependent). Don't try to be 193 | # clever and replace this with sed code, as IRIX sed won't handle 194 | # lines with more than a fixed number of characters (4096 in 195 | # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; 196 | # the IRIX cc adds comments like `#:fec' to the end of the 197 | # dependency line. 198 | tr ' ' ' 199 | ' < "$tmpdepfile" \ 200 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ 201 | tr ' 202 | ' ' ' >> "$depfile" 203 | echo >> "$depfile" 204 | 205 | # The second pass generates a dummy entry for each header file. 206 | tr ' ' ' 207 | ' < "$tmpdepfile" \ 208 | | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ 209 | >> "$depfile" 210 | else 211 | # The sourcefile does not contain any dependencies, so just 212 | # store a dummy comment line, to avoid errors with the Makefile 213 | # "include basename.Plo" scheme. 214 | echo "#dummy" > "$depfile" 215 | fi 216 | rm -f "$tmpdepfile" 217 | ;; 218 | 219 | aix) 220 | # The C for AIX Compiler uses -M and outputs the dependencies 221 | # in a .u file. In older versions, this file always lives in the 222 | # current directory. Also, the AIX compiler puts `$object:' at the 223 | # start of each line; $object doesn't have directory information. 224 | # Version 6 uses the directory in both cases. 225 | dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 226 | test "x$dir" = "x$object" && dir= 227 | base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 228 | if test "$libtool" = yes; then 229 | tmpdepfile1=$dir$base.u 230 | tmpdepfile2=$base.u 231 | tmpdepfile3=$dir.libs/$base.u 232 | "$@" -Wc,-M 233 | else 234 | tmpdepfile1=$dir$base.u 235 | tmpdepfile2=$dir$base.u 236 | tmpdepfile3=$dir$base.u 237 | "$@" -M 238 | fi 239 | stat=$? 240 | 241 | if test $stat -eq 0; then : 242 | else 243 | rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 244 | exit $stat 245 | fi 246 | 247 | for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" 248 | do 249 | test -f "$tmpdepfile" && break 250 | done 251 | if test -f "$tmpdepfile"; then 252 | # Each line is of the form `foo.o: dependent.h'. 253 | # Do two passes, one to just change these to 254 | # `$object: dependent.h' and one to simply `dependent.h:'. 255 | sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 256 | # That's a tab and a space in the []. 257 | sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 258 | else 259 | # The sourcefile does not contain any dependencies, so just 260 | # store a dummy comment line, to avoid errors with the Makefile 261 | # "include basename.Plo" scheme. 262 | echo "#dummy" > "$depfile" 263 | fi 264 | rm -f "$tmpdepfile" 265 | ;; 266 | 267 | icc) 268 | # Intel's C compiler understands `-MD -MF file'. However on 269 | # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c 270 | # ICC 7.0 will fill foo.d with something like 271 | # foo.o: sub/foo.c 272 | # foo.o: sub/foo.h 273 | # which is wrong. We want: 274 | # sub/foo.o: sub/foo.c 275 | # sub/foo.o: sub/foo.h 276 | # sub/foo.c: 277 | # sub/foo.h: 278 | # ICC 7.1 will output 279 | # foo.o: sub/foo.c sub/foo.h 280 | # and will wrap long lines using \ : 281 | # foo.o: sub/foo.c ... \ 282 | # sub/foo.h ... \ 283 | # ... 284 | 285 | "$@" -MD -MF "$tmpdepfile" 286 | stat=$? 287 | if test $stat -eq 0; then : 288 | else 289 | rm -f "$tmpdepfile" 290 | exit $stat 291 | fi 292 | rm -f "$depfile" 293 | # Each line is of the form `foo.o: dependent.h', 294 | # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. 295 | # Do two passes, one to just change these to 296 | # `$object: dependent.h' and one to simply `dependent.h:'. 297 | sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" 298 | # Some versions of the HPUX 10.20 sed can't process this invocation 299 | # correctly. Breaking it into two sed invocations is a workaround. 300 | sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | 301 | sed -e 's/$/ :/' >> "$depfile" 302 | rm -f "$tmpdepfile" 303 | ;; 304 | 305 | hp2) 306 | # The "hp" stanza above does not work with aCC (C++) and HP's ia64 307 | # compilers, which have integrated preprocessors. The correct option 308 | # to use with these is +Maked; it writes dependencies to a file named 309 | # 'foo.d', which lands next to the object file, wherever that 310 | # happens to be. 311 | # Much of this is similar to the tru64 case; see comments there. 312 | dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 313 | test "x$dir" = "x$object" && dir= 314 | base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 315 | if test "$libtool" = yes; then 316 | tmpdepfile1=$dir$base.d 317 | tmpdepfile2=$dir.libs/$base.d 318 | "$@" -Wc,+Maked 319 | else 320 | tmpdepfile1=$dir$base.d 321 | tmpdepfile2=$dir$base.d 322 | "$@" +Maked 323 | fi 324 | stat=$? 325 | if test $stat -eq 0; then : 326 | else 327 | rm -f "$tmpdepfile1" "$tmpdepfile2" 328 | exit $stat 329 | fi 330 | 331 | for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" 332 | do 333 | test -f "$tmpdepfile" && break 334 | done 335 | if test -f "$tmpdepfile"; then 336 | sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" 337 | # Add `dependent.h:' lines. 338 | sed -ne '2,${ 339 | s/^ *// 340 | s/ \\*$// 341 | s/$/:/ 342 | p 343 | }' "$tmpdepfile" >> "$depfile" 344 | else 345 | echo "#dummy" > "$depfile" 346 | fi 347 | rm -f "$tmpdepfile" "$tmpdepfile2" 348 | ;; 349 | 350 | tru64) 351 | # The Tru64 compiler uses -MD to generate dependencies as a side 352 | # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. 353 | # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put 354 | # dependencies in `foo.d' instead, so we check for that too. 355 | # Subdirectories are respected. 356 | dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` 357 | test "x$dir" = "x$object" && dir= 358 | base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` 359 | 360 | if test "$libtool" = yes; then 361 | # With Tru64 cc, shared objects can also be used to make a 362 | # static library. This mechanism is used in libtool 1.4 series to 363 | # handle both shared and static libraries in a single compilation. 364 | # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. 365 | # 366 | # With libtool 1.5 this exception was removed, and libtool now 367 | # generates 2 separate objects for the 2 libraries. These two 368 | # compilations output dependencies in $dir.libs/$base.o.d and 369 | # in $dir$base.o.d. We have to check for both files, because 370 | # one of the two compilations can be disabled. We should prefer 371 | # $dir$base.o.d over $dir.libs/$base.o.d because the latter is 372 | # automatically cleaned when .libs/ is deleted, while ignoring 373 | # the former would cause a distcleancheck panic. 374 | tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 375 | tmpdepfile2=$dir$base.o.d # libtool 1.5 376 | tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 377 | tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 378 | "$@" -Wc,-MD 379 | else 380 | tmpdepfile1=$dir$base.o.d 381 | tmpdepfile2=$dir$base.d 382 | tmpdepfile3=$dir$base.d 383 | tmpdepfile4=$dir$base.d 384 | "$@" -MD 385 | fi 386 | 387 | stat=$? 388 | if test $stat -eq 0; then : 389 | else 390 | rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 391 | exit $stat 392 | fi 393 | 394 | for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" 395 | do 396 | test -f "$tmpdepfile" && break 397 | done 398 | if test -f "$tmpdepfile"; then 399 | sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" 400 | # That's a tab and a space in the []. 401 | sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" 402 | else 403 | echo "#dummy" > "$depfile" 404 | fi 405 | rm -f "$tmpdepfile" 406 | ;; 407 | 408 | #nosideeffect) 409 | # This comment above is used by automake to tell side-effect 410 | # dependency tracking mechanisms from slower ones. 411 | 412 | dashmstdout) 413 | # Important note: in order to support this mode, a compiler *must* 414 | # always write the preprocessed file to stdout, regardless of -o. 415 | "$@" || exit $? 416 | 417 | # Remove the call to Libtool. 418 | if test "$libtool" = yes; then 419 | while test "X$1" != 'X--mode=compile'; do 420 | shift 421 | done 422 | shift 423 | fi 424 | 425 | # Remove `-o $object'. 426 | IFS=" " 427 | for arg 428 | do 429 | case $arg in 430 | -o) 431 | shift 432 | ;; 433 | $object) 434 | shift 435 | ;; 436 | *) 437 | set fnord "$@" "$arg" 438 | shift # fnord 439 | shift # $arg 440 | ;; 441 | esac 442 | done 443 | 444 | test -z "$dashmflag" && dashmflag=-M 445 | # Require at least two characters before searching for `:' 446 | # in the target name. This is to cope with DOS-style filenames: 447 | # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. 448 | "$@" $dashmflag | 449 | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" 450 | rm -f "$depfile" 451 | cat < "$tmpdepfile" > "$depfile" 452 | tr ' ' ' 453 | ' < "$tmpdepfile" | \ 454 | ## Some versions of the HPUX 10.20 sed can't process this invocation 455 | ## correctly. Breaking it into two sed invocations is a workaround. 456 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 457 | rm -f "$tmpdepfile" 458 | ;; 459 | 460 | dashXmstdout) 461 | # This case only exists to satisfy depend.m4. It is never actually 462 | # run, as this mode is specially recognized in the preamble. 463 | exit 1 464 | ;; 465 | 466 | makedepend) 467 | "$@" || exit $? 468 | # Remove any Libtool call 469 | if test "$libtool" = yes; then 470 | while test "X$1" != 'X--mode=compile'; do 471 | shift 472 | done 473 | shift 474 | fi 475 | # X makedepend 476 | shift 477 | cleared=no eat=no 478 | for arg 479 | do 480 | case $cleared in 481 | no) 482 | set ""; shift 483 | cleared=yes ;; 484 | esac 485 | if test $eat = yes; then 486 | eat=no 487 | continue 488 | fi 489 | case "$arg" in 490 | -D*|-I*) 491 | set fnord "$@" "$arg"; shift ;; 492 | # Strip any option that makedepend may not understand. Remove 493 | # the object too, otherwise makedepend will parse it as a source file. 494 | -arch) 495 | eat=yes ;; 496 | -*|$object) 497 | ;; 498 | *) 499 | set fnord "$@" "$arg"; shift ;; 500 | esac 501 | done 502 | obj_suffix=`echo "$object" | sed 's/^.*\././'` 503 | touch "$tmpdepfile" 504 | ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" 505 | rm -f "$depfile" 506 | cat < "$tmpdepfile" > "$depfile" 507 | sed '1,2d' "$tmpdepfile" | tr ' ' ' 508 | ' | \ 509 | ## Some versions of the HPUX 10.20 sed can't process this invocation 510 | ## correctly. Breaking it into two sed invocations is a workaround. 511 | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" 512 | rm -f "$tmpdepfile" "$tmpdepfile".bak 513 | ;; 514 | 515 | cpp) 516 | # Important note: in order to support this mode, a compiler *must* 517 | # always write the preprocessed file to stdout. 518 | "$@" || exit $? 519 | 520 | # Remove the call to Libtool. 521 | if test "$libtool" = yes; then 522 | while test "X$1" != 'X--mode=compile'; do 523 | shift 524 | done 525 | shift 526 | fi 527 | 528 | # Remove `-o $object'. 529 | IFS=" " 530 | for arg 531 | do 532 | case $arg in 533 | -o) 534 | shift 535 | ;; 536 | $object) 537 | shift 538 | ;; 539 | *) 540 | set fnord "$@" "$arg" 541 | shift # fnord 542 | shift # $arg 543 | ;; 544 | esac 545 | done 546 | 547 | "$@" -E | 548 | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ 549 | -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | 550 | sed '$ s: \\$::' > "$tmpdepfile" 551 | rm -f "$depfile" 552 | echo "$object : \\" > "$depfile" 553 | cat < "$tmpdepfile" >> "$depfile" 554 | sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" 555 | rm -f "$tmpdepfile" 556 | ;; 557 | 558 | msvisualcpp) 559 | # Important note: in order to support this mode, a compiler *must* 560 | # always write the preprocessed file to stdout. 561 | "$@" || exit $? 562 | 563 | # Remove the call to Libtool. 564 | if test "$libtool" = yes; then 565 | while test "X$1" != 'X--mode=compile'; do 566 | shift 567 | done 568 | shift 569 | fi 570 | 571 | IFS=" " 572 | for arg 573 | do 574 | case "$arg" in 575 | -o) 576 | shift 577 | ;; 578 | $object) 579 | shift 580 | ;; 581 | "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") 582 | set fnord "$@" 583 | shift 584 | shift 585 | ;; 586 | *) 587 | set fnord "$@" "$arg" 588 | shift 589 | shift 590 | ;; 591 | esac 592 | done 593 | "$@" -E 2>/dev/null | 594 | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" 595 | rm -f "$depfile" 596 | echo "$object : \\" > "$depfile" 597 | sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" 598 | echo " " >> "$depfile" 599 | sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" 600 | rm -f "$tmpdepfile" 601 | ;; 602 | 603 | msvcmsys) 604 | # This case exists only to let depend.m4 do its work. It works by 605 | # looking at the text of this script. This case will never be run, 606 | # since it is checked for above. 607 | exit 1 608 | ;; 609 | 610 | none) 611 | exec "$@" 612 | ;; 613 | 614 | *) 615 | echo "Unknown depmode $depmode" 1>&2 616 | exit 1 617 | ;; 618 | esac 619 | 620 | exit 0 621 | 622 | # Local Variables: 623 | # mode: shell-script 624 | # sh-indentation: 2 625 | # eval: (add-hook 'write-file-hooks 'time-stamp) 626 | # time-stamp-start: "scriptversion=" 627 | # time-stamp-format: "%:y-%02m-%02d.%02H" 628 | # time-stamp-time-zone: "UTC" 629 | # time-stamp-end: "; # UTC" 630 | # End: 631 | -------------------------------------------------------------------------------- /Makefile.in: -------------------------------------------------------------------------------- 1 | # Makefile.in generated by automake 1.11.1 from Makefile.am. 2 | # @configure_input@ 3 | 4 | # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 5 | # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, 6 | # Inc. 7 | # This Makefile.in is free software; the Free Software Foundation 8 | # gives unlimited permission to copy and/or distribute it, 9 | # with or without modifications, as long as this notice is preserved. 10 | 11 | # This program is distributed in the hope that it will be useful, 12 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 13 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 14 | # PARTICULAR PURPOSE. 15 | 16 | @SET_MAKE@ 17 | 18 | VPATH = @srcdir@ 19 | pkgdatadir = $(datadir)/@PACKAGE@ 20 | pkgincludedir = $(includedir)/@PACKAGE@ 21 | pkglibdir = $(libdir)/@PACKAGE@ 22 | pkglibexecdir = $(libexecdir)/@PACKAGE@ 23 | am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd 24 | install_sh_DATA = $(install_sh) -c -m 644 25 | install_sh_PROGRAM = $(install_sh) -c 26 | install_sh_SCRIPT = $(install_sh) -c 27 | INSTALL_HEADER = $(INSTALL_DATA) 28 | transform = $(program_transform_name) 29 | NORMAL_INSTALL = : 30 | PRE_INSTALL = : 31 | POST_INSTALL = : 32 | NORMAL_UNINSTALL = : 33 | PRE_UNINSTALL = : 34 | POST_UNINSTALL = : 35 | bin_PROGRAMS = ufiformat$(EXEEXT) 36 | subdir = . 37 | DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ 38 | $(srcdir)/Makefile.in $(srcdir)/config.h.in \ 39 | $(top_srcdir)/configure AUTHORS COPYING ChangeLog INSTALL NEWS \ 40 | depcomp install-sh missing mkinstalldirs 41 | ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 42 | am__aclocal_m4_deps = $(top_srcdir)/configure.in 43 | am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ 44 | $(ACLOCAL_M4) 45 | am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ 46 | configure.lineno config.status.lineno 47 | mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs 48 | CONFIG_HEADER = config.h 49 | CONFIG_CLEAN_FILES = 50 | CONFIG_CLEAN_VPATH_FILES = 51 | am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man8dir)" 52 | PROGRAMS = $(bin_PROGRAMS) 53 | am_ufiformat_OBJECTS = ufi_format.$(OBJEXT) ufi_command.$(OBJEXT) \ 54 | ufi_detect.$(OBJEXT) 55 | ufiformat_OBJECTS = $(am_ufiformat_OBJECTS) 56 | ufiformat_LDADD = $(LDADD) 57 | DEFAULT_INCLUDES = -I.@am__isrc@ 58 | depcomp = $(SHELL) $(top_srcdir)/depcomp 59 | am__depfiles_maybe = depfiles 60 | am__mv = mv -f 61 | COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ 62 | $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) 63 | CCLD = $(CC) 64 | LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ 65 | SOURCES = $(ufiformat_SOURCES) 66 | DIST_SOURCES = $(ufiformat_SOURCES) 67 | am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; 68 | am__vpath_adj = case $$p in \ 69 | $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ 70 | *) f=$$p;; \ 71 | esac; 72 | am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; 73 | am__install_max = 40 74 | am__nobase_strip_setup = \ 75 | srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` 76 | am__nobase_strip = \ 77 | for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" 78 | am__nobase_list = $(am__nobase_strip_setup); \ 79 | for p in $$list; do echo "$$p $$p"; done | \ 80 | sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ 81 | $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ 82 | if (++n[$$2] == $(am__install_max)) \ 83 | { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ 84 | END { for (dir in files) print dir, files[dir] }' 85 | am__base_list = \ 86 | sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ 87 | sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' 88 | man8dir = $(mandir)/man8 89 | NROFF = nroff 90 | MANS = $(man8_MANS) 91 | ETAGS = etags 92 | CTAGS = ctags 93 | DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) 94 | distdir = $(PACKAGE)-$(VERSION) 95 | top_distdir = $(distdir) 96 | am__remove_distdir = \ 97 | { test ! -d "$(distdir)" \ 98 | || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ 99 | && rm -fr "$(distdir)"; }; } 100 | DIST_ARCHIVES = $(distdir).tar.gz 101 | GZIP_ENV = --best 102 | distuninstallcheck_listfiles = find . -type f -print 103 | distcleancheck_listfiles = find . -type f -print 104 | ACLOCAL = @ACLOCAL@ 105 | AMTAR = @AMTAR@ 106 | AUTOCONF = @AUTOCONF@ 107 | AUTOHEADER = @AUTOHEADER@ 108 | AUTOMAKE = @AUTOMAKE@ 109 | AWK = @AWK@ 110 | CC = @CC@ 111 | CCDEPMODE = @CCDEPMODE@ 112 | CFLAGS = @CFLAGS@ 113 | CPP = @CPP@ 114 | CPPFLAGS = @CPPFLAGS@ 115 | CYGPATH_W = @CYGPATH_W@ 116 | DEFS = @DEFS@ 117 | DEPDIR = @DEPDIR@ 118 | ECHO_C = @ECHO_C@ 119 | ECHO_N = @ECHO_N@ 120 | ECHO_T = @ECHO_T@ 121 | EGREP = @EGREP@ 122 | EXEEXT = @EXEEXT@ 123 | GREP = @GREP@ 124 | INSTALL = @INSTALL@ 125 | INSTALL_DATA = @INSTALL_DATA@ 126 | INSTALL_PROGRAM = @INSTALL_PROGRAM@ 127 | INSTALL_SCRIPT = @INSTALL_SCRIPT@ 128 | INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ 129 | LDFLAGS = @LDFLAGS@ 130 | LIBOBJS = @LIBOBJS@ 131 | LIBS = @LIBS@ 132 | LTLIBOBJS = @LTLIBOBJS@ 133 | MAKEINFO = @MAKEINFO@ 134 | MKDIR_P = @MKDIR_P@ 135 | OBJEXT = @OBJEXT@ 136 | PACKAGE = @PACKAGE@ 137 | PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ 138 | PACKAGE_NAME = @PACKAGE_NAME@ 139 | PACKAGE_STRING = @PACKAGE_STRING@ 140 | PACKAGE_TARNAME = @PACKAGE_TARNAME@ 141 | PACKAGE_URL = @PACKAGE_URL@ 142 | PACKAGE_VERSION = @PACKAGE_VERSION@ 143 | PATH_SEPARATOR = @PATH_SEPARATOR@ 144 | SET_MAKE = @SET_MAKE@ 145 | SHELL = @SHELL@ 146 | STRIP = @STRIP@ 147 | VERSION = @VERSION@ 148 | abs_builddir = @abs_builddir@ 149 | abs_srcdir = @abs_srcdir@ 150 | abs_top_builddir = @abs_top_builddir@ 151 | abs_top_srcdir = @abs_top_srcdir@ 152 | ac_ct_CC = @ac_ct_CC@ 153 | am__include = @am__include@ 154 | am__leading_dot = @am__leading_dot@ 155 | am__quote = @am__quote@ 156 | am__tar = @am__tar@ 157 | am__untar = @am__untar@ 158 | bindir = @bindir@ 159 | build_alias = @build_alias@ 160 | builddir = @builddir@ 161 | datadir = @datadir@ 162 | datarootdir = @datarootdir@ 163 | docdir = @docdir@ 164 | dvidir = @dvidir@ 165 | exec_prefix = @exec_prefix@ 166 | host_alias = @host_alias@ 167 | htmldir = @htmldir@ 168 | includedir = @includedir@ 169 | infodir = @infodir@ 170 | install_sh = @install_sh@ 171 | libdir = @libdir@ 172 | libexecdir = @libexecdir@ 173 | localedir = @localedir@ 174 | localstatedir = @localstatedir@ 175 | mandir = @mandir@ 176 | mkdir_p = @mkdir_p@ 177 | oldincludedir = @oldincludedir@ 178 | pdfdir = @pdfdir@ 179 | prefix = @prefix@ 180 | program_transform_name = @program_transform_name@ 181 | psdir = @psdir@ 182 | sbindir = @sbindir@ 183 | sharedstatedir = @sharedstatedir@ 184 | srcdir = @srcdir@ 185 | sysconfdir = @sysconfdir@ 186 | target_alias = @target_alias@ 187 | top_build_prefix = @top_build_prefix@ 188 | top_builddir = @top_builddir@ 189 | top_srcdir = @top_srcdir@ 190 | ufiformat_SOURCES = ufi_format.c ufi_command.c ufi_detect.c ufi_command.h ufi_detect.h 191 | man8_MANS = ufiformat.man 192 | EXTRA_DIST = ufiformat.man 193 | all: config.h 194 | $(MAKE) $(AM_MAKEFLAGS) all-am 195 | 196 | .SUFFIXES: 197 | .SUFFIXES: .c .o .obj 198 | am--refresh: 199 | @: 200 | $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) 201 | @for dep in $?; do \ 202 | case '$(am__configure_deps)' in \ 203 | *$$dep*) \ 204 | echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ 205 | $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ 206 | && exit 0; \ 207 | exit 1;; \ 208 | esac; \ 209 | done; \ 210 | echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ 211 | $(am__cd) $(top_srcdir) && \ 212 | $(AUTOMAKE) --gnu Makefile 213 | .PRECIOUS: Makefile 214 | Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status 215 | @case '$?' in \ 216 | *config.status*) \ 217 | echo ' $(SHELL) ./config.status'; \ 218 | $(SHELL) ./config.status;; \ 219 | *) \ 220 | echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ 221 | cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ 222 | esac; 223 | 224 | $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) 225 | $(SHELL) ./config.status --recheck 226 | 227 | $(top_srcdir)/configure: $(am__configure_deps) 228 | $(am__cd) $(srcdir) && $(AUTOCONF) 229 | $(ACLOCAL_M4): $(am__aclocal_m4_deps) 230 | $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) 231 | $(am__aclocal_m4_deps): 232 | 233 | config.h: stamp-h1 234 | @if test ! -f $@; then \ 235 | rm -f stamp-h1; \ 236 | $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ 237 | else :; fi 238 | 239 | stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status 240 | @rm -f stamp-h1 241 | cd $(top_builddir) && $(SHELL) ./config.status config.h 242 | $(srcdir)/config.h.in: $(am__configure_deps) 243 | ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) 244 | rm -f stamp-h1 245 | touch $@ 246 | 247 | distclean-hdr: 248 | -rm -f config.h stamp-h1 249 | install-binPROGRAMS: $(bin_PROGRAMS) 250 | @$(NORMAL_INSTALL) 251 | test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" 252 | @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ 253 | for p in $$list; do echo "$$p $$p"; done | \ 254 | sed 's/$(EXEEXT)$$//' | \ 255 | while read p p1; do if test -f $$p; \ 256 | then echo "$$p"; echo "$$p"; else :; fi; \ 257 | done | \ 258 | sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ 259 | -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ 260 | sed 'N;N;N;s,\n, ,g' | \ 261 | $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ 262 | { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ 263 | if ($$2 == $$4) files[d] = files[d] " " $$1; \ 264 | else { print "f", $$3 "/" $$4, $$1; } } \ 265 | END { for (d in files) print "f", d, files[d] }' | \ 266 | while read type dir files; do \ 267 | if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ 268 | test -z "$$files" || { \ 269 | echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ 270 | $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ 271 | } \ 272 | ; done 273 | 274 | uninstall-binPROGRAMS: 275 | @$(NORMAL_UNINSTALL) 276 | @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ 277 | files=`for p in $$list; do echo "$$p"; done | \ 278 | sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ 279 | -e 's/$$/$(EXEEXT)/' `; \ 280 | test -n "$$list" || exit 0; \ 281 | echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ 282 | cd "$(DESTDIR)$(bindir)" && rm -f $$files 283 | 284 | clean-binPROGRAMS: 285 | -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) 286 | ufiformat$(EXEEXT): $(ufiformat_OBJECTS) $(ufiformat_DEPENDENCIES) 287 | @rm -f ufiformat$(EXEEXT) 288 | $(LINK) $(ufiformat_OBJECTS) $(ufiformat_LDADD) $(LIBS) 289 | 290 | mostlyclean-compile: 291 | -rm -f *.$(OBJEXT) 292 | 293 | distclean-compile: 294 | -rm -f *.tab.c 295 | 296 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufi_command.Po@am__quote@ 297 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufi_detect.Po@am__quote@ 298 | @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ufi_format.Po@am__quote@ 299 | 300 | .c.o: 301 | @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< 302 | @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po 303 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 304 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 305 | @am__fastdepCC_FALSE@ $(COMPILE) -c $< 306 | 307 | .c.obj: 308 | @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` 309 | @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po 310 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ 311 | @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 312 | @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` 313 | install-man8: $(man8_MANS) 314 | @$(NORMAL_INSTALL) 315 | test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)" 316 | @list='$(man8_MANS)'; test -n "$(man8dir)" || exit 0; \ 317 | { for i in $$list; do echo "$$i"; done; \ 318 | } | while read p; do \ 319 | if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ 320 | echo "$$d$$p"; echo "$$p"; \ 321 | done | \ 322 | sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ 323 | -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ 324 | sed 'N;N;s,\n, ,g' | { \ 325 | list=; while read file base inst; do \ 326 | if test "$$base" = "$$inst"; then list="$$list $$file"; else \ 327 | echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ 328 | $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ 329 | fi; \ 330 | done; \ 331 | for i in $$list; do echo "$$i"; done | $(am__base_list) | \ 332 | while read files; do \ 333 | test -z "$$files" || { \ 334 | echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ 335 | $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ 336 | done; } 337 | 338 | uninstall-man8: 339 | @$(NORMAL_UNINSTALL) 340 | @list='$(man8_MANS)'; test -n "$(man8dir)" || exit 0; \ 341 | files=`{ for i in $$list; do echo "$$i"; done; \ 342 | } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ 343 | -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ 344 | test -z "$$files" || { \ 345 | echo " ( cd '$(DESTDIR)$(man8dir)' && rm -f" $$files ")"; \ 346 | cd "$(DESTDIR)$(man8dir)" && rm -f $$files; } 347 | 348 | ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) 349 | list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ 350 | unique=`for i in $$list; do \ 351 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 352 | done | \ 353 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ 354 | END { if (nonempty) { for (i in files) print i; }; }'`; \ 355 | mkid -fID $$unique 356 | tags: TAGS 357 | 358 | TAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ 359 | $(TAGS_FILES) $(LISP) 360 | set x; \ 361 | here=`pwd`; \ 362 | list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ 363 | unique=`for i in $$list; do \ 364 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 365 | done | \ 366 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ 367 | END { if (nonempty) { for (i in files) print i; }; }'`; \ 368 | shift; \ 369 | if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ 370 | test -n "$$unique" || unique=$$empty_fix; \ 371 | if test $$# -gt 0; then \ 372 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 373 | "$$@" $$unique; \ 374 | else \ 375 | $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ 376 | $$unique; \ 377 | fi; \ 378 | fi 379 | ctags: CTAGS 380 | CTAGS: $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \ 381 | $(TAGS_FILES) $(LISP) 382 | list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \ 383 | unique=`for i in $$list; do \ 384 | if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ 385 | done | \ 386 | $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ 387 | END { if (nonempty) { for (i in files) print i; }; }'`; \ 388 | test -z "$(CTAGS_ARGS)$$unique" \ 389 | || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ 390 | $$unique 391 | 392 | GTAGS: 393 | here=`$(am__cd) $(top_builddir) && pwd` \ 394 | && $(am__cd) $(top_srcdir) \ 395 | && gtags -i $(GTAGS_ARGS) "$$here" 396 | 397 | distclean-tags: 398 | -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags 399 | 400 | distdir: $(DISTFILES) 401 | @list='$(MANS)'; if test -n "$$list"; then \ 402 | list=`for p in $$list; do \ 403 | if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ 404 | if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ 405 | if test -n "$$list" && \ 406 | grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ 407 | echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ 408 | grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ 409 | echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ 410 | echo " typically \`make maintainer-clean' will remove them" >&2; \ 411 | exit 1; \ 412 | else :; fi; \ 413 | else :; fi 414 | $(am__remove_distdir) 415 | test -d "$(distdir)" || mkdir "$(distdir)" 416 | @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 417 | topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ 418 | list='$(DISTFILES)'; \ 419 | dist_files=`for file in $$list; do echo $$file; done | \ 420 | sed -e "s|^$$srcdirstrip/||;t" \ 421 | -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ 422 | case $$dist_files in \ 423 | */*) $(MKDIR_P) `echo "$$dist_files" | \ 424 | sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ 425 | sort -u` ;; \ 426 | esac; \ 427 | for file in $$dist_files; do \ 428 | if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ 429 | if test -d $$d/$$file; then \ 430 | dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ 431 | if test -d "$(distdir)/$$file"; then \ 432 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 433 | fi; \ 434 | if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ 435 | cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ 436 | find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ 437 | fi; \ 438 | cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ 439 | else \ 440 | test -f "$(distdir)/$$file" \ 441 | || cp -p $$d/$$file "$(distdir)/$$file" \ 442 | || exit 1; \ 443 | fi; \ 444 | done 445 | -test -n "$(am__skip_mode_fix)" \ 446 | || find "$(distdir)" -type d ! -perm -755 \ 447 | -exec chmod u+rwx,go+rx {} \; -o \ 448 | ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ 449 | ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ 450 | ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ 451 | || chmod -R a+r "$(distdir)" 452 | dist-gzip: distdir 453 | tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz 454 | $(am__remove_distdir) 455 | 456 | dist-bzip2: distdir 457 | tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 458 | $(am__remove_distdir) 459 | 460 | dist-lzma: distdir 461 | tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma 462 | $(am__remove_distdir) 463 | 464 | dist-xz: distdir 465 | tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz 466 | $(am__remove_distdir) 467 | 468 | dist-tarZ: distdir 469 | tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z 470 | $(am__remove_distdir) 471 | 472 | dist-shar: distdir 473 | shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz 474 | $(am__remove_distdir) 475 | 476 | dist-zip: distdir 477 | -rm -f $(distdir).zip 478 | zip -rq $(distdir).zip $(distdir) 479 | $(am__remove_distdir) 480 | 481 | dist dist-all: distdir 482 | tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz 483 | $(am__remove_distdir) 484 | 485 | # This target untars the dist file and tries a VPATH configuration. Then 486 | # it guarantees that the distribution is self-contained by making another 487 | # tarfile. 488 | distcheck: dist 489 | case '$(DIST_ARCHIVES)' in \ 490 | *.tar.gz*) \ 491 | GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ 492 | *.tar.bz2*) \ 493 | bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ 494 | *.tar.lzma*) \ 495 | lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ 496 | *.tar.xz*) \ 497 | xz -dc $(distdir).tar.xz | $(am__untar) ;;\ 498 | *.tar.Z*) \ 499 | uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ 500 | *.shar.gz*) \ 501 | GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ 502 | *.zip*) \ 503 | unzip $(distdir).zip ;;\ 504 | esac 505 | chmod -R a-w $(distdir); chmod a+w $(distdir) 506 | mkdir $(distdir)/_build 507 | mkdir $(distdir)/_inst 508 | chmod a-w $(distdir) 509 | test -d $(distdir)/_build || exit 0; \ 510 | dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ 511 | && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ 512 | && am__cwd=`pwd` \ 513 | && $(am__cd) $(distdir)/_build \ 514 | && ../configure --srcdir=.. --prefix="$$dc_install_base" \ 515 | $(DISTCHECK_CONFIGURE_FLAGS) \ 516 | && $(MAKE) $(AM_MAKEFLAGS) \ 517 | && $(MAKE) $(AM_MAKEFLAGS) dvi \ 518 | && $(MAKE) $(AM_MAKEFLAGS) check \ 519 | && $(MAKE) $(AM_MAKEFLAGS) install \ 520 | && $(MAKE) $(AM_MAKEFLAGS) installcheck \ 521 | && $(MAKE) $(AM_MAKEFLAGS) uninstall \ 522 | && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ 523 | distuninstallcheck \ 524 | && chmod -R a-w "$$dc_install_base" \ 525 | && ({ \ 526 | (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ 527 | && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ 528 | && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ 529 | && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ 530 | distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ 531 | } || { rm -rf "$$dc_destdir"; exit 1; }) \ 532 | && rm -rf "$$dc_destdir" \ 533 | && $(MAKE) $(AM_MAKEFLAGS) dist \ 534 | && rm -rf $(DIST_ARCHIVES) \ 535 | && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ 536 | && cd "$$am__cwd" \ 537 | || exit 1 538 | $(am__remove_distdir) 539 | @(echo "$(distdir) archives ready for distribution: "; \ 540 | list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ 541 | sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' 542 | distuninstallcheck: 543 | @$(am__cd) '$(distuninstallcheck_dir)' \ 544 | && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ 545 | || { echo "ERROR: files left after uninstall:" ; \ 546 | if test -n "$(DESTDIR)"; then \ 547 | echo " (check DESTDIR support)"; \ 548 | fi ; \ 549 | $(distuninstallcheck_listfiles) ; \ 550 | exit 1; } >&2 551 | distcleancheck: distclean 552 | @if test '$(srcdir)' = . ; then \ 553 | echo "ERROR: distcleancheck can only run from a VPATH build" ; \ 554 | exit 1 ; \ 555 | fi 556 | @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ 557 | || { echo "ERROR: files left in build directory after distclean:" ; \ 558 | $(distcleancheck_listfiles) ; \ 559 | exit 1; } >&2 560 | check-am: all-am 561 | check: check-am 562 | all-am: Makefile $(PROGRAMS) $(MANS) config.h 563 | installdirs: 564 | for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(man8dir)"; do \ 565 | test -z "$$dir" || $(MKDIR_P) "$$dir"; \ 566 | done 567 | install: install-am 568 | install-exec: install-exec-am 569 | install-data: install-data-am 570 | uninstall: uninstall-am 571 | 572 | install-am: all-am 573 | @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am 574 | 575 | installcheck: installcheck-am 576 | install-strip: 577 | $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ 578 | install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ 579 | `test -z '$(STRIP)' || \ 580 | echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install 581 | mostlyclean-generic: 582 | 583 | clean-generic: 584 | 585 | distclean-generic: 586 | -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) 587 | -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) 588 | 589 | maintainer-clean-generic: 590 | @echo "This command is intended for maintainers to use" 591 | @echo "it deletes files that may require special tools to rebuild." 592 | clean: clean-am 593 | 594 | clean-am: clean-binPROGRAMS clean-generic mostlyclean-am 595 | 596 | distclean: distclean-am 597 | -rm -f $(am__CONFIG_DISTCLEAN_FILES) 598 | -rm -rf ./$(DEPDIR) 599 | -rm -f Makefile 600 | distclean-am: clean-am distclean-compile distclean-generic \ 601 | distclean-hdr distclean-tags 602 | 603 | dvi: dvi-am 604 | 605 | dvi-am: 606 | 607 | html: html-am 608 | 609 | html-am: 610 | 611 | info: info-am 612 | 613 | info-am: 614 | 615 | install-data-am: install-man 616 | 617 | install-dvi: install-dvi-am 618 | 619 | install-dvi-am: 620 | 621 | install-exec-am: install-binPROGRAMS 622 | 623 | install-html: install-html-am 624 | 625 | install-html-am: 626 | 627 | install-info: install-info-am 628 | 629 | install-info-am: 630 | 631 | install-man: install-man8 632 | 633 | install-pdf: install-pdf-am 634 | 635 | install-pdf-am: 636 | 637 | install-ps: install-ps-am 638 | 639 | install-ps-am: 640 | 641 | installcheck-am: 642 | 643 | maintainer-clean: maintainer-clean-am 644 | -rm -f $(am__CONFIG_DISTCLEAN_FILES) 645 | -rm -rf $(top_srcdir)/autom4te.cache 646 | -rm -rf ./$(DEPDIR) 647 | -rm -f Makefile 648 | maintainer-clean-am: distclean-am maintainer-clean-generic 649 | 650 | mostlyclean: mostlyclean-am 651 | 652 | mostlyclean-am: mostlyclean-compile mostlyclean-generic 653 | 654 | pdf: pdf-am 655 | 656 | pdf-am: 657 | 658 | ps: ps-am 659 | 660 | ps-am: 661 | 662 | uninstall-am: uninstall-binPROGRAMS uninstall-man 663 | 664 | uninstall-man: uninstall-man8 665 | 666 | .MAKE: all install-am install-strip 667 | 668 | .PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \ 669 | clean-binPROGRAMS clean-generic ctags dist dist-all dist-bzip2 \ 670 | dist-gzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \ 671 | distcheck distclean distclean-compile distclean-generic \ 672 | distclean-hdr distclean-tags distcleancheck distdir \ 673 | distuninstallcheck dvi dvi-am html html-am info info-am \ 674 | install install-am install-binPROGRAMS install-data \ 675 | install-data-am install-dvi install-dvi-am install-exec \ 676 | install-exec-am install-html install-html-am install-info \ 677 | install-info-am install-man install-man8 install-pdf \ 678 | install-pdf-am install-ps install-ps-am install-strip \ 679 | installcheck installcheck-am installdirs maintainer-clean \ 680 | maintainer-clean-generic mostlyclean mostlyclean-compile \ 681 | mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ 682 | uninstall-am uninstall-binPROGRAMS uninstall-man \ 683 | uninstall-man8 684 | 685 | 686 | # Tell versions [3.59,3.63) of GNU make to not export all variables. 687 | # Otherwise a system limit (for SysV at least) may be exceeded. 688 | .NOEXPORT: 689 | -------------------------------------------------------------------------------- /aclocal.m4: -------------------------------------------------------------------------------- 1 | # generated automatically by aclocal 1.11.1 -*- Autoconf -*- 2 | 3 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 4 | # 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. 5 | # This file is free software; the Free Software Foundation 6 | # gives unlimited permission to copy and/or distribute it, 7 | # with or without modifications, as long as this notice is preserved. 8 | 9 | # This program is distributed in the hope that it will be useful, 10 | # but WITHOUT ANY WARRANTY, to the extent permitted by law; without 11 | # even the implied warranty of MERCHANTABILITY or FITNESS FOR A 12 | # PARTICULAR PURPOSE. 13 | 14 | m4_ifndef([AC_AUTOCONF_VERSION], 15 | [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl 16 | m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.65],, 17 | [m4_warning([this file was generated for autoconf 2.65. 18 | You have another version of autoconf. It may work, but is not guaranteed to. 19 | If you have problems, you may need to regenerate the build system entirely. 20 | To do so, use the procedure documented by the package, typically `autoreconf'.])]) 21 | 22 | # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. 23 | # 24 | # This file is free software; the Free Software Foundation 25 | # gives unlimited permission to copy and/or distribute it, 26 | # with or without modifications, as long as this notice is preserved. 27 | 28 | # AM_AUTOMAKE_VERSION(VERSION) 29 | # ---------------------------- 30 | # Automake X.Y traces this macro to ensure aclocal.m4 has been 31 | # generated from the m4 files accompanying Automake X.Y. 32 | # (This private macro should not be called outside this file.) 33 | AC_DEFUN([AM_AUTOMAKE_VERSION], 34 | [am__api_version='1.11' 35 | dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to 36 | dnl require some minimum version. Point them to the right macro. 37 | m4_if([$1], [1.11.1], [], 38 | [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl 39 | ]) 40 | 41 | # _AM_AUTOCONF_VERSION(VERSION) 42 | # ----------------------------- 43 | # aclocal traces this macro to find the Autoconf version. 44 | # This is a private macro too. Using m4_define simplifies 45 | # the logic in aclocal, which can simply ignore this definition. 46 | m4_define([_AM_AUTOCONF_VERSION], []) 47 | 48 | # AM_SET_CURRENT_AUTOMAKE_VERSION 49 | # ------------------------------- 50 | # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. 51 | # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. 52 | AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], 53 | [AM_AUTOMAKE_VERSION([1.11.1])dnl 54 | m4_ifndef([AC_AUTOCONF_VERSION], 55 | [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl 56 | _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) 57 | 58 | # AM_AUX_DIR_EXPAND -*- Autoconf -*- 59 | 60 | # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. 61 | # 62 | # This file is free software; the Free Software Foundation 63 | # gives unlimited permission to copy and/or distribute it, 64 | # with or without modifications, as long as this notice is preserved. 65 | 66 | # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets 67 | # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to 68 | # `$srcdir', `$srcdir/..', or `$srcdir/../..'. 69 | # 70 | # Of course, Automake must honor this variable whenever it calls a 71 | # tool from the auxiliary directory. The problem is that $srcdir (and 72 | # therefore $ac_aux_dir as well) can be either absolute or relative, 73 | # depending on how configure is run. This is pretty annoying, since 74 | # it makes $ac_aux_dir quite unusable in subdirectories: in the top 75 | # source directory, any form will work fine, but in subdirectories a 76 | # relative path needs to be adjusted first. 77 | # 78 | # $ac_aux_dir/missing 79 | # fails when called from a subdirectory if $ac_aux_dir is relative 80 | # $top_srcdir/$ac_aux_dir/missing 81 | # fails if $ac_aux_dir is absolute, 82 | # fails when called from a subdirectory in a VPATH build with 83 | # a relative $ac_aux_dir 84 | # 85 | # The reason of the latter failure is that $top_srcdir and $ac_aux_dir 86 | # are both prefixed by $srcdir. In an in-source build this is usually 87 | # harmless because $srcdir is `.', but things will broke when you 88 | # start a VPATH build or use an absolute $srcdir. 89 | # 90 | # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, 91 | # iff we strip the leading $srcdir from $ac_aux_dir. That would be: 92 | # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` 93 | # and then we would define $MISSING as 94 | # MISSING="\${SHELL} $am_aux_dir/missing" 95 | # This will work as long as MISSING is not called from configure, because 96 | # unfortunately $(top_srcdir) has no meaning in configure. 97 | # However there are other variables, like CC, which are often used in 98 | # configure, and could therefore not use this "fixed" $ac_aux_dir. 99 | # 100 | # Another solution, used here, is to always expand $ac_aux_dir to an 101 | # absolute PATH. The drawback is that using absolute paths prevent a 102 | # configured tree to be moved without reconfiguration. 103 | 104 | AC_DEFUN([AM_AUX_DIR_EXPAND], 105 | [dnl Rely on autoconf to set up CDPATH properly. 106 | AC_PREREQ([2.50])dnl 107 | # expand $ac_aux_dir to an absolute path 108 | am_aux_dir=`cd $ac_aux_dir && pwd` 109 | ]) 110 | 111 | # AM_CONDITIONAL -*- Autoconf -*- 112 | 113 | # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 114 | # Free Software Foundation, Inc. 115 | # 116 | # This file is free software; the Free Software Foundation 117 | # gives unlimited permission to copy and/or distribute it, 118 | # with or without modifications, as long as this notice is preserved. 119 | 120 | # serial 9 121 | 122 | # AM_CONDITIONAL(NAME, SHELL-CONDITION) 123 | # ------------------------------------- 124 | # Define a conditional. 125 | AC_DEFUN([AM_CONDITIONAL], 126 | [AC_PREREQ(2.52)dnl 127 | ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], 128 | [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl 129 | AC_SUBST([$1_TRUE])dnl 130 | AC_SUBST([$1_FALSE])dnl 131 | _AM_SUBST_NOTMAKE([$1_TRUE])dnl 132 | _AM_SUBST_NOTMAKE([$1_FALSE])dnl 133 | m4_define([_AM_COND_VALUE_$1], [$2])dnl 134 | if $2; then 135 | $1_TRUE= 136 | $1_FALSE='#' 137 | else 138 | $1_TRUE='#' 139 | $1_FALSE= 140 | fi 141 | AC_CONFIG_COMMANDS_PRE( 142 | [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then 143 | AC_MSG_ERROR([[conditional "$1" was never defined. 144 | Usually this means the macro was only invoked conditionally.]]) 145 | fi])]) 146 | 147 | # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 148 | # Free Software Foundation, Inc. 149 | # 150 | # This file is free software; the Free Software Foundation 151 | # gives unlimited permission to copy and/or distribute it, 152 | # with or without modifications, as long as this notice is preserved. 153 | 154 | # serial 10 155 | 156 | # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be 157 | # written in clear, in which case automake, when reading aclocal.m4, 158 | # will think it sees a *use*, and therefore will trigger all it's 159 | # C support machinery. Also note that it means that autoscan, seeing 160 | # CC etc. in the Makefile, will ask for an AC_PROG_CC use... 161 | 162 | 163 | # _AM_DEPENDENCIES(NAME) 164 | # ---------------------- 165 | # See how the compiler implements dependency checking. 166 | # NAME is "CC", "CXX", "GCJ", or "OBJC". 167 | # We try a few techniques and use that to set a single cache variable. 168 | # 169 | # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was 170 | # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular 171 | # dependency, and given that the user is not expected to run this macro, 172 | # just rely on AC_PROG_CC. 173 | AC_DEFUN([_AM_DEPENDENCIES], 174 | [AC_REQUIRE([AM_SET_DEPDIR])dnl 175 | AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl 176 | AC_REQUIRE([AM_MAKE_INCLUDE])dnl 177 | AC_REQUIRE([AM_DEP_TRACK])dnl 178 | 179 | ifelse([$1], CC, [depcc="$CC" am_compiler_list=], 180 | [$1], CXX, [depcc="$CXX" am_compiler_list=], 181 | [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], 182 | [$1], UPC, [depcc="$UPC" am_compiler_list=], 183 | [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], 184 | [depcc="$$1" am_compiler_list=]) 185 | 186 | AC_CACHE_CHECK([dependency style of $depcc], 187 | [am_cv_$1_dependencies_compiler_type], 188 | [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then 189 | # We make a subdir and do the tests there. Otherwise we can end up 190 | # making bogus files that we don't know about and never remove. For 191 | # instance it was reported that on HP-UX the gcc test will end up 192 | # making a dummy file named `D' -- because `-MD' means `put the output 193 | # in D'. 194 | mkdir conftest.dir 195 | # Copy depcomp to subdir because otherwise we won't find it if we're 196 | # using a relative directory. 197 | cp "$am_depcomp" conftest.dir 198 | cd conftest.dir 199 | # We will build objects and dependencies in a subdirectory because 200 | # it helps to detect inapplicable dependency modes. For instance 201 | # both Tru64's cc and ICC support -MD to output dependencies as a 202 | # side effect of compilation, but ICC will put the dependencies in 203 | # the current directory while Tru64 will put them in the object 204 | # directory. 205 | mkdir sub 206 | 207 | am_cv_$1_dependencies_compiler_type=none 208 | if test "$am_compiler_list" = ""; then 209 | am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` 210 | fi 211 | am__universal=false 212 | m4_case([$1], [CC], 213 | [case " $depcc " in #( 214 | *\ -arch\ *\ -arch\ *) am__universal=true ;; 215 | esac], 216 | [CXX], 217 | [case " $depcc " in #( 218 | *\ -arch\ *\ -arch\ *) am__universal=true ;; 219 | esac]) 220 | 221 | for depmode in $am_compiler_list; do 222 | # Setup a source with many dependencies, because some compilers 223 | # like to wrap large dependency lists on column 80 (with \), and 224 | # we should not choose a depcomp mode which is confused by this. 225 | # 226 | # We need to recreate these files for each test, as the compiler may 227 | # overwrite some of them when testing with obscure command lines. 228 | # This happens at least with the AIX C compiler. 229 | : > sub/conftest.c 230 | for i in 1 2 3 4 5 6; do 231 | echo '#include "conftst'$i'.h"' >> sub/conftest.c 232 | # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with 233 | # Solaris 8's {/usr,}/bin/sh. 234 | touch sub/conftst$i.h 235 | done 236 | echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf 237 | 238 | # We check with `-c' and `-o' for the sake of the "dashmstdout" 239 | # mode. It turns out that the SunPro C++ compiler does not properly 240 | # handle `-M -o', and we need to detect this. Also, some Intel 241 | # versions had trouble with output in subdirs 242 | am__obj=sub/conftest.${OBJEXT-o} 243 | am__minus_obj="-o $am__obj" 244 | case $depmode in 245 | gcc) 246 | # This depmode causes a compiler race in universal mode. 247 | test "$am__universal" = false || continue 248 | ;; 249 | nosideeffect) 250 | # after this tag, mechanisms are not by side-effect, so they'll 251 | # only be used when explicitly requested 252 | if test "x$enable_dependency_tracking" = xyes; then 253 | continue 254 | else 255 | break 256 | fi 257 | ;; 258 | msvisualcpp | msvcmsys) 259 | # This compiler won't grok `-c -o', but also, the minuso test has 260 | # not run yet. These depmodes are late enough in the game, and 261 | # so weak that their functioning should not be impacted. 262 | am__obj=conftest.${OBJEXT-o} 263 | am__minus_obj= 264 | ;; 265 | none) break ;; 266 | esac 267 | if depmode=$depmode \ 268 | source=sub/conftest.c object=$am__obj \ 269 | depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ 270 | $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ 271 | >/dev/null 2>conftest.err && 272 | grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && 273 | grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && 274 | grep $am__obj sub/conftest.Po > /dev/null 2>&1 && 275 | ${MAKE-make} -s -f confmf > /dev/null 2>&1; then 276 | # icc doesn't choke on unknown options, it will just issue warnings 277 | # or remarks (even with -Werror). So we grep stderr for any message 278 | # that says an option was ignored or not supported. 279 | # When given -MP, icc 7.0 and 7.1 complain thusly: 280 | # icc: Command line warning: ignoring option '-M'; no argument required 281 | # The diagnosis changed in icc 8.0: 282 | # icc: Command line remark: option '-MP' not supported 283 | if (grep 'ignoring option' conftest.err || 284 | grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else 285 | am_cv_$1_dependencies_compiler_type=$depmode 286 | break 287 | fi 288 | fi 289 | done 290 | 291 | cd .. 292 | rm -rf conftest.dir 293 | else 294 | am_cv_$1_dependencies_compiler_type=none 295 | fi 296 | ]) 297 | AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) 298 | AM_CONDITIONAL([am__fastdep$1], [ 299 | test "x$enable_dependency_tracking" != xno \ 300 | && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) 301 | ]) 302 | 303 | 304 | # AM_SET_DEPDIR 305 | # ------------- 306 | # Choose a directory name for dependency files. 307 | # This macro is AC_REQUIREd in _AM_DEPENDENCIES 308 | AC_DEFUN([AM_SET_DEPDIR], 309 | [AC_REQUIRE([AM_SET_LEADING_DOT])dnl 310 | AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl 311 | ]) 312 | 313 | 314 | # AM_DEP_TRACK 315 | # ------------ 316 | AC_DEFUN([AM_DEP_TRACK], 317 | [AC_ARG_ENABLE(dependency-tracking, 318 | [ --disable-dependency-tracking speeds up one-time build 319 | --enable-dependency-tracking do not reject slow dependency extractors]) 320 | if test "x$enable_dependency_tracking" != xno; then 321 | am_depcomp="$ac_aux_dir/depcomp" 322 | AMDEPBACKSLASH='\' 323 | fi 324 | AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) 325 | AC_SUBST([AMDEPBACKSLASH])dnl 326 | _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl 327 | ]) 328 | 329 | # Generate code to set up dependency tracking. -*- Autoconf -*- 330 | 331 | # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 332 | # Free Software Foundation, Inc. 333 | # 334 | # This file is free software; the Free Software Foundation 335 | # gives unlimited permission to copy and/or distribute it, 336 | # with or without modifications, as long as this notice is preserved. 337 | 338 | #serial 5 339 | 340 | # _AM_OUTPUT_DEPENDENCY_COMMANDS 341 | # ------------------------------ 342 | AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], 343 | [{ 344 | # Autoconf 2.62 quotes --file arguments for eval, but not when files 345 | # are listed without --file. Let's play safe and only enable the eval 346 | # if we detect the quoting. 347 | case $CONFIG_FILES in 348 | *\'*) eval set x "$CONFIG_FILES" ;; 349 | *) set x $CONFIG_FILES ;; 350 | esac 351 | shift 352 | for mf 353 | do 354 | # Strip MF so we end up with the name of the file. 355 | mf=`echo "$mf" | sed -e 's/:.*$//'` 356 | # Check whether this is an Automake generated Makefile or not. 357 | # We used to match only the files named `Makefile.in', but 358 | # some people rename them; so instead we look at the file content. 359 | # Grep'ing the first line is not enough: some people post-process 360 | # each Makefile.in and add a new line on top of each file to say so. 361 | # Grep'ing the whole file is not good either: AIX grep has a line 362 | # limit of 2048, but all sed's we know have understand at least 4000. 363 | if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then 364 | dirpart=`AS_DIRNAME("$mf")` 365 | else 366 | continue 367 | fi 368 | # Extract the definition of DEPDIR, am__include, and am__quote 369 | # from the Makefile without running `make'. 370 | DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` 371 | test -z "$DEPDIR" && continue 372 | am__include=`sed -n 's/^am__include = //p' < "$mf"` 373 | test -z "am__include" && continue 374 | am__quote=`sed -n 's/^am__quote = //p' < "$mf"` 375 | # When using ansi2knr, U may be empty or an underscore; expand it 376 | U=`sed -n 's/^U = //p' < "$mf"` 377 | # Find all dependency output files, they are included files with 378 | # $(DEPDIR) in their names. We invoke sed twice because it is the 379 | # simplest approach to changing $(DEPDIR) to its actual value in the 380 | # expansion. 381 | for file in `sed -n " 382 | s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ 383 | sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do 384 | # Make sure the directory exists. 385 | test -f "$dirpart/$file" && continue 386 | fdir=`AS_DIRNAME(["$file"])` 387 | AS_MKDIR_P([$dirpart/$fdir]) 388 | # echo "creating $dirpart/$file" 389 | echo '# dummy' > "$dirpart/$file" 390 | done 391 | done 392 | } 393 | ])# _AM_OUTPUT_DEPENDENCY_COMMANDS 394 | 395 | 396 | # AM_OUTPUT_DEPENDENCY_COMMANDS 397 | # ----------------------------- 398 | # This macro should only be invoked once -- use via AC_REQUIRE. 399 | # 400 | # This code is only required when automatic dependency tracking 401 | # is enabled. FIXME. This creates each `.P' file that we will 402 | # need in order to bootstrap the dependency handling code. 403 | AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], 404 | [AC_CONFIG_COMMANDS([depfiles], 405 | [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], 406 | [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) 407 | ]) 408 | 409 | # Do all the work for Automake. -*- Autoconf -*- 410 | 411 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 412 | # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. 413 | # 414 | # This file is free software; the Free Software Foundation 415 | # gives unlimited permission to copy and/or distribute it, 416 | # with or without modifications, as long as this notice is preserved. 417 | 418 | # serial 16 419 | 420 | # This macro actually does too much. Some checks are only needed if 421 | # your package does certain things. But this isn't really a big deal. 422 | 423 | # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) 424 | # AM_INIT_AUTOMAKE([OPTIONS]) 425 | # ----------------------------------------------- 426 | # The call with PACKAGE and VERSION arguments is the old style 427 | # call (pre autoconf-2.50), which is being phased out. PACKAGE 428 | # and VERSION should now be passed to AC_INIT and removed from 429 | # the call to AM_INIT_AUTOMAKE. 430 | # We support both call styles for the transition. After 431 | # the next Automake release, Autoconf can make the AC_INIT 432 | # arguments mandatory, and then we can depend on a new Autoconf 433 | # release and drop the old call support. 434 | AC_DEFUN([AM_INIT_AUTOMAKE], 435 | [AC_PREREQ([2.62])dnl 436 | dnl Autoconf wants to disallow AM_ names. We explicitly allow 437 | dnl the ones we care about. 438 | m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl 439 | AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl 440 | AC_REQUIRE([AC_PROG_INSTALL])dnl 441 | if test "`cd $srcdir && pwd`" != "`pwd`"; then 442 | # Use -I$(srcdir) only when $(srcdir) != ., so that make's output 443 | # is not polluted with repeated "-I." 444 | AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl 445 | # test to see if srcdir already configured 446 | if test -f $srcdir/config.status; then 447 | AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) 448 | fi 449 | fi 450 | 451 | # test whether we have cygpath 452 | if test -z "$CYGPATH_W"; then 453 | if (cygpath --version) >/dev/null 2>/dev/null; then 454 | CYGPATH_W='cygpath -w' 455 | else 456 | CYGPATH_W=echo 457 | fi 458 | fi 459 | AC_SUBST([CYGPATH_W]) 460 | 461 | # Define the identity of the package. 462 | dnl Distinguish between old-style and new-style calls. 463 | m4_ifval([$2], 464 | [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl 465 | AC_SUBST([PACKAGE], [$1])dnl 466 | AC_SUBST([VERSION], [$2])], 467 | [_AM_SET_OPTIONS([$1])dnl 468 | dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. 469 | m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, 470 | [m4_fatal([AC_INIT should be called with package and version arguments])])dnl 471 | AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl 472 | AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl 473 | 474 | _AM_IF_OPTION([no-define],, 475 | [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) 476 | AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl 477 | 478 | # Some tools Automake needs. 479 | AC_REQUIRE([AM_SANITY_CHECK])dnl 480 | AC_REQUIRE([AC_ARG_PROGRAM])dnl 481 | AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) 482 | AM_MISSING_PROG(AUTOCONF, autoconf) 483 | AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) 484 | AM_MISSING_PROG(AUTOHEADER, autoheader) 485 | AM_MISSING_PROG(MAKEINFO, makeinfo) 486 | AC_REQUIRE([AM_PROG_INSTALL_SH])dnl 487 | AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl 488 | AC_REQUIRE([AM_PROG_MKDIR_P])dnl 489 | # We need awk for the "check" target. The system "awk" is bad on 490 | # some platforms. 491 | AC_REQUIRE([AC_PROG_AWK])dnl 492 | AC_REQUIRE([AC_PROG_MAKE_SET])dnl 493 | AC_REQUIRE([AM_SET_LEADING_DOT])dnl 494 | _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], 495 | [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], 496 | [_AM_PROG_TAR([v7])])]) 497 | _AM_IF_OPTION([no-dependencies],, 498 | [AC_PROVIDE_IFELSE([AC_PROG_CC], 499 | [_AM_DEPENDENCIES(CC)], 500 | [define([AC_PROG_CC], 501 | defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl 502 | AC_PROVIDE_IFELSE([AC_PROG_CXX], 503 | [_AM_DEPENDENCIES(CXX)], 504 | [define([AC_PROG_CXX], 505 | defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl 506 | AC_PROVIDE_IFELSE([AC_PROG_OBJC], 507 | [_AM_DEPENDENCIES(OBJC)], 508 | [define([AC_PROG_OBJC], 509 | defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl 510 | ]) 511 | _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl 512 | dnl The `parallel-tests' driver may need to know about EXEEXT, so add the 513 | dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro 514 | dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. 515 | AC_CONFIG_COMMANDS_PRE(dnl 516 | [m4_provide_if([_AM_COMPILER_EXEEXT], 517 | [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl 518 | ]) 519 | 520 | dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not 521 | dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further 522 | dnl mangled by Autoconf and run in a shell conditional statement. 523 | m4_define([_AC_COMPILER_EXEEXT], 524 | m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) 525 | 526 | 527 | # When config.status generates a header, we must update the stamp-h file. 528 | # This file resides in the same directory as the config header 529 | # that is generated. The stamp files are numbered to have different names. 530 | 531 | # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the 532 | # loop where config.status creates the headers, so we can generate 533 | # our stamp files there. 534 | AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], 535 | [# Compute $1's index in $config_headers. 536 | _am_arg=$1 537 | _am_stamp_count=1 538 | for _am_header in $config_headers :; do 539 | case $_am_header in 540 | $_am_arg | $_am_arg:* ) 541 | break ;; 542 | * ) 543 | _am_stamp_count=`expr $_am_stamp_count + 1` ;; 544 | esac 545 | done 546 | echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) 547 | 548 | # Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. 549 | # 550 | # This file is free software; the Free Software Foundation 551 | # gives unlimited permission to copy and/or distribute it, 552 | # with or without modifications, as long as this notice is preserved. 553 | 554 | # AM_PROG_INSTALL_SH 555 | # ------------------ 556 | # Define $install_sh. 557 | AC_DEFUN([AM_PROG_INSTALL_SH], 558 | [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl 559 | if test x"${install_sh}" != xset; then 560 | case $am_aux_dir in 561 | *\ * | *\ *) 562 | install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; 563 | *) 564 | install_sh="\${SHELL} $am_aux_dir/install-sh" 565 | esac 566 | fi 567 | AC_SUBST(install_sh)]) 568 | 569 | # Copyright (C) 2003, 2005 Free Software Foundation, Inc. 570 | # 571 | # This file is free software; the Free Software Foundation 572 | # gives unlimited permission to copy and/or distribute it, 573 | # with or without modifications, as long as this notice is preserved. 574 | 575 | # serial 2 576 | 577 | # Check whether the underlying file-system supports filenames 578 | # with a leading dot. For instance MS-DOS doesn't. 579 | AC_DEFUN([AM_SET_LEADING_DOT], 580 | [rm -rf .tst 2>/dev/null 581 | mkdir .tst 2>/dev/null 582 | if test -d .tst; then 583 | am__leading_dot=. 584 | else 585 | am__leading_dot=_ 586 | fi 587 | rmdir .tst 2>/dev/null 588 | AC_SUBST([am__leading_dot])]) 589 | 590 | # Check to see how 'make' treats includes. -*- Autoconf -*- 591 | 592 | # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. 593 | # 594 | # This file is free software; the Free Software Foundation 595 | # gives unlimited permission to copy and/or distribute it, 596 | # with or without modifications, as long as this notice is preserved. 597 | 598 | # serial 4 599 | 600 | # AM_MAKE_INCLUDE() 601 | # ----------------- 602 | # Check to see how make treats includes. 603 | AC_DEFUN([AM_MAKE_INCLUDE], 604 | [am_make=${MAKE-make} 605 | cat > confinc << 'END' 606 | am__doit: 607 | @echo this is the am__doit target 608 | .PHONY: am__doit 609 | END 610 | # If we don't find an include directive, just comment out the code. 611 | AC_MSG_CHECKING([for style of include used by $am_make]) 612 | am__include="#" 613 | am__quote= 614 | _am_result=none 615 | # First try GNU make style include. 616 | echo "include confinc" > confmf 617 | # Ignore all kinds of additional output from `make'. 618 | case `$am_make -s -f confmf 2> /dev/null` in #( 619 | *the\ am__doit\ target*) 620 | am__include=include 621 | am__quote= 622 | _am_result=GNU 623 | ;; 624 | esac 625 | # Now try BSD make style include. 626 | if test "$am__include" = "#"; then 627 | echo '.include "confinc"' > confmf 628 | case `$am_make -s -f confmf 2> /dev/null` in #( 629 | *the\ am__doit\ target*) 630 | am__include=.include 631 | am__quote="\"" 632 | _am_result=BSD 633 | ;; 634 | esac 635 | fi 636 | AC_SUBST([am__include]) 637 | AC_SUBST([am__quote]) 638 | AC_MSG_RESULT([$_am_result]) 639 | rm -f confinc confmf 640 | ]) 641 | 642 | # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- 643 | 644 | # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 645 | # Free Software Foundation, Inc. 646 | # 647 | # This file is free software; the Free Software Foundation 648 | # gives unlimited permission to copy and/or distribute it, 649 | # with or without modifications, as long as this notice is preserved. 650 | 651 | # serial 6 652 | 653 | # AM_MISSING_PROG(NAME, PROGRAM) 654 | # ------------------------------ 655 | AC_DEFUN([AM_MISSING_PROG], 656 | [AC_REQUIRE([AM_MISSING_HAS_RUN]) 657 | $1=${$1-"${am_missing_run}$2"} 658 | AC_SUBST($1)]) 659 | 660 | 661 | # AM_MISSING_HAS_RUN 662 | # ------------------ 663 | # Define MISSING if not defined so far and test if it supports --run. 664 | # If it does, set am_missing_run to use it, otherwise, to nothing. 665 | AC_DEFUN([AM_MISSING_HAS_RUN], 666 | [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl 667 | AC_REQUIRE_AUX_FILE([missing])dnl 668 | if test x"${MISSING+set}" != xset; then 669 | case $am_aux_dir in 670 | *\ * | *\ *) 671 | MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; 672 | *) 673 | MISSING="\${SHELL} $am_aux_dir/missing" ;; 674 | esac 675 | fi 676 | # Use eval to expand $SHELL 677 | if eval "$MISSING --run true"; then 678 | am_missing_run="$MISSING --run " 679 | else 680 | am_missing_run= 681 | AC_MSG_WARN([`missing' script is too old or missing]) 682 | fi 683 | ]) 684 | 685 | # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. 686 | # 687 | # This file is free software; the Free Software Foundation 688 | # gives unlimited permission to copy and/or distribute it, 689 | # with or without modifications, as long as this notice is preserved. 690 | 691 | # AM_PROG_MKDIR_P 692 | # --------------- 693 | # Check for `mkdir -p'. 694 | AC_DEFUN([AM_PROG_MKDIR_P], 695 | [AC_PREREQ([2.60])dnl 696 | AC_REQUIRE([AC_PROG_MKDIR_P])dnl 697 | dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, 698 | dnl while keeping a definition of mkdir_p for backward compatibility. 699 | dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. 700 | dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of 701 | dnl Makefile.ins that do not define MKDIR_P, so we do our own 702 | dnl adjustment using top_builddir (which is defined more often than 703 | dnl MKDIR_P). 704 | AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl 705 | case $mkdir_p in 706 | [[\\/$]]* | ?:[[\\/]]*) ;; 707 | */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; 708 | esac 709 | ]) 710 | 711 | # Helper functions for option handling. -*- Autoconf -*- 712 | 713 | # Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. 714 | # 715 | # This file is free software; the Free Software Foundation 716 | # gives unlimited permission to copy and/or distribute it, 717 | # with or without modifications, as long as this notice is preserved. 718 | 719 | # serial 4 720 | 721 | # _AM_MANGLE_OPTION(NAME) 722 | # ----------------------- 723 | AC_DEFUN([_AM_MANGLE_OPTION], 724 | [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) 725 | 726 | # _AM_SET_OPTION(NAME) 727 | # ------------------------------ 728 | # Set option NAME. Presently that only means defining a flag for this option. 729 | AC_DEFUN([_AM_SET_OPTION], 730 | [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) 731 | 732 | # _AM_SET_OPTIONS(OPTIONS) 733 | # ---------------------------------- 734 | # OPTIONS is a space-separated list of Automake options. 735 | AC_DEFUN([_AM_SET_OPTIONS], 736 | [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) 737 | 738 | # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) 739 | # ------------------------------------------- 740 | # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. 741 | AC_DEFUN([_AM_IF_OPTION], 742 | [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) 743 | 744 | # Check to make sure that the build environment is sane. -*- Autoconf -*- 745 | 746 | # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 747 | # Free Software Foundation, Inc. 748 | # 749 | # This file is free software; the Free Software Foundation 750 | # gives unlimited permission to copy and/or distribute it, 751 | # with or without modifications, as long as this notice is preserved. 752 | 753 | # serial 5 754 | 755 | # AM_SANITY_CHECK 756 | # --------------- 757 | AC_DEFUN([AM_SANITY_CHECK], 758 | [AC_MSG_CHECKING([whether build environment is sane]) 759 | # Just in case 760 | sleep 1 761 | echo timestamp > conftest.file 762 | # Reject unsafe characters in $srcdir or the absolute working directory 763 | # name. Accept space and tab only in the latter. 764 | am_lf=' 765 | ' 766 | case `pwd` in 767 | *[[\\\"\#\$\&\'\`$am_lf]]*) 768 | AC_MSG_ERROR([unsafe absolute working directory name]);; 769 | esac 770 | case $srcdir in 771 | *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) 772 | AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; 773 | esac 774 | 775 | # Do `set' in a subshell so we don't clobber the current shell's 776 | # arguments. Must try -L first in case configure is actually a 777 | # symlink; some systems play weird games with the mod time of symlinks 778 | # (eg FreeBSD returns the mod time of the symlink's containing 779 | # directory). 780 | if ( 781 | set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` 782 | if test "$[*]" = "X"; then 783 | # -L didn't work. 784 | set X `ls -t "$srcdir/configure" conftest.file` 785 | fi 786 | rm -f conftest.file 787 | if test "$[*]" != "X $srcdir/configure conftest.file" \ 788 | && test "$[*]" != "X conftest.file $srcdir/configure"; then 789 | 790 | # If neither matched, then we have a broken ls. This can happen 791 | # if, for instance, CONFIG_SHELL is bash and it inherits a 792 | # broken ls alias from the environment. This has actually 793 | # happened. Such a system could not be considered "sane". 794 | AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken 795 | alias in your environment]) 796 | fi 797 | 798 | test "$[2]" = conftest.file 799 | ) 800 | then 801 | # Ok. 802 | : 803 | else 804 | AC_MSG_ERROR([newly created file is older than distributed files! 805 | Check your system clock]) 806 | fi 807 | AC_MSG_RESULT(yes)]) 808 | 809 | # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. 810 | # 811 | # This file is free software; the Free Software Foundation 812 | # gives unlimited permission to copy and/or distribute it, 813 | # with or without modifications, as long as this notice is preserved. 814 | 815 | # AM_PROG_INSTALL_STRIP 816 | # --------------------- 817 | # One issue with vendor `install' (even GNU) is that you can't 818 | # specify the program used to strip binaries. This is especially 819 | # annoying in cross-compiling environments, where the build's strip 820 | # is unlikely to handle the host's binaries. 821 | # Fortunately install-sh will honor a STRIPPROG variable, so we 822 | # always use install-sh in `make install-strip', and initialize 823 | # STRIPPROG with the value of the STRIP variable (set by the user). 824 | AC_DEFUN([AM_PROG_INSTALL_STRIP], 825 | [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl 826 | # Installed binaries are usually stripped using `strip' when the user 827 | # run `make install-strip'. However `strip' might not be the right 828 | # tool to use in cross-compilation environments, therefore Automake 829 | # will honor the `STRIP' environment variable to overrule this program. 830 | dnl Don't test for $cross_compiling = yes, because it might be `maybe'. 831 | if test "$cross_compiling" != no; then 832 | AC_CHECK_TOOL([STRIP], [strip], :) 833 | fi 834 | INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" 835 | AC_SUBST([INSTALL_STRIP_PROGRAM])]) 836 | 837 | # Copyright (C) 2006, 2008 Free Software Foundation, Inc. 838 | # 839 | # This file is free software; the Free Software Foundation 840 | # gives unlimited permission to copy and/or distribute it, 841 | # with or without modifications, as long as this notice is preserved. 842 | 843 | # serial 2 844 | 845 | # _AM_SUBST_NOTMAKE(VARIABLE) 846 | # --------------------------- 847 | # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. 848 | # This macro is traced by Automake. 849 | AC_DEFUN([_AM_SUBST_NOTMAKE]) 850 | 851 | # AM_SUBST_NOTMAKE(VARIABLE) 852 | # --------------------------- 853 | # Public sister of _AM_SUBST_NOTMAKE. 854 | AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) 855 | 856 | # Check how to create a tarball. -*- Autoconf -*- 857 | 858 | # Copyright (C) 2004, 2005 Free Software Foundation, Inc. 859 | # 860 | # This file is free software; the Free Software Foundation 861 | # gives unlimited permission to copy and/or distribute it, 862 | # with or without modifications, as long as this notice is preserved. 863 | 864 | # serial 2 865 | 866 | # _AM_PROG_TAR(FORMAT) 867 | # -------------------- 868 | # Check how to create a tarball in format FORMAT. 869 | # FORMAT should be one of `v7', `ustar', or `pax'. 870 | # 871 | # Substitute a variable $(am__tar) that is a command 872 | # writing to stdout a FORMAT-tarball containing the directory 873 | # $tardir. 874 | # tardir=directory && $(am__tar) > result.tar 875 | # 876 | # Substitute a variable $(am__untar) that extract such 877 | # a tarball read from stdin. 878 | # $(am__untar) < result.tar 879 | AC_DEFUN([_AM_PROG_TAR], 880 | [# Always define AMTAR for backward compatibility. 881 | AM_MISSING_PROG([AMTAR], [tar]) 882 | m4_if([$1], [v7], 883 | [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], 884 | [m4_case([$1], [ustar],, [pax],, 885 | [m4_fatal([Unknown tar format])]) 886 | AC_MSG_CHECKING([how to create a $1 tar archive]) 887 | # Loop over all known methods to create a tar archive until one works. 888 | _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' 889 | _am_tools=${am_cv_prog_tar_$1-$_am_tools} 890 | # Do not fold the above two line into one, because Tru64 sh and 891 | # Solaris sh will not grok spaces in the rhs of `-'. 892 | for _am_tool in $_am_tools 893 | do 894 | case $_am_tool in 895 | gnutar) 896 | for _am_tar in tar gnutar gtar; 897 | do 898 | AM_RUN_LOG([$_am_tar --version]) && break 899 | done 900 | am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' 901 | am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' 902 | am__untar="$_am_tar -xf -" 903 | ;; 904 | plaintar) 905 | # Must skip GNU tar: if it does not support --format= it doesn't create 906 | # ustar tarball either. 907 | (tar --version) >/dev/null 2>&1 && continue 908 | am__tar='tar chf - "$$tardir"' 909 | am__tar_='tar chf - "$tardir"' 910 | am__untar='tar xf -' 911 | ;; 912 | pax) 913 | am__tar='pax -L -x $1 -w "$$tardir"' 914 | am__tar_='pax -L -x $1 -w "$tardir"' 915 | am__untar='pax -r' 916 | ;; 917 | cpio) 918 | am__tar='find "$$tardir" -print | cpio -o -H $1 -L' 919 | am__tar_='find "$tardir" -print | cpio -o -H $1 -L' 920 | am__untar='cpio -i -H $1 -d' 921 | ;; 922 | none) 923 | am__tar=false 924 | am__tar_=false 925 | am__untar=false 926 | ;; 927 | esac 928 | 929 | # If the value was cached, stop now. We just wanted to have am__tar 930 | # and am__untar set. 931 | test -n "${am_cv_prog_tar_$1}" && break 932 | 933 | # tar/untar a dummy directory, and stop if the command works 934 | rm -rf conftest.dir 935 | mkdir conftest.dir 936 | echo GrepMe > conftest.dir/file 937 | AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) 938 | rm -rf conftest.dir 939 | if test -s conftest.tar; then 940 | AM_RUN_LOG([$am__untar /dev/null 2>&1 && break 942 | fi 943 | done 944 | rm -rf conftest.dir 945 | 946 | AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) 947 | AC_MSG_RESULT([$am_cv_prog_tar_$1])]) 948 | AC_SUBST([am__tar]) 949 | AC_SUBST([am__untar]) 950 | ]) # _AM_PROG_TAR 951 | 952 | --------------------------------------------------------------------------------