avfs-1.1.4/0000755000175000001440000000000014032341025007443 500000000000000avfs-1.1.4/NEWS0000644000175000001440000002172614032341001010064 00000000000000Changes from 1.1.3 to 1.1.4 (2021-04-04) - add support for lzip Changes from 1.1.2 to 1.1.3 (2020-08-12) - fix compilation problem on MacOS - fix encoding problem in ulha extfs module Changes from 1.1.1 to 1.1.2 (2020-04-27) - add support for rar 5.0 files - fix memleak in zstd support - small fix for extfs udar module Changes from 1.1.0 to 1.1.1 (2019-08-09) - updated internal bzlib to 1.0.8 to fix security bug - added pkgconfig file Changes from 1.0.6 to 1.1.0 (2019-06-21) - improved handling of single '#' to stop resolving archive handlers when it makes no sense to add another chain - support multiple gzip member in a single file (concatenated gzip files) - updated webdav module with work with latest libneon (which is no longer bundled) - CODA and PRELOAD support has been removed Changes from 1.0.5 to 1.0.6 (2018-08-26) - added support for libzstd (zst files) - fixed arbitrary command execution in rsh/ssh module - zip workaround for zip archives with unix attributes but regular files are not marked correctly Changes from 1.0.4 to 1.0.5 (2017-05-03) - limit the file cache to 50 elements and age of 10 minutes to avoid endless grow of internal cache - allow reproducable builds - fixed crash in parsing ls output for modules which need to handle ls-like output - fix urar module when external rar/unrar tool crashed Changes from 1.0.3 to 1.0.4 (2016-09-14) - fixed zip module to correctly read archives with a lot of files or very large files Changes from 1.0.2 to 1.0.3 (2015-06-13) - fixed zlib assert triggered for some Huffman encodings - added rar v5 in extfs urar (which is also renamed to uextrar to avoid collision with internal rar module) - some configure script improvements have been done for fuse and liblzma dependencies Changes from 1.0.1 to 1.0.2 (2014-06-29) - fixed access to files which are larger than 4GB in modules based on archive, state, and utar - added support in utar modules for files larger than 8GB - added zip64 support in uzip module to support more than 64k files and files larger then 4 GiB - improved utar module to skip sime extended headers (so there will no longer be pseudo PaxHeaders files) - changed some extfs scripts to no longer require bash Changes from 1.0.0 to 1.0.1 (2012-06-12) - compile fixes for macos - fixed hard link count for extfs directories - extfs updates to use bash as executing shell - xz handler support quite some more file endings Changes from 0.9.9 to 1.0.0 (2011-07-11) - fixed possible crash due to race condition in namespace module Changes from 0.9.8 to 0.9.9 (2010-10-06) - fixed race condition in avfsd - system zlib and bzlib may be used instead of shipped versions. Access is slower for some operations (e.g. seeking) - updated bzlib to 1.0.6 - support for liblzma has been added so xz and lzma files can be accessed. There is also a module named uxze which uses the external command xz so even without liblzma such archives can be accessed. - fixed crash in ftp module when password file is empty - updated extfs handler and added some new handlers - added ucftp module for uncached ftp support with read and write Changes from 0.9.7 to 0.9.8 (2007-05-31) - utar supports long names in POSIX ustar archives - fixed truncation of 100 byte long file names in tar archive - fixed crash in zlib code - fixed deadlock in extfs code - updated bzlib to 1.0.3 - updated avfsd to use fuse API version 26 - several extfs fixes: - fixed ucpio script - fixed bug in extfs symlink handling (patch from Tanmoy Bhattacharya) - fixed ftplist to output correct symlinks and to support http/ssh (patch from Tanmoy Bhattacharya) - extfs scripts rpm and trpm outputs correct file sizes (important for fuse) (patch from Tanmoy Bhattacharya) - ftppass/davpass checks for additional base avfs directories. Environment variable AVFSBASE can be set for non-default directory. (patch from Tanmoy Bhattacharya) - ftp module supports @ in usernames (patch from Tanmoy Bhattacharya) - the avfs library is built and installed by default additionally to fuse/avfscoda/preload depending on the actual system - added RPM spec file for avfs-fuse (patch from Tanmoy Bhattacharya) Changes from 0.9.6 to 0.9.7 (2006-06-14) - Fuse daemon can now be installed with --enable-fuse - added symlink rewriting code to make absolute symlinks relative There is an avfsstat entry to toggle this symlink rewrite - temporary files from extfs are cached which speeds up accessing files inside extfs archives - urar module uses unrar in case of missing rar - changed ftp module to use "LIST -al" instead of "LIST -an" to support ftp servers which don't allow the "-an" argument - fixed bug in ftp module when getting ftp files from the root directory - utar and ftp module should be able to handle >2G files - updated extfs modules - fixed invisible hidden files for iso9660 - added extfs support for 7zip - fixed possible segfault in extfs module - fixed bug in the ulha extfs module which had problems with file names containing spaces - updated documentation Changes from 0.9.5 to 0.9.6 - fixed return value of local_close so errors in close() can be detected - updated date parsing in extfs so patchfs handler works again - urar module should be able to read rar archives from newer rar versions Changes from 0.9.3 to 0.9.5 - improved support for magic character inside filenames - fixed endless loop in bz2 handler - automake is now used for building avfs - updated extfs handlers - other small bugfixes (see ChangeLog for details) Changes from 0.9.1 to 0.9.3 - Bugfixes (see ChangeLog for details) Changes from 0.9.0 to 0.9.1 - Lots of bugfixes (see ChangeLog for details) - Optimized lookups in large directories Changes from 0.5.2 to 0.9.0 - Major rewrite touching almost all interfaces and code - Magic char changed from '@' to '#'. I hope this is the last such change ;) - New handlers: o ftp (read only for the moment) o http o rsh o dav (contributed by Justin Mason) - Other improvements: o Indexing of gzip and bzip2 files. This achieves fast random access to the uncompressed files without caching to whole file. o Better disk cache management, tunable parameters in /#avfsstat/cache o Multi-threaded operation for avfscoda and preload o Philosophy change for preload method: only a thin client is preloaded, work done in a server o Write support is working in avfscoda, redir doesn't fully support this yet o Support for avfscoda with reiserfs (2.4.4 and above) - Degradations: o ugz, utar, floppy, are now read only. Will be fixed. o Preload is only supported on Solaris, old Linux libc's are now not supported. o A few things are missing from the preload method (you can't 'cd' into archive, mmap() doesn't work, etc.), Will eventually be fixed. Changes from 0.5.1 to 0.5.2 - Fixed redir.c compilation problems with newer LIBCs - Made redir.c work on 2.4.x kernels Changes from 0.5 to 0.5.1 - Fixed installation problems Changes from 0.4 to 0.5 - Avfscoda introduced, because the preload method will not work for GLIBC 2.1 and up. - Fixed minor bug in zipfile handling (jar files) Changes from 0.3 to 0.4 - 'External fs' from Midnight Commander. This provides handlers for rpm, deb, zoo, lha, cpio etc... - Performance enhancements with 'ugz' handler (now uses zlib) - Write support for tar-archives - Write support for gzip-files - Tested on Solaris 2.7 - Changed module versioning scheme - Fixed some bugs: o Work around tcsh closing all file descriptors o Fixed symlink resolvation bug o Fixed floppy bugs (mtoos does weird things with 0 sized files) Changes from version 0.2 to 0.3 - Magic char is now '@' instead of ':' - Small path-format change (move it closer to the mc-vfs format) - Symbolic link handling - Solaris 2.6 support - Performance enhancements (e.g. 'cp -r' for .tgz, zipfiles) - Avfsstat handler: information about avfs - 'ar' handling (.a and .deb files) - Floppy handling (read/write) - RAR-file support finished - Non shared mmap-ing of virtual files (some versions of grep need this) - BIG internal changes + minor changes to the module interface - Configuring with autoconf - RPM spec files for Linux GLIBC and libc5 Changes from version 0.1.1 to 0.2 - ZIP-file support - Partial RAR-file support - Performance improvements for compressed files - Now stable on Solaris as well as Linux. - Modular handlers - Many-many bugs fixed Changes from version 0.1 to 0.1.1 - Fixed a security bug spotted by Jan Niehusmann - Fixed the .avfs_dummyfile bug first spotted by Demon of the Known Universe Version 0.1 - First release avfs-1.1.4/AUTHORS0000644000175000001440000000011314032341001010420 00000000000000Miklos Szeredi Ralf Hoffmann avfs-1.1.4/config.h.in0000644000175000001440000000740114032341012011404 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if you have the `atoll' function. */ #undef HAVE_ATOLL /* Define to 1 if you have the header file. */ #undef HAVE_DLFCN_H /* Define if your struct direntry has d_off */ #undef HAVE_D_OFF /* Define if your struct direntry has d_type */ #undef HAVE_D_TYPE /* Define to 1 if you have the `getgrgid_r' function. */ #undef HAVE_GETGRGID_R /* Define to 1 if you have the `getgrnam_r' function. */ #undef HAVE_GETGRNAM_R /* Define to 1 if you have the `getpwnam_r' function. */ #undef HAVE_GETPWNAM_R /* Define to 1 if you have the `getpwuid_r' function. */ #undef HAVE_GETPWUID_R /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the `dl' library (-ldl). */ #undef HAVE_LIBDL /* Define to 1 if your system has libfuse installed */ #undef HAVE_LIBFUSE /* Define to 1 if your system has liblzip installed */ #undef HAVE_LIBLZIP /* Define to 1 if your system has liblzma installed */ #undef HAVE_LIBLZMA /* Define to 1 if your system has libneon installed */ #undef HAVE_LIBNEON /* Define to 1 if you have the `pthread' library (-lpthread). */ #undef HAVE_LIBPTHREAD /* Define to 1 if your system has libzstd installed */ #undef HAVE_LIBZSTD /* Define to 1 if you have the header file. */ #undef HAVE_LZLIB_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `mkdtemp' function. */ #undef HAVE_MKDTEMP /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strncasecmp' function. */ #undef HAVE_STRNCASECMP /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STATVFS_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF /* Define to the sub-directory where libtool stores uninstalled libraries. */ #undef LT_OBJDIR /* Define to 1 if `major', `minor', and `makedev' are declared in . */ #undef MAJOR_IN_MKDEV /* Define to 1 if `major', `minor', and `makedev' are declared in . */ #undef MAJOR_IN_SYSMACROS /* Name of package */ #undef PACKAGE /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT /* Define to the full name of this package. */ #undef PACKAGE_NAME /* Define to the full name and version of this package. */ #undef PACKAGE_STRING /* Define to the one symbol short name of this package. */ #undef PACKAGE_TARNAME /* Define to the home page for this package. */ #undef PACKAGE_URL /* Define to the version of this package. */ #undef PACKAGE_VERSION /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define if you want to use system bzlib library */ #undef USE_SYSTEM_BZLIB /* Define if you want to use system zlib library */ #undef USE_SYSTEM_ZLIB /* Version number of package */ #undef VERSION /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 #endif /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES avfs-1.1.4/test/0000755000175000001440000000000014032341025010422 500000000000000avfs-1.1.4/test/runtest.c0000644000175000001440000001272714032341001012215 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "virtual.h" #include #include #include #include #include #define TESTDIR "/tmp/avfstest" typedef int (*testfunc) (void *); struct test { char *name; struct test *next; struct test *sub; void *data; testfunc func; }; #define TESTFILESIZE 102400 struct filetest { const char *filename; unsigned char data[TESTFILESIZE]; }; static struct test *test_new(struct test *tg, const char *name) { struct test *ng; struct test **tgp; for(tgp = &tg->sub; *tgp != NULL; tgp = &(*tgp)->next); ng = malloc(sizeof(*ng)); ng->sub = NULL; ng->next = NULL; ng->name = strdup(name); ng->data = NULL; ng->func = NULL; *tgp = ng; return ng; } static void test_add(struct test *tg, const char *name, void *data, testfunc func) { struct test *tc; tc = test_new(tg, name); tc->data = data; tc->func = func; } static void tab(int i) { for(; i > 0; i--) putchar(' '); } static int test_run_path(struct test *tg, const char *path) { int ok; int res; char *newpath; if(tg == NULL) return 0; newpath = malloc(strlen(path) + 1 + strlen(tg->name) + 1); sprintf(newpath, "%s.%s", path, tg->name); ok = test_run_path(tg->sub, newpath); if(tg->func != NULL) { int len = printf("%s:", newpath); tab(60 - len); res = tg->func(tg->data); printf("%s\n", res ? "OK" : "FAILED"); if(!res) ok = 0; } free(newpath); res = test_run_path(tg->next, path); if(!res) ok = 0; return ok; } static int test_run(struct test *tg) { return test_run_path(tg, ""); } static int test_rmr(const char *file) { int res; DIR *dirp; struct dirent *ent; char *name; res = unlink(file); if(res == 0) return 0; res = rmdir(file); if(res == 0) return 0; dirp = opendir(file); if(dirp == NULL) return -1; while((ent = readdir(dirp)) != NULL) { name = ent->d_name; if(name[0] != '.' || (name[1] && (name[1] != '.' || name[2]))) { char *newname; newname = malloc(strlen(file) + 1 + strlen(name) + 1); sprintf(newname, "%s/%s", file, name); test_rmr(newname); free(newname); } } closedir(dirp); return rmdir(file); } static void test_init() { test_rmr(TESTDIR); mkdir(TESTDIR, 0777); } static char *test_file(const char *name) { char *fullname = malloc(strlen(TESTDIR) + 1 + strlen(name) + 1); sprintf(fullname, "%s/%s", TESTDIR, name); return fullname; } static int file_create(struct filetest *ft) { int res; int fd; off_t off; size_t size; res = virt_open(ft->filename, O_WRONLY | O_CREAT | O_EXCL, 0666); if(res == -1) return 0; fd = res; for(off = 0; off < TESTFILESIZE; off += size) { size = rand() % TESTFILESIZE / 2; if(off + size > TESTFILESIZE) size = TESTFILESIZE - off; res = virt_write(fd, ft->data + off, size); if(res != size) return 0; } res = virt_close(fd); if(res == -1) return 0; return 1; } static int flush_cache() { int res; int fd; fd = virt_open("/#avfsstat/cache/clear", O_WRONLY, 0); if(fd == -1) return -1; res = virt_write(fd, "1", 1); if(res == -1) return -1; res = virt_close(fd); if(res == -1) return -1; return 0; } static int file_contents(struct filetest *ft) { int res; int fd; off_t off; size_t size; char buf[TESTFILESIZE / 2]; res = flush_cache(); if(res == -1) return 0; res = virt_open(ft->filename, O_RDONLY, 0); if(res == -1) return 0; fd = res; for(off = 0; off < TESTFILESIZE; off += size) { size = rand() % TESTFILESIZE / 2; res = virt_read(fd, buf, size); if(off + size > TESTFILESIZE) size = TESTFILESIZE - off; if(res != size) return 0; if(memcmp(ft->data + off, buf, size) != 0) return 0; } res = virt_read(fd, buf, 100); if(res != 0) return 0; res = virt_close(fd); if(res == -1) return 0; return 1; } static void add_filetest(struct test *tg, const char *testname, const char *filename) { struct filetest *ft; struct test *ftg; int i; srand(1); ft = (struct filetest *) malloc(sizeof(*ft)); ftg = test_new(tg, testname); ft->filename = filename; for(i = 0; i < TESTFILESIZE; i++) ft->data[i] = (i + (!(rand() % 30) ? rand() : 0)) % 0x100; test_add(ftg, "create", ft, (testfunc) file_create); test_add(ftg, "contents", ft, (testfunc) file_contents); } int main(int argc, char *argv[]) { int res; struct test root; struct test *tg; test_init(); root.sub = NULL; tg = test_new(&root, "filetest"); add_filetest(tg, "ugzip", test_file("t.gz#ugzip")); add_filetest(tg, "ubzip2", test_file("t.bz2#ubzip2")); add_filetest(tg, "volatile", "/#volatile/testfile"); res = test_run(tg); if(res == 0) return 1; else return 0; } avfs-1.1.4/test/gzip_multimember_test.c0000644000175000001440000000355014032341001015115 00000000000000#include #include #include #include #include #include #include #include #include int main( int argc, char **argv ) { int fd; ssize_t len; char buf[128*1024]; struct stat stat_buf; const char *testfile = "numchar.gz#"; if ( virt_stat( testfile, &stat_buf ) != 0 ) { printf("FAILED: stat failed\n"); return EXIT_FAILURE; } if ( stat_buf.st_size != 2 * 1048576 ) { printf("FAILED: invalid size\n"); return EXIT_FAILURE; } fd = virt_open( testfile, O_RDONLY, 0 ); if ( fd < 0 ) { printf("FAILED: open failed\n"); return EXIT_FAILURE; } ssize_t total_len; for (;;) { len = virt_read( fd, buf, sizeof( buf ) ); total_len += len; if ( len == 0 ) break; else if ( len < 0 ) { printf("FAILED: read failed\n"); return EXIT_FAILURE; } } if ( total_len != 2 * 1048576 ) { printf("FAILED: invalid size\n"); return EXIT_FAILURE; } for (;;) { total_len -= sizeof( buf ); virt_lseek( fd, total_len, 0 ); len = virt_read( fd, buf, sizeof( buf ) ); if ( total_len >= 1048576 ) { char ch = 'A' + ( total_len - 1048576 ) % 10; if ( buf[0] != ch ) { printf("FAILED: invalid char:%c at %lu\n", ch, total_len); return EXIT_FAILURE; } } else { char ch = '0' + ( total_len ) % 10; if ( buf[0] != ch ) { printf("FAILED: invalid char:%c at %lu\n", ch, total_len); return EXIT_FAILURE; } } if ( total_len < sizeof( buf ) ) break; } virt_close( fd ); printf("OK\n"); return 0; } avfs-1.1.4/test/testread.c0000644000175000001440000000315514032341001012317 00000000000000/* this is a very simple test tool for reading any file in an archive, just give the name as argument. * This tool is not meant to be correct or a good example, it is pretty much only useful for debugging * avfs. */ #include #include #include #include #include #include #include #include int main( int argc, char **argv ) { int fd; ssize_t len; char buf[128*1024]; if ( argc < 2 ) { return 0; } struct stat stat_buf; if ( virt_stat( argv[1], &stat_buf ) != 0 ) { printf( "Could not stat %s\n", argv[1] ); } else { printf( "Size: %lu\n", stat_buf.st_size ); } fd = virt_open( argv[1], O_RDONLY, 0 ); if ( fd >= 0 ) { ssize_t total_len = 0; for (;;) { len = virt_read( fd, buf, sizeof( buf ) ); total_len += len; printf( "Bytes read: %lu\n", len ); if ( len == 0 ) break; else if ( len < 0 ) { printf( "Error: %s\n", strerror( errno ) ); break; } } printf( "Total len:%lu\n", total_len ); if ( total_len >= sizeof( buf ) ) { for (;;) { total_len -= sizeof( buf ); virt_lseek( fd, total_len, 0 ); len = virt_read( fd, buf, sizeof( buf ) ); printf( "Bytes read by seeking to %lu: %lu\n", total_len, len ); if ( total_len < sizeof( buf ) ) break; } } virt_close( fd ); } return 0; } avfs-1.1.4/test/Makefile.in0000644000175000001440000005032014032341013012404 00000000000000# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ noinst_PROGRAMS = runtest$(EXEEXT) testread$(EXEEXT) \ gzip_multimember_test$(EXEEXT) subdir = test ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) am_gzip_multimember_test_OBJECTS = gzip_multimember_test.$(OBJEXT) gzip_multimember_test_OBJECTS = $(am_gzip_multimember_test_OBJECTS) gzip_multimember_test_DEPENDENCIES = ../lib/libavfs_static.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = gzip_multimember_test_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(gzip_multimember_test_LDFLAGS) \ $(LDFLAGS) -o $@ am_runtest_OBJECTS = runtest.$(OBJEXT) runtest_OBJECTS = $(am_runtest_OBJECTS) runtest_DEPENDENCIES = ../lib/libavfs_static.la runtest_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(runtest_LDFLAGS) $(LDFLAGS) -o $@ am_testread_OBJECTS = testread.$(OBJEXT) testread_OBJECTS = $(am_testread_OBJECTS) testread_DEPENDENCIES = ../lib/libavfs_static.la testread_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(testread_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/gzip_multimember_test.Po \ ./$(DEPDIR)/runtest.Po ./$(DEPDIR)/testread.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(gzip_multimember_test_SOURCES) $(runtest_SOURCES) \ $(testread_SOURCES) DIST_SOURCES = $(gzip_multimember_test_SOURCES) $(runtest_SOURCES) \ $(testread_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BZLIB_INCLUDE = @BZLIB_INCLUDE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAV = @DAV@ DAV_LS = @DAV_LS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FUSELIBS = @FUSELIBS@ GREP = @GREP@ HAVE_ZIPINFO = @HAVE_ZIPINFO@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ LIBZSTD_LIBS = @LIBZSTD_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NUMVERSION = @NUMVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ ZIP = @ZIP@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_INCLUDE = @ZLIB_INCLUDE@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = -I$(top_srcdir)/include @CFLAGS@ @CPPFLAGS@ runtest_LDFLAGS = @LDFLAGS@ @LIBS@ runtest_LDADD = ../lib/libavfs_static.la runtest_SOURCES = runtest.c testread_LDFLAGS = @LDFLAGS@ @LIBS@ testread_LDADD = ../lib/libavfs_static.la testread_SOURCES = testread.c gzip_multimember_test_LDFLAGS = @LDFLAGS@ @LIBS@ gzip_multimember_test_LDADD = ../lib/libavfs_static.la gzip_multimember_test_SOURCES = gzip_multimember_test.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu test/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu test/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list gzip_multimember_test$(EXEEXT): $(gzip_multimember_test_OBJECTS) $(gzip_multimember_test_DEPENDENCIES) $(EXTRA_gzip_multimember_test_DEPENDENCIES) @rm -f gzip_multimember_test$(EXEEXT) $(AM_V_CCLD)$(gzip_multimember_test_LINK) $(gzip_multimember_test_OBJECTS) $(gzip_multimember_test_LDADD) $(LIBS) runtest$(EXEEXT): $(runtest_OBJECTS) $(runtest_DEPENDENCIES) $(EXTRA_runtest_DEPENDENCIES) @rm -f runtest$(EXEEXT) $(AM_V_CCLD)$(runtest_LINK) $(runtest_OBJECTS) $(runtest_LDADD) $(LIBS) testread$(EXEEXT): $(testread_OBJECTS) $(testread_DEPENDENCIES) $(EXTRA_testread_DEPENDENCIES) @rm -f testread$(EXEEXT) $(AM_V_CCLD)$(testread_LINK) $(testread_OBJECTS) $(testread_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gzip_multimember_test.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runtest.Po@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testread.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/gzip_multimember_test.Po -rm -f ./$(DEPDIR)/runtest.Po -rm -f ./$(DEPDIR)/testread.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/gzip_multimember_test.Po -rm -f ./$(DEPDIR)/runtest.Po -rm -f ./$(DEPDIR)/testread.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstPROGRAMS cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: avfs-1.1.4/test/Makefile.am0000644000175000001440000000075114032341001012373 00000000000000noinst_PROGRAMS = runtest testread gzip_multimember_test AM_CFLAGS = -I$(top_srcdir)/include @CFLAGS@ @CPPFLAGS@ runtest_LDFLAGS = @LDFLAGS@ @LIBS@ runtest_LDADD = ../lib/libavfs_static.la runtest_SOURCES = runtest.c testread_LDFLAGS = @LDFLAGS@ @LIBS@ testread_LDADD = ../lib/libavfs_static.la testread_SOURCES = testread.c gzip_multimember_test_LDFLAGS = @LDFLAGS@ @LIBS@ gzip_multimember_test_LDADD = ../lib/libavfs_static.la gzip_multimember_test_SOURCES = gzip_multimember_test.c avfs-1.1.4/compile0000755000175000001440000001635014032341013010743 00000000000000#! /bin/sh # Wrapper for compilers which do not understand '-c -o'. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2020 Free Software Foundation, Inc. # Written by Tom Tromey . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # This file is maintained in Automake, please report # bugs to or send patches to # . nl=' ' # We need space, tab and new line, in precisely that order. Quoting is # there to prevent tools from complaining about whitespace usage. IFS=" "" $nl" file_conv= # func_file_conv build_file lazy # Convert a $build file to $host form and store it in $file # Currently only supports Windows hosts. If the determined conversion # type is listed in (the comma separated) LAZY, no conversion will # take place. func_file_conv () { file=$1 case $file in / | /[!/]*) # absolute file, and not a UNC file if test -z "$file_conv"; then # lazily determine how to convert abs files case `uname -s` in MINGW*) file_conv=mingw ;; CYGWIN* | MSYS*) file_conv=cygwin ;; *) file_conv=wine ;; esac fi case $file_conv/,$2, in *,$file_conv,*) ;; mingw/*) file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` ;; cygwin/* | msys/*) file=`cygpath -m "$file" || echo "$file"` ;; wine/*) file=`winepath -w "$file" || echo "$file"` ;; esac ;; esac } # func_cl_dashL linkdir # Make cl look for libraries in LINKDIR func_cl_dashL () { func_file_conv "$1" if test -z "$lib_path"; then lib_path=$file else lib_path="$lib_path;$file" fi linker_opts="$linker_opts -LIBPATH:$file" } # func_cl_dashl library # Do a library search-path lookup for cl func_cl_dashl () { lib=$1 found=no save_IFS=$IFS IFS=';' for dir in $lib_path $LIB do IFS=$save_IFS if $shared && test -f "$dir/$lib.dll.lib"; then found=yes lib=$dir/$lib.dll.lib break fi if test -f "$dir/$lib.lib"; then found=yes lib=$dir/$lib.lib break fi if test -f "$dir/lib$lib.a"; then found=yes lib=$dir/lib$lib.a break fi done IFS=$save_IFS if test "$found" != yes; then lib=$lib.lib fi } # func_cl_wrapper cl arg... # Adjust compile command to suit cl func_cl_wrapper () { # Assume a capable shell lib_path= shared=: linker_opts= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. eat=1 case $2 in *.o | *.[oO][bB][jJ]) func_file_conv "$2" set x "$@" -Fo"$file" shift ;; *) func_file_conv "$2" set x "$@" -Fe"$file" shift ;; esac ;; -I) eat=1 func_file_conv "$2" mingw set x "$@" -I"$file" shift ;; -I*) func_file_conv "${1#-I}" mingw set x "$@" -I"$file" shift ;; -l) eat=1 func_cl_dashl "$2" set x "$@" "$lib" shift ;; -l*) func_cl_dashl "${1#-l}" set x "$@" "$lib" shift ;; -L) eat=1 func_cl_dashL "$2" ;; -L*) func_cl_dashL "${1#-L}" ;; -static) shared=false ;; -Wl,*) arg=${1#-Wl,} save_ifs="$IFS"; IFS=',' for flag in $arg; do IFS="$save_ifs" linker_opts="$linker_opts $flag" done IFS="$save_ifs" ;; -Xlinker) eat=1 linker_opts="$linker_opts $2" ;; -*) set x "$@" "$1" shift ;; *.cc | *.CC | *.cxx | *.CXX | *.[cC]++) func_file_conv "$1" set x "$@" -Tp"$file" shift ;; *.c | *.cpp | *.CPP | *.lib | *.LIB | *.Lib | *.OBJ | *.obj | *.[oO]) func_file_conv "$1" mingw set x "$@" "$file" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -n "$linker_opts"; then linker_opts="-link$linker_opts" fi exec "$@" $linker_opts exit 1 } eat= case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: compile [--help] [--version] PROGRAM [ARGS] Wrapper for compilers which do not understand '-c -o'. Remove '-o dest.o' from ARGS, run PROGRAM with the remaining arguments, and rename the output as expected. If you are trying to build a whole package this is not the right script to run: please start by reading the file 'INSTALL'. Report bugs to . EOF exit $? ;; -v | --v*) echo "compile $scriptversion" exit $? ;; cl | *[/\\]cl | cl.exe | *[/\\]cl.exe | \ icl | *[/\\]icl | icl.exe | *[/\\]icl.exe ) func_cl_wrapper "$@" # Doesn't return... ;; esac ofile= cfile= for arg do if test -n "$eat"; then eat= else case $1 in -o) # configure might choose to run compile as 'compile cc -o foo foo.c'. # So we strip '-o arg' only if arg is an object. eat=1 case $2 in *.o | *.obj) ofile=$2 ;; *) set x "$@" -o "$2" shift ;; esac ;; *.c) cfile=$1 set x "$@" "$1" shift ;; *) set x "$@" "$1" shift ;; esac fi shift done if test -z "$ofile" || test -z "$cfile"; then # If no '-o' option was seen then we might have been invoked from a # pattern rule where we don't need one. That is ok -- this is a # normal compilation that the losing compiler can handle. If no # '.c' file was seen then we are probably linking. That is also # ok. exec "$@" fi # Name of file we expect compiler to create. cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` # Create the lock directory. # Note: use '[/\\:.-]' here to ensure that we don't use the same name # that we are using for the .o file. Also, base the name on the expected # object file name, since that is what matters with a parallel build. lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d while true; do if mkdir "$lockdir" >/dev/null 2>&1; then break fi sleep 1 done # FIXME: race condition here if user kills between mkdir and trap. trap "rmdir '$lockdir'; exit 1" 1 2 15 # Run the compile. "$@" ret=$? if test -f "$cofile"; then test "$cofile" = "$ofile" || mv "$cofile" "$ofile" elif test -f "${cofile}bj"; then test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" fi rmdir "$lockdir" exit $ret # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: avfs-1.1.4/modules/0000755000175000001440000000000014032341025011113 500000000000000avfs-1.1.4/modules/bz2.c0000644000175000001440000000133614032341001011671 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. BZ2 module */ #include "filter.h" #include "version.h" extern int av_init_module_bz2(struct vmodule *module); int av_init_module_bz2(struct vmodule *module) { struct avfs *avfs; const char *ubz2_args[3]; const char *bz2_args[2]; ubz2_args[0] = "bzip2"; ubz2_args[1] = "-d"; ubz2_args[2] = NULL; bz2_args[0] = "bzip2"; bz2_args[1] = NULL; /* FIXME: compression level argument */ return av_init_filt(module, AV_VER, "bz2", bz2_args, ubz2_args, NULL, &avfs); } avfs-1.1.4/modules/uz.c0000644000175000001440000000146214032341001011632 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. UZ (uncompress) module using gzip */ #include "filter.h" #include "version.h" int av_init_module_uz(struct vmodule *module) { struct avfs *avfs; struct ext_info uz_exts[5]; const char *uz_args[3]; uz_exts[0].from = ".Z", uz_exts[0].to = NULL; uz_exts[1].from = ".tpz", uz_exts[1].to = ".tar"; uz_exts[2].from = ".tz", uz_exts[2].to = ".tar"; uz_exts[3].from = ".taz", uz_exts[3].to = ".tar"; uz_exts[4].from = NULL; uz_args[0] = "gzip"; uz_args[1] = "-d"; uz_args[2] = NULL; return av_init_filt(module, AV_VER, "uz", uz_args, NULL, uz_exts, &avfs); } avfs-1.1.4/modules/uxz.c0000644000175000001440000001265314032341001012026 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2010 Ralf Hoffmann This program can be distributed under the terms of the GNU GPL. See the file COPYING. UXZ module (based on UBZ2 module) */ #include "version.h" #include "xzfile.h" #include "filecache.h" #include "oper.h" #include "version.h" struct xznode { struct avstat sig; struct xzcache *cache; avino_t ino; }; struct xzhandle { struct xzfile *zfil; vfile *base; struct xznode *node; }; static void xznode_destroy(struct xznode *nod) { av_unref_obj(nod->cache); } static struct xznode *xz_new_node(ventry *ve, struct avstat *stbuf) { struct xznode *nod; AV_NEW_OBJ(nod, xznode_destroy); nod->sig = *stbuf; nod->cache = av_xzcache_new(); nod->ino = av_new_ino(ve->mnt->avfs); return nod; } static int xz_same(struct xznode *nod, struct avstat *stbuf) { if(nod->sig.ino == stbuf->ino && nod->sig.dev == stbuf->dev && nod->sig.size == stbuf->size && AV_TIME_EQ(nod->sig.mtime, stbuf->mtime)) return 1; else return 0; } static struct xznode *xz_do_get_node(ventry *ve, const char *key, struct avstat *stbuf) { static AV_LOCK_DECL(lock); struct xznode *nod; AV_LOCK(lock); nod = (struct xznode *) av_filecache_get(key); if(nod != NULL) { if(!xz_same(nod, stbuf)) { av_unref_obj(nod); nod = NULL; } } if(nod == NULL) { nod = xz_new_node(ve, stbuf); av_filecache_set(key, nod); } AV_UNLOCK(lock); return nod; } static int xz_getnode(ventry *ve, vfile *base, struct xznode **resp) { int res; struct avstat stbuf; const int attrmask = AVA_INO | AVA_DEV | AVA_SIZE | AVA_MTIME; struct xznode *nod; char *key; res = av_fgetattr(base, &stbuf, attrmask); if(res < 0) return res; res = av_filecache_getkey(ve, &key); if(res < 0) return res; nod = xz_do_get_node(ve, key, &stbuf); av_free(key); *resp = nod; return 0; } static int xz_lookup(ventry *ve, const char *name, void **newp) { char *path = (char *) ve->data; if(path == NULL) { if(name[0] != '\0') return -ENOENT; if(ve->mnt->opts[0] != '\0') return -ENOENT; path = av_strdup(name); } else if(name == NULL) { av_free(path); path = NULL; } else return -ENOENT; *newp = path; return 0; } static int xz_access(ventry *ve, int amode) { return av_access(ve->mnt->base, amode); } static int xz_open(ventry *ve, int flags, avmode_t mode, void **resp) { int res; vfile *base; struct xznode *nod; struct xzhandle *fil; if(flags & AVO_DIRECTORY) return -ENOTDIR; if(AV_ISWRITE(flags)) return -EROFS; res = av_open(ve->mnt->base, AVO_RDONLY, 0, &base); if(res < 0) return res; res = xz_getnode(ve, base, &nod); if(res < 0) { av_close(base); return res; } AV_NEW(fil); if((flags & AVO_ACCMODE) != AVO_NOPERM) fil->zfil = av_xzfile_new(base); else fil->zfil = NULL; fil->base = base; fil->node = nod; *resp = fil; return 0; } static int xz_close(vfile *vf) { struct xzhandle *fil = (struct xzhandle *) vf->data; av_unref_obj(fil->zfil); av_unref_obj(fil->node); av_close(fil->base); av_free(fil); return 0; } static avssize_t xz_read(vfile *vf, char *buf, avsize_t nbyte) { avssize_t res; struct xzhandle *fil = (struct xzhandle *) vf->data; res = av_xzfile_pread(fil->zfil, fil->node->cache, buf, nbyte, vf->ptr); if(res > 0) vf->ptr += res; return res; } static int xz_getattr(vfile *vf, struct avstat *buf, int attrmask) { int res; struct xzhandle *fil = (struct xzhandle *) vf->data; struct xznode *nod = fil->node; avoff_t size; const int basemask = AVA_MODE | AVA_UID | AVA_GID | AVA_MTIME | AVA_ATIME | AVA_CTIME; res = av_fgetattr(fil->base, buf, basemask); if(res < 0) return res; if((attrmask & (AVA_SIZE | AVA_BLKCNT)) != 0) { res = av_xzfile_size(fil->zfil, fil->node->cache, &size); if(res == 0 && size == -1) { fil->zfil = av_xzfile_new(fil->base); res = av_xzfile_size(fil->zfil, fil->node->cache, &size); } if(res < 0) return res; buf->size = size; buf->blocks = AV_BLOCKS(buf->size); } buf->mode &= ~(07000); buf->blksize = 4096; buf->dev = vf->mnt->avfs->dev; buf->ino = nod->ino; buf->nlink = 1; return 0; } extern int av_init_module_uxz(struct vmodule *module); int av_init_module_uxz(struct vmodule *module) { int res; struct avfs *avfs; struct ext_info uxz_exts[5]; uxz_exts[0].from = ".tar.xz", uxz_exts[0].to = ".tar"; uxz_exts[1].from = ".txz", uxz_exts[1].to = ".tar"; uxz_exts[2].from = ".xz", uxz_exts[2].to = NULL; uxz_exts[3].from = ".lzma", uxz_exts[3].to = NULL; uxz_exts[4].from = NULL; res = av_new_avfs("uxz", uxz_exts, AV_VER, AVF_NOLOCK, module, &avfs); if(res < 0) return res; avfs->lookup = xz_lookup; avfs->access = xz_access; avfs->open = xz_open; avfs->close = xz_close; avfs->read = xz_read; avfs->getattr = xz_getattr; av_add_avfs(avfs); return 0; } avfs-1.1.4/modules/ucftp.c0000644000175000001440000014713714032341001012327 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000 Miklos Szeredi Copyright (C) 2010 Ralf Hoffmann This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ /* * This file is based on volatile.c and ftp.c and the write patch for * ftp.c from the Zemljanka Commander team */ #include "avfs.h" #include "version.h" #include "state.h" #include "socket.h" #include "filebuf.h" #include "parsels.h" #include #include #include #include #define USER_SEP_STR "@" #define USER_SEP_CHAR (USER_SEP_STR[0]) #define FTP_REPLY_TIMEOUT 30000 #define FTP_READ_TIMEOUT 60000 #define UCFTP_ST_VALID 20 #define UCFTP_DIR_VALID 10 /*************************************** * some internal structures ***************************************/ struct ucftpconn { char *host; char *user; char *password; int busy; int sock; struct filebuf *sockfb; struct ucftpconn *next; int binary; char *cwd; short ft_cancel_ok; struct ucftpentry *root; }; struct ucftpfile { struct ucftpentry *ent; /* corresponding entry */ int flags; /* the following entries are used for files */ int sock; struct filebuf *sockfb; avoff_t numbytes; struct ucftpconn *conn; int writing; short eof; }; /* a generic information node */ /* analogous to the "on-disk inode" in a disk filesystem */ struct ucftpnode { struct avstat st; char *linkname; avtime_t valid; struct ucftpentry *subdir; /* only dir */ struct ucftpentry *parent; /* only dir */ }; /* our ventry.data handle */ /* represents a named reference to a ucftpnode */ struct ucftpentry { char *name; struct ucftpnode *node; struct ucftpentry *next; struct ucftpentry **prevp; struct ucftpentry *parent; }; struct ucftpsession { char *account; char *password; struct ucftpsession *next; struct ucftpsession *prev; }; /* our vmount.data handle */ struct ucftpfs { struct avfs *avfs; struct ucftpconn *conns; struct ucftpsession sessions; }; enum ucftp_op { OP_DELE = 0, OP_MKD = 1, OP_RMD = 2}; char *ucftp_op_cmd[3] = { "DELE ", "MKD ", "RMD " }; /*************************************** * some access functions for generic * avfs structure ***************************************/ static struct ucftpentry *ucftp_ventry_ucftpentry(ventry *ve) { return (struct ucftpentry *) ve->data; } static struct ucftpfs *ucftp_ventry_ucftpfs(ventry *ve) { return (struct ucftpfs *) ve->mnt->avfs->data; } static struct ucftpfile *ucftp_vfile_ucftpfile(vfile *vf) { return (struct ucftpfile *) vf->data; } static struct ucftpfs *ucftp_vfile_fs(vfile *vf) { return (struct ucftpfs *) vf->mnt->avfs->data; } /*************************************** * some generic code ***************************************/ static void strip_crlf(char *line) { avsize_t len = strlen(line); if(len > 0 && line[len-1] == '\n') { if(len > 1 && line[len-2] == '\r') line[len-2] = '\0'; else line[len-1] = '\0'; } } static int write_socket(int sock, const char *buf, avsize_t buflen) { int res; while(buflen > 0) { res = write(sock, buf, buflen); if(res == -1) return -errno; buf += res; buflen -= res; } return 0; } static int ucftp_get_addrbytes(const char *line, int addrbytes[6]) { int i; int j; int val; const char *s; for(s = line; *s && *s != '('; s++); if(!*s) return -1; s++; for(i = 0; i < 6; i++) { val = 0; for(j = 0; j < 3; j++) { if(!isdigit((int) *s)) return -1; val = val * 10 + (*s - '0'); s++; if(*s == ',' || *s == ')') break; } if(*s != ',' && *s != ')') return -1; addrbytes[i] = val; if(*s == ')') break; s++; } if(i != 5 || *s != ')') return -1; return 0; } /*************************************** * session code ***************************************/ static struct ucftpsession *ucftp_find_session(struct ucftpfs *fs, const char *account) { struct ucftpsession *fts; for(fts = fs->sessions.next; fts != &fs->sessions; fts = fts->next) { if(strcmp(account, fts->account) == 0) return fts; } return NULL; } static struct ucftpsession *ucftp_get_session(struct ucftpfs *fs, const char *account) { struct ucftpsession *fts; fts = ucftp_find_session(fs, account); if(fts == NULL) { struct ucftpsession *next; struct ucftpsession *prev; AV_NEW(fts); fts->account = av_strdup(account); fts->password = NULL; fts->next = next = fs->sessions.next; fts->prev = prev = &fs->sessions; next->prev = fts; prev->next = fts; } return fts; } static void ucftp_remove_session(struct ucftpsession *fts) { struct ucftpsession *next = fts->next; struct ucftpsession *prev = fts->prev; next->prev = prev; prev->next = next; av_free(fts->account); av_free(fts->password); av_free(fts); } /*************************************** * code for password/hostname/path splitting ***************************************/ static const char *ucftp_get_password(struct ucftpfs *fs, const char *host, const char *user) { struct ucftpsession *fts; char *account; account = av_stradd(NULL, user, USER_SEP_STR, host, NULL); fts = ucftp_find_session(fs, account); av_free(account); if(fts == NULL) { account = av_stradd(NULL, user, USER_SEP_STR, NULL); fts = ucftp_find_session(fs, account); av_free(account); } if(fts != NULL) return fts->password; else return NULL; } static int ucftp_split_path(struct ucftpfs *fs, char *hostpart, const char **hostp, const char **userp, const char **passp) { char *s, *t; const char *host; const char *user; const char *pass; for(s = hostpart; *s && *s != USER_SEP_CHAR; s++); for(t = s; *t; t++) if (*t == USER_SEP_CHAR) s = t; if(*s != '\0') { *s = '\0'; host = s + 1; user = hostpart; pass = ucftp_get_password(fs, host, user); if(pass == NULL) return -EACCES; } else { host = hostpart; user = "ftp"; pass = "avfs@"; } if(host[0] == '\0') return -ENOENT; *hostp = host; *userp = user; *passp = pass; return 0; } /*************************************** * ucftpentry constructor and destructor ***************************************/ /* av_obj.destr for ucftpentry */ static void ucftp_entry_destr(struct ucftpentry *ent) { if(ent->prevp != NULL) *ent->prevp = ent->next; if(ent->next != NULL) ent->next->prevp = ent->prevp; av_unref_obj(ent->parent); av_free(ent->name); ent->prevp = NULL; ent->next = NULL; ent->parent = NULL; ent->name = NULL; } /* constructor for ucftpentry */ static struct ucftpentry *ucftp_new_entry(const char *name) { struct ucftpentry *ent; AV_NEW_OBJ(ent, ucftp_entry_destr); ent->node = NULL; ent->next = NULL; ent->prevp = NULL; ent->parent = NULL; ent->name = av_strdup(name); return ent; } /*************************************** * ucftpnode constructor and destructor ***************************************/ /* av_obj.destr for ucftpnode */ static void ucftp_node_destr(struct ucftpnode *nod) { if(nod->linkname != NULL) av_free(nod->linkname); } /* constructor for ucftpnode */ static struct ucftpnode *ucftp_new_node(struct avstat *initstat) { struct ucftpnode *nod; AV_NEW_OBJ(nod, ucftp_node_destr); nod->st = *initstat; nod->subdir = NULL; nod->parent = NULL; nod->valid = 0; nod->linkname = NULL; return nod; } /*************************************** * code for node handling ***************************************/ /* link ent to nod */ static void ucftp_link_node(struct ucftpentry *ent, struct ucftpnode *nod) { //TODO why do we get an ref from ent but not ent->parent (in case it exists)? av_ref_obj(ent); av_ref_obj(nod); ent->node = nod; if(AV_ISDIR(nod->st.mode)) { nod->st.nlink = 2; if(ent->parent != NULL) { nod->parent = ent->parent; ent->parent->node->st.nlink ++; } else nod->parent = ent; } else nod->st.nlink ++; if(ent->parent != NULL) ent->parent->node->st.size ++; } static void ucftp_unlink_node(struct ucftpentry *ent) { struct ucftpnode *nod = ent->node; if(AV_ISDIR(nod->st.mode)) { nod->st.nlink = 0; if(nod->parent != NULL) nod->parent->node->st.nlink --; } else nod->st.nlink --; if(ent->parent != NULL) ent->parent->node->st.size --; ent->node = NULL; av_unref_obj(nod); av_unref_obj(ent); } static int ucftp_make_node(struct ucftpfs *fs, struct ucftpentry *ent, avmode_t mode) { struct ucftpnode *nod; struct avstat initstat; if(ent->name == NULL) return -ENOENT; av_default_stat(&initstat); initstat.dev = fs->avfs->dev; initstat.ino = av_new_ino(fs->avfs); nod = ucftp_new_node(&initstat); nod->st.mode = mode; ucftp_link_node(ent, nod); av_unref_obj(nod); return 0; } static int ucftp_is_valid_node(struct ucftpnode *node) { avtime_t now = av_time(); if(now < node->valid) return 1; return 0; } static void ucftp_truncate_node(struct ucftpnode *nod, avoff_t length) { nod->st.size = length; nod->st.blocks = AV_DIV(nod->st.size, 512); av_curr_time(&nod->st.mtime); } /*************************************** * entry handling ***************************************/ static int ucftp_add_subentry(struct ucftpentry *parent, struct ucftpentry *ent, struct ucftpentry **startp) { struct ucftpentry **entp; if(startp == NULL) { entp = &parent->node->subdir; } else { entp = startp; } for(; *entp != NULL; entp = &(*entp)->next); *entp = ent; ent->prevp = entp; ent->parent = parent; av_ref_obj(parent); ent->next = NULL; return 0; } static struct ucftpentry *find_list_entry(struct ucftpentry *oldlist, const char *filename) { for(; oldlist != NULL; oldlist = oldlist->next) { if(strcmp(oldlist->name, filename) == 0) break; } return oldlist; } static void list_remove_entry(struct ucftpentry *ent) { if(ent == NULL) return; if(ent->prevp != NULL) *ent->prevp = ent->next; if(ent->next != NULL) ent->next->prevp = ent->prevp; ent->prevp = NULL; ent->next = NULL; } /* free a all subentries from a given entry */ static void ucftp_free_tree(struct ucftpentry *ent) { struct ucftpnode *nod = ent->node; if(nod != NULL) { while(nod->subdir != NULL) ucftp_free_tree(nod->subdir); ucftp_unlink_node(ent); } else { av_unref_obj(ent); } } /* called by ucftp_getpath */ static char *ucftp_create_path(struct ucftpentry *ent) { char *path; if(ent->parent == NULL) return av_strdup(""); path = ucftp_create_path(ent->parent); return av_stradd(path, "/", ent->name, NULL); } static int ucftp_getpath(ventry *ve, char **resp) { struct ucftpentry *ent = ucftp_ventry_ucftpentry(ve); *resp = ucftp_create_path(ent); return 0; } static void ucftp_free_dirlist(struct ucftpentry *ent) { if(ent->node != NULL) { struct ucftpentry *subent = ent->node->subdir; while(subent != NULL) { ucftp_free_tree(subent); subent = ent->node->subdir; } } } static void unref_list_parent(struct ucftpentry *list) { while(list != NULL) { av_unref_obj(list->parent); list->parent = NULL; list = list->next; } } static void free_entry_list(struct ucftpentry *list) { while(list != NULL) { struct ucftpentry *ent = list; list = list->next; list_remove_entry(ent); ucftp_free_tree(ent); } } static struct ucftpconn *ucftp_find_conn(struct ucftpfs *fs, struct ucftpentry *ent) { struct ucftpconn *conn; while(ent->parent != NULL) ent = ent->parent; conn = fs->conns; while(conn != NULL) { if(conn->root == ent) break; conn = conn->next; } return conn; } static struct ucftpconn *ucftp_find_conn_ventry(ventry *ve) { struct ucftpfs *fs = ucftp_ventry_ucftpfs(ve); struct ucftpentry *ent = ucftp_ventry_ucftpentry(ve); return ucftp_find_conn(fs, ent); } static void ucftp_putent(ventry *ve) { struct ucftpentry *ent = ucftp_ventry_ucftpentry(ve); av_unref_obj(ent); } static int ucftp_copyent(ventry *ve, void **resp) { struct ucftpentry *ent = ucftp_ventry_ucftpentry(ve); av_ref_obj(ent); *resp = (void *) ent; return 0; } /*************************************** * connection code ***************************************/ static void ucftp_release_conn(struct ucftpconn *conn) { conn->busy = 0; } static void ucftp_close_conn(struct ucftpconn *conn) { av_unref_obj(conn->sockfb); conn->sockfb = NULL; conn->sock = -1; conn->binary = -1; conn->cwd[0] = '\0'; } /* get a line from a connection */ static int ucftp_get_line(struct ucftpconn *conn, char **linep) { int res; char *line; res = av_filebuf_getline(conn->sockfb, &line, FTP_REPLY_TIMEOUT); if(res <= 0 || line == NULL) { ucftp_close_conn(conn); if(res < 0) return res; if(res == 0) av_log(AVLOG_ERROR, "FTP: timeout waiting for reply"); else av_log(AVLOG_ERROR, "FTP: server closed ftpconn"); return -EIO; } strip_crlf(line); *linep = line; return 0; } static int ucftp_check_reply(struct ucftpconn *conn, const char *line) { int reply; if(strlen(line) < 4 || !isdigit((int) line[0]) || !isdigit((int) line[1]) || !isdigit((int) line[2]) || (line[3] != ' ' && line[3] != '-')) { ucftp_close_conn(conn); av_log(AVLOG_ERROR, "FTP: malformed reply: %s", line); return -EIO; } reply = (line[0] - '0') * 100 + (line[1] - '0') * 10 + (line[2] - '0'); if(reply == 421) ucftp_close_conn(conn); return reply; } static int ucftp_wait_reply_code(struct ucftpconn *conn) { int res; char *line; char replystr[4]; int firstline = 1; int cont; int replycode = 0; do { cont = 0; res = ucftp_get_line(conn, &line); if(res < 0) return res; if(firstline) { res = ucftp_check_reply(conn, line); if(res < 0) { av_free(line); return res; } replycode = res; if(line[3] == '-') { strncpy(replystr, line, 3); replystr[3] = ' '; firstline = 0; cont = 1; } } else if(strncmp(line, replystr, 4) != 0) cont = 1; if(replycode >= 400) av_log(AVLOG_ERROR, "FTP: %s", line); else av_log(AVLOG_DEBUG, "FTP: %s", line); av_free(line); } while(cont); return replycode; } static int ucftp_write_command(struct ucftpconn *conn, const char *cmd) { char *line; int res; if(strncmp(cmd, "PASS ", 5) == 0) av_log(AVLOG_DEBUG, "FTP: PASS *"); else av_log(AVLOG_DEBUG, "FTP: %s", cmd); line = av_stradd(NULL, cmd, "\r\n", NULL); res = write_socket(conn->sock, line, strlen(line)); av_free(line); return res; } static int ucftp_command(struct ucftpconn *conn, const char *cmd) { int res; res = ucftp_write_command(conn, cmd); if(res < 0) return res; res = ucftp_wait_reply_code(conn); return res; } static int ucftp_set_ascii(struct ucftpconn *conn) { int res; if(conn->binary != 0) { res = ucftp_command(conn, "TYPE A"); if(res < 0) return res; conn->binary = 0; } return 0; } static int ucftp_set_binary(struct ucftpconn *conn) { int res; if(conn->binary != 1) { res = ucftp_command(conn, "TYPE I"); if(res < 0) return res; conn->binary = 1; } return 0; } static int ucftp_set_cwd(struct ucftpconn *conn, const char *dir) { int res; char *cmd; if(strcmp(conn->cwd, dir) != 0) { cmd = av_stradd(NULL, "CWD ", ( dir[0] == '\0' ) ? "/" : dir, NULL); res = ucftp_command(conn, cmd); av_free(cmd); if(res < 0) return res; if(res == 550) return -ENOENT; if(res / 100 != 2) return -EIO; av_free(conn->cwd); conn->cwd = av_strdup(dir); } return 0; } static int ucftp_login(struct ucftpconn *conn) { int res; char *cmd; cmd = av_stradd(NULL, "USER ", conn->user, NULL); res = ucftp_command(conn, cmd); av_free(cmd); if(res == 331) { cmd = av_stradd(NULL, "PASS ", conn->password, NULL); res = ucftp_command(conn, cmd); av_free(cmd); if(res < 0) return res; } if(res != 230) return -EACCES; return 0; } static int ucftp_init_conn(struct ucftpconn *conn) { int res; res = ucftp_wait_reply_code(conn); if(res == 120) res = ucftp_wait_reply_code(conn); if(res < 0) return res; if(res != 220) return -EIO; res = ucftp_login(conn); if(res < 0) return res; ucftp_command(conn, "PWD"); ucftp_command(conn, "SYST"); return 0; } static int ucftp_open_conn(struct ucftpconn *conn) { int res; if(conn->sock != -1) { res = ucftp_command(conn, "NOOP"); if(res < 0) return res; if(res != 421) return 0; } res = av_sock_connect(conn->host, 21); if(res < 0) return res; conn->sock = res; conn->sockfb = av_filebuf_new(conn->sock, 0); res = ucftp_init_conn(conn); if(res < 0) { ucftp_close_conn(conn); return res; } return 0; } static int ucftp_check_passv_reply(struct ucftpconn *conn, const char *line, char **resp) { int res; int replycode; int addrbytes[6]; char addrbuf[128]; int port; res = ucftp_check_reply(conn, line); if(res < 0) return res; replycode = res; if(replycode != 227) { av_log(AVLOG_ERROR, "FTP: %s", line); ucftp_close_conn(conn); return -EIO; } av_log(AVLOG_DEBUG, "FTP: %s", line); if(line[3] != ' ') { av_log(AVLOG_ERROR, "FTP: Multiline reply to PASV: %s", line); ucftp_close_conn(conn); return -EIO; } res = ucftp_get_addrbytes(line, addrbytes); if(res < 0) { av_log(AVLOG_ERROR, "FTP: Bad reply to PASV: %s", line); ucftp_close_conn(conn); return -EIO; } port = addrbytes[4] * 0x100 + addrbytes[5]; sprintf(addrbuf, "%i.%i.%i.%i:%i", addrbytes[0], addrbytes[1], addrbytes[2], addrbytes[3], port); *resp = av_strdup(addrbuf); return 0; } static int ucftp_open_dataconn(struct ucftpconn *conn) { int res; char *line; char *host; res = ucftp_write_command(conn, "PASV"); if(res < 0) return res; res = ucftp_get_line(conn, &line); if(res < 0) return res; res = ucftp_check_passv_reply(conn, line, &host); av_free(line); if(res < 0) return res; av_log(AVLOG_DEBUG,"FTP: remote data address: %s", host); res = av_sock_connect(host, -1); if(res >= 0) av_registerfd(res); av_free(host); return res; } static struct ucftpconn *ucftp_lookup_conn(struct ucftpfs *fs, const char *host, const char *user, const char *password) { struct ucftpconn *conn; struct ucftpconn **cp; for(cp = &fs->conns; *cp != NULL; cp = &(*cp)->next) { conn = *cp; if(strcmp(conn->host, host) == 0 && strcmp(conn->user, user) == 0 && strcmp(conn->password, password) == 0 && !conn->busy) { conn->busy = 1; return conn; } } AV_NEW(conn); conn->host = av_strdup(host); conn->user = av_strdup(user); conn->password = av_strdup(password); conn->busy = 1; conn->sock = -1; conn->sockfb = NULL; conn->next = NULL; conn->binary = -1; conn->cwd = av_strdup(""); conn->ft_cancel_ok = 1; conn->root = ucftp_new_entry("/"); ucftp_make_node(fs, conn->root, 0755 | AV_IFDIR); *cp = conn; return conn; } static int ucftp_get_conn(struct ucftpfs *fs, const char *userhost, struct ucftpconn **resp) { int res; char *tmps; const char *host; const char *user; const char *password; struct ucftpconn *conn = NULL; tmps = av_strdup(userhost); res = ucftp_split_path(fs, tmps, &host, &user, &password); if(res == 0) conn = ucftp_lookup_conn(fs, host, user, password); av_free(tmps); if(res < 0) return res; *resp = conn; return 0; } /*************************************** * ucftpfile constructor and destructor ***************************************/ #define TRY_REUSE_CONN_AFTER_CLOSE static void ucftp_free_file(struct ucftpfile *f) { #ifndef TRY_REUSE_CONN_AFTER_CLOSE if(f->conn != NULL) { ucftp_close_conn(f->conn); ucftp_release_conn(f->conn); } #endif av_unref_obj(f->sockfb); if(f->sock >= 0) close(f->sock); #ifdef TRY_REUSE_CONN_AFTER_CLOSE /* if control connection is busy try to wait for reply, often closing the data socket will bring the control connection back to life */ if ( f->conn != NULL ) { if ( f->conn->busy ) { if ( f->conn->ft_cancel_ok ) { int res = ucftp_wait_reply_code(f->conn); if(res >= 0 && ( res / 10 == 45 || res == 426 ) ) { /* code 45x and 426 is acceptable here, server reported abort */ } else if(res >= 0 && res / 100 != 2) res = -EIO; if(res < 0) { av_log( AVLOG_WARNING, "UCFTP: canceling file transfer and reuse connection failed\n" ); f->conn->ft_cancel_ok = 0; ucftp_close_conn(f->conn); } ucftp_release_conn(f->conn); } else { ucftp_close_conn(f->conn); ucftp_release_conn(f->conn); } } } #endif f->sock = -1; f->sockfb = NULL; f->numbytes = 0; f->conn = NULL; f->writing = 0; f->eof = 0; av_unref_obj(f->ent); f->ent = NULL; } static struct ucftpfile *ucftp_new_file(struct ucftpentry *ent, int flags) { struct ucftpfile *f; AV_NEW_OBJ(f, ucftp_free_file); f->sock = -1; f->sockfb = NULL; f->numbytes = 0; f->conn = NULL; f->flags = flags; f->writing = 0; f->eof = 0; av_ref_obj(ent); f->ent = ent; return f; } static int ucftp_init_file(struct ucftpfile *lf, int sock) { lf->sock = sock; lf->sockfb = NULL; lf->numbytes = 0; lf->conn = NULL; lf->writing = 0; lf->eof = 0; lf->sockfb = av_filebuf_new(lf->sock, 0); return 0; } /*************************************** * dir reading code ***************************************/ static int ucftp_read_list(struct ucftpfs *fs, struct filebuf *fb, struct ucftpentry *ent, struct lscache *lc) { int res; char *line; int eof = 0; avtime_t now = av_time(); struct ucftpentry *oldlist, **entp; /* release current subdir and save it locally */ oldlist = ent->node->subdir; if(oldlist != NULL) { oldlist->prevp = &oldlist; ent->node->subdir = NULL; } unref_list_parent(oldlist); entp = &ent->node->subdir; do { res = av_filebuf_getline(fb, &line, FTP_READ_TIMEOUT); if(res < 0) { free_entry_list(oldlist); return res; } if(res == 0) { free_entry_list(oldlist); av_log(AVLOG_ERROR, "FTP: read timeout"); return -EIO; } if(line == NULL) eof = 1; else { struct avstat stbuf; char *filename; char *linkname; strip_crlf(line); av_log(AVLOG_DEBUG, "FTP: %s", line); res = av_parse_ls(lc, line, &stbuf, &filename, &linkname); av_free(line); if(res == 1) { struct ucftpentry *subent = NULL; if(strcmp(filename, "..") != 0 && strcmp(filename, ".") != 0 ) { subent = find_list_entry(oldlist, filename); if(subent != NULL) { list_remove_entry(subent); } else { subent = ucftp_new_entry(filename); } if(subent->node == NULL) { ucftp_make_node(fs, subent, stbuf.mode); av_unref_obj(subent); } ucftp_add_subentry(ent, subent, entp); entp = &subent->next; /* re-use some old values */ if(subent->node != NULL) { stbuf.dev = subent->node->st.dev; stbuf.ino = subent->node->st.ino; } subent->node->st = stbuf; if(subent->node->linkname != NULL) { av_free(subent->node->linkname); } if(linkname != NULL) { subent->node->linkname = av_strdup(linkname); } else { subent->node->linkname = NULL; } } av_free(filename); av_free(linkname); } } } while(!eof); ent->node->valid = now + UCFTP_DIR_VALID; free_entry_list(oldlist); return 0; } static int ucftp_do_list(struct ucftpfs *fs, struct ucftpconn *conn, const char *dir, struct ucftpentry *ent) { int res; char *cmd; int listsock; struct filebuf *fb; struct lscache *lc; res = ucftp_open_conn(conn); if(res < 0) return res; res = ucftp_set_ascii(conn); if(res < 0) return res; res = ucftp_set_cwd(conn, dir); if(res < 0) return res; res = ucftp_open_dataconn(conn); if(res < 0) return res; listsock = res; cmd = av_strdup("LIST -al"); res = ucftp_command(conn, cmd); av_free(cmd); if(res >= 0 && res / 100 != 1) res = -EIO; if(res < 0) { close(listsock); return res; } fb = av_filebuf_new(listsock, 0); lc = av_new_lscache(); res = ucftp_read_list(fs, fb, ent, lc); av_unref_obj(lc); av_unref_obj(fb); res = ucftp_wait_reply_code(conn); if(res >= 0 && res / 100 != 2) res = -EIO; if(res < 0) { ucftp_free_dirlist(ent); return res; } return 0; } static int ucftp_list(struct ucftpfs *fs, struct ucftpconn *conn, struct ucftpentry *ent) { int res; char *path; path = ucftp_create_path(ent); res = ucftp_do_list(fs, conn, path, ent); ucftp_release_conn(conn); av_free(path); return res; } /* called by ucftp_nth_entry */ static struct ucftpnode *ucftp_special_entry(int n, struct ucftpnode *nod, const char **namep) { if(n == 0) { *namep = "."; return nod; } else { *namep = ".."; return nod->parent->node; } } /* called by ucftp_readdir */ static struct ucftpnode *ucftp_nth_entry(int n, struct ucftpnode *nod, const char **namep) { struct ucftpentry *ent; int i; if(nod->parent != NULL) { //TODO should I rather not handling these special entries here? if(n < 2) return ucftp_special_entry(n, nod, namep); n -= 2; } ent = nod->subdir; for(i = 0; i < n && ent != NULL; i++) ent = ent->next; if(ent == NULL) return NULL; *namep = ent->name; return ent->node; } static int ucftp_readdir(vfile *vf, struct avdirent *buf) { struct ucftpfile *parentfile = ucftp_vfile_ucftpfile(vf); struct ucftpnode *parent = parentfile->ent->node; struct ucftpnode *nod; const char *name; if(!AV_ISDIR(parent->st.mode)) return -ENOTDIR; if(!ucftp_is_valid_node(parent)) { //get dir list from ftp struct ucftpconn *conn; int res; conn = ucftp_find_conn(ucftp_vfile_fs(vf), parentfile->ent); res = ucftp_list(ucftp_vfile_fs(vf), conn, parentfile->ent); if(res < 0) { //TODO do something? aborting? } } nod = ucftp_nth_entry(vf->ptr, parent, &name); if(nod == NULL) return 0; buf->name = av_strdup(name); buf->ino = nod->st.ino; buf->type = AV_TYPE(nod->st.mode); vf->ptr ++; return 1; } /*************************************** * entry look up code ***************************************/ /* called by ucftp_do_lookup */ static struct ucftpentry *ucftp_get_entry(struct ucftpentry *parent, const char *name) { struct ucftpentry **entp; struct ucftpentry *ent; if(strcmp(name, ".") == 0) { ent = parent; av_ref_obj(ent); return ent; } if(strcmp(name, "..") == 0) { ent = parent->parent; av_ref_obj(ent); return ent; } for(entp = &parent->node->subdir; *entp != NULL; entp = &(*entp)->next) if(strcmp(name, (*entp)->name) == 0) { ent = *entp; av_ref_obj(ent); return ent; } /* lookup failed, so create a new entry and add it to the directory list temporarily */ ent = ucftp_new_entry(name); *entp = ent; ent->prevp = entp; ent->parent = parent; av_ref_obj(parent); return ent; } /* called by ucftp_lookup */ static int ucftp_do_lookup(ventry *ve, const char *name, struct ucftpentry **entp) { struct ucftpentry *parent = ucftp_ventry_ucftpentry(ve); if(parent->node == NULL) return -ENOENT; if(name == NULL) { *entp = parent->parent; av_ref_obj(*entp); return 0; } if(!AV_ISDIR(parent->node->st.mode)) return -ENOTDIR; if(!ucftp_is_valid_node(parent->node)) { //get dir list from ftp struct ucftpconn *conn; struct ucftpfs *fs = ucftp_ventry_ucftpfs(ve); int res; conn = ucftp_find_conn_ventry(ve); res = ucftp_list(fs, conn, parent); if(res < 0) { //TODO do something? aborting? } } *entp = ucftp_get_entry(parent, name); return 0; } /* called by ucftp_lookup */ static struct ucftpentry *ucftp_get_root(struct ucftpconn *conn) { struct ucftpentry *root = conn->root; av_ref_obj(root); return root; } static int ucftp_lookup(ventry *ve, const char *name, void **newp) { int res = 0; struct ucftpentry *parent = ucftp_ventry_ucftpentry(ve); struct ucftpentry *ent; if(parent == NULL) { struct ucftpconn *conn; if(ve->mnt->opts[0] != '\0') return -ENOENT; res = ucftp_get_conn(ucftp_ventry_ucftpfs(ve), name, &conn); if ( res < 0 ) return res; ent = ucftp_get_root(conn); ucftp_release_conn(conn); } else { res = ucftp_do_lookup(ve, name, &ent); if(res < 0) return res; // it's ref'd in previous lookup but not freed by using putent // so we need to do it here av_unref_obj(parent); } *newp = ent; if(ent != NULL && ent->node != NULL) return AV_TYPE(ent->node->st.mode); else return 0; } /*************************************** * write code (put) ***************************************/ static int ucftp_do_put(const char *dir, const char *file, struct ucftpconn *conn, struct ucftpfile *uf) { int res; int putsock; char *cmd; res = ucftp_open_conn(conn); if(res < 0) return res; res = ucftp_set_binary(conn); if(res < 0) return res; res = ucftp_set_cwd(conn, dir); if(res < 0) return res; res = ucftp_open_dataconn(conn); if(res < 0) return res; putsock = res; cmd = av_stradd(NULL, "STOR ", file, NULL); res = ucftp_command(conn, cmd); av_free(cmd); if(res >= 0 && res / 100 != 1) res = -EIO; if(res < 0) { close(putsock); return res; } uf->sock = putsock; uf->conn = conn; uf->writing = 1; return 0; } static int ucftp_init_put(ventry *ve, int flags, struct ucftpfile **ufp) { int res; struct ucftpfs *fs = ucftp_ventry_ucftpfs(ve); struct ucftpentry *ent = ucftp_ventry_ucftpentry(ve); struct ucftpconn *conn; char *dir; char *file; conn = ucftp_find_conn(fs, ent); if(!conn) return -EIO; // no conn? if(conn->busy) return -EAGAIN; // control connection busy conn->busy = 1; dir = ucftp_create_path(ent->parent); file = av_strdup(ent->name); *ufp = ucftp_new_file(ent, flags); res = ucftp_do_put(( dir[0] == '\0' ) ? "/" : dir, file, conn, *ufp); av_free(dir); av_free(file); if(res < 0) { av_unref_obj(*ufp); ucftp_release_conn(conn); } else { ucftp_truncate_node(ent->node, 0); } return res; } static avssize_t ucftp_write(vfile *vf, const char *buf, avsize_t nbyte) { struct ucftpfile *uf = ucftp_vfile_ucftpfile(vf); int res; if(!buf) return -EINVAL; if(nbyte < 1) return 0; if(AV_ISDIR(uf->ent->node->st.mode)) return -EISDIR; if((uf->flags & AVO_ACCMODE) != AVO_WRONLY || (uf->flags & AVO_TRUNC) == 0 || (uf->flags & AVO_CREAT) == 0 || (uf->flags & AVO_APPEND) != 0) return -EINVAL; if(uf->sock < 0) { return -EIO; } res = write(uf->sock, buf, nbyte); if(res < 0 || res != nbyte) return -EIO; ucftp_truncate_node(uf->ent->node, uf->ent->node->st.size + res); return res; } /*************************************** * open code ***************************************/ /* called by ucftp_open_check_type */ static int ucftp_need_write(int flags) { if((flags & AVO_ACCMODE) == AVO_WRONLY || (flags & AVO_ACCMODE) == AVO_RDWR || (flags & AVO_TRUNC) != 0) return 1; return 0; } /* called by ucftp_open_check */ static int ucftp_open_check_type(avmode_t mode, int flags) { if((flags & AVO_DIRECTORY) != 0 && !AV_ISDIR(mode)) return -ENOTDIR; switch(mode & AV_IFMT) { case AV_IFREG: return 0; case AV_IFDIR: if(ucftp_need_write(flags)) return -EISDIR; return 0; case AV_IFLNK: if((flags & AVO_ACCMODE) != AVO_NOPERM || !(flags & AVO_NOFOLLOW)) return -ENOENT; return 0; default: /* FIFO, char/bockdev, socket */ if((flags & AVO_ACCMODE) != AVO_NOPERM) return -ENXIO; return 0; } } /* called by ucftp_open */ static int ucftp_open_check(struct ucftpnode *nod, int flags) { if(nod == NULL) { if(!(flags & AVO_CREAT)) return -ENOENT; return 0; } if((flags & AVO_EXCL) != 0) return -EEXIST; return ucftp_open_check_type(nod->st.mode, flags); } static int ucftp_open(ventry *ve, int flags, avmode_t mode, void **resp) { int res; struct ucftpfs *fs = ucftp_ventry_ucftpfs(ve); struct ucftpentry *ent = ucftp_ventry_ucftpentry(ve); struct ucftpfile *file = NULL; int new_node = 0; /* check permissions */ res = ucftp_open_check(ent->node, flags); if(res < 0) return res; if(ent->node == NULL) { // node doesn't exists so there's no such file // create a node in case of write if((flags & AVO_ACCMODE) == AVO_WRONLY && (flags & AVO_CREAT) && (flags & AVO_TRUNC)) { res = ucftp_make_node(fs, ent, mode | AV_IFREG); if(res < 0) return res; new_node = 1; } else { return -ENOENT; } } if((flags & AVO_ACCMODE) == AVO_NOPERM) { file = ucftp_new_file(ent, flags); } else { if((flags & AVO_DIRECTORY) != 0) { file = ucftp_new_file(ent, flags); } else { if(AV_ISREG(ent->node->st.mode)) { if((flags & AVO_ACCMODE) == AVO_RDONLY) { file = ucftp_new_file(ent, flags); } else if((flags & AVO_ACCMODE) == AVO_WRONLY) { if(ucftp_init_put(ve, flags, &file) < 0) { if(new_node == 1) ucftp_unlink_node(ent); return -EIO; } } } } } if(file == NULL) return -EIO; *resp = file; return 0; } /*************************************** * close code ***************************************/ static int ucftp_close(vfile *vf) { struct ucftpfile *f = ucftp_vfile_ucftpfile(vf); int res = 0; if(f->writing == 1) { close(f->sock); res = ucftp_wait_reply_code(f->conn); if(res >= 0 && res / 100 != 2) res = -EIO; if ( res >= 0 ) { ucftp_release_conn(f->conn); } } av_unref_obj(f); return res; } /*************************************** * read code (get) ***************************************/ static int ucftp_do_get(const char *dir, const char *file, struct ucftpconn *conn, struct ucftpfile *uf) { int res; int getsock; char *cmd; res = ucftp_open_conn(conn); if(res < 0) return res; res = ucftp_set_binary(conn); if(res < 0) return res; res = ucftp_set_cwd(conn, dir); if(res < 0) return res; res = ucftp_open_dataconn(conn); if(res < 0) return res; getsock = res; cmd = av_stradd(NULL, "RETR ", file, NULL); res = ucftp_command(conn, cmd); av_free(cmd); if(res >= 0 && res / 100 != 1) res = -EIO; if(res < 0) { close(getsock); return res; } res = ucftp_init_file(uf, getsock); if(res < 0) { return res; } uf->conn = conn; return 0; } static int ucftp_init_get(vfile *vf) { int res; struct ucftpfile *uf = ucftp_vfile_ucftpfile(vf); struct ucftpfs *fs = ucftp_vfile_fs(vf); struct ucftpentry *ent = uf->ent; struct ucftpconn *conn; char *dir; char *file; conn = ucftp_find_conn(fs, ent); if(!conn) return -EIO; // no conn? if(conn->busy) return -EAGAIN; // control connection busy conn->busy = 1; dir = ucftp_create_path(ent->parent); file = av_strdup(ent->name); res = ucftp_do_get(( dir[0] == '\0' ) ? "/" : dir, file, conn, uf); av_free(dir); av_free(file); if(res < 0) { ucftp_release_conn(conn); } return res; } /* TODO: perhaps try filling buf as it happens that bytes read from sock are lower than nbyte */ static avssize_t ucftp_read(vfile *vf, char *buf, avsize_t nbyte) { avoff_t nact; struct ucftpfile *uf = ucftp_vfile_ucftpfile(vf); avsize_t nbytes; int res; if(AV_ISDIR(uf->ent->node->st.mode)) return -EISDIR; if(uf->eof) { return 0; } if(!uf->sockfb) { if(!AV_ISREG(uf->ent->node->st.mode)) return -EINVAL; if((uf->flags & AVO_ACCMODE) != AVO_RDONLY) return -EINVAL; if(ucftp_init_get(vf) < 0) return -EIO; } nact = nbyte; if ( uf->numbytes != vf->ptr ) { av_log(AVLOG_ERROR, "UCFTP: wrong file position\n"); return -EIO; } for(;;) { nbytes = av_filebuf_read(uf->sockfb, buf, nact); if(nbytes != 0) { uf->numbytes += nbytes; vf->ptr += nbytes; break; } else { if(av_filebuf_eof(uf->sockfb)) { av_unref_obj(uf->sockfb); uf->sockfb = NULL; close(uf->sock); uf->sock = -1; uf->eof = 1; res = ucftp_wait_reply_code(uf->conn); if(res >= 0 && res / 100 != 2) res = -EIO; if(res < 0) return res; ucftp_release_conn(uf->conn); uf->conn = NULL; return 0; } else { res = av_filebuf_check(&uf->sockfb, 1, FTP_READ_TIMEOUT); if(res < 0) return res; if(res == 0) { av_log(AVLOG_ERROR, "FTP: read timeout"); return -EIO; } } } } return nbytes; } /*************************************** * attribute code (stat) ***************************************/ static int ucftp_getattr(vfile *vf, struct avstat *buf, int attrmask) { struct ucftpfile *file = ucftp_vfile_ucftpfile(vf); *buf = file->ent->node->st; return 0; } #if 0 static void vol_set_attributes(struct avstat *dest, const struct avstat *src, int attrmask) { if((attrmask & AVA_ATIME) != 0) dest->atime = src->atime; if((attrmask & AVA_MTIME) != 0) dest->mtime = src->mtime; if((attrmask & AVA_MODE) != 0) dest->mode = (dest->mode & AV_IFMT) | src->mode; if((attrmask & AVA_UID) != 0) dest->uid = src->uid; if((attrmask & AVA_GID) != 0) dest->gid = src->gid; } static int vol_setattr(vfile *vf, struct avstat *buf, int attrmask) { struct ucftpnode *nod = vol_vfile_ucftpnode(vf); vol_set_attributes(&nod->st, buf, attrmask); return 0; } #endif /*************************************** * access and readlink functions ***************************************/ static int ucftp_access(ventry *ve, int amode) { struct ucftpnode *nod = ucftp_ventry_ucftpentry(ve)->node; if(nod == NULL) return -ENOENT; return 0; } static int ucftp_readlink(ventry *ve, char **bufp) { struct ucftpnode *nod = ucftp_ventry_ucftpentry(ve)->node; if(nod == NULL) return -ENOENT; if(!AV_ISLNK(nod->st.mode)) return -EINVAL; if(!nod->linkname) return -EINVAL; *bufp = av_strdup(nod->linkname); return 0; } /*************************************** * code for generic FTP commands ***************************************/ static int ucftp_do_op(enum ucftp_op op, const char *dir, const char *file, struct ucftpconn *conn) { int res; char *cmd; res = ucftp_open_conn(conn); if(res < 0) return res; res = ucftp_set_cwd(conn, dir); if(res < 0) return res; res = ucftp_open_dataconn(conn); if(res < 0) return res; cmd = av_stradd(NULL, ucftp_op_cmd[op], file, NULL); res = ucftp_command(conn, cmd); av_free(cmd); if(res >= 0 && res / 100 != 2) res = -EIO; if(res < 0) { return res; } return 0; } static int ucftp_op(enum ucftp_op op, ventry *ve) { int res; struct ucftpfs *fs = ucftp_ventry_ucftpfs(ve); struct ucftpentry *ent = ucftp_ventry_ucftpentry(ve); struct ucftpconn *conn; char *dir; char *file; conn = ucftp_find_conn(fs, ent); if(!conn) return -EIO; // no conn? if(conn->busy) return -EAGAIN; // control connection busy conn->busy = 1; dir = ucftp_create_path(ent->parent); file = av_strdup(ent->name); res = ucftp_do_op(op, dir[0] == '\0' ? "/" : dir, file, conn); av_free(dir); av_free(file); ucftp_release_conn(conn); return res; } /*************************************** * deletion code ***************************************/ static int ucftp_unlink(ventry *ve) { struct ucftpentry *ent = ucftp_ventry_ucftpentry(ve); int res; if(ent->node == NULL) return -ENOENT; if(AV_ISDIR(ent->node->st.mode)) return -EISDIR; res = ucftp_op(OP_DELE, ve); if(res < 0) return res; ucftp_unlink_node(ent); return 0; } /* called by ucftp_rmdir */ static int ucftp_check_rmdir(struct ucftpentry *ent) { struct ucftpnode *nod = ent->node; if(nod == NULL) return -ENOENT; if(!AV_ISDIR(nod->st.mode)) return -ENOTDIR; if(nod->subdir != NULL) return -ENOTEMPTY; if(ent->parent == NULL) return -EBUSY; return 0; } static int ucftp_rmdir(ventry *ve) { int res; struct ucftpentry *ent = ucftp_ventry_ucftpentry(ve); res = ucftp_check_rmdir(ent); if(res < 0) return res; res = ucftp_op(OP_RMD, ve); if(res < 0) return res; ucftp_unlink_node(ent); return 0; } /*************************************** * make dir code ***************************************/ static int ucftp_mkdir(ventry *ve, avmode_t mode) { int res; struct ucftpfs *fs = ucftp_ventry_ucftpfs(ve); struct ucftpentry *ent = ucftp_ventry_ucftpentry(ve); if(ent->node != NULL) return -EEXIST; res = ucftp_op(OP_MKD, ve); if(res < 0) return res; res = ucftp_make_node(fs, ent, mode | AV_IFDIR); if(res < 0) return res; if(ent->parent != NULL && ent->parent->node != NULL) ent->parent->node->valid = 0; return 0; } /*************************************** * seeking ***************************************/ #if 0 static avoff_t ucftp_lseek(vfile *vf, avoff_t offset, int whence) { return -ENOSYS; /* TODO implement some kind of seeking? * Since seeking is not supported by FTP and no data is cached * seeking would be terrible expensive. * on the other hand, forward seeking could be implemented * by repeatedly call read, seek to the end as well. Seek to * the start could be implemented by closing and re-open */ } #endif /*************************************** * ucftp_ctl code ***************************************/ static int ucftp_password_set(struct entry *ent, const char *param, const char *val) { struct ucftpsession *fts; struct statefile *sf = (struct statefile *) av_namespace_get(ent); struct ucftpfs *fs = (struct ucftpfs *) sf->data; unsigned int len; fts = ucftp_get_session(fs, param); av_free(fts->password); fts->password = av_strdup(val); len = strlen(fts->password); if(len > 0) { if(fts->password[len - 1] == '\n') fts->password[len - 1] = '\0'; } return 0; } static int ucftp_loggedin_get(struct entry *ent, const char *param, char **resp) { struct ucftpsession *fts; struct statefile *sf = (struct statefile *) av_namespace_get(ent); struct ucftpfs *fs = (struct ucftpfs *) sf->data; fts = ucftp_find_session(fs, param); if(fts == NULL) *resp = av_strdup("0\n"); else *resp = av_strdup("1\n"); return 0; } static int ucftp_loggedin_val(const char *val, int *resp) { char *end; int ival; ival = strtol(val, &end, 10); if(end == val) return -EINVAL; if(*end == '\n') end++; if(*end != '\0') return -EINVAL; if(ival < 0 || ival > 1) return -EINVAL; *resp = ival; return 0; } static int ucftp_loggedin_set(struct entry *ent, const char *param, const char *val) { int res; struct ucftpsession *fts; struct statefile *sf = (struct statefile *) av_namespace_get(ent); struct ucftpfs *fs = (struct ucftpfs *) sf->data; fts = ucftp_find_session(fs, param); if(fts == NULL) res = -EACCES; else { int ival; res = ucftp_loggedin_val(val, &ival); if(res == 0 && ival == 0) { /* FIXME: end connections using this session */ ucftp_remove_session(fts); } } return res; } static int ucftp_init_ctl(struct vmodule *module, struct ucftpfs *fs) { int res; struct namespace *ns; struct statefile *stf; struct entry *ent; struct avfs *avfs; res = av_state_new(module, "ucftp_ctl", &ns, &avfs); if(res < 0) return res; ent = av_namespace_lookup(ns, NULL, "password"); AV_NEW(stf); stf->data = fs; stf->get = NULL; stf->set = ucftp_password_set; av_namespace_set(ent, stf); ent = av_namespace_lookup(ns, NULL, "loggedin"); AV_NEW(stf); stf->data = fs; stf->get = ucftp_loggedin_get; stf->set = ucftp_loggedin_set; av_namespace_set(ent, stf); av_unref_obj(ns); return 0; } /*************************************** * ucftp constructor and destructor ***************************************/ static void ucftp_destroy(struct avfs *avfs) { struct ucftpfs *fs = (struct ucftpfs *) avfs->data; struct ucftpconn *conn; struct ucftpconn *nextconn; for(conn = fs->conns; conn != NULL; conn = nextconn) { nextconn = conn->next; ucftp_free_tree(conn->root); av_unref_obj(conn->root); ucftp_close_conn(conn); av_free(conn->host); av_free(conn->user); av_free(conn->password); av_free(conn->cwd); av_free(conn); } while(fs->sessions.next != &fs->sessions) ucftp_remove_session(fs->sessions.next); av_free(fs); } extern int av_init_module_ucftp(struct vmodule *module); int av_init_module_ucftp(struct vmodule *module) { int res; struct avfs *avfs; struct ucftpfs *fs; res = av_new_avfs("ucftp", NULL, AV_VER, AVF_ONLYROOT, module, &avfs); if(res < 0) return res; avfs->destroy = ucftp_destroy; AV_NEW(fs); avfs->data = (void *) fs; fs->avfs = avfs; fs->conns = NULL; fs->sessions.next = &fs->sessions; fs->sessions.prev = &fs->sessions; avfs->lookup = ucftp_lookup; avfs->putent = ucftp_putent; avfs->copyent = ucftp_copyent; avfs->getpath = ucftp_getpath; avfs->open = ucftp_open; avfs->close = ucftp_close; avfs->read = ucftp_read; avfs->readdir = ucftp_readdir; avfs->getattr = ucftp_getattr; avfs->write = ucftp_write; avfs->access = ucftp_access; avfs->readlink = ucftp_readlink; avfs->mkdir = ucftp_mkdir; avfs->unlink = ucftp_unlink; avfs->rmdir = ucftp_rmdir; //avfs->lseek = ucftp_lseek; // avfs->rename = vol_rename; // avfs->setattr = vol_setattr; // avfs->truncate = vol_truncate; av_add_avfs(avfs); res = ucftp_init_ctl(module, fs); if(res < 0) av_unref_obj(avfs); return res; } /* Local Variables: */ /* c-basic-offset:4 */ /* End: */ avfs-1.1.4/modules/utar.c0000644000175000001440000011317514032341001012154 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi Copyright (C) 2007,2013 Ralf Hoffmann (ralf@boomerangsworld.de) Based on the GNU tar sources (C) Free Software Foundation This file can be distributed under the GNU GPL. See the file COPYING. TAR module */ #include "gtar.h" #include "archive.h" #include "oper.h" #include "ugid.h" #include "version.h" #include #define COPYBUFSIZE 16384 #define BIGBLOCKSIZE (20 * BLOCKSIZE) /* Some constants from POSIX are given names. */ #define NAME_FIELD_SIZE 100 #define PREFIX_FIELD_SIZE 155 #define UNAME_FIELD_SIZE 32 /* FIXME: Not any more: inode udata is used for saving filenames temporarily at archive creation */ struct tar_entinfo { char *name; char *linkname; avoff_t size; avoff_t datastart; union block header; }; struct sp_array { avoff_t offset; int numbytes; }; struct tarnode { int type; struct sp_array *sparsearray; int sp_array_len; avoff_t headeroff; avuid_t uid; avgid_t gid; char uname[UNAME_FIELD_SIZE]; char gname[UNAME_FIELD_SIZE]; }; #define ISSPACE(x) isspace(x) #define ISODIGIT(x) ((x) >= '0' && (x) < '8') /*------------------------------------------------------------------------. | Quick and dirty octal conversion. Result is -1 if the field is invalid | | (all blank, or nonoctal). | `------------------------------------------------------------------------*/ static long long from_oct(int digs, char *where) { long long value; while (ISSPACE ((int) *where)) { /* skip spaces */ where++; if (--digs <= 0) return -1; /* all blank field */ } value = 0; while (digs > 0 && ISODIGIT (*where)) { /* Scan til nonoctal. */ value = (value << 3) | (*where++ - '0'); --digs; } if (digs > 0 && *where && !ISSPACE ((int) *where)) return -1; /* ended on non-space/nul */ return value; } /* this function is from gtar 1.26:list.c */ const int LG_8 = 3; const int LG_256 = 8; /* Convert buffer at WHERE0 of size DIGS from external format to uintmax_t. DIGS must be positive. If TYPE is nonnull, the data are of type TYPE. The buffer must represent a value in the range -MINUS_MINVAL through MAXVAL. If OCTAL_ONLY, allow only octal numbers instead of the other GNU extensions. Return -1 on error, diagnosing the error if TYPE is nonnull and if !SILENT. */ static avoff_t val_from_header (char const *where0, size_t digs, char const *type, avoff_t minus_minval, avoff_t maxval, char octal_only) { avoff_t value; char const *where = where0; char const *lim = where + digs; int negative = 0; /* Accommodate buggy tar of unknown vintage, which outputs leading NUL if the previous field overflows. */ where += !*where; /* Accommodate older tars, which output leading spaces. */ for (;;) { if (where == lim) { return -1; } if (!ISSPACE ((unsigned char) *where)) break; where++; } value = 0; if (ISODIGIT (*where)) { char const *where1 = where; avoff_t overflow = 0; for (;;) { value += *where++ - '0'; if (where == lim || ! ISODIGIT (*where)) break; overflow |= value ^ (value << LG_8 >> LG_8); value <<= LG_8; } /* Parse the output of older, unportable tars, which generate negative values in two's complement octal. If the leading nonzero digit is 1, we can't recover the original value reliably; so do this only if the digit is 2 or more. This catches the common case of 32-bit negative time stamps. */ if ((overflow || maxval < value) && '2' <= *where1 && type) { /* Compute the negative of the input value, assuming two's complement. */ int digit = (*where1 - '0') | 4; overflow = 0; value = 0; where = where1; for (;;) { value += 7 - digit; where++; if (where == lim || ! ISODIGIT (*where)) break; digit = *where - '0'; overflow |= value ^ (value << LG_8 >> LG_8); value <<= LG_8; } value++; overflow |= !value; if (!overflow && value <= minus_minval) { negative = 1; } } if (overflow) { return -1; } } else if (octal_only) { /* Suppress the following extensions. */ } else if (*where == '\200' /* positive base-256 */ || *where == '\377' /* negative base-256 */) { /* Parse base-256 output. A nonnegative number N is represented as (256**DIGS)/2 + N; a negative number -N is represented as (256**DIGS) - N, i.e. as two's complement. The representation guarantees that the leading bit is always on, so that we don't confuse this format with the others (assuming ASCII bytes of 8 bits or more). */ int signbit = *where & (1 << (LG_256 - 2)); avoff_t topbits = (((avoff_t) - signbit) << (CHAR_BIT * sizeof (avoff_t) - LG_256 - (LG_256 - 2))); value = (*where++ & ((1 << (LG_256 - 2)) - 1)) - signbit; for (;;) { value = (value << LG_256) + (unsigned char) *where++; if (where == lim) break; if (((value << LG_256 >> LG_256) | topbits) != value) { return -1; } } negative = signbit; if (negative) value = -value; } if (where != lim && *where && !ISSPACE ((unsigned char) *where)) { return -1; } if (value <= (negative ? minus_minval : maxval)) return negative ? -value : value; return -1; } /*------------------------------------------------------------------------. | Converts long VALUE into a DIGS-digit field at WHERE, including a | | trailing space and room for a NUL. For example, 3 for DIGS 3 means one | | digit, a space, and room for a NUL. | | | | We assume the trailing NUL is already there and don't fill it in. This | | fact is used by start_header and finish_header, so don't change it! | `------------------------------------------------------------------------*/ #if 0 static void to_oct (long value, int digs, char *where) { --digs; /* Trailing null slot is left alone */ do { where[--digs] = '0' + (char) (value & 7); /* one octal digit */ value >>= 3; } while (digs > 0); } #endif static int find_next_block(vfile *vf, union block *blk) { int res; res = av_read(vf, blk->buffer, BLOCKSIZE); if(res <= 0) return res; if(res < BLOCKSIZE) { av_log(AVLOG_WARNING, "TAR: Broken archive"); return -EIO; } return 1; } static int get_next_block(vfile *vf, union block *blk) { int res; res = find_next_block(vf, blk); if(res < 0) return res; if(res == 0) { av_log(AVLOG_WARNING, "TAR: Broken archive"); return -EIO; } return 0; } static enum archive_format get_header_format( union block *header ) { enum archive_format f = V7_FORMAT; if ( strncmp( header->header.magic, TMAGIC, TMAGLEN ) == 0 && strncmp( header->header.version, TVERSION, TVERSLEN ) == 0 ) { /* POSIX header is magic == "ustar\0" and version == "00" */ f = POSIX_FORMAT; } else if ( strcmp( header->header.magic, OLDGNU_MAGIC) == 0 ) { /* Old GNU header is magic == "ustar " and version == "0\0" */ /* it could be actually a pre-POSIX header */ f = OLDGNU_FORMAT; } return f; } /* return values: < 0: fatal, 0 eof, 1 bad header, 2 OK */ static int read_entry(vfile *vf, struct tar_entinfo *tinf) { int i; long unsigned_sum; /* the POSIX one :-) */ long signed_sum; /* the Sun one :-( */ long recorded_sum; char *p; char **longp; char *bp; union block data_block; int size, written; int res; avoff_t sres; char *next_long_name = NULL, *next_long_link = NULL; union block *header = &tinf->header; while (1) { res = find_next_block(vf, header); if(res <= 0) break; /* HEADER_END_OF_FILE */ recorded_sum = from_oct (sizeof header->header.chksum, header->header.chksum); unsigned_sum = 0; signed_sum = 0; p = header->buffer; for (i = sizeof (*header); --i >= 0;) { /* We can't use unsigned char here because of old compilers, e.g. V7. */ unsigned_sum += 0xFF & *p; signed_sum += *p++; } /* Adjust checksum to count the "chksum" field as blanks. */ for (i = sizeof (header->header.chksum); --i >= 0;) { unsigned_sum -= 0xFF & header->header.chksum[i]; signed_sum -= header->header.chksum[i]; } unsigned_sum += ' ' * sizeof header->header.chksum; signed_sum += ' ' * sizeof header->header.chksum; if (unsigned_sum == sizeof header->header.chksum * ' ') { /* This is a zeroed block...whole block is 0's except for the blanks we faked for the checksum field. */ res = 0; break; /* HEADER_ZERO_BLOCK */ } if (unsigned_sum != recorded_sum && signed_sum != recorded_sum) { res = 1; av_log(AVLOG_WARNING, "TAR: Bad header"); break; /* HEADER_FAILURE */ } /* Good block. Decode file size and return. */ if (header->header.typeflag == LNKTYPE) tinf->size = 0; /* links 0 size on tape */ else tinf->size = val_from_header(header->header.size, sizeof(header->header.size), "avoff_t", 0, AV_MAXOFF, 0); if (header->header.typeflag == GNUTYPE_LONGNAME || header->header.typeflag == GNUTYPE_LONGLINK || header->header.typeflag == XHDTYPE || header->header.typeflag == XGLTYPE) { if (header->header.typeflag == GNUTYPE_LONGNAME || header->header.typeflag == GNUTYPE_LONGLINK) { longp = ((header->header.typeflag == GNUTYPE_LONGNAME) ? &next_long_name : &next_long_link); if (*longp) av_free (*longp); bp = *longp = (char *) av_malloc ((avsize_t) tinf->size); for (size = tinf->size; size > 0; size -= written) { res = get_next_block (vf, &data_block); if (res < 0) break; written = BLOCKSIZE; if (written > size) written = size; memcpy (bp, data_block.buffer, (avsize_t) written); bp += written; } if(res < 0) break; } else if (header->header.typeflag == XHDTYPE) { /* just ignore/skip for the moment * look for details in GNU tar/list.c/read_header */ } else if (header->header.typeflag == XGLTYPE) { /* just ignore/skip for the moment */ } /* Loop! */ } else { tinf->datastart = vf->ptr; if (header->oldgnu_header.isextended) { do { res = get_next_block (vf, &data_block); if(res < 0) break; } while(data_block.sparse_header.isextended); } if(res < 0) break; sres = av_lseek(vf, AV_DIV(tinf->size, BLOCKSIZE) * BLOCKSIZE, AVSEEK_CUR); if(sres < 0) break; if (header->header.typeflag == 'g') continue; if ( get_header_format( header ) == POSIX_FORMAT ) { /* POSIX ustar format uses prefix for long file names the actual name is prefix/name */ if ( header->header.prefix[0] != '\0' ) { char *tmp_prefix, *tmp_name; tmp_prefix = av_strndup( header->header.prefix, PREFIX_FIELD_SIZE ); tmp_name = av_strndup( header->header.name, NAME_FIELD_SIZE ); if ( next_long_name ) av_free(next_long_name); next_long_name = av_stradd( NULL, tmp_prefix, "/", tmp_name, NULL ); av_free( tmp_prefix ); av_free( tmp_name ); } } /* NOTE: header->header.name is not necessarily null-terminated */ if ( next_long_name ) { tinf->name = av_strdup (next_long_name); } else { tinf->name = av_strndup( header->header.name, NAME_FIELD_SIZE ); } if ( next_long_link ) { tinf->linkname = av_strdup (next_long_link); } else { tinf->linkname = av_strndup( header->header.linkname, NAME_FIELD_SIZE ); } res = 2; break; /* HEADER_SUCCESS */ } } av_free(next_long_name); av_free(next_long_link); return res; } static void decode_header (union block *header, struct avstat *stat_info, enum archive_format *format_pointer, struct ugidcache *cache) { enum archive_format format; char ugname[UNAME_FIELD_SIZE+1]; if (strcmp (header->header.magic, TMAGIC) == 0) format = POSIX_FORMAT; else if (strcmp (header->header.magic, OLDGNU_MAGIC) == 0) format = OLDGNU_FORMAT; else format = V7_FORMAT; *format_pointer = format; stat_info->mode = from_oct (8, header->header.mode); stat_info->mode &= 07777; stat_info->mtime.sec = from_oct (1 + 12, header->header.mtime); stat_info->mtime.nsec = 0; if(header->header.typeflag == GNUTYPE_SPARSE) { stat_info->size = val_from_header(header->oldgnu_header.realsize, sizeof(header->oldgnu_header.realsize), "avoff_t", 0, AV_MAXOFF, 0); } else { stat_info->size = val_from_header(header->header.size, sizeof(header->header.size), "avoff_t", 0, AV_MAXOFF, 0); } // from_oct failed, so set size to 0 if ( stat_info->size == -1 ) { stat_info->size = 0; } switch(header->header.typeflag) { case GNUTYPE_SPARSE: case REGTYPE: case AREGTYPE: case LNKTYPE: case CONTTYPE: stat_info->mode |= AV_IFREG; break; case GNUTYPE_DUMPDIR: case DIRTYPE: stat_info->mode |= AV_IFDIR; break; case SYMTYPE: stat_info->mode |= AV_IFLNK; break; case BLKTYPE: stat_info->mode |= AV_IFBLK; break; case CHRTYPE: stat_info->mode |= AV_IFCHR; break; case FIFOTYPE: stat_info->mode |= AV_IFIFO; break; } if (format == V7_FORMAT) { stat_info->uid = from_oct (8, header->header.uid); stat_info->gid = from_oct (8, header->header.gid); stat_info->rdev = 0; } else { ugname[UNAME_FIELD_SIZE] = '\0'; strncpy(ugname, header->header.uname, UNAME_FIELD_SIZE); stat_info->uid = av_finduid(cache, ugname, from_oct (8, header->header.uid)); strncpy(ugname, header->header.gname, UNAME_FIELD_SIZE); stat_info->gid = av_findgid(cache, ugname, from_oct (8, header->header.gid)); switch (header->header.typeflag) { case BLKTYPE: case CHRTYPE: stat_info->rdev = av_mkdev (from_oct (8, header->header.devmajor), from_oct (8, header->header.devminor)); break; default: stat_info->rdev = 0; } } } static int check_existing(struct entry *ent, struct avstat *tarstat) { struct archnode *nod; nod = (struct archnode *) av_namespace_get(ent); if(AV_ISDIR(nod->st.mode)) { if(AV_ISDIR(tarstat->mode)) { nod->st.mode = tarstat->mode; nod->st.uid = tarstat->uid; nod->st.gid = tarstat->gid; nod->st.mtime = tarstat->mtime; #if 0 /* FIXME */ nod->origst = nod->st; #endif return 0; } else { av_log(AVLOG_WARNING, "TAR: Overwriting directory with file"); return 0; } } av_arch_del_node(ent); return 1; } static void fill_link(struct archive *arch, struct entry *ent, const char *linkname) { struct entry *link; struct archnode *nod = NULL; link = av_arch_resolve(arch, linkname, 0, 0); if(link != NULL) nod = (struct archnode *) av_namespace_get(link); if(nod == NULL || AV_ISDIR(nod->st.mode)) av_log(AVLOG_WARNING, "utar: Illegal hard link"); else { nod->st.nlink ++; av_namespace_set(ent, nod); av_ref_obj(ent); av_ref_obj(nod); } av_unref_obj(link); } static void tarnode_delete(struct tarnode *tn) { av_free(tn->sparsearray); } static void fill_node(struct archive *arch, struct entry *ent, struct tar_entinfo *tinf, struct avstat *tarstat) { struct archnode *nod; struct tarnode *tn; union block *header = &tinf->header; nod = av_arch_new_node(arch, ent, AV_ISDIR(tarstat->mode)); /* keep dev, ino, nlink */ nod->st.mode = tarstat->mode; nod->st.uid = tarstat->uid; nod->st.gid = tarstat->gid; nod->st.rdev = tarstat->rdev; nod->st.size = tarstat->size; nod->st.blksize = BLOCKSIZE; nod->st.blocks = AV_BLOCKS(tinf->size); nod->st.atime = tarstat->mtime; /* FIXME */ nod->st.mtime = tarstat->mtime; nod->st.ctime = tarstat->mtime; nod->offset = tinf->datastart; nod->realsize = tinf->size; AV_NEW_OBJ(tn, tarnode_delete); nod->data = tn; tn->sparsearray = NULL; tn->headeroff = tinf->datastart - BLOCKSIZE; tn->uid = from_oct (8, header->header.uid); tn->gid = from_oct (8, header->header.gid); strncpy(tn->uname, header->header.uname, UNAME_FIELD_SIZE); strncpy(tn->gname, header->header.gname, UNAME_FIELD_SIZE); tn->type = header->header.typeflag; if(tn->type == SYMTYPE) { nod->linkname = tinf->linkname; nod->st.size = strlen(nod->linkname); tinf->linkname = NULL; } } static void fill_tarentry(struct archive *arch, struct entry *ent, struct tar_entinfo *tinf, struct avstat *tarstat) { int res; union block *header = &tinf->header; struct archnode *nod; nod = (struct archnode *) av_namespace_get(ent); if(nod != NULL) { res = check_existing(ent, tarstat); if(res != 1) return; } if(header->header.typeflag == LNKTYPE) fill_link(arch, ent, tinf->linkname); else fill_node(arch, ent, tinf, tarstat); } static void insert_tarentry(struct archive *arch, struct tar_entinfo *tinf, struct avstat *tarstat) { struct entry *ent; if(tinf->header.header.typeflag == GNUTYPE_SPARSE) { #if 0 /* FIXME */ arch->flags |= ARCHF_RDONLY; if(arch->readonly_reason == NULL) arch->readonly_reason = av_strdup("TAR: Cannot modify archive containing sparsefiles"); #endif } /* Appears to be a file. But BSD tar uses the convention that a slash suffix means a directory. */ if(AV_ISREG(tarstat->mode) && tinf->name[strlen(tinf->name)-1] == '/') tarstat->mode = (tarstat->mode & 07777) | AV_IFDIR; ent = av_arch_resolve(arch, tinf->name, 1, 0); if(ent == NULL) return; if(av_arch_isroot(arch, ent)) { /* that is not so unusual, archives created with "tar -cf test.tar ." have a ./ entry so the warning is disabled */ /* av_log(AVLOG_WARNING, "TAR: Empty filename");*/ } else fill_tarentry(arch, ent, tinf, tarstat); av_unref_obj(ent); } static int read_tarfile(vfile *vf, struct archive *arch, struct ugidcache *cache) { struct tar_entinfo tinf; enum archive_format format; struct avstat tarstat; int res; while(1) { res = read_entry(vf, &tinf); if(res < 0) return res; else if(res == 1) { #if 0 /* FIXME */ arch->flags |= ARCHF_RDONLY; /* Broken archive */ if(arch->readonly_reason == NULL) arch->readonly_reason = av_strdup("TAR: Cannot modify archive with errors"); #endif continue; } else if(res == 0) break; av_default_stat(&tarstat); decode_header(&tinf.header, &tarstat, &format, cache); insert_tarentry(arch, &tinf, &tarstat); av_free(tinf.name); av_free(tinf.linkname); } return 0; } static int parse_tarfile(void *data, ventry *ve, struct archive *arch) { int res; vfile *vf; struct ugidcache *cache; res = av_open(ve->mnt->base, AVO_RDONLY, 0, &vf); if(res < 0) return res; cache = av_new_ugidcache(); res = read_tarfile(vf, arch, cache); av_unref_obj(cache); av_close(vf); return res; } #if 0 static int write_out(ave *v, int outfd, arch_file *file, avsize_t size) { avssize_t rres, wres, len; char buf[COPYBUFSIZE]; avsize_t at; for(at = 0; at < size;) { rres = av_read(v, file->fh, buf, AV_MIN(COPYBUFSIZE, size-at)); if(rres == -1) return -1; at += rres; file->ptr += rres; if(rres != COPYBUFSIZE && at != size) { v->errn = EIO; return -1; } if(rres < COPYBUFSIZE) { len = AV_DIV(rres, BLOCKSIZE) * BLOCKSIZE; if(len > rres) av_memset(buf + rres, 0, len - rres); } else len = COPYBUFSIZE; wres = av_write(v, outfd, buf, len); if(wres == -1) return -1; } return 0; } static void finish_header(union block *blk) { int i, sum; char *p; av_memset(blk->header.chksum, ' ', 8); /* Fill in the checksum field. It's formatted differently from the other fields: it has [6] digits, a null, then a space -- rather than digits, a space, then a null. We use to_oct then write the null in over to_oct's space. The final space is already there, from checksumming, and to_oct doesn't modify it. */ sum = 0; p = blk->buffer; for (i = BLOCKSIZE; --i >= 0; ) /* We can't use unsigned char here because of old compilers, e.g. V7. */ sum += 0xFF & *p++; to_oct ((long) sum, 7, blk->header.chksum); blk->header.chksum[6] = '\0'; /* zap the space */ } static int long_name(ave *v, int outfd, const char *name, int type) { union block blk; int size; int at; size = av_strlen(name) + 1; av_memset(blk.buffer, 0, BLOCKSIZE); av_strcpy(blk.header.name, "././@LongLink"); to_oct ((long) 0, 8, blk.header.mode); to_oct ((long) 0, 8, blk.header.uid); to_oct ((long) 0, 8, blk.header.gid); to_oct ((long) 0, 12, blk.header.mtime); av_strcpy(blk.header.uname, "root"); av_strcpy(blk.header.gname, "root"); av_strcpy(blk.header.magic, OLDGNU_MAGIC); blk.header.typeflag = type; to_oct ((long) size, 12, blk.header.size); finish_header(&blk); if(av_write(v, outfd, blk.buffer, BLOCKSIZE) == -1) return -1; for(at = 0; at < size; at += BLOCKSIZE) { av_memset(blk.buffer, 0, BLOCKSIZE); av_strncpy(blk.buffer, name + at, BLOCKSIZE); if(av_write(v, outfd, blk.buffer, BLOCKSIZE) == -1) return -1; } return 0; } static int create_entry(ave *v, arch_entry *ent, const char *path, arch_file *file, int outfd, struct ugidcache *cache) { union block blk; arch_inode *ino = ent->ino; struct tar_entdat *ted = (struct tar_entdat *) ent->udata; char *name; int type; avsize_t size; int res; char ugname[AV_TUNMLEN]; av_memset(blk.buffer, 0, BLOCKSIZE); to_oct ((long) ino->st.mode, 8, blk.header.mode); to_oct ((long) ino->st.mtime, 12, blk.header.mtime); if(!(ino->flags & INOF_CREATED) && ted != NULL && ino->st.uid == ino->origst.uid && ino->st.gid == ino->origst.gid) { to_oct ((long) ted->uid, 8, blk.header.uid); to_oct ((long) ted->gid, 8, blk.header.gid); av_strncpy(blk.header.uname, ted->uname, UNAME_FIELD_SIZE); av_strncpy(blk.header.gname, ted->gname, UNAME_FIELD_SIZE); } else { to_oct ((long) ino->st.uid, 8, blk.header.uid); to_oct ((long) ino->st.gid, 8, blk.header.gid); av_finduname(ugname, ino->st.uid, cache); av_strncpy(blk.header.uname, ugname, UNAME_FIELD_SIZE); av_findgname(ugname, ino->st.gid, cache); av_strncpy(blk.header.gname, ugname, UNAME_FIELD_SIZE); } /* We only do OLDGNU for the moment */ av_strcpy(blk.header.magic, OLDGNU_MAGIC); if(AV_ISDIR(ino->st.mode)) type = DIRTYPE; else if(AV_ISLNK(ino->st.mode)) type = SYMTYPE; else if(AV_ISCHR(ino->st.mode)) type = CHRTYPE; else if(AV_ISBLK(ino->st.mode)) type = BLKTYPE; else if(AV_ISFIFO(ino->st.mode) || AV_ISSOCK(ino->st.mode)) type = FIFOTYPE; else type = REGTYPE; if(ino->udata != NULL) type = LNKTYPE; blk.header.typeflag = type; if(type == REGTYPE) size = ino->st.size; else size = 0; to_oct ((long) size, 12, blk.header.size); if(type == CHRTYPE || type == BLKTYPE) { int major, minor; av_splitdev(ino->st.rdev, &major, &minor); to_oct ((long) major, 8, blk.header.devmajor); to_oct ((long) minor, 8, blk.header.devminor); } if(type == LNKTYPE || type == SYMTYPE) { char *linkname; if(type == LNKTYPE) linkname = (char *) ino->udata; else linkname = ino->syml; if(av_strlen(linkname) >= NAME_FIELD_SIZE && long_name(v, outfd, linkname, GNUTYPE_LONGLINK) == -1) return -1; av_strncpy(blk.header.linkname, linkname, NAME_FIELD_SIZE); blk.header.linkname[NAME_FIELD_SIZE-1] = '\0'; } if(!AV_ISDIR(ino->st.mode)) name = av_strconcat(v, path, ent->name, NULL); else name = av_strconcat(v, path, ent->name, "/", NULL); if(name == NULL) return -1; if(av_strlen(name) >= NAME_FIELD_SIZE && long_name(v, outfd, name, GNUTYPE_LONGNAME) == -1) return -1; av_strncpy(blk.header.name, name, NAME_FIELD_SIZE); blk.header.name[NAME_FIELD_SIZE-1] = '\0'; av_free(name); finish_header(&blk); if(av_write(v, outfd, blk.buffer, BLOCKSIZE) == -1) return -1; /* FIXME: sparse files */ if(ino->typeflag == GNUTYPE_SPARSE) { v->errn = EFAULT; return -1; } if(size != 0) { if(ino->tmpfile != NULL) { arch_file f; f.ptr = 0; f.fh = av_localopen(v, ino->tmpfile, AVO_RDONLY, 0); if(f.fh == -1) return -1; res = write_out(v, outfd, &f, size); av_localclose(DUMMYV, f.fh); if(res == -1) return -1; } else { file->ptr = av_lseek(v, file->fh, ino->offset, AVSEEK_SET); if(file->ptr == -1) return -1; res = write_out(v, outfd, file, size); if(res == -1) return -1; } } return 0; } static int write_tardir(ave *v, arch_file *file, arch_inode *dir, int outfd, const char *path, int pathchanged, struct ugidcache *cache) { arch_entry *ent; arch_inode *ino; struct tar_entdat *ted; int res; for(ent = dir->subdir; ent != NULL; ent = ent->next) { ted = (struct tar_entdat *) ent->udata; ino = ent->ino; if(!(ino->flags & INOF_AUTODIR)) { if(create_entry(v, ent, path, file, outfd, cache) == -1) return -1; if(!AV_ISDIR(ino->st.mode) && ino->st.nlink > 1 && ino->udata == NULL) { ino->udata = av_strconcat(v, path, ent->name, NULL); if(ino->udata == NULL) return -1; } } if(AV_ISDIR(ino->st.mode)) { int dirchanged; char *newpath; if(ted == NULL) dirchanged = 1; /* Renamed directory */ else dirchanged = 0; newpath = av_strconcat(v, path, ent->name, "/", NULL); if(newpath == NULL) return -1; res = write_tardir(v, file, ino, outfd, newpath, dirchanged, cache); av_free(newpath); if(res == -1) return -1; } } return 0; } static void clear_filenames(arch_inode *dir) { arch_entry *ent; for(ent = dir->subdir; ent != NULL; ent = ent->next) { av_free(ent->ino->udata); ent->ino->udata = NULL; if(AV_ISDIR(ent->ino->st.mode)) clear_filenames(ent->ino); } } static int need_origarch(arch_inode *dir) { arch_entry *ent; for(ent = dir->subdir; ent != NULL; ent = ent->next) { if(ent->ino->tmpfile == NULL && AV_ISREG(ent->ino->st.mode) && ent->ino->st.size != 0) return 1; if(AV_ISDIR(ent->ino->st.mode) && need_origarch(ent->ino)) return 1; } return 0; } static int zero_block(ave *v, int outfd) { union block blk; av_memset(blk.buffer, 0, BLOCKSIZE); if(av_write(v, outfd, blk.buffer, BLOCKSIZE) == -1) return -1; return 0; } static int flush_tarfile(ave *v, vpath *path, archive *arch) { arch_file file; rep_file *rf; int res; struct ugidcache cache; av_init_ugidcache(&cache); rf = av_get_replacement(v, BASE(path), need_origarch(arch->root->ino)); if(rf == NULL) return -1; file.fh = av_open(v, BASE(path), AVO_RDONLY, 0); if(file.fh == -1) { av_del_replacement(rf); return -1; } file.ptr = 0; res = write_tardir(v, &file, arch->root->ino, rf->outfd, "", 0, &cache); clear_filenames(arch->root->ino); if(res != -1) { avoff_t currsize, esize; /* This pads the size to 10 blocks */ /* FIXME: Do it nicer. Maybe with buffering all the writes */ currsize = av_lseek(v, rf->outfd, 0, AVSEEK_CUR); if(currsize == -1) res = -1; else { esize = AV_DIV(currsize + BLOCKSIZE, BIGBLOCKSIZE) * BIGBLOCKSIZE; while(currsize < esize) { res = zero_block(v, rf->outfd); if(res == -1) break; currsize += BLOCKSIZE; } } } av_close(DUMMYV, file.fh); if(res == -1) { av_log(AVLOG_ERROR, "utar: Flush failed, errno: %i", v->errn); av_del_replacement(rf); return -1; } res = av_replace_file(v, rf); if(res == -1) { av_log(AVLOG_ERROR, "utar: Replace file failed, errno: %i", v->errn); } return res; } static int copy_file(ave *v, arch_fdi *di) { arch_inode *ino = di->ino; avoff_t currpos; char buf[COPYBUFSIZE]; avssize_t rres, wres; int fd; ino->tmpfile = av_get_tmpfile(v); if(ino->tmpfile == NULL) return -1; fd = av_localopen(v, ino->tmpfile, AVO_RDWR | AVO_CREAT | AVO_EXCL, 0600); if(fd == -1) goto error; currpos = di->ptr; di->ptr = 0; while(di->ptr < di->size) { rres = tar_read(v, (void *) di, buf, COPYBUFSIZE); if(rres == -1) goto error; if(rres == 0) { v->errn = EIO; goto error; } wres = av_localwrite(v, fd, buf, rres); if(wres == -1) goto error; } av_close(DUMMYV, di->file.fh); di->file.fh = fd; di->file.ptr = di->size; di->offset = 0; ino->offset = 0; di->ptr = currpos; ino->flags |= INOF_DIRTY; return 0; error: if(fd != -1) av_localclose(DUMMYV, fd); av_del_tmpfile(ino->tmpfile); ino->tmpfile = NULL; return -1; } static avssize_t tar_write(ave *v, void *devinfo, const char *buf, avsize_t nbyte) { arch_fdi *di = (arch_fdi *) devinfo; if(nbyte == 0) return 0; if(di->ino->tmpfile == NULL && copy_file(v, di) == -1) return -1; return (*di->vdev->write) (v, devinfo, buf, nbyte); } #endif static void tar_release(struct archive *arch, struct archnode *nod) { struct tarnode *tn = (struct tarnode *) nod->data; if(tn != NULL) { av_free(tn->sparsearray); tn->sparsearray = NULL; } } static int read_sparsearray(struct archfile *fil) { int res; union block header; int counter; struct sp_array *sparses; struct tarnode *tn = (struct tarnode *) fil->nod->data; int size, len; av_lseek(fil->basefile, tn->headeroff, AVSEEK_SET); res = get_next_block(fil->basefile, &header); if(res < 0) return res; size = 10; len = 0; sparses = (struct sp_array *) av_malloc(size * sizeof(struct sp_array)); for (counter = 0; counter < SPARSES_IN_OLDGNU_HEADER; counter++) { sparses[len].offset = from_oct (1 + 12, header.oldgnu_header.sp[counter].offset); sparses[len].numbytes = from_oct (1 + 12, header.oldgnu_header.sp[counter].numbytes); if (!sparses[counter].numbytes) break; len++; } if (header.oldgnu_header.isextended) { /* Read in the list of extended headers and translate them into the sparsearray as before. */ while (1) { res = get_next_block(fil->basefile, &header); if(res < 0) { av_free(sparses); return res; } for (counter = 0; counter < SPARSES_IN_SPARSE_HEADER; counter++) { if (counter + len > size - 1) { /* Realloc the scratch area since we've run out of room. */ size *= 2; sparses = (struct sp_array *) av_realloc (sparses, size * sizeof (struct sp_array)); } if (header.sparse_header.sp[counter].numbytes[0] == 0) break; sparses[len].offset = from_oct (1 + 12, header.sparse_header.sp[counter].offset); sparses[len].numbytes = from_oct (1 + 12, header.sparse_header.sp[counter].numbytes); len++; } if (!header.sparse_header.isextended) break; } } tn->sparsearray = sparses; tn->sp_array_len = len; fil->nod->offset = fil->basefile->ptr; /* the correct offset */ return 0; } static avssize_t read_sparse(vfile *vf, char *buf, avsize_t nbyte) { struct archfile *fil = arch_vfile_file(vf); struct tarnode *tn = (struct tarnode *) fil->nod->data; avoff_t offset; avoff_t size = fil->nod->st.size; avoff_t realsize = fil->nod->realsize; struct sp_array *sparses; avoff_t realoff; int ctr; avsize_t nact; avoff_t start, end; avoff_t spstart, spend; avoff_t cmstart, cmend; int res; if(AV_ISDIR(fil->nod->st.mode)) return -EISDIR; if(vf->ptr >= size) return 0; if(tn->sparsearray == NULL) { res = read_sparsearray(fil); if(res < 0) return res; } sparses = tn->sparsearray; offset = fil->nod->offset; // since nbyte is avsize_t, the min will not be larger than that datatype nact = (avsize_t)AV_MIN((avoff_t)nbyte, (avoff_t) (size - vf->ptr)); start = vf->ptr; end = start + nact; memset(buf, 0, nact); realoff = 0; ctr = 0; while(ctr < tn->sp_array_len && realoff < realsize) { spstart = sparses[ctr].offset; spend = spstart + sparses[ctr].numbytes; if(spstart < end && spend > start) { avoff_t rdoffset; cmstart = AV_MAX(spstart, start); cmend = AV_MIN(spend, end); rdoffset = realoff + offset + (cmstart - spstart); res = av_pread(fil->basefile, buf + (cmstart - start), cmend - cmstart, rdoffset); if(res < 0) return res; if(res != (cmend - cmstart)) { av_log(AVLOG_WARNING, "TAR: Broken archive"); return -EIO; } } realoff += ((spend - spstart - 1) / BLOCKSIZE + 1) * BLOCKSIZE; ctr++; } vf->ptr += nact; return nact; } static avssize_t tar_read(vfile *vf, char *buf, avsize_t nbyte) { struct archfile *fil = arch_vfile_file(vf); struct tarnode *tn = (struct tarnode *) fil->nod->data; if(tn->type == GNUTYPE_SPARSE) return read_sparse(vf, buf, nbyte); else return av_arch_read(vf, buf, nbyte); } int av_init_module_utar(struct vmodule *module); int av_init_module_utar(struct vmodule *module) { int res; struct avfs *avfs; struct ext_info tarexts[2]; struct archparams *ap; tarexts[0].from = ".tar", tarexts[0].to = NULL; tarexts[1].from = NULL; res = av_archive_init("utar", tarexts, AV_VER, module, &avfs); if(res < 0) return res; ap = (struct archparams *) avfs->data; ap->parse = parse_tarfile; ap->read = tar_read; ap->release = tar_release; av_add_avfs(avfs); return 0; } avfs-1.1.4/modules/dav_ls.c0000644000175000001440000001426314032341001012447 00000000000000/* ls for AVFS DAV support. Most of this file is taken from ls.c in cadaver, which has the following copyright notice: 'ls' for cadaver Copyright (C) 2000-2001, Joe Orton , except where otherwise indicated. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ #include "filebuf.h" #include #include #include #include "dav.h" #include struct fetch_context { struct av_dav_conn *conn; struct av_dav_resource **list; const char *target; /* Request-URI of the PROPFIND */ unsigned int include_target; /* Include resource at href */ }; static const ne_propname props[] = { { "DAV:", "getcontentlength" }, { "DAV:", "getlastmodified" }, { "http://apache.org/dav/props/", "executable" }, { "DAV:", "resourcetype" }, { NULL } }; static int compare_resource(const struct av_dav_resource *r1, const struct av_dav_resource *r2) { /* Sort errors first, then collections, then alphabetically */ if (r1->type == resr_error) { return -1; } else if (r2->type == resr_error) { return 1; } else if (r1->type == resr_collection) { if (r2->type != resr_collection) { return -1; } else { return strcmp(r1->uri, r2->uri); } } else { if (r2->type != resr_collection) { return strcmp(r1->uri, r2->uri); } else { return 1; } } } static void results(void *userdata, const ne_uri *uri, const ne_prop_result_set *set) { struct fetch_context *ctx = userdata; struct av_dav_resource *current, *previous, *newres; const char *clength, *modtime, *isexec, *abspath; const ne_status *status = NULL; av_log (AVLOG_DEBUG, "DAV URI: %s", uri->path); newres = ne_propset_private(set); abspath = uri->path; if (ne_path_compare(ctx->target, abspath) == 0 && !ctx->include_target) { /* This is the target URI, skip it */ av_free(newres); return; } newres->uri = ne_strdup(abspath); // flat attributes are those declined in the xml start_element // handler. clength = ne_propset_value(set, &props[0]); modtime = ne_propset_value(set, &props[1]); isexec = ne_propset_value(set, &props[2]); if (clength == NULL) { status = ne_propset_status(set, &props[0]); } if (modtime == NULL) { status = ne_propset_status(set, &props[1]); } if (newres->type == resr_normal && status) { /* It's an error! */ newres->error_status = status->code; /* Special hack for Apache 1.3/mod_dav */ if (strcmp(status->reason_phrase, "status text goes here") == 0) { const char *desc; if (status->code == 401) { desc = ("Authorization Required"); } else if (status->klass == 3) { desc = ("Redirect"); } else if (status->klass == 5) { desc = ("Server Error"); } else { desc = ("Unknown Error"); } newres->error_reason = ne_strdup(desc); } else { newres->error_reason = ne_strdup(status->reason_phrase); } newres->type = resr_error; } if (isexec && strcasecmp(isexec, "T") == 0) { newres->is_executable = 1; } else { newres->is_executable = 0; } if (modtime) { newres->modtime = ne_httpdate_parse(modtime); } if (clength) { newres->size = strtol(clength, NULL, 10); } for (current = *ctx->list, previous = NULL; current != NULL; previous = current, current=current->next) { if (compare_resource(current, newres) >= 0) { break; } } if (previous) { previous->next = newres; } else { *ctx->list = newres; } newres->next = current; } int start_element(void *userdata, int parent, const char *nspace, const char *name, const char **atts) { ne_propfind_handler *pfh = userdata; struct av_dav_resource *r = ne_propfind_current_private(pfh); if (parent == 2) { // resourcetype if (strcmp(name, "collection") == 0) { r->type = resr_collection; } } else { if (strcmp(name, "resourcetype") == 0) { return 2; } } return NE_XML_DECLINE; } int data_element(void *userdata, int state, const char *cdata, size_t len) { return 0; } int end_element(void *userdata, int state, const char *nspace, const char *name) { return 0; } void free_resource(struct av_dav_resource *res) { ne_free(res->uri); ne_free(res->error_reason); av_free(res); } void free_resource_list(struct av_dav_resource *res) { struct av_dav_resource *next; for (; res != NULL; res = next) { next = res->next; free_resource(res); } } static void *create_private(void *userdata, const ne_uri *uri) { return av_calloc(sizeof(struct av_dav_resource)); } int fetch_resource_list(struct av_dav_conn *conn, const char *uri, int depth, int include_target, struct av_dav_resource **reslist) { ne_propfind_handler *pfh = ne_propfind_create(conn->sesh, uri, depth); int ret; struct fetch_context ctx = {0}; *reslist = NULL; ctx.conn = conn; ctx.list = reslist; ctx.target = uri; ctx.include_target = include_target; ne_xml_push_handler(ne_propfind_get_parser(pfh), start_element, data_element, end_element, pfh); ne_propfind_set_private(pfh, create_private, NULL, NULL); ret = ne_propfind_named(pfh, props, results, &ctx); ne_propfind_destroy(pfh); return ret; } avfs-1.1.4/modules/rsh.c0000644000175000001440000001512214032341001011766 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "remote.h" #include "runprog.h" #include "parsels.h" #include "filebuf.h" #include #include #include #define RSH_LIST_TIMEOUT 20000 struct rshlocalfile { char *tmpfile; struct program *pr; avoff_t currsize; }; static void rsh_parse_line(struct lscache *lc, const char *line, struct remdirlist *dl) { int res; char *filename; char *linkname; struct avstat stbuf; res = av_parse_ls(lc, line, &stbuf, &filename, &linkname); if(res != 1) return; av_remote_add(dl, filename, linkname, &stbuf); av_free(filename); av_free(linkname); } static int rsh_read_list(struct program *pr, struct lscache *lc, struct remdirlist *dl) { int res; while(1) { char *line; res = av_program_getline(pr, &line, RSH_LIST_TIMEOUT); if(res < 0) return res; if(res == 0) { av_log(AVLOG_ERROR, "RSH: timeout"); return -EIO; } if(line == NULL) return 0; rsh_parse_line(lc, line, dl); av_free(line); } } static int rsh_isspecial(int c) { const char *normchars = "/.~@#%^-_=+:"; if((c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || c >= 160 || strchr(normchars, c) != NULL) return 0; else return 1; } static char *rsh_code_name(const char *name) { char *newname = (char *) av_malloc(strlen(name) * 2 + 1); const char *s; char *d; for(s = name, d = newname; *s != '\0'; s++, d++) { if(rsh_isspecial((unsigned char) *s)) *d++ = '\\'; *d = *s; } *d = '\0'; return newname; } static char *rsh_split_hostpart(const char *hostpart, const char **hostp) { unsigned int i; for(i = 0; hostpart[i] != '\0'; i++) { if(hostpart[i] == '@') { *hostp = hostpart + i + 1; return av_strndup(hostpart, i); } } *hostp = hostpart; return NULL; } static int rsh_is_valid_username(const char *username) { const char *ch; if (!username) return 0; if (strlen(username) > 32) { // arbitrary chosen return 0; } for (ch = username; *ch != '\0'; ch++) { if (*ch >= 'A' && *ch <= 'Z') continue; if (*ch >= 'a' && *ch <= 'z') continue; if (*ch >= '0' && *ch <= '9') continue; return 0; } return 1; } static int rsh_is_valid_hostname(const char *host) { const char *ch; if (!host) return 0; if (strlen(host) > 255) { return 0; } for (ch = host; *ch != '\0'; ch++) { if (*ch >= 'A' && *ch <= 'Z') continue; if (*ch >= 'a' && *ch <= 'z') continue; if (*ch >= '0' && *ch <= '9') continue; // accept only for any other than the first char if (ch != host && *ch == '-') continue; if (ch != host && *ch == '.') continue; return 0; } return 1; } static int rsh_list(struct remote *rem, struct remdirlist *dl) { int res; struct program *pr; const char *prog[8]; char *escaped_path; unsigned int arg; const char *host; char *username; escaped_path = rsh_code_name(dl->hostpath.path); username = rsh_split_hostpart(dl->hostpath.host, &host); if (!rsh_is_valid_username(username) || !rsh_is_valid_hostname(host)) { av_free(escaped_path); av_free(username); return -EINVAL; } arg = 0; prog[arg++] = rem->name; if(username != NULL) { prog[arg++] = "-l"; prog[arg++] = username; } prog[arg++] = host; prog[arg++] = "/bin/ls"; if((dl->flags & REM_LIST_SINGLE) != 0) prog[arg++] = "-ldn"; else prog[arg++] = "-lan"; prog[arg++] = escaped_path; prog[arg++] = NULL; res = av_start_program(prog, &pr); if(res == 0) { struct lscache *lc = av_new_lscache(); res = rsh_read_list(pr, lc, dl); av_unref_obj(lc); av_unref_obj(pr); } av_free(escaped_path); av_free(username); return res; } static void rsh_free_localfile(struct rshlocalfile *lf) { if(lf->pr != NULL) { av_program_log_output(lf->pr); av_unref_obj(lf->pr); } } static int rsh_get(struct remote *rem, struct remgetparam *gp) { int res; struct rshlocalfile *lf; char *tmpfile; char *codedpath; char *path; const char *prog[4]; char progname[4]; strcpy(progname, "rcp"); progname[0] = rem->name[0]; res = av_get_tmpfile(&tmpfile); if(res < 0) return res; AV_NEW_OBJ(lf, rsh_free_localfile); lf->pr = NULL; codedpath = rsh_code_name(gp->hostpath.path); path = av_stradd(NULL, gp->hostpath.host, ":", codedpath, NULL); av_free(codedpath); lf->tmpfile = tmpfile; prog[0] = progname; prog[1] = path; prog[2] = lf->tmpfile; prog[3] = NULL; res = av_start_program(prog, &lf->pr); av_free(path); if(res < 0) { av_unref_obj(lf); av_del_tmpfile(tmpfile); return res; } lf->currsize = 0; gp->data = lf; gp->localname = lf->tmpfile; return 0; } static int rsh_wait(struct remote *rem, void *data, avoff_t end) { int res; struct rshlocalfile *lf = (struct rshlocalfile *) data; /* FIXME: timeout? */ do { struct stat stbuf; res = av_program_log_output(lf->pr); if(res <= 0) return res; res = stat(lf->tmpfile, &stbuf); if(res == 0) lf->currsize = stbuf.st_size; if(lf->currsize < end) av_sleep(250); } while(lf->currsize < end); return 1; } static void rsh_destroy(struct remote *rem) { av_free(rem->name); av_free(rem); } static int init_rsh(struct vmodule *module, const char *name) { struct remote *rem; struct avfs *avfs; AV_NEW(rem); rem->data = NULL; rem->name = av_strdup(name); rem->list = rsh_list; rem->get = rsh_get; rem->wait = rsh_wait; rem->destroy = rsh_destroy; return av_remote_init(module, rem, &avfs); } extern int av_init_module_rsh(struct vmodule *module); int av_init_module_rsh(struct vmodule *module) { int res; res = init_rsh(module, "rsh"); if(res < 0) return res; res = init_rsh(module, "ssh"); if(res < 0) return res; return 0; } avfs-1.1.4/modules/uzstd.c0000644000175000001440000001277414032341001012355 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2018 Ralf Hoffmann This program can be distributed under the terms of the GNU GPL. See the file COPYING. UZSTD module (based on UBZ2 module) */ #include "version.h" #include "zstdfile.h" #include "filecache.h" #include "oper.h" #include "version.h" struct zstdnode { struct avstat sig; struct zstdcache *cache; avino_t ino; }; struct zstdhandle { struct zstdfile *zfil; vfile *base; struct zstdnode *node; }; static void zstdnode_destroy(struct zstdnode *nod) { av_unref_obj(nod->cache); } static struct zstdnode *zstd_new_node(ventry *ve, struct avstat *stbuf) { struct zstdnode *nod; AV_NEW_OBJ(nod, zstdnode_destroy); nod->sig = *stbuf; nod->cache = av_zstdcache_new(); nod->ino = av_new_ino(ve->mnt->avfs); return nod; } static int zstd_same(struct zstdnode *nod, struct avstat *stbuf) { if(nod->sig.ino == stbuf->ino && nod->sig.dev == stbuf->dev && nod->sig.size == stbuf->size && AV_TIME_EQ(nod->sig.mtime, stbuf->mtime)) return 1; else return 0; } static struct zstdnode *zstd_do_get_node(ventry *ve, const char *key, struct avstat *stbuf) { static AV_LOCK_DECL(lock); struct zstdnode *nod; AV_LOCK(lock); nod = (struct zstdnode *) av_filecache_get(key); if(nod != NULL) { if(!zstd_same(nod, stbuf)) { av_unref_obj(nod); nod = NULL; } } if(nod == NULL) { nod = zstd_new_node(ve, stbuf); av_filecache_set(key, nod); } AV_UNLOCK(lock); return nod; } static int zstd_getnode(ventry *ve, vfile *base, struct zstdnode **resp) { int res; struct avstat stbuf; const int attrmask = AVA_INO | AVA_DEV | AVA_SIZE | AVA_MTIME; struct zstdnode *nod; char *key; res = av_fgetattr(base, &stbuf, attrmask); if(res < 0) return res; res = av_filecache_getkey(ve, &key); if(res < 0) return res; nod = zstd_do_get_node(ve, key, &stbuf); av_free(key); *resp = nod; return 0; } static int zstd_lookup(ventry *ve, const char *name, void **newp) { char *path = (char *) ve->data; if(path == NULL) { if(name[0] != '\0') return -ENOENT; if(ve->mnt->opts[0] != '\0') return -ENOENT; path = av_strdup(name); } else if(name == NULL) { av_free(path); path = NULL; } else return -ENOENT; *newp = path; return 0; } static int zstd_access(ventry *ve, int amode) { return av_access(ve->mnt->base, amode); } static int zstd_open(ventry *ve, int flags, avmode_t mode, void **resp) { int res; vfile *base; struct zstdnode *nod; struct zstdhandle *fil; if(flags & AVO_DIRECTORY) return -ENOTDIR; if(AV_ISWRITE(flags)) return -EROFS; res = av_open(ve->mnt->base, AVO_RDONLY, 0, &base); if(res < 0) return res; res = zstd_getnode(ve, base, &nod); if(res < 0) { av_close(base); return res; } AV_NEW(fil); if((flags & AVO_ACCMODE) != AVO_NOPERM) fil->zfil = av_zstdfile_new(base); else fil->zfil = NULL; fil->base = base; fil->node = nod; *resp = fil; return 0; } static int zstd_close(vfile *vf) { struct zstdhandle *fil = (struct zstdhandle *) vf->data; av_unref_obj(fil->zfil); av_unref_obj(fil->node); av_close(fil->base); av_free(fil); return 0; } static avssize_t zstd_read(vfile *vf, char *buf, avsize_t nbyte) { avssize_t res; struct zstdhandle *fil = (struct zstdhandle *) vf->data; res = av_zstdfile_pread(fil->zfil, fil->node->cache, buf, nbyte, vf->ptr); if(res > 0) vf->ptr += res; return res; } static int zstd_getattr(vfile *vf, struct avstat *buf, int attrmask) { int res; struct zstdhandle *fil = (struct zstdhandle *) vf->data; struct zstdnode *nod = fil->node; avoff_t size; const int basemask = AVA_MODE | AVA_UID | AVA_GID | AVA_MTIME | AVA_ATIME | AVA_CTIME; res = av_fgetattr(fil->base, buf, basemask); if(res < 0) return res; if((attrmask & (AVA_SIZE | AVA_BLKCNT)) != 0) { res = av_zstdfile_size(fil->zfil, fil->node->cache, &size); if(res == 0 && size == -1) { fil->zfil = av_zstdfile_new(fil->base); res = av_zstdfile_size(fil->zfil, fil->node->cache, &size); } if(res < 0) return res; buf->size = size; buf->blocks = AV_BLOCKS(buf->size); } buf->mode &= ~(07000); buf->blksize = 4096; buf->dev = vf->mnt->avfs->dev; buf->ino = nod->ino; buf->nlink = 1; return 0; } extern int av_init_module_uzstd(struct vmodule *module); int av_init_module_uzstd(struct vmodule *module) { int res; struct avfs *avfs; struct ext_info uzstd_exts[4]; uzstd_exts[0].from = ".tar.zst", uzstd_exts[0].to = ".tar"; uzstd_exts[1].from = ".tzst", uzstd_exts[1].to = ".tar"; uzstd_exts[2].from = ".zst", uzstd_exts[2].to = NULL; uzstd_exts[3].from = NULL; res = av_new_avfs("uzstd", uzstd_exts, AV_VER, AVF_NOLOCK, module, &avfs); if(res < 0) return res; avfs->lookup = zstd_lookup; avfs->access = zstd_access; avfs->open = zstd_open; avfs->close = zstd_close; avfs->read = zstd_read; avfs->getattr = zstd_getattr; av_add_avfs(avfs); return 0; } avfs-1.1.4/modules/ubzip2.c0000644000175000001440000000127614032341001012412 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. UBZIP2 module */ #include "filter.h" #include "version.h" extern int av_init_module_ubzip2(struct vmodule *module); int av_init_module_ubzip2(struct vmodule *module) { struct avfs *avfs; const char *ubz2_args[3]; const char *bz2_args[2]; ubz2_args[0] = "bzip2"; ubz2_args[1] = "-d"; ubz2_args[2] = NULL; bz2_args[0] = "bzip2"; bz2_args[1] = NULL; return av_init_filt(module, AV_VER, "ubzip2", ubz2_args, bz2_args, NULL, &avfs); } avfs-1.1.4/modules/gz.c0000644000175000001440000000126514032341001011615 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. GZ module */ #include "filter.h" #include "version.h" extern int av_init_module_gz(struct vmodule *module); int av_init_module_gz(struct vmodule *module) { struct avfs *avfs; const char *ugz_args[3]; const char *gz_args[2]; ugz_args[0] = "gzip"; ugz_args[1] = "-d"; ugz_args[2] = NULL; gz_args[0] = "gzip"; gz_args[1] = NULL; /* FIXME: compression level argument */ return av_init_filt(module, AV_VER, "gz", gz_args, ugz_args, NULL, &avfs); } avfs-1.1.4/modules/ugz.c0000644000175000001440000002511014032341001011775 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. GUNZIP module */ #include "zfile.h" #include "zipconst.h" #include "filecache.h" #include "cache.h" #include "oper.h" #include "version.h" struct gznode { avmutex lock; int ready; struct avstat sig; struct cacheobj *cache; avino_t ino; avtime_t mtime; }; struct gzfile { struct zfile *zfil; vfile *base; struct gznode *node; }; #define GZBUFSIZE 1024 struct gzbuf { vfile *vf; unsigned char buf[GZBUFSIZE]; unsigned char *next; unsigned int avail; unsigned int total; }; #define GZHEADER_SIZE 10 #define GZFOOTER_SIZE 8 #define GZMAGIC1 0x1f #define GZMAGIC2 0x8b /* gzip flag byte */ #define GZFL_ASCII 0x01 /* bit 0 set: file probably ascii text */ #define GZFL_CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ #define GZFL_EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ #define GZFL_ORIG_NAME 0x08 /* bit 3 set: original file name present */ #define GZFL_COMMENT 0x10 /* bit 4 set: file comment present */ #define GZFL_RESERVED 0xE0 /* bits 5..7: reserved */ #define BI(ptr, i) ((avbyte) (ptr)[i]) #define DBYTE(ptr) (BI(ptr,0) | (BI(ptr,1)<<8)) #define QBYTE(ptr) ((avuint) (BI(ptr,0) | (BI(ptr,1)<<8) | \ (BI(ptr,2)<<16) | (BI(ptr,3)<<24))) static int gzbuf_getbyte(struct gzbuf *gb) { if(gb->avail == 0) { avssize_t res = av_read(gb->vf, (char*)( gb->buf ), GZBUFSIZE); if(res < 0) return res; gb->next = gb->buf; gb->avail = res; } if(gb->avail == 0) { av_log(AVLOG_ERROR, "UGZ: Premature end of file"); return -EIO; } gb->avail --; gb->total ++; return *gb->next ++; } static int gzbuf_skip_string(struct gzbuf *gb) { int c; do { c = gzbuf_getbyte(gb); if(c < 0) return c; } while(c != '\0'); return 0; } static int gzbuf_read(struct gzbuf *gb, char *buf, avsize_t nbyte) { for(; nbyte; nbyte--) { int c = gzbuf_getbyte(gb); if(c < 0) return c; *buf ++ = c; } return 0; } static int gz_read_header(vfile *vf, struct gznode *nod) { int res; struct gzbuf gb; unsigned char buf[GZHEADER_SIZE]; int method, flags; gb.vf = vf; gb.avail = 0; gb.total = 0; res = gzbuf_read(&gb, (char*)buf, GZHEADER_SIZE); if(res < 0) return res; if(buf[0] != GZMAGIC1 || buf[1] != GZMAGIC2) { av_log(AVLOG_ERROR, "UGZ: File not in GZIP format"); return -EIO; } method = buf[2]; flags = buf[3]; if(method != METHOD_DEFLATE) { av_log(AVLOG_ERROR, "UGZ: File compression is not DEFLATE"); return -EIO; } if(flags & GZFL_RESERVED) { av_log(AVLOG_ERROR, "UGZ: Unknown flags"); return -EIO; } nod->mtime = QBYTE(buf + 4); /* Ignore bytes 8 and 9 */ if((flags & GZFL_CONTINUATION) != 0) { res = gzbuf_read(&gb, (char*)buf, 2); if(res < 0) return res; } if((flags & GZFL_EXTRA_FIELD) != 0) { avsize_t len; res = gzbuf_read(&gb, (char*)buf, 2); if(res < 0) return res; for(len = DBYTE(buf); len; len--) { res = gzbuf_getbyte(&gb); if(res < 0) return res; } } if((flags & GZFL_ORIG_NAME) != 0) { res = gzbuf_skip_string(&gb); if(res < 0) return res; } if((flags & GZFL_COMMENT) != 0) { res = gzbuf_skip_string(&gb); if(res < 0) return res; } nod->ready = 1; return 0; } static void gznode_destroy(struct gznode *nod) { av_unref_obj(nod->cache); AV_FREELOCK(nod->lock); } static struct gznode *gz_new_node(ventry *ve, struct avstat *stbuf) { struct gznode *nod; AV_NEW_OBJ(nod, gznode_destroy); AV_INITLOCK(nod->lock); nod->ready = 0; nod->sig = *stbuf; nod->cache = NULL; nod->ino = av_new_ino(ve->mnt->avfs); return nod; } static int gz_same(struct gznode *nod, struct avstat *stbuf) { if(nod->sig.ino == stbuf->ino && nod->sig.dev == stbuf->dev && nod->sig.size == stbuf->size && AV_TIME_EQ(nod->sig.mtime, stbuf->mtime)) return 1; else return 0; } static struct gznode *gz_findnode(ventry *ve, const char *key, struct avstat *stbuf) { struct gznode *nod; static AV_LOCK_DECL(lock); AV_LOCK(lock); nod = (struct gznode *) av_filecache_get(key); if(nod != NULL) { if(!gz_same(nod, stbuf)) { av_unref_obj(nod); nod = NULL; } } if(nod == NULL) { nod = gz_new_node(ve, stbuf); av_filecache_set(key, nod); } AV_UNLOCK(lock); return nod; } static int gz_getnode(ventry *ve, vfile *base, struct gznode **resp) { int res; struct avstat stbuf; const int attrmask = AVA_INO | AVA_DEV | AVA_SIZE | AVA_MTIME; struct gznode *nod; char *key; res = av_fgetattr(base, &stbuf, attrmask); if(res < 0) return res; res = av_filecache_getkey(ve, &key); if(res < 0) return res; nod = gz_findnode(ve, key, &stbuf); AV_LOCK(nod->lock); if(!nod->ready) { res = gz_read_header(base, nod); if(res < 0) av_filecache_set(key, NULL); } else res = 0; AV_UNLOCK(nod->lock); av_free(key); if(res < 0) { av_unref_obj(nod); return res; } *resp = nod; return 0; } static struct zcache *gz_getcache(ventry *base, struct gznode *nod) { struct zcache *cache; cache = (struct zcache *) av_cacheobj_get(nod->cache); if(cache == NULL) { int res; char *name; res = av_generate_path(base, &name); if(res < 0) name = NULL; else name = av_stradd(name, "(index)", NULL); cache = av_zcache_new(); av_unref_obj(nod->cache); /* FIXME: the cacheobj should only be created when the zcache is nonempty */ nod->cache = av_cacheobj_new(cache, name); av_free(name); } return cache; } static int gz_lookup(ventry *ve, const char *name, void **newp) { char *path = (char *) ve->data; if(path == NULL) { if(name[0] != '\0') return -ENOENT; if(ve->mnt->opts[0] != '\0' && strcmp(ve->mnt->opts, "-s") != 0) return -ENOENT; path = av_strdup(name); } else if(name == NULL) { av_free(path); path = NULL; } else return -ENOENT; *newp = path; return 0; } static int gz_access(ventry *ve, int amode) { return av_access(ve->mnt->base, amode); } static int gz_open(ventry *ve, int flags, avmode_t mode, void **resp) { int res; vfile *base; struct gznode *nod; struct gzfile *fil; if(flags & AVO_DIRECTORY) return -ENOTDIR; if(AV_ISWRITE(flags)) return -EROFS; res = av_open(ve->mnt->base, AVO_RDONLY, 0, &base); if(res < 0) return res; res = gz_getnode(ve, base, &nod); if(res < 0) { av_close(base); return res; } AV_NEW(fil); if((flags & AVO_ACCMODE) != AVO_NOPERM) fil->zfil = av_zfile_new(base, 0, 0, AV_ZFILE_DATA_GZIP_ENCAPSULATED); else fil->zfil = NULL; fil->base = base; fil->node = nod; *resp = fil; return 0; } static int gz_close(vfile *vf) { struct gzfile *fil = (struct gzfile *) vf->data; av_unref_obj(fil->zfil); av_unref_obj(fil->node); av_close(fil->base); av_free(fil); return 0; } static avssize_t gz_read(vfile *vf, char *buf, avsize_t nbyte) { avssize_t res; struct gzfile *fil = (struct gzfile *) vf->data; struct zcache *zc; struct cacheobj *cobj; AV_LOCK(fil->node->lock); zc = gz_getcache(vf->mnt->base, fil->node); cobj = fil->node->cache; av_ref_obj(cobj); AV_UNLOCK(fil->node->lock); res = av_zfile_pread(fil->zfil, zc, buf, nbyte, vf->ptr); if(res >= 0) { vf->ptr += res; /* FIXME: should only be set when changed, ugly, UGLY, etc... */ av_cacheobj_setsize(cobj, av_zcache_size(zc)); } else { AV_LOCK(fil->node->lock); av_unref_obj(fil->node->cache); fil->node->cache = NULL; AV_UNLOCK(fil->node->lock); } av_unref_obj(zc); av_unref_obj(cobj); return res; } static int gz_getsize(vfile *vf, struct avstat *buf) { int res; struct gzfile *fil = (struct gzfile *) vf->data; struct zcache *zc; struct cacheobj *cobj; avoff_t size; AV_LOCK(fil->node->lock); zc = gz_getcache(vf->mnt->base, fil->node); cobj = fil->node->cache; av_ref_obj(cobj); AV_UNLOCK(fil->node->lock); res = av_zfile_size(fil->zfil, zc, &size); if(res == 0 && size == -1) { fil->zfil = av_zfile_new(fil->base, 0, 0, AV_ZFILE_DATA_GZIP_ENCAPSULATED); res = av_zfile_size(fil->zfil, zc, &size); } buf->size = size; av_unref_obj(zc); av_unref_obj(cobj); return res; } static int gz_getattr(vfile *vf, struct avstat *buf, int attrmask) { int res; struct gzfile *fil = (struct gzfile *) vf->data; struct gznode *nod = fil->node; const int basemask = AVA_MODE | AVA_UID | AVA_GID | AVA_ATIME | AVA_CTIME | AVA_BLKCNT; res = av_fgetattr(fil->base, buf, basemask); if(res < 0) return res; if((attrmask & (AVA_SIZE | AVA_BLKCNT)) != 0) { res = gz_getsize(vf, buf); if(res < 0) return res; } buf->mode &= ~(07000); buf->blksize = 4096; buf->dev = vf->mnt->avfs->dev; buf->ino = nod->ino; buf->nlink = 1; buf->mtime.sec = nod->mtime; buf->mtime.nsec = 0; return 0; } extern int av_init_module_ugz(struct vmodule *module); int av_init_module_ugz(struct vmodule *module) { int res; struct avfs *avfs; struct ext_info ugz_exts[3]; ugz_exts[0].from = ".gz", ugz_exts[0].to = NULL; ugz_exts[1].from = ".tgz", ugz_exts[1].to = ".tar"; ugz_exts[2].from = NULL; res = av_new_avfs("ugz", ugz_exts, AV_VER, AVF_NOLOCK, module, &avfs); if(res < 0) return res; avfs->lookup = gz_lookup; avfs->access = gz_access; avfs->open = gz_open; avfs->close = gz_close; avfs->read = gz_read; avfs->getattr = gz_getattr; av_add_avfs(avfs); return 0; } avfs-1.1.4/modules/urar.c0000644000175000001440000007704114032341001012153 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. RAR module Copyright (C) 1998 David Hanak (dhanak@inf.bme.hu) */ #include "archive.h" #include "realfile.h" #include "prog.h" #include "oper.h" #include "version.h" #include #include #include #define DOS_DIR_SEP_CHAR '\\' enum rar_format { RAR, RAR50 }; static avbyte good_marker_head[] = { 0x52, 0x61, 0x72, 0x21, 0x1a, 0x07, 0x00 }; #define LONG_HEAD_SIZE 11 #define SHORT_HEAD_SIZE 7 #define FILE_HEAD_SIZE 21 #define MARKER_HEAD_SIZE (sizeof(good_marker_head)/sizeof(avbyte)) typedef avbyte block_header[LONG_HEAD_SIZE]; typedef avbyte file_header[FILE_HEAD_SIZE]; #define BI(ptr, i) ((avbyte) (ptr)[i]) #define BYTE(ptr) (BI(ptr,0)) #define DBYTE(ptr) ((avushort)(BI(ptr,0) | (BI(ptr,1)<<8))) #define QBYTE(ptr) ((avuint)(BI(ptr,0) | (BI(ptr,1)<<8) | \ (BI(ptr,2)<<16) | (BI(ptr,3)<<24))) #define QQBYTE(ptr) ((avuquad)((avuquad)BI(ptr,0) | ((avuquad)BI(ptr,1)<<8) | \ ((avuquad)BI(ptr,2)<<16) | ((avuquad)BI(ptr,3)<<24) | \ ((avuquad)BI(ptr,4)<<32) | ((avuquad)BI(ptr,5)<<40) | \ ((avuquad)BI(ptr,6)<<48) | ((avuquad)BI(ptr,7)<<56))) #define bh_CRC(bh) DBYTE(bh ) #define bh_type(bh) BYTE (bh + 2) #define bh_flags(bh) DBYTE(bh + 3) #define bh_headsize(bh) DBYTE(bh + 5) #define bh_addsize(bh) QBYTE(bh + 7) #define bh_size(bh) (bh_headsize(bh) + bh_addsize(bh)) #define fh_origsize(fh) QBYTE(fh ) #define fh_hostos(fh) BYTE (fh + 4) #define fh_CRC(fh) QBYTE(fh + 5) #define fh_time(fh) QBYTE(fh + 9) #define fh_version(fh) BYTE (fh + 13) #define fh_method(fh) BYTE (fh + 14) #define fh_namelen(fh) DBYTE(fh + 15) #define fh_attr(fh) QBYTE(fh + 17) #define dos_ftsec(ft) (int)( 2 * ((ft >> 0) & 0x1F)) #define dos_ftmin(ft) (int)( ((ft >> 5) & 0x3F)) #define dos_fthour(ft) (int)( ((ft >> 11) & 0x1F)) #define dos_ftday(ft) (int)( ((ft >> 16) & 0x1F)) #define dos_ftmonth(ft) (int)(-1 + ((ft >> 21) & 0x0F)) #define dos_ftyear(ft) (int)(80 + ((ft >> 25) & 0x7F)) /* Block types */ #define B_MARKER 0x72 #define B_MAIN 0x73 #define B_FILE 0x74 #define B_COMMENT 0x75 #define B_EXTRA_INFO 0x76 #define B_SUB 0x77 #define B_RECOVERY 0x78 /* Block flags */ #define FB_OUTDATED 0x4000 #define FB_WITH_BODY 0x8000 /* Archive flags */ #define FA_IS_VOLUME 0x01 #define FA_WITH_COMMENT 0x02 #define FA_IS_SOLID 0x04 #define FA_WITH_AUTHENTICITY 0x20 /* File block flags */ #define FF_CONT_FROM_PREV 0x01 #define FF_CONT_IN_NEXT 0x02 #define FF_WITH_PASSWORD 0x04 #define FF_WITH_COMMENT 0x08 #define FF_IS_SOLID 0x10 /* Compression methods */ #define M_STORE 0x30 #define M_FASTEST 0x31 #define M_FAST 0x32 #define M_NORMAL 0x33 #define M_GOOD 0x34 #define M_BEST 0x35 /* Archiving OS */ #define OS_MSDOS 0 #define OS_OS2 1 #define OS_WIN32 2 #define OS_UNIX 3 #define CRC_START 0xFFFFFFFFUL #define CRC_INIT 0xEDB88320UL #define CRC_TABLESIZE 256 static avuint CRC_table[CRC_TABLESIZE]; /* some rar 5 header values (not complete, just what is necessary for the features */ enum { RAR5_HEADER_TYPE_MAIN_ARCHIVE_HEADER = 1, RAR5_HEADER_TYPE_FILE_HEADER = 2, RAR5_HEADER_TYPE_END_OF_ARCHIVE = 5 }; enum { RAR5_HEADER_FLAGS_EXTRA_PRESENT = 1, RAR5_HEADER_FLAGS_DATA_PRESENT = 2 }; enum { RAR5_HEADER_FILE_HEADER_FILE_FLAGS_DIRECTORY_OBJECT = 1, RAR5_HEADER_FILE_HEADER_FILE_FLAGS_UNIX_TIME_PRESENT = 2, RAR5_HEADER_FILE_HEADER_FILE_FLAGS_CRC_PRESENT = 4, RAR5_HEADER_FILE_HEADER_FILE_FLAGS_UNPACKED_SIZE_UNKNOWN = 8 }; enum { RAR5_HEADER_FILE_HEADER_HOST_OS_WINDOWS = 0, RAR5_HEADER_FILE_HEADER_HOST_OS_UNIX = 1 }; enum { RAR5_HEADER_FILE_HEADER_EXTRA_TYPE_FILE_TIME = 3 }; enum { RAR5_HEADER_FILE_HEADER_EXTRA_FILE_TIME_FLAGS_UNIX_TIME = 0x01, RAR5_HEADER_FILE_HEADER_EXTRA_FILE_TIME_FLAGS_MTIME_PRESENT = 0x02, RAR5_HEADER_FILE_HEADER_EXTRA_FILE_TIME_FLAGS_CTIME_PRESENT = 0x04, RAR5_HEADER_FILE_HEADER_EXTRA_FILE_TIME_FLAGS_ATIME_PRESENT = 0x08, RAR5_HEADER_FILE_HEADER_EXTRA_FILE_TIME_FLAGS_NSEC_PRECISION = 0x10 }; struct rarnode { avushort flags; avbyte hostos; avbyte packer_version; avbyte method; char *path; }; struct rar_entinfo { char *name; char *linkname; avoff_t datastart; block_header bh; file_header fh; }; struct rar5_entinfo { char *name; char *linkname; avbyte is_dir; avoff_t size; avtimestruc_t mtime; avtimestruc_t atime; avtimestruc_t ctime; avmode_t mode; }; struct rarfile { char *tmpfile; int fd; }; static void initCRC(void) { int i, j; avuint c; for (i = 0; i < CRC_TABLESIZE; i++) { for (c = i, j = 0; j < 8; j++) c = (c & 1) ? (c >> 1) ^ CRC_INIT : (c >> 1); CRC_table[i] = c; } } static avuint CRC_byte(avuint crc, avbyte byte) { return CRC_table[(avbyte)crc ^ byte] ^ (crc >> 8); } static avuint CRC_string(avuint crc, avbyte *buf, long size) { long i; for (i = 0; i < size; i++) crc = CRC_byte(crc, buf[i]); return crc; } static int read_block_header(vfile *vf, block_header bh, int all) { int res; int size = SHORT_HEAD_SIZE; int i; for(i = SHORT_HEAD_SIZE; i < LONG_HEAD_SIZE; i++) bh[i] = 0; if(all) res = av_read_all(vf, (char*)bh, SHORT_HEAD_SIZE); else res = av_read(vf, (char*)bh, SHORT_HEAD_SIZE); if(res < 0) return res; if(res < SHORT_HEAD_SIZE) return 0; if ((bh_flags(bh) & FB_WITH_BODY) != 0) { res = av_read_all(vf, (char*) ( bh+SHORT_HEAD_SIZE ), 4); if(res < 0) return res; size += 4; } return size; } static int read_marker_block(vfile *vf, enum rar_format *format) { int res; avbyte buf[MARKER_HEAD_SIZE], *pos = buf; int readsize = MARKER_HEAD_SIZE; /* An SFX module starts with the extraction header. Skip that part by searching for the marker head. */ while(1) { res = av_read_all(vf, (char*)( buf + MARKER_HEAD_SIZE - readsize ), readsize); if(res < 0) return res; if (memcmp(buf, good_marker_head, MARKER_HEAD_SIZE - 1) == 0) { if (buf[6] == 0) { // rar format 1.5 *format = RAR; return 0; } else if (buf[6] == 1) { // rar format 5.0 *format = RAR50; // rar 5.0 uses one additional byte res = av_read_all(vf, (char*)buf, 1); if(res < 0) return res; if (buf[0] != 0) { return -EINVAL; } return 0; } else if (buf[6] == 2) { // rar future format return -ENOTSUP; } } pos = memchr(buf + 1, good_marker_head[0], MARKER_HEAD_SIZE-1); if (pos == NULL) readsize = MARKER_HEAD_SIZE; else { readsize = pos - buf; memmove(buf, pos, MARKER_HEAD_SIZE - readsize); } } return 0; /* Just to avoid warnings. Never reaches this line. */ } static int read_archive_header(vfile *vf) { int res; block_header main_head; avuint crc; avbyte tmpbuf[6]; int headlen; headlen = read_block_header(vf, main_head, 1); if(headlen < 0) return headlen; if (bh_type(main_head) != B_MAIN) { av_log(AVLOG_ERROR, "URAR: Bad archive header"); return -EIO; } crc = CRC_string(CRC_START, main_head + 2, headlen - 2); /* Read reserved bytes. */ res = av_read_all(vf, (char*)tmpbuf, 6); if(res < 0) return res; crc = CRC_string(crc, tmpbuf, 6); if ((avushort)~crc != bh_CRC(main_head)) { av_log(AVLOG_ERROR, "URAR: Bad archive header CRC"); return -EIO; } av_lseek(vf, bh_size(main_head) - headlen - 6, AVSEEK_CUR); return 0; } static void conv_tolower(char *s) { for(; *s; s++) *s = tolower((int) *s); } static void dos2unix_path(char *path) { char *pos = path; while((pos = strchr(pos, DOS_DIR_SEP_CHAR)) != NULL) *pos = '/'; } static avtime_t dos2unix_time(avuint dt) { struct avtm ut; ut.sec = dos_ftsec(dt); ut.min = dos_ftmin(dt); ut.hour = dos_fthour(dt); ut.day = dos_ftday(dt); ut.mon = dos_ftmonth(dt); ut.year = dos_ftyear(dt); return av_mktime(&ut); } static avmode_t dos2unix_attr(avuint da, avmode_t archmode) { avmode_t mode = (archmode & 0666); if (da & 0x01) mode = mode & ~0222; if (da & 0x10) mode = mode | ((mode & 0444) >> 2) | AV_IFDIR; else mode |= AV_IFREG; return mode; } static void rarnode_delete(struct rarnode *info) { av_free(info->path); } static avmode_t rar_get_mode(struct rar_entinfo *ei, avmode_t origmode) { if (bh_flags(ei->bh) & FF_WITH_PASSWORD) return AV_IFREG; /* FIXME */ else { if (fh_hostos(ei->fh) == OS_UNIX) return fh_attr(ei->fh); else return dos2unix_attr(fh_attr(ei->fh), origmode); } } static void fill_rarentry(struct archive *arch, struct entry *ent, struct rar_entinfo *ei) { struct rarnode *info; struct archnode *nod; int isdir = AV_ISDIR(rar_get_mode(ei, 0)); nod = av_arch_new_node(arch, ent, isdir); nod->st.mode = rar_get_mode(ei, nod->st.mode); nod->st.mtime.sec = dos2unix_time(fh_time(ei->fh)); nod->st.mtime.nsec = 0; nod->st.atime = nod->st.mtime; nod->st.ctime = nod->st.mtime; nod->st.size = fh_origsize(ei->fh); nod->st.blocks = AV_BLOCKS(nod->st.size); nod->st.blksize = 4096; nod->offset = ei->datastart; if(fh_method(ei->fh) == M_STORE) nod->realsize = fh_origsize(ei->fh); else nod->realsize = 0; nod->linkname = av_strdup(ei->linkname); AV_NEW_OBJ(info, rarnode_delete); nod->data = info; info->flags = bh_flags(ei->bh); info->hostos = fh_hostos(ei->fh); info->packer_version = fh_version(ei->fh); info->method = fh_method(ei->fh); info->path = av_strdup(ei->name); } static void insert_rarentry(struct archive *arch, struct rar_entinfo *ei) { struct entry *ent; int entflags = 0; char *path = ei->name; dos2unix_path(path); if(fh_hostos(ei->fh) == OS_MSDOS) { conv_tolower(path); entflags |= NSF_NOCASE; } ent = av_arch_create(arch, path, entflags); if(ent == NULL) return; fill_rarentry(arch, ent, ei); av_unref_obj(ent); } static void fill_rar5entry(struct archive *arch, struct entry *ent, struct rar5_entinfo *ei) { struct rarnode *info; struct archnode *nod; nod = av_arch_new_node(arch, ent, ei->is_dir); nod->st.mode = ei->mode; nod->st.mtime = ei->mtime; nod->st.atime = ei->atime; nod->st.ctime = ei->ctime; nod->st.size = ei->size; nod->st.blocks = AV_BLOCKS(nod->st.size); nod->st.blksize = 512; nod->offset = 0; nod->realsize = 0; nod->linkname = NULL; AV_NEW_OBJ(info, rarnode_delete); nod->data = info; info->flags = 0; info->hostos = 0; info->packer_version = 0; info->method = 0; info->path = av_strdup(ei->name); } static void insert_rar5entry(struct archive *arch, struct rar5_entinfo *ei) { struct entry *ent; int entflags = 0; char *path = ei->name; ent = av_arch_create(arch, path, entflags); if(ent == NULL) { return; } fill_rar5entry(arch, ent, ei); av_unref_obj(ent); } static int crc_additional_header(vfile *vf, struct rar_entinfo *ei, int bytes_crcd, avuint *crc) { /* In the header there are some optional entries (e.g. salt, exttime; see arcread.ccp::ReadHeader * from unrar package). We need to use these bytes for the CRC. * Currently this optional stuff is not supported and I don't want to * add additional code to handle these information so I just read the * remaining bytes up to bh_headsize * * TODO: The salt is needed for crypted files which are not supported right now * so this is not a problem. * But perhaps it is a good idea to support the additional time information. */ int res, tlen = bytes_crcd; avbyte *tempbuf; tlen = bh_headsize(ei->bh) - 2 - tlen; if(tlen > 0) { tempbuf = av_malloc(tlen); res = av_read_all(vf, (char*)tempbuf, tlen); if(res < 0) { av_free(tempbuf); return res; } *crc = CRC_string(*crc, tempbuf, tlen); av_free(tempbuf); } else if(tlen < 0) { return -EIO; } return 0; } static int read_rarentry(vfile *vf, struct rar_entinfo *ei) { int res; block_header ch; avuint crc; if (bh_size(ei->bh) < LONG_HEAD_SIZE + FILE_HEAD_SIZE) { av_log(AVLOG_ERROR, "URAR: bad header"); return -EIO; } res = av_read_all(vf, (char*)( ei->fh ), FILE_HEAD_SIZE); if(res < 0) return res; ei->name = av_malloc(fh_namelen(ei->fh)+1); res = av_read_all(vf, ei->name, fh_namelen(ei->fh)); if(res < 0) return res; ei->name[fh_namelen(ei->fh)] = '\0'; crc = CRC_string(CRC_START, ei->bh + 2, LONG_HEAD_SIZE - 2); crc = CRC_string(crc, ei->fh, FILE_HEAD_SIZE); crc = CRC_string(crc, (avbyte*)( ei->name ), fh_namelen(ei->fh)); if(crc_additional_header(vf, ei, LONG_HEAD_SIZE - 2 + FILE_HEAD_SIZE + fh_namelen(ei->fh), &crc) != 0) { av_log(AVLOG_ERROR, "URAR: bad header"); return -EIO; } if ((avushort)~crc != bh_CRC(ei->bh)) { av_log(AVLOG_ERROR, "URAR: bad CRC"); return -EIO; } if ((bh_flags(ei->bh) & FF_WITH_COMMENT) != 0) { res = read_block_header(vf, ch, 1); if(res < 0) return res; av_lseek(vf, bh_size(ch) - res, AVSEEK_CUR); } if(fh_hostos(ei->fh) == OS_UNIX && AV_ISLNK(fh_attr(ei->fh))) { ei->linkname = av_malloc(fh_origsize(ei->fh) + 1); res = av_read_all(vf, ei->linkname, fh_origsize(ei->fh)); if(res < 0) return res; ei->linkname[fh_origsize(ei->fh)] = '\0'; } return 0; } // up to 10 bytes, 7 bits of data per byte, bit 7 == 1 indicates // continuation. Encoding is in little endian static int read_vint(vfile *vf, avuquad *result, avuint *crc) { int read_res; int count = 0; avbyte buf[1]; avuquad res = 0; for (count = 0; count < 10; count++) { read_res = av_read_all(vf, (char*)buf, 1); if (read_res < 0) { av_log(AVLOG_ERROR, "URAR: out of data during vint parsing"); return read_res; } *crc = CRC_byte(*crc, buf[0]); res |= (buf[0] & 0x7f) << (7 * count); if ((buf[0] & 0x80) == 0) { *result = res; return 0; } } av_log(AVLOG_ERROR, "URAR: invalid vint"); return -EINVAL; } static int read_uint32(vfile *vf, avuint *result, avuint *crc) { avbyte buf[4]; int res; res = av_read_all(vf, (char*)buf, 4); if (res < 0) { return res; } *result = QBYTE(buf); if (crc) { *crc = CRC_string(*crc, buf, 4); } return 0; } static int read_uint64(vfile *vf, avuquad *result, avuint *crc) { avbyte buf[8]; int res; res = av_read_all(vf, (char*)buf, 8); if (res < 0) { return res; } *result = QQBYTE(buf); if (crc) { *crc = CRC_string(*crc, buf, 8); } return 0; } static int skip_data(vfile *vf, size_t size, avuint *crc) { while (size > 0) { avbyte buf[1]; int res = av_read_all(vf, (char*)buf, 1); if (res < 0) { av_log(AVLOG_ERROR, "URAR: out of data during skipping data"); return res; } *crc = CRC_byte(*crc, buf[0]); size--; } return 0; } #define READ_VINT(vf, target, crc) { \ int res = read_vint((vf), (target), (crc)); \ if (res < 0) { \ return res; \ } \ } #define READ_UINT32(vf, target, crc) { \ int res = read_uint32((vf), (target), (crc)); \ if (res < 0) { \ return res; \ } \ } #define READ_UINT64(vf, target, crc) { \ int res = read_uint64((vf), (target), (crc)); \ if (res < 0) { \ return res; \ } \ } static void convert_windows_timestamp(avuquad timestamp, avtimestruc_t *ts) { // windows timestamps are in 100ns from year 1600something timestamp *= 100; timestamp -= 11644473600000000000ULL; ts->sec = timestamp / 1000000000; ts->nsec = timestamp % 1000000000; } static int parse_rar5_time_header(vfile *vf, struct rar5_entinfo *ei, avuint *crc) { // file time avuquad flags; int is_unix; READ_VINT(vf, &flags, crc); if (flags & RAR5_HEADER_FILE_HEADER_EXTRA_FILE_TIME_FLAGS_UNIX_TIME) { is_unix = 1; } else { is_unix = 0; } if (flags & RAR5_HEADER_FILE_HEADER_EXTRA_FILE_TIME_FLAGS_MTIME_PRESENT) { if (is_unix) { avuint mtime; READ_UINT32(vf, &mtime, crc); ei->mtime.sec = mtime; } else { avuquad mtime; READ_UINT64(vf, &mtime, crc); convert_windows_timestamp(mtime, &ei->mtime); } } if (flags & RAR5_HEADER_FILE_HEADER_EXTRA_FILE_TIME_FLAGS_CTIME_PRESENT) { if (is_unix) { avuint ctime; READ_UINT32(vf, &ctime, crc); ei->ctime.sec = ctime; } else { avuquad ctime; READ_UINT64(vf, &ctime, crc); convert_windows_timestamp(ctime, &ei->ctime); } } if (flags & RAR5_HEADER_FILE_HEADER_EXTRA_FILE_TIME_FLAGS_ATIME_PRESENT) { if (is_unix) { avuint atime; READ_UINT32(vf, &atime, crc); ei->atime.sec = atime; } else { avuquad atime; READ_UINT64(vf, &atime, crc); convert_windows_timestamp(atime, &ei->atime); } } if (is_unix && (flags & RAR5_HEADER_FILE_HEADER_EXTRA_FILE_TIME_FLAGS_NSEC_PRECISION)) { if (flags & RAR5_HEADER_FILE_HEADER_EXTRA_FILE_TIME_FLAGS_MTIME_PRESENT) { avuint t; READ_UINT32(vf, &t, crc); ei->mtime.nsec = t; } if (flags & RAR5_HEADER_FILE_HEADER_EXTRA_FILE_TIME_FLAGS_CTIME_PRESENT) { avuint t; READ_UINT32(vf, &t, crc); ei->ctime.nsec = t; } if (flags & RAR5_HEADER_FILE_HEADER_EXTRA_FILE_TIME_FLAGS_ATIME_PRESENT) { avuint t; READ_UINT32(vf, &t, crc); ei->atime.nsec = t; } } return 0; } static int parse_rar5_extra_header(vfile *vf, avuquad extra_header_bytes, struct rar5_entinfo *ei, avuint *crc) { avoff_t start_pos = vf->ptr; while (vf->ptr - start_pos < extra_header_bytes) { avuquad size; avuquad type; avoff_t extra_header_pos; int res; READ_VINT(vf, &size, crc); extra_header_pos = vf->ptr; READ_VINT(vf, &type, crc); if (type == RAR5_HEADER_FILE_HEADER_EXTRA_TYPE_FILE_TIME) { res = parse_rar5_time_header(vf, ei, crc); if (res < 0) { return res; } } if (vf->ptr - extra_header_pos > size || extra_header_pos - start_pos + size > extra_header_bytes) { av_log(AVLOG_ERROR, "URAR: invalid extra header"); return -EINVAL; } res = skip_data(vf, size - (vf->ptr - extra_header_pos), crc); if (res < 0) { return res; } } return 0; } static int parse_rar5_file_header(vfile *vf, struct archive *arch, avuquad remaining_header_bytes, avuint *crc) { avoff_t start_pos = vf->ptr; avuquad file_flags; avuquad unpacked_size; avuquad attributes; avuint data_crc = 0; avuquad compression_information; avuquad host_os; avuquad name_length; int res; char *name = NULL; struct rar5_entinfo ei = { NULL, }; READ_VINT(vf, &file_flags, crc); READ_VINT(vf, &unpacked_size, crc ); if (file_flags & RAR5_HEADER_FILE_HEADER_FILE_FLAGS_UNPACKED_SIZE_UNKNOWN) { unpacked_size = 0; } READ_VINT(vf, &attributes, crc); /* uint32? mtime */ if (file_flags & RAR5_HEADER_FILE_HEADER_FILE_FLAGS_UNIX_TIME_PRESENT) { avuint mtime; READ_UINT32(vf, &mtime, crc); ei.mtime.sec = mtime; ei.ctime = ei.mtime; ei.atime = ei.mtime; } /* uint32? data_crc */ if (file_flags & RAR5_HEADER_FILE_HEADER_FILE_FLAGS_CRC_PRESENT) { READ_UINT32(vf, &data_crc, crc); } READ_VINT(vf, &compression_information, crc); READ_VINT(vf, &host_os, crc); READ_VINT(vf, &name_length, crc); if (name_length <= PATH_MAX) { name = av_malloc(name_length + 1); res = av_read_all(vf, name, name_length); if (res < 0) { av_free(name); return res; } name[name_length] = '\0'; *crc = CRC_string(*crc, (avbyte*)name, name_length); } res = parse_rar5_extra_header(vf, remaining_header_bytes - (vf->ptr - start_pos), &ei, crc); if (res < 0) { av_free(name); return res; } if (vf->ptr - start_pos > remaining_header_bytes) { av_log(AVLOG_ERROR, "URAR: invalid header"); av_free(name); return -EINVAL; } res = skip_data(vf, remaining_header_bytes - (vf->ptr - start_pos), crc); if (res < 0) { av_free(name); return res; } /* convert file attribute */ if (host_os == RAR5_HEADER_FILE_HEADER_HOST_OS_UNIX) { ei.mode = attributes; } else { // handle windows (host_os==0) and unknown identically if (file_flags & RAR5_HEADER_FILE_HEADER_FILE_FLAGS_DIRECTORY_OBJECT) { ei.mode = AV_IFDIR | 0700; } else { ei.mode = AV_IFREG | 0600; } } /* add entry to archive */ if (name != NULL) { ei.name = name; ei.linkname = NULL; ei.is_dir = file_flags & RAR5_HEADER_FILE_HEADER_FILE_FLAGS_DIRECTORY_OBJECT; ei.size = unpacked_size; insert_rar5entry(arch, &ei); av_free(ei.name); av_free(ei.linkname); } return 0; } /** * parse a block, return <= 0 for errors, > 0 for block type */ static int parse_rar5_block(vfile *vf, struct archive *arch) { int res; avuquad header_size; avuquad header_type; avuquad header_flags; avuquad extra_area_size; avuquad data_size; avuint crc = CRC_START; avuint header_crc; avoff_t headstart; READ_UINT32(vf, &header_crc, NULL); READ_VINT(vf, &header_size, &crc); /* store current file offset since header flags define visible fields, most of them are variable size. To skip all header bytes including the unknown, we need to know much bytes we already read */ headstart = vf->ptr; READ_VINT(vf, &header_type, &crc); if (header_type < RAR5_HEADER_TYPE_MAIN_ARCHIVE_HEADER || header_type > RAR5_HEADER_TYPE_END_OF_ARCHIVE) { av_log(AVLOG_ERROR, "URAR: invalid header type"); return -EINVAL; } READ_VINT(vf, &header_flags, &crc); /* vint? extra_area_size */ if (header_flags & RAR5_HEADER_FLAGS_EXTRA_PRESENT) { READ_VINT(vf, &extra_area_size, &crc); } else { extra_area_size = 0; } /* vint? data_size */ if (header_flags & RAR5_HEADER_FLAGS_DATA_PRESENT) { READ_VINT(vf, &data_size, &crc); } else { data_size = 0; } /* now we basically have all important fields, parse interesting block or skip the rest */ if (vf->ptr - headstart > header_size) { av_log(AVLOG_ERROR, "URAR: invalid header size"); return -EINVAL; } if (header_type == RAR5_HEADER_TYPE_FILE_HEADER) { res = parse_rar5_file_header(vf, arch, header_size - (vf->ptr - headstart), &crc); if (res < 0) { return res; } } else { res = skip_data(vf, header_size - (vf->ptr - headstart), &crc); if (res < 0) { return res; } } /* check header CRC */ if (~crc != header_crc) { av_log(AVLOG_ERROR, "URAR: invalid crc"); return -EINVAL; } /* skip the data area as well, but it is not part of the CRC */ if (header_flags & RAR5_HEADER_FLAGS_DATA_PRESENT) { av_lseek(vf, data_size, AVSEEK_CUR); } return header_type; } static int read_rar5file(vfile *vf, struct archive *arch) { while (1) { int res = parse_rar5_block(vf, arch); if (res < 0) { return res; } else if (res == 0) { return -EINVAL; } else if (res == RAR5_HEADER_TYPE_END_OF_ARCHIVE) { break; } } return 0; } static int read_rarfile(vfile *vf, struct archive *arch) { avoff_t headstart; int res; enum rar_format format; res = read_marker_block(vf, &format); if(res < 0) return res; if (format == RAR) { res = read_archive_header(vf); if(res < 0) return res; headstart = vf->ptr; while(1) { struct rar_entinfo ei; res = read_block_header(vf, ei.bh, 0); if(res < 0) return res; if(res == 0) break; if (bh_type(ei.bh) == B_FILE) { ei.name = NULL; ei.linkname = NULL; res = read_rarentry(vf, &ei); if(res < 0) { av_free(ei.name); av_free(ei.linkname); return res; } ei.datastart = vf->ptr; insert_rarentry(arch, &ei); av_free(ei.name); av_free(ei.linkname); } av_lseek(vf, headstart + bh_size(ei.bh), AVSEEK_SET); headstart = vf->ptr; } } else if (format == RAR50) { return read_rar5file(vf, arch); } return 0; } static int parse_rarfile(void *data, ventry *ve, struct archive *arch) { int res; vfile *vf; res = av_open(ve->mnt->base, AVO_RDONLY, 0, &vf); if(res < 0) return res; res = read_rarfile(vf, arch); av_close(vf); return res; } /* FIXME: Because we use the 'rar' program to extract the contents of each file individually , we get _VERY_ poor performance */ static int get_rar_file(ventry *ve, struct archfile *fil, int fd) { int res; struct rarnode *info = (struct rarnode *) fil->nod->data; struct realfile *rf; const char *prog[7]; struct proginfo pri; static int rar_available = 1; res = av_get_realfile(ve->mnt->base, &rf); if(res < 0) return res; /* prepare arguments */ prog[0] = "rar"; prog[1] = "p"; prog[2] = "-c-"; prog[3] = "-ierr"; prog[4] = rf->name; prog[5] = info->path; prog[6] = NULL; if(rar_available) { av_init_proginfo(&pri); pri.prog = prog; pri.ifd = open("/dev/null", O_RDWR); pri.ofd = fd; pri.efd = pri.ifd; res = av_start_prog(&pri); close(pri.ifd); if(res == 0) res = av_wait_prog(&pri, 0, 0); } else { /* force unrar execution */ res = -EIO; } if(res == -EIO) { /* rar failed or unavailable, try unrar */ rar_available = 0; prog[0] = "unrar"; av_init_proginfo(&pri); pri.prog = prog; pri.ifd = open("/dev/null", O_RDWR); pri.ofd = fd; pri.efd = pri.ifd; res = av_start_prog(&pri); close(pri.ifd); if(res == 0) res = av_wait_prog(&pri, 0, 0); if(res == -EIO) { /* unrar failed too so reset rar_available */ rar_available = 1; } } av_unref_obj(rf); return res; } static int do_unrar(ventry *ve, struct archfile *fil) { int res; struct rarfile *rfil; char *tmpfile; int fd; res = av_get_tmpfile(&tmpfile); if(res < 0) return res; fd = open(tmpfile, O_RDWR | O_CREAT | O_TRUNC, 0644); if(fd == -1) { res = -errno; av_log(AVLOG_ERROR, "RAR: Could not open %s: %s", tmpfile, strerror(errno)); av_del_tmpfile(tmpfile); return res; } res = get_rar_file(ve, fil, fd); if(res < 0) { close(fd); av_del_tmpfile(tmpfile); return res; } AV_NEW(rfil); rfil->tmpfile = tmpfile; rfil->fd = fd; fil->data = rfil; return 0; } static int rar_open(ventry *ve, struct archfile *fil) { struct rarnode *info = (struct rarnode *) fil->nod->data; if(info == NULL) { /* access to base rar directory */ return -EISDIR; } if(info->flags & FF_WITH_PASSWORD) { av_log(AVLOG_WARNING, "URAR: File password protected, sorry..."); return -EACCES; } if(info->method != M_STORE) return do_unrar(ve, fil); return 0; } static int rar_close(struct archfile *fil) { struct rarfile *rfil = (struct rarfile *) fil->data; if(rfil != NULL) { close(rfil->fd); av_del_tmpfile(rfil->tmpfile); av_free(rfil); } return 0; } static avssize_t rar_read(vfile *vf, char *buf, avsize_t nbyte) { avssize_t res; struct archfile *fil = arch_vfile_file(vf); struct rarfile *rfil = (struct rarfile *) fil->data; if(rfil == NULL) return av_arch_read(vf, buf, nbyte); if(lseek(rfil->fd, vf->ptr, SEEK_SET) == -1) return -errno; res = read(rfil->fd, buf, nbyte); if(res == -1) return -errno; vf->ptr += res; return res; } extern int av_init_module_urar(struct vmodule *module); int av_init_module_urar(struct vmodule *module) { int res; struct avfs *avfs; struct ext_info rarexts[3]; struct archparams *ap; rarexts[0].from = ".rar", rarexts[0].to = NULL; rarexts[1].from = ".sfx", rarexts[1].to = NULL; rarexts[2].from = NULL; res = av_archive_init("urar", rarexts, AV_VER, module, &avfs); if(res < 0) return res; ap = (struct archparams *) avfs->data; ap->parse = parse_rarfile; ap->open = rar_open; ap->close = rar_close; ap->read = rar_read; initCRC(); av_add_avfs(avfs); return 0; } avfs-1.1.4/modules/uar.c0000644000175000001440000001721114032341001011762 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. AR module */ #include "archive.h" #include "oper.h" #include "version.h" #define ARMAGIC "!\n" #define ARMAGICLEN 8 #define ENDMAGIC "`\n" struct ar_header { char name[16]; char date[12]; char uid[6]; char gid[6]; char mode[8]; char size[10]; char endmagic[2]; }; struct ar_values { avtime_t mtime; avuid_t uid; avgid_t gid; avmode_t mode; avsize_t size; avoff_t offset; }; struct ar_nametab { char *names; avsize_t size; }; static void fill_arentry(struct archive *arch, struct entry *ent, struct ar_values *arv) { struct archnode *nod; nod = av_arch_new_node(arch, ent, 0); nod->offset = arv->offset; nod->realsize = arv->size; nod->st.mode = arv->mode; nod->st.uid = arv->uid; nod->st.gid = arv->gid; nod->st.blocks = AV_BLOCKS(arv->size); nod->st.blksize = 1024; nod->st.mtime.sec = arv->mtime; nod->st.mtime.nsec = 0; nod->st.atime = nod->st.mtime; nod->st.ctime = nod->st.mtime; nod->st.size = arv->size; } static void insert_arentry(struct archive *arch, struct ar_values *arv, const char *name) { struct entry *ent; if(!name[0]) { av_log(AVLOG_WARNING, "AR: Empty name"); return; } if((arv->mode & AV_IFMT) == 0) { av_log(AVLOG_WARNING, "AR: Illegal type"); return; } ent = av_arch_create(arch, name, 0); if(ent == NULL) return; fill_arentry(arch, ent, arv); av_unref_obj(ent); } static avulong getnum(const char *s, int len, int base) { avulong num; int i; num = 0; for(i = 0; i < len; i++) { if(s[i] >= '0' && s[i] < '0' + base) num = (num * base) + (s[i] - '0'); else break; } return num; } static int interpret_header(struct ar_header *hbuf, struct ar_values *arv) { if(strncmp(hbuf->endmagic, ENDMAGIC, 2) != 0) return -1; arv->mtime = getnum(hbuf->date, 12, 10); arv->uid = getnum(hbuf->uid, 6, 10); arv->gid = getnum(hbuf->gid, 6, 10); arv->mode = getnum(hbuf->mode, 8, 8); arv->size = getnum(hbuf->size, 10, 10); return 0; } static int read_longnames(vfile *vf, struct ar_values *arv, struct ar_nametab *nt) { avssize_t rres; avsize_t i; if(nt->names != NULL) { av_log(AVLOG_WARNING, "AR: Multiple name tables"); return 1; } if(arv->size == 0) return 1; if(arv->size >= (1 << 22)) { av_log(AVLOG_WARNING, "AR: name table too long"); return 1; } nt->size = arv->size; nt->names = av_malloc(nt->size); rres = av_read(vf, nt->names, nt->size); if(rres < 0) return rres; if(rres != nt->size) { av_log(AVLOG_WARNING, "AR: Broken archive"); return 0; } for(i = 0; i < nt->size; i++) if(nt->names[i] == '/' || nt->names[i] == '\\' || nt->names[i] == '\n') nt->names[i] = '\0'; nt->names[nt->size - 1] = '\0'; return 1; } static int read_bsd_longname(vfile *vf, struct archive *arch, struct ar_values *arv, char *shortname) { avssize_t rres; avsize_t namelen; char *name; namelen = getnum(shortname + 3, 13, 10); name = av_malloc(namelen + 1); rres = av_read(vf, name, namelen); if(rres == namelen) { arv->size -= namelen; arv->offset += namelen; insert_arentry(arch, arv, name); av_free(name); return 1; } av_free(name); if(rres < 0) return rres; av_log(AVLOG_WARNING, "AR: Broken archive"); return 0; } static void insert_longname(struct archive *arch, struct ar_values *arv, char *shortname, struct ar_nametab *nt) { if(nt->names != NULL) { avsize_t nameoffs; nameoffs = getnum(shortname + 1, 15, 10); if(nameoffs < nt->size) insert_arentry(arch, arv, nt->names + nameoffs); else av_log(AVLOG_WARNING, "AR: Bad filename table"); } else av_log(AVLOG_WARNING, "AR: Missing filename table"); } static void insert_shortname(struct archive *arch, struct ar_values *arv, char *name) { int i; for(i = 0; i < 16; i++) if(name[i] == '/') { name[i] = '\0'; break; } /* If no slash was found, strip spaces from end */ if(i == 16) for(i = 15; i >= 0 && name[i] == ' '; i--) name[i] = '\0'; insert_arentry(arch, arv, name); } static int process_name(vfile *vf, struct archive *arch, struct ar_values *arv, char *name, struct ar_nametab *nt) { if((strncmp(name, "// ", 16) == 0 || strncmp(name, "ARFILENAMES/ ", 16) == 0)) return read_longnames(vf, arv, nt); if(name[0] == '#' && name[1] == '1' && name[2] == '/' && name[3] >= '0' && name[3] <= '9') return read_bsd_longname(vf, arch, arv, name); if((name[0] == '/' || name[0] == ' ') && name[1] >= '0' && name[1] <= '9') { insert_longname(arch, arv, name, nt); return 1; } if(name[0] == '/' || strncmp(name, "__.SYMDEF ", 16) == 0) return 1; insert_shortname(arch, arv, name); return 1; } static int read_entry(vfile *vf, struct archive *arch, struct ar_nametab *nt) { int res; avssize_t rres; struct ar_header hbuf; struct ar_values arv; avoff_t sres, noff; rres = av_read(vf, (char *) &hbuf, sizeof(hbuf)); if(rres <= 0) return rres; if(rres != sizeof(hbuf)) { av_log(AVLOG_WARNING, "AR: Broken archive"); return 0; } if(interpret_header(&hbuf, &arv) == -1) { av_log(AVLOG_WARNING, "AR: Broken archive"); return 0; } arv.offset = vf->ptr; res = process_name(vf, arch, &arv, hbuf.name, nt); if(res <= 0) return res; noff = arv.offset + arv.size; if((noff & 1) != 0) noff++; sres = av_lseek(vf, noff, AVSEEK_SET); if(sres < 0) return sres; return 1; } static int read_arfile(vfile *vf, struct archive *arch) { int res; char magic[ARMAGICLEN]; avssize_t rres; struct ar_nametab nt; rres = av_read(vf, magic, ARMAGICLEN); if(rres < 0) return rres; if(rres != ARMAGICLEN || strncmp(magic, ARMAGIC, ARMAGICLEN) != 0) return -EIO; nt.names = NULL; nt.size = 0; do res = read_entry(vf, arch, &nt); while(res == 1); av_free(nt.names); return res; } static int parse_arfile(void *data, ventry *ve, struct archive *arch) { int res; vfile *vf; res = av_open(ve->mnt->base, AVO_RDONLY, 0, &vf); if(res < 0) return res; res = read_arfile(vf, arch); av_close(vf); return res; } int av_init_module_uar(struct vmodule *module); int av_init_module_uar(struct vmodule *module) { int res; struct avfs *avfs; struct ext_info arexts[3]; struct archparams *ap; arexts[0].from = ".a", arexts[0].to = NULL; arexts[1].from = ".deb", arexts[1].to = NULL; arexts[2].from = NULL; res = av_archive_init("uar", arexts, AV_VER, module, &avfs); if(res < 0) return res; ap = (struct archparams *) avfs->data; ap->parse = parse_arfile; av_add_avfs(avfs); return 0; } avfs-1.1.4/modules/ugzip.c0000644000175000001440000000126114032341001012327 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. UGZIP module */ #include "filter.h" #include "version.h" extern int av_init_module_ugzip(struct vmodule *module); int av_init_module_ugzip(struct vmodule *module) { struct avfs *avfs; const char *ugz_args[3]; const char *gz_args[2]; ugz_args[0] = "gzip"; ugz_args[1] = "-d"; ugz_args[2] = NULL; gz_args[0] = "gzip"; gz_args[1] = NULL; return av_init_filt(module, AV_VER, "ugzip", ugz_args, gz_args, NULL, &avfs); } avfs-1.1.4/modules/gtar.h0000644000175000001440000002170114032341001012134 00000000000000/* Format of tar archives. Copyright (C) 1988, 92, 93, 94, 96, 97 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* GNU tar Archive Format description. */ /* If OLDGNU_COMPATIBILITY is not zero, tar produces archives which, by default, are readable by older versions of GNU tar. This can be overriden by using --posix; in this case, POSIXLY_CORRECT in environment may be set for enforcing stricter conformance. If OLDGNU_COMPATIBILITY is zero or undefined, tar will eventually produces archives which, by default, POSIX compatible; then either using --posix or defining POSIXLY_CORRECT enforces stricter conformance. This #define will disappear in a few years. FP, June 1995. */ #define OLDGNU_COMPATIBILITY 1 /*---------------------------------------------. | `tar' Header Block, from POSIX 1003.1-1990. | `---------------------------------------------*/ /* POSIX header. */ struct posix_header { /* byte offset */ char name[100]; /* 0 */ char mode[8]; /* 100 */ char uid[8]; /* 108 */ char gid[8]; /* 116 */ char size[12]; /* 124 */ char mtime[12]; /* 136 */ char chksum[8]; /* 148 */ char typeflag; /* 156 */ char linkname[100]; /* 157 */ char magic[6]; /* 257 */ char version[2]; /* 263 */ char uname[32]; /* 265 */ char gname[32]; /* 297 */ char devmajor[8]; /* 329 */ char devminor[8]; /* 337 */ char prefix[155]; /* 345 */ /* 500 */ }; #define TMAGIC "ustar" /* ustar and a null */ #define TMAGLEN 6 #define TVERSION "00" /* 00 and no null */ #define TVERSLEN 2 /* Values used in typeflag field. */ #define REGTYPE '0' /* regular file */ #define AREGTYPE '\0' /* regular file */ #define LNKTYPE '1' /* link */ #define SYMTYPE '2' /* reserved */ #define CHRTYPE '3' /* character special */ #define BLKTYPE '4' /* block special */ #define DIRTYPE '5' /* directory */ #define FIFOTYPE '6' /* FIFO special */ #define CONTTYPE '7' /* reserved */ #define XHDTYPE 'x' /* Extended header referring to the next file in the archive */ #define XGLTYPE 'g' /* Global extended header */ /* Bits used in the mode field, values in octal. */ #define TSUID 04000 /* set UID on execution */ #define TSGID 02000 /* set GID on execution */ #define TSVTX 01000 /* reserved */ /* file permissions */ #define TUREAD 00400 /* read by owner */ #define TUWRITE 00200 /* write by owner */ #define TUEXEC 00100 /* execute/search by owner */ #define TGREAD 00040 /* read by group */ #define TGWRITE 00020 /* write by group */ #define TGEXEC 00010 /* execute/search by group */ #define TOREAD 00004 /* read by other */ #define TOWRITE 00002 /* write by other */ #define TOEXEC 00001 /* execute/search by other */ /*-------------------------------------. | `tar' Header Block, GNU extensions. | `-------------------------------------*/ /* In GNU tar, SYMTYPE is for to symbolic links, and CONTTYPE is for contiguous files, so maybe disobeying the `reserved' comment in POSIX header description. I suspect these were meant to be used this way, and should not have really been `reserved' in the published standards. */ /* *BEWARE* *BEWARE* *BEWARE* that the following information is still boiling, and may change. Even if the OLDGNU format description should be accurate, the so-called GNU format is not yet fully decided. It is surely meant to use only extensions allowed by POSIX, but the sketch below repeats some ugliness from the OLDGNU format, which should rather go away. Sparse files should be saved in such a way that they do *not* require two passes at archive creation time. Huge files get some POSIX fields to overflow, alternate solutions have to be sought for this. */ /* Descriptor for a single file hole. */ struct sparse { /* byte offset */ char offset[12]; /* 0 */ char numbytes[12]; /* 12 */ /* 24 */ }; /* Sparse files are not supported in POSIX ustar format. For sparse files with a POSIX header, a GNU extra header is provided which holds overall sparse information and a few sparse descriptors. When an old GNU header replaces both the POSIX header and the GNU extra header, it holds some sparse descriptors too. Whether POSIX or not, if more sparse descriptors are still needed, they are put into as many successive sparse headers as necessary. The following constants tell how many sparse descriptors fit in each kind of header able to hold them. */ #define SPARSES_IN_EXTRA_HEADER 16 #define SPARSES_IN_OLDGNU_HEADER 4 #define SPARSES_IN_SPARSE_HEADER 21 /* The GNU extra header contains some information GNU tar needs, but not foreseen in POSIX header format. It is only used after a POSIX header (and never with old GNU headers), and immediately follows this POSIX header, when typeflag is a letter rather than a digit, so signaling a GNU extension. */ struct extra_header { /* byte offset */ char atime[12]; /* 0 */ char ctime[12]; /* 12 */ char offset[12]; /* 24 */ char realsize[12]; /* 36 */ char longnames[4]; /* 48 */ char unused_pad1[68]; /* 52 */ struct sparse sp[SPARSES_IN_EXTRA_HEADER]; /* 120 */ char isextended; /* 504 */ /* 505 */ }; /* Extension header for sparse files, used immediately after the GNU extra header, and used only if all sparse information cannot fit into that extra header. There might even be many such extension headers, one after the other, until all sparse information has been recorded. */ struct sparse_header { /* byte offset */ struct sparse sp[SPARSES_IN_SPARSE_HEADER]; /* 0 */ char isextended; /* 504 */ /* 505 */ }; /* The old GNU format header conflicts with POSIX format in such a way that POSIX archives may fool old GNU tar's, and POSIX tar's might well be fooled by old GNU tar archives. An old GNU format header uses the space used by the prefix field in a POSIX header, and cumulates information normally found in a GNU extra header. With an old GNU tar header, we never see any POSIX header nor GNU extra header. Supplementary sparse headers are allowed, however. */ struct oldgnu_header { /* byte offset */ char unused_pad1[345]; /* 0 */ char atime[12]; /* 345 */ char ctime[12]; /* 357 */ char offset[12]; /* 369 */ char longnames[4]; /* 381 */ char unused_pad2; /* 385 */ struct sparse sp[SPARSES_IN_OLDGNU_HEADER]; /* 386 */ char isextended; /* 482 */ char realsize[12]; /* 483 */ /* 495 */ }; /* OLDGNU_MAGIC uses both magic and version fields, which are contiguous. Found in an archive, it indicates an old GNU header format, which will be hopefully become obsolescent. With OLDGNU_MAGIC, uname and gname are valid, though the header is not truly POSIX conforming. */ #define OLDGNU_MAGIC "ustar " /* 7 chars and a null */ /* The standards committee allows only capital A through capital Z for user-defined expansion. */ /* This is a dir entry that contains the names of files that were in the dir at the time the dump was made. */ #define GNUTYPE_DUMPDIR 'D' /* Identifies the *next* file on the tape as having a long linkname. */ #define GNUTYPE_LONGLINK 'K' /* Identifies the *next* file on the tape as having a long name. */ #define GNUTYPE_LONGNAME 'L' /* This is the continuation of a file that began on another volume. */ #define GNUTYPE_MULTIVOL 'M' /* For storing filenames that do not fit into the main header. */ #define GNUTYPE_NAMES 'N' /* This is for sparse files. */ #define GNUTYPE_SPARSE 'S' /* This file is a tape/volume header. Ignore it on extraction. */ #define GNUTYPE_VOLHDR 'V' /*--------------------------------------. | tar Header Block, overall structure. | `--------------------------------------*/ /* tar files are made in basic blocks of this size. */ #define BLOCKSIZE 512 enum archive_format { DEFAULT_FORMAT, /* format to be decided later */ V7_FORMAT, /* old V7 tar format */ OLDGNU_FORMAT, /* GNU format as per before tar 1.12 */ POSIX_FORMAT, /* restricted, pure POSIX format */ GNU_FORMAT /* POSIX format with GNU extensions */ }; union block { char buffer[BLOCKSIZE]; struct posix_header header; struct extra_header extra_header; struct oldgnu_header oldgnu_header; struct sparse_header sparse_header; }; /* End of Format description. */ avfs-1.1.4/modules/ubz2.c0000644000175000001440000001271514032341001012061 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. UBZ2 module */ #include "version.h" #include "bzfile.h" #include "filecache.h" #include "oper.h" #include "version.h" struct bznode { struct avstat sig; struct bzcache *cache; avino_t ino; }; struct bzipfile { struct bzfile *zfil; vfile *base; struct bznode *node; }; static void bznode_destroy(struct bznode *nod) { av_unref_obj(nod->cache); } static struct bznode *bz_new_node(ventry *ve, struct avstat *stbuf) { struct bznode *nod; AV_NEW_OBJ(nod, bznode_destroy); nod->sig = *stbuf; nod->cache = av_bzcache_new(); nod->ino = av_new_ino(ve->mnt->avfs); return nod; } static int bz_same(struct bznode *nod, struct avstat *stbuf) { if(nod->sig.ino == stbuf->ino && nod->sig.dev == stbuf->dev && nod->sig.size == stbuf->size && AV_TIME_EQ(nod->sig.mtime, stbuf->mtime)) return 1; else return 0; } static struct bznode *bz_do_get_node(ventry *ve, const char *key, struct avstat *stbuf) { static AV_LOCK_DECL(lock); struct bznode *nod; AV_LOCK(lock); nod = (struct bznode *) av_filecache_get(key); if(nod != NULL) { if(!bz_same(nod, stbuf)) { av_unref_obj(nod); nod = NULL; } } if(nod == NULL) { nod = bz_new_node(ve, stbuf); av_filecache_set(key, nod); } AV_UNLOCK(lock); return nod; } static int bz_getnode(ventry *ve, vfile *base, struct bznode **resp) { int res; struct avstat stbuf; const int attrmask = AVA_INO | AVA_DEV | AVA_SIZE | AVA_MTIME; struct bznode *nod; char *key; res = av_fgetattr(base, &stbuf, attrmask); if(res < 0) return res; res = av_filecache_getkey(ve, &key); if(res < 0) return res; nod = bz_do_get_node(ve, key, &stbuf); av_free(key); *resp = nod; return 0; } static int bz_lookup(ventry *ve, const char *name, void **newp) { char *path = (char *) ve->data; if(path == NULL) { if(name[0] != '\0') return -ENOENT; if(ve->mnt->opts[0] != '\0') return -ENOENT; path = av_strdup(name); } else if(name == NULL) { av_free(path); path = NULL; } else return -ENOENT; *newp = path; return 0; } static int bz_access(ventry *ve, int amode) { return av_access(ve->mnt->base, amode); } static int bz_open(ventry *ve, int flags, avmode_t mode, void **resp) { int res; vfile *base; struct bznode *nod; struct bzipfile *fil; if(flags & AVO_DIRECTORY) return -ENOTDIR; if(AV_ISWRITE(flags)) return -EROFS; res = av_open(ve->mnt->base, AVO_RDONLY, 0, &base); if(res < 0) return res; res = bz_getnode(ve, base, &nod); if(res < 0) { av_close(base); return res; } AV_NEW(fil); if((flags & AVO_ACCMODE) != AVO_NOPERM) fil->zfil = av_bzfile_new(base); else fil->zfil = NULL; fil->base = base; fil->node = nod; *resp = fil; return 0; } static int bz_close(vfile *vf) { struct bzipfile *fil = (struct bzipfile *) vf->data; av_unref_obj(fil->zfil); av_unref_obj(fil->node); av_close(fil->base); av_free(fil); return 0; } static avssize_t bz_read(vfile *vf, char *buf, avsize_t nbyte) { avssize_t res; struct bzipfile *fil = (struct bzipfile *) vf->data; res = av_bzfile_pread(fil->zfil, fil->node->cache, buf, nbyte, vf->ptr); if(res > 0) vf->ptr += res; return res; } static int bz_getattr(vfile *vf, struct avstat *buf, int attrmask) { int res; struct bzipfile *fil = (struct bzipfile *) vf->data; struct bznode *nod = fil->node; avoff_t size; const int basemask = AVA_MODE | AVA_UID | AVA_GID | AVA_MTIME | AVA_ATIME | AVA_CTIME; res = av_fgetattr(fil->base, buf, basemask); if(res < 0) return res; if((attrmask & (AVA_SIZE | AVA_BLKCNT)) != 0) { res = av_bzfile_size(fil->zfil, fil->node->cache, &size); if(res == 0 && size == -1) { fil->zfil = av_bzfile_new(fil->base); res = av_bzfile_size(fil->zfil, fil->node->cache, &size); } if(res < 0) return res; buf->size = size; buf->blocks = AV_BLOCKS(buf->size); } buf->mode &= ~(07000); buf->blksize = 4096; buf->dev = vf->mnt->avfs->dev; buf->ino = nod->ino; buf->nlink = 1; return 0; } extern int av_init_module_ubz2(struct vmodule *module); int av_init_module_ubz2(struct vmodule *module) { int res; struct avfs *avfs; struct ext_info ubz_exts[6]; ubz_exts[0].from = ".tar.bz2", ubz_exts[0].to = ".tar"; ubz_exts[1].from = ".bz2", ubz_exts[1].to = NULL; ubz_exts[2].from = ".bz", ubz_exts[2].to = NULL; ubz_exts[3].from = ".tbz2", ubz_exts[3].to = ".tar"; ubz_exts[4].from = ".tbz", ubz_exts[4].to = ".tar"; ubz_exts[5].from = NULL; res = av_new_avfs("ubz2", ubz_exts, AV_VER, AVF_NOLOCK, module, &avfs); if(res < 0) return res; avfs->lookup = bz_lookup; avfs->access = bz_access; avfs->open = bz_open; avfs->close = bz_close; avfs->read = bz_read; avfs->getattr = bz_getattr; av_add_avfs(avfs); return 0; } avfs-1.1.4/modules/dav.c0000644000175000001440000004515214032341001011752 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi Copyright (C) 2019 Ralf Hoffmann This file can be distributed either under the GNU LGPL, or under the GNU GPL. See the file COPYING.LIB and COPYING. DAV module (see http://www.webdav.org/) using Neon DAV client library, by Justin Mason . */ /* TODO -- http_request_auth implementation */ /* TODO -- PUT */ /* TODO -- make GET more efficient by not getting entire file * before returning from dav_get() */ #include "dav.h" #include "avfs.h" #include "version.h" #include "remote.h" #include "prog.h" #include "filebuf.h" #include "passwords.h" #include #include #include #include #include #include #include /* --------------------------------------------------------------------- */ static char AV_UserAgent[128]; struct davlocalfile { int running; char *tmpfile; char *url; avoff_t currsize; int fd; }; /* --------------------------------------------------------------------- */ /* char * davlocalfile_to_string (struct davlocalfile *lf) { static char buf[1024]; snprintf (buf, 1023, "[davlocalfile: tmpf=%s url=%s running=%d currsz=%d]", lf->tmpfile, lf->url, lf->running, (int) lf->currsize); return buf; } */ /* ---------------------------------------------------------------------- */ static char *dav_hostpath_to_url (char *urlbuf, int buflen, const struct remhostpath *hp) { const char *rawp, *pathp; int len; *urlbuf = '\0'; av_log(AVLOG_DEBUG, "DAV: hostpath-to-URL: host=%s path='%s'", hp->host, hp->path); /* now rewrite the host bit into the urlbuf, adding: * - the protocol bit if http: is specified, as http:// * - /s instead of :s * - a trailing slash */ len = 0; rawp = hp->host; if (!strncmp (rawp, "http:", 5)) { len += snprintf (urlbuf+len, buflen-len, "http://"); rawp += 5; while (*rawp == '/') { rawp++; } } else if (strncmp(rawp, "https:", 6) == 0) { len += snprintf (urlbuf+len, buflen-len, "https://"); rawp += 6; while (*rawp == '/') { rawp++; } } else { len += snprintf (urlbuf+len, buflen-len, "http://"); } for ( ; *rawp != '\0'; rawp++) { /* TODO: allow colons, or just pipes? */ if (/* *rawp == ':' || */ *rawp == '|') { urlbuf[len] = '/'; } else { urlbuf[len] = *rawp; } len++; } if (len > 0 && urlbuf[len-1] == '/') { len--; urlbuf[len] = '\0'; } /* add the path, if it's non-empty */ for (pathp = hp->path; *pathp == '/'; pathp++); if (*pathp != '\0') { len += snprintf (urlbuf+len, buflen-len, "/%s", pathp); } /** * Finally, we've rewritten it. */ av_log(AVLOG_DEBUG, "DAV: rewritten URL = '%s'", urlbuf); return urlbuf; } /* ---------------------------------------------------------------------- */ static void dav_free_localfile(struct davlocalfile *lf) { av_free(lf->url); } /* ---------------------------------------------------------------------- */ static int dav_supply_creds(int is_for_proxy, void *userdata, const char *realm, int attempt, char *username, char *password) { struct pass_session *pass; struct av_dav_conn *conn = (struct av_dav_conn*)userdata; struct davdata *davdat = conn->data; pass = pass_get_password (&(davdat->sessions), realm, conn->uri.host); if (pass == NULL) { return -1; } strncpy(username, pass->username, NE_ABUFSIZ - 1); strncpy(password, pass->password, NE_ABUFSIZ - 1); username[NE_ABUFSIZ - 1] = '\0'; password[NE_ABUFSIZ - 1] = '\0'; return attempt; } static int dav_supply_creds_server(void *userdata, const char *realm, int attempt, char *username, char *password) { return dav_supply_creds(0, userdata, realm, attempt, username, password); } static int dav_supply_creds_proxy(void *userdata, const char *realm, int attempt, char *username, char *password) { return dav_supply_creds(1, userdata, realm, attempt, username, password); } /* ---------------------------------------------------------------------- */ static int av_dav_conn_init (struct av_dav_conn *conn, struct davdata *davdat, ne_uri *uri) { conn->sesh = ne_session_create(uri->scheme, uri->host, uri->port); /* TODO: provide proxy support from http_proxy env var */ /* TODO: first make sure neon doesn't automatically do this ;) */ /* http_session_proxy(sess, "proxy.myisp.com", 8080); */ /* TODO something is missing to make expect100 work, but it works without too */ /* ne_set_session_flag(conn->sesh, NE_SESSFLAG_EXPECT100, 1); */ ne_set_useragent (conn->sesh, AV_UserAgent); ne_set_server_auth (conn->sesh, dav_supply_creds_server, conn); ne_set_proxy_auth (conn->sesh, dav_supply_creds_proxy, conn); return 0; } static struct av_dav_conn * new_dav_conn (struct davdata *davdat) { int i; struct av_dav_conn *conn; for (i = 0; i < AV_MAX_DAV_CONNS; i++) { conn = &(davdat->allconns[i]); /* skip the busy ones */ if (conn->isbusy) { continue; } conn->isbusy = 1; conn->data = davdat; conn->sesh = NULL; return conn; } av_log(AVLOG_ERROR, "DAV: out of connections"); return NULL; } /* ---------------------------------------------------------------------- */ static int http_error_to_errno (const char *method, int httpret, const char *errstr) { int errval = -EIO; av_log(AVLOG_ERROR, "DAV: %s failed: (neon err=%d) \"%s\"", method, httpret, errstr); switch (httpret) { case NE_ERROR: /* Generic error; use http_get_error(session) */ /* TODO -- fill out more HTTP errors here */ if (!strncmp (errstr, "404", 3)) { errval = -ENOENT; } else if (!strncmp (errstr, "403", 3)) { errval = -EACCES; } else if (!strncmp (errstr, "405", 3)) { errval = -EACCES; } break; case NE_LOOKUP: /* Name lookup failed */ errval = -ECONNREFUSED; break; case NE_AUTH: /* User authentication failed on server */ errval = -EACCES; break; case NE_PROXYAUTH: /* Proxy authentication failed */ errval = -EACCES; break; case NE_CONNECT: /* Could not connect to server */ errval = -ECONNREFUSED; break; case NE_TIMEOUT: /* Connection timed out */ errval = -ETIMEDOUT; break; case NE_FAILED: /* The precondition failed */ errval = -ENXIO; break; default: av_log (AVLOG_ERROR, "Unknown HTTP error code for %s: %d %s", method, httpret, errstr); errval = -ENXIO; break; } av_log (AVLOG_DEBUG, "returning errno %d", errval); return errval; } /* ---------------------------------------------------------------------- */ static int av_get_cb (void *userdata, const char *buf, size_t len) { struct davlocalfile *lf = (struct davlocalfile *) userdata; int res; av_log(AVLOG_DEBUG, "DAV: GET cb: writing %lu", len); res = write (lf->fd, buf, len); if (res < 0) { av_log (AVLOG_ERROR, "DAV: write failed: %s", strerror(errno)); } if (res != len) { av_log (AVLOG_ERROR, "DAV: short write to tmpfile (%i/%lu)", res, len); } lf->currsize += len; return 0; } static int av_http_read_file(ne_session *sess, const char *uri, ne_block_reader reader, void *userdata) { ne_request *req = ne_request_create(sess, "GET", uri); int ret; ne_add_response_body_reader(req, ne_accept_2xx, reader, userdata); ret = ne_request_dispatch(req); if (ret == NE_OK && ne_get_status(req)->klass != 2) { ret = NE_ERROR; } ne_request_destroy(req); return ret; } static int dav_http_get (struct davdata *davdat, struct davlocalfile *lf) { const char *err; int res; struct av_dav_conn *conn = NULL; conn = new_dav_conn (davdat); if (conn == NULL) { return -1; } lf->fd = -1; if (ne_uri_parse (lf->url, &(conn->uri)) != 0 || conn->uri.path == NULL || conn->uri.host == NULL) { av_log(AVLOG_ERROR, "DAV: Invalid URI '%s'", lf->url); res = -1; goto error; } lf->fd = open (lf->tmpfile, O_WRONLY|O_CREAT|O_TRUNC|O_APPEND, 0700); if (lf->fd < 0) { av_log(AVLOG_ERROR, "DAV: failed to write to '%s': %s", lf->tmpfile, strerror (errno)); res = -1; goto error; } av_dav_conn_init(conn, davdat, &conn->uri); av_log(AVLOG_DEBUG, "DAV: created new HTTP session"); /* unfortunately the Neon API doesn't allow partial reads. * Perhaps redo this using the http.c code to avoid having * to download the entire file first */ av_log(AVLOG_DEBUG, "DAV: GETting '%s'", lf->url); res = av_http_read_file(conn->sesh, lf->url, av_get_cb, lf); close (lf->fd); lf->fd = -1; if (res != NE_OK) { err = ne_get_error(conn->sesh); res = http_error_to_errno ("GET", res, err); goto error; } if (conn->sesh) { ne_session_destroy(conn->sesh); conn->sesh = NULL; } ne_uri_free(&conn->uri); conn->isbusy = 0; return 0; error: if (conn->sesh) { ne_session_destroy(conn->sesh); conn->sesh = NULL; } ne_uri_free(&conn->uri); conn->isbusy = 0; if (lf->fd > 0) { close (lf->fd); lf->fd = -1; } return res; } /* ---------------------------------------------------------------------- */ /* * TODO: rewrite using new "remote" API once it stabilises for writes */ #if 0 static int dav_http_put (struct file *fil, struct davlocalfile *lf) { const char *err; struct av_dav_conn *conn; FILE *fin = NULL; int res; conn = new_dav_conn (davdat); if (conn == NULL) { return -1; } if (uri_parse (lf->url, &(conn->uri), &av_dav_uri_defaults) != 0 || conn->uri.path == NULL || conn->uri.host == NULL) { av_log(AVLOG_ERROR, "DAV: Invalid URI '%s'", lf->url); res = -1; goto error; } http_session_server (conn->sesh, conn->uri.host, conn->uri.port); res = lseek (lf->fd, 0, SEEK_SET); if (res < 0) { res = -errno; goto error; } fin = fdopen (lf->fd, "r"); /* unfortunately the Neon API doesn't allow partial writes. * Perhaps redo this using the http.c code */ res = http_put (conn->sesh, lf->url, fin); if (res != HTTP_OK) { err = http_get_error(conn->sesh); res = http_error_to_errno ("PUT", res, err); goto error; } conn->isbusy = 0; if (fin != NULL) { fclose (fin); } close (lf->fd); return 0; error: conn->isbusy = 0; if (fin != NULL) { fclose (fin); } close (lf->fd); return res; } #endif /* ---------------------------------------------------------------------- */ static int dav_res_stat_to_avstat (struct av_dav_resource *res, struct avstat *stbuf) { stbuf->mtime.sec = res->modtime; stbuf->mtime.nsec = 0; stbuf->atime = stbuf->mtime; stbuf->ctime = stbuf->mtime; stbuf->dev = 1; stbuf->ino = 1; stbuf->nlink = 1; stbuf->uid = 0; stbuf->gid = 0; stbuf->blksize = 1024; switch (res->type) { case resr_normal: stbuf->size = res->size; stbuf->blocks = AV_DIV(stbuf->size, 1024); if (res->is_executable) { stbuf->mode = AV_IFREG | 0777; } else { stbuf->mode = AV_IFREG | 0666; } break; case resr_reference: av_log(AVLOG_WARNING, "DAV: reference: TODO %d", res->type); /* symbolic link, doesn't seem to be supported by mod_dav * anyway */ return -1; case resr_collection: stbuf->size = res->size; stbuf->blocks = AV_DIV(stbuf->size, 1024); stbuf->mode = AV_IFDIR | 0777; break; default: av_log(AVLOG_WARNING, "DAV: unknown resource type %d", res->type); return -1; } return 0; } /* ---------------------------------------------------------------------- */ static int populate_av_tree_from_reslist (struct remdirlist *dl, struct av_dav_conn *conn, struct av_dav_resource *reslist) { struct av_dav_resource *current, *next; char *shortname, *endchar; int pathlen; pathlen = strlen (conn->uri.path); for (current = reslist; current!=NULL; current = next) { next = current->next; /* skip path at start of name, if possible. Also trim * out any slashes we won't need. */ if (!strncmp (current->uri, conn->uri.path, pathlen)) { shortname = current->uri + pathlen; while (*shortname == '/') { shortname++; } if (shortname[0] == '\0' || !strcmp (shortname, "/")) { shortname = "."; } } else { shortname = current->uri; } endchar = shortname + (strlen(shortname)-1); if (*endchar == '/') { *endchar = '\0'; } { struct avstat stbuf; char *linkname = NULL; char *remname; remname = dl->hostpath.path; if (dav_res_stat_to_avstat (current, &stbuf) < 0) { av_log (AVLOG_WARNING, "DAV: parsing direntry: to_avstat failed"); goto skip; } av_log (AVLOG_DEBUG, "DAV: adding direntry \"%s\" mode=0%o", remname, stbuf.mode); av_remote_add (dl, shortname, linkname, &stbuf); } skip: free_resource (current); } return 0; } /* ---------------------------------------------------------------------- */ static int dav_list(struct remote *rem, struct remdirlist *dl) { char urlbuf[512]; int res; struct davdata *davdat = (struct davdata *) rem->data; char *url; struct av_dav_conn *conn; struct av_dav_resource *reslist = NULL; const char *err; // to make valgrind happy memset(urlbuf, 0, sizeof(urlbuf)); url = dav_hostpath_to_url (urlbuf, 511, &(dl->hostpath)); av_log (AVLOG_DEBUG, "DAV: dav_list called on '%s' flags=%x", url, dl->flags); conn = new_dav_conn (davdat); if (conn == NULL) { return -1; } if (ne_uri_parse (url, &(conn->uri)) != 0 || conn->uri.path == NULL || conn->uri.host == NULL) { av_log(AVLOG_ERROR, "DAV: Invalid URI '%s'", url); res = -1; goto error; } av_dav_conn_init(conn, davdat, &conn->uri); av_log(AVLOG_DEBUG, "DAV: created new HTTP session"); res = fetch_resource_list (conn, conn->uri.path, 1, 1, &reslist); if (res != NE_OK) { err = ne_get_error(conn->sesh); res = http_error_to_errno ("PROPFIND", res, err); goto error; } if (reslist == NULL) { av_log (AVLOG_WARNING, "DAV: no reslist"); res = -1; goto error; } if (populate_av_tree_from_reslist (dl, conn, reslist) < 0) { res = -1; goto error; } if (conn->sesh) { ne_session_destroy(conn->sesh); conn->sesh = NULL; } ne_uri_free(&conn->uri); conn->isbusy = 0; return 0; error: if (conn->sesh) { ne_session_destroy(conn->sesh); conn->sesh = NULL; } ne_uri_free(&conn->uri); conn->isbusy = 0; return res; } /* ---------------------------------------------------------------------- */ static int dav_get(struct remote *rem, struct remgetparam *gp) { int res; char urlbuf[512]; struct davdata *davdat = (struct davdata *) rem->data; struct davlocalfile *lf; char *tmpfile; res = av_get_tmpfile(&tmpfile); if(res < 0) { return res; } AV_NEW_OBJ(lf, dav_free_localfile); // to make valgrind happy memset(urlbuf, 0, sizeof(urlbuf)); lf->url = av_strdup (dav_hostpath_to_url (urlbuf, 511, &(gp->hostpath))); lf->tmpfile = tmpfile; lf->currsize = 0; lf->fd = -1; res = dav_http_get (davdat, lf); if (res < 0) { av_del_tmpfile(lf->tmpfile); av_unref_obj(lf); return res; } gp->data = lf; gp->localname = lf->tmpfile; return 0; } /* ---------------------------------------------------------------------- */ static int dav_wait(struct remote *rem, void *data, avoff_t end) { return 1; } /* ---------------------------------------------------------------------- */ static int dav_init_ctl(struct vmodule *module, struct davdata *davdat) { int res; struct namespace *ns; struct statefile *stf; struct entry *ent; struct avfs *avfs; res = av_state_new(module, "dav_ctl", &ns, &avfs); if(res < 0) return res; ent = av_namespace_lookup(ns, NULL, "username"); AV_NEW(stf); stf->data = &(davdat->sessions); stf->get = pass_username_get; stf->set = pass_username_set; av_namespace_set(ent, stf); ent = av_namespace_lookup(ns, NULL, "password"); AV_NEW(stf); stf->data = &(davdat->sessions); stf->get = pass_password_get; stf->set = pass_password_set; av_namespace_set(ent, stf); ent = av_namespace_lookup(ns, NULL, "loggedin"); AV_NEW(stf); stf->data = &(davdat->sessions); stf->get = pass_loggedin_get; stf->set = pass_loggedin_set; av_namespace_set(ent, stf); av_unref_obj(ns); return 0; } /* ---------------------------------------------------------------------- */ static void dav_destroy(struct remote *rem) { struct davdata *davdat = (struct davdata *) rem->data; av_free (davdat); av_free (rem->name); av_free (rem); } /* ---------------------------------------------------------------------- */ int av_init_module_dav(struct vmodule *module) { int res; struct remote *rem; struct avfs *avfs; struct davdata *davdat; av_log(AVLOG_DEBUG, "DAV: initializing"); ne_sock_init(); AV_NEW(davdat); memset (&(davdat->allconns), 0, sizeof(davdat->allconns)); snprintf (AV_UserAgent, 127, "AVFSCoda/%d", AV_VER); AV_NEW(rem); rem->data = davdat; rem->flags = REM_DIR_ONLY; rem->name = av_strdup("dav"); rem->list = dav_list; rem->get = dav_get; rem->wait = dav_wait; rem->destroy = dav_destroy; res = av_remote_init(module, rem, &avfs); if (res == 0) { res = dav_init_ctl (module, davdat); if (res < 0) { av_unref_obj(avfs); } } return 0; } // vim:sw=4: avfs-1.1.4/modules/Makefile.in0000644000175000001440000006007714032341013013107 00000000000000# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @USE_LIBLZMA_TRUE@am__append_1 = uxz.c @USE_LIBZSTD_TRUE@am__append_2 = uzstd.c @USE_LIBLZIP_TRUE@am__append_3 = ulzip.c @BUILD_DAVSUPPORT_TRUE@am__append_4 = dav.c @BUILD_DAVSUPPORT_TRUE@am__append_5 = dav_ls.c subdir = modules ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libmodules_la_LIBADD = am__libmodules_la_SOURCES_DIST = volatile.c rsh.c http.c ftp.c ugz.c \ ubz2.c ugzip.c ubzip2.c gz.c bz2.c uz.c uar.c utar.c urar.c \ uzip.c floppy.c extfs.c ucftp.c uxze.c uzstde.c uxz.c uzstd.c \ ulzip.c dav.c dav_ls.c @USE_LIBLZMA_TRUE@am__objects_1 = uxz.lo @USE_LIBZSTD_TRUE@am__objects_2 = uzstd.lo @USE_LIBLZIP_TRUE@am__objects_3 = ulzip.lo @BUILD_DAVSUPPORT_TRUE@am__objects_4 = dav.lo am__objects_5 = volatile.lo rsh.lo http.lo ftp.lo ugz.lo ubz2.lo \ ugzip.lo ubzip2.lo gz.lo bz2.lo uz.lo uar.lo utar.lo urar.lo \ uzip.lo floppy.lo extfs.lo ucftp.lo uxze.lo uzstde.lo \ $(am__objects_1) $(am__objects_2) $(am__objects_3) \ $(am__objects_4) @BUILD_DAVSUPPORT_TRUE@am__objects_6 = dav_ls.lo am_libmodules_la_OBJECTS = $(am__objects_5) $(am__objects_6) nodist_libmodules_la_OBJECTS = mod_static.lo libmodules_la_OBJECTS = $(am_libmodules_la_OBJECTS) \ $(nodist_libmodules_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libmodules_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libmodules_la_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/bz2.Plo ./$(DEPDIR)/dav.Plo \ ./$(DEPDIR)/dav_ls.Plo ./$(DEPDIR)/extfs.Plo \ ./$(DEPDIR)/floppy.Plo ./$(DEPDIR)/ftp.Plo ./$(DEPDIR)/gz.Plo \ ./$(DEPDIR)/http.Plo ./$(DEPDIR)/mod_static.Plo \ ./$(DEPDIR)/rsh.Plo ./$(DEPDIR)/uar.Plo ./$(DEPDIR)/ubz2.Plo \ ./$(DEPDIR)/ubzip2.Plo ./$(DEPDIR)/ucftp.Plo \ ./$(DEPDIR)/ugz.Plo ./$(DEPDIR)/ugzip.Plo \ ./$(DEPDIR)/ulzip.Plo ./$(DEPDIR)/urar.Plo \ ./$(DEPDIR)/utar.Plo ./$(DEPDIR)/uxz.Plo ./$(DEPDIR)/uxze.Plo \ ./$(DEPDIR)/uz.Plo ./$(DEPDIR)/uzip.Plo ./$(DEPDIR)/uzstd.Plo \ ./$(DEPDIR)/uzstde.Plo ./$(DEPDIR)/volatile.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libmodules_la_SOURCES) $(nodist_libmodules_la_SOURCES) DIST_SOURCES = $(am__libmodules_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BZLIB_INCLUDE = @BZLIB_INCLUDE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAV = @DAV@ DAV_LS = @DAV_LS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FUSELIBS = @FUSELIBS@ GREP = @GREP@ HAVE_ZIPINFO = @HAVE_ZIPINFO@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ LIBZSTD_LIBS = @LIBZSTD_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NUMVERSION = @NUMVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ ZIP = @ZIP@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_INCLUDE = @ZLIB_INCLUDE@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = -I$(top_srcdir)/include @CFLAGS@ @CPPFLAGS@ noinst_LTLIBRARIES = libmodules.la EXTRA_DIST = make_initmod libmodules_la_LDFLAGS = -module modules = volatile.c rsh.c http.c ftp.c ugz.c ubz2.c ugzip.c ubzip2.c \ gz.c bz2.c uz.c uar.c utar.c urar.c uzip.c floppy.c extfs.c \ ucftp.c uxze.c uzstde.c $(am__append_1) $(am__append_2) \ $(am__append_3) $(am__append_4) libmodules_la_SOURCES = $(modules) $(am__append_5) nodist_libmodules_la_SOURCES = \ mod_static.c noinst_HEADERS = \ dav.h \ gtar.h \ zipconst.h CLEANFILES = mod_static.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu modules/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu modules/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libmodules.la: $(libmodules_la_OBJECTS) $(libmodules_la_DEPENDENCIES) $(EXTRA_libmodules_la_DEPENDENCIES) $(AM_V_CCLD)$(libmodules_la_LINK) $(libmodules_la_OBJECTS) $(libmodules_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bz2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dav.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dav_ls.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extfs.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/floppy.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gz.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_static.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rsh.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uar.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ubz2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ubzip2.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ucftp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ugz.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ugzip.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ulzip.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urar.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utar.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uxz.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uxze.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uz.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uzip.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uzstd.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uzstde.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/volatile.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/bz2.Plo -rm -f ./$(DEPDIR)/dav.Plo -rm -f ./$(DEPDIR)/dav_ls.Plo -rm -f ./$(DEPDIR)/extfs.Plo -rm -f ./$(DEPDIR)/floppy.Plo -rm -f ./$(DEPDIR)/ftp.Plo -rm -f ./$(DEPDIR)/gz.Plo -rm -f ./$(DEPDIR)/http.Plo -rm -f ./$(DEPDIR)/mod_static.Plo -rm -f ./$(DEPDIR)/rsh.Plo -rm -f ./$(DEPDIR)/uar.Plo -rm -f ./$(DEPDIR)/ubz2.Plo -rm -f ./$(DEPDIR)/ubzip2.Plo -rm -f ./$(DEPDIR)/ucftp.Plo -rm -f ./$(DEPDIR)/ugz.Plo -rm -f ./$(DEPDIR)/ugzip.Plo -rm -f ./$(DEPDIR)/ulzip.Plo -rm -f ./$(DEPDIR)/urar.Plo -rm -f ./$(DEPDIR)/utar.Plo -rm -f ./$(DEPDIR)/uxz.Plo -rm -f ./$(DEPDIR)/uxze.Plo -rm -f ./$(DEPDIR)/uz.Plo -rm -f ./$(DEPDIR)/uzip.Plo -rm -f ./$(DEPDIR)/uzstd.Plo -rm -f ./$(DEPDIR)/uzstde.Plo -rm -f ./$(DEPDIR)/volatile.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/bz2.Plo -rm -f ./$(DEPDIR)/dav.Plo -rm -f ./$(DEPDIR)/dav_ls.Plo -rm -f ./$(DEPDIR)/extfs.Plo -rm -f ./$(DEPDIR)/floppy.Plo -rm -f ./$(DEPDIR)/ftp.Plo -rm -f ./$(DEPDIR)/gz.Plo -rm -f ./$(DEPDIR)/http.Plo -rm -f ./$(DEPDIR)/mod_static.Plo -rm -f ./$(DEPDIR)/rsh.Plo -rm -f ./$(DEPDIR)/uar.Plo -rm -f ./$(DEPDIR)/ubz2.Plo -rm -f ./$(DEPDIR)/ubzip2.Plo -rm -f ./$(DEPDIR)/ucftp.Plo -rm -f ./$(DEPDIR)/ugz.Plo -rm -f ./$(DEPDIR)/ugzip.Plo -rm -f ./$(DEPDIR)/ulzip.Plo -rm -f ./$(DEPDIR)/urar.Plo -rm -f ./$(DEPDIR)/utar.Plo -rm -f ./$(DEPDIR)/uxz.Plo -rm -f ./$(DEPDIR)/uxze.Plo -rm -f ./$(DEPDIR)/uz.Plo -rm -f ./$(DEPDIR)/uzip.Plo -rm -f ./$(DEPDIR)/uzstd.Plo -rm -f ./$(DEPDIR)/uzstde.Plo -rm -f ./$(DEPDIR)/volatile.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile mod_static.c: make_initmod $(srcdir)/make_initmod $(modules) > mod_static.c # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: avfs-1.1.4/modules/dav.h0000644000175000001440000000352414032341001011754 00000000000000#ifndef INCLUDED_DAV_H #define INCLUDED_DAV_H 1 #include "passwords.h" #include #include #include #include #include /* --------------------------------------------------------------------- */ #define DAV_PARAM_SEP ':' #define AV_MAX_DAV_CONNS 128 /* --------------------------------------------------------------------- */ /** * The DAV connection structure. */ struct av_dav_conn { ne_session *sesh; char *user; char *password; ne_uri uri; int isbusy; struct davdata *data; // backlink to global data, needed for // password management }; struct av_dav_fdidat { ne_uri *base_uri; char *tmpname; char *remote; int rdonly; int cursize; int error; }; struct davdata { struct av_dav_conn allconns[AV_MAX_DAV_CONNS]; struct pass_session sessions; }; /** * DAV properties: "resources", ie. files or directories in DAVspeak. */ enum av_dav_resource_type { resr_normal = 0, resr_collection, resr_reference, resr_error }; struct av_dav_resource { char *uri; enum av_dav_resource_type type; size_t size; time_t modtime; int is_executable; char *error_reason; /* error string returned for this resource */ int error_status; /* error status returned for this resource */ struct av_dav_resource *next; }; extern void free_resource( struct av_dav_resource *res ); extern void free_resource_list( struct av_dav_resource *res ); /* --------------------------------------------------------------------- */ extern int fetch_resource_list(struct av_dav_conn *conn, const char *uri, int depth, int include_target, struct av_dav_resource **reslist); /* --------------------------------------------------------------------- */ #endif avfs-1.1.4/modules/volatile.c0000644000175000001440000004326514032341001013022 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" #include "version.h" /* a generic information node */ /* analogous to the "on-disk inode" in a disk filesystem */ struct volnode { struct avstat st; struct volentry *subdir; /* only dir */ struct volentry *parent; /* only dir */ char *content; /* only regular & symlink */ }; /* our ventry.data handle */ /* represents a named reference to a volnode */ struct volentry { char *name; struct volnode *node; struct volentry *next; struct volentry **prevp; struct volentry *parent; }; /* our vmount.data handle */ struct volfs { struct volentry *root; struct avfs *avfs; }; /* av_obj.destr for volentry */ static void vol_unlink_entry(struct volentry *ent) { if(ent->prevp != NULL) *ent->prevp = ent->next; if(ent->next != NULL) ent->next->prevp = ent->prevp; av_unref_obj(ent->parent); av_free(ent->name); ent->prevp = NULL; ent->next = NULL; ent->parent = NULL; ent->name = NULL; } /* constructor for volentry */ static struct volentry *vol_new_entry(const char *name) { struct volentry *ent; AV_NEW_OBJ(ent, vol_unlink_entry); ent->node = NULL; ent->next = NULL; ent->prevp = NULL; ent->parent = NULL; ent->name = av_strdup(name); return ent; } /* av_obj.destr for volnode */ static void vol_free_node(struct volnode *nod) { av_free(nod->content); } /* constructor for volnode */ static struct volnode *vol_new_node(struct avstat *initstat) { struct volnode *nod; AV_NEW_OBJ(nod, vol_free_node); nod->st = *initstat; nod->subdir = NULL; nod->parent = NULL; nod->content = NULL; return nod; } /* link ent to nod */ static void vol_link_node(struct volentry *ent, struct volnode *nod) { av_ref_obj(ent); av_ref_obj(nod); ent->node = nod; if(AV_ISDIR(nod->st.mode)) { nod->st.nlink = 2; if(ent->parent != NULL) { nod->parent = ent->parent; ent->parent->node->st.nlink ++; } else nod->parent = ent; } else nod->st.nlink ++; if(ent->parent != NULL) ent->parent->node->st.size ++; } static void vol_unlink_node(struct volentry *ent) { struct volnode *nod = ent->node; if(AV_ISDIR(nod->st.mode)) { nod->st.nlink = 0; if(nod->parent != NULL) nod->parent->node->st.nlink --; } else nod->st.nlink --; if(ent->parent != NULL) ent->parent->node->st.size --; ent->node = NULL; av_unref_obj(nod); av_unref_obj(ent); } /* called by vol_destroy */ static void vol_free_tree(struct volentry *ent) { struct volnode *nod = ent->node; if(nod != NULL) { while(nod->subdir != NULL) vol_free_tree(nod->subdir); vol_unlink_entry(ent); vol_unlink_node(ent); } } static int vol_make_node(struct volfs *fs, struct volentry *ent, avmode_t mode) { struct volnode *nod; struct avstat initstat; if(ent->name == NULL) return -ENOENT; av_default_stat(&initstat); initstat.dev = fs->avfs->dev; initstat.ino = av_new_ino(fs->avfs); nod = vol_new_node(&initstat); nod->st.mode = mode; vol_link_node(ent, nod); av_unref_obj(nod); return 0; } static struct volentry *vol_ventry_volentry(ventry *ve) { return (struct volentry *) ve->data; } static struct volnode *vol_vfile_volnode(vfile *vf) { return (struct volnode *) vf->data; } static struct volfs *vol_ventry_volfs(ventry *ve) { return (struct volfs *) ve->mnt->avfs->data; } /****************************************************************/ /* start of avfs ops */ /* called by vol_do_lookup */ static struct volentry *vol_get_entry(struct volentry *parent, const char *name) { struct volentry **entp; struct volentry *ent; if(strcmp(name, ".") == 0) { ent = parent; av_ref_obj(ent); return ent; } if(strcmp(name, "..") == 0) { ent = parent->parent; av_ref_obj(ent); return ent; } for(entp = &parent->node->subdir; *entp != NULL; entp = &(*entp)->next) if(strcmp(name, (*entp)->name) == 0) { ent = *entp; av_ref_obj(ent); return ent; } /* lookup failed, so create a new entry and add it to the directory list temporarily */ ent = vol_new_entry(name); *entp = ent; ent->prevp = entp; ent->parent = parent; av_ref_obj(parent); return ent; } /* called by vol_lookup */ static int vol_do_lookup(struct volentry *parent, const char *name, struct volentry **entp) { if(parent->node == NULL) return -ENOENT; if(name == NULL) { *entp = parent->parent; av_ref_obj(*entp); return 0; } if(!AV_ISDIR(parent->node->st.mode)) return -ENOTDIR; *entp = vol_get_entry(parent, name); return 0; } /* called by vol_lookup */ static struct volentry *vol_get_root(ventry *ve) { struct volfs *fs = vol_ventry_volfs(ve); struct volentry *root = fs->root; av_ref_obj(root); return root; } static int vol_lookup(ventry *ve, const char *name, void **newp) { int res = 0; struct volentry *parent = vol_ventry_volentry(ve); struct volentry *ent; if(parent == NULL) { if(name[0] != '\0' || ve->mnt->opts[0] != '\0') return -ENOENT; ent = vol_get_root(ve); } else { res = vol_do_lookup(parent, name, &ent); if(res < 0) return res; av_unref_obj(parent); } *newp = ent; if(ent != NULL && ent->node != NULL) return AV_TYPE(ent->node->st.mode); else return 0; } /* called by vol_getpath */ static char *vol_create_path(struct volentry *ent) { char *path; if(ent->parent == NULL) return av_strdup(""); path = vol_create_path(ent->parent); return av_stradd(path, "/", ent->name, NULL); } static int vol_getpath(ventry *ve, char **resp) { struct volentry *ent = vol_ventry_volentry(ve); *resp = vol_create_path(ent); return 0; } static void vol_putent(ventry *ve) { struct volentry *ent = vol_ventry_volentry(ve); av_unref_obj(ent); } static int vol_copyent(ventry *ve, void **resp) { struct volentry *ent = vol_ventry_volentry(ve); av_ref_obj(ent); *resp = (void *) ent; return 0; } /* called by vol_open and vol_truncate */ static void vol_truncate_node(struct volnode *nod, avoff_t length) { nod->st.size = length; nod->st.blocks = AV_DIV(nod->st.size, 512); av_curr_time(&nod->st.mtime); } /* called by vol_open_check_type */ static int vol_need_write(int flags) { if((flags & AVO_ACCMODE) == AVO_WRONLY || (flags & AVO_ACCMODE) == AVO_RDWR || (flags & AVO_TRUNC) != 0) return 1; return 0; } /* called by vol_open_check */ static int vol_open_check_type(avmode_t mode, int flags) { if((flags & AVO_DIRECTORY) != 0 && !AV_ISDIR(mode)) return -ENOTDIR; switch(mode & AV_IFMT) { case AV_IFREG: return 0; case AV_IFDIR: if(vol_need_write(flags)) return -EISDIR; return 0; case AV_IFLNK: if((flags & AVO_ACCMODE) != AVO_NOPERM || !(flags & AVO_NOFOLLOW)) return -ENOENT; return 0; default: /* FIFO, char/bockdev, socket */ if((flags & AVO_ACCMODE) != AVO_NOPERM) return -ENXIO; return 0; } } /* called by vol_open */ static int vol_open_check(struct volnode *nod, int flags) { if(nod == NULL) { if(!(flags & AVO_CREAT)) return -ENOENT; return 0; } if((flags & AVO_EXCL) != 0) return -EEXIST; return vol_open_check_type(nod->st.mode, flags); } static int vol_open(ventry *ve, int flags, avmode_t mode, void **resp) { int res; struct volfs *fs = vol_ventry_volfs(ve); struct volentry *ent = vol_ventry_volentry(ve); /* check permissions */ res = vol_open_check(ent->node, flags); if(res < 0) return res; /* create the file if it doesn't exist yet */ if(ent->node == NULL) { res = vol_make_node(fs, ent, mode | AV_IFREG); if(res < 0) return res; } else if((flags & AVO_TRUNC) != 0) vol_truncate_node(ent->node, 0); av_ref_obj(ent->node); *resp = ent->node; return 0; } static int vol_close(vfile *vf) { struct volnode *nod = vol_vfile_volnode(vf); av_unref_obj(nod); return 0; } static avssize_t vol_read(vfile *vf, char *buf, avsize_t nbyte) { avoff_t nact; struct volnode *nod = vol_vfile_volnode(vf); if(AV_ISDIR(nod->st.mode)) return -EISDIR; if(vf->ptr >= nod->st.size) return 0; nact = AV_MIN(nbyte, (avsize_t) (nod->st.size - vf->ptr)); memcpy(buf, nod->content + vf->ptr, nact); vf->ptr += nact; return nact; } static avssize_t vol_write(vfile *vf, const char *buf, avsize_t nbyte) { avoff_t end; struct volnode *nod = vol_vfile_volnode(vf); if((vf->flags & AVO_APPEND) != 0) vf->ptr = nod->st.size; end = vf->ptr + nbyte; if(end > nod->st.size) { nod->content = av_realloc(nod->content, end); nod->st.size = end; nod->st.blocks = AV_DIV(nod->st.size, 512); } memcpy(nod->content + vf->ptr, buf, nbyte); av_curr_time(&nod->st.mtime); vf->ptr = end; return nbyte; } static int vol_truncate(vfile *vf, avoff_t length) { struct volnode *nod = vol_vfile_volnode(vf); if(length < nod->st.size) vol_truncate_node(nod, length); return 0; } /* called by vol_nth_entry */ static struct volnode *vol_special_entry(int n, struct volnode *nod, const char **namep) { if(n == 0) { *namep = "."; return nod; } else { *namep = ".."; return nod->parent->node; } } /* called by vol_readdir */ static struct volnode *vol_nth_entry(int n, struct volnode *nod, const char **namep) { struct volentry *ent; int i; if(nod->parent != NULL) { if(n < 2) return vol_special_entry(n, nod, namep); n -= 2; } ent = nod->subdir; for(i = 0; i < n && ent != NULL; i++) ent = ent->next; if(ent == NULL) return NULL; *namep = ent->name; return ent->node; } static int vol_readdir(vfile *vf, struct avdirent *buf) { struct volnode *parent = vol_vfile_volnode(vf); struct volnode *nod; const char *name; if(!AV_ISDIR(parent->st.mode)) return -ENOTDIR; nod = vol_nth_entry(vf->ptr, parent, &name); if(nod == NULL) return 0; buf->name = av_strdup(name); buf->ino = nod->st.ino; buf->type = AV_TYPE(nod->st.mode); vf->ptr ++; return 1; } static int vol_getattr(vfile *vf, struct avstat *buf, int attrmask) { struct volnode *nod = vol_vfile_volnode(vf); *buf = nod->st; return 0; } static void vol_set_attributes(struct avstat *dest, const struct avstat *src, int attrmask) { if((attrmask & AVA_ATIME) != 0) dest->atime = src->atime; if((attrmask & AVA_MTIME) != 0) dest->mtime = src->mtime; if((attrmask & AVA_MODE) != 0) dest->mode = (dest->mode & AV_IFMT) | src->mode; if((attrmask & AVA_UID) != 0) dest->uid = src->uid; if((attrmask & AVA_GID) != 0) dest->gid = src->gid; } static int vol_setattr(vfile *vf, struct avstat *buf, int attrmask) { struct volnode *nod = vol_vfile_volnode(vf); vol_set_attributes(&nod->st, buf, attrmask); return 0; } static int vol_access(ventry *ve, int amode) { struct volnode *nod = vol_ventry_volentry(ve)->node; if(nod == NULL) return -ENOENT; return 0; } static int vol_readlink(ventry *ve, char **bufp) { struct volnode *nod = vol_ventry_volentry(ve)->node; if(nod == NULL) return -ENOENT; if(!AV_ISLNK(nod->st.mode)) return -EINVAL; *bufp = av_strdup(nod->content); return 0; } static int vol_unlink(ventry *ve) { struct volentry *ent = vol_ventry_volentry(ve); if(ent->node == NULL) return -ENOENT; if(AV_ISDIR(ent->node->st.mode)) return -EISDIR; vol_unlink_node(ent); return 0; } /* called by vol_rmdir */ static int vol_check_rmdir(struct volentry *ent) { struct volnode *nod = ent->node; if(nod == NULL) return -ENOENT; if(!AV_ISDIR(nod->st.mode)) return -ENOTDIR; if(nod->subdir != NULL) return -ENOTEMPTY; if(ent->parent == NULL) return -EBUSY; return 0; } static int vol_rmdir(ventry *ve) { int res; struct volentry *ent = vol_ventry_volentry(ve); res = vol_check_rmdir(ent); if(res < 0) return res; vol_unlink_node(ent); return 0; } static int vol_mkdir(ventry *ve, avmode_t mode) { int res; struct volfs *fs = vol_ventry_volfs(ve); struct volentry *ent = vol_ventry_volentry(ve); if(ent->node != NULL) return -EEXIST; res = vol_make_node(fs, ent, mode | AV_IFDIR); if(res < 0) return res; return 0; } static int vol_mknod(ventry *ve, avmode_t mode, avdev_t dev) { int res; struct volfs *fs = vol_ventry_volfs(ve); struct volentry *ent = vol_ventry_volentry(ve); if(ent->node != NULL) return -EEXIST; res = vol_make_node(fs, ent, mode); if(res < 0) return res; ent->node->st.rdev = dev; return 0; } /* called by vol_check_rename */ static int vol_is_subdir(struct volentry *dir, struct volentry *basedir) { while(1) { if(dir == basedir) return 1; if(dir->parent == NULL) break; dir = dir->parent; } return 0; } /* called by vol_rename */ static int vol_check_rename(struct volentry *ent, struct volentry *newent) { if(ent->node == NULL) return -ENOENT; if(newent->name == NULL) return -ENOENT; if(AV_ISDIR(ent->node->st.mode) && vol_is_subdir(newent, ent)) return -EINVAL; if(newent->node != NULL) { if(AV_ISDIR(ent->node->st.mode)) { if(!AV_ISDIR(newent->node->st.mode)) return -ENOTDIR; if(newent->node->subdir != NULL) return -ENOTEMPTY; } else { if(AV_ISDIR(newent->node->st.mode)) return -EISDIR; } vol_unlink_node(newent); } return 0; } static int vol_rename(ventry *ve, ventry *newve) { int res; struct volentry *ent = vol_ventry_volentry(ve); struct volentry *newent = vol_ventry_volentry(newve); if(ent->node != NULL && ent == newent) return 0; res = vol_check_rename(ent, newent); if(res < 0) return res; vol_link_node(newent, ent->node); vol_unlink_node(ent); return 0; } /* called by vol_link */ static int vol_check_link(struct volentry *ent, struct volentry *newent) { if(ent->node == NULL) return -ENOENT; if(newent->name == NULL) return -ENOENT; if(AV_ISDIR(ent->node->st.mode)) return -EPERM; if(newent->node != NULL) return -EEXIST; return 0; } static int vol_link(ventry *ve, ventry *newve) { int res; struct volentry *ent = vol_ventry_volentry(ve); struct volentry *newent = vol_ventry_volentry(newve); res = vol_check_link(ent, newent); if(res < 0) return res; vol_link_node(newent, ent->node); return 0; } static int vol_symlink(const char *path, ventry *newve) { int res; struct volfs *fs = vol_ventry_volfs(newve); struct volentry *ent = vol_ventry_volentry(newve); if(ent->node != NULL) return -EEXIST; res = vol_make_node(fs, ent, 0777 | AV_IFLNK); if(res < 0) return res; ent->node->content = av_strdup(path); ent->node->st.size = strlen(path); return 0; } static void vol_destroy(struct avfs *avfs) { struct volfs *fs = (struct volfs *) avfs->data; vol_free_tree(fs->root); av_unref_obj(fs->root); av_free(fs); } /* end of avfs ops */ /****************************************************************/ extern int av_init_module_volatile(struct vmodule *module); int av_init_module_volatile(struct vmodule *module) { int res; struct avfs *avfs; struct volfs *fs; res = av_new_avfs("volatile", NULL, AV_VER, AVF_ONLYROOT, module, &avfs); if(res < 0) return res; avfs->destroy = vol_destroy; AV_NEW(fs); avfs->data = (void *) fs; fs->root = vol_new_entry("/"); fs->avfs = avfs; vol_make_node(fs, fs->root, 0755 | AV_IFDIR); avfs->lookup = vol_lookup; avfs->putent = vol_putent; avfs->copyent = vol_copyent; avfs->getpath = vol_getpath; avfs->open = vol_open; avfs->close = vol_close; avfs->read = vol_read; avfs->write = vol_write; avfs->readdir = vol_readdir; avfs->getattr = vol_getattr; avfs->setattr = vol_setattr; avfs->truncate = vol_truncate; avfs->access = vol_access; avfs->readlink = vol_readlink; avfs->unlink = vol_unlink; avfs->rmdir = vol_rmdir; avfs->mkdir = vol_mkdir; avfs->mknod = vol_mknod; avfs->rename = vol_rename; avfs->link = vol_link; avfs->symlink = vol_symlink; av_add_avfs(avfs); return 0; } avfs-1.1.4/modules/uzip.c0000644000175000001440000005527514032341001012176 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-1999 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. ZIP module */ #include "archive.h" #include "zipconst.h" #include "zfile.h" #include "cache.h" #include "oper.h" #include "version.h" struct ecrec { avushort this_disk; avushort cdir_disk; avushort this_entries; avushort total_entries; avuint cdir_size; avuint cdir_off; avushort comment_len; avoff_t file_size; short is_zip64; }; #define ECREC_THIS_DISK 4 #define ECREC_CDIR_DISK 6 #define ECREC_THIS_ENTRIES 8 #define ECREC_TOTAL_ENTRIES 10 #define ECREC_CDIR_SIZE 12 #define ECREC_CDIR_OFF 16 #define ECREC_COMMENT_LEN 20 #define ECREC_SIZE 22 /* Z64_ECDL reads ZIP64_End_of_Central_Director_Locator */ struct z64_end_of_central_dir_loc { avuint ecdir_disk; avuquad ecdir_off; avuint total_disks; struct ecrec *ecd; }; #define Z64_ECDL_ECDIR_DISK 4 #define Z64_ECDL_ECDIR_OFF 8 #define Z64_ECDL_TOTAL_DISKS 16 #define Z64_ECDL_SIZE 20 #define Z64_ECD_VERSION 12 #define Z64_ECD_NEED_VERSION 14 #define Z64_ECD_THIS_DISK 16 #define Z64_ECD_CDIR_DISK 20 #define Z64_ECD_THIS_ENTRIES 24 #define Z64_ECD_TOTAL_ENTRIES 32 #define Z64_ECD_CDIR_SIZE 40 #define Z64_ECD_CDIR_OFF 48 #define Z64_ECD_SIZE 56 /* Z64_ECD end of central directory record */ struct z64_end_of_central_dir { avushort version; avushort need_version; avuint this_disk; avuint cdir_disk; avuquad this_entries; avuquad total_entries; avuquad cdir_size; avuquad cdir_off; }; struct cdirentry { avushort version; avushort need_version; avushort flag; avushort method; avuint mod_time; avuint crc; avuquad comp_size; avuquad file_size; avushort fname_len; avushort extra_len; avushort comment_len; avushort start_disk; avushort int_attr; avuint attr; avuquad file_off; }; #define CDIRENT_VERSION 4 #define CDIRENT_NEED_VERSION 6 #define CDIRENT_FLAG 8 #define CDIRENT_METHOD 10 #define CDIRENT_MOD_TIME 12 #define CDIRENT_CRC 16 #define CDIRENT_COMP_SIZE 20 #define CDIRENT_FILE_SIZE 24 #define CDIRENT_FNAME_LEN 28 #define CDIRENT_EXTRA_LEN 30 #define CDIRENT_COMMENT_LEN 32 #define CDIRENT_START_DISK 34 #define CDIRENT_INT_ATTR 36 #define CDIRENT_ATTR 38 #define CDIRENT_FILE_OFF 42 #define CDIRENT_SIZE 46 struct ldirentry { avushort need_version; avushort flag; avushort method; avuint mod_time; avuint crc; avuquad comp_size; avuquad file_size; avushort fname_len; avushort extra_len; }; #define LDIRENT_NEED_VERSION 4 #define LDIRENT_FLAG 6 #define LDIRENT_METHOD 8 #define LDIRENT_MOD_TIME 10 #define LDIRENT_CRC 14 #define LDIRENT_COMP_SIZE 18 #define LDIRENT_FILE_SIZE 22 #define LDIRENT_FNAME_LEN 26 #define LDIRENT_EXTRA_LEN 28 #define LDIRENT_SIZE 30 #define dos_ftsec(ft) (int)( 2 * ((ft >> 0) & 0x1F)) #define dos_ftmin(ft) (int)( ((ft >> 5) & 0x3F)) #define dos_fthour(ft) (int)( ((ft >> 11) & 0x1F)) #define dos_ftday(ft) (int)( ((ft >> 16) & 0x1F)) #define dos_ftmonth(ft) (int)(-1 + ((ft >> 21) & 0x0F)) #define dos_ftyear(ft) (int)(80 + ((ft >> 25) & 0x7F)) #define BUFSIZE 512 #define SEARCHLEN 66000 #define BI(ptr, i) ((avbyte) (ptr)[i]) #define BI_Q(ptr, i) ((avuquad)((avbyte) (ptr)[i])) #define DBYTE(ptr) ((avushort)(BI(ptr,0) | (BI(ptr,1)<<8))) #define QBYTE(ptr) ((avuint)(BI(ptr,0) | (BI(ptr,1)<<8) | \ (BI(ptr,2)<<16) | (BI(ptr,3)<<24))) #define DQBYTE(ptr) (BI_Q(ptr,0) | (BI_Q(ptr,1)<<8) | \ (BI_Q(ptr,2)<<16) | (BI_Q(ptr,3)<<24) | \ (BI_Q(ptr,4)<<32) | (BI_Q(ptr,5)<<40) | \ (BI_Q(ptr,6)<<48) | (BI_Q(ptr,7)<<56)) struct zipnode { avuint crc; avushort method; avoff_t headeroff; struct cacheobj *cache; }; static void conv_tolower(char *s) { for(; *s; s++) *s = tolower(*s); } static avoff_t find_ecrec(vfile *vf, long searchlen, struct ecrec *ecrec) { int res; avoff_t bufstart; int pos; char buf[BUFSIZE+3]; avoff_t sres; int found; sres = av_lseek(vf, 0, AVSEEK_END); if(sres < 0) return sres; if(sres < ECREC_SIZE) { av_log(AVLOG_ERROR, "UZIP: Broken archive"); return -EIO; } pos = 0; bufstart = sres - (ECREC_SIZE - 4); buf[0] = buf[1] = buf[2] = 0; found = 0; for(;searchlen && (bufstart || pos); searchlen--) { if(!pos) { pos = BUFSIZE; if(bufstart < pos) pos = bufstart; bufstart -= pos; buf[pos] = buf[0]; buf[pos+1] = buf[1]; buf[pos+2] = buf[2]; res = av_pread_all(vf, buf, pos, bufstart); if(res < 0) return res; } pos--; if(buf[pos] == 'P' && buf[pos+1] == 'K' && buf[pos+2] == 5 && buf[pos+3] == 6) { found = 1; break; } } if(!found) { av_log(AVLOG_ERROR, "UZIP: Couldn't find End of Central Directory Record"); return -EIO; } bufstart += pos; res = av_pread_all(vf, buf, ECREC_SIZE, bufstart); if(res < 0) return res; ecrec->this_disk = DBYTE(buf+ECREC_THIS_DISK); ecrec->cdir_disk = DBYTE(buf+ECREC_CDIR_DISK); ecrec->this_entries = DBYTE(buf+ECREC_THIS_ENTRIES); ecrec->total_entries = DBYTE(buf+ECREC_TOTAL_ENTRIES); ecrec->cdir_size = QBYTE(buf+ECREC_CDIR_SIZE); ecrec->cdir_off = QBYTE(buf+ECREC_CDIR_OFF); ecrec->comment_len = DBYTE(buf+ECREC_COMMENT_LEN); ecrec->file_size = sres; ecrec->is_zip64 = 0; return bufstart; } static avtime_t dos2unix_time(avuint dt) { struct avtm ut; ut.sec = dos_ftsec(dt); ut.min = dos_ftmin(dt); ut.hour = dos_fthour(dt); ut.day = dos_ftday(dt); ut.mon = dos_ftmonth(dt); ut.year = dos_ftyear(dt); return av_mktime(&ut); } static avmode_t dos2unix_attr(avuint da, avmode_t archmode) { avmode_t mode = (archmode & 0666); if (da & 0x01) mode = mode & ~0222; if (da & 0x10) mode = mode | ((mode & 0444) >> 2) | AV_IFDIR; else mode |= AV_IFREG; return mode; } static avmode_t zip_get_mode(struct cdirentry *cent, const char *path, avmode_t origmode) { avmode_t mode; /* FIXME: Handle other architectures */ if((cent->version & 0xFF00) >> 8 == OS_UNIX) { mode = (cent->attr >> 16) & 0xFFFF; /* workaround for unset type */ if ((mode & AV_IFMT) == 0) { mode |= AV_IFREG; } } else { mode = dos2unix_attr(cent->attr & 0xFF, origmode); } if(path[0] && path[strlen(path)-1] == '/') mode = (mode & 07777) | AV_IFDIR; return mode; } static void zipnode_delete(struct zipnode *nod) { av_unref_obj(nod->cache); } static void fill_zipentry(struct archive *arch, const char *path, struct entry *ent, struct cdirentry *cent, struct ecrec *ecrec) { struct archnode *nod; struct zipnode *info; int isdir = AV_ISDIR(zip_get_mode(cent, path, 0)); nod = av_arch_new_node(arch, ent, isdir); nod->st.mode = zip_get_mode(cent, path, nod->st.mode); nod->st.size = cent->file_size; nod->st.blocks = AV_BLOCKS(cent->comp_size); nod->st.blksize = 4096; nod->st.mtime.sec = dos2unix_time(cent->mod_time); nod->st.mtime.nsec = 0; nod->st.atime = nod->st.mtime; nod->st.ctime = nod->st.mtime; nod->realsize = cent->comp_size; AV_NEW_OBJ(info, zipnode_delete); nod->data = info; info->cache = NULL; info->crc = cent->crc; info->method = 0; /* FIXME: multivolume archives */ if(cent->start_disk != 0 || ecrec->cdir_disk != 0) info->headeroff = -1; else info->headeroff = cent->file_off; } static void insert_zipentry(struct archive *arch, char *path, struct cdirentry *cent, struct ecrec *ecrec) { struct entry *ent; int entflags = 0; /* FIXME: option for uzip, not to convert filenames to lowercase */ switch((cent->version & 0xFF00) >> 8) { case OS_CPM: case OS_VM_CMS: case OS_MVS: case OS_TANDEM: case OS_TOPS20: case OS_VMS: conv_tolower(path); /* fall through */ case OS_MSDOS: /* some shitty windows zipper produces zipfiles in this type */ case OS_NT: case OS_WIN95: entflags |= NSF_NOCASE; } ent = av_arch_create(arch, path, entflags); if(ent == NULL) return; fill_zipentry(arch, path, ent, cent, ecrec); av_unref_obj(ent); } static int parse_extra_header(vfile *vf, avoff_t pos, struct cdirentry *cent, struct ldirentry *lent) { char buf[4]; avoff_t end = pos + (cent ? cent->extra_len : lent->extra_len); while (pos + 4 <= end) { /* read header ID and size */ int res = av_pread_all(vf, buf, 4, pos); avushort id; int size; if(res < 0) { return res; } id = DBYTE(buf); size = DBYTE(buf+2); pos += 4; if (id == 1 && pos + size <= end) { if((cent && (avuint)(cent->file_size) == 0xffffffff) || (lent && (avuint)(lent->file_size) == 0xffffffff)) { if(size >= 8) { char buf8[8]; int res = av_pread_all(vf, buf8, 8, pos); if(res < 0) { return res; } if (cent) { cent->file_size = DQBYTE(buf8); } else { lent->file_size = DQBYTE(buf8); } size -= 8; pos += 8; } else { if (cent) { cent->file_size = 0; } else { lent->file_size = 0; } pos += size; } } if((cent && (avuint)(cent->comp_size) == 0xffffffff) || (lent && (avuint)(lent->comp_size) == 0xffffffff)) { if(size >= 8) { char buf8[8]; int res = av_pread_all(vf, buf8, 8, pos); if(res < 0) { return res; } if (cent) { cent->comp_size = DQBYTE(buf8); } else{ lent->comp_size = DQBYTE(buf8); } size -= 8; pos += 8; } else { if (cent) { cent->comp_size = 0; } else{ lent->comp_size = 0; } pos += size; } } if(cent && (avuint)(cent->file_off) == 0xffffffff) { if(size >= 8) { char buf8[8]; int res = av_pread_all(vf, buf8, 8, pos); if(res < 0) { return res; } cent->file_off = DQBYTE(buf8); size -= 8; pos += 8; } else { pos += size; } } } else { pos += size; } } return 0; } static avoff_t read_entry(vfile *vf, struct archive *arch, avoff_t pos, struct ecrec *ecrec) { int res; char buf[CDIRENT_SIZE]; struct cdirentry ent; char *filename; res = av_pread_all(vf, buf, CDIRENT_SIZE, pos); if(res < 0) return res; if(buf[0] != 'P' || buf[1] != 'K' || buf[2] != 1 || buf[3] != 2) { av_log(AVLOG_ERROR, "UZIP: Broken archive"); return -EIO; } ent.version = DBYTE(buf+CDIRENT_VERSION); ent.need_version = DBYTE(buf+CDIRENT_NEED_VERSION); ent.flag = DBYTE(buf+CDIRENT_FLAG); ent.method = DBYTE(buf+CDIRENT_METHOD); ent.mod_time = QBYTE(buf+CDIRENT_MOD_TIME); ent.crc = QBYTE(buf+CDIRENT_CRC); ent.comp_size = QBYTE(buf+CDIRENT_COMP_SIZE); ent.file_size = QBYTE(buf+CDIRENT_FILE_SIZE); ent.fname_len = DBYTE(buf+CDIRENT_FNAME_LEN); ent.extra_len = DBYTE(buf+CDIRENT_EXTRA_LEN); ent.comment_len = DBYTE(buf+CDIRENT_COMMENT_LEN); ent.start_disk = DBYTE(buf+CDIRENT_START_DISK); ent.int_attr = DBYTE(buf+CDIRENT_INT_ATTR); ent.attr = QBYTE(buf+CDIRENT_ATTR); ent.file_off = QBYTE(buf+CDIRENT_FILE_OFF); filename = av_malloc(ent.fname_len + 1); res = av_pread_all(vf, filename, ent.fname_len, pos + CDIRENT_SIZE); if(res < 0) { av_free(filename); return res; } filename[ent.fname_len] = '\0'; if(pos + CDIRENT_SIZE + ent.fname_len + ent.extra_len + ent.comment_len > ecrec->file_size) { av_free(filename); return -EIO; } if(parse_extra_header(vf, pos + CDIRENT_SIZE + ent.fname_len, &ent, NULL) < 0 ) { av_free(filename); return -EIO; } insert_zipentry(arch, filename, &ent, ecrec); av_free(filename); return pos + CDIRENT_SIZE + ent.fname_len + ent.extra_len + ent.comment_len; } static avoff_t find_z64_ecd(vfile *vf, struct z64_end_of_central_dir_loc *ecdl, struct z64_end_of_central_dir *z64_ecd, avoff_t pos) { char buf[Z64_ECD_SIZE]; int res; if(pos + Z64_ECD_SIZE > ecdl->ecd->file_size) { return -EIO; } res = av_pread_all(vf, buf, Z64_ECD_SIZE, pos); if(res < 0) { return res; } if(!(buf[0] == 'P' && buf[1] == 'K' && buf[2] == 6 && buf[3] == 6)) { return -EIO; } z64_ecd->version = DBYTE(buf+Z64_ECD_VERSION); z64_ecd->need_version = DBYTE(buf+Z64_ECD_NEED_VERSION); z64_ecd->this_disk = QBYTE(buf+Z64_ECD_THIS_DISK); z64_ecd->cdir_disk = QBYTE(buf+Z64_ECD_CDIR_DISK); z64_ecd->this_entries = DQBYTE(buf+Z64_ECD_THIS_ENTRIES); z64_ecd->total_entries = DQBYTE(buf+Z64_ECD_TOTAL_ENTRIES); z64_ecd->cdir_size = DQBYTE(buf+Z64_ECD_CDIR_SIZE); z64_ecd->cdir_off = DQBYTE(buf+Z64_ECD_CDIR_OFF); return pos; } static avoff_t find_z64_ecdl(vfile *vf, struct ecrec *ecd, struct z64_end_of_central_dir_loc *ecdl, avoff_t pos) { char buf[Z64_ECDL_SIZE]; int res; if (pos < Z64_ECDL_SIZE) { return -EIO; } pos -= Z64_ECDL_SIZE; res = av_pread_all(vf, buf, Z64_ECDL_SIZE, pos); if(res < 0) { return res; } if(!(buf[0] == 'P' && buf[1] == 'K' && buf[2] == 6 && buf[3] == 7)) { return -EIO; } ecdl->ecdir_disk = QBYTE(buf+Z64_ECDL_ECDIR_DISK); ecdl->ecdir_off = DQBYTE(buf+Z64_ECDL_ECDIR_OFF); ecdl->total_disks = QBYTE(buf+Z64_ECDL_TOTAL_DISKS); ecdl->ecd = ecd; return pos; } static int find_and_validate_z64_ecdl(vfile *vf, struct archive *arch, struct ecrec *ecrec, avoff_t pos, struct z64_end_of_central_dir_loc *ecdl) { avoff_t ecdl_pos; ecdl_pos = find_z64_ecdl(vf, ecrec, ecdl, pos); if(ecdl_pos < 0) { return ecdl_pos; } if(ecdl->ecdir_disk != ecdl->ecd->this_disk) { return -EIO; } if (ecdl->ecdir_off > ecdl->ecd->file_size) { return -EIO; } ecrec->is_zip64 = 1; return 0; } static int read_zip64file(vfile *vf, struct archive *arch, struct ecrec *ecrec, struct z64_end_of_central_dir_loc *ecdl, avoff_t pos) { struct z64_end_of_central_dir z64_ecd; avoff_t extra_bytes; avoff_t cdir_end; avoff_t ecdir_pos; avoff_t cdir_pos; int nument; ecdir_pos = ecdl->ecdir_off; if (ecdir_pos > ecdl->ecd->file_size) { return -EIO; } pos = find_z64_ecd(vf, ecdl, &z64_ecd, ecdir_pos); if(pos < 0) { return -EIO; } if(z64_ecd.cdir_disk != z64_ecd.this_disk) { av_log(AVLOG_ERROR, "UZIP: Cannot handle multivolume archives"); return -EIO; } cdir_end = z64_ecd.cdir_size + z64_ecd.cdir_off; extra_bytes = pos - cdir_end; if(extra_bytes < 0) { av_log(AVLOG_ERROR, "UZIP: Broken archive"); return -EIO; } if(z64_ecd.cdir_off == 0 && z64_ecd.cdir_size == 0) { /* Empty zipfile */ return 0; } cdir_pos = z64_ecd.cdir_off + extra_bytes; for(nument = 0; nument < z64_ecd.total_entries; nument++) { if(cdir_pos >= pos) { av_log(AVLOG_ERROR, "UZIP: Broken archive"); return -EIO; } cdir_pos = read_entry(vf, arch, cdir_pos, ecrec); if(cdir_pos < 0) return cdir_pos; } return 0; } static int read_zipfile(vfile *vf, struct archive *arch) { avoff_t ecrec_pos; struct ecrec ecrec; struct z64_end_of_central_dir_loc ecdl; avoff_t extra_bytes; avoff_t cdir_end; avoff_t cdir_pos; int nument; ecrec_pos = find_ecrec(vf, SEARCHLEN, &ecrec); if(ecrec_pos < 0) return ecrec_pos; if(find_and_validate_z64_ecdl(vf, arch, &ecrec, ecrec_pos, &ecdl) == 0) { /* zip64 format */ return read_zip64file(vf, arch, &ecrec, &ecdl, ecrec_pos); } cdir_end = ecrec.cdir_size+ecrec.cdir_off; if(ecrec.this_disk != ecrec.cdir_disk) { av_log(AVLOG_ERROR, "UZIP: Cannot handle multivolume archives"); return -EIO; } extra_bytes = ecrec_pos - cdir_end; if(extra_bytes < 0) { av_log(AVLOG_ERROR, "UZIP: Broken archive"); return -EIO; } if(ecrec.cdir_off == 0 && ecrec.cdir_size == 0) { /* Empty zipfile */ return 0; } cdir_pos = ecrec.cdir_off + extra_bytes; for(nument = 0; nument < ecrec.total_entries; nument++) { if(cdir_pos >= ecrec_pos) { av_log(AVLOG_ERROR, "UZIP: Broken archive"); return -EIO; } cdir_pos = read_entry(vf, arch, cdir_pos, &ecrec); if(cdir_pos < 0) return cdir_pos; } return 0; } static int parse_zipfile(void *data, ventry *ve, struct archive *arch) { int res; vfile *vf; res = av_open(ve->mnt->base, AVO_RDONLY, 0, &vf); if(res < 0) return res; res = read_zipfile(vf, arch); av_close(vf); return res; } static int zip_close(struct archfile *fil) { struct zfile *zfil = fil->data; av_unref_obj(zfil); return 0; } static int zip_open(ventry *ve, struct archfile *fil) { int res; char buf[LDIRENT_SIZE]; struct ldirentry ent; int headersize; struct zipnode *info = (struct zipnode *) fil->nod->data; avoff_t offset; if(info == NULL) { /* no info means accessing base zip directory without any filename */ return -EISDIR; } offset = info->headeroff; if(offset == -1) { av_log(AVLOG_ERROR, "UZIP: Cannot handle multivolume archives"); return -ENOENT; } res = av_pread_all(fil->basefile, buf, LDIRENT_SIZE, offset); if(res < 0) return res; if(buf[0] != 'P' || buf[1] != 'K' || buf[2] != 3 || buf[3] != 4) { av_log(AVLOG_ERROR, "UZIP: Broken archive"); return -EIO; } ent.need_version = DBYTE(buf+LDIRENT_NEED_VERSION); ent.flag = DBYTE(buf+LDIRENT_FLAG); ent.method = DBYTE(buf+LDIRENT_METHOD); ent.mod_time = QBYTE(buf+LDIRENT_MOD_TIME); ent.crc = QBYTE(buf+LDIRENT_CRC); ent.comp_size = QBYTE(buf+LDIRENT_COMP_SIZE); ent.file_size = QBYTE(buf+LDIRENT_FILE_SIZE); ent.fname_len = DBYTE(buf+LDIRENT_FNAME_LEN); ent.extra_len = DBYTE(buf+LDIRENT_EXTRA_LEN); if(ent.method != METHOD_STORE && ent.method != METHOD_DEFLATE) { av_log(AVLOG_ERROR, "UZIP: Cannot handle compression method %i", ent.method); return -ENOENT; } if((ent.flag & 0x08) != 0) { /* can't trust local header, use central directory: */ ent.comp_size = fil->nod->realsize; ent.file_size = fil->nod->st.size; ent.crc = info->crc; } info->method = ent.method; headersize = LDIRENT_SIZE + ent.fname_len + ent.extra_len; fil->nod->offset = offset + headersize; if(parse_extra_header(fil->basefile, offset + LDIRENT_SIZE + ent.fname_len, NULL, &ent) < 0 ) { return -EIO; } if(ent.method == METHOD_DEFLATE) { struct zfile *zfil; zfil = av_zfile_new(fil->basefile, fil->nod->offset, ent.crc, AV_ZFILE_DATA_PLAIN); fil->data = zfil; } return 0; } static avssize_t zip_deflate_read(vfile *vf, char *buf, avsize_t nbyte) { avssize_t res; struct archfile *fil = arch_vfile_file(vf); struct zfile *zfil = (struct zfile *) fil->data; struct zipnode *info = (struct zipnode *) fil->nod->data; struct zcache *zc; zc = (struct zcache *) av_cacheobj_get(info->cache); if(zc == NULL) { av_unref_obj(info->cache); info->cache = NULL; zc = av_zcache_new(); } res = av_zfile_pread(zfil, zc, buf, nbyte, vf->ptr); if(res >= 0) { avoff_t cachesize; vf->ptr += res; cachesize = av_zcache_size(zc); if(cachesize != 0) { /* FIXME: name of this cacheobj? */ if(info->cache == NULL) info->cache = av_cacheobj_new(zc, "(uzip:index)"); av_cacheobj_setsize(info->cache, cachesize); } } else { av_unref_obj(info->cache); info->cache = NULL; } av_unref_obj(zc); return res; } static avssize_t zip_read(vfile *vf, char *buf, avsize_t nbyte) { avssize_t res; struct archfile *fil = arch_vfile_file(vf); struct zfile *zfil = (struct zfile *) fil->data; if(zfil != NULL) res = zip_deflate_read(vf, buf, nbyte); else res = av_arch_read(vf, buf, nbyte); return res; } extern int av_init_module_uzip(struct vmodule *module); int av_init_module_uzip(struct vmodule *module) { int res; struct avfs *avfs; struct ext_info zipexts[6]; struct archparams *ap; zipexts[0].from = ".zip", zipexts[0].to = NULL; zipexts[1].from = ".jar", zipexts[1].to = NULL; zipexts[2].from = ".ear", zipexts[2].to = NULL; zipexts[3].from = ".war", zipexts[3].to = NULL; zipexts[4].from = ".apk", zipexts[4].to = NULL; zipexts[5].from = NULL; res = av_archive_init("uzip", zipexts, AV_VER, module, &avfs); if(res < 0) return res; ap = (struct archparams *) avfs->data; ap->parse = parse_zipfile; ap->open = zip_open; ap->close = zip_close; ap->read = zip_read; av_add_avfs(avfs); return 0; } avfs-1.1.4/modules/uzstde.c0000644000175000001440000000215614032341001012513 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2018 Ralf Hoffmann This program can be distributed under the terms of the GNU GPL. See the file COPYING. UZSTDE module */ #include "filter.h" #include "version.h" #include "config.h" extern int av_init_module_uzstde(struct vmodule *module); int av_init_module_uzstde(struct vmodule *module) { struct avfs *avfs; const char *uzstde_args[4]; const char *zstde_args[3]; struct ext_info uzstde_exts[3]; uzstde_args[0] = "zstd"; uzstde_args[1] = "-d"; uzstde_args[2] = "-c"; uzstde_args[3] = NULL; zstde_args[0] = "zstd"; zstde_args[1] = "-c"; zstde_args[2] = NULL; #if HAVE_LIBZSTD // no default ending conversion if we have internal zstd support uzstde_exts[0].from = NULL; #else uzstde_exts[0].from = ".tar.zst", uzstde_exts[2].to = ".tar"; uzstde_exts[1].from = ".zst", uzstde_exts[2].to = NULL; uzstde_exts[2].from = NULL; #endif return av_init_filt(module, AV_VER, "uzstde", uzstde_args, zstde_args, uzstde_exts, &avfs); } avfs-1.1.4/modules/zipconst.h0000644000175000001440000000173514032341001013055 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-1999 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #define OS_MSDOS 0 #define OS_AMIGA 1 #define OS_VMS 2 #define OS_UNIX 3 #define OS_VM_CMS 4 #define OS_ARARI 5 #define OS_HPFS 6 #define OS_MAC 7 #define OS_Z_SYSTEM 8 #define OS_CPM 9 #define OS_TOPS20 10 #define OS_NT 11 #define OS_QDOS 12 #define OS_ACORN 13 #define OS_WIN95 14 #define OS_MVS 15 #define OS_BEOS 16 #define OS_TANDEM 17 #define METHOD_STORE 0 #define METHOD_SHRINK 1 #define METHOD_REDUCE1 2 #define METHOD_REDUCE2 3 #define METHOD_REDUCE3 4 #define METHOD_REDUCE4 5 #define METHOD_IMPLODE 6 #define METHOD_TOKENIZE 7 #define METHOD_DEFLATE 8 #define METHOD_ENHDEFLATE 9 #define METHOD_DCLIMPLODE 10 avfs-1.1.4/modules/uxze.c0000644000175000001440000000220414032341001012162 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2010-2018 Ralf Hoffmann This program can be distributed under the terms of the GNU GPL. See the file COPYING. UXZE module */ #include "filter.h" #include "version.h" #include "config.h" extern int av_init_module_uxze(struct vmodule *module); int av_init_module_uxze(struct vmodule *module) { struct avfs *avfs; const char *uxze_args[3]; const char *xze_args[2]; struct ext_info uxze_exts[5]; uxze_args[0] = "xz"; uxze_args[1] = "-d"; uxze_args[2] = NULL; xze_args[0] = "xz"; xze_args[1] = NULL; #if HAVE_LIBLZMA // no default ending conversion if we have internal zstd support uxze_exts[0].from = NULL; #else uxze_exts[0].from = ".tar.xz", uxze_exts[0].to = ".tar"; uxze_exts[1].from = ".txz", uxze_exts[1].to = ".tar"; uxze_exts[2].from = ".xz", uxze_exts[2].to = NULL; uxze_exts[3].from = ".lzma", uxze_exts[3].to = NULL; uxze_exts[4].from = NULL; #endif return av_init_filt(module, AV_VER, "uxze", uxze_args, xze_args, uxze_exts, &avfs); } avfs-1.1.4/modules/make_initmod0000755000175000001440000000077614032341001013425 00000000000000#! /bin/sh modnames= for obj do bname=`basename $obj .c` modnames="$modnames $bname" done echo "/* This file was generated automatically by 'make_initmod' */" echo echo '#include "avfs.h"' echo for name in $modnames; do echo "int av_init_module_${name}(struct vmodule *module);" done echo echo "extern void av_init_static_modules();" echo echo "void av_init_static_modules()" echo "{" for name in $modnames; do echo " av_init_module_${name}(NULL);" done echo "}" echo echo "/* End of file */" avfs-1.1.4/modules/ftp.c0000644000175000001440000005731414032341001011774 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ /* TODO: if data connection has closed, retry don't use NOOP (if control connection has closed (421), retry) fix absolute symlinks close unused data connections after timeout close unused control connections after timeout limit max connections to a host if second connection doesn't work wait for first and retry retrieve restart seekability selective proxying */ #include "remote.h" #include "socket.h" #include "state.h" #include "filebuf.h" #include "parsels.h" #include #include #include #include #define USER_SEP_STR "@" #define USER_SEP_CHAR (USER_SEP_STR[0]) #define FTP_REPLY_TIMEOUT 30000 #define FTP_READ_TIMEOUT 60000 static AV_LOCK_DECL(ftp_lock); struct ftpconn { char *host; char *user; char *password; int busy; int sock; struct filebuf *sockfb; struct ftpconn *next; int binary; char *cwd; }; struct ftpsession { char *account; char *password; struct ftpsession *next; struct ftpsession *prev; }; struct ftpdata { struct ftpconn *conns; struct ftpsession sessions; }; struct ftplocalfile { int fd; char *tmpfile; int sock; struct filebuf *sockfb; avoff_t numbytes; struct ftpconn *conn; }; static struct ftpsession *ftp_find_session(struct ftpdata *ftd, const char *account) { struct ftpsession *fts; for(fts = ftd->sessions.next; fts != &ftd->sessions; fts = fts->next) { if(strcmp(account, fts->account) == 0) return fts; } return NULL; } static struct ftpsession *ftp_get_session(struct ftpdata *ftd, const char *account) { struct ftpsession *fts; fts = ftp_find_session(ftd, account); if(fts == NULL) { struct ftpsession *next; struct ftpsession *prev; AV_NEW(fts); fts->account = av_strdup(account); fts->password = NULL; fts->next = next = ftd->sessions.next; fts->prev = prev = &ftd->sessions; next->prev = fts; prev->next = fts; } return fts; } static void ftp_remove_session(struct ftpsession *fts) { struct ftpsession *next = fts->next; struct ftpsession *prev = fts->prev; next->prev = prev; prev->next = next; av_free(fts->account); av_free(fts->password); av_free(fts); } static void strip_crlf(char *line) { avsize_t len = strlen(line); if(len > 0 && line[len-1] == '\n') { if(len > 1 && line[len-2] == '\r') line[len-2] = '\0'; else line[len-1] = '\0'; } } static void ftp_release_conn(struct ftpconn *conn) { AV_LOCK(ftp_lock); conn->busy = 0; AV_UNLOCK(ftp_lock); } static void ftp_close_conn(struct ftpconn *conn) { av_unref_obj(conn->sockfb); conn->sockfb = NULL; conn->sock = -1; conn->binary = -1; conn->cwd[0] = '\0'; } static int ftp_get_line(struct ftpconn *conn, char **linep) { int res; char *line; res = av_filebuf_getline(conn->sockfb, &line, FTP_REPLY_TIMEOUT); if(res <= 0 || line == NULL) { ftp_close_conn(conn); if(res < 0) return res; if(res == 0) av_log(AVLOG_ERROR, "FTP: timeout waiting for reply"); else av_log(AVLOG_ERROR, "FTP: server closed ftpconn"); return -EIO; } strip_crlf(line); *linep = line; return 0; } static int ftp_check_reply(struct ftpconn *conn, const char *line) { int reply; if(strlen(line) < 4 || !isdigit((int) line[0]) || !isdigit((int) line[1]) || !isdigit((int) line[2]) || (line[3] != ' ' && line[3] != '-')) { ftp_close_conn(conn); av_log(AVLOG_ERROR, "FTP: malformed reply: %s", line); return -EIO; } reply = (line[0] - '0') * 100 + (line[1] - '0') * 10 + (line[2] - '0'); if(reply == 421) ftp_close_conn(conn); return reply; } static int ftp_wait_reply_code(struct ftpconn *conn) { int res; char *line; char replystr[4]; int firstline = 1; int cont; int replycode = 0; do { cont = 0; res = ftp_get_line(conn, &line); if(res < 0) return res; if(firstline) { res = ftp_check_reply(conn, line); if(res < 0) { av_free(line); return res; } replycode = res; if(line[3] == '-') { strncpy(replystr, line, 3); replystr[3] = ' '; firstline = 0; cont = 1; } } else if(strncmp(line, replystr, 4) != 0) cont = 1; if(replycode >= 400) av_log(AVLOG_ERROR, "FTP: %s", line); else av_log(AVLOG_DEBUG, "FTP: %s", line); av_free(line); } while(cont); return replycode; } static int write_socket(int sock, const char *buf, avsize_t buflen) { int res; while(buflen > 0) { res = write(sock, buf, buflen); if(res == -1) return -errno; buf += res; buflen -= res; } return 0; } static int ftp_write_command(struct ftpconn *conn, const char *cmd) { char *line; int res; if(strncmp(cmd, "PASS ", 5) == 0) av_log(AVLOG_DEBUG, "FTP: PASS *"); else av_log(AVLOG_DEBUG, "FTP: %s", cmd); line = av_stradd(NULL, cmd, "\r\n", NULL); res = write_socket(conn->sock, line, strlen(line)); av_free(line); return res; } static int ftp_command(struct ftpconn *conn, const char *cmd) { int res; res = ftp_write_command(conn, cmd); if(res < 0) return res; res = ftp_wait_reply_code(conn); return res; } static int ftp_get_addrbytes(const char *line, int addrbytes[6]) { int i; int j; int val; const char *s; for(s = line; *s && *s != '('; s++); if(!*s) return -1; s++; for(i = 0; i < 6; i++) { val = 0; for(j = 0; j < 3; j++) { if(!isdigit((int) *s)) return -1; val = val * 10 + (*s - '0'); s++; if(*s == ',' || *s == ')') break; } if(*s != ',' && *s != ')') return -1; addrbytes[i] = val; if(*s == ')') break; s++; } if(i != 5 || *s != ')') return -1; return 0; } static int ftp_check_passv_reply(struct ftpconn *conn, const char *line, char **resp) { int res; int replycode; int addrbytes[6]; char addrbuf[128]; int port; res = ftp_check_reply(conn, line); if(res < 0) return res; replycode = res; if(replycode != 227) { av_log(AVLOG_ERROR, "FTP: %s", line); ftp_close_conn(conn); return -EIO; } av_log(AVLOG_DEBUG, "FTP: %s", line); if(line[3] != ' ') { av_log(AVLOG_ERROR, "FTP: Multiline reply to PASV: %s", line); ftp_close_conn(conn); return -EIO; } res = ftp_get_addrbytes(line, addrbytes); if(res < 0) { av_log(AVLOG_ERROR, "FTP: Bad reply to PASV: %s", line); ftp_close_conn(conn); return -EIO; } port = addrbytes[4] * 0x100 + addrbytes[5]; sprintf(addrbuf, "%i.%i.%i.%i:%i", addrbytes[0], addrbytes[1], addrbytes[2], addrbytes[3], port); *resp = av_strdup(addrbuf); return 0; } static int ftp_open_dataconn(struct ftpconn *conn) { int res; char *line; char *host; res = ftp_write_command(conn, "PASV"); if(res < 0) return res; res = ftp_get_line(conn, &line); if(res < 0) return res; res = ftp_check_passv_reply(conn, line, &host); av_free(line); if(res < 0) return res; av_log(AVLOG_DEBUG,"FTP: remote data address: %s", host); res = av_sock_connect(host, -1); if(res >= 0) av_registerfd(res); av_free(host); return res; } static int ftp_login(struct ftpconn *conn) { int res; char *cmd; cmd = av_stradd(NULL, "USER ", conn->user, NULL); res = ftp_command(conn, cmd); av_free(cmd); if(res == 331) { cmd = av_stradd(NULL, "PASS ", conn->password, NULL); res = ftp_command(conn, cmd); av_free(cmd); if(res < 0) return res; } if(res != 230) return -EACCES; return 0; } static int ftp_init_conn(struct ftpconn *conn) { int res; res = ftp_wait_reply_code(conn); if(res == 120) res = ftp_wait_reply_code(conn); if(res < 0) return res; if(res != 220) return -EIO; res = ftp_login(conn); if(res < 0) return res; ftp_command(conn, "PWD"); ftp_command(conn, "SYST"); return 0; } static int ftp_open_conn(struct ftpconn *conn) { int res; if(conn->sock != -1) { res = ftp_command(conn, "NOOP"); if(res < 0) return res; if(res != 421) return 0; } res = av_sock_connect(conn->host, 21); if(res < 0) return res; conn->sock = res; conn->sockfb = av_filebuf_new(conn->sock, 0); res = ftp_init_conn(conn); if(res < 0) { ftp_close_conn(conn); return res; } return 0; } static void ftp_free_dirlist(struct remdirlist *dl) { int i; for(i = 0; i < dl->num; i++) { av_free(dl->ents[i].name); av_free(dl->ents[i].linkname); } av_free(dl->ents); dl->ents = NULL; dl->num = 0; } static int ftp_read_list(struct filebuf *fb, struct remdirlist *dl, struct lscache *lc) { int res; char *line; int eof = 0; do { res = av_filebuf_getline(fb, &line, FTP_READ_TIMEOUT); if(res < 0) return res; if(res == 0) { av_log(AVLOG_ERROR, "FTP: read timeout"); return -EIO; } if(line == NULL) eof = 1; else { struct avstat stbuf; char *filename; char *linkname; strip_crlf(line); av_log(AVLOG_DEBUG, "FTP: %s", line); res = av_parse_ls(lc, line, &stbuf, &filename, &linkname); av_free(line); if(res == 1) { av_remote_add(dl, filename, linkname, &stbuf); av_free(filename); av_free(linkname); } } } while(!eof); return 0; } static int ftp_set_ascii(struct ftpconn *conn) { int res; if(conn->binary != 0) { res = ftp_command(conn, "TYPE A"); if(res < 0) return res; conn->binary = 0; } return 0; } static int ftp_set_binary(struct ftpconn *conn) { int res; if(conn->binary != 1) { res = ftp_command(conn, "TYPE I"); if(res < 0) return res; conn->binary = 1; } return 0; } static int ftp_set_cwd(struct ftpconn *conn, const char *dir) { int res; char *cmd; if(strcmp(conn->cwd, dir) != 0) { cmd = av_stradd(NULL, "CWD ", dir, NULL); res = ftp_command(conn, cmd); av_free(cmd); if(res < 0) return res; if(res == 550) return -ENOENT; if(res / 100 != 2) return -EIO; av_free(conn->cwd); conn->cwd = av_strdup(dir); } return 0; } static int ftp_do_list(struct ftpconn *conn, const char *dir, struct remdirlist *dl) { int res; char *cmd; int listsock; struct filebuf *fb; struct lscache *lc; res = ftp_open_conn(conn); if(res < 0) return res; res = ftp_set_ascii(conn); if(res < 0) return res; res = ftp_set_cwd(conn, dir); if(res < 0) return res; res = ftp_open_dataconn(conn); if(res < 0) return res; listsock = res; cmd = av_strdup("LIST -al"); res = ftp_command(conn, cmd); av_free(cmd); if(res >= 0 && res / 100 != 1) res = -EIO; if(res < 0) { close(listsock); return res; } fb = av_filebuf_new(listsock, 0); lc = av_new_lscache(); res = ftp_read_list(fb, dl, lc); av_unref_obj(lc); av_unref_obj(fb); res = ftp_wait_reply_code(conn); if(res >= 0 && res / 100 != 2) res = -EIO; if(res < 0) { ftp_free_dirlist(dl); return res; } return 0; } static const char *ftp_get_password(struct ftpdata *ftd, const char *host, const char *user) { struct ftpsession *fts; char *account; account = av_stradd(NULL, user, USER_SEP_STR, host, NULL); fts = ftp_find_session(ftd, account); av_free(account); if(fts == NULL) { account = av_stradd(NULL, user, USER_SEP_STR, NULL); fts = ftp_find_session(ftd, account); av_free(account); } if(fts != NULL) return fts->password; else return NULL; } static int ftp_split_path(struct ftpdata *ftd, char *hostpart, const char **hostp, const char **userp, const char **passp) { char *s, *t; const char *host; const char *user; const char *pass; for(s = hostpart; *s && *s != USER_SEP_CHAR; s++); for(t = s; *t; t++) if (*t == USER_SEP_CHAR) s = t; if(*s != '\0') { *s = '\0'; host = s + 1; user = hostpart; pass = ftp_get_password(ftd, host, user); if(pass == NULL) return -EACCES; } else { host = hostpart; user = "ftp"; pass = "avfs@"; } if(host[0] == '\0') return -ENOENT; *hostp = host; *userp = user; *passp = pass; return 0; } static struct ftpconn *ftp_find_conn(struct ftpdata *ftd, const char *host, const char *user, const char *password) { struct ftpconn *conn; struct ftpconn **cp; for(cp = &ftd->conns; *cp != NULL; cp = &(*cp)->next) { conn = *cp; if(strcmp(conn->host, host) == 0 && strcmp(conn->user, user) == 0 && strcmp(conn->password, password) == 0 && !conn->busy) { conn->busy = 1; return conn; } } AV_NEW(conn); conn->host = av_strdup(host); conn->user = av_strdup(user); conn->password = av_strdup(password); conn->busy = 1; conn->sock = -1; conn->sockfb = NULL; conn->next = NULL; conn->binary = -1; conn->cwd = av_strdup(""); *cp = conn; return conn; } static int ftp_get_conn(struct ftpdata *ftd, const char *userhost, struct ftpconn **resp) { int res; char *tmps; const char *host; const char *user; const char *password; struct ftpconn *conn = NULL; AV_LOCK(ftp_lock); tmps = av_strdup(userhost); res = ftp_split_path(ftd, tmps, &host, &user, &password); if(res == 0) conn = ftp_find_conn(ftd, host, user, password); av_free(tmps); AV_UNLOCK(ftp_lock); if(res < 0) return res; *resp = conn; return 0; } static int ftp_list(struct remote *rem, struct remdirlist *dl) { int res; struct ftpdata *ftd = (struct ftpdata *) rem->data; struct ftpconn *conn; res = ftp_get_conn(ftd, dl->hostpath.host, &conn); if(res < 0) return res; res = ftp_do_list(conn, dl->hostpath.path, dl); ftp_release_conn(conn); return res; } static void ftp_free_localfile(struct ftplocalfile *lf) { if(lf->conn != NULL) { ftp_close_conn(lf->conn); ftp_release_conn(lf->conn); } av_unref_obj(lf->sockfb); close(lf->sock); close(lf->fd); } static int ftp_init_localfile(struct ftplocalfile *lf, int sock) { int res; lf->fd = -1; lf->tmpfile = NULL; lf->sock = sock; lf->sockfb = NULL; lf->numbytes = 0; lf->conn = NULL; res = av_get_tmpfile(&lf->tmpfile); if(res < 0) return res; lf->fd = open(lf->tmpfile, O_RDWR | O_CREAT | O_TRUNC | O_APPEND, 0600); if(lf->fd == -1) return -errno; lf->sockfb = av_filebuf_new(lf->sock, 0); return 0; } static int ftp_do_get(struct remgetparam *gp, const char *dir, const char *file, struct ftpconn *conn) { int res; int getsock; char *cmd; struct ftplocalfile *lf; res = ftp_open_conn(conn); if(res < 0) return res; res = ftp_set_binary(conn); if(res < 0) return res; res = ftp_set_cwd(conn, dir); if(res < 0) return res; res = ftp_open_dataconn(conn); if(res < 0) return res; getsock = res; cmd = av_stradd(NULL, "RETR ", file, NULL); res = ftp_command(conn, cmd); av_free(cmd); if(res >= 0 && res / 100 != 1) res = -EIO; if(res < 0) { close(getsock); return res; } AV_NEW_OBJ(lf, ftp_free_localfile); res = ftp_init_localfile(lf, getsock); if(res < 0) { av_unref_obj(lf); av_del_tmpfile(lf->tmpfile); return res; } lf->conn = conn; gp->data = lf; gp->localname = lf->tmpfile; return 0; } static int ftp_get(struct remote *rem, struct remgetparam *gp) { int res; struct ftpdata *ftd = (struct ftpdata *) rem->data; struct ftpconn *conn; char *dir; char *s; char *file; res = ftp_get_conn(ftd, gp->hostpath.host, &conn); if(res < 0) return res; dir = av_strdup(gp->hostpath.path); s = strrchr(dir, '/'); *s = '\0'; file = s + 1; res = ftp_do_get(gp, ( dir[0] == '\0' ) ? "/" : dir, file, conn); av_free(dir); if(res < 0) ftp_release_conn(conn); return res; } static int ftp_write_localfile(int fd, char *buf, avsize_t nbytes) { int res; res = write(fd, buf, nbytes); if(res == -1) { av_log(AVLOG_ERROR, "FTP: error writing to tmpfile: %s", strerror(errno)); return -EIO; } if(res != nbytes) { av_log(AVLOG_ERROR, "FTP: short write to tmpfile (%i/%i)", res, nbytes); return -EIO; } return 0; } #define READBUF 4096 static int ftp_wait(struct remote *rem, void *data, avoff_t end) { int res; struct ftplocalfile *lf = (struct ftplocalfile *) data; char buf[READBUF]; avsize_t nbytes; do { nbytes = av_filebuf_read(lf->sockfb, buf, READBUF); if(nbytes != 0) { res = ftp_write_localfile(lf->fd, buf, nbytes); if(res < 0) return res; lf->numbytes += nbytes; } else { if(av_filebuf_eof(lf->sockfb)) { av_unref_obj(lf->sockfb); lf->sockfb = NULL; close(lf->sock); lf->sock = -1; res = ftp_wait_reply_code(lf->conn); if(res >= 0 && res / 100 != 2) res = -EIO; if(res < 0) return res; ftp_release_conn(lf->conn); lf->conn = NULL; return 0; } else { res = av_filebuf_check(&lf->sockfb, 1, FTP_READ_TIMEOUT); if(res < 0) return res; if(res == 0) { av_log(AVLOG_ERROR, "FTP: read timeout"); return -EIO; } } } } while(lf->numbytes < end); return 1; } static int ftp_password_set(struct entry *ent, const char *param, const char *val) { struct ftpsession *fts; struct statefile *sf = (struct statefile *) av_namespace_get(ent); struct ftpdata *ftd = (struct ftpdata *) sf->data; unsigned int len; AV_LOCK(ftp_lock); fts = ftp_get_session(ftd, param); av_free(fts->password); fts->password = av_strdup(val); len = strlen(fts->password); if(len > 0) { if(fts->password[len - 1] == '\n') fts->password[len - 1] = '\0'; } AV_UNLOCK(ftp_lock); return 0; } static int ftp_loggedin_get(struct entry *ent, const char *param, char **resp) { struct ftpsession *fts; struct statefile *sf = (struct statefile *) av_namespace_get(ent); struct ftpdata *ftd = (struct ftpdata *) sf->data; AV_LOCK(ftp_lock); fts = ftp_find_session(ftd, param); if(fts == NULL) *resp = av_strdup("0\n"); else *resp = av_strdup("1\n"); AV_UNLOCK(ftp_lock); return 0; } static int ftp_loggedin_val(const char *val, int *resp) { char *end; int ival; ival = strtol(val, &end, 10); if(end == val) return -EINVAL; if(*end == '\n') end++; if(*end != '\0') return -EINVAL; if(ival < 0 || ival > 1) return -EINVAL; *resp = ival; return 0; } static int ftp_loggedin_set(struct entry *ent, const char *param, const char *val) { int res; struct ftpsession *fts; struct statefile *sf = (struct statefile *) av_namespace_get(ent); struct ftpdata *ftd = (struct ftpdata *) sf->data; AV_LOCK(ftp_lock); fts = ftp_find_session(ftd, param); if(fts == NULL) res = -EACCES; else { int ival; res = ftp_loggedin_val(val, &ival); if(res == 0 && ival == 0) { /* FIXME: end connections using this session */ ftp_remove_session(fts); } } AV_UNLOCK(ftp_lock); return res; } static int ftp_init_ctl(struct vmodule *module, struct ftpdata *ftd) { int res; struct namespace *ns; struct statefile *stf; struct entry *ent; struct avfs *avfs; res = av_state_new(module, "ftp_ctl", &ns, &avfs); if(res < 0) return res; ent = av_namespace_lookup(ns, NULL, "password"); AV_NEW(stf); stf->data = ftd; stf->get = NULL; stf->set = ftp_password_set; av_namespace_set(ent, stf); ent = av_namespace_lookup(ns, NULL, "loggedin"); AV_NEW(stf); stf->data = ftd; stf->get = ftp_loggedin_get; stf->set = ftp_loggedin_set; av_namespace_set(ent, stf); av_unref_obj(ns); return 0; } static void ftp_destroy(struct remote *rem) { struct ftpdata *ftd = (struct ftpdata *) rem->data; struct ftpconn *conn; struct ftpconn *nextconn; for(conn = ftd->conns; conn != NULL; conn = nextconn) { nextconn = conn->next; ftp_close_conn(conn); av_free(conn->host); av_free(conn->user); av_free(conn->password); av_free(conn->cwd); av_free(conn); conn = nextconn; } AV_LOCK(ftp_lock); while(ftd->sessions.next != &ftd->sessions) ftp_remove_session(ftd->sessions.next); AV_UNLOCK(ftp_lock); av_free(ftd); av_free(rem->name); av_free(rem); } extern int av_init_module_ftp(struct vmodule *module); int av_init_module_ftp(struct vmodule *module) { int res; struct remote *rem; struct ftpdata *ftd; struct avfs *avfs; AV_NEW(ftd); ftd->conns = NULL; ftd->sessions.next = &ftd->sessions; ftd->sessions.prev = &ftd->sessions; AV_NEW(rem); rem->data = ftd; rem->flags = REM_DIR_ONLY; rem->name = av_strdup("ftp"); rem->list = ftp_list; rem->get = ftp_get; rem->wait = ftp_wait; rem->destroy = ftp_destroy; res = av_remote_init(module, rem, &avfs); if(res == 0) { res = ftp_init_ctl(module, ftd); if(res < 0) av_unref_obj(avfs); } return res; } avfs-1.1.4/modules/floppy.c0000644000175000001440000002171014032341001012503 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. FLOPPY module (interface for mtools) */ #include "remote.h" #include "runprog.h" #include #include struct floppylocalfile { char *tmpfile; struct program *pr; avoff_t currsize; }; static void strip_spaces(const char *buf, int *ip) { int i = *ip; while(isspace((unsigned char) buf[i])) i++; *ip = i; } static void strip_nonspace(const char *buf, int *ip) { int i = *ip; while(!isspace((unsigned char) buf[i])) i++; *ip = i; } static void strip_spaces_end(char *buf) { unsigned int i = strlen(buf); while(i > 0 && isspace((unsigned char) buf[i-1])) i--; buf[i] = '\0'; } static int get_num(const char *s, int *ip) { int i; int num; i = *ip; if(s[i] < '0' || s[i] > '9') return -1; num = 0; for(;; i++) { if(s[i] >= '0' && s[i] <= '9') num = (num * 10) + (s[i] - '0'); else if(s[i] != ',' && s[i] != '.') break; } *ip = i; return num; } static int conv_date(const char *s, struct avtm *tms) { int num; int i; i = 0; if((num = get_num(s, &i)) == -1 || num < 1 || num > 12) return -1; tms->mon = num - 1; i++; if((num = get_num(s, &i)) == -1 || num < 1 || num > 31) return -1; tms->day = num; i++; if((num = get_num(s, &i)) == -1) return -1; if(num >= 80 && num < 100) num += 1900; else if(num >= 0 && num < 80) num += 2000; if(num < 1900) return -1; tms->year = num - 1900; return 0; } static int conv_time(const char *s, struct avtm *tms) { int num; int i; i = 0; if((num = get_num(s, &i)) == -1 || num < 0) return -1; tms->hour = num; i++; if((num = get_num(s, &i)) == -1 || num < 0 || num > 59) return -1; tms->min = num; if(s[i] == ':') { i++; if((num = get_num(s, &i)) == -1 || num < 0 || num > 59) return -1; tms->sec = num; } else tms->sec = 0; if((s[i] == 'p' || s[i] == 'P') && tms->hour < 12) tms->hour += 12; if(tms->hour > 24) return -1; if(tms->hour == 24) tms->hour = 0; return 0; } static int process_vollabel(const char *buf, struct avstat *st, char **namep) { *namep = av_stradd(NULL, ".vol-", buf + 22, NULL); strip_spaces_end(*namep); st->mode = AV_IFREG | 0444; st->size = 0; return 0; } static int process_dir_line(const char *buf, int vollabel, struct avstat *st, char **namep) { int i, start; int namelen; struct avtm tms; char shortname[32]; i = 0; if(strncmp(buf, " Volume in drive ", 17) == 0 && buf[17] && strncmp(buf+18, " is ", 4) == 0 && buf[22]) { if(vollabel) return process_vollabel(buf, st, namep); else return -1; } strip_nonspace(buf, &i); if(!buf[i] || i == 0 || i > 8) return -1; namelen = i; strncpy(shortname, buf, namelen); shortname[namelen] = '\0'; strip_spaces(buf, &i); if(i == 9) { int extlen; strip_nonspace(buf, &i); extlen = i - 9; if(extlen > 3) return -1; shortname[namelen++] = '.'; strncpy(shortname+namelen, buf+9, extlen); namelen += extlen; shortname[namelen] = '\0'; strip_spaces(buf, &i); } if(!buf[i] || i < 13) return -1; start = i; strip_nonspace(buf, &i); if(strncmp("", buf + start, i - start) == 0) { st->size = 0; st->mode = AV_IFDIR | 0777; } else { int size; if((size = get_num(buf, &start)) == -1) return -1; st->size = size; st->mode = AV_IFREG | 0666; } strip_spaces(buf, &i); if(!buf[i]) return -1; start = i; strip_nonspace(buf, &i); if(conv_date(buf + start, &tms) == -1) return -1; strip_spaces(buf, &i); if(!buf[i]) return -1; start = i; strip_nonspace(buf, &i); if(conv_time(buf + start, &tms) == -1) return -1; strip_spaces(buf, &i); st->mtime.sec = av_mktime(&tms); st->mtime.nsec = 0; if(buf[i]) { *namep = av_strdup(buf+i); strip_spaces_end(*namep); } else *namep = av_strdup(shortname); return 0; } static void floppy_parse_line(const char *line, struct remdirlist *dl) { int res; char *filename; struct avstat stbuf; int vollabel; if(strcmp(dl->hostpath.path, "/") == 0) vollabel = 1; else vollabel = 0; av_default_stat(&stbuf); res = process_dir_line(line, vollabel, &stbuf, &filename); if(res != 0) return; stbuf.nlink = 1; stbuf.blksize = 512; stbuf.blocks = AV_BLOCKS(stbuf.size); stbuf.atime = stbuf.mtime; stbuf.ctime = stbuf.mtime; av_remote_add(dl, filename, NULL, &stbuf); av_free(filename); } static int floppy_read_list(struct program *pr, struct remdirlist *dl) { int res; while(1) { char *line; res = av_program_getline(pr, &line, -1); if(res <= 0) return res; if(line == NULL) return 0; floppy_parse_line(line, dl); av_free(line); } } static int floppy_get_path(struct remote *rem, struct remhostpath *hp, char **resp) { char drive[2]; char *alias = (char *) rem->data; if(alias != NULL) drive[0] = alias[0]; else { if(strlen(hp->host) != 1) return -ENOENT; drive[0] = tolower((unsigned char) hp->host[0]); if(drive[0] < 'a' || drive[0] > 'z') return -ENOENT; } drive[1] = '\0'; *resp = av_stradd(NULL, drive, ":", hp->path, NULL); return 0; } static int floppy_list(struct remote *rem, struct remdirlist *dl) { int res; struct program *pr; const char *prog[4]; char *path; res = floppy_get_path(rem, &dl->hostpath, &path); if(res < 0) return res; prog[0] = "mdir"; prog[1] = "-a"; prog[2] = path; prog[3] = NULL; res = av_start_program(prog, &pr); if(res == 0) { res = floppy_read_list(pr, dl); av_unref_obj(pr); } av_free(path); return res; } static void floppy_free_localfile(struct floppylocalfile *lf) { if(lf->pr != NULL) { av_program_log_output(lf->pr); av_unref_obj(lf->pr); } } static int floppy_get(struct remote *rem, struct remgetparam *gp) { int res; struct floppylocalfile *lf; char *tmpfile; const char *prog[4]; char *path; res = floppy_get_path(rem, &gp->hostpath, &path); if(res < 0) return res; res = av_get_tmpfile(&tmpfile); if(res < 0) { av_free(path); return res; } if(strncmp(gp->hostpath.path, "/.vol-", 6) == 0) { av_free(path); open(tmpfile, O_WRONLY | O_CREAT | O_TRUNC, 0600); gp->data = NULL; gp->localname = tmpfile; return 0; } AV_NEW_OBJ(lf, floppy_free_localfile); lf->pr = NULL; lf->tmpfile = tmpfile; prog[0] = "mcopy"; prog[1] = path; prog[2] = lf->tmpfile; prog[3] = NULL; res = av_start_program(prog, &lf->pr); av_free(path); if(res < 0) { av_unref_obj(lf); av_del_tmpfile(tmpfile); return res; } lf->currsize = 0; gp->data = lf; gp->localname = lf->tmpfile; return 1; } static int floppy_wait(struct remote *rem, void *data, avoff_t end) { int res; struct floppylocalfile *lf = (struct floppylocalfile *) data; /* FIXME: timeout? */ do { struct stat stbuf; res = av_program_log_output(lf->pr); if(res <= 0) return res; res = stat(lf->tmpfile, &stbuf); if(res == 0) lf->currsize = stbuf.st_size; if(lf->currsize < end) av_sleep(250); } while(lf->currsize < end); return 1; } static void floppy_destroy(struct remote *rem) { av_free(rem->name); av_free(rem->data); av_free(rem); } static int floppy_init(struct vmodule *module, const char *modname, const char *alias) { int res; struct remote *rem; struct avfs *avfs; AV_NEW(rem); /* FIXME: Dont cache (at least not for long) */ rem->flags = REM_DIR_ONLY | REM_NOCASE; rem->data = av_strdup(alias); rem->name = av_strdup(modname); rem->destroy = floppy_destroy; rem->list = floppy_list; rem->get = floppy_get; rem->wait = floppy_wait; res = av_remote_init(module, rem, &avfs); return res; } extern int av_init_module_floppy(struct vmodule *module); int av_init_module_floppy(struct vmodule *module) { int res; res = floppy_init(module, "floppy", NULL); if(res < 0) return res; res = floppy_init(module, "a", "a"); if(res < 0) return res; return 0; } avfs-1.1.4/modules/http.c0000644000175000001440000003370614032341001012161 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" #include "version.h" #include "cache.h" #include "filebuf.h" #include "socket.h" #include "serialfile.h" #include "internal.h" #include #include #define HTTP_READ_TIMEOUT 20000 struct httpentry; struct httplocalfile { struct filebuf *sockfb; struct httpentry *ent; }; struct httpentry { char *url; struct cacheobj *cobj; avoff_t size; struct httpentry *next; }; struct httpfs { struct httpentry *ents; char *proxyname; }; struct httpfile { struct httpfs *fs; struct httpentry *ent; }; static int write_socket(int sock, const char *buf, avsize_t buflen) { int res; while(buflen > 0) { res = write(sock, buf, buflen); if(res == -1) return -errno; buf += res; buflen -= res; } return 0; } static void strip_crlf(char *line) { avsize_t len = strlen(line); if(len > 0 && line[len-1] == '\n') { if(len > 1 && line[len-2] == '\r') line[len-2] = '\0'; else line[len-1] = '\0'; } } static int http_get_line(struct httplocalfile *lf, char **linep) { int res; char *line; while(1) { res = av_filebuf_readline(lf->sockfb, &line); if(res < 0) return res; if(res == 1) break; if(av_filebuf_eof(lf->sockfb)) { av_log(AVLOG_ERROR, "HTTP: connection closed in header"); return -EIO; } res = av_filebuf_check(&lf->sockfb, 1, HTTP_READ_TIMEOUT); if(res < 0) return res; if(res == 0) { av_log(AVLOG_ERROR, "HTTP: timeout in header"); return -EIO; } } strip_crlf(line); av_log(AVLOG_DEBUG, "HTTP: %s", line); *linep = line; return 0; } static char *http_split_header(char *line) { char *s; for(s = line; *s && !isspace((unsigned char) *s); s++); if(*s) { do { *s = '\0'; s++; } while(isspace((unsigned char) *s)); } return s; } static void http_process_header_line(struct httplocalfile *lf, char *line) { char *s; s = http_split_header(line); if(strcasecmp("content-length:", line) == 0) { char *end; avoff_t size; size = strtol(s, &end, 10); while(*end && isspace((unsigned char) *end)) end++; if(!*end) lf->ent->size = size; } } static int http_check_header_line(struct httplocalfile *lf) { int res; char *line; res = http_get_line(lf, &line); if(res < 0) return res; if(line[0] == '\0') res = 0; else { http_process_header_line(lf, line); res = 1; } av_free(line); return res; } static int http_ignore_header(struct httplocalfile *lf) { int res; char *line; int end = 0; do { res = http_get_line(lf, &line); if(res < 0) return res; if(line[0] == '\0') end = 1; av_free(line); } while(!end); return 0; } static int http_process_status_line(struct httplocalfile *lf, char *line) { const char *s; int statuscode; int res; for(s = line; *s && *s != ' '; s++); if(s[0] != ' ' || !isdigit((unsigned char) s[1]) || !isdigit((unsigned char) s[2]) || !isdigit((unsigned char) s[3])) { av_log(AVLOG_ERROR, "HTTP: bad status code: %s", s); return -EIO; } statuscode = (s[1] - '0') * 100 + (s[2] - '0') * 10 + (s[3] - '0'); av_log(AVLOG_DEBUG, "HTTP: status code: %i", statuscode); if(statuscode / 100 == 1) { res = http_ignore_header(lf); if(res < 0) return res; return 0; } if(statuscode / 100 == 2) return 1; av_log(AVLOG_WARNING, "HTTP: error: %s", s); http_ignore_header(lf); if(statuscode / 100 == 3 || statuscode / 100 == 4) return -ENOENT; return -EIO; } static int http_check_status_line(struct httplocalfile *lf) { int res; char *line; do { res = http_get_line(lf, &line); if(res < 0) return res; res = http_process_status_line(lf, line); av_free(line); } while(res == 0); if(res < 0) return res; return 0; } static int http_wait_response(struct httplocalfile *lf) { int res; res = http_check_status_line(lf); if(res < 0) return res; do res = http_check_header_line(lf); while(res == 1); return res; } static const char *http_strip_resource_type(const char *url) { const char *s; for(s = url; *s && *s != ':'; s++); if(*s) s++; for(; *s == '/'; s++); return s; } static char *http_url_path(const char *url) { const char *s; s = http_strip_resource_type(url); s = strchr(s, '/'); if(s == NULL) return av_strdup("/"); else return av_strdup(s); } static char *http_url_host(const char *url) { const char *s; const char *t; s = http_strip_resource_type(url); t = strchr(s, '/'); if(t == NULL) return av_strdup(s); else return av_strndup(s, t - s); } static int http_request_get(int sock, struct httpfile *fil) { int res; char *req; char *url; char *host; if(fil->fs->proxyname != NULL) url = av_strdup(fil->ent->url); else url = http_url_path(fil->ent->url); host = http_url_host(fil->ent->url); req = av_stradd(NULL, "GET ", url, " HTTP/1.1\r\n", "Host: ", host, "\r\n" "Connection: close\r\n" "\r\n", NULL); av_free(url); av_free(host); av_log(AVLOG_DEBUG, "HTTP: %s", req); res = write_socket(sock, req, strlen(req)); av_free(req); return res; } static void http_stop(struct httplocalfile *lf) { av_unref_obj(lf->sockfb); } static int http_start(void *data, void **resp) { int res; int sock; int defaultport; char *host; struct httpfile *fil = (struct httpfile *) data; struct httplocalfile *lf; if(fil->fs->proxyname != NULL) { host = av_strdup(fil->fs->proxyname); defaultport = 8000; } else { host = http_url_host(fil->ent->url); defaultport = 80; } res = av_sock_connect(host, defaultport); av_free(host); if(res < 0) return res; sock = res; av_registerfd(sock); res = http_request_get(sock, fil); if(res < 0) { close(sock); return res; } fil->ent->size = -1; AV_NEW_OBJ(lf, http_stop); lf->sockfb = av_filebuf_new(sock, 0); lf->ent = fil->ent; res = http_wait_response(lf); if(res < 0) { av_unref_obj(lf); return res; } *resp = lf; return 0; } static avssize_t http_sread(void *data, char *buf, avsize_t nbyte) { avssize_t res; struct httplocalfile *lf = (struct httplocalfile *) data; do { res = av_filebuf_read(lf->sockfb, buf, nbyte); if(res != 0) return res; if(av_filebuf_eof(lf->sockfb)) return 0; res = av_filebuf_check(&lf->sockfb, 1, HTTP_READ_TIMEOUT); if(res < 0) return res; } while(res == 1); av_log(AVLOG_ERROR, "HTTP: timeout in body"); return -EIO; } static struct sfile *http_get_serialfile(struct httpfile *fil) { struct sfile *sf; struct httpfile *filcpy; struct httpentry *ent = fil->ent; static struct sfilefuncs func = { http_start, http_sread }; sf = (struct sfile *) av_cacheobj_get(ent->cobj); if(sf != NULL) return sf; AV_NEW_OBJ(filcpy, NULL); *filcpy = *fil; sf = av_sfile_new(&func, filcpy, 0); av_unref_obj(ent->cobj); ent->cobj = av_cacheobj_new(sf, ent->url); return sf; } static void http_set_size(struct httpfile *fil, struct sfile *sf) { struct httpentry *ent = fil->ent; avoff_t du; du = av_sfile_diskusage(sf); if(du >= 0) av_cacheobj_setsize(ent->cobj, du); } static struct httpentry *http_get_entry(struct httpfs *fs, const char *url) { struct httpentry **ep; struct httpentry *ent; for(ep = &fs->ents; *ep != NULL; ep = &(*ep)->next) { ent = *ep; if(strcmp(ent->url, url) == 0) return ent; } AV_NEW(ent); ent->url = av_strdup(url); ent->cobj = NULL; ent->next = NULL; *ep = ent; return ent; } static int begins_with(const char *str, const char *beg) { if(strncmp(str, beg, strlen(beg)) == 0) return 1; else return 0; } static char *http_ventry_url(ventry *ve) { char *url = av_strdup((char *) ve->data); char *s; for(s = url; *s; s++) { if(*s == '|') *s = '/'; } if(!begins_with(url, "http://") && !begins_with(url, "ftp://")) { char *newurl; newurl = av_stradd(NULL, "http://", url, NULL); av_free(url); url = newurl; } return url; } static int http_open(ventry *ve, int flags, avmode_t mode, void **resp) { int res; char *url; struct httpfs *fs = (struct httpfs *) ve->mnt->avfs->data; struct httpfile *fil; struct sfile *sf; url = http_ventry_url(ve); if(url == NULL) return -ENOENT; AV_NEW(fil); fil->ent = http_get_entry(fs, url); fil->fs = fs; av_free(url); sf = http_get_serialfile(fil); res = av_sfile_startget(sf); http_set_size(fil, sf); av_unref_obj(sf); if(res == 0) *resp = (void *) fil; else av_free(fil); return res; } static int http_close(vfile *vf) { struct httpfile *fil = (struct httpfile *) vf->data; av_free(fil); return 0; } static avssize_t http_read(vfile *vf, char *buf, avsize_t nbyte) { avssize_t res; struct httpfile *fil = (struct httpfile *) vf->data; struct sfile *sf; sf = http_get_serialfile(fil); res = av_sfile_pread(sf, buf, nbyte, vf->ptr); http_set_size(fil, sf); av_unref_obj(sf); if(res > 0) vf->ptr += res; return res; } static int http_getattr(vfile *vf, struct avstat *buf, int attrmask) { avoff_t size = -1; struct httpfile *fil = (struct httpfile *) vf->data; if(attrmask & AVA_SIZE) { int res; struct sfile *sf; sf = http_get_serialfile(fil); res = av_sfile_startget(sf); if(res < 0) return res; size = fil->ent->size; if(size == -1) size = av_sfile_size(sf); http_set_size(fil, sf); av_unref_obj(sf); } buf->dev = 1; buf->ino = 1; buf->mode = AV_IFREG | 0777; buf->nlink = 1; buf->uid = 0; buf->gid = 0; buf->size = size; buf->blksize = 512; buf->blocks = AV_BLOCKS(size); buf->atime.sec = 0; buf->atime.nsec = 0; buf->mtime = buf->atime; buf->ctime = buf->atime; return 0; } static int http_access(ventry *ve, int amode) { if((amode & AVW_OK) != 0) return -EACCES; return 0; } static void http_destroy(struct avfs *avfs) { struct httpentry *ent; struct httpentry *nextent; struct httpfs *fs = (struct httpfs *) avfs->data; ent = fs->ents; while(ent != NULL) { nextent = ent->next; av_free(ent->url); av_unref_obj(ent->cobj); av_free(ent); ent = nextent; } av_free(fs->proxyname); av_free(fs); } static int http_proxy_get(struct entry *ent, const char *param, char **retp) { struct statefile *sf = (struct statefile *) av_namespace_get(ent); struct avfs *avfs = (struct avfs *) sf->data; struct httpfs *fs = (struct httpfs *) avfs->data; char *s; AV_LOCK(avfs->lock); if(fs->proxyname != NULL) s = av_stradd(NULL, fs->proxyname, "\n", NULL); else s = av_strdup(""); AV_UNLOCK(avfs->lock); *retp = s; return 0; } static int http_proxy_set(struct entry *ent, const char *param, const char *val) { struct statefile *sf = (struct statefile *) av_namespace_get(ent); struct avfs *avfs = (struct avfs *) sf->data; struct httpfs *fs = (struct httpfs *) avfs->data; char *s; unsigned int len; if(begins_with(val, "http://")) val = http_strip_resource_type(val); s = av_strdup(val); len = strlen(s); if(len > 0 && s[len-1] == '\n') s[len-1] = '\0'; if(s[0] == '\0') { av_free(s); s = NULL; } AV_LOCK(avfs->lock); av_free(fs->proxyname); fs->proxyname = s; AV_UNLOCK(avfs->lock); return 0; } static void http_default_proxy(struct httpfs *fs) { const char *proxyenv; proxyenv = getenv("http_proxy"); if(proxyenv == NULL) return; if(begins_with(proxyenv, "http://")) proxyenv = http_strip_resource_type(proxyenv); fs->proxyname = av_strdup(proxyenv); av_log(AVLOG_DEBUG, "HTTP: proxy = %s", fs->proxyname); } extern int av_init_module_http(struct vmodule *module); int av_init_module_http(struct vmodule *module) { int res; struct avfs *avfs; struct httpfs *fs; struct statefile statf; res = av_new_avfs("http", NULL, AV_VER, AVF_ONLYROOT, module, &avfs); if(res < 0) return res; AV_NEW(fs); fs->ents = NULL; fs->proxyname = NULL; http_default_proxy(fs); statf.get = http_proxy_get; statf.set = http_proxy_set; statf.data = avfs; av_avfsstat_register("http_proxy", &statf); avfs->data = (void *) fs; avfs->destroy = http_destroy; avfs->open = http_open; avfs->close = http_close; avfs->getattr = http_getattr; avfs->read = http_read; avfs->access = http_access; av_add_avfs(avfs); return 0; } avfs-1.1.4/modules/Makefile.am0000644000175000001440000000165514032341001013070 00000000000000AM_CFLAGS = -I$(top_srcdir)/include @CFLAGS@ @CPPFLAGS@ noinst_LTLIBRARIES = libmodules.la EXTRA_DIST = make_initmod libmodules_la_LDFLAGS = -module modules = \ volatile.c \ rsh.c \ http.c \ ftp.c \ ugz.c \ ubz2.c \ ugzip.c \ ubzip2.c \ gz.c \ bz2.c \ uz.c \ uar.c \ utar.c \ urar.c \ uzip.c \ floppy.c \ extfs.c \ ucftp.c \ uxze.c \ uzstde.c if USE_LIBLZMA modules += uxz.c endif if USE_LIBZSTD modules += uzstd.c endif if USE_LIBLZIP modules += ulzip.c endif libmodules_la_SOURCES = \ $(modules) if BUILD_DAVSUPPORT modules += dav.c libmodules_la_SOURCES += dav_ls.c endif nodist_libmodules_la_SOURCES = \ mod_static.c noinst_HEADERS = \ dav.h \ gtar.h \ zipconst.h mod_static.c: make_initmod $(srcdir)/make_initmod $(modules) > mod_static.c CLEANFILES = mod_static.c avfs-1.1.4/modules/extfs.c0000644000175000001440000002660714032341001012335 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi Copyright (C) 2006 Ralf Hoffmann (ralf@boomerangsworld.de) This program can be distributed under the terms of the GNU GPL. See the file COPYING. EXTFS module This module is partly based on the 'extfs.c' module of Midnight Commander VFS, by Jakub Jelinek and Pavel Machek. */ #include "archive.h" #include "version.h" #include "filebuf.h" #include "parsels.h" #include "realfile.h" #include "runprog.h" #include "filecache.h" #include "cache.h" #include "exit.h" #include "tmpfile.h" #include #include struct extfsdata { int needbase; char *progpath; }; struct extfsnode { char *fullpath; avmutex lock; }; struct extfscacheentry { char *tmpfile; }; struct extfsfile { struct extfscacheentry *cent; int fd; }; static void extfscacheentry_delete(struct extfscacheentry *cent) { if( cent->tmpfile != NULL ) { av_del_tmpfile(cent->tmpfile); } } static void fill_extfs_link(struct archive *arch, struct entry *ent, char *linkname) { struct entry *link; struct archnode *nod = NULL; link = av_arch_resolve(arch, linkname, 0, 0); if(link != NULL) nod = (struct archnode *) av_namespace_get(link); if(nod == NULL || AV_ISDIR(nod->st.mode)) av_log(AVLOG_WARNING, "EXTFS: Illegal hard link"); else { nod->st.nlink ++; av_namespace_set(ent, nod); av_ref_obj(ent); av_ref_obj(nod); } av_unref_obj(link); } static void extfsnode_delete(struct extfsnode *enod) { av_free(enod->fullpath); AV_FREELOCK(enod->lock); } static void fill_extfs_node(struct archive *arch, struct entry *ent, struct avstat *stbuf, char *path, char *linkname) { struct archnode *nod; struct extfsnode *enod; char *s; nod = av_arch_new_node(arch, ent, AV_ISDIR(stbuf->mode)); stbuf->dev = nod->st.dev; stbuf->ino = nod->st.ino; stbuf->nlink = nod->st.nlink; nod->st = *stbuf; nod->offset = 0; nod->realsize = 0; AV_NEW_OBJ(enod, extfsnode_delete); AV_INITLOCK(enod->lock); nod->data = enod; /* Fullpath should be without leading slashes */ for(s = path; *s && *s == '/'; s++); enod->fullpath = av_strdup(s); if(AV_ISLNK(stbuf->mode)) nod->linkname = av_strdup(linkname); } static void insert_extfs_entry(struct archive *arch, struct avstat *stbuf, char *path, char *linkname) { struct entry *ent; if(!path[0]) return; ent = av_arch_create(arch, path, 0); if(ent == NULL) return; /* if linkname is not null but mode is not a link then this should be a hard link */ if(linkname != NULL && !AV_ISLNK(stbuf->mode)) fill_extfs_link(arch, ent, linkname); else fill_extfs_node(arch, ent, stbuf, path, linkname); av_unref_obj(ent); } static void parse_extfs_line(struct lscache *lc, char *line, struct archive *arch) { int res; char *filename; char *linkname; struct avstat stbuf; res = av_parse_ls(lc, line, &stbuf, &filename, &linkname); if(res != 1) return; insert_extfs_entry(arch, &stbuf, filename, linkname); av_free(filename); av_free(linkname); } static int read_extfs_list(struct program *pr, struct lscache *lc, struct archive *arch) { int res; while(1) { char *line; res = av_program_getline(pr, &line, -1); if(res <= 0) return res; if(line == NULL) return 0; parse_extfs_line(lc, line, arch); av_free(line); } } static int extfs_list(void *data, ventry *ve, struct archive *arch) { int res; const char *prog[4]; struct realfile *rf; struct program *pr; struct extfsdata *info = (struct extfsdata *) data; if(info->needbase) { res = av_get_realfile(ve->mnt->base, &rf); if(res < 0) return res; } else rf = NULL; prog[0] = info->progpath; prog[1] = "list"; prog[2] = rf == NULL ? NULL : rf->name; prog[3] = NULL; res = av_start_program(prog, &pr); if(res == 0) { struct lscache *lc = av_new_lscache(); res = read_extfs_list(pr, lc, arch); av_unref_obj(lc); av_unref_obj(pr); } av_unref_obj(rf); return res; } static int get_key_for_node(ventry *ve, struct archfile *fil, char **resp) { struct extfsnode *enod = (struct extfsnode *) fil->nod->data; char *key; int res; if(enod == NULL) { return -EISDIR; } res = av_filecache_getkey(ve, &key); if(res < 0) return res; key = av_stradd(key, "/", enod->fullpath, NULL); *resp = key; return 0; } static int get_extfs_file(ventry *ve, struct archfile *fil, const char *tmpfile) { int res; struct archparams *ap = (struct archparams *) ve->mnt->avfs->data; struct extfsdata *info = (struct extfsdata *) ap->data; struct extfsnode *enod = (struct extfsnode *) fil->nod->data; const char *prog[6]; struct realfile *rf; if(enod == NULL) { /* no extfsnode means someone tries to access the extfs archive as a file (e.g. open( "test.lha#" ) ) Although open on a directory is not forbidden we cannot create an appropriate tmpfile so we return EISDIR */ return -EISDIR; } if(info->needbase) { res = av_get_realfile(ve->mnt->base, &rf); if(res < 0) return res; } else rf = NULL; prog[0] = info->progpath; prog[1] = "copyout"; prog[2] = rf == NULL ? "/" : rf->name; prog[3] = enod->fullpath; prog[4] = tmpfile; prog[5] = NULL; res = av_run_program(prog); av_unref_obj(rf); return res; } static struct ext_info *create_exts(char *line) { struct ext_info *exts; char *elist, *newelist; int i, n; while(*line && !isspace((unsigned char) *line)) line++; if(*line) *line++ = '\0'; while(isspace((unsigned char) *line)) line++; elist = line; for(n = 0; *line && *line != '#'; n++) { while(*line && !isspace((unsigned char) *line)) line++; while(isspace((unsigned char) *line)) line++; } if(!n) return NULL; /* No extensions */ exts = av_malloc((n + 1) * sizeof(*exts) + strlen(elist) + 1); newelist = (char *) (&exts[n+1]); strcpy(newelist, elist); for(i = 0; i < n; i++) { exts[i].from = newelist; exts[i].to = NULL; while(*newelist && !isspace((unsigned char) *newelist)) newelist++; if(*newelist) *newelist++ = '\0'; while(isspace((unsigned char) *newelist)) newelist++; } exts[n].from = NULL; exts[n].to = NULL; return exts; } static avssize_t extfs_read(vfile *vf, char *buf, avsize_t nbyte) { avssize_t res; struct archfile *fil = arch_vfile_file(vf); struct extfsfile *efil = (struct extfsfile *) fil->data; if(lseek(efil->fd, vf->ptr, SEEK_SET) == -1) return -errno; res = read(efil->fd, buf, nbyte); if(res == -1) return -errno; vf->ptr += res; return res; } static int extfs_open(ventry *ve, struct archfile *fil) { int res; struct extfsfile *efil; struct extfsnode *enod = (struct extfsnode *) fil->nod->data; int fd; char *key; struct extfscacheentry *cent; /* get key for extfscache */ res = get_key_for_node(ve, fil, &key); if(res < 0) return res; AV_LOCK(enod->lock); cent = av_cache2_get(key); if (cent == NULL) { char *tmpfile; avoff_t tmpsize; /* no entry in cache so create a temporary file... */ res = av_get_tmpfile(&tmpfile); if(res < 0) { av_free(key); AV_UNLOCK(enod->lock); return res; } res = get_extfs_file(ve, fil, tmpfile); if(res < 0) { av_free(key); av_del_tmpfile(tmpfile); AV_UNLOCK(enod->lock); return res; } /* ...create an object to store tmpfile */ AV_NEW_OBJ(cent, extfscacheentry_delete); cent->tmpfile = tmpfile; /* put it in the extfscache */ av_cache2_set(cent,key); AV_UNLOCK(enod->lock); tmpsize = av_tmpfile_blksize(tmpfile); if(tmpsize > 0) av_cache2_setsize(key, tmpsize); } else { AV_UNLOCK(enod->lock); } av_free(key); fd = open(cent->tmpfile, O_RDONLY); if(fd == -1) { res = -errno; av_log(AVLOG_ERROR, "EXTFS: Could not open %s: %s", cent->tmpfile, strerror(errno)); av_unref_obj(cent); return res; } AV_NEW(efil); efil->cent = cent; efil->fd = fd; fil->data = efil; return 0; } static int extfs_close(struct archfile *fil) { struct extfsfile *efil = (struct extfsfile *) fil->data; close(efil->fd); av_unref_obj(efil->cent); av_free(efil); return 0; } static void extfsdata_delete(struct extfsdata *info) { av_free(info->progpath); } static int create_extfs_handler(struct vmodule *module, const char *extfs_dir, char *name) { int res; struct avfs *avfs; struct archparams *ap; struct extfsdata *info; struct ext_info *extlist; int needbase; int end; /* Creates extension list, and strips name of the extensions */ extlist = create_exts(name); end = strlen(name) - 1; if(name[end] == ':') { needbase = 0; name[end] = '\0'; } else needbase = 1; res = av_archive_init(name, extlist, AV_VER, module, &avfs); av_free(extlist); if(res < 0) return res; ap = (struct archparams *) avfs->data; /* FIXME: If there is no basefile then cache the listing forever? */ AV_NEW_OBJ(info, extfsdata_delete); ap->data = info; ap->parse = extfs_list; ap->read = extfs_read; ap->open = extfs_open; ap->close = extfs_close; if(!needbase) ap->flags |= ARF_NOBASE; info->progpath = av_stradd(NULL, extfs_dir, "/", name, NULL); info->needbase = needbase; av_add_avfs(avfs); return 0; } static int extfs_init(struct vmodule *module) { char *extfs_dir, *extfs_conf; struct filebuf *fb; int fd; int res; char *line; char *c; extfs_dir = av_get_config("moduledir"); extfs_dir = av_stradd(extfs_dir, "/extfs", NULL); extfs_conf = av_stradd(NULL, extfs_dir, "/extfs.ini", NULL); fd = open(extfs_conf, O_RDONLY); if(fd == -1) { res = -errno; av_log(AVLOG_WARNING, "Could not open extfs config file %s: %s", extfs_conf, strerror(errno)); av_free(extfs_conf); av_free(extfs_dir); return res; } av_free(extfs_conf); fb = av_filebuf_new(fd, 0); while(1) { res = av_filebuf_getline(fb, &line, -1); if(res < 0 || line == NULL) break; if (*line != '#') { c = line + strlen(line) - 1; if(*c == '\n') *c-- = '\0'; if(*line) res = create_extfs_handler(module, extfs_dir, line); } av_free(line); if(res < 0) break; } av_unref_obj(fb); av_free(extfs_dir); if(res < 0) return res; return 0; } extern int av_init_module_extfs(struct vmodule *module); int av_init_module_extfs(struct vmodule *module) { return extfs_init(module); } avfs-1.1.4/modules/ulzip.c0000644000175000001440000001620314032341001012336 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2021 Ralf Hoffmann This program can be distributed under the terms of the GNU GPL. See the file COPYING. ULZIP module (based on UZSTD module) */ #include "version.h" #include "lzipfile.h" #include "filecache.h" #include "cache.h" #include "oper.h" #include "version.h" struct lzipnode { avmutex lock; struct avstat sig; struct cacheobj *cache; avino_t ino; }; struct lziphandle { struct lzipfile *zfil; vfile *base; struct lzipnode *node; }; static void lzipnode_destroy(struct lzipnode *nod) { av_unref_obj(nod->cache); AV_FREELOCK(nod->lock); } static struct lzipnode *lzip_new_node(ventry *ve, struct avstat *stbuf) { struct lzipnode *nod; AV_NEW_OBJ(nod, lzipnode_destroy); AV_INITLOCK(nod->lock); nod->sig = *stbuf; nod->cache = NULL; nod->ino = av_new_ino(ve->mnt->avfs); return nod; } static int lzip_same(struct lzipnode *nod, struct avstat *stbuf) { if(nod->sig.ino == stbuf->ino && nod->sig.dev == stbuf->dev && nod->sig.size == stbuf->size && AV_TIME_EQ(nod->sig.mtime, stbuf->mtime)) return 1; else return 0; } static struct lzipnode *lzip_do_get_node(ventry *ve, const char *key, struct avstat *stbuf) { static AV_LOCK_DECL(lock); struct lzipnode *nod; AV_LOCK(lock); nod = (struct lzipnode *) av_filecache_get(key); if(nod != NULL) { if(!lzip_same(nod, stbuf)) { av_unref_obj(nod); nod = NULL; } } if(nod == NULL) { nod = lzip_new_node(ve, stbuf); av_filecache_set(key, nod); } AV_UNLOCK(lock); return nod; } static int lzip_getnode(ventry *ve, vfile *base, struct lzipnode **resp) { int res; struct avstat stbuf; const int attrmask = AVA_INO | AVA_DEV | AVA_SIZE | AVA_MTIME; struct lzipnode *nod; char *key; res = av_fgetattr(base, &stbuf, attrmask); if(res < 0) return res; res = av_filecache_getkey(ve, &key); if(res < 0) return res; nod = lzip_do_get_node(ve, key, &stbuf); av_free(key); *resp = nod; return 0; } static struct lzipcache *lzip_getcache(ventry *base, struct lzipnode *nod) { struct lzipcache *cache; cache = (struct lzipcache *) av_cacheobj_get(nod->cache); if(cache == NULL) { int res; char *name; res = av_generate_path(base, &name); if(res < 0) name = NULL; else name = av_stradd(name, "(index)", NULL); cache = av_lzipcache_new(); av_unref_obj(nod->cache); /* FIXME: the cacheobj should only be created when the lzipcache is nonempty */ nod->cache = av_cacheobj_new(cache, name); av_free(name); } return cache; } static int lzip_lookup(ventry *ve, const char *name, void **newp) { char *path = (char *) ve->data; if(path == NULL) { if(name[0] != '\0') return -ENOENT; if(ve->mnt->opts[0] != '\0') return -ENOENT; path = av_strdup(name); } else if(name == NULL) { av_free(path); path = NULL; } else return -ENOENT; *newp = path; return 0; } static int lzip_access(ventry *ve, int amode) { return av_access(ve->mnt->base, amode); } static int lzip_open(ventry *ve, int flags, avmode_t mode, void **resp) { int res; vfile *base; struct lzipnode *nod; struct lziphandle *fil; if(flags & AVO_DIRECTORY) return -ENOTDIR; if(AV_ISWRITE(flags)) return -EROFS; res = av_open(ve->mnt->base, AVO_RDONLY, 0, &base); if(res < 0) return res; res = lzip_getnode(ve, base, &nod); if(res < 0) { av_close(base); return res; } AV_NEW(fil); if((flags & AVO_ACCMODE) != AVO_NOPERM) fil->zfil = av_lzipfile_new(base); else fil->zfil = NULL; fil->base = base; fil->node = nod; *resp = fil; return 0; } static int lzip_close(vfile *vf) { struct lziphandle *fil = (struct lziphandle *) vf->data; av_unref_obj(fil->zfil); av_unref_obj(fil->node); av_close(fil->base); av_free(fil); return 0; } static avssize_t lzip_read(vfile *vf, char *buf, avsize_t nbyte) { avssize_t res; struct lziphandle *fil = (struct lziphandle *) vf->data; struct lzipcache *zc; struct cacheobj *cobj; avoff_t prev_cachesize; AV_LOCK(fil->node->lock); zc = lzip_getcache(vf->mnt->base, fil->node); cobj = fil->node->cache; av_ref_obj(cobj); AV_UNLOCK(fil->node->lock); prev_cachesize = av_lzipcache_size(zc); res = av_lzipfile_pread(fil->zfil, zc, buf, nbyte, vf->ptr); if(res > 0) { avoff_t new_cachesize; vf->ptr += res; new_cachesize = av_lzipcache_size(zc); if (new_cachesize != prev_cachesize) { av_cacheobj_setsize(cobj, new_cachesize); } } else { AV_LOCK(fil->node->lock); av_unref_obj(fil->node->cache); fil->node->cache = NULL; AV_UNLOCK(fil->node->lock); } av_unref_obj(zc); av_unref_obj(cobj); return res; } static int lzip_getattr(vfile *vf, struct avstat *buf, int attrmask) { int res; struct lziphandle *fil = (struct lziphandle *) vf->data; struct lzipnode *nod = fil->node; avoff_t size; const int basemask = AVA_MODE | AVA_UID | AVA_GID | AVA_MTIME | AVA_ATIME | AVA_CTIME; struct lzipcache *zc; struct cacheobj *cobj; res = av_fgetattr(fil->base, buf, basemask); if(res < 0) return res; AV_LOCK(fil->node->lock); zc = lzip_getcache(vf->mnt->base, fil->node); cobj = fil->node->cache; av_ref_obj(cobj); AV_UNLOCK(fil->node->lock); if((attrmask & (AVA_SIZE | AVA_BLKCNT)) != 0) { res = av_lzipfile_size(fil->zfil, zc, &size); if(res == 0 && size == -1) { fil->zfil = av_lzipfile_new(fil->base); res = av_lzipfile_size(fil->zfil, zc, &size); } if(res < 0) { av_unref_obj(zc); av_unref_obj(cobj); return res; } buf->size = size; buf->blocks = AV_BLOCKS(buf->size); } buf->mode &= ~(07000); buf->blksize = 4096; buf->dev = vf->mnt->avfs->dev; buf->ino = nod->ino; buf->nlink = 1; av_unref_obj(zc); av_unref_obj(cobj); return 0; } extern int av_init_module_ulzip(struct vmodule *module); int av_init_module_ulzip(struct vmodule *module) { int res; struct avfs *avfs; struct ext_info ulzip_exts[3]; ulzip_exts[0].from = ".tar.lz", ulzip_exts[0].to = ".tar"; ulzip_exts[1].from = ".lz", ulzip_exts[1].to = NULL; ulzip_exts[2].from = NULL; res = av_new_avfs("ulzip", ulzip_exts, AV_VER, AVF_NOLOCK, module, &avfs); if(res < 0) return res; avfs->lookup = lzip_lookup; avfs->access = lzip_access; avfs->open = lzip_open; avfs->close = lzip_close; avfs->read = lzip_read; avfs->getattr = lzip_getattr; av_add_avfs(avfs); return 0; } avfs-1.1.4/INSTALL0000644000175000001440000003661414032341013010423 00000000000000Installation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2016 Free Software Foundation, Inc. Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without warranty of any kind. Basic Installation ================== Briefly, the shell command './configure && make && make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the 'README' file for instructions specific to this package. Some packages provide this 'INSTALL' file but do not implement all of the features documented below. The lack of an optional feature in a given package is not necessarily a bug. More recommendations for GNU packages can be found in *note Makefile Conventions: (standards)Makefile Conventions. The 'configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a 'Makefile' in each directory of the package. It may also create one or more '.h' files containing system-dependent definitions. Finally, it creates a shell script 'config.status' that you can run in the future to recreate the current configuration, and a file 'config.log' containing compiler output (useful mainly for debugging 'configure'). It can also use an optional file (typically called 'config.cache' and enabled with '--cache-file=config.cache' or simply '-C') that saves the results of its tests to speed up reconfiguring. Caching is disabled by default to prevent problems with accidental use of stale cache files. If you need to do unusual things to compile the package, please try to figure out how 'configure' could check whether to do them, and mail diffs or instructions to the address given in the 'README' so they can be considered for the next release. If you are using the cache, and at some point 'config.cache' contains results you don't want to keep, you may remove or edit it. The file 'configure.ac' (or 'configure.in') is used to create 'configure' by a program called 'autoconf'. You need 'configure.ac' if you want to change it or regenerate 'configure' using a newer version of 'autoconf'. The simplest way to compile this package is: 1. 'cd' to the directory containing the package's source code and type './configure' to configure the package for your system. Running 'configure' might take a while. While running, it prints some messages telling which features it is checking for. 2. Type 'make' to compile the package. 3. Optionally, type 'make check' to run any self-tests that come with the package, generally using the just-built uninstalled binaries. 4. Type 'make install' to install the programs and any data files and documentation. When installing into a prefix owned by root, it is recommended that the package be configured and built as a regular user, and only the 'make install' phase executed with root privileges. 5. Optionally, type 'make installcheck' to repeat any self-tests, but this time using the binaries in their final installed location. This target does not install anything. Running this target as a regular user, particularly if the prior 'make install' required root privileges, verifies that the installation completed correctly. 6. You can remove the program binaries and object files from the source code directory by typing 'make clean'. To also remove the files that 'configure' created (so you can compile the package for a different kind of computer), type 'make distclean'. There is also a 'make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. 7. Often, you can also type 'make uninstall' to remove the installed files again. In practice, not all packages have tested that uninstallation works correctly, even though it is required by the GNU Coding Standards. 8. Some packages, particularly those that use Automake, provide 'make distcheck', which can by used by developers to test that all other targets like 'make install' and 'make uninstall' work correctly. This target is generally not run by end users. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the 'configure' script does not know about. Run './configure --help' for details on some of the pertinent environment variables. You can give 'configure' initial values for configuration parameters by setting variables in the command line or in the environment. Here is an example: ./configure CC=c99 CFLAGS=-g LIBS=-lposix *Note Defining Variables::, for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you can use GNU 'make'. 'cd' to the directory where you want the object files and executables to go and run the 'configure' script. 'configure' automatically checks for the source code in the directory that 'configure' is in and in '..'. This is known as a "VPATH" build. With a non-GNU 'make', it is safer to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use 'make distclean' before reconfiguring for another architecture. On MacOS X 10.5 and later systems, you can create libraries and executables that work on multiple system types--known as "fat" or "universal" binaries--by specifying multiple '-arch' options to the compiler but only a single '-arch' option to the preprocessor. Like this: ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \ CPP="gcc -E" CXXCPP="g++ -E" This is not guaranteed to produce working output in all cases, you may have to build one architecture at a time and combine the results using the 'lipo' tool if you have problems. Installation Names ================== By default, 'make install' installs the package's commands under '/usr/local/bin', include files under '/usr/local/include', etc. You can specify an installation prefix other than '/usr/local' by giving 'configure' the option '--prefix=PREFIX', where PREFIX must be an absolute file name. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you pass the option '--exec-prefix=PREFIX' to 'configure', the package uses PREFIX as the prefix for installing programs and libraries. Documentation and other data files still use the regular prefix. In addition, if you use an unusual directory layout you can give options like '--bindir=DIR' to specify different values for particular kinds of files. Run 'configure --help' for a list of the directories you can set and what kinds of files go in them. In general, the default for these options is expressed in terms of '${prefix}', so that specifying just '--prefix' will affect all of the other directory specifications that were not explicitly provided. The most portable way to affect installation locations is to pass the correct locations to 'configure'; however, many packages provide one or both of the following shortcuts of passing variable assignments to the 'make install' command line to change installation locations without having to reconfigure or recompile. The first method involves providing an override variable for each affected directory. For example, 'make install prefix=/alternate/directory' will choose an alternate location for all directory configuration variables that were expressed in terms of '${prefix}'. Any directories that were specified during 'configure', but not in terms of '${prefix}', must each be overridden at install time for the entire installation to be relocated. The approach of makefile variable overrides for each directory variable is required by the GNU Coding Standards, and ideally causes no recompilation. However, some platforms have known limitations with the semantics of shared libraries that end up requiring recompilation when using this method, particularly noticeable in packages that use GNU Libtool. The second method involves providing the 'DESTDIR' variable. For example, 'make install DESTDIR=/alternate/directory' will prepend '/alternate/directory' before all installation names. The approach of 'DESTDIR' overrides is not required by the GNU Coding Standards, and does not work on platforms that have drive letters. On the other hand, it does better at avoiding recompilation issues, and works well even when some directory options were not specified in terms of '${prefix}' at 'configure' time. Optional Features ================= If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving 'configure' the option '--program-prefix=PREFIX' or '--program-suffix=SUFFIX'. Some packages pay attention to '--enable-FEATURE' options to 'configure', where FEATURE indicates an optional part of the package. They may also pay attention to '--with-PACKAGE' options, where PACKAGE is something like 'gnu-as' or 'x' (for the X Window System). The 'README' should mention any '--enable-' and '--with-' options that the package recognizes. For packages that use the X Window System, 'configure' can usually find the X include and library files automatically, but if it doesn't, you can use the 'configure' options '--x-includes=DIR' and '--x-libraries=DIR' to specify their locations. Some packages offer the ability to configure how verbose the execution of 'make' will be. For these packages, running './configure --enable-silent-rules' sets the default to minimal output, which can be overridden with 'make V=1'; while running './configure --disable-silent-rules' sets the default to verbose, which can be overridden with 'make V=0'. Particular systems ================== On HP-UX, the default C compiler is not ANSI C compatible. If GNU CC is not installed, it is recommended to use the following options in order to use an ANSI C compiler: ./configure CC="cc -Ae -D_XOPEN_SOURCE=500" and if that doesn't work, install pre-built binaries of GCC for HP-UX. HP-UX 'make' updates targets which have the same time stamps as their prerequisites, which makes it generally unusable when shipped generated files such as 'configure' are involved. Use GNU 'make' instead. On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot parse its '' header file. The option '-nodtk' can be used as a workaround. If GNU CC is not installed, it is therefore recommended to try ./configure CC="cc" and if that doesn't work, try ./configure CC="cc -nodtk" On Solaris, don't put '/usr/ucb' early in your 'PATH'. This directory contains several dysfunctional programs; working variants of these programs are available in '/usr/bin'. So, if you need '/usr/ucb' in your 'PATH', put it _after_ '/usr/bin'. On Haiku, software installed for all users goes in '/boot/common', not '/usr/local'. It is recommended to use the following options: ./configure --prefix=/boot/common Specifying the System Type ========================== There may be some features 'configure' cannot figure out automatically, but needs to determine by the type of machine the package will run on. Usually, assuming the package is built to be run on the _same_ architectures, 'configure' can figure that out, but if it prints a message saying it cannot guess the machine type, give it the '--build=TYPE' option. TYPE can either be a short name for the system type, such as 'sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file 'config.sub' for the possible values of each field. If 'config.sub' isn't included in this package, then this package doesn't need to know the machine type. If you are _building_ compiler tools for cross-compiling, you should use the option '--target=TYPE' to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the "host" platform (i.e., that on which the generated programs will eventually be run) with '--host=TYPE'. Sharing Defaults ================ If you want to set default values for 'configure' scripts to share, you can create a site shell script called 'config.site' that gives default values for variables like 'CC', 'cache_file', and 'prefix'. 'configure' looks for 'PREFIX/share/config.site' if it exists, then 'PREFIX/etc/config.site' if it exists. Or, you can set the 'CONFIG_SITE' environment variable to the location of the site script. A warning: not all 'configure' scripts look for a site script. Defining Variables ================== Variables not defined in a site shell script can be set in the environment passed to 'configure'. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the 'configure' command line, using 'VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc causes the specified 'gcc' to be used as the C compiler (unless it is overridden in the site shell script). Unfortunately, this technique does not work for 'CONFIG_SHELL' due to an Autoconf limitation. Until the limitation is lifted, you can use this workaround: CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash 'configure' Invocation ====================== 'configure' recognizes the following options to control how it operates. '--help' '-h' Print a summary of all of the options to 'configure', and exit. '--help=short' '--help=recursive' Print a summary of the options unique to this package's 'configure', and exit. The 'short' variant lists options used only in the top level, while the 'recursive' variant lists options also present in any nested packages. '--version' '-V' Print the version of Autoconf used to generate the 'configure' script, and exit. '--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally 'config.cache'. FILE defaults to '/dev/null' to disable caching. '--config-cache' '-C' Alias for '--cache-file=config.cache'. '--quiet' '--silent' '-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to '/dev/null' (any error messages will still be shown). '--srcdir=DIR' Look for the package's source code in directory DIR. Usually 'configure' can determine that directory automatically. '--prefix=DIR' Use DIR as the installation prefix. *note Installation Names:: for more details, including other options available for fine-tuning the installation locations. '--no-create' '-n' Run the configure checks, but stop before creating any output files. 'configure' also accepts some other, not widely useful, options. Run 'configure --help' for more details. avfs-1.1.4/zlib/0000755000175000001440000000000014032341025010403 500000000000000avfs-1.1.4/zlib/infutil.c0000644000175000001440000000371714032341001012143 00000000000000/* inflate_util.c -- data and routines common to blocks and codes * Copyright (C) 1995-2002 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" #include "infblock.h" #include "inftrees.h" #include "infcodes.h" #include "infutil.h" struct inflate_codes_state {int dummy;}; /* for buggy compilers */ /* And'ing with mask[n] masks the lower n bits */ uInt inflate_mask[17] = { 0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff, 0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff }; /* copy as much as possible from the sliding window to the output area */ int inflate_flush(s, z, r) inflate_blocks_statef *s; z_streamp z; int r; { uInt n; Bytef *p; Bytef *q; /* local copies of source and destination pointers */ p = z->next_out; q = s->read; /* compute number of bytes to copy as far as end of window */ n = (uInt)((q <= s->write ? s->write : s->end) - q); if (n > z->avail_out) n = z->avail_out; if (n && r == Z_BUF_ERROR) r = Z_OK; /* update counters */ z->avail_out -= n; z->total_out += n; /* update check information */ if (s->checkfn != Z_NULL) z->adler = s->check = (*s->checkfn)(s->check, q, n); /* copy as far as end of window */ zmemcpy(p, q, n); p += n; q += n; /* see if more to copy at beginning of window */ if (q == s->end) { /* wrap pointers */ q = s->window; if (s->write == s->end) s->write = s->window; /* compute bytes to copy */ n = (uInt)(s->write - q); if (n > z->avail_out) n = z->avail_out; if (n && r == Z_BUF_ERROR) r = Z_OK; /* update counters */ z->avail_out -= n; z->total_out += n; /* update check information */ if (s->checkfn != Z_NULL) z->adler = s->check = (*s->checkfn)(s->check, q, n); /* copy */ zmemcpy(p, q, n); p += n; q += n; } /* update pointers */ z->next_out = p; s->read = q; /* done */ return r; } avfs-1.1.4/zlib/trees.h0000644000175000001440000002037414032341001011616 00000000000000/* header created automatically with -DGEN_TREES_H */ local const ct_data static_ltree[L_CODES+2] = { {{ 12},{ 8}}, {{140},{ 8}}, {{ 76},{ 8}}, {{204},{ 8}}, {{ 44},{ 8}}, {{172},{ 8}}, {{108},{ 8}}, {{236},{ 8}}, {{ 28},{ 8}}, {{156},{ 8}}, {{ 92},{ 8}}, {{220},{ 8}}, {{ 60},{ 8}}, {{188},{ 8}}, {{124},{ 8}}, {{252},{ 8}}, {{ 2},{ 8}}, {{130},{ 8}}, {{ 66},{ 8}}, {{194},{ 8}}, {{ 34},{ 8}}, {{162},{ 8}}, {{ 98},{ 8}}, {{226},{ 8}}, {{ 18},{ 8}}, {{146},{ 8}}, {{ 82},{ 8}}, {{210},{ 8}}, {{ 50},{ 8}}, {{178},{ 8}}, {{114},{ 8}}, {{242},{ 8}}, {{ 10},{ 8}}, {{138},{ 8}}, {{ 74},{ 8}}, {{202},{ 8}}, {{ 42},{ 8}}, {{170},{ 8}}, {{106},{ 8}}, {{234},{ 8}}, {{ 26},{ 8}}, {{154},{ 8}}, {{ 90},{ 8}}, {{218},{ 8}}, {{ 58},{ 8}}, {{186},{ 8}}, {{122},{ 8}}, {{250},{ 8}}, {{ 6},{ 8}}, {{134},{ 8}}, {{ 70},{ 8}}, {{198},{ 8}}, {{ 38},{ 8}}, {{166},{ 8}}, {{102},{ 8}}, {{230},{ 8}}, {{ 22},{ 8}}, {{150},{ 8}}, {{ 86},{ 8}}, {{214},{ 8}}, {{ 54},{ 8}}, {{182},{ 8}}, {{118},{ 8}}, {{246},{ 8}}, {{ 14},{ 8}}, {{142},{ 8}}, {{ 78},{ 8}}, {{206},{ 8}}, {{ 46},{ 8}}, {{174},{ 8}}, {{110},{ 8}}, {{238},{ 8}}, {{ 30},{ 8}}, {{158},{ 8}}, {{ 94},{ 8}}, {{222},{ 8}}, {{ 62},{ 8}}, {{190},{ 8}}, {{126},{ 8}}, {{254},{ 8}}, {{ 1},{ 8}}, {{129},{ 8}}, {{ 65},{ 8}}, {{193},{ 8}}, {{ 33},{ 8}}, {{161},{ 8}}, {{ 97},{ 8}}, {{225},{ 8}}, {{ 17},{ 8}}, {{145},{ 8}}, {{ 81},{ 8}}, {{209},{ 8}}, {{ 49},{ 8}}, {{177},{ 8}}, {{113},{ 8}}, {{241},{ 8}}, {{ 9},{ 8}}, {{137},{ 8}}, {{ 73},{ 8}}, {{201},{ 8}}, {{ 41},{ 8}}, {{169},{ 8}}, {{105},{ 8}}, {{233},{ 8}}, {{ 25},{ 8}}, {{153},{ 8}}, {{ 89},{ 8}}, {{217},{ 8}}, {{ 57},{ 8}}, {{185},{ 8}}, {{121},{ 8}}, {{249},{ 8}}, {{ 5},{ 8}}, {{133},{ 8}}, {{ 69},{ 8}}, {{197},{ 8}}, {{ 37},{ 8}}, {{165},{ 8}}, {{101},{ 8}}, {{229},{ 8}}, {{ 21},{ 8}}, {{149},{ 8}}, {{ 85},{ 8}}, {{213},{ 8}}, {{ 53},{ 8}}, {{181},{ 8}}, {{117},{ 8}}, {{245},{ 8}}, {{ 13},{ 8}}, {{141},{ 8}}, {{ 77},{ 8}}, {{205},{ 8}}, {{ 45},{ 8}}, {{173},{ 8}}, {{109},{ 8}}, {{237},{ 8}}, {{ 29},{ 8}}, {{157},{ 8}}, {{ 93},{ 8}}, {{221},{ 8}}, {{ 61},{ 8}}, {{189},{ 8}}, {{125},{ 8}}, {{253},{ 8}}, {{ 19},{ 9}}, {{275},{ 9}}, {{147},{ 9}}, {{403},{ 9}}, {{ 83},{ 9}}, {{339},{ 9}}, {{211},{ 9}}, {{467},{ 9}}, {{ 51},{ 9}}, {{307},{ 9}}, {{179},{ 9}}, {{435},{ 9}}, {{115},{ 9}}, {{371},{ 9}}, {{243},{ 9}}, {{499},{ 9}}, {{ 11},{ 9}}, {{267},{ 9}}, {{139},{ 9}}, {{395},{ 9}}, {{ 75},{ 9}}, {{331},{ 9}}, {{203},{ 9}}, {{459},{ 9}}, {{ 43},{ 9}}, {{299},{ 9}}, {{171},{ 9}}, {{427},{ 9}}, {{107},{ 9}}, {{363},{ 9}}, {{235},{ 9}}, {{491},{ 9}}, {{ 27},{ 9}}, {{283},{ 9}}, {{155},{ 9}}, {{411},{ 9}}, {{ 91},{ 9}}, {{347},{ 9}}, {{219},{ 9}}, {{475},{ 9}}, {{ 59},{ 9}}, {{315},{ 9}}, {{187},{ 9}}, {{443},{ 9}}, {{123},{ 9}}, {{379},{ 9}}, {{251},{ 9}}, {{507},{ 9}}, {{ 7},{ 9}}, {{263},{ 9}}, {{135},{ 9}}, {{391},{ 9}}, {{ 71},{ 9}}, {{327},{ 9}}, {{199},{ 9}}, {{455},{ 9}}, {{ 39},{ 9}}, {{295},{ 9}}, {{167},{ 9}}, {{423},{ 9}}, {{103},{ 9}}, {{359},{ 9}}, {{231},{ 9}}, {{487},{ 9}}, {{ 23},{ 9}}, {{279},{ 9}}, {{151},{ 9}}, {{407},{ 9}}, {{ 87},{ 9}}, {{343},{ 9}}, {{215},{ 9}}, {{471},{ 9}}, {{ 55},{ 9}}, {{311},{ 9}}, {{183},{ 9}}, {{439},{ 9}}, {{119},{ 9}}, {{375},{ 9}}, {{247},{ 9}}, {{503},{ 9}}, {{ 15},{ 9}}, {{271},{ 9}}, {{143},{ 9}}, {{399},{ 9}}, {{ 79},{ 9}}, {{335},{ 9}}, {{207},{ 9}}, {{463},{ 9}}, {{ 47},{ 9}}, {{303},{ 9}}, {{175},{ 9}}, {{431},{ 9}}, {{111},{ 9}}, {{367},{ 9}}, {{239},{ 9}}, {{495},{ 9}}, {{ 31},{ 9}}, {{287},{ 9}}, {{159},{ 9}}, {{415},{ 9}}, {{ 95},{ 9}}, {{351},{ 9}}, {{223},{ 9}}, {{479},{ 9}}, {{ 63},{ 9}}, {{319},{ 9}}, {{191},{ 9}}, {{447},{ 9}}, {{127},{ 9}}, {{383},{ 9}}, {{255},{ 9}}, {{511},{ 9}}, {{ 0},{ 7}}, {{ 64},{ 7}}, {{ 32},{ 7}}, {{ 96},{ 7}}, {{ 16},{ 7}}, {{ 80},{ 7}}, {{ 48},{ 7}}, {{112},{ 7}}, {{ 8},{ 7}}, {{ 72},{ 7}}, {{ 40},{ 7}}, {{104},{ 7}}, {{ 24},{ 7}}, {{ 88},{ 7}}, {{ 56},{ 7}}, {{120},{ 7}}, {{ 4},{ 7}}, {{ 68},{ 7}}, {{ 36},{ 7}}, {{100},{ 7}}, {{ 20},{ 7}}, {{ 84},{ 7}}, {{ 52},{ 7}}, {{116},{ 7}}, {{ 3},{ 8}}, {{131},{ 8}}, {{ 67},{ 8}}, {{195},{ 8}}, {{ 35},{ 8}}, {{163},{ 8}}, {{ 99},{ 8}}, {{227},{ 8}} }; local const ct_data static_dtree[D_CODES] = { {{ 0},{ 5}}, {{16},{ 5}}, {{ 8},{ 5}}, {{24},{ 5}}, {{ 4},{ 5}}, {{20},{ 5}}, {{12},{ 5}}, {{28},{ 5}}, {{ 2},{ 5}}, {{18},{ 5}}, {{10},{ 5}}, {{26},{ 5}}, {{ 6},{ 5}}, {{22},{ 5}}, {{14},{ 5}}, {{30},{ 5}}, {{ 1},{ 5}}, {{17},{ 5}}, {{ 9},{ 5}}, {{25},{ 5}}, {{ 5},{ 5}}, {{21},{ 5}}, {{13},{ 5}}, {{29},{ 5}}, {{ 3},{ 5}}, {{19},{ 5}}, {{11},{ 5}}, {{27},{ 5}}, {{ 7},{ 5}}, {{23},{ 5}} }; const uch _dist_code[DIST_CODE_LEN] = { 0, 1, 2, 3, 4, 4, 5, 5, 6, 6, 6, 6, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 9, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0, 0, 16, 17, 18, 18, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 28, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29 }; const uch _length_code[MAX_MATCH-MIN_MATCH+1]= { 0, 1, 2, 3, 4, 5, 6, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 17, 17, 17, 18, 18, 18, 18, 18, 18, 18, 18, 19, 19, 19, 19, 19, 19, 19, 19, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 28 }; local const int base_length[LENGTH_CODES] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 12, 14, 16, 20, 24, 28, 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 0 }; local const int base_dist[D_CODES] = { 0, 1, 2, 3, 4, 6, 8, 12, 16, 24, 32, 48, 64, 96, 128, 192, 256, 384, 512, 768, 1024, 1536, 2048, 3072, 4096, 6144, 8192, 12288, 16384, 24576 }; avfs-1.1.4/zlib/zlib.h0000644000175000001440000012072514032341001011435 00000000000000/* IMPORTANT NOTE: This is not the original zlib distribution. The following files have been modified: infblock.c infblock.h infcodes.c infcodes.h inflate.c zlib.h The modifications are copyright (C) 2001 Miklos Szeredi The modified software can be distributed under the same licence as the original software (see bellow). */ /* zlib.h -- interface of the 'zlib' general purpose compression library version 1.1.4, March 11th, 2002 Copyright (C) 1995-2002 Jean-loup Gailly and Mark Adler This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software. Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 3. This notice may not be removed or altered from any source distribution. Jean-loup Gailly Mark Adler jloup@gzip.org madler@alumni.caltech.edu The data format used by the zlib library is described by RFCs (Request for Comments) 1950 to 1952 in the files ftp://ds.internic.net/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate format) and rfc1952.txt (gzip format). */ #ifndef _ZLIB_H #define _ZLIB_H #include "zconf.h" #ifdef __cplusplus extern "C" { #endif #define ZLIB_VERSION "1.1.4" /* The 'zlib' compression library provides in-memory compression and decompression functions, including integrity checks of the uncompressed data. This version of the library supports only one compression method (deflation) but other algorithms will be added later and will have the same stream interface. Compression can be done in a single step if the buffers are large enough (for example if an input file is mmap'ed), or can be done by repeated calls of the compression function. In the latter case, the application must provide more input and/or consume the output (providing more output space) before each call. The library also supports reading and writing files in gzip (.gz) format with an interface similar to that of stdio. The library does not install any signal handler. The decoder checks the consistency of the compressed data, so the library should never crash even in case of corrupted input. */ typedef voidpf (*alloc_func) OF((voidpf opaque, uInt items, uInt size)); typedef void (*free_func) OF((voidpf opaque, voidpf address)); struct internal_state; typedef struct z_stream_s { Bytef *next_in; /* next input byte */ uInt avail_in; /* number of bytes available at next_in */ uLongLong total_in; /* total nb of input bytes read so far */ Bytef *next_out; /* next output byte should be put there */ uInt avail_out; /* remaining free space at next_out */ uLongLong total_out; /* total nb of bytes output so far */ char *msg; /* last error message, NULL if no error */ struct internal_state FAR *state; /* not visible by applications */ alloc_func zalloc; /* used to allocate the internal state */ free_func zfree; /* used to free the internal state */ voidpf opaque; /* private data object passed to zalloc and zfree */ int data_type; /* best guess about the data type: ascii or binary */ uLong adler; /* adler32 value of the uncompressed data */ uLong reserved; /* reserved for future use */ } z_stream; typedef z_stream FAR *z_streamp; /* The application must update next_in and avail_in when avail_in has dropped to zero. It must update next_out and avail_out when avail_out has dropped to zero. The application must initialize zalloc, zfree and opaque before calling the init function. All other fields are set by the compression library and must not be updated by the application. The opaque value provided by the application will be passed as the first parameter for calls of zalloc and zfree. This can be useful for custom memory management. The compression library attaches no meaning to the opaque value. zalloc must return Z_NULL if there is not enough memory for the object. If zlib is used in a multi-threaded application, zalloc and zfree must be thread safe. On 16-bit systems, the functions zalloc and zfree must be able to allocate exactly 65536 bytes, but will not be required to allocate more than this if the symbol MAXSEG_64K is defined (see zconf.h). WARNING: On MSDOS, pointers returned by zalloc for objects of exactly 65536 bytes *must* have their offset normalized to zero. The default allocation function provided by this library ensures this (see zutil.c). To reduce memory requirements and avoid any allocation of 64K objects, at the expense of compression ratio, compile the library with -DMAX_WBITS=14 (see zconf.h). The fields total_in and total_out can be used for statistics or progress reports. After compression, total_in holds the total size of the uncompressed data and may be saved for use in the decompressor (particularly if the decompressor wants to decompress everything in a single step). */ /* constants */ #define Z_NO_FLUSH 0 #define Z_PARTIAL_FLUSH 1 /* will be removed, use Z_SYNC_FLUSH instead */ #define Z_SYNC_FLUSH 2 #define Z_FULL_FLUSH 3 #define Z_FINISH 4 /* Allowed flush values; see deflate() below for details */ #define Z_OK 0 #define Z_STREAM_END 1 #define Z_NEED_DICT 2 #define Z_ERRNO (-1) #define Z_STREAM_ERROR (-2) #define Z_DATA_ERROR (-3) #define Z_MEM_ERROR (-4) #define Z_BUF_ERROR (-5) #define Z_VERSION_ERROR (-6) /* Return codes for the compression/decompression functions. Negative * values are errors, positive values are used for special but normal events. */ #define Z_NO_COMPRESSION 0 #define Z_BEST_SPEED 1 #define Z_BEST_COMPRESSION 9 #define Z_DEFAULT_COMPRESSION (-1) /* compression levels */ #define Z_FILTERED 1 #define Z_HUFFMAN_ONLY 2 #define Z_DEFAULT_STRATEGY 0 /* compression strategy; see deflateInit2() below for details */ #define Z_BINARY 0 #define Z_ASCII 1 #define Z_UNKNOWN 2 /* Possible values of the data_type field */ #define Z_DEFLATED 8 /* The deflate compression method (the only one supported in this version) */ #define Z_NULL 0 /* for initializing zalloc, zfree, opaque */ #define zlib_version zlibVersion() /* for compatibility with versions < 1.0.2 */ /* basic functions */ ZEXTERN const char * ZEXPORT zlibVersion OF((void)); /* The application can compare zlibVersion and ZLIB_VERSION for consistency. If the first character differs, the library code actually used is not compatible with the zlib.h header file used by the application. This check is automatically made by deflateInit and inflateInit. */ /* ZEXTERN int ZEXPORT deflateInit OF((z_streamp strm, int level)); Initializes the internal stream state for compression. The fields zalloc, zfree and opaque must be initialized before by the caller. If zalloc and zfree are set to Z_NULL, deflateInit updates them to use default allocation functions. The compression level must be Z_DEFAULT_COMPRESSION, or between 0 and 9: 1 gives best speed, 9 gives best compression, 0 gives no compression at all (the input data is simply copied a block at a time). Z_DEFAULT_COMPRESSION requests a default compromise between speed and compression (currently equivalent to level 6). deflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if level is not a valid compression level, Z_VERSION_ERROR if the zlib library version (zlib_version) is incompatible with the version assumed by the caller (ZLIB_VERSION). msg is set to null if there is no error message. deflateInit does not perform any compression: this will be done by deflate(). */ ZEXTERN int ZEXPORT deflate OF((z_streamp strm, int flush)); /* deflate compresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may introduce some output latency (reading input without producing any output) except when forced to flush. The detailed semantics are as follows. deflate performs one or both of the following actions: - Compress more input starting at next_in and update next_in and avail_in accordingly. If not all input can be processed (because there is not enough room in the output buffer), next_in and avail_in are updated and processing will resume at this point for the next call of deflate(). - Provide more output starting at next_out and update next_out and avail_out accordingly. This action is forced if the parameter flush is non zero. Forcing flush frequently degrades the compression ratio, so this parameter should be set only when necessary (in interactive applications). Some output may be provided even if flush is not set. Before the call of deflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming more output, and updating avail_in or avail_out accordingly; avail_out should never be zero before the call. The application can consume the compressed output when it wants, for example when the output buffer is full (avail_out == 0), or after each call of deflate(). If deflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. If the parameter flush is set to Z_SYNC_FLUSH, all pending output is flushed to the output buffer and the output is aligned on a byte boundary, so that the decompressor can get all input data available so far. (In particular avail_in is zero after the call if enough output space has been provided before the call.) Flushing may degrade compression for some compression algorithms and so it should be used only when necessary. If flush is set to Z_FULL_FLUSH, all output is flushed as with Z_SYNC_FLUSH, and the compression state is reset so that decompression can restart from this point if previous compressed data has been damaged or if random access is desired. Using Z_FULL_FLUSH too often can seriously degrade the compression. If deflate returns with avail_out == 0, this function must be called again with the same value of the flush parameter and more output space (updated avail_out), until the flush is complete (deflate returns with non-zero avail_out). If the parameter flush is set to Z_FINISH, pending input is processed, pending output is flushed and deflate returns with Z_STREAM_END if there was enough output space; if deflate returns with Z_OK, this function must be called again with Z_FINISH and more output space (updated avail_out) but no more input data, until it returns with Z_STREAM_END or an error. After deflate has returned Z_STREAM_END, the only possible operations on the stream are deflateReset or deflateEnd. Z_FINISH can be used immediately after deflateInit if all the compression is to be done in a single step. In this case, avail_out must be at least 0.1% larger than avail_in plus 12 bytes. If deflate does not return Z_STREAM_END, then it must be called again as described above. deflate() sets strm->adler to the adler32 checksum of all input read so far (that is, total_in bytes). deflate() may update data_type if it can make a good guess about the input data type (Z_ASCII or Z_BINARY). In doubt, the data is considered binary. This field is only for information purposes and does not affect the compression algorithm in any manner. deflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if all input has been consumed and all output has been produced (only when flush is set to Z_FINISH), Z_STREAM_ERROR if the stream state was inconsistent (for example if next_in or next_out was NULL), Z_BUF_ERROR if no progress is possible (for example avail_in or avail_out was zero). */ ZEXTERN int ZEXPORT deflateEnd OF((z_streamp strm)); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending output. deflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state was inconsistent, Z_DATA_ERROR if the stream was freed prematurely (some input or output was discarded). In the error case, msg may be set but then points to a static string (which must not be deallocated). */ /* ZEXTERN int ZEXPORT inflateInit OF((z_streamp strm)); Initializes the internal stream state for decompression. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by the caller. If next_in is not Z_NULL and avail_in is large enough (the exact value depends on the compression method), inflateInit determines the compression method from the zlib header and allocates all data structures accordingly; otherwise the allocation will be deferred to the first call of inflate. If zalloc and zfree are set to Z_NULL, inflateInit updates them to use default allocation functions. inflateInit returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_VERSION_ERROR if the zlib library version is incompatible with the version assumed by the caller. msg is set to null if there is no error message. inflateInit does not perform any decompression apart from reading the zlib header if present: this will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unchanged.) */ ZEXTERN int ZEXPORT inflate OF((z_streamp strm, int flush)); /* inflate decompresses as much data as possible, and stops when the input buffer becomes empty or the output buffer becomes full. It may some introduce some output latency (reading input without producing any output) except when forced to flush. The detailed semantics are as follows. inflate performs one or both of the following actions: - Decompress more input starting at next_in and update next_in and avail_in accordingly. If not all input can be processed (because there is not enough room in the output buffer), next_in is updated and processing will resume at this point for the next call of inflate(). - Provide more output starting at next_out and update next_out and avail_out accordingly. inflate() provides as much output as possible, until there is no more input data or no more space in the output buffer (see below about the flush parameter). Before the call of inflate(), the application should ensure that at least one of the actions is possible, by providing more input and/or consuming more output, and updating the next_* and avail_* values accordingly. The application can consume the uncompressed output when it wants, for example when the output buffer is full (avail_out == 0), or after each call of inflate(). If inflate returns Z_OK and with zero avail_out, it must be called again after making room in the output buffer because there might be more output pending. If the parameter flush is set to Z_SYNC_FLUSH, inflate flushes as much output as possible to the output buffer. The flushing behavior of inflate is not specified for values of the flush parameter other than Z_SYNC_FLUSH and Z_FINISH, but the current implementation actually flushes as much output as possible anyway. inflate() should normally be called until it returns Z_STREAM_END or an error. However if all decompression is to be performed in a single step (a single call of inflate), the parameter flush should be set to Z_FINISH. In this case all pending input is processed and all pending output is flushed; avail_out must be large enough to hold all the uncompressed data. (The size of the uncompressed data may have been saved by the compressor for this purpose.) The next operation on this stream must be inflateEnd to deallocate the decompression state. The use of Z_FINISH is never required, but can be used to inform inflate that a faster routine may be used for the single inflate() call. If a preset dictionary is needed at this point (see inflateSetDictionary below), inflate sets strm-adler to the adler32 checksum of the dictionary chosen by the compressor and returns Z_NEED_DICT; otherwise it sets strm->adler to the adler32 checksum of all output produced so far (that is, total_out bytes) and returns Z_OK, Z_STREAM_END or an error code as described below. At the end of the stream, inflate() checks that its computed adler32 checksum is equal to that saved by the compressor and returns Z_STREAM_END only if the checksum is correct. inflate() returns Z_OK if some progress has been made (more input processed or more output produced), Z_STREAM_END if the end of the compressed data has been reached and all uncompressed output has been produced, Z_NEED_DICT if a preset dictionary is needed at this point, Z_DATA_ERROR if the input data was corrupted (input stream not conforming to the zlib format or incorrect adler32 checksum), Z_STREAM_ERROR if the stream structure was inconsistent (for example if next_in or next_out was NULL), Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if no progress is possible or if there was not enough room in the output buffer when Z_FINISH is used. In the Z_DATA_ERROR case, the application may then call inflateSync to look for a good compression block. */ ZEXTERN int ZEXPORT inflateEnd OF((z_streamp strm)); /* All dynamically allocated data structures for this stream are freed. This function discards any unprocessed input and does not flush any pending output. inflateEnd returns Z_OK if success, Z_STREAM_ERROR if the stream state was inconsistent. In the error case, msg may be set but then points to a static string (which must not be deallocated). */ /* Advanced functions */ /* The following functions are needed only in some special applications. */ /* ZEXTERN int ZEXPORT deflateInit2 OF((z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy)); This is another version of deflateInit with more compression options. The fields next_in, zalloc, zfree and opaque must be initialized before by the caller. The method parameter is the compression method. It must be Z_DEFLATED in this version of the library. The windowBits parameter is the base two logarithm of the window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. Larger values of this parameter result in better compression at the expense of memory usage. The default value is 15 if deflateInit is used instead. The memLevel parameter specifies how much memory should be allocated for the internal compression state. memLevel=1 uses minimum memory but is slow and reduces compression ratio; memLevel=9 uses maximum memory for optimal speed. The default value is 8. See zconf.h for total memory usage as a function of windowBits and memLevel. The strategy parameter is used to tune the compression algorithm. Use the value Z_DEFAULT_STRATEGY for normal data, Z_FILTERED for data produced by a filter (or predictor), or Z_HUFFMAN_ONLY to force Huffman encoding only (no string match). Filtered data consists mostly of small values with a somewhat random distribution. In this case, the compression algorithm is tuned to compress them better. The effect of Z_FILTERED is to force more Huffman coding and less string matching; it is somewhat intermediate between Z_DEFAULT and Z_HUFFMAN_ONLY. The strategy parameter only affects the compression ratio but not the correctness of the compressed output even if it is not set appropriately. deflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as an invalid method). msg is set to null if there is no error message. deflateInit2 does not perform any compression: this will be done by deflate(). */ ZEXTERN int ZEXPORT deflateSetDictionary OF((z_streamp strm, const Bytef *dictionary, uInt dictLength)); /* Initializes the compression dictionary from the given byte sequence without producing any compressed output. This function must be called immediately after deflateInit, deflateInit2 or deflateReset, before any call of deflate. The compressor and decompressor must use exactly the same dictionary (see inflateSetDictionary). The dictionary should consist of strings (byte sequences) that are likely to be encountered later in the data to be compressed, with the most commonly used strings preferably put towards the end of the dictionary. Using a dictionary is most useful when the data to be compressed is short and can be predicted with good accuracy; the data can then be compressed better than with the default empty dictionary. Depending on the size of the compression data structures selected by deflateInit or deflateInit2, a part of the dictionary may in effect be discarded, for example if the dictionary is larger than the window size in deflate or deflate2. Thus the strings most likely to be useful should be put at the end of the dictionary, not at the front. Upon return of this function, strm->adler is set to the Adler32 value of the dictionary; the decompressor may later use this value to determine which dictionary has been used by the compressor. (The Adler32 value applies to the whole dictionary even if only a subset of the dictionary is actually used by the compressor.) deflateSetDictionary returns Z_OK if success, or Z_STREAM_ERROR if a parameter is invalid (such as NULL dictionary) or the stream state is inconsistent (for example if deflate has already been called for this stream or if the compression method is bsort). deflateSetDictionary does not perform any compression: this will be done by deflate(). */ ZEXTERN int ZEXPORT deflateCopy OF((z_streamp dest, z_streamp source)); /* Sets the destination stream as a complete copy of the source stream. This function can be useful when several compression strategies will be tried, for example when there are several ways of pre-processing the input data with a filter. The streams that will be discarded should then be freed by calling deflateEnd. Note that deflateCopy duplicates the internal compression state which can be quite large, so this strategy is slow and can consume lots of memory. deflateCopy returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc being NULL). msg is left unchanged in both source and destination. */ ZEXTERN int ZEXPORT deflateReset OF((z_streamp strm)); /* This function is equivalent to deflateEnd followed by deflateInit, but does not free and reallocate all the internal compression state. The stream will keep the same compression level and any other attributes that may have been set by deflateInit2. deflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being NULL). */ ZEXTERN int ZEXPORT deflateParams OF((z_streamp strm, int level, int strategy)); /* Dynamically update the compression level and compression strategy. The interpretation of level and strategy is as in deflateInit2. This can be used to switch between compression and straight copy of the input data, or to switch to a different kind of input data requiring a different strategy. If the compression level is changed, the input available so far is compressed with the old level (and may be flushed); the new level will take effect only at the next call of deflate(). Before the call of deflateParams, the stream state must be set as for a call of deflate(), since the currently available input may have to be compressed and flushed. In particular, strm->avail_out must be non-zero. deflateParams returns Z_OK if success, Z_STREAM_ERROR if the source stream state was inconsistent or if a parameter was invalid, Z_BUF_ERROR if strm->avail_out was zero. */ /* ZEXTERN int ZEXPORT inflateInit2 OF((z_streamp strm, int windowBits)); This is another version of inflateInit with an extra parameter. The fields next_in, avail_in, zalloc, zfree and opaque must be initialized before by the caller. The windowBits parameter is the base two logarithm of the maximum window size (the size of the history buffer). It should be in the range 8..15 for this version of the library. The default value is 15 if inflateInit is used instead. If a compressed stream with a larger window size is given as input, inflate() will return with the error code Z_DATA_ERROR instead of trying to allocate a larger window. inflateInit2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_STREAM_ERROR if a parameter is invalid (such as a negative memLevel). msg is set to null if there is no error message. inflateInit2 does not perform any decompression apart from reading the zlib header if present: this will be done by inflate(). (So next_in and avail_in may be modified, but next_out and avail_out are unchanged.) */ ZEXTERN int ZEXPORT inflateSetDictionary OF((z_streamp strm, const Bytef *dictionary, uInt dictLength)); /* Initializes the decompression dictionary from the given uncompressed byte sequence. This function must be called immediately after a call of inflate if this call returned Z_NEED_DICT. The dictionary chosen by the compressor can be determined from the Adler32 value returned by this call of inflate. The compressor and decompressor must use exactly the same dictionary (see deflateSetDictionary). inflateSetDictionary returns Z_OK if success, Z_STREAM_ERROR if a parameter is invalid (such as NULL dictionary) or the stream state is inconsistent, Z_DATA_ERROR if the given dictionary doesn't match the expected one (incorrect Adler32 value). inflateSetDictionary does not perform any decompression: this will be done by subsequent calls of inflate(). */ ZEXTERN int ZEXPORT inflateSync OF((z_streamp strm)); /* Skips invalid compressed data until a full flush point (see above the description of deflate with Z_FULL_FLUSH) can be found, or until all available input is skipped. No output is provided. inflateSync returns Z_OK if a full flush point has been found, Z_BUF_ERROR if no more input was provided, Z_DATA_ERROR if no flush point has been found, or Z_STREAM_ERROR if the stream structure was inconsistent. In the success case, the application may save the current current value of total_in which indicates where valid compressed data was found. In the error case, the application may repeatedly call inflateSync, providing more input each time, until success or end of the input data. */ ZEXTERN int ZEXPORT inflateReset OF((z_streamp strm)); /* This function is equivalent to inflateEnd followed by inflateInit, but does not free and reallocate all the internal decompression state. The stream will keep attributes that may have been set by inflateInit2. inflateReset returns Z_OK if success, or Z_STREAM_ERROR if the source stream state was inconsistent (such as zalloc or state being NULL). */ /* utility functions */ /* The following utility functions are implemented on top of the basic stream-oriented functions. To simplify the interface, some default options are assumed (compression level and memory usage, standard memory allocation functions). The source code of these utility functions can easily be modified if you need special options. */ ZEXTERN int ZEXPORT compress OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)); /* Compresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least 0.1% larger than sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. This function can be used to compress a whole file at once if the input file is mmap'ed. compress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer. */ ZEXTERN int ZEXPORT compress2 OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen, int level)); /* Compresses the source buffer into the destination buffer. The level parameter has the same meaning as in deflateInit. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be at least 0.1% larger than sourceLen plus 12 bytes. Upon exit, destLen is the actual size of the compressed buffer. compress2 returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, Z_STREAM_ERROR if the level parameter is invalid. */ ZEXTERN int ZEXPORT uncompress OF((Bytef *dest, uLongf *destLen, const Bytef *source, uLong sourceLen)); /* Decompresses the source buffer into the destination buffer. sourceLen is the byte length of the source buffer. Upon entry, destLen is the total size of the destination buffer, which must be large enough to hold the entire uncompressed data. (The size of the uncompressed data must have been saved previously by the compressor and transmitted to the decompressor by some mechanism outside the scope of this compression library.) Upon exit, destLen is the actual size of the compressed buffer. This function can be used to decompress a whole file at once if the input file is mmap'ed. uncompress returns Z_OK if success, Z_MEM_ERROR if there was not enough memory, Z_BUF_ERROR if there was not enough room in the output buffer, or Z_DATA_ERROR if the input data was corrupted. */ typedef voidp gzFile; ZEXTERN gzFile ZEXPORT gzopen OF((const char *path, const char *mode)); /* Opens a gzip (.gz) file for reading or writing. The mode parameter is as in fopen ("rb" or "wb") but can also include a compression level ("wb9") or a strategy: 'f' for filtered data as in "wb6f", 'h' for Huffman only compression as in "wb1h". (See the description of deflateInit2 for more information about the strategy parameter.) gzopen can be used to read a file which is not in gzip format; in this case gzread will directly read from the file without decompression. gzopen returns NULL if the file could not be opened or if there was insufficient memory to allocate the (de)compression state; errno can be checked to distinguish the two cases (if errno is zero, the zlib error is Z_MEM_ERROR). */ ZEXTERN gzFile ZEXPORT gzdopen OF((int fd, const char *mode)); /* gzdopen() associates a gzFile with the file descriptor fd. File descriptors are obtained from calls like open, dup, creat, pipe or fileno (in the file has been previously opened with fopen). The mode parameter is as in gzopen. The next call of gzclose on the returned gzFile will also close the file descriptor fd, just like fclose(fdopen(fd), mode) closes the file descriptor fd. If you want to keep fd open, use gzdopen(dup(fd), mode). gzdopen returns NULL if there was insufficient memory to allocate the (de)compression state. */ ZEXTERN int ZEXPORT gzsetparams OF((gzFile file, int level, int strategy)); /* Dynamically update the compression level or strategy. See the description of deflateInit2 for the meaning of these parameters. gzsetparams returns Z_OK if success, or Z_STREAM_ERROR if the file was not opened for writing. */ ZEXTERN int ZEXPORT gzread OF((gzFile file, voidp buf, unsigned len)); /* Reads the given number of uncompressed bytes from the compressed file. If the input file was not in gzip format, gzread copies the given number of bytes into the buffer. gzread returns the number of uncompressed bytes actually read (0 for end of file, -1 for error). */ ZEXTERN int ZEXPORT gzwrite OF((gzFile file, const voidp buf, unsigned len)); /* Writes the given number of uncompressed bytes into the compressed file. gzwrite returns the number of uncompressed bytes actually written (0 in case of error). */ ZEXTERN int ZEXPORTVA gzprintf OF((gzFile file, const char *format, ...)); /* Converts, formats, and writes the args to the compressed file under control of the format string, as in fprintf. gzprintf returns the number of uncompressed bytes actually written (0 in case of error). */ ZEXTERN int ZEXPORT gzputs OF((gzFile file, const char *s)); /* Writes the given null-terminated string to the compressed file, excluding the terminating null character. gzputs returns the number of characters written, or -1 in case of error. */ ZEXTERN char * ZEXPORT gzgets OF((gzFile file, char *buf, int len)); /* Reads bytes from the compressed file until len-1 characters are read, or a newline character is read and transferred to buf, or an end-of-file condition is encountered. The string is then terminated with a null character. gzgets returns buf, or Z_NULL in case of error. */ ZEXTERN int ZEXPORT gzputc OF((gzFile file, int c)); /* Writes c, converted to an unsigned char, into the compressed file. gzputc returns the value that was written, or -1 in case of error. */ ZEXTERN int ZEXPORT gzgetc OF((gzFile file)); /* Reads one byte from the compressed file. gzgetc returns this byte or -1 in case of end of file or error. */ ZEXTERN int ZEXPORT gzflush OF((gzFile file, int flush)); /* Flushes all pending output into the compressed file. The parameter flush is as in the deflate() function. The return value is the zlib error number (see function gzerror below). gzflush returns Z_OK if the flush parameter is Z_FINISH and all output could be flushed. gzflush should be called only when strictly necessary because it can degrade compression. */ ZEXTERN z_off_t ZEXPORT gzseek OF((gzFile file, z_off_t offset, int whence)); /* Sets the starting position for the next gzread or gzwrite on the given compressed file. The offset represents a number of bytes in the uncompressed data stream. The whence parameter is defined as in lseek(2); the value SEEK_END is not supported. If the file is opened for reading, this function is emulated but can be extremely slow. If the file is opened for writing, only forward seeks are supported; gzseek then compresses a sequence of zeroes up to the new starting position. gzseek returns the resulting offset location as measured in bytes from the beginning of the uncompressed stream, or -1 in case of error, in particular if the file is opened for writing and the new starting position would be before the current position. */ ZEXTERN int ZEXPORT gzrewind OF((gzFile file)); /* Rewinds the given file. This function is supported only for reading. gzrewind(file) is equivalent to (int)gzseek(file, 0L, SEEK_SET) */ ZEXTERN z_off_t ZEXPORT gztell OF((gzFile file)); /* Returns the starting position for the next gzread or gzwrite on the given compressed file. This position represents a number of bytes in the uncompressed data stream. gztell(file) is equivalent to gzseek(file, 0L, SEEK_CUR) */ ZEXTERN int ZEXPORT gzeof OF((gzFile file)); /* Returns 1 when EOF has previously been detected reading the given input stream, otherwise zero. */ ZEXTERN int ZEXPORT gzclose OF((gzFile file)); /* Flushes all pending output if necessary, closes the compressed file and deallocates all the (de)compression state. The return value is the zlib error number (see function gzerror below). */ ZEXTERN const char * ZEXPORT gzerror OF((gzFile file, int *errnum)); /* Returns the error message for the last error which occurred on the given compressed file. errnum is set to zlib error number. If an error occurred in the file system and not in the compression library, errnum is set to Z_ERRNO and the application may consult errno to get the exact error code. */ /* checksum functions */ /* These functions are not related to compression but are exported anyway because they might be useful in applications using the compression library. */ ZEXTERN uLong ZEXPORT adler32 OF((uLong adler, const Bytef *buf, uInt len)); /* Update a running Adler-32 checksum with the bytes buf[0..len-1] and return the updated checksum. If buf is NULL, this function returns the required initial value for the checksum. An Adler-32 checksum is almost as reliable as a CRC32 but can be computed much faster. Usage example: uLong adler = adler32(0L, Z_NULL, 0); while (read_buffer(buffer, length) != EOF) { adler = adler32(adler, buffer, length); } if (adler != original_adler) error(); */ ZEXTERN uLong ZEXPORT crc32 OF((uLong crc, const Bytef *buf, uInt len)); /* Update a running crc with the bytes buf[0..len-1] and return the updated crc. If buf is NULL, this function returns the required initial value for the crc. Pre- and post-conditioning (one's complement) is performed within this function so it shouldn't be done by the application. Usage example: uLong crc = crc32(0L, Z_NULL, 0); while (read_buffer(buffer, length) != EOF) { crc = crc32(crc, buffer, length); } if (crc != original_crc) error(); */ /* various hacks, don't look :) */ /* deflateInit and inflateInit are macros to allow checking the zlib version * and the compiler's view of z_stream: */ ZEXTERN int ZEXPORT deflateInit_ OF((z_streamp strm, int level, const char *version, int stream_size)); ZEXTERN int ZEXPORT inflateInit_ OF((z_streamp strm, const char *version, int stream_size)); ZEXTERN int ZEXPORT deflateInit2_ OF((z_streamp strm, int level, int method, int windowBits, int memLevel, int strategy, const char *version, int stream_size)); ZEXTERN int ZEXPORT inflateInit2_ OF((z_streamp strm, int windowBits, const char *version, int stream_size)); ZEXPORT int ZEXPORT inflateSave OF((z_streamp strm, char **resultp)); ZEXPORT int ZEXPORT inflateRestore OF((z_streamp strm, char *buf)); #define deflateInit(strm, level) \ deflateInit_((strm), (level), ZLIB_VERSION, sizeof(z_stream)) #define inflateInit(strm) \ inflateInit_((strm), ZLIB_VERSION, sizeof(z_stream)) #define deflateInit2(strm, level, method, windowBits, memLevel, strategy) \ deflateInit2_((strm),(level),(method),(windowBits),(memLevel),\ (strategy), ZLIB_VERSION, sizeof(z_stream)) #define inflateInit2(strm, windowBits) \ inflateInit2_((strm), (windowBits), ZLIB_VERSION, sizeof(z_stream)) #if !defined(_Z_UTIL_H) && !defined(NO_DUMMY_DECL) struct internal_state {int dummy;}; /* hack for buggy compilers */ #endif ZEXTERN const char * ZEXPORT zError OF((int err)); ZEXTERN int ZEXPORT inflateSyncPoint OF((z_streamp z)); ZEXTERN const uLongf * ZEXPORT get_crc_table OF((void)); #ifdef __cplusplus } #endif #endif /* _ZLIB_H */ avfs-1.1.4/zlib/infutil.h0000644000175000001440000000713714032341001012150 00000000000000/* infutil.h -- types and macros common to blocks and codes * Copyright (C) 1995-2002 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ #ifndef _INFUTIL_H #define _INFUTIL_H typedef enum { TYPE, /* get type bits (3, including end bit) */ LENS, /* get lengths for stored */ STORED, /* processing stored block */ TABLE, /* get table lengths */ BTREE, /* get bit lengths tree for a dynamic block */ DTREE, /* get length, distance trees for a dynamic block */ CODES, /* processing fixed or dynamic block */ DRY, /* output remaining window bytes */ DONE, /* finished last block, done */ BAD} /* got a data error--stuck here */ inflate_block_mode; /* inflate blocks semi-private state */ struct inflate_blocks_state { /* mode */ inflate_block_mode mode; /* current inflate_block mode */ /* mode dependent information */ union { uInt left; /* if STORED, bytes left to copy */ struct { uInt table; /* table lengths (14 bits) */ uInt index; /* index into blens (or border) */ uIntf *blens; /* bit lengths of codes */ uInt bb; /* bit length tree depth */ inflate_huft *tb; /* bit length decoding tree */ } trees; /* if DTREE, decoding info for trees */ struct { inflate_codes_statef *codes; } decode; /* if CODES, current state */ } sub; /* submode */ uInt last; /* true if this block is the last block */ /* mode independent information */ uInt bitk; /* bits in bit buffer */ uLong bitb; /* bit buffer */ inflate_huft *hufts; /* single malloc for tree space */ Bytef *window; /* sliding window */ Bytef *end; /* one byte after sliding window */ Bytef *read; /* window read pointer */ Bytef *write; /* window write pointer */ check_func checkfn; /* check function */ uLong check; /* check on output */ }; /* defines for inflate input/output */ /* update pointers and return */ #define UPDBITS {s->bitb=b;s->bitk=k;} #define UPDIN {z->avail_in=n;z->total_in+=p-z->next_in;z->next_in=p;} #define UPDOUT {s->write=q;} #define UPDATE {UPDBITS UPDIN UPDOUT} #define LEAVE {UPDATE return inflate_flush(s,z,r);} /* get bytes and bits */ #define LOADIN {p=z->next_in;n=z->avail_in;b=s->bitb;k=s->bitk;} #define NEEDBYTE {if(n)r=Z_OK;else LEAVE} #define NEXTBYTE (n--,*p++) #define NEEDBITS(j) {while(k<(j)){NEEDBYTE;b|=((uLong)NEXTBYTE)<>=(j);k-=(j);} /* output bytes */ #define WAVAIL (uInt)(qread?s->read-q-1:s->end-q) #define LOADOUT {q=s->write;m=(uInt)WAVAIL;} #define WRAP {if(q==s->end&&s->read!=s->window){q=s->window;m=(uInt)WAVAIL;}} #define FLUSH {UPDOUT r=inflate_flush(s,z,r); LOADOUT} #define NEEDOUT {if(m==0){WRAP if(m==0){FLUSH WRAP if(m==0) LEAVE}}r=Z_OK;} #define OUTBYTE(a) {*q++=(Byte)(a);m--;} /* load local pointers */ #define LOAD {LOADIN LOADOUT} /* masks for lower bits (size given to avoid silly warnings with Visual C++) */ extern uInt inflate_mask[17]; /* copy as much as possible from the sliding window to the output area */ extern int inflate_flush OF(( inflate_blocks_statef *, z_streamp , int)); struct internal_state {int dummy;}; /* for buggy compilers */ #endif avfs-1.1.4/zlib/infblock.c0000644000175000001440000003751614032341001012264 00000000000000/* infblock.c -- interpret and process block types to last block * Copyright (C) 1995-2002 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" #include "infblock.h" #include "inftrees.h" #include "infcodes.h" #include "infutil.h" #include struct inflate_codes_state {int dummy;}; /* for buggy compilers */ /* simplify the use of the inflate_huft type with some defines */ #define exop word.what.Exop #define bits word.what.Bits /* Table for deflate from PKZIP's appnote.txt. */ local const uInt border[] = { /* Order of the bit length code lengths */ 16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; /* Notes beyond the 1.93a appnote.txt: 1. Distance pointers never point before the beginning of the output stream. 2. Distance pointers can point back across blocks, up to 32k away. 3. There is an implied maximum of 7 bits for the bit length table and 15 bits for the actual data. 4. If only one code exists, then it is encoded using one bit. (Zero would be more efficient, but perhaps a little confusing.) If two codes exist, they are coded using one bit each (0 and 1). 5. There is no way of sending zero distance codes--a dummy must be sent if there are none. (History: a pre 2.0 version of PKZIP would store blocks with no distance codes, but this was discovered to be too harsh a criterion.) Valid only for 1.93a. 2.04c does allow zero distance codes, which is sent as one code of zero bits in length. 6. There are up to 286 literal/length codes. Code 256 represents the end-of-block. Note however that the static length tree defines 288 codes just to fill out the Huffman codes. Codes 286 and 287 cannot be used though, since there is no length base or extra bits defined for them. Similarily, there are up to 30 distance codes. However, static trees define 32 codes (all 5 bits) to fill out the Huffman codes, but the last two had better not show up in the data. 7. Unzip can check dynamic Huffman blocks for complete code sets. The exception is that a single code would not be complete (see #4). 8. The five bits following the block type is really the number of literal codes sent minus 257. 9. Length codes 8,16,16 are interpreted as 13 length codes of 8 bits (1+6+6). Therefore, to output three times the length, you output three codes (1+1+1), whereas to output four times the same length, you only need two codes (1+3). Hmm. 10. In the tree reconstruction algorithm, Code = Code + Increment only if BitLength(i) is not zero. (Pretty obvious.) 11. Correction: 4 Bits: # of Bit Length codes - 4 (4 - 19) 12. Note: length code 284 can represent 227-258, but length code 285 really is 258. The last length deserves its own, short code since it gets used a lot in very redundant files. The length 258 is special since 258 - 3 (the min match length) is 255. 13. The literal/length and distance code bit lengths are read as a single stream of lengths. It is possible (and advantageous) for a repeat code (16, 17, or 18) to go across the boundary between the two sets of lengths. */ void inflate_blocks_reset(s, z, c) inflate_blocks_statef *s; z_streamp z; uLongf *c; { if (c != Z_NULL) *c = s->check; if (s->mode == BTREE || s->mode == DTREE) ZFREE(z, s->sub.trees.blens); if (s->mode == CODES) inflate_codes_free(s->sub.decode.codes, z); s->mode = TYPE; s->bitk = 0; s->bitb = 0; s->read = s->write = s->window; if (s->checkfn != Z_NULL) z->adler = s->check = (*s->checkfn)(0L, (const Bytef *)Z_NULL, 0); Tracev((stderr, "inflate: blocks reset\n")); } inflate_blocks_statef *inflate_blocks_new(z, c, w) z_streamp z; check_func c; uInt w; { inflate_blocks_statef *s; if ((s = (inflate_blocks_statef *)ZALLOC (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL) return s; if ((s->hufts = (inflate_huft *)ZALLOC(z, sizeof(inflate_huft), MANY)) == Z_NULL) { ZFREE(z, s); return Z_NULL; } if ((s->window = (Bytef *)ZALLOC(z, 1, w)) == Z_NULL) { ZFREE(z, s->hufts); ZFREE(z, s); return Z_NULL; } s->end = s->window + w; s->checkfn = c; s->mode = TYPE; Tracev((stderr, "inflate: blocks allocated\n")); inflate_blocks_reset(s, z, Z_NULL); return s; } int inflate_blocks(s, z, r) inflate_blocks_statef *s; z_streamp z; int r; { uInt t; /* temporary storage */ uLong b; /* bit buffer */ uInt k; /* bits in bit buffer */ Bytef *p; /* input data pointer */ uInt n; /* bytes available there */ Bytef *q; /* output window write pointer */ uInt m; /* bytes to end of window or read pointer */ /* copy input/output information to locals (UPDATE macro restores) */ LOAD /* process input based on current state */ while (1) switch (s->mode) { case TYPE: NEEDBITS(3) t = (uInt)b & 7; s->last = t & 1; switch (t >> 1) { case 0: /* stored */ Tracev((stderr, "inflate: stored block%s\n", s->last ? " (last)" : "")); DUMPBITS(3) t = k & 7; /* go to byte boundary */ DUMPBITS(t) s->mode = LENS; /* get length of stored block */ break; case 1: /* fixed */ Tracev((stderr, "inflate: fixed codes block%s\n", s->last ? " (last)" : "")); { uInt bl, bd; inflate_huft *tl, *td; inflate_trees_fixed(&bl, &bd, &tl, &td, z); s->sub.decode.codes = inflate_codes_new(bl, bd, tl, td, z); if (s->sub.decode.codes == Z_NULL) { r = Z_MEM_ERROR; LEAVE } } DUMPBITS(3) s->mode = CODES; break; case 2: /* dynamic */ Tracev((stderr, "inflate: dynamic codes block%s\n", s->last ? " (last)" : "")); DUMPBITS(3) s->mode = TABLE; break; case 3: /* illegal */ DUMPBITS(3) s->mode = BAD; z->msg = (char*)"invalid block type"; r = Z_DATA_ERROR; LEAVE } break; case LENS: NEEDBITS(32) if ((((~b) >> 16) & 0xffff) != (b & 0xffff)) { s->mode = BAD; z->msg = (char*)"invalid stored block lengths"; r = Z_DATA_ERROR; LEAVE } s->sub.left = (uInt)b & 0xffff; b = k = 0; /* dump bits */ Tracev((stderr, "inflate: stored length %u\n", s->sub.left)); s->mode = s->sub.left ? STORED : (s->last ? DRY : TYPE); break; case STORED: if (n == 0) LEAVE NEEDOUT t = s->sub.left; if (t > n) t = n; if (t > m) t = m; zmemcpy(q, p, t); p += t; n -= t; q += t; m -= t; if ((s->sub.left -= t) != 0) break; Tracev((stderr, "inflate: stored end, %lu total out\n", z->total_out + (q >= s->read ? q - s->read : (s->end - s->read) + (q - s->window)))); s->mode = s->last ? DRY : TYPE; break; case TABLE: NEEDBITS(14) s->sub.trees.table = t = (uInt)b & 0x3fff; #ifndef PKZIP_BUG_WORKAROUND if ((t & 0x1f) > 29 || ((t >> 5) & 0x1f) > 29) { s->mode = BAD; z->msg = (char*)"too many length or distance symbols"; r = Z_DATA_ERROR; LEAVE } #endif t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f); if ((s->sub.trees.blens = (uIntf*)ZALLOC(z, t, sizeof(uInt))) == Z_NULL) { r = Z_MEM_ERROR; LEAVE } DUMPBITS(14) s->sub.trees.index = 0; Tracev((stderr, "inflate: table sizes ok\n")); s->mode = BTREE; case BTREE: while (s->sub.trees.index < 4 + (s->sub.trees.table >> 10)) { NEEDBITS(3) s->sub.trees.blens[border[s->sub.trees.index++]] = (uInt)b & 7; DUMPBITS(3) } while (s->sub.trees.index < 19) s->sub.trees.blens[border[s->sub.trees.index++]] = 0; s->sub.trees.bb = 7; t = inflate_trees_bits(s->sub.trees.blens, &s->sub.trees.bb, &s->sub.trees.tb, s->hufts, z); if (t != Z_OK) { r = t; if (r == Z_DATA_ERROR) { ZFREE(z, s->sub.trees.blens); s->mode = BAD; } LEAVE } s->sub.trees.index = 0; Tracev((stderr, "inflate: bits tree ok\n")); s->mode = DTREE; case DTREE: while (t = s->sub.trees.table, s->sub.trees.index < 258 + (t & 0x1f) + ((t >> 5) & 0x1f)) { inflate_huft *h; uInt i, j, c; t = s->sub.trees.bb; NEEDBITS(t) h = s->sub.trees.tb + ((uInt)b & inflate_mask[t]); t = h->bits; c = h->base; if (c < 16) { DUMPBITS(t) s->sub.trees.blens[s->sub.trees.index++] = c; } else /* c == 16..18 */ { i = c == 18 ? 7 : c - 14; j = c == 18 ? 11 : 3; NEEDBITS(t + i) DUMPBITS(t) j += (uInt)b & inflate_mask[i]; DUMPBITS(i) i = s->sub.trees.index; t = s->sub.trees.table; if (i + j > 258 + (t & 0x1f) + ((t >> 5) & 0x1f) || (c == 16 && i < 1)) { ZFREE(z, s->sub.trees.blens); s->mode = BAD; z->msg = (char*)"invalid bit length repeat"; r = Z_DATA_ERROR; LEAVE } c = c == 16 ? s->sub.trees.blens[i - 1] : 0; do { s->sub.trees.blens[i++] = c; } while (--j); s->sub.trees.index = i; } } s->sub.trees.tb = Z_NULL; { uInt bl, bd; inflate_huft *tl, *td; inflate_codes_statef *c; bl = 9; /* must be <= 9 for lookahead assumptions */ bd = 6; /* must be <= 9 for lookahead assumptions */ t = s->sub.trees.table; t = inflate_trees_dynamic(257 + (t & 0x1f), 1 + ((t >> 5) & 0x1f), s->sub.trees.blens, &bl, &bd, &tl, &td, s->hufts, z); if (t != Z_OK) { if (t == (uInt)Z_DATA_ERROR) { ZFREE(z, s->sub.trees.blens); s->mode = BAD; } r = t; LEAVE } Tracev((stderr, "inflate: trees ok\n")); if ((c = inflate_codes_new(bl, bd, tl, td, z)) == Z_NULL) { r = Z_MEM_ERROR; LEAVE } s->sub.decode.codes = c; } ZFREE(z, s->sub.trees.blens); s->mode = CODES; case CODES: UPDATE if ((r = inflate_codes(s, z, r)) != Z_STREAM_END) return inflate_flush(s, z, r); r = Z_OK; inflate_codes_free(s->sub.decode.codes, z); LOAD Tracev((stderr, "inflate: codes end, %lu total out\n", z->total_out + (q >= s->read ? q - s->read : (s->end - s->read) + (q - s->window)))); if (!s->last) { s->mode = TYPE; break; } s->mode = DRY; case DRY: FLUSH if (s->read != s->write) LEAVE s->mode = DONE; case DONE: r = Z_STREAM_END; LEAVE case BAD: r = Z_DATA_ERROR; LEAVE default: r = Z_STREAM_ERROR; LEAVE } } int inflate_blocks_free(s, z) inflate_blocks_statef *s; z_streamp z; { inflate_blocks_reset(s, z, Z_NULL); ZFREE(z, s->window); ZFREE(z, s->hufts); ZFREE(z, s); Tracev((stderr, "inflate: blocks freed\n")); return Z_OK; } void inflate_set_dictionary(s, d, n) inflate_blocks_statef *s; const Bytef *d; uInt n; { zmemcpy(s->window, d, n); s->read = s->write = s->window + n; } /* Returns true if inflate is currently at the end of a block generated * by Z_SYNC_FLUSH or Z_FULL_FLUSH. * IN assertion: s != Z_NULL */ int inflate_blocks_sync_point(s) inflate_blocks_statef *s; { return s->mode == LENS; } int inflate_blocks_save(bufp, at, s, z, w) char **bufp; int at; inflate_blocks_statef *s; z_streamp z; uInt w; { char *buf = *bufp; struct inflate_blocks_state scpy = *s; uInt t; unsigned len = 0; len += sizeof(struct inflate_blocks_state); if (s->mode == BTREE || s->mode == DTREE) { assert(s->sub.trees.blens != NULL); scpy.sub.trees.blens = NULL; t = s->sub.trees.table; t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f); len += t * sizeof(uInt); assert(s->sub.trees.tb == NULL || (s->sub.trees.tb >= s->hufts && s->sub.trees.tb < s->hufts + MANY)); scpy.sub.trees.tb = (inflate_huft *) (s->sub.trees.tb == NULL ? -1 : ((long) s->sub.trees.tb - (long) s->hufts)); } if (s->mode == CODES) { assert(s->sub.decode.codes != NULL); scpy.sub.decode.codes = NULL; } assert(s->hufts != NULL); scpy.hufts = NULL; assert(s->window != NULL); scpy.window = NULL; assert(s->end >= s->window && s->end <= s->window + w); scpy.end = (Bytef *) (s->end - s->window); assert(s->read >= s->window && s->read <= s->window + w); scpy.read = (Bytef *) (s->read - s->window); assert(s->write >= s->window && s->write <= s->window + w); scpy.write = (Bytef *) (s->write - s->window); scpy.checkfn = NULL; len += sizeof(inflate_huft) * MANY; len += w; *bufp = buf = realloc(buf, at + len); if(buf == NULL) return Z_MEM_ERROR; memcpy(buf + at, &scpy, sizeof(struct inflate_blocks_state)); at += sizeof(struct inflate_blocks_state); if (s->mode == BTREE || s->mode == DTREE) { t = s->sub.trees.table; t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f); memcpy(buf + at, s->sub.trees.blens, t * sizeof(uInt)); at += t * sizeof(uInt); } memcpy(buf + at, s->hufts, sizeof(inflate_huft) * MANY); at += sizeof(inflate_huft) * MANY; memcpy(buf + at, s->window, w); at += w; if (s->mode == CODES) { at = inflate_codes_save(bufp, at, s, z); if(at < 0) return at; } return at; } inflate_blocks_statef * inflate_blocks_restore(bufp, z, c, w) char **bufp; z_streamp z; check_func c; uInt w; { inflate_blocks_statef *s; uInt t; char *buf = *bufp; if ((s = (inflate_blocks_statef *)ZALLOC (z,1,sizeof(struct inflate_blocks_state))) == Z_NULL) return s; memcpy(s, buf, sizeof(struct inflate_blocks_state)); buf += sizeof(struct inflate_blocks_state); if ((s->hufts = (inflate_huft *)ZALLOC(z, sizeof(inflate_huft), MANY)) == Z_NULL) { ZFREE(z, s); return Z_NULL; } if ((s->window = (Bytef *)ZALLOC(z, 1, w)) == Z_NULL) { ZFREE(z, s->hufts); ZFREE(z, s); return Z_NULL; } if (s->mode == BTREE || s->mode == DTREE) { t = s->sub.trees.table; t = 258 + (t & 0x1f) + ((t >> 5) & 0x1f); if((s->sub.trees.blens = (uIntf*)ZALLOC(z, t, sizeof(uInt))) == Z_NULL) { ZFREE(z, s->window); ZFREE(z, s->hufts); ZFREE(z, s); return Z_NULL; } memcpy(s->sub.trees.blens, buf, t * sizeof(uInt)); buf += t * sizeof(uInt); if(s->sub.trees.tb == (inflate_huft *) -1) s->sub.trees.tb = NULL; else s->sub.trees.tb = (inflate_huft *) ((long) s->hufts + (long) s->sub.trees.tb); } memcpy(s->hufts, buf, sizeof(inflate_huft) * MANY); buf += sizeof(inflate_huft) * MANY; memcpy(s->window, buf, w); buf += w; s->end = s->window + (long) s->end; s->read = s->window + (long) s->read; s->write = s->window + (long) s->write; s->checkfn = c; *bufp = buf; if (s->mode == CODES) { s->sub.decode.codes = inflate_codes_restore(bufp, s, z); if(s->sub.decode.codes == Z_NULL) { inflate_blocks_free(s, z); return Z_NULL; } } return s; } avfs-1.1.4/zlib/trees.c0000644000175000001440000012531114032341001011606 00000000000000/* trees.c -- output deflated data using Huffman coding * Copyright (C) 1995-2002 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ /* * ALGORITHM * * The "deflation" process uses several Huffman trees. The more * common source values are represented by shorter bit sequences. * * Each code tree is stored in a compressed form which is itself * a Huffman encoding of the lengths of all the code strings (in * ascending order by source values). The actual code strings are * reconstructed from the lengths in the inflate process, as described * in the deflate specification. * * REFERENCES * * Deutsch, L.P.,"'Deflate' Compressed Data Format Specification". * Available in ftp.uu.net:/pub/archiving/zip/doc/deflate-1.1.doc * * Storer, James A. * Data Compression: Methods and Theory, pp. 49-50. * Computer Science Press, 1988. ISBN 0-7167-8156-5. * * Sedgewick, R. * Algorithms, p290. * Addison-Wesley, 1983. ISBN 0-201-06672-6. */ /* @(#) $Id: trees.c,v 1.2 2002/12/03 18:50:27 mszeredi Exp $ */ /* #define GEN_TREES_H */ #include "deflate.h" #ifdef DEBUG # include #endif /* =========================================================================== * Constants */ #define MAX_BL_BITS 7 /* Bit length codes must not exceed MAX_BL_BITS bits */ #define END_BLOCK 256 /* end of block literal code */ #define REP_3_6 16 /* repeat previous bit length 3-6 times (2 bits of repeat count) */ #define REPZ_3_10 17 /* repeat a zero length 3-10 times (3 bits of repeat count) */ #define REPZ_11_138 18 /* repeat a zero length 11-138 times (7 bits of repeat count) */ local const int extra_lbits[LENGTH_CODES] /* extra bits for each length code */ = {0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0}; local const int extra_dbits[D_CODES] /* extra bits for each distance code */ = {0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13}; local const int extra_blbits[BL_CODES]/* extra bits for each bit length code */ = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7}; local const uch bl_order[BL_CODES] = {16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15}; /* The lengths of the bit length codes are sent in order of decreasing * probability, to avoid transmitting the lengths for unused bit length codes. */ #define Buf_size (8 * 2*sizeof(char)) /* Number of bits used within bi_buf. (bi_buf might be implemented on * more than 16 bits on some systems.) */ /* =========================================================================== * Local data. These are initialized only once. */ #define DIST_CODE_LEN 512 /* see definition of array dist_code below */ #if defined(GEN_TREES_H) || !defined(STDC) /* non ANSI compilers may not accept trees.h */ local ct_data static_ltree[L_CODES+2]; /* The static literal tree. Since the bit lengths are imposed, there is no * need for the L_CODES extra codes used during heap construction. However * The codes 286 and 287 are needed to build a canonical tree (see _tr_init * below). */ local ct_data static_dtree[D_CODES]; /* The static distance tree. (Actually a trivial tree since all codes use * 5 bits.) */ uch _dist_code[DIST_CODE_LEN]; /* Distance codes. The first 256 values correspond to the distances * 3 .. 258, the last 256 values correspond to the top 8 bits of * the 15 bit distances. */ uch _length_code[MAX_MATCH-MIN_MATCH+1]; /* length code for each normalized match length (0 == MIN_MATCH) */ local int base_length[LENGTH_CODES]; /* First normalized length for each code (0 = MIN_MATCH) */ local int base_dist[D_CODES]; /* First normalized distance for each code (0 = distance of 1) */ #else # include "trees.h" #endif /* GEN_TREES_H */ struct static_tree_desc_s { const ct_data *static_tree; /* static tree or NULL */ const intf *extra_bits; /* extra bits for each code or NULL */ int extra_base; /* base index for extra_bits */ int elems; /* max number of elements in the tree */ int max_length; /* max bit length for the codes */ }; local static_tree_desc static_l_desc = {static_ltree, extra_lbits, LITERALS+1, L_CODES, MAX_BITS}; local static_tree_desc static_d_desc = {static_dtree, extra_dbits, 0, D_CODES, MAX_BITS}; local static_tree_desc static_bl_desc = {(const ct_data *)0, extra_blbits, 0, BL_CODES, MAX_BL_BITS}; /* =========================================================================== * Local (static) routines in this file. */ local void tr_static_init OF((void)); local void init_block OF((deflate_state *s)); local void pqdownheap OF((deflate_state *s, ct_data *tree, int k)); local void gen_bitlen OF((deflate_state *s, tree_desc *desc)); local void gen_codes OF((ct_data *tree, int max_code, ushf *bl_count)); local void build_tree OF((deflate_state *s, tree_desc *desc)); local void scan_tree OF((deflate_state *s, ct_data *tree, int max_code)); local void send_tree OF((deflate_state *s, ct_data *tree, int max_code)); local int build_bl_tree OF((deflate_state *s)); local void send_all_trees OF((deflate_state *s, int lcodes, int dcodes, int blcodes)); local void compress_block OF((deflate_state *s, ct_data *ltree, ct_data *dtree)); local void set_data_type OF((deflate_state *s)); local unsigned bi_reverse OF((unsigned value, int length)); local void bi_windup OF((deflate_state *s)); local void bi_flush OF((deflate_state *s)); local void copy_block OF((deflate_state *s, charf *buf, unsigned len, int header)); #ifdef GEN_TREES_H local void gen_trees_header OF((void)); #endif #ifndef DEBUG # define send_code(s, c, tree) send_bits(s, tree[c].Code, tree[c].Len) /* Send a code of the given tree. c and tree must not have side effects */ #else /* DEBUG */ # define send_code(s, c, tree) \ { if (z_verbose>2) fprintf(stderr,"\ncd %3d ",(c)); \ send_bits(s, tree[c].Code, tree[c].Len); } #endif /* =========================================================================== * Output a short LSB first on the stream. * IN assertion: there is enough room in pendingBuf. */ #define put_short(s, w) { \ put_byte(s, (uch)((w) & 0xff)); \ put_byte(s, (uch)((ush)(w) >> 8)); \ } /* =========================================================================== * Send a value on a given number of bits. * IN assertion: length <= 16 and value fits in length bits. */ #ifdef DEBUG local void send_bits OF((deflate_state *s, int value, int length)); local void send_bits(s, value, length) deflate_state *s; int value; /* value to send */ int length; /* number of bits */ { Tracevv((stderr," l %2d v %4x ", length, value)); Assert(length > 0 && length <= 15, "invalid length"); s->bits_sent += (ulg)length; /* If not enough room in bi_buf, use (valid) bits from bi_buf and * (16 - bi_valid) bits from value, leaving (width - (16-bi_valid)) * unused bits in value. */ if (s->bi_valid > (int)Buf_size - length) { s->bi_buf |= (value << s->bi_valid); put_short(s, s->bi_buf); s->bi_buf = (ush)value >> (Buf_size - s->bi_valid); s->bi_valid += length - Buf_size; } else { s->bi_buf |= value << s->bi_valid; s->bi_valid += length; } } #else /* !DEBUG */ #define send_bits(s, value, length) \ { int len = length;\ if (s->bi_valid > (int)Buf_size - len) {\ int val = value;\ s->bi_buf |= (val << s->bi_valid);\ put_short(s, s->bi_buf);\ s->bi_buf = (ush)val >> (Buf_size - s->bi_valid);\ s->bi_valid += len - Buf_size;\ } else {\ s->bi_buf |= (value) << s->bi_valid;\ s->bi_valid += len;\ }\ } #endif /* DEBUG */ #define MAX(a,b) (a >= b ? a : b) /* the arguments must not have side effects */ /* =========================================================================== * Initialize the various 'constant' tables. */ local void tr_static_init() { #if defined(GEN_TREES_H) || !defined(STDC) static int static_init_done = 0; int n; /* iterates over tree elements */ int bits; /* bit counter */ int length; /* length value */ int code; /* code value */ int dist; /* distance index */ ush bl_count[MAX_BITS+1]; /* number of codes at each bit length for an optimal tree */ if (static_init_done) return; /* For some embedded targets, global variables are not initialized: */ static_l_desc.static_tree = static_ltree; static_l_desc.extra_bits = extra_lbits; static_d_desc.static_tree = static_dtree; static_d_desc.extra_bits = extra_dbits; static_bl_desc.extra_bits = extra_blbits; /* Initialize the mapping length (0..255) -> length code (0..28) */ length = 0; for (code = 0; code < LENGTH_CODES-1; code++) { base_length[code] = length; for (n = 0; n < (1< dist code (0..29) */ dist = 0; for (code = 0 ; code < 16; code++) { base_dist[code] = dist; for (n = 0; n < (1<>= 7; /* from now on, all distances are divided by 128 */ for ( ; code < D_CODES; code++) { base_dist[code] = dist << 7; for (n = 0; n < (1<<(extra_dbits[code]-7)); n++) { _dist_code[256 + dist++] = (uch)code; } } Assert (dist == 256, "tr_static_init: 256+dist != 512"); /* Construct the codes of the static literal tree */ for (bits = 0; bits <= MAX_BITS; bits++) bl_count[bits] = 0; n = 0; while (n <= 143) static_ltree[n++].Len = 8, bl_count[8]++; while (n <= 255) static_ltree[n++].Len = 9, bl_count[9]++; while (n <= 279) static_ltree[n++].Len = 7, bl_count[7]++; while (n <= 287) static_ltree[n++].Len = 8, bl_count[8]++; /* Codes 286 and 287 do not exist, but we must include them in the * tree construction to get a canonical Huffman tree (longest code * all ones) */ gen_codes((ct_data *)static_ltree, L_CODES+1, bl_count); /* The static distance tree is trivial: */ for (n = 0; n < D_CODES; n++) { static_dtree[n].Len = 5; static_dtree[n].Code = bi_reverse((unsigned)n, 5); } static_init_done = 1; # ifdef GEN_TREES_H gen_trees_header(); # endif #endif /* defined(GEN_TREES_H) || !defined(STDC) */ } /* =========================================================================== * Genererate the file trees.h describing the static trees. */ #ifdef GEN_TREES_H # ifndef DEBUG # include # endif # define SEPARATOR(i, last, width) \ ((i) == (last)? "\n};\n\n" : \ ((i) % (width) == (width)-1 ? ",\n" : ", ")) void gen_trees_header() { FILE *header = fopen("trees.h", "w"); int i; Assert (header != NULL, "Can't open trees.h"); fprintf(header, "/* header created automatically with -DGEN_TREES_H */\n\n"); fprintf(header, "local const ct_data static_ltree[L_CODES+2] = {\n"); for (i = 0; i < L_CODES+2; i++) { fprintf(header, "{{%3u},{%3u}}%s", static_ltree[i].Code, static_ltree[i].Len, SEPARATOR(i, L_CODES+1, 5)); } fprintf(header, "local const ct_data static_dtree[D_CODES] = {\n"); for (i = 0; i < D_CODES; i++) { fprintf(header, "{{%2u},{%2u}}%s", static_dtree[i].Code, static_dtree[i].Len, SEPARATOR(i, D_CODES-1, 5)); } fprintf(header, "const uch _dist_code[DIST_CODE_LEN] = {\n"); for (i = 0; i < DIST_CODE_LEN; i++) { fprintf(header, "%2u%s", _dist_code[i], SEPARATOR(i, DIST_CODE_LEN-1, 20)); } fprintf(header, "const uch _length_code[MAX_MATCH-MIN_MATCH+1]= {\n"); for (i = 0; i < MAX_MATCH-MIN_MATCH+1; i++) { fprintf(header, "%2u%s", _length_code[i], SEPARATOR(i, MAX_MATCH-MIN_MATCH, 20)); } fprintf(header, "local const int base_length[LENGTH_CODES] = {\n"); for (i = 0; i < LENGTH_CODES; i++) { fprintf(header, "%1u%s", base_length[i], SEPARATOR(i, LENGTH_CODES-1, 20)); } fprintf(header, "local const int base_dist[D_CODES] = {\n"); for (i = 0; i < D_CODES; i++) { fprintf(header, "%5u%s", base_dist[i], SEPARATOR(i, D_CODES-1, 10)); } fclose(header); } #endif /* GEN_TREES_H */ /* =========================================================================== * Initialize the tree data structures for a new zlib stream. */ void _tr_init(s) deflate_state *s; { tr_static_init(); s->l_desc.dyn_tree = s->dyn_ltree; s->l_desc.stat_desc = &static_l_desc; s->d_desc.dyn_tree = s->dyn_dtree; s->d_desc.stat_desc = &static_d_desc; s->bl_desc.dyn_tree = s->bl_tree; s->bl_desc.stat_desc = &static_bl_desc; s->bi_buf = 0; s->bi_valid = 0; s->last_eob_len = 8; /* enough lookahead for inflate */ #ifdef DEBUG s->compressed_len = 0L; s->bits_sent = 0L; #endif /* Initialize the first block of the first file: */ init_block(s); } /* =========================================================================== * Initialize a new block. */ local void init_block(s) deflate_state *s; { int n; /* iterates over tree elements */ /* Initialize the trees. */ for (n = 0; n < L_CODES; n++) s->dyn_ltree[n].Freq = 0; for (n = 0; n < D_CODES; n++) s->dyn_dtree[n].Freq = 0; for (n = 0; n < BL_CODES; n++) s->bl_tree[n].Freq = 0; s->dyn_ltree[END_BLOCK].Freq = 1; s->opt_len = s->static_len = 0L; s->last_lit = s->matches = 0; } #define SMALLEST 1 /* Index within the heap array of least frequent node in the Huffman tree */ /* =========================================================================== * Remove the smallest element from the heap and recreate the heap with * one less element. Updates heap and heap_len. */ #define pqremove(s, tree, top) \ {\ top = s->heap[SMALLEST]; \ s->heap[SMALLEST] = s->heap[s->heap_len--]; \ pqdownheap(s, tree, SMALLEST); \ } /* =========================================================================== * Compares to subtrees, using the tree depth as tie breaker when * the subtrees have equal frequency. This minimizes the worst case length. */ #define smaller(tree, n, m, depth) \ (tree[n].Freq < tree[m].Freq || \ (tree[n].Freq == tree[m].Freq && depth[n] <= depth[m])) /* =========================================================================== * Restore the heap property by moving down the tree starting at node k, * exchanging a node with the smallest of its two sons if necessary, stopping * when the heap property is re-established (each father smaller than its * two sons). */ local void pqdownheap(s, tree, k) deflate_state *s; ct_data *tree; /* the tree to restore */ int k; /* node to move down */ { int v = s->heap[k]; int j = k << 1; /* left son of k */ while (j <= s->heap_len) { /* Set j to the smallest of the two sons: */ if (j < s->heap_len && smaller(tree, s->heap[j+1], s->heap[j], s->depth)) { j++; } /* Exit if v is smaller than both sons */ if (smaller(tree, v, s->heap[j], s->depth)) break; /* Exchange v with the smallest son */ s->heap[k] = s->heap[j]; k = j; /* And continue down the tree, setting j to the left son of k */ j <<= 1; } s->heap[k] = v; } /* =========================================================================== * Compute the optimal bit lengths for a tree and update the total bit length * for the current block. * IN assertion: the fields freq and dad are set, heap[heap_max] and * above are the tree nodes sorted by increasing frequency. * OUT assertions: the field len is set to the optimal bit length, the * array bl_count contains the frequencies for each bit length. * The length opt_len is updated; static_len is also updated if stree is * not null. */ local void gen_bitlen(s, desc) deflate_state *s; tree_desc *desc; /* the tree descriptor */ { ct_data *tree = desc->dyn_tree; int max_code = desc->max_code; const ct_data *stree = desc->stat_desc->static_tree; const intf *extra = desc->stat_desc->extra_bits; int base = desc->stat_desc->extra_base; int max_length = desc->stat_desc->max_length; int h; /* heap index */ int n, m; /* iterate over the tree elements */ int bits; /* bit length */ int xbits; /* extra bits */ ush f; /* frequency */ int overflow = 0; /* number of elements with bit length too large */ for (bits = 0; bits <= MAX_BITS; bits++) s->bl_count[bits] = 0; /* In a first pass, compute the optimal bit lengths (which may * overflow in the case of the bit length tree). */ tree[s->heap[s->heap_max]].Len = 0; /* root of the heap */ for (h = s->heap_max+1; h < HEAP_SIZE; h++) { n = s->heap[h]; bits = tree[tree[n].Dad].Len + 1; if (bits > max_length) bits = max_length, overflow++; tree[n].Len = (ush)bits; /* We overwrite tree[n].Dad which is no longer needed */ if (n > max_code) continue; /* not a leaf node */ s->bl_count[bits]++; xbits = 0; if (n >= base) xbits = extra[n-base]; f = tree[n].Freq; s->opt_len += (ulg)f * (bits + xbits); if (stree) s->static_len += (ulg)f * (stree[n].Len + xbits); } if (overflow == 0) return; Trace((stderr,"\nbit length overflow\n")); /* This happens for example on obj2 and pic of the Calgary corpus */ /* Find the first bit length which could increase: */ do { bits = max_length-1; while (s->bl_count[bits] == 0) bits--; s->bl_count[bits]--; /* move one leaf down the tree */ s->bl_count[bits+1] += 2; /* move one overflow item as its brother */ s->bl_count[max_length]--; /* The brother of the overflow item also moves one step up, * but this does not affect bl_count[max_length] */ overflow -= 2; } while (overflow > 0); /* Now recompute all bit lengths, scanning in increasing frequency. * h is still equal to HEAP_SIZE. (It is simpler to reconstruct all * lengths instead of fixing only the wrong ones. This idea is taken * from 'ar' written by Haruhiko Okumura.) */ for (bits = max_length; bits != 0; bits--) { n = s->bl_count[bits]; while (n != 0) { m = s->heap[--h]; if (m > max_code) continue; if (tree[m].Len != (unsigned) bits) { Trace((stderr,"code %d bits %d->%d\n", m, tree[m].Len, bits)); s->opt_len += ((long)bits - (long)tree[m].Len) *(long)tree[m].Freq; tree[m].Len = (ush)bits; } n--; } } } /* =========================================================================== * Generate the codes for a given tree and bit counts (which need not be * optimal). * IN assertion: the array bl_count contains the bit length statistics for * the given tree and the field len is set for all tree elements. * OUT assertion: the field code is set for all tree elements of non * zero code length. */ local void gen_codes (tree, max_code, bl_count) ct_data *tree; /* the tree to decorate */ int max_code; /* largest code with non zero frequency */ ushf *bl_count; /* number of codes at each bit length */ { ush next_code[MAX_BITS+1]; /* next code value for each bit length */ ush code = 0; /* running code value */ int bits; /* bit index */ int n; /* code index */ /* The distribution counts are first used to generate the code values * without bit reversal. */ for (bits = 1; bits <= MAX_BITS; bits++) { next_code[bits] = code = (code + bl_count[bits-1]) << 1; } /* Check that the bit counts in bl_count are consistent. The last code * must be all ones. */ Assert (code + bl_count[MAX_BITS]-1 == (1<dyn_tree; const ct_data *stree = desc->stat_desc->static_tree; int elems = desc->stat_desc->elems; int n, m; /* iterate over heap elements */ int max_code = -1; /* largest code with non zero frequency */ int node; /* new node being created */ /* Construct the initial heap, with least frequent element in * heap[SMALLEST]. The sons of heap[n] are heap[2*n] and heap[2*n+1]. * heap[0] is not used. */ s->heap_len = 0, s->heap_max = HEAP_SIZE; for (n = 0; n < elems; n++) { if (tree[n].Freq != 0) { s->heap[++(s->heap_len)] = max_code = n; s->depth[n] = 0; } else { tree[n].Len = 0; } } /* The pkzip format requires that at least one distance code exists, * and that at least one bit should be sent even if there is only one * possible code. So to avoid special checks later on we force at least * two codes of non zero frequency. */ while (s->heap_len < 2) { node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0); tree[node].Freq = 1; s->depth[node] = 0; s->opt_len--; if (stree) s->static_len -= stree[node].Len; /* node is 0 or 1 so it does not have extra bits */ } desc->max_code = max_code; /* The elements heap[heap_len/2+1 .. heap_len] are leaves of the tree, * establish sub-heaps of increasing lengths: */ for (n = s->heap_len/2; n >= 1; n--) pqdownheap(s, tree, n); /* Construct the Huffman tree by repeatedly combining the least two * frequent nodes. */ node = elems; /* next internal node of the tree */ do { pqremove(s, tree, n); /* n = node of least frequency */ m = s->heap[SMALLEST]; /* m = node of next least frequency */ s->heap[--(s->heap_max)] = n; /* keep the nodes sorted by frequency */ s->heap[--(s->heap_max)] = m; /* Create a new node father of n and m */ tree[node].Freq = tree[n].Freq + tree[m].Freq; s->depth[node] = (uch) (MAX(s->depth[n], s->depth[m]) + 1); tree[n].Dad = tree[m].Dad = (ush)node; #ifdef DUMP_BL_TREE if (tree == s->bl_tree) { fprintf(stderr,"\nnode %d(%d), sons %d(%d) %d(%d)", node, tree[node].Freq, n, tree[n].Freq, m, tree[m].Freq); } #endif /* and insert the new node in the heap */ s->heap[SMALLEST] = node++; pqdownheap(s, tree, SMALLEST); } while (s->heap_len >= 2); s->heap[--(s->heap_max)] = s->heap[SMALLEST]; /* At this point, the fields freq and dad are set. We can now * generate the bit lengths. */ gen_bitlen(s, (tree_desc *)desc); /* The field len is now set, we can generate the bit codes */ gen_codes ((ct_data *)tree, max_code, s->bl_count); } /* =========================================================================== * Scan a literal or distance tree to determine the frequencies of the codes * in the bit length tree. */ local void scan_tree (s, tree, max_code) deflate_state *s; ct_data *tree; /* the tree to be scanned */ int max_code; /* and its largest code of non zero frequency */ { int n; /* iterates over all tree elements */ int prevlen = -1; /* last emitted length */ int curlen; /* length of current code */ int nextlen = tree[0].Len; /* length of next code */ int count = 0; /* repeat count of the current code */ int max_count = 7; /* max repeat count */ int min_count = 4; /* min repeat count */ if (nextlen == 0) max_count = 138, min_count = 3; tree[max_code+1].Len = (ush)0xffff; /* guard */ for (n = 0; n <= max_code; n++) { curlen = nextlen; nextlen = tree[n+1].Len; if (++count < max_count && curlen == nextlen) { continue; } else if (count < min_count) { s->bl_tree[curlen].Freq += count; } else if (curlen != 0) { if (curlen != prevlen) s->bl_tree[curlen].Freq++; s->bl_tree[REP_3_6].Freq++; } else if (count <= 10) { s->bl_tree[REPZ_3_10].Freq++; } else { s->bl_tree[REPZ_11_138].Freq++; } count = 0; prevlen = curlen; if (nextlen == 0) { max_count = 138, min_count = 3; } else if (curlen == nextlen) { max_count = 6, min_count = 3; } else { max_count = 7, min_count = 4; } } } /* =========================================================================== * Send a literal or distance tree in compressed form, using the codes in * bl_tree. */ local void send_tree (s, tree, max_code) deflate_state *s; ct_data *tree; /* the tree to be scanned */ int max_code; /* and its largest code of non zero frequency */ { int n; /* iterates over all tree elements */ int prevlen = -1; /* last emitted length */ int curlen; /* length of current code */ int nextlen = tree[0].Len; /* length of next code */ int count = 0; /* repeat count of the current code */ int max_count = 7; /* max repeat count */ int min_count = 4; /* min repeat count */ /* tree[max_code+1].Len = -1; */ /* guard already set */ if (nextlen == 0) max_count = 138, min_count = 3; for (n = 0; n <= max_code; n++) { curlen = nextlen; nextlen = tree[n+1].Len; if (++count < max_count && curlen == nextlen) { continue; } else if (count < min_count) { do { send_code(s, curlen, s->bl_tree); } while (--count != 0); } else if (curlen != 0) { if (curlen != prevlen) { send_code(s, curlen, s->bl_tree); count--; } Assert(count >= 3 && count <= 6, " 3_6?"); send_code(s, REP_3_6, s->bl_tree); send_bits(s, count-3, 2); } else if (count <= 10) { send_code(s, REPZ_3_10, s->bl_tree); send_bits(s, count-3, 3); } else { send_code(s, REPZ_11_138, s->bl_tree); send_bits(s, count-11, 7); } count = 0; prevlen = curlen; if (nextlen == 0) { max_count = 138, min_count = 3; } else if (curlen == nextlen) { max_count = 6, min_count = 3; } else { max_count = 7, min_count = 4; } } } /* =========================================================================== * Construct the Huffman tree for the bit lengths and return the index in * bl_order of the last bit length code to send. */ local int build_bl_tree(s) deflate_state *s; { int max_blindex; /* index of last bit length code of non zero freq */ /* Determine the bit length frequencies for literal and distance trees */ scan_tree(s, (ct_data *)s->dyn_ltree, s->l_desc.max_code); scan_tree(s, (ct_data *)s->dyn_dtree, s->d_desc.max_code); /* Build the bit length tree: */ build_tree(s, (tree_desc *)(&(s->bl_desc))); /* opt_len now includes the length of the tree representations, except * the lengths of the bit lengths codes and the 5+5+4 bits for the counts. */ /* Determine the number of bit length codes to send. The pkzip format * requires that at least 4 bit length codes be sent. (appnote.txt says * 3 but the actual value used is 4.) */ for (max_blindex = BL_CODES-1; max_blindex >= 3; max_blindex--) { if (s->bl_tree[bl_order[max_blindex]].Len != 0) break; } /* Update opt_len to include the bit length tree and counts */ s->opt_len += 3*(max_blindex+1) + 5+5+4; Tracev((stderr, "\ndyn trees: dyn %ld, stat %ld", s->opt_len, s->static_len)); return max_blindex; } /* =========================================================================== * Send the header for a block using dynamic Huffman trees: the counts, the * lengths of the bit length codes, the literal tree and the distance tree. * IN assertion: lcodes >= 257, dcodes >= 1, blcodes >= 4. */ local void send_all_trees(s, lcodes, dcodes, blcodes) deflate_state *s; int lcodes, dcodes, blcodes; /* number of codes for each tree */ { int rank; /* index in bl_order */ Assert (lcodes >= 257 && dcodes >= 1 && blcodes >= 4, "not enough codes"); Assert (lcodes <= L_CODES && dcodes <= D_CODES && blcodes <= BL_CODES, "too many codes"); Tracev((stderr, "\nbl counts: ")); send_bits(s, lcodes-257, 5); /* not +255 as stated in appnote.txt */ send_bits(s, dcodes-1, 5); send_bits(s, blcodes-4, 4); /* not -3 as stated in appnote.txt */ for (rank = 0; rank < blcodes; rank++) { Tracev((stderr, "\nbl code %2d ", bl_order[rank])); send_bits(s, s->bl_tree[bl_order[rank]].Len, 3); } Tracev((stderr, "\nbl tree: sent %ld", s->bits_sent)); send_tree(s, (ct_data *)s->dyn_ltree, lcodes-1); /* literal tree */ Tracev((stderr, "\nlit tree: sent %ld", s->bits_sent)); send_tree(s, (ct_data *)s->dyn_dtree, dcodes-1); /* distance tree */ Tracev((stderr, "\ndist tree: sent %ld", s->bits_sent)); } /* =========================================================================== * Send a stored block */ void _tr_stored_block(s, buf, stored_len, eof) deflate_state *s; charf *buf; /* input block */ ulg stored_len; /* length of input block */ int eof; /* true if this is the last block for a file */ { send_bits(s, (STORED_BLOCK<<1)+eof, 3); /* send block type */ #ifdef DEBUG s->compressed_len = (s->compressed_len + 3 + 7) & (ulg)~7L; s->compressed_len += (stored_len + 4) << 3; #endif copy_block(s, buf, (unsigned)stored_len, 1); /* with header */ } /* =========================================================================== * Send one empty static block to give enough lookahead for inflate. * This takes 10 bits, of which 7 may remain in the bit buffer. * The current inflate code requires 9 bits of lookahead. If the * last two codes for the previous block (real code plus EOB) were coded * on 5 bits or less, inflate may have only 5+3 bits of lookahead to decode * the last real code. In this case we send two empty static blocks instead * of one. (There are no problems if the previous block is stored or fixed.) * To simplify the code, we assume the worst case of last real code encoded * on one bit only. */ void _tr_align(s) deflate_state *s; { send_bits(s, STATIC_TREES<<1, 3); send_code(s, END_BLOCK, static_ltree); #ifdef DEBUG s->compressed_len += 10L; /* 3 for block type, 7 for EOB */ #endif bi_flush(s); /* Of the 10 bits for the empty block, we have already sent * (10 - bi_valid) bits. The lookahead for the last real code (before * the EOB of the previous block) was thus at least one plus the length * of the EOB plus what we have just sent of the empty static block. */ if (1 + s->last_eob_len + 10 - s->bi_valid < 9) { send_bits(s, STATIC_TREES<<1, 3); send_code(s, END_BLOCK, static_ltree); #ifdef DEBUG s->compressed_len += 10L; #endif bi_flush(s); } s->last_eob_len = 7; } /* =========================================================================== * Determine the best encoding for the current block: dynamic trees, static * trees or store, and output the encoded block to the zip file. */ void _tr_flush_block(s, buf, stored_len, eof) deflate_state *s; charf *buf; /* input block, or NULL if too old */ ulg stored_len; /* length of input block */ int eof; /* true if this is the last block for a file */ { ulg opt_lenb, static_lenb; /* opt_len and static_len in bytes */ int max_blindex = 0; /* index of last bit length code of non zero freq */ /* Build the Huffman trees unless a stored block is forced */ if (s->level > 0) { /* Check if the file is ascii or binary */ if (s->data_type == Z_UNKNOWN) set_data_type(s); /* Construct the literal and distance trees */ build_tree(s, (tree_desc *)(&(s->l_desc))); Tracev((stderr, "\nlit data: dyn %ld, stat %ld", s->opt_len, s->static_len)); build_tree(s, (tree_desc *)(&(s->d_desc))); Tracev((stderr, "\ndist data: dyn %ld, stat %ld", s->opt_len, s->static_len)); /* At this point, opt_len and static_len are the total bit lengths of * the compressed block data, excluding the tree representations. */ /* Build the bit length tree for the above two trees, and get the index * in bl_order of the last bit length code to send. */ max_blindex = build_bl_tree(s); /* Determine the best encoding. Compute first the block length in bytes*/ opt_lenb = (s->opt_len+3+7)>>3; static_lenb = (s->static_len+3+7)>>3; Tracev((stderr, "\nopt %lu(%lu) stat %lu(%lu) stored %lu lit %u ", opt_lenb, s->opt_len, static_lenb, s->static_len, stored_len, s->last_lit)); if (static_lenb <= opt_lenb) opt_lenb = static_lenb; } else { Assert(buf != (char*)0, "lost buf"); opt_lenb = static_lenb = stored_len + 5; /* force a stored block */ } #ifdef FORCE_STORED if (buf != (char*)0) { /* force stored block */ #else if (stored_len+4 <= opt_lenb && buf != (char*)0) { /* 4: two words for the lengths */ #endif /* The test buf != NULL is only necessary if LIT_BUFSIZE > WSIZE. * Otherwise we can't have processed more than WSIZE input bytes since * the last block flush, because compression would have been * successful. If LIT_BUFSIZE <= WSIZE, it is never too late to * transform a block into a stored block. */ _tr_stored_block(s, buf, stored_len, eof); #ifdef FORCE_STATIC } else if (static_lenb >= 0) { /* force static trees */ #else } else if (static_lenb == opt_lenb) { #endif send_bits(s, (STATIC_TREES<<1)+eof, 3); compress_block(s, (ct_data *)static_ltree, (ct_data *)static_dtree); #ifdef DEBUG s->compressed_len += 3 + s->static_len; #endif } else { send_bits(s, (DYN_TREES<<1)+eof, 3); send_all_trees(s, s->l_desc.max_code+1, s->d_desc.max_code+1, max_blindex+1); compress_block(s, (ct_data *)s->dyn_ltree, (ct_data *)s->dyn_dtree); #ifdef DEBUG s->compressed_len += 3 + s->opt_len; #endif } Assert (s->compressed_len == s->bits_sent, "bad compressed size"); /* The above check is made mod 2^32, for files larger than 512 MB * and uLong implemented on 32 bits. */ init_block(s); if (eof) { bi_windup(s); #ifdef DEBUG s->compressed_len += 7; /* align on byte boundary */ #endif } Tracev((stderr,"\ncomprlen %lu(%lu) ", s->compressed_len>>3, s->compressed_len-7*eof)); } /* =========================================================================== * Save the match info and tally the frequency counts. Return true if * the current block must be flushed. */ int _tr_tally (s, dist, lc) deflate_state *s; unsigned dist; /* distance of matched string */ unsigned lc; /* match length-MIN_MATCH or unmatched char (if dist==0) */ { s->d_buf[s->last_lit] = (ush)dist; s->l_buf[s->last_lit++] = (uch)lc; if (dist == 0) { /* lc is the unmatched char */ s->dyn_ltree[lc].Freq++; } else { s->matches++; /* Here, lc is the match length - MIN_MATCH */ dist--; /* dist = match distance - 1 */ Assert((ush)dist < (ush)MAX_DIST(s) && (ush)lc <= (ush)(MAX_MATCH-MIN_MATCH) && (ush)d_code(dist) < (ush)D_CODES, "_tr_tally: bad match"); s->dyn_ltree[_length_code[lc]+LITERALS+1].Freq++; s->dyn_dtree[d_code(dist)].Freq++; } #ifdef TRUNCATE_BLOCK /* Try to guess if it is profitable to stop the current block here */ if ((s->last_lit & 0x1fff) == 0 && s->level > 2) { /* Compute an upper bound for the compressed length */ ulg out_length = (ulg)s->last_lit*8L; ulg in_length = (ulg)((long)s->strstart - s->block_start); int dcode; for (dcode = 0; dcode < D_CODES; dcode++) { out_length += (ulg)s->dyn_dtree[dcode].Freq * (5L+extra_dbits[dcode]); } out_length >>= 3; Tracev((stderr,"\nlast_lit %u, in %ld, out ~%ld(%ld%%) ", s->last_lit, in_length, out_length, 100L - out_length*100L/in_length)); if (s->matches < s->last_lit/2 && out_length < in_length/2) return 1; } #endif return (s->last_lit == s->lit_bufsize-1); /* We avoid equality with lit_bufsize because of wraparound at 64K * on 16 bit machines and because stored blocks are restricted to * 64K-1 bytes. */ } /* =========================================================================== * Send the block data compressed using the given Huffman trees */ local void compress_block(s, ltree, dtree) deflate_state *s; ct_data *ltree; /* literal tree */ ct_data *dtree; /* distance tree */ { unsigned dist; /* distance of matched string */ int lc; /* match length or unmatched char (if dist == 0) */ unsigned lx = 0; /* running index in l_buf */ unsigned code; /* the code to send */ int extra; /* number of extra bits to send */ if (s->last_lit != 0) do { dist = s->d_buf[lx]; lc = s->l_buf[lx++]; if (dist == 0) { send_code(s, lc, ltree); /* send a literal byte */ Tracecv(isgraph(lc), (stderr," '%c' ", lc)); } else { /* Here, lc is the match length - MIN_MATCH */ code = _length_code[lc]; send_code(s, code+LITERALS+1, ltree); /* send the length code */ extra = extra_lbits[code]; if (extra != 0) { lc -= base_length[code]; send_bits(s, lc, extra); /* send the extra length bits */ } dist--; /* dist is now the match distance - 1 */ code = d_code(dist); Assert (code < D_CODES, "bad d_code"); send_code(s, code, dtree); /* send the distance code */ extra = extra_dbits[code]; if (extra != 0) { dist -= base_dist[code]; send_bits(s, dist, extra); /* send the extra distance bits */ } } /* literal or match pair ? */ /* Check that the overlay between pending_buf and d_buf+l_buf is ok: */ Assert(s->pending < s->lit_bufsize + 2*lx, "pendingBuf overflow"); } while (lx < s->last_lit); send_code(s, END_BLOCK, ltree); s->last_eob_len = ltree[END_BLOCK].Len; } /* =========================================================================== * Set the data type to ASCII or BINARY, using a crude approximation: * binary if more than 20% of the bytes are <= 6 or >= 128, ascii otherwise. * IN assertion: the fields freq of dyn_ltree are set and the total of all * frequencies does not exceed 64K (to fit in an int on 16 bit machines). */ local void set_data_type(s) deflate_state *s; { int n = 0; unsigned ascii_freq = 0; unsigned bin_freq = 0; while (n < 7) bin_freq += s->dyn_ltree[n++].Freq; while (n < 128) ascii_freq += s->dyn_ltree[n++].Freq; while (n < LITERALS) bin_freq += s->dyn_ltree[n++].Freq; s->data_type = (Byte)(bin_freq > (ascii_freq >> 2) ? Z_BINARY : Z_ASCII); } /* =========================================================================== * Reverse the first len bits of a code, using straightforward code (a faster * method would use a table) * IN assertion: 1 <= len <= 15 */ local unsigned bi_reverse(code, len) unsigned code; /* the value to invert */ int len; /* its bit length */ { register unsigned res = 0; do { res |= code & 1; code >>= 1, res <<= 1; } while (--len > 0); return res >> 1; } /* =========================================================================== * Flush the bit buffer, keeping at most 7 bits in it. */ local void bi_flush(s) deflate_state *s; { if (s->bi_valid == 16) { put_short(s, s->bi_buf); s->bi_buf = 0; s->bi_valid = 0; } else if (s->bi_valid >= 8) { put_byte(s, (Byte)s->bi_buf); s->bi_buf >>= 8; s->bi_valid -= 8; } } /* =========================================================================== * Flush the bit buffer and align the output on a byte boundary */ local void bi_windup(s) deflate_state *s; { if (s->bi_valid > 8) { put_short(s, s->bi_buf); } else if (s->bi_valid > 0) { put_byte(s, (Byte)s->bi_buf); } s->bi_buf = 0; s->bi_valid = 0; #ifdef DEBUG s->bits_sent = (s->bits_sent+7) & ~7; #endif } /* =========================================================================== * Copy a stored block, storing first the length and its * one's complement if requested. */ local void copy_block(s, buf, len, header) deflate_state *s; charf *buf; /* the input data */ unsigned len; /* its length */ int header; /* true if block header must be written */ { bi_windup(s); /* align on byte boundary */ s->last_eob_len = 8; /* enough lookahead for inflate */ if (header) { put_short(s, (ush)len); put_short(s, (ush)~len); #ifdef DEBUG s->bits_sent += 2*16; #endif } #ifdef DEBUG s->bits_sent += (ulg)len<<3; #endif while (len--) { put_byte(s, *buf++); } } avfs-1.1.4/zlib/adler32.c0000644000175000001440000000242014032341001011713 00000000000000/* adler32.c -- compute the Adler-32 checksum of a data stream * Copyright (C) 1995-2002 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id: adler32.c,v 1.2 2002/12/03 18:50:25 mszeredi Exp $ */ #include "zlib.h" #define BASE 65521L /* largest prime smaller than 65536 */ #define NMAX 5552 /* NMAX is the largest n such that 255n(n+1)/2 + (n+1)(BASE-1) <= 2^32-1 */ #define DO1(buf,i) {s1 += buf[i]; s2 += s1;} #define DO2(buf,i) DO1(buf,i); DO1(buf,i+1); #define DO4(buf,i) DO2(buf,i); DO2(buf,i+2); #define DO8(buf,i) DO4(buf,i); DO4(buf,i+4); #define DO16(buf) DO8(buf,0); DO8(buf,8); /* ========================================================================= */ uLong ZEXPORT adler32(adler, buf, len) uLong adler; const Bytef *buf; uInt len; { unsigned long s1 = adler & 0xffff; unsigned long s2 = (adler >> 16) & 0xffff; int k; if (buf == Z_NULL) return 1L; while (len > 0) { k = len < NMAX ? len : NMAX; len -= k; while (k >= 16) { DO16(buf); buf += 16; k -= 16; } if (k != 0) do { s1 += *buf++; s2 += s1; } while (--k); s1 %= BASE; s2 %= BASE; } return (s2 << 16) | s1; } avfs-1.1.4/zlib/inftrees.h0000644000175000001440000000507014032341001012307 00000000000000/* inftrees.h -- header to use inftrees.c * Copyright (C) 1995-2002 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ /* Huffman code lookup table entry--this entry is four bytes for machines that have 16-bit pointers (e.g. PC's in the small or medium model). */ typedef struct inflate_huft_s FAR inflate_huft; struct inflate_huft_s { union { struct { Byte Exop; /* number of extra bits or operation */ Byte Bits; /* number of bits in this code or subcode */ } what; uInt pad; /* pad structure to a power of 2 (4 bytes for */ } word; /* 16-bit, 8 bytes for 32-bit int's) */ uInt base; /* literal, length base, distance base, or table offset */ }; /* Maximum size of dynamic tree. The maximum found in a long but non- exhaustive search was 1004 huft structures (850 for length/literals and 154 for distances, the latter actually the result of an exhaustive search). The actual maximum is not known, but the value below is more than safe. */ #define MANY 1440 extern int inflate_trees_bits OF(( uIntf *, /* 19 code lengths */ uIntf *, /* bits tree desired/actual depth */ inflate_huft * FAR *, /* bits tree result */ inflate_huft *, /* space for trees */ z_streamp)); /* for messages */ extern int inflate_trees_dynamic OF(( uInt, /* number of literal/length codes */ uInt, /* number of distance codes */ uIntf *, /* that many (total) code lengths */ uIntf *, /* literal desired/actual bit depth */ uIntf *, /* distance desired/actual bit depth */ inflate_huft * FAR *, /* literal/length tree result */ inflate_huft * FAR *, /* distance tree result */ inflate_huft *, /* space for trees */ z_streamp)); /* for messages */ extern int inflate_trees_fixed OF(( uIntf *, /* literal desired/actual bit depth */ uIntf *, /* distance desired/actual bit depth */ inflate_huft * FAR *, /* literal/length tree result */ inflate_huft * FAR *, /* distance tree result */ z_streamp)); /* for memory allocation */ avfs-1.1.4/zlib/zutil.h0000644000175000001440000001275114032341001011643 00000000000000/* zutil.h -- internal interface and configuration of the compression library * Copyright (C) 1995-2002 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ /* @(#) $Id: zutil.h,v 1.2 2002/12/03 18:50:27 mszeredi Exp $ */ #ifndef _Z_UTIL_H #define _Z_UTIL_H #include "zlib.h" #ifdef STDC # include # include # include #endif #ifdef NO_ERRNO_H extern int errno; #else # include #endif #ifndef local # define local static #endif /* compile with -Dlocal if your debugger can't find static symbols */ typedef unsigned char uch; typedef uch FAR uchf; typedef unsigned short ush; typedef ush FAR ushf; typedef unsigned long ulg; extern const char *z_errmsg[10]; /* indexed by 2-zlib_error */ /* (size given to avoid silly warnings with Visual C++) */ #define ERR_MSG(err) z_errmsg[Z_NEED_DICT-(err)] #define ERR_RETURN(strm,err) \ return (strm->msg = (char*)ERR_MSG(err), (err)) /* To be used only when the state is known to be valid */ /* common constants */ #ifndef DEF_WBITS # define DEF_WBITS MAX_WBITS #endif /* default windowBits for decompression. MAX_WBITS is for compression only */ #if MAX_MEM_LEVEL >= 8 # define DEF_MEM_LEVEL 8 #else # define DEF_MEM_LEVEL MAX_MEM_LEVEL #endif /* default memLevel */ #define STORED_BLOCK 0 #define STATIC_TREES 1 #define DYN_TREES 2 /* The three kinds of block type */ #define MIN_MATCH 3 #define MAX_MATCH 258 /* The minimum and maximum match lengths */ #define PRESET_DICT 0x20 /* preset dictionary flag in zlib header */ /* target dependencies */ #ifdef MSDOS # define OS_CODE 0x00 # if defined(__TURBOC__) || defined(__BORLANDC__) # if(__STDC__ == 1) && (defined(__LARGE__) || defined(__COMPACT__)) /* Allow compilation with ANSI keywords only enabled */ void _Cdecl farfree( void *block ); void *_Cdecl farmalloc( unsigned long nbytes ); # else # include # endif # else /* MSC or DJGPP */ # include # endif #endif #ifdef OS2 # define OS_CODE 0x06 #endif #ifdef WIN32 /* Window 95 & Windows NT */ # define OS_CODE 0x0b #endif #if defined(VAXC) || defined(VMS) # define OS_CODE 0x02 # define F_OPEN(name, mode) \ fopen((name), (mode), "mbc=60", "ctx=stm", "rfm=fix", "mrs=512") #endif #ifdef AMIGA # define OS_CODE 0x01 #endif #if defined(ATARI) || defined(atarist) # define OS_CODE 0x05 #endif #if defined(MACOS) || defined(TARGET_OS_MAC) # define OS_CODE 0x07 # if defined(__MWERKS__) && __dest_os != __be_os && __dest_os != __win32_os # include /* for fdopen */ # else # ifndef fdopen # define fdopen(fd,mode) NULL /* No fdopen() */ # endif # endif #endif #ifdef __50SERIES /* Prime/PRIMOS */ # define OS_CODE 0x0F #endif #ifdef TOPS20 # define OS_CODE 0x0a #endif #if defined(_BEOS_) || defined(RISCOS) # define fdopen(fd,mode) NULL /* No fdopen() */ #endif #if (defined(_MSC_VER) && (_MSC_VER > 600)) # define fdopen(fd,type) _fdopen(fd,type) #endif /* Common defaults */ #ifndef OS_CODE # define OS_CODE 0x03 /* assume Unix */ #endif #ifndef F_OPEN # define F_OPEN(name, mode) fopen((name), (mode)) #endif /* functions */ #ifdef HAVE_STRERROR extern char *strerror OF((int)); # define zstrerror(errnum) strerror(errnum) #else # define zstrerror(errnum) "" #endif #if defined(pyr) # define NO_MEMCPY #endif #if defined(SMALL_MEDIUM) && !defined(_MSC_VER) && !defined(__SC__) /* Use our own functions for small and medium model with MSC <= 5.0. * You may have to use the same strategy for Borland C (untested). * The __SC__ check is for Symantec. */ # define NO_MEMCPY #endif #if defined(STDC) && !defined(HAVE_MEMCPY) && !defined(NO_MEMCPY) # define HAVE_MEMCPY #endif #ifdef HAVE_MEMCPY # ifdef SMALL_MEDIUM /* MSDOS small or medium model */ # define zmemcpy _fmemcpy # define zmemcmp _fmemcmp # define zmemzero(dest, len) _fmemset(dest, 0, len) # else # define zmemcpy memcpy # define zmemcmp memcmp # define zmemzero(dest, len) memset(dest, 0, len) # endif #else extern void zmemcpy OF((Bytef* dest, const Bytef* source, uInt len)); extern int zmemcmp OF((const Bytef* s1, const Bytef* s2, uInt len)); extern void zmemzero OF((Bytef* dest, uInt len)); #endif /* Diagnostic functions */ #ifdef DEBUG # include extern int z_verbose; extern void z_error OF((char *m)); # define Assert(cond,msg) {if(!(cond)) z_error(msg);} # define Trace(x) {if (z_verbose>=0) fprintf x ;} # define Tracev(x) {if (z_verbose>0) fprintf x ;} # define Tracevv(x) {if (z_verbose>1) fprintf x ;} # define Tracec(c,x) {if (z_verbose>0 && (c)) fprintf x ;} # define Tracecv(c,x) {if (z_verbose>1 && (c)) fprintf x ;} #else # define Assert(cond,msg) # define Trace(x) # define Tracev(x) # define Tracevv(x) # define Tracec(c,x) # define Tracecv(c,x) #endif typedef uLong (ZEXPORT *check_func) OF((uLong check, const Bytef *buf, uInt len)); voidpf zcalloc OF((voidpf opaque, unsigned items, unsigned size)); void zcfree OF((voidpf opaque, voidpf ptr)); #define ZALLOC(strm, items, size) \ (*((strm)->zalloc))((strm)->opaque, (items), (size)) #define ZFREE(strm, addr) (*((strm)->zfree))((strm)->opaque, (voidpf)(addr)) #define TRY_FREE(s, p) {if (p) ZFREE(s, p);} #endif /* _Z_UTIL_H */ avfs-1.1.4/zlib/infcodes.c0000644000175000001440000002623614032341001012264 00000000000000/* infcodes.c -- process literals and length/distance pairs * Copyright (C) 1995-2002 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" #include "inftrees.h" #include "infblock.h" #include "infcodes.h" #include "infutil.h" #include "inffast.h" #include /* simplify the use of the inflate_huft type with some defines */ #define exop word.what.Exop #define bits word.what.Bits typedef enum { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */ START, /* x: set up for LEN */ LEN, /* i: get length/literal/eob next */ LENEXT, /* i: getting length extra (have base) */ DIST, /* i: get distance next */ DISTEXT, /* i: getting distance extra */ COPY, /* o: copying bytes in window, waiting for space */ LIT, /* o: got literal, waiting for output space */ WASH, /* o: got eob, possibly still output waiting */ END, /* x: got eob and all data flushed */ BADCODE} /* x: got error */ inflate_codes_mode; /* inflate codes private state */ struct inflate_codes_state { /* mode */ inflate_codes_mode mode; /* current inflate_codes mode */ /* mode dependent information */ uInt len; union { struct { inflate_huft *tree; /* pointer into tree */ uInt need; /* bits needed */ } code; /* if LEN or DIST, where in tree */ uInt lit; /* if LIT, literal */ struct { uInt get; /* bits to get for extra */ uInt dist; /* distance back to copy from */ } copy; /* if EXT or COPY, where and how much */ } sub; /* submode */ /* mode independent information */ Byte lbits; /* ltree bits decoded per branch */ Byte dbits; /* dtree bits decoder per branch */ inflate_huft *ltree; /* literal/length/eob tree */ inflate_huft *dtree; /* distance tree */ }; inflate_codes_statef *inflate_codes_new(bl, bd, tl, td, z) uInt bl, bd; inflate_huft *tl; inflate_huft *td; /* need separate declaration for Borland C++ */ z_streamp z; { inflate_codes_statef *c; if ((c = (inflate_codes_statef *) ZALLOC(z,1,sizeof(struct inflate_codes_state))) != Z_NULL) { c->mode = START; c->lbits = (Byte)bl; c->dbits = (Byte)bd; c->ltree = tl; c->dtree = td; Tracev((stderr, "inflate: codes new\n")); } return c; } int inflate_codes(s, z, r) inflate_blocks_statef *s; z_streamp z; int r; { uInt j; /* temporary storage */ inflate_huft *t; /* temporary pointer */ uInt e; /* extra bits or operation */ uLong b; /* bit buffer */ uInt k; /* bits in bit buffer */ Bytef *p; /* input data pointer */ uInt n; /* bytes available there */ Bytef *q; /* output window write pointer */ uInt m; /* bytes to end of window or read pointer */ Bytef *f; /* pointer to copy strings from */ inflate_codes_statef *c = s->sub.decode.codes; /* codes state */ /* copy input/output information to locals (UPDATE macro restores) */ LOAD /* process input and output based on current state */ while (1) switch (c->mode) { /* waiting for "i:"=input, "o:"=output, "x:"=nothing */ case START: /* x: set up for LEN */ #ifndef SLOW if (m >= 258 && n >= 10) { UPDATE r = inflate_fast(c->lbits, c->dbits, c->ltree, c->dtree, s, z); LOAD if (r != Z_OK) { c->mode = r == Z_STREAM_END ? WASH : BADCODE; break; } } #endif /* !SLOW */ c->sub.code.need = c->lbits; c->sub.code.tree = c->ltree; c->mode = LEN; case LEN: /* i: get length/literal/eob next */ j = c->sub.code.need; NEEDBITS(j) t = c->sub.code.tree + ((uInt)b & inflate_mask[j]); DUMPBITS(t->bits) e = (uInt)(t->exop); if (e == 0) /* literal */ { c->sub.lit = t->base; Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ? "inflate: literal '%c'\n" : "inflate: literal 0x%02x\n", t->base)); c->mode = LIT; break; } if (e & 16) /* length */ { c->sub.copy.get = e & 15; c->len = t->base; c->mode = LENEXT; break; } if ((e & 64) == 0) /* next table */ { c->sub.code.need = e; c->sub.code.tree = t + t->base; break; } if (e & 32) /* end of block */ { Tracevv((stderr, "inflate: end of block\n")); c->mode = WASH; break; } c->mode = BADCODE; /* invalid code */ z->msg = (char*)"invalid literal/length code"; r = Z_DATA_ERROR; LEAVE case LENEXT: /* i: getting length extra (have base) */ j = c->sub.copy.get; NEEDBITS(j) c->len += (uInt)b & inflate_mask[j]; DUMPBITS(j) c->sub.code.need = c->dbits; c->sub.code.tree = c->dtree; Tracevv((stderr, "inflate: length %u\n", c->len)); c->mode = DIST; case DIST: /* i: get distance next */ j = c->sub.code.need; NEEDBITS(j) t = c->sub.code.tree + ((uInt)b & inflate_mask[j]); DUMPBITS(t->bits) e = (uInt)(t->exop); if (e & 16) /* distance */ { c->sub.copy.get = e & 15; c->sub.copy.dist = t->base; c->mode = DISTEXT; break; } if ((e & 64) == 0) /* next table */ { c->sub.code.need = e; c->sub.code.tree = t + t->base; break; } c->mode = BADCODE; /* invalid code */ z->msg = (char*)"invalid distance code"; r = Z_DATA_ERROR; LEAVE case DISTEXT: /* i: getting distance extra */ j = c->sub.copy.get; NEEDBITS(j) c->sub.copy.dist += (uInt)b & inflate_mask[j]; DUMPBITS(j) Tracevv((stderr, "inflate: distance %u\n", c->sub.copy.dist)); c->mode = COPY; case COPY: /* o: copying bytes in window, waiting for space */ f = q - c->sub.copy.dist; while (f < s->window) /* modulo window size-"while" instead */ f += s->end - s->window; /* of "if" handles invalid distances */ while (c->len) { NEEDOUT OUTBYTE(*f++) if (f == s->end) f = s->window; c->len--; } c->mode = START; break; case LIT: /* o: got literal, waiting for output space */ NEEDOUT OUTBYTE(c->sub.lit) c->mode = START; break; case WASH: /* o: got eob, possibly more output */ if (k > 7) /* return unused byte, if any */ { Assert(k < 16, "inflate_codes grabbed too many bytes") k -= 8; n++; p--; /* can always return one */ } FLUSH if (s->read != s->write) LEAVE c->mode = END; case END: r = Z_STREAM_END; LEAVE case BADCODE: /* x: got error */ r = Z_DATA_ERROR; LEAVE default: r = Z_STREAM_ERROR; LEAVE } #ifdef NEED_DUMMY_RETURN return Z_STREAM_ERROR; /* Some dumb compilers complain without this */ #endif } void inflate_codes_free(c, z) inflate_codes_statef *c; z_streamp z; { ZFREE(z, c); Tracev((stderr, "inflate: codes free\n")); } int inflate_codes_save(bufp, at, s, z) char **bufp; int at; inflate_blocks_statef *s; z_streamp z; { char *buf = *bufp; inflate_codes_statef *c = s->sub.decode.codes; struct inflate_codes_state ccpy = *c; char fixed_tree = 0; /* this is a flag for the restore code to indicate that a tree pointer points to a fixed table instead of dynamic one. Bit 0 is for the c->ltree/dtree, bit 1 for c->sub.code.tree */ if(c->mode == LEN || c->mode == DIST) { if(c->sub.code.tree >= s->hufts && c->sub.code.tree < s->hufts + MANY) { ccpy.sub.code.tree = (inflate_huft *) ((long) c->sub.code.tree - (long) s->hufts); } else { /* this is an assumption, it will be checked in restore */ fixed_tree |= 2; } } if(c->ltree >= s->hufts && c->ltree < s->hufts + MANY) { ccpy.ltree = (inflate_huft *) ((long) c->ltree - (long) s->hufts); assert(c->dtree >= s->hufts && c->dtree < s->hufts + MANY); ccpy.dtree = (inflate_huft *) ((long) c->dtree - (long) s->hufts); } else { /* this is an assumption, it will be checked in restore */ fixed_tree |= 1; } *bufp = buf = realloc(buf, at + sizeof(struct inflate_codes_state) + 1); if(buf == NULL) return Z_MEM_ERROR; memcpy(buf + at, &ccpy, sizeof(struct inflate_codes_state)); at += sizeof(struct inflate_codes_state); buf[at++] = fixed_tree; return at; } inflate_codes_statef *inflate_codes_restore(bufp, s, z) char **bufp; inflate_blocks_statef *s; z_streamp z; { char *buf = *bufp; inflate_codes_statef *c; char fixed_tree = 0; if ((c = (inflate_codes_statef *) ZALLOC(z,1,sizeof(struct inflate_codes_state))) == Z_NULL) return c; memcpy(c, buf, sizeof(struct inflate_codes_state)); fixed_tree = buf[sizeof(struct inflate_codes_state)]; if( (fixed_tree & 1) == 0) { c->ltree = (inflate_huft *) ((long) s->hufts + (long) c->ltree); c->dtree = (inflate_huft *) ((long) s->hufts + (long) c->dtree); } else if( (fixed_tree & 1) == 1) { Byte old_lbits = c->lbits; Byte old_dbits = c->dbits; inflate_huft *old_ltree = c->ltree; inflate_huft *old_dtree = c->dtree; uInt bl, bd; if(inflate_trees_fixed(&bl, &bd, &c->ltree, &c->dtree, z) != Z_OK) { ZFREE(z, c); return Z_NULL; } c->lbits = (Byte)bl; c->dbits = (Byte)bd; /* it was an assumption that fixed trees are used if one of the following conditions is false we were wrong */ if(c->lbits != old_lbits || c->dbits != old_dbits || c->ltree != old_ltree || c->dtree != old_dtree) { ZFREE(z, c); return Z_NULL; } } else { return Z_NULL; } buf += sizeof(struct inflate_codes_state) + 1; *bufp = buf; if(c->mode == LEN || c->mode == DIST) { if (fixed_tree & 2) { /* c->sub.code.tree is probably also a fixed tree */ Byte old_lbits = c->lbits; inflate_huft *old_ltree = c->ltree; inflate_huft *temp_dtree; uInt bl, bd; if(inflate_trees_fixed(&bl, &bd, &c->sub.code.tree, &temp_dtree, z) != Z_OK) { ZFREE(z, c); return Z_NULL; } c->sub.code.need = (Byte)bl; /* it was an assumption that fixed trees are used if one of the following conditions is false we were wrong */ if (c->sub.code.tree != old_ltree || c->sub.code.need != old_lbits) { ZFREE(z, c); return Z_NULL; } } else { c->sub.code.tree = (inflate_huft *) ((long) s->hufts + (long) c->sub.code.tree); } } return c; } avfs-1.1.4/zlib/inftrees.c0000644000175000001440000003724414032341001012312 00000000000000/* inftrees.c -- generate Huffman trees for efficient decoding * Copyright (C) 1995-2002 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" #include "inftrees.h" #if !defined(BUILDFIXED) && !defined(STDC) # define BUILDFIXED /* non ANSI compilers may not accept inffixed.h */ #endif const char inflate_copyright[] = " inflate 1.1.4 Copyright 1995-2002 Mark Adler "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot include such an acknowledgment, I would appreciate that you keep this copyright string in the executable of your product. */ struct internal_state {int dummy;}; /* for buggy compilers */ /* simplify the use of the inflate_huft type with some defines */ #define exop word.what.Exop #define bits word.what.Bits local int huft_build OF(( uIntf *, /* code lengths in bits */ uInt, /* number of codes */ uInt, /* number of "simple" codes */ const uIntf *, /* list of base values for non-simple codes */ const uIntf *, /* list of extra bits for non-simple codes */ inflate_huft * FAR*,/* result: starting table */ uIntf *, /* maximum lookup bits (returns actual) */ inflate_huft *, /* space for trees */ uInt *, /* hufts used in space */ uIntf * )); /* space for values */ /* Tables for deflate from PKZIP's appnote.txt. */ local const uInt cplens[31] = { /* Copy lengths for literal codes 257..285 */ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; /* see note #13 above about 258 */ local const uInt cplext[31] = { /* Extra bits for literal codes 257..285 */ 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0, 112, 112}; /* 112==invalid */ local const uInt cpdist[30] = { /* Copy offsets for distance codes 0..29 */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577}; local const uInt cpdext[30] = { /* Extra bits for distance codes */ 0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13}; /* Huffman code decoding is performed using a multi-level table lookup. The fastest way to decode is to simply build a lookup table whose size is determined by the longest code. However, the time it takes to build this table can also be a factor if the data being decoded is not very long. The most common codes are necessarily the shortest codes, so those codes dominate the decoding time, and hence the speed. The idea is you can have a shorter table that decodes the shorter, more probable codes, and then point to subsidiary tables for the longer codes. The time it costs to decode the longer codes is then traded against the time it takes to make longer tables. This results of this trade are in the variables lbits and dbits below. lbits is the number of bits the first level table for literal/ length codes can decode in one step, and dbits is the same thing for the distance codes. Subsequent tables are also less than or equal to those sizes. These values may be adjusted either when all of the codes are shorter than that, in which case the longest code length in bits is used, or when the shortest code is *longer* than the requested table size, in which case the length of the shortest code in bits is used. There are two different values for the two tables, since they code a different number of possibilities each. The literal/length table codes 286 possible values, or in a flat code, a little over eight bits. The distance table codes 30 possible values, or a little less than five bits, flat. The optimum values for speed end up being about one bit more than those, so lbits is 8+1 and dbits is 5+1. The optimum values may differ though from machine to machine, and possibly even between compilers. Your mileage may vary. */ /* If BMAX needs to be larger than 16, then h and x[] should be uLong. */ #define BMAX 15 /* maximum bit length of any code */ local int huft_build(b, n, s, d, e, t, m, hp, hn, v) uIntf *b; /* code lengths in bits (all assumed <= BMAX) */ uInt n; /* number of codes (assumed <= 288) */ uInt s; /* number of simple-valued codes (0..s-1) */ const uIntf *d; /* list of base values for non-simple codes */ const uIntf *e; /* list of extra bits for non-simple codes */ inflate_huft * FAR *t; /* result: starting table */ uIntf *m; /* maximum lookup bits, returns actual */ inflate_huft *hp; /* space for trees */ uInt *hn; /* hufts used in space */ uIntf *v; /* working area: values in order of bit length */ /* Given a list of code lengths and a maximum table size, make a set of tables to decode that set of codes. Return Z_OK on success, Z_BUF_ERROR if the given code set is incomplete (the tables are still built in this case), or Z_DATA_ERROR if the input is invalid. */ { uInt a; /* counter for codes of length k */ uInt c[BMAX+1]; /* bit length count table */ uInt f; /* i repeats in table every f entries */ int g; /* maximum code length */ int h; /* table level */ register uInt i; /* counter, current code */ register uInt j; /* counter */ register int k; /* number of bits in current code */ int l; /* bits per table (returned in m) */ uInt mask; /* (1 << w) - 1, to avoid cc -O bug on HP */ register uIntf *p; /* pointer into c[], b[], or v[] */ inflate_huft *q; /* points to current table */ struct inflate_huft_s r; /* table entry for structure assignment */ inflate_huft *u[BMAX]; /* table stack */ register int w; /* bits before this table == (l * h) */ uInt x[BMAX+1]; /* bit offsets, then code stack */ uIntf *xp; /* pointer into x */ int y; /* number of dummy codes added */ uInt z; /* number of entries in current table */ /* Generate counts for each bit length */ p = c; #define C0 *p++ = 0; #define C2 C0 C0 C0 C0 #define C4 C2 C2 C2 C2 C4 /* clear c[]--assume BMAX+1 is 16 */ p = b; i = n; do { c[*p++]++; /* assume all entries <= BMAX */ } while (--i); if (c[0] == n) /* null input--all zero length codes */ { *t = (inflate_huft *)Z_NULL; *m = 0; return Z_OK; } /* Find minimum and maximum length, bound *m by those */ l = *m; for (j = 1; j <= BMAX; j++) if (c[j]) break; k = j; /* minimum code length */ if ((uInt)l < j) l = j; for (i = BMAX; i; i--) if (c[i]) break; g = i; /* maximum code length */ if ((uInt)l > i) l = i; *m = l; /* Adjust last length count to fill out codes, if needed */ for (y = 1 << j; j < i; j++, y <<= 1) if ((y -= c[j]) < 0) return Z_DATA_ERROR; if ((y -= c[i]) < 0) return Z_DATA_ERROR; c[i] += y; /* Generate starting offsets into the value table for each length */ x[1] = j = 0; p = c + 1; xp = x + 2; while (--i) { /* note that i == g from above */ *xp++ = (j += *p++); } /* Make a table of values in order of bit lengths */ p = b; i = 0; do { if ((j = *p++) != 0) v[x[j]++] = i; } while (++i < n); n = x[g]; /* set n to length of v */ /* Generate the Huffman codes and for each, make the table entries */ x[0] = i = 0; /* first Huffman code is zero */ p = v; /* grab values in bit order */ h = -1; /* no tables yet--level -1 */ w = -l; /* bits decoded == (l * h) */ u[0] = (inflate_huft *)Z_NULL; /* just to keep compilers happy */ q = (inflate_huft *)Z_NULL; /* ditto */ z = 0; /* ditto */ /* go through the bit lengths (k already is bits in shortest code) */ for (; k <= g; k++) { a = c[k]; while (a--) { /* here i is the Huffman code of length k bits for value *p */ /* make tables up to required level */ while (k > w + l) { h++; w += l; /* previous table always l bits */ /* compute minimum size table less than or equal to l bits */ z = g - w; z = z > (uInt)l ? l : z; /* table size upper limit */ if ((f = 1 << (j = k - w)) > a + 1) /* try a k-w bit table */ { /* too few codes for k-w bit table */ f -= a + 1; /* deduct codes from patterns left */ xp = c + k; if (j < z) while (++j < z) /* try smaller tables up to z bits */ { if ((f <<= 1) <= *++xp) break; /* enough codes to use up j bits */ f -= *xp; /* else deduct codes from patterns */ } } z = 1 << j; /* table entries for j-bit table */ /* allocate new table */ if (*hn + z > MANY) /* (note: doesn't matter for fixed) */ return Z_DATA_ERROR; /* overflow of MANY */ u[h] = q = hp + *hn; *hn += z; /* connect to last table, if there is one */ if (h) { x[h] = i; /* save pattern for backing up */ r.bits = (Byte)l; /* bits to dump before this table */ r.exop = (Byte)j; /* bits in this table */ j = i >> (w - l); r.base = (uInt)(q - u[h-1] - j); /* offset to this table */ u[h-1][j] = r; /* connect to last table */ } else *t = q; /* first table is returned result */ } /* set up table entry in r */ r.bits = (Byte)(k - w); if (p >= v + n) { r.exop = 128 + 64; /* out of values--invalid code */ r.base = 0; } else if (*p < s) { r.exop = (Byte)(*p < 256 ? 0 : 32 + 64); /* 256 is end-of-block */ r.base = *p++; /* simple code is just the value */ } else { r.exop = (Byte)(e[*p - s] + 16 + 64);/* non-simple--look up in lists */ r.base = d[*p++ - s]; } /* fill code-like entries with r */ f = 1 << (k - w); for (j = i >> w; j < z; j += f) q[j] = r; /* backwards increment the k-bit code i */ for (j = 1 << (k - 1); i & j; j >>= 1) i ^= j; i ^= j; /* backup over finished tables */ mask = (1 << w) - 1; /* needed on HP, cc -O bug */ while ((i & mask) != x[h]) { h--; /* don't need to update q */ w -= l; mask = (1 << w) - 1; } } } /* Return Z_BUF_ERROR if we were given an incomplete table */ return y != 0 && g != 1 ? Z_BUF_ERROR : Z_OK; } int inflate_trees_bits(c, bb, tb, hp, z) uIntf *c; /* 19 code lengths */ uIntf *bb; /* bits tree desired/actual depth */ inflate_huft * FAR *tb; /* bits tree result */ inflate_huft *hp; /* space for trees */ z_streamp z; /* for messages */ { int r; uInt hn = 0; /* hufts used in space */ uIntf *v; /* work area for huft_build */ if ((v = (uIntf*)ZALLOC(z, 19, sizeof(uInt))) == Z_NULL) return Z_MEM_ERROR; r = huft_build(c, 19, 19, (uIntf*)Z_NULL, (uIntf*)Z_NULL, tb, bb, hp, &hn, v); if (r == Z_DATA_ERROR) z->msg = (char*)"oversubscribed dynamic bit lengths tree"; else if (r == Z_BUF_ERROR || *bb == 0) { z->msg = (char*)"incomplete dynamic bit lengths tree"; r = Z_DATA_ERROR; } ZFREE(z, v); return r; } int inflate_trees_dynamic(nl, nd, c, bl, bd, tl, td, hp, z) uInt nl; /* number of literal/length codes */ uInt nd; /* number of distance codes */ uIntf *c; /* that many (total) code lengths */ uIntf *bl; /* literal desired/actual bit depth */ uIntf *bd; /* distance desired/actual bit depth */ inflate_huft * FAR *tl; /* literal/length tree result */ inflate_huft * FAR *td; /* distance tree result */ inflate_huft *hp; /* space for trees */ z_streamp z; /* for messages */ { int r; uInt hn = 0; /* hufts used in space */ uIntf *v; /* work area for huft_build */ /* allocate work area */ if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL) return Z_MEM_ERROR; /* build literal/length tree */ r = huft_build(c, nl, 257, cplens, cplext, tl, bl, hp, &hn, v); if (r != Z_OK || *bl == 0) { if (r == Z_DATA_ERROR) z->msg = (char*)"oversubscribed literal/length tree"; else if (r != Z_MEM_ERROR) { z->msg = (char*)"incomplete literal/length tree"; r = Z_DATA_ERROR; } ZFREE(z, v); return r; } /* build distance tree */ r = huft_build(c + nl, nd, 0, cpdist, cpdext, td, bd, hp, &hn, v); if (r != Z_OK || (*bd == 0 && nl > 257)) { if (r == Z_DATA_ERROR) z->msg = (char*)"oversubscribed distance tree"; else if (r == Z_BUF_ERROR) { #ifdef PKZIP_BUG_WORKAROUND r = Z_OK; } #else z->msg = (char*)"incomplete distance tree"; r = Z_DATA_ERROR; } else if (r != Z_MEM_ERROR) { z->msg = (char*)"empty distance tree with lengths"; r = Z_DATA_ERROR; } ZFREE(z, v); return r; #endif } /* done */ ZFREE(z, v); return Z_OK; } /* build fixed tables only once--keep them here */ #ifdef BUILDFIXED local int fixed_built = 0; #define FIXEDH 544 /* number of hufts used by fixed tables */ local inflate_huft fixed_mem[FIXEDH]; local uInt fixed_bl; local uInt fixed_bd; local inflate_huft *fixed_tl; local inflate_huft *fixed_td; #else #include "inffixed.h" #endif int inflate_trees_fixed(bl, bd, tl, td, z) uIntf *bl; /* literal desired/actual bit depth */ uIntf *bd; /* distance desired/actual bit depth */ inflate_huft * FAR *tl; /* literal/length tree result */ inflate_huft * FAR *td; /* distance tree result */ z_streamp z; /* for memory allocation */ { #ifdef BUILDFIXED /* build fixed tables if not already */ if (!fixed_built) { int k; /* temporary variable */ uInt f = 0; /* number of hufts used in fixed_mem */ uIntf *c; /* length list for huft_build */ uIntf *v; /* work area for huft_build */ /* allocate memory */ if ((c = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL) return Z_MEM_ERROR; if ((v = (uIntf*)ZALLOC(z, 288, sizeof(uInt))) == Z_NULL) { ZFREE(z, c); return Z_MEM_ERROR; } /* literal table */ for (k = 0; k < 144; k++) c[k] = 8; for (; k < 256; k++) c[k] = 9; for (; k < 280; k++) c[k] = 7; for (; k < 288; k++) c[k] = 8; fixed_bl = 9; huft_build(c, 288, 257, cplens, cplext, &fixed_tl, &fixed_bl, fixed_mem, &f, v); /* distance table */ for (k = 0; k < 30; k++) c[k] = 5; fixed_bd = 5; huft_build(c, 30, 0, cpdist, cpdext, &fixed_td, &fixed_bd, fixed_mem, &f, v); /* done */ ZFREE(z, v); ZFREE(z, c); fixed_built = 1; } #endif *bl = fixed_bl; *bd = fixed_bd; *tl = fixed_tl; *td = fixed_td; return Z_OK; } avfs-1.1.4/zlib/inffixed.h0000644000175000001440000002134014032341001012262 00000000000000/* inffixed.h -- table for decoding fixed codes * Generated automatically by the maketree.c program */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ local uInt fixed_bl = 9; local uInt fixed_bd = 5; local inflate_huft fixed_tl[] = { {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115}, {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},192}, {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},160}, {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},224}, {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},144}, {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},208}, {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},176}, {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},240}, {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227}, {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},200}, {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},168}, {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},232}, {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},152}, {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},216}, {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},184}, {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},248}, {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163}, {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},196}, {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},164}, {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},228}, {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},148}, {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},212}, {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},180}, {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},244}, {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0}, {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},204}, {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},172}, {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},236}, {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},156}, {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},220}, {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},188}, {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},252}, {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131}, {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},194}, {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},162}, {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},226}, {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},146}, {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},210}, {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},178}, {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},242}, {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258}, {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},202}, {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},170}, {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},234}, {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},154}, {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},218}, {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},186}, {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},250}, {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195}, {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},198}, {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},166}, {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},230}, {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},150}, {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},214}, {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},182}, {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},246}, {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0}, {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},206}, {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},174}, {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},238}, {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},158}, {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},222}, {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},190}, {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},254}, {{{96,7}},256}, {{{0,8}},80}, {{{0,8}},16}, {{{84,8}},115}, {{{82,7}},31}, {{{0,8}},112}, {{{0,8}},48}, {{{0,9}},193}, {{{80,7}},10}, {{{0,8}},96}, {{{0,8}},32}, {{{0,9}},161}, {{{0,8}},0}, {{{0,8}},128}, {{{0,8}},64}, {{{0,9}},225}, {{{80,7}},6}, {{{0,8}},88}, {{{0,8}},24}, {{{0,9}},145}, {{{83,7}},59}, {{{0,8}},120}, {{{0,8}},56}, {{{0,9}},209}, {{{81,7}},17}, {{{0,8}},104}, {{{0,8}},40}, {{{0,9}},177}, {{{0,8}},8}, {{{0,8}},136}, {{{0,8}},72}, {{{0,9}},241}, {{{80,7}},4}, {{{0,8}},84}, {{{0,8}},20}, {{{85,8}},227}, {{{83,7}},43}, {{{0,8}},116}, {{{0,8}},52}, {{{0,9}},201}, {{{81,7}},13}, {{{0,8}},100}, {{{0,8}},36}, {{{0,9}},169}, {{{0,8}},4}, {{{0,8}},132}, {{{0,8}},68}, {{{0,9}},233}, {{{80,7}},8}, {{{0,8}},92}, {{{0,8}},28}, {{{0,9}},153}, {{{84,7}},83}, {{{0,8}},124}, {{{0,8}},60}, {{{0,9}},217}, {{{82,7}},23}, {{{0,8}},108}, {{{0,8}},44}, {{{0,9}},185}, {{{0,8}},12}, {{{0,8}},140}, {{{0,8}},76}, {{{0,9}},249}, {{{80,7}},3}, {{{0,8}},82}, {{{0,8}},18}, {{{85,8}},163}, {{{83,7}},35}, {{{0,8}},114}, {{{0,8}},50}, {{{0,9}},197}, {{{81,7}},11}, {{{0,8}},98}, {{{0,8}},34}, {{{0,9}},165}, {{{0,8}},2}, {{{0,8}},130}, {{{0,8}},66}, {{{0,9}},229}, {{{80,7}},7}, {{{0,8}},90}, {{{0,8}},26}, {{{0,9}},149}, {{{84,7}},67}, {{{0,8}},122}, {{{0,8}},58}, {{{0,9}},213}, {{{82,7}},19}, {{{0,8}},106}, {{{0,8}},42}, {{{0,9}},181}, {{{0,8}},10}, {{{0,8}},138}, {{{0,8}},74}, {{{0,9}},245}, {{{80,7}},5}, {{{0,8}},86}, {{{0,8}},22}, {{{192,8}},0}, {{{83,7}},51}, {{{0,8}},118}, {{{0,8}},54}, {{{0,9}},205}, {{{81,7}},15}, {{{0,8}},102}, {{{0,8}},38}, {{{0,9}},173}, {{{0,8}},6}, {{{0,8}},134}, {{{0,8}},70}, {{{0,9}},237}, {{{80,7}},9}, {{{0,8}},94}, {{{0,8}},30}, {{{0,9}},157}, {{{84,7}},99}, {{{0,8}},126}, {{{0,8}},62}, {{{0,9}},221}, {{{82,7}},27}, {{{0,8}},110}, {{{0,8}},46}, {{{0,9}},189}, {{{0,8}},14}, {{{0,8}},142}, {{{0,8}},78}, {{{0,9}},253}, {{{96,7}},256}, {{{0,8}},81}, {{{0,8}},17}, {{{85,8}},131}, {{{82,7}},31}, {{{0,8}},113}, {{{0,8}},49}, {{{0,9}},195}, {{{80,7}},10}, {{{0,8}},97}, {{{0,8}},33}, {{{0,9}},163}, {{{0,8}},1}, {{{0,8}},129}, {{{0,8}},65}, {{{0,9}},227}, {{{80,7}},6}, {{{0,8}},89}, {{{0,8}},25}, {{{0,9}},147}, {{{83,7}},59}, {{{0,8}},121}, {{{0,8}},57}, {{{0,9}},211}, {{{81,7}},17}, {{{0,8}},105}, {{{0,8}},41}, {{{0,9}},179}, {{{0,8}},9}, {{{0,8}},137}, {{{0,8}},73}, {{{0,9}},243}, {{{80,7}},4}, {{{0,8}},85}, {{{0,8}},21}, {{{80,8}},258}, {{{83,7}},43}, {{{0,8}},117}, {{{0,8}},53}, {{{0,9}},203}, {{{81,7}},13}, {{{0,8}},101}, {{{0,8}},37}, {{{0,9}},171}, {{{0,8}},5}, {{{0,8}},133}, {{{0,8}},69}, {{{0,9}},235}, {{{80,7}},8}, {{{0,8}},93}, {{{0,8}},29}, {{{0,9}},155}, {{{84,7}},83}, {{{0,8}},125}, {{{0,8}},61}, {{{0,9}},219}, {{{82,7}},23}, {{{0,8}},109}, {{{0,8}},45}, {{{0,9}},187}, {{{0,8}},13}, {{{0,8}},141}, {{{0,8}},77}, {{{0,9}},251}, {{{80,7}},3}, {{{0,8}},83}, {{{0,8}},19}, {{{85,8}},195}, {{{83,7}},35}, {{{0,8}},115}, {{{0,8}},51}, {{{0,9}},199}, {{{81,7}},11}, {{{0,8}},99}, {{{0,8}},35}, {{{0,9}},167}, {{{0,8}},3}, {{{0,8}},131}, {{{0,8}},67}, {{{0,9}},231}, {{{80,7}},7}, {{{0,8}},91}, {{{0,8}},27}, {{{0,9}},151}, {{{84,7}},67}, {{{0,8}},123}, {{{0,8}},59}, {{{0,9}},215}, {{{82,7}},19}, {{{0,8}},107}, {{{0,8}},43}, {{{0,9}},183}, {{{0,8}},11}, {{{0,8}},139}, {{{0,8}},75}, {{{0,9}},247}, {{{80,7}},5}, {{{0,8}},87}, {{{0,8}},23}, {{{192,8}},0}, {{{83,7}},51}, {{{0,8}},119}, {{{0,8}},55}, {{{0,9}},207}, {{{81,7}},15}, {{{0,8}},103}, {{{0,8}},39}, {{{0,9}},175}, {{{0,8}},7}, {{{0,8}},135}, {{{0,8}},71}, {{{0,9}},239}, {{{80,7}},9}, {{{0,8}},95}, {{{0,8}},31}, {{{0,9}},159}, {{{84,7}},99}, {{{0,8}},127}, {{{0,8}},63}, {{{0,9}},223}, {{{82,7}},27}, {{{0,8}},111}, {{{0,8}},47}, {{{0,9}},191}, {{{0,8}},15}, {{{0,8}},143}, {{{0,8}},79}, {{{0,9}},255} }; local inflate_huft fixed_td[] = { {{{80,5}},1}, {{{87,5}},257}, {{{83,5}},17}, {{{91,5}},4097}, {{{81,5}},5}, {{{89,5}},1025}, {{{85,5}},65}, {{{93,5}},16385}, {{{80,5}},3}, {{{88,5}},513}, {{{84,5}},33}, {{{92,5}},8193}, {{{82,5}},9}, {{{90,5}},2049}, {{{86,5}},129}, {{{192,5}},24577}, {{{80,5}},2}, {{{87,5}},385}, {{{83,5}},25}, {{{91,5}},6145}, {{{81,5}},7}, {{{89,5}},1537}, {{{85,5}},97}, {{{93,5}},24577}, {{{80,5}},4}, {{{88,5}},769}, {{{84,5}},49}, {{{92,5}},12289}, {{{82,5}},13}, {{{90,5}},3073}, {{{86,5}},193}, {{{192,5}},24577} }; avfs-1.1.4/zlib/inflate.c0000644000175000001440000002656114032341001012115 00000000000000/* inflate.c -- zlib interface to inflate modules * Copyright (C) 1995-2002 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" #include "infblock.h" #include struct inflate_blocks_state {int dummy;}; /* for buggy compilers */ typedef enum { METHOD, /* waiting for method byte */ FLAG, /* waiting for flag byte */ DICT4, /* four dictionary check bytes to go */ DICT3, /* three dictionary check bytes to go */ DICT2, /* two dictionary check bytes to go */ DICT1, /* one dictionary check byte to go */ DICT0, /* waiting for inflateSetDictionary */ BLOCKS, /* decompressing blocks */ CHECK4, /* four check bytes to go */ CHECK3, /* three check bytes to go */ CHECK2, /* two check bytes to go */ CHECK1, /* one check byte to go */ DONE, /* finished check, done */ BAD} /* got an error--stay here */ inflate_mode; /* inflate private state */ struct internal_state { /* mode */ inflate_mode mode; /* current inflate mode */ /* mode dependent information */ union { uInt method; /* if FLAGS, method byte */ struct { uLong was; /* computed check value */ uLong need; /* stream check value */ } check; /* if CHECK, check values to compare */ uInt marker; /* if BAD, inflateSync's marker bytes count */ } sub; /* submode */ /* mode independent information */ int nowrap; /* flag for no wrapper */ uInt wbits; /* log2(window size) (8..15, defaults to 15) */ inflate_blocks_statef *blocks; /* current inflate_blocks state */ }; int ZEXPORT inflateReset(z) z_streamp z; { if (z == Z_NULL || z->state == Z_NULL) return Z_STREAM_ERROR; z->total_in = z->total_out = 0; z->msg = Z_NULL; z->state->mode = z->state->nowrap ? BLOCKS : METHOD; inflate_blocks_reset(z->state->blocks, z, Z_NULL); Tracev((stderr, "inflate: reset\n")); return Z_OK; } int ZEXPORT inflateEnd(z) z_streamp z; { if (z == Z_NULL || z->state == Z_NULL || z->zfree == Z_NULL) return Z_STREAM_ERROR; if (z->state->blocks != Z_NULL) inflate_blocks_free(z->state->blocks, z); ZFREE(z, z->state); z->state = Z_NULL; Tracev((stderr, "inflate: end\n")); return Z_OK; } int ZEXPORT inflateInit2_(z, w, version, stream_size) z_streamp z; int w; const char *version; int stream_size; { if (version == Z_NULL || version[0] != ZLIB_VERSION[0] || stream_size != sizeof(z_stream)) return Z_VERSION_ERROR; /* initialize state */ if (z == Z_NULL) return Z_STREAM_ERROR; z->msg = Z_NULL; if (z->zalloc == Z_NULL) { z->zalloc = zcalloc; z->opaque = (voidpf)0; } if (z->zfree == Z_NULL) z->zfree = zcfree; if ((z->state = (struct internal_state FAR *) ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL) return Z_MEM_ERROR; z->state->blocks = Z_NULL; /* handle undocumented nowrap option (no zlib header or check) */ z->state->nowrap = 0; if (w < 0) { w = - w; z->state->nowrap = 1; } /* set window size */ if (w < 8 || w > 15) { inflateEnd(z); return Z_STREAM_ERROR; } z->state->wbits = (uInt)w; /* create inflate_blocks state */ if ((z->state->blocks = inflate_blocks_new(z, z->state->nowrap ? Z_NULL : adler32, (uInt)1 << w)) == Z_NULL) { inflateEnd(z); return Z_MEM_ERROR; } Tracev((stderr, "inflate: allocated\n")); /* reset state */ inflateReset(z); return Z_OK; } int ZEXPORT inflateInit_(z, version, stream_size) z_streamp z; const char *version; int stream_size; { return inflateInit2_(z, DEF_WBITS, version, stream_size); } #define NEEDBYTE {if(z->avail_in==0)return r;r=f;} #define NEXTBYTE (z->avail_in--,z->total_in++,*z->next_in++) int ZEXPORT inflate(z, f) z_streamp z; int f; { int r; uInt b; if (z == Z_NULL || z->state == Z_NULL || z->next_in == Z_NULL) return Z_STREAM_ERROR; f = f == Z_FINISH ? Z_BUF_ERROR : Z_OK; r = Z_BUF_ERROR; while (1) switch (z->state->mode) { case METHOD: NEEDBYTE if (((z->state->sub.method = NEXTBYTE) & 0xf) != Z_DEFLATED) { z->state->mode = BAD; z->msg = (char*)"unknown compression method"; z->state->sub.marker = 5; /* can't try inflateSync */ break; } if ((z->state->sub.method >> 4) + 8 > z->state->wbits) { z->state->mode = BAD; z->msg = (char*)"invalid window size"; z->state->sub.marker = 5; /* can't try inflateSync */ break; } z->state->mode = FLAG; case FLAG: NEEDBYTE b = NEXTBYTE; if (((z->state->sub.method << 8) + b) % 31) { z->state->mode = BAD; z->msg = (char*)"incorrect header check"; z->state->sub.marker = 5; /* can't try inflateSync */ break; } Tracev((stderr, "inflate: zlib header ok\n")); if (!(b & PRESET_DICT)) { z->state->mode = BLOCKS; break; } z->state->mode = DICT4; case DICT4: NEEDBYTE z->state->sub.check.need = (uLong)NEXTBYTE << 24; z->state->mode = DICT3; case DICT3: NEEDBYTE z->state->sub.check.need += (uLong)NEXTBYTE << 16; z->state->mode = DICT2; case DICT2: NEEDBYTE z->state->sub.check.need += (uLong)NEXTBYTE << 8; z->state->mode = DICT1; case DICT1: NEEDBYTE z->state->sub.check.need += (uLong)NEXTBYTE; z->adler = z->state->sub.check.need; z->state->mode = DICT0; return Z_NEED_DICT; case DICT0: z->state->mode = BAD; z->msg = (char*)"need dictionary"; z->state->sub.marker = 0; /* can try inflateSync */ return Z_STREAM_ERROR; case BLOCKS: r = inflate_blocks(z->state->blocks, z, r); if (r == Z_DATA_ERROR) { z->state->mode = BAD; z->state->sub.marker = 0; /* can try inflateSync */ break; } if (r == Z_OK) r = f; if (r != Z_STREAM_END) return r; r = f; inflate_blocks_reset(z->state->blocks, z, &z->state->sub.check.was); if (z->state->nowrap) { z->state->mode = DONE; break; } z->state->mode = CHECK4; case CHECK4: NEEDBYTE z->state->sub.check.need = (uLong)NEXTBYTE << 24; z->state->mode = CHECK3; case CHECK3: NEEDBYTE z->state->sub.check.need += (uLong)NEXTBYTE << 16; z->state->mode = CHECK2; case CHECK2: NEEDBYTE z->state->sub.check.need += (uLong)NEXTBYTE << 8; z->state->mode = CHECK1; case CHECK1: NEEDBYTE z->state->sub.check.need += (uLong)NEXTBYTE; if (z->state->sub.check.was != z->state->sub.check.need) { z->state->mode = BAD; z->msg = (char*)"incorrect data check"; z->state->sub.marker = 5; /* can't try inflateSync */ break; } Tracev((stderr, "inflate: zlib check ok\n")); z->state->mode = DONE; case DONE: return Z_STREAM_END; case BAD: return Z_DATA_ERROR; default: return Z_STREAM_ERROR; } #ifdef NEED_DUMMY_RETURN return Z_STREAM_ERROR; /* Some dumb compilers complain without this */ #endif } int ZEXPORT inflateSetDictionary(z, dictionary, dictLength) z_streamp z; const Bytef *dictionary; uInt dictLength; { uInt length = dictLength; if (z == Z_NULL || z->state == Z_NULL || z->state->mode != DICT0) return Z_STREAM_ERROR; if (adler32(1L, dictionary, dictLength) != z->adler) return Z_DATA_ERROR; z->adler = 1L; if (length >= ((uInt)1<state->wbits)) { length = (1<state->wbits)-1; dictionary += dictLength - length; } inflate_set_dictionary(z->state->blocks, dictionary, length); z->state->mode = BLOCKS; return Z_OK; } int ZEXPORT inflateSync(z) z_streamp z; { uInt n; /* number of bytes to look at */ Bytef *p; /* pointer to bytes */ uInt m; /* number of marker bytes found in a row */ uLongLong r, w; /* temporaries to save total_in and total_out */ /* set up */ if (z == Z_NULL || z->state == Z_NULL) return Z_STREAM_ERROR; if (z->state->mode != BAD) { z->state->mode = BAD; z->state->sub.marker = 0; } if ((n = z->avail_in) == 0) return Z_BUF_ERROR; p = z->next_in; m = z->state->sub.marker; /* search */ while (n && m < 4) { static const Byte mark[4] = {0, 0, 0xff, 0xff}; if (*p == mark[m]) m++; else if (*p) m = 0; else m = 4 - m; p++, n--; } /* restore */ z->total_in += p - z->next_in; z->next_in = p; z->avail_in = n; z->state->sub.marker = m; /* return no joy or set up to restart on a new block */ if (m != 4) return Z_DATA_ERROR; r = z->total_in; w = z->total_out; inflateReset(z); z->total_in = r; z->total_out = w; z->state->mode = BLOCKS; return Z_OK; } /* Returns true if inflate is currently at the end of a block generated * by Z_SYNC_FLUSH or Z_FULL_FLUSH. This function is used by one PPP * implementation to provide an additional safety check. PPP uses Z_SYNC_FLUSH * but removes the length bytes of the resulting empty stored block. When * decompressing, PPP checks that at the end of input packet, inflate is * waiting for these length bytes. */ int ZEXPORT inflateSyncPoint(z) z_streamp z; { if (z == Z_NULL || z->state == Z_NULL || z->state->blocks == Z_NULL) return Z_STREAM_ERROR; return inflate_blocks_sync_point(z->state->blocks); } int inflateSave(z_streamp z, char **resultp) { int at; char *buf; z_stream zcpy = *z; struct internal_state statecpy = *z->state; buf = malloc(sizeof(z_stream) + sizeof(struct internal_state)); if(buf == NULL) return Z_MEM_ERROR; at = 0; zcpy.next_in = NULL; zcpy.avail_in = 0; zcpy.next_out = NULL; zcpy.avail_out = 0; zcpy.msg = NULL; zcpy.state = NULL; zcpy.zalloc = NULL; zcpy.zfree = NULL; zcpy.opaque = NULL; memcpy(buf + at, &zcpy, sizeof(z_stream)); at += sizeof(z_stream); statecpy.blocks = NULL; memcpy(buf + at, &statecpy, sizeof(struct internal_state)); at += sizeof(struct internal_state); at = inflate_blocks_save(&buf, at, z->state->blocks, z, (uInt)1 << z->state->wbits); if(at < 0) { free(buf); return at; } buf = realloc(buf, at + 2); buf[at++] = 'S'; buf[at++] = 'Z'; *resultp = buf; return at; } int inflateRestore(z_streamp z, char *buf) { z_stream zcpy; memcpy(&zcpy, buf, sizeof(z_stream)); buf += sizeof(z_stream); zcpy.next_in = z->next_in; zcpy.avail_in = z->avail_in; zcpy.next_out = z->next_out; zcpy.avail_out = z->avail_out; zcpy.zalloc = z->zalloc; zcpy.zfree = z->zfree; zcpy.opaque = z->opaque; *z = zcpy; z->msg = Z_NULL; if (z->zalloc == Z_NULL) { z->zalloc = zcalloc; z->opaque = (voidpf)0; } if (z->zfree == Z_NULL) z->zfree = zcfree; if ((z->state = (struct internal_state FAR *) ZALLOC(z,1,sizeof(struct internal_state))) == Z_NULL) return Z_MEM_ERROR; memcpy(z->state, buf, sizeof(struct internal_state)); buf += sizeof(struct internal_state); if((z->state->blocks = inflate_blocks_restore(&buf, z, z->state->nowrap ? Z_NULL : adler32, (uInt) 1 << z->state->wbits)) == Z_NULL) { inflateEnd(z); return Z_MEM_ERROR; } assert(buf[0] == 'S' && buf[1] == 'Z'); return Z_OK; } avfs-1.1.4/zlib/inffast.h0000644000175000001440000000075014032341001012122 00000000000000/* inffast.h -- header to use inffast.c * Copyright (C) 1995-2002 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ extern int inflate_fast OF(( uInt, uInt, inflate_huft *, inflate_huft *, inflate_blocks_statef *, z_streamp )); avfs-1.1.4/zlib/deflate.c0000644000175000001440000013761214032341001012077 00000000000000/* deflate.c -- compress data using the deflation algorithm * Copyright (C) 1995-2002 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* * ALGORITHM * * The "deflation" process depends on being able to identify portions * of the input text which are identical to earlier input (within a * sliding window trailing behind the input currently being processed). * * The most straightforward technique turns out to be the fastest for * most input files: try all possible matches and select the longest. * The key feature of this algorithm is that insertions into the string * dictionary are very simple and thus fast, and deletions are avoided * completely. Insertions are performed at each input character, whereas * string matches are performed only when the previous match ends. So it * is preferable to spend more time in matches to allow very fast string * insertions and avoid deletions. The matching algorithm for small * strings is inspired from that of Rabin & Karp. A brute force approach * is used to find longer strings when a small match has been found. * A similar algorithm is used in comic (by Jan-Mark Wams) and freeze * (by Leonid Broukhis). * A previous version of this file used a more sophisticated algorithm * (by Fiala and Greene) which is guaranteed to run in linear amortized * time, but has a larger average cost, uses more memory and is patented. * However the F&G algorithm may be faster for some highly redundant * files if the parameter max_chain_length (described below) is too large. * * ACKNOWLEDGEMENTS * * The idea of lazy evaluation of matches is due to Jan-Mark Wams, and * I found it in 'freeze' written by Leonid Broukhis. * Thanks to many people for bug reports and testing. * * REFERENCES * * Deutsch, L.P.,"DEFLATE Compressed Data Format Specification". * Available in ftp://ds.internic.net/rfc/rfc1951.txt * * A description of the Rabin and Karp algorithm is given in the book * "Algorithms" by R. Sedgewick, Addison-Wesley, p252. * * Fiala,E.R., and Greene,D.H. * Data Compression with Finite Windows, Comm.ACM, 32,4 (1989) 490-595 * */ /* @(#) $Id: deflate.c,v 1.2 2002/12/03 18:50:25 mszeredi Exp $ */ #include "deflate.h" const char deflate_copyright[] = " deflate 1.1.4 Copyright 1995-2002 Jean-loup Gailly "; /* If you use the zlib library in a product, an acknowledgment is welcome in the documentation of your product. If for some reason you cannot include such an acknowledgment, I would appreciate that you keep this copyright string in the executable of your product. */ /* =========================================================================== * Function prototypes. */ typedef enum { need_more, /* block not completed, need more input or more output */ block_done, /* block flush performed */ finish_started, /* finish started, need only more output at next deflate */ finish_done /* finish done, accept no more input or output */ } block_state; typedef block_state (*compress_func) OF((deflate_state *s, int flush)); /* Compression function. Returns the block state after the call. */ local void fill_window OF((deflate_state *s)); local block_state deflate_stored OF((deflate_state *s, int flush)); local block_state deflate_fast OF((deflate_state *s, int flush)); local block_state deflate_slow OF((deflate_state *s, int flush)); local void lm_init OF((deflate_state *s)); local void putShortMSB OF((deflate_state *s, uInt b)); local void flush_pending OF((z_streamp strm)); local int read_buf OF((z_streamp strm, Bytef *buf, unsigned size)); #ifdef ASMV void match_init OF((void)); /* asm code initialization */ uInt longest_match OF((deflate_state *s, IPos cur_match)); #else local uInt longest_match OF((deflate_state *s, IPos cur_match)); #endif #ifdef DEBUG local void check_match OF((deflate_state *s, IPos start, IPos match, int length)); #endif /* =========================================================================== * Local data */ #define NIL 0 /* Tail of hash chains */ #ifndef TOO_FAR # define TOO_FAR 4096 #endif /* Matches of length 3 are discarded if their distance exceeds TOO_FAR */ #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) /* Minimum amount of lookahead, except at the end of the input file. * See deflate.c for comments about the MIN_MATCH+1. */ /* Values for max_lazy_match, good_match and max_chain_length, depending on * the desired pack level (0..9). The values given below have been tuned to * exclude worst case performance for pathological files. Better values may be * found for specific files. */ typedef struct config_s { ush good_length; /* reduce lazy search above this match length */ ush max_lazy; /* do not perform lazy search above this match length */ ush nice_length; /* quit search above this match length */ ush max_chain; compress_func func; } config; local const config configuration_table[10] = { /* good lazy nice chain */ /* 0 */ {0, 0, 0, 0, deflate_stored}, /* store only */ /* 1 */ {4, 4, 8, 4, deflate_fast}, /* maximum speed, no lazy matches */ /* 2 */ {4, 5, 16, 8, deflate_fast}, /* 3 */ {4, 6, 32, 32, deflate_fast}, /* 4 */ {4, 4, 16, 16, deflate_slow}, /* lazy matches */ /* 5 */ {8, 16, 32, 32, deflate_slow}, /* 6 */ {8, 16, 128, 128, deflate_slow}, /* 7 */ {8, 32, 128, 256, deflate_slow}, /* 8 */ {32, 128, 258, 1024, deflate_slow}, /* 9 */ {32, 258, 258, 4096, deflate_slow}}; /* maximum compression */ /* Note: the deflate() code requires max_lazy >= MIN_MATCH and max_chain >= 4 * For deflate_fast() (levels <= 3) good is ignored and lazy has a different * meaning. */ #define EQUAL 0 /* result of memcmp for equal strings */ struct static_tree_desc_s {int dummy;}; /* for buggy compilers */ /* =========================================================================== * Update a hash value with the given input byte * IN assertion: all calls to to UPDATE_HASH are made with consecutive * input characters, so that a running hash key can be computed from the * previous key instead of complete recalculation each time. */ #define UPDATE_HASH(s,h,c) (h = (((h)<hash_shift) ^ (c)) & s->hash_mask) /* =========================================================================== * Insert string str in the dictionary and set match_head to the previous head * of the hash chain (the most recent string with same hash key). Return * the previous length of the hash chain. * If this file is compiled with -DFASTEST, the compression level is forced * to 1, and no hash chains are maintained. * IN assertion: all calls to to INSERT_STRING are made with consecutive * input characters and the first MIN_MATCH bytes of str are valid * (except for the last MIN_MATCH-1 bytes of the input file). */ #ifdef FASTEST #define INSERT_STRING(s, str, match_head) \ (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ match_head = s->head[s->ins_h], \ s->head[s->ins_h] = (Pos)(str)) #else #define INSERT_STRING(s, str, match_head) \ (UPDATE_HASH(s, s->ins_h, s->window[(str) + (MIN_MATCH-1)]), \ s->prev[(str) & s->w_mask] = match_head = s->head[s->ins_h], \ s->head[s->ins_h] = (Pos)(str)) #endif /* =========================================================================== * Initialize the hash table (avoiding 64K overflow for 16 bit systems). * prev[] will be initialized on the fly. */ #define CLEAR_HASH(s) \ s->head[s->hash_size-1] = NIL; \ zmemzero((Bytef *)s->head, (unsigned)(s->hash_size-1)*sizeof(*s->head)); /* ========================================================================= */ int ZEXPORT deflateInit_(strm, level, version, stream_size) z_streamp strm; int level; const char *version; int stream_size; { return deflateInit2_(strm, level, Z_DEFLATED, MAX_WBITS, DEF_MEM_LEVEL, Z_DEFAULT_STRATEGY, version, stream_size); /* To do: ignore strm->next_in if we use it as window */ } /* ========================================================================= */ int ZEXPORT deflateInit2_(strm, level, method, windowBits, memLevel, strategy, version, stream_size) z_streamp strm; int level; int method; int windowBits; int memLevel; int strategy; const char *version; int stream_size; { deflate_state *s; int noheader = 0; static const char* my_version = ZLIB_VERSION; ushf *overlay; /* We overlay pending_buf and d_buf+l_buf. This works since the average * output size for (length,distance) codes is <= 24 bits. */ if (version == Z_NULL || version[0] != my_version[0] || stream_size != sizeof(z_stream)) { return Z_VERSION_ERROR; } if (strm == Z_NULL) return Z_STREAM_ERROR; strm->msg = Z_NULL; if (strm->zalloc == Z_NULL) { strm->zalloc = zcalloc; strm->opaque = (voidpf)0; } if (strm->zfree == Z_NULL) strm->zfree = zcfree; if (level == Z_DEFAULT_COMPRESSION) level = 6; #ifdef FASTEST level = 1; #endif if (windowBits < 0) { /* undocumented feature: suppress zlib header */ noheader = 1; windowBits = -windowBits; } if (memLevel < 1 || memLevel > MAX_MEM_LEVEL || method != Z_DEFLATED || windowBits < 9 || windowBits > 15 || level < 0 || level > 9 || strategy < 0 || strategy > Z_HUFFMAN_ONLY) { return Z_STREAM_ERROR; } s = (deflate_state *) ZALLOC(strm, 1, sizeof(deflate_state)); if (s == Z_NULL) return Z_MEM_ERROR; strm->state = (struct internal_state FAR *)s; s->strm = strm; s->noheader = noheader; s->w_bits = windowBits; s->w_size = 1 << s->w_bits; s->w_mask = s->w_size - 1; s->hash_bits = memLevel + 7; s->hash_size = 1 << s->hash_bits; s->hash_mask = s->hash_size - 1; s->hash_shift = ((s->hash_bits+MIN_MATCH-1)/MIN_MATCH); s->window = (Bytef *) ZALLOC(strm, s->w_size, 2*sizeof(Byte)); s->prev = (Posf *) ZALLOC(strm, s->w_size, sizeof(Pos)); s->head = (Posf *) ZALLOC(strm, s->hash_size, sizeof(Pos)); s->lit_bufsize = 1 << (memLevel + 6); /* 16K elements by default */ overlay = (ushf *) ZALLOC(strm, s->lit_bufsize, sizeof(ush)+2); s->pending_buf = (uchf *) overlay; s->pending_buf_size = (ulg)s->lit_bufsize * (sizeof(ush)+2L); if (s->window == Z_NULL || s->prev == Z_NULL || s->head == Z_NULL || s->pending_buf == Z_NULL) { strm->msg = (char*)ERR_MSG(Z_MEM_ERROR); deflateEnd (strm); return Z_MEM_ERROR; } s->d_buf = overlay + s->lit_bufsize/sizeof(ush); s->l_buf = s->pending_buf + (1+sizeof(ush))*s->lit_bufsize; s->level = level; s->strategy = strategy; s->method = (Byte)method; return deflateReset(strm); } /* ========================================================================= */ int ZEXPORT deflateSetDictionary (strm, dictionary, dictLength) z_streamp strm; const Bytef *dictionary; uInt dictLength; { deflate_state *s; uInt length = dictLength; uInt n; IPos hash_head = 0; if (strm == Z_NULL || strm->state == Z_NULL || dictionary == Z_NULL || strm->state->status != INIT_STATE) return Z_STREAM_ERROR; s = strm->state; strm->adler = adler32(strm->adler, dictionary, dictLength); if (length < MIN_MATCH) return Z_OK; if (length > MAX_DIST(s)) { length = MAX_DIST(s); #ifndef USE_DICT_HEAD dictionary += dictLength - length; /* use the tail of the dictionary */ #endif } zmemcpy(s->window, dictionary, length); s->strstart = length; s->block_start = (long)length; /* Insert all strings in the hash table (except for the last two bytes). * s->lookahead stays null, so s->ins_h will be recomputed at the next * call of fill_window. */ s->ins_h = s->window[0]; UPDATE_HASH(s, s->ins_h, s->window[1]); for (n = 0; n <= length - MIN_MATCH; n++) { INSERT_STRING(s, n, hash_head); } if (hash_head) hash_head = 0; /* to make compiler happy */ return Z_OK; } /* ========================================================================= */ int ZEXPORT deflateReset (strm) z_streamp strm; { deflate_state *s; if (strm == Z_NULL || strm->state == Z_NULL || strm->zalloc == Z_NULL || strm->zfree == Z_NULL) return Z_STREAM_ERROR; strm->total_in = strm->total_out = 0; strm->msg = Z_NULL; /* use zfree if we ever allocate msg dynamically */ strm->data_type = Z_UNKNOWN; s = (deflate_state *)strm->state; s->pending = 0; s->pending_out = s->pending_buf; if (s->noheader < 0) { s->noheader = 0; /* was set to -1 by deflate(..., Z_FINISH); */ } s->status = s->noheader ? BUSY_STATE : INIT_STATE; strm->adler = 1; s->last_flush = Z_NO_FLUSH; _tr_init(s); lm_init(s); return Z_OK; } /* ========================================================================= */ int ZEXPORT deflateParams(strm, level, strategy) z_streamp strm; int level; int strategy; { deflate_state *s; compress_func func; int err = Z_OK; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; s = strm->state; if (level == Z_DEFAULT_COMPRESSION) { level = 6; } if (level < 0 || level > 9 || strategy < 0 || strategy > Z_HUFFMAN_ONLY) { return Z_STREAM_ERROR; } func = configuration_table[s->level].func; if (func != configuration_table[level].func && strm->total_in != 0) { /* Flush the last buffer: */ err = deflate(strm, Z_PARTIAL_FLUSH); } if (s->level != level) { s->level = level; s->max_lazy_match = configuration_table[level].max_lazy; s->good_match = configuration_table[level].good_length; s->nice_match = configuration_table[level].nice_length; s->max_chain_length = configuration_table[level].max_chain; } s->strategy = strategy; return err; } /* ========================================================================= * Put a short in the pending buffer. The 16-bit value is put in MSB order. * IN assertion: the stream state is correct and there is enough room in * pending_buf. */ local void putShortMSB (s, b) deflate_state *s; uInt b; { put_byte(s, (Byte)(b >> 8)); put_byte(s, (Byte)(b & 0xff)); } /* ========================================================================= * Flush as much pending output as possible. All deflate() output goes * through this function so some applications may wish to modify it * to avoid allocating a large strm->next_out buffer and copying into it. * (See also read_buf()). */ local void flush_pending(strm) z_streamp strm; { unsigned len = strm->state->pending; if (len > strm->avail_out) len = strm->avail_out; if (len == 0) return; zmemcpy(strm->next_out, strm->state->pending_out, len); strm->next_out += len; strm->state->pending_out += len; strm->total_out += len; strm->avail_out -= len; strm->state->pending -= len; if (strm->state->pending == 0) { strm->state->pending_out = strm->state->pending_buf; } } /* ========================================================================= */ int ZEXPORT deflate (strm, flush) z_streamp strm; int flush; { int old_flush; /* value of flush param for previous deflate call */ deflate_state *s; if (strm == Z_NULL || strm->state == Z_NULL || flush > Z_FINISH || flush < 0) { return Z_STREAM_ERROR; } s = strm->state; if (strm->next_out == Z_NULL || (strm->next_in == Z_NULL && strm->avail_in != 0) || (s->status == FINISH_STATE && flush != Z_FINISH)) { ERR_RETURN(strm, Z_STREAM_ERROR); } if (strm->avail_out == 0) ERR_RETURN(strm, Z_BUF_ERROR); s->strm = strm; /* just in case */ old_flush = s->last_flush; s->last_flush = flush; /* Write the zlib header */ if (s->status == INIT_STATE) { uInt header = (Z_DEFLATED + ((s->w_bits-8)<<4)) << 8; uInt level_flags = (s->level-1) >> 1; if (level_flags > 3) level_flags = 3; header |= (level_flags << 6); if (s->strstart != 0) header |= PRESET_DICT; header += 31 - (header % 31); s->status = BUSY_STATE; putShortMSB(s, header); /* Save the adler32 of the preset dictionary: */ if (s->strstart != 0) { putShortMSB(s, (uInt)(strm->adler >> 16)); putShortMSB(s, (uInt)(strm->adler & 0xffff)); } strm->adler = 1L; } /* Flush as much pending output as possible */ if (s->pending != 0) { flush_pending(strm); if (strm->avail_out == 0) { /* Since avail_out is 0, deflate will be called again with * more output space, but possibly with both pending and * avail_in equal to zero. There won't be anything to do, * but this is not an error situation so make sure we * return OK instead of BUF_ERROR at next call of deflate: */ s->last_flush = -1; return Z_OK; } /* Make sure there is something to do and avoid duplicate consecutive * flushes. For repeated and useless calls with Z_FINISH, we keep * returning Z_STREAM_END instead of Z_BUFF_ERROR. */ } else if (strm->avail_in == 0 && flush <= old_flush && flush != Z_FINISH) { ERR_RETURN(strm, Z_BUF_ERROR); } /* User must not provide more input after the first FINISH: */ if (s->status == FINISH_STATE && strm->avail_in != 0) { ERR_RETURN(strm, Z_BUF_ERROR); } /* Start a new block or continue the current one. */ if (strm->avail_in != 0 || s->lookahead != 0 || (flush != Z_NO_FLUSH && s->status != FINISH_STATE)) { block_state bstate; bstate = (*(configuration_table[s->level].func))(s, flush); if (bstate == finish_started || bstate == finish_done) { s->status = FINISH_STATE; } if (bstate == need_more || bstate == finish_started) { if (strm->avail_out == 0) { s->last_flush = -1; /* avoid BUF_ERROR next call, see above */ } return Z_OK; /* If flush != Z_NO_FLUSH && avail_out == 0, the next call * of deflate should use the same flush parameter to make sure * that the flush is complete. So we don't have to output an * empty block here, this will be done at next call. This also * ensures that for a very small output buffer, we emit at most * one empty block. */ } if (bstate == block_done) { if (flush == Z_PARTIAL_FLUSH) { _tr_align(s); } else { /* FULL_FLUSH or SYNC_FLUSH */ _tr_stored_block(s, (char*)0, 0L, 0); /* For a full flush, this empty block will be recognized * as a special marker by inflate_sync(). */ if (flush == Z_FULL_FLUSH) { CLEAR_HASH(s); /* forget history */ } } flush_pending(strm); if (strm->avail_out == 0) { s->last_flush = -1; /* avoid BUF_ERROR at next call, see above */ return Z_OK; } } } Assert(strm->avail_out > 0, "bug2"); if (flush != Z_FINISH) return Z_OK; if (s->noheader) return Z_STREAM_END; /* Write the zlib trailer (adler32) */ putShortMSB(s, (uInt)(strm->adler >> 16)); putShortMSB(s, (uInt)(strm->adler & 0xffff)); flush_pending(strm); /* If avail_out is zero, the application will call deflate again * to flush the rest. */ s->noheader = -1; /* write the trailer only once! */ return s->pending != 0 ? Z_OK : Z_STREAM_END; } /* ========================================================================= */ int ZEXPORT deflateEnd (strm) z_streamp strm; { int status; if (strm == Z_NULL || strm->state == Z_NULL) return Z_STREAM_ERROR; status = strm->state->status; if (status != INIT_STATE && status != BUSY_STATE && status != FINISH_STATE) { return Z_STREAM_ERROR; } /* Deallocate in reverse order of allocations: */ TRY_FREE(strm, strm->state->pending_buf); TRY_FREE(strm, strm->state->head); TRY_FREE(strm, strm->state->prev); TRY_FREE(strm, strm->state->window); ZFREE(strm, strm->state); strm->state = Z_NULL; return status == BUSY_STATE ? Z_DATA_ERROR : Z_OK; } /* ========================================================================= * Copy the source state to the destination state. * To simplify the source, this is not supported for 16-bit MSDOS (which * doesn't have enough memory anyway to duplicate compression states). */ int ZEXPORT deflateCopy (dest, source) z_streamp dest; z_streamp source; { #ifdef MAXSEG_64K return Z_STREAM_ERROR; #else deflate_state *ds; deflate_state *ss; ushf *overlay; if (source == Z_NULL || dest == Z_NULL || source->state == Z_NULL) { return Z_STREAM_ERROR; } ss = source->state; *dest = *source; ds = (deflate_state *) ZALLOC(dest, 1, sizeof(deflate_state)); if (ds == Z_NULL) return Z_MEM_ERROR; dest->state = (struct internal_state FAR *) ds; *ds = *ss; ds->strm = dest; ds->window = (Bytef *) ZALLOC(dest, ds->w_size, 2*sizeof(Byte)); ds->prev = (Posf *) ZALLOC(dest, ds->w_size, sizeof(Pos)); ds->head = (Posf *) ZALLOC(dest, ds->hash_size, sizeof(Pos)); overlay = (ushf *) ZALLOC(dest, ds->lit_bufsize, sizeof(ush)+2); ds->pending_buf = (uchf *) overlay; if (ds->window == Z_NULL || ds->prev == Z_NULL || ds->head == Z_NULL || ds->pending_buf == Z_NULL) { deflateEnd (dest); return Z_MEM_ERROR; } /* following zmemcpy do not work for 16-bit MSDOS */ zmemcpy(ds->window, ss->window, ds->w_size * 2 * sizeof(Byte)); zmemcpy(ds->prev, ss->prev, ds->w_size * sizeof(Pos)); zmemcpy(ds->head, ss->head, ds->hash_size * sizeof(Pos)); zmemcpy(ds->pending_buf, ss->pending_buf, (uInt)ds->pending_buf_size); ds->pending_out = ds->pending_buf + (ss->pending_out - ss->pending_buf); ds->d_buf = overlay + ds->lit_bufsize/sizeof(ush); ds->l_buf = ds->pending_buf + (1+sizeof(ush))*ds->lit_bufsize; ds->l_desc.dyn_tree = ds->dyn_ltree; ds->d_desc.dyn_tree = ds->dyn_dtree; ds->bl_desc.dyn_tree = ds->bl_tree; return Z_OK; #endif } /* =========================================================================== * Read a new buffer from the current input stream, update the adler32 * and total number of bytes read. All deflate() input goes through * this function so some applications may wish to modify it to avoid * allocating a large strm->next_in buffer and copying from it. * (See also flush_pending()). */ local int read_buf(strm, buf, size) z_streamp strm; Bytef *buf; unsigned size; { unsigned len = strm->avail_in; if (len > size) len = size; if (len == 0) return 0; strm->avail_in -= len; if (!strm->state->noheader) { strm->adler = adler32(strm->adler, strm->next_in, len); } zmemcpy(buf, strm->next_in, len); strm->next_in += len; strm->total_in += len; return (int)len; } /* =========================================================================== * Initialize the "longest match" routines for a new zlib stream */ local void lm_init (s) deflate_state *s; { s->window_size = (ulg)2L*s->w_size; CLEAR_HASH(s); /* Set the default configuration parameters: */ s->max_lazy_match = configuration_table[s->level].max_lazy; s->good_match = configuration_table[s->level].good_length; s->nice_match = configuration_table[s->level].nice_length; s->max_chain_length = configuration_table[s->level].max_chain; s->strstart = 0; s->block_start = 0L; s->lookahead = 0; s->match_length = s->prev_length = MIN_MATCH-1; s->match_available = 0; s->ins_h = 0; #ifdef ASMV match_init(); /* initialize the asm code */ #endif } /* =========================================================================== * Set match_start to the longest match starting at the given string and * return its length. Matches shorter or equal to prev_length are discarded, * in which case the result is equal to prev_length and match_start is * garbage. * IN assertions: cur_match is the head of the hash chain for the current * string (strstart) and its distance is <= MAX_DIST, and prev_length >= 1 * OUT assertion: the match length is not greater than s->lookahead. */ #ifndef ASMV /* For 80x86 and 680x0, an optimized version will be provided in match.asm or * match.S. The code will be functionally equivalent. */ #ifndef FASTEST local uInt longest_match(s, cur_match) deflate_state *s; IPos cur_match; /* current match */ { unsigned chain_length = s->max_chain_length;/* max hash chain length */ register Bytef *scan = s->window + s->strstart; /* current string */ register Bytef *match; /* matched string */ register int len; /* length of current match */ int best_len = s->prev_length; /* best match length so far */ int nice_match = s->nice_match; /* stop if match long enough */ IPos limit = s->strstart > (IPos)MAX_DIST(s) ? s->strstart - (IPos)MAX_DIST(s) : NIL; /* Stop when cur_match becomes <= limit. To simplify the code, * we prevent matches with the string of window index 0. */ Posf *prev = s->prev; uInt wmask = s->w_mask; #ifdef UNALIGNED_OK /* Compare two bytes at a time. Note: this is not always beneficial. * Try with and without -DUNALIGNED_OK to check. */ register Bytef *strend = s->window + s->strstart + MAX_MATCH - 1; register ush scan_start = *(ushf*)scan; register ush scan_end = *(ushf*)(scan+best_len-1); #else register Bytef *strend = s->window + s->strstart + MAX_MATCH; register Byte scan_end1 = scan[best_len-1]; register Byte scan_end = scan[best_len]; #endif /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. * It is easy to get rid of this optimization if necessary. */ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); /* Do not waste too much time if we already have a good match: */ if (s->prev_length >= s->good_match) { chain_length >>= 2; } /* Do not look for matches beyond the end of the input. This is necessary * to make deflate deterministic. */ if ((uInt)nice_match > s->lookahead) nice_match = s->lookahead; Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); do { Assert(cur_match < s->strstart, "no future"); match = s->window + cur_match; /* Skip to next match if the match length cannot increase * or if the match length is less than 2: */ #if (defined(UNALIGNED_OK) && MAX_MATCH == 258) /* This code assumes sizeof(unsigned short) == 2. Do not use * UNALIGNED_OK if your compiler uses a different size. */ if (*(ushf*)(match+best_len-1) != scan_end || *(ushf*)match != scan_start) continue; /* It is not necessary to compare scan[2] and match[2] since they are * always equal when the other bytes match, given that the hash keys * are equal and that HASH_BITS >= 8. Compare 2 bytes at a time at * strstart+3, +5, ... up to strstart+257. We check for insufficient * lookahead only every 4th comparison; the 128th check will be made * at strstart+257. If MAX_MATCH-2 is not a multiple of 8, it is * necessary to put more guard bytes at the end of the window, or * to check more often for insufficient lookahead. */ Assert(scan[2] == match[2], "scan[2]?"); scan++, match++; do { } while (*(ushf*)(scan+=2) == *(ushf*)(match+=2) && *(ushf*)(scan+=2) == *(ushf*)(match+=2) && *(ushf*)(scan+=2) == *(ushf*)(match+=2) && *(ushf*)(scan+=2) == *(ushf*)(match+=2) && scan < strend); /* The funny "do {}" generates better code on most compilers */ /* Here, scan <= window+strstart+257 */ Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); if (*scan == *match) scan++; len = (MAX_MATCH - 1) - (int)(strend-scan); scan = strend - (MAX_MATCH-1); #else /* UNALIGNED_OK */ if (match[best_len] != scan_end || match[best_len-1] != scan_end1 || *match != *scan || *++match != scan[1]) continue; /* The check at best_len-1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that * the hash keys are equal and that HASH_BITS >= 8. */ scan += 2, match++; Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; * the 256th check will be made at strstart+258. */ do { } while (*++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && scan < strend); Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); len = MAX_MATCH - (int)(strend - scan); scan = strend - MAX_MATCH; #endif /* UNALIGNED_OK */ if (len > best_len) { s->match_start = cur_match; best_len = len; if (len >= nice_match) break; #ifdef UNALIGNED_OK scan_end = *(ushf*)(scan+best_len-1); #else scan_end1 = scan[best_len-1]; scan_end = scan[best_len]; #endif } } while ((cur_match = prev[cur_match & wmask]) > limit && --chain_length != 0); if ((uInt)best_len <= s->lookahead) return (uInt)best_len; return s->lookahead; } #else /* FASTEST */ /* --------------------------------------------------------------------------- * Optimized version for level == 1 only */ local uInt longest_match(s, cur_match) deflate_state *s; IPos cur_match; /* current match */ { register Bytef *scan = s->window + s->strstart; /* current string */ register Bytef *match; /* matched string */ register int len; /* length of current match */ register Bytef *strend = s->window + s->strstart + MAX_MATCH; /* The code is optimized for HASH_BITS >= 8 and MAX_MATCH-2 multiple of 16. * It is easy to get rid of this optimization if necessary. */ Assert(s->hash_bits >= 8 && MAX_MATCH == 258, "Code too clever"); Assert((ulg)s->strstart <= s->window_size-MIN_LOOKAHEAD, "need lookahead"); Assert(cur_match < s->strstart, "no future"); match = s->window + cur_match; /* Return failure if the match length is less than 2: */ if (match[0] != scan[0] || match[1] != scan[1]) return MIN_MATCH-1; /* The check at best_len-1 can be removed because it will be made * again later. (This heuristic is not always a win.) * It is not necessary to compare scan[2] and match[2] since they * are always equal when the other bytes match, given that * the hash keys are equal and that HASH_BITS >= 8. */ scan += 2, match += 2; Assert(*scan == *match, "match[2]?"); /* We check for insufficient lookahead only every 8th comparison; * the 256th check will be made at strstart+258. */ do { } while (*++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && *++scan == *++match && scan < strend); Assert(scan <= s->window+(unsigned)(s->window_size-1), "wild scan"); len = MAX_MATCH - (int)(strend - scan); if (len < MIN_MATCH) return MIN_MATCH - 1; s->match_start = cur_match; return len <= s->lookahead ? len : s->lookahead; } #endif /* FASTEST */ #endif /* ASMV */ #ifdef DEBUG /* =========================================================================== * Check that the match at match_start is indeed a match. */ local void check_match(s, start, match, length) deflate_state *s; IPos start, match; int length; { /* check that the match is indeed a match */ if (zmemcmp(s->window + match, s->window + start, length) != EQUAL) { fprintf(stderr, " start %u, match %u, length %d\n", start, match, length); do { fprintf(stderr, "%c%c", s->window[match++], s->window[start++]); } while (--length != 0); z_error("invalid match"); } if (z_verbose > 1) { fprintf(stderr,"\\[%d,%d]", start-match, length); do { putc(s->window[start++], stderr); } while (--length != 0); } } #else # define check_match(s, start, match, length) #endif /* =========================================================================== * Fill the window when the lookahead becomes insufficient. * Updates strstart and lookahead. * * IN assertion: lookahead < MIN_LOOKAHEAD * OUT assertions: strstart <= window_size-MIN_LOOKAHEAD * At least one byte has been read, or avail_in == 0; reads are * performed for at least two bytes (required for the zip translate_eol * option -- not supported here). */ local void fill_window(s) deflate_state *s; { register unsigned n, m; register Posf *p; unsigned more; /* Amount of free space at the end of the window. */ uInt wsize = s->w_size; do { more = (unsigned)(s->window_size -(ulg)s->lookahead -(ulg)s->strstart); /* Deal with !@#$% 64K limit: */ if (more == 0 && s->strstart == 0 && s->lookahead == 0) { more = wsize; } else if (more == (unsigned)(-1)) { /* Very unlikely, but possible on 16 bit machine if strstart == 0 * and lookahead == 1 (input done one byte at time) */ more--; /* If the window is almost full and there is insufficient lookahead, * move the upper half to the lower one to make room in the upper half. */ } else if (s->strstart >= wsize+MAX_DIST(s)) { zmemcpy(s->window, s->window+wsize, (unsigned)wsize); s->match_start -= wsize; s->strstart -= wsize; /* we now have strstart >= MAX_DIST */ s->block_start -= (long) wsize; /* Slide the hash table (could be avoided with 32 bit values at the expense of memory usage). We slide even when level == 0 to keep the hash table consistent if we switch back to level > 0 later. (Using level 0 permanently is not an optimal usage of zlib, so we don't care about this pathological case.) */ n = s->hash_size; p = &s->head[n]; do { m = *--p; *p = (Pos)(m >= wsize ? m-wsize : NIL); } while (--n); n = wsize; #ifndef FASTEST p = &s->prev[n]; do { m = *--p; *p = (Pos)(m >= wsize ? m-wsize : NIL); /* If n is not on any hash chain, prev[n] is garbage but * its value will never be used. */ } while (--n); #endif more += wsize; } if (s->strm->avail_in == 0) return; /* If there was no sliding: * strstart <= WSIZE+MAX_DIST-1 && lookahead <= MIN_LOOKAHEAD - 1 && * more == window_size - lookahead - strstart * => more >= window_size - (MIN_LOOKAHEAD-1 + WSIZE + MAX_DIST-1) * => more >= window_size - 2*WSIZE + 2 * In the BIG_MEM or MMAP case (not yet supported), * window_size == input_size + MIN_LOOKAHEAD && * strstart + s->lookahead <= input_size => more >= MIN_LOOKAHEAD. * Otherwise, window_size == 2*WSIZE so more >= 2. * If there was sliding, more >= WSIZE. So in all cases, more >= 2. */ Assert(more >= 2, "more < 2"); n = read_buf(s->strm, s->window + s->strstart + s->lookahead, more); s->lookahead += n; /* Initialize the hash value now that we have some input: */ if (s->lookahead >= MIN_MATCH) { s->ins_h = s->window[s->strstart]; UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); #if MIN_MATCH != 3 Call UPDATE_HASH() MIN_MATCH-3 more times #endif } /* If the whole input has less than MIN_MATCH bytes, ins_h is garbage, * but this is not important since only literal bytes will be emitted. */ } while (s->lookahead < MIN_LOOKAHEAD && s->strm->avail_in != 0); } /* =========================================================================== * Flush the current block, with given end-of-file flag. * IN assertion: strstart is set to the end of the current match. */ #define FLUSH_BLOCK_ONLY(s, eof) { \ _tr_flush_block(s, (s->block_start >= 0L ? \ (charf *)&s->window[(unsigned)s->block_start] : \ (charf *)Z_NULL), \ (ulg)((long)s->strstart - s->block_start), \ (eof)); \ s->block_start = s->strstart; \ flush_pending(s->strm); \ Tracev((stderr,"[FLUSH]")); \ } /* Same but force premature exit if necessary. */ #define FLUSH_BLOCK(s, eof) { \ FLUSH_BLOCK_ONLY(s, eof); \ if (s->strm->avail_out == 0) return (eof) ? finish_started : need_more; \ } /* =========================================================================== * Copy without compression as much as possible from the input stream, return * the current block state. * This function does not insert new strings in the dictionary since * uncompressible data is probably not useful. This function is used * only for the level=0 compression option. * NOTE: this function should be optimized to avoid extra copying from * window to pending_buf. */ local block_state deflate_stored(s, flush) deflate_state *s; int flush; { /* Stored blocks are limited to 0xffff bytes, pending_buf is limited * to pending_buf_size, and each stored block has a 5 byte header: */ ulg max_block_size = 0xffff; ulg max_start; if (max_block_size > s->pending_buf_size - 5) { max_block_size = s->pending_buf_size - 5; } /* Copy as much as possible from input to output: */ for (;;) { /* Fill the window as much as possible: */ if (s->lookahead <= 1) { Assert(s->strstart < s->w_size+MAX_DIST(s) || s->block_start >= (long)s->w_size, "slide too late"); fill_window(s); if (s->lookahead == 0 && flush == Z_NO_FLUSH) return need_more; if (s->lookahead == 0) break; /* flush the current block */ } Assert(s->block_start >= 0L, "block gone"); s->strstart += s->lookahead; s->lookahead = 0; /* Emit a stored block if pending_buf will be full: */ max_start = s->block_start + max_block_size; if (s->strstart == 0 || (ulg)s->strstart >= max_start) { /* strstart == 0 is possible when wraparound on 16-bit machine */ s->lookahead = (uInt)(s->strstart - max_start); s->strstart = (uInt)max_start; FLUSH_BLOCK(s, 0); } /* Flush if we may have to slide, otherwise block_start may become * negative and the data will be gone: */ if (s->strstart - (uInt)s->block_start >= MAX_DIST(s)) { FLUSH_BLOCK(s, 0); } } FLUSH_BLOCK(s, flush == Z_FINISH); return flush == Z_FINISH ? finish_done : block_done; } /* =========================================================================== * Compress as much as possible from the input stream, return the current * block state. * This function does not perform lazy evaluation of matches and inserts * new strings in the dictionary only for unmatched strings or for short * matches. It is used only for the fast compression options. */ local block_state deflate_fast(s, flush) deflate_state *s; int flush; { IPos hash_head = NIL; /* head of the hash chain */ int bflush; /* set if current block must be flushed */ for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ if (s->lookahead < MIN_LOOKAHEAD) { fill_window(s); if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { return need_more; } if (s->lookahead == 0) break; /* flush the current block */ } /* Insert the string window[strstart .. strstart+2] in the * dictionary, and set hash_head to the head of the hash chain: */ if (s->lookahead >= MIN_MATCH) { INSERT_STRING(s, s->strstart, hash_head); } /* Find the longest match, discarding those <= prev_length. * At this point we have always match_length < MIN_MATCH */ if (hash_head != NIL && s->strstart - hash_head <= MAX_DIST(s)) { /* To simplify the code, we prevent matches with the string * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ if (s->strategy != Z_HUFFMAN_ONLY) { s->match_length = longest_match (s, hash_head); } /* longest_match() sets match_start */ } if (s->match_length >= MIN_MATCH) { check_match(s, s->strstart, s->match_start, s->match_length); _tr_tally_dist(s, s->strstart - s->match_start, s->match_length - MIN_MATCH, bflush); s->lookahead -= s->match_length; /* Insert new strings in the hash table only if the match length * is not too large. This saves time but degrades compression. */ #ifndef FASTEST if (s->match_length <= s->max_insert_length && s->lookahead >= MIN_MATCH) { s->match_length--; /* string at strstart already in hash table */ do { s->strstart++; INSERT_STRING(s, s->strstart, hash_head); /* strstart never exceeds WSIZE-MAX_MATCH, so there are * always MIN_MATCH bytes ahead. */ } while (--s->match_length != 0); s->strstart++; } else #endif { s->strstart += s->match_length; s->match_length = 0; s->ins_h = s->window[s->strstart]; UPDATE_HASH(s, s->ins_h, s->window[s->strstart+1]); #if MIN_MATCH != 3 Call UPDATE_HASH() MIN_MATCH-3 more times #endif /* If lookahead < MIN_MATCH, ins_h is garbage, but it does not * matter since it will be recomputed at next deflate call. */ } } else { /* No match, output a literal byte */ Tracevv((stderr,"%c", s->window[s->strstart])); _tr_tally_lit (s, s->window[s->strstart], bflush); s->lookahead--; s->strstart++; } if (bflush) FLUSH_BLOCK(s, 0); } FLUSH_BLOCK(s, flush == Z_FINISH); return flush == Z_FINISH ? finish_done : block_done; } /* =========================================================================== * Same as above, but achieves better compression. We use a lazy * evaluation for matches: a match is finally adopted only if there is * no better match at the next window position. */ local block_state deflate_slow(s, flush) deflate_state *s; int flush; { IPos hash_head = NIL; /* head of hash chain */ int bflush; /* set if current block must be flushed */ /* Process the input block. */ for (;;) { /* Make sure that we always have enough lookahead, except * at the end of the input file. We need MAX_MATCH bytes * for the next match, plus MIN_MATCH bytes to insert the * string following the next match. */ if (s->lookahead < MIN_LOOKAHEAD) { fill_window(s); if (s->lookahead < MIN_LOOKAHEAD && flush == Z_NO_FLUSH) { return need_more; } if (s->lookahead == 0) break; /* flush the current block */ } /* Insert the string window[strstart .. strstart+2] in the * dictionary, and set hash_head to the head of the hash chain: */ if (s->lookahead >= MIN_MATCH) { INSERT_STRING(s, s->strstart, hash_head); } /* Find the longest match, discarding those <= prev_length. */ s->prev_length = s->match_length, s->prev_match = s->match_start; s->match_length = MIN_MATCH-1; if (hash_head != NIL && s->prev_length < s->max_lazy_match && s->strstart - hash_head <= MAX_DIST(s)) { /* To simplify the code, we prevent matches with the string * of window index 0 (in particular we have to avoid a match * of the string with itself at the start of the input file). */ if (s->strategy != Z_HUFFMAN_ONLY) { s->match_length = longest_match (s, hash_head); } /* longest_match() sets match_start */ if (s->match_length <= 5 && (s->strategy == Z_FILTERED || (s->match_length == MIN_MATCH && s->strstart - s->match_start > TOO_FAR))) { /* If prev_match is also MIN_MATCH, match_start is garbage * but we will ignore the current match anyway. */ s->match_length = MIN_MATCH-1; } } /* If there was a match at the previous step and the current * match is not better, output the previous match: */ if (s->prev_length >= MIN_MATCH && s->match_length <= s->prev_length) { uInt max_insert = s->strstart + s->lookahead - MIN_MATCH; /* Do not insert strings in hash table beyond this. */ check_match(s, s->strstart-1, s->prev_match, s->prev_length); _tr_tally_dist(s, s->strstart -1 - s->prev_match, s->prev_length - MIN_MATCH, bflush); /* Insert in hash table all strings up to the end of the match. * strstart-1 and strstart are already inserted. If there is not * enough lookahead, the last two strings are not inserted in * the hash table. */ s->lookahead -= s->prev_length-1; s->prev_length -= 2; do { if (++s->strstart <= max_insert) { INSERT_STRING(s, s->strstart, hash_head); } } while (--s->prev_length != 0); s->match_available = 0; s->match_length = MIN_MATCH-1; s->strstart++; if (bflush) FLUSH_BLOCK(s, 0); } else if (s->match_available) { /* If there was no match at the previous position, output a * single literal. If there was a match but the current match * is longer, truncate the previous match to a single literal. */ Tracevv((stderr,"%c", s->window[s->strstart-1])); _tr_tally_lit(s, s->window[s->strstart-1], bflush); if (bflush) { FLUSH_BLOCK_ONLY(s, 0); } s->strstart++; s->lookahead--; if (s->strm->avail_out == 0) return need_more; } else { /* There is no previous match to compare with, wait for * the next step to decide. */ s->match_available = 1; s->strstart++; s->lookahead--; } } Assert (flush != Z_NO_FLUSH, "no flush?"); if (s->match_available) { Tracevv((stderr,"%c", s->window[s->strstart-1])); _tr_tally_lit(s, s->window[s->strstart-1], bflush); s->match_available = 0; } FLUSH_BLOCK(s, flush == Z_FINISH); return flush == Z_FINISH ? finish_done : block_done; } avfs-1.1.4/zlib/zconf.h0000644000175000001440000002267314032341001011617 00000000000000/* zconf.h -- configuration of the zlib compression library * Copyright (C) 1995-2002 Jean-loup Gailly. * Copyright (C) 2005 Ralf Hoffmann * For conditions of distribution and use, see copyright notice in zlib.h * * Changes: * 2005-06-13 Ralf Hoffmann * added more symbols to the redefines */ /* @(#) $Id: zconf.h,v 1.5 2005/06/14 18:17:20 hoffmannr Exp $ */ #ifndef _ZCONF_H #define _ZCONF_H #include "config.h" #define Z_PREFIX 1 /* * If you *really* need a unique prefix for all types and library functions, * compile with -DZ_PREFIX. The "standard" zlib should be compiled without it. */ #ifdef Z_PREFIX # define deflateInit_ z_deflateInit_ # define deflate z_deflate # define deflateEnd z_deflateEnd # define inflateInit_ z_inflateInit_ # define inflate z_inflate # define inflateEnd z_inflateEnd # define deflateInit2_ z_deflateInit2_ # define deflateSetDictionary z_deflateSetDictionary # define deflateCopy z_deflateCopy # define deflateReset z_deflateReset # define deflateParams z_deflateParams # define inflateInit2_ z_inflateInit2_ # define inflateSetDictionary z_inflateSetDictionary # define inflateSync z_inflateSync # define inflateSyncPoint z_inflateSyncPoint # define inflateReset z_inflateReset # define compress z_compress # define compress2 z_compress2 # define uncompress z_uncompress # define adler32 z_adler32 # define crc32 z_crc32 # define get_crc_table z_get_crc_table # define Byte z_Byte # define uInt z_uInt # define uLong z_uLong # define Bytef z_Bytef # define charf z_charf # define intf z_intf # define uIntf z_uIntf # define uLongf z_uLongf # define voidpf z_voidpf # define voidp z_voidp # define zlibVersion z_zlibVersion # define zcfree z_zcfree # define zcalloc z_zcalloc # define zError z_zError # define _tr_tally z__tr_tally # define inflate_blocks z_inflate_blocks # define inflate_blocks_free z_inflate_blocks_free # define inflate_blocks_new z_inflate_blocks_new # define inflate_blocks_reset z_inflate_blocks_reset # define inflate_blocks_restore z_inflate_blocks_restore # define inflate_blocks_save z_inflate_blocks_save # define inflate_blocks_sync_point z_inflate_blocks_sync_point # define inflate_set_dictionary z_inflate_set_dictionary # define inflate_codes z_inflate_codes # define inflate_codes_free z_inflate_codes_free # define inflate_codes_new z_inflate_codes_new # define inflate_codes_restore z_inflate_codes_restore # define inflate_codes_save z_inflate_codes_save # define inflate_fast z_inflate_fast # define inflateRestore z_inflateRestore # define inflateSave z_inflateSave # define inflate_trees_bits z_inflate_trees_bits # define inflate_trees_dynamic z_inflate_trees_dynamic # define inflate_trees_fixed z_inflate_trees_fixed # define inflate_flush z_inflate_flush # define _tr_align z__tr_align # define _tr_flush_block z__tr_flush_block # define _tr_init z__tr_init # define _tr_stored_block z__tr_stored_block # define inflate_mask z_inflate_mask # define z_errmsg z_z_errmsg # define deflate_copyright z_deflate_copyright # define inflate_copyright z_inflate_copyright # define _dist_code z__dist_code # define _length_code z__length_code #endif #if (defined(_WIN32) || defined(__WIN32__)) && !defined(WIN32) # define WIN32 #endif #if defined(__GNUC__) || defined(WIN32) || defined(__386__) || defined(i386) # ifndef __32BIT__ # define __32BIT__ # endif #endif #if defined(__MSDOS__) && !defined(MSDOS) # define MSDOS #endif /* * Compile with -DMAXSEG_64K if the alloc function cannot allocate more * than 64k bytes at a time (needed on systems with 16-bit int). */ #if defined(MSDOS) && !defined(__32BIT__) # define MAXSEG_64K #endif #ifdef MSDOS # define UNALIGNED_OK #endif #if (defined(MSDOS) || defined(_WINDOWS) || defined(WIN32)) && !defined(STDC) # define STDC #endif #if defined(__STDC__) || defined(__cplusplus) || defined(__OS2__) # ifndef STDC # define STDC # endif #endif #ifndef STDC # ifndef const /* cannot use !defined(STDC) && !defined(const) on Mac */ # define const # endif #endif /* Some Mac compilers merge all .h files incorrectly: */ #if defined(__MWERKS__) || defined(applec) ||defined(THINK_C) ||defined(__SC__) # define NO_DUMMY_DECL #endif /* Old Borland C incorrectly complains about missing returns: */ #if defined(__BORLANDC__) && (__BORLANDC__ < 0x500) # define NEED_DUMMY_RETURN #endif /* Maximum value for memLevel in deflateInit2 */ #ifndef MAX_MEM_LEVEL # ifdef MAXSEG_64K # define MAX_MEM_LEVEL 8 # else # define MAX_MEM_LEVEL 9 # endif #endif /* Maximum value for windowBits in deflateInit2 and inflateInit2. * WARNING: reducing MAX_WBITS makes minigzip unable to extract .gz files * created by gzip. (Files created by minigzip can still be extracted by * gzip.) */ #ifndef MAX_WBITS # define MAX_WBITS 15 /* 32K LZ77 window */ #endif /* The memory requirements for deflate are (in bytes): (1 << (windowBits+2)) + (1 << (memLevel+9)) that is: 128K for windowBits=15 + 128K for memLevel = 8 (default values) plus a few kilobytes for small objects. For example, if you want to reduce the default memory requirements from 256K to 128K, compile with make CFLAGS="-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7" Of course this will generally degrade compression (there's no free lunch). The memory requirements for inflate are (in bytes) 1 << windowBits that is, 32K for windowBits=15 (default value) plus a few kilobytes for small objects. */ /* Type declarations */ #ifndef OF /* function prototypes */ # ifdef STDC # define OF(args) args # else # define OF(args) () # endif #endif /* The following definitions for FAR are needed only for MSDOS mixed * model programming (small or medium model with some far allocations). * This was tested only with MSC; for other MSDOS compilers you may have * to define NO_MEMCPY in zutil.h. If you don't need the mixed model, * just define FAR to be empty. */ #if (defined(M_I86SM) || defined(M_I86MM)) && !defined(__32BIT__) /* MSC small or medium model */ # define SMALL_MEDIUM # ifdef _MSC_VER # define FAR _far # else # define FAR far # endif #endif #if defined(__BORLANDC__) && (defined(__SMALL__) || defined(__MEDIUM__)) # ifndef __32BIT__ # define SMALL_MEDIUM # define FAR _far # endif #endif /* Compile with -DZLIB_DLL for Windows DLL support */ #if defined(ZLIB_DLL) # if defined(_WINDOWS) || defined(WINDOWS) # ifdef FAR # undef FAR # endif # include # define ZEXPORT WINAPI # ifdef WIN32 # define ZEXPORTVA WINAPIV # else # define ZEXPORTVA FAR _cdecl _export # endif # endif # if defined (__BORLANDC__) # if (__BORLANDC__ >= 0x0500) && defined (WIN32) # include # define ZEXPORT __declspec(dllexport) WINAPI # define ZEXPORTRVA __declspec(dllexport) WINAPIV # else # if defined (_Windows) && defined (__DLL__) # define ZEXPORT _export # define ZEXPORTVA _export # endif # endif # endif #endif #if defined (__BEOS__) # if defined (ZLIB_DLL) # define ZEXTERN extern __declspec(dllexport) # else # define ZEXTERN extern __declspec(dllimport) # endif #endif #ifndef ZEXPORT # define ZEXPORT #endif #ifndef ZEXPORTVA # define ZEXPORTVA #endif #ifndef ZEXTERN # define ZEXTERN extern #endif #ifndef FAR # define FAR #endif #if !defined(MACOS) && !defined(TARGET_OS_MAC) typedef unsigned char Byte; /* 8 bits */ #endif typedef unsigned int uInt; /* 16 bits or more */ typedef unsigned long uLong; /* 32 bits or more */ typedef unsigned long long uLongLong; /* 64 bits */ #ifdef SMALL_MEDIUM /* Borland C/C++ and some old MSC versions ignore FAR inside typedef */ # define Bytef Byte FAR #else typedef Byte FAR Bytef; #endif typedef char FAR charf; typedef int FAR intf; typedef uInt FAR uIntf; typedef uLong FAR uLongf; #ifdef STDC typedef void FAR *voidpf; typedef void *voidp; #else typedef Byte FAR *voidpf; typedef Byte *voidp; #endif #ifdef HAVE_UNISTD_H # include /* for off_t */ # include /* for SEEK_* and off_t */ # define z_off_t off_t #endif #ifndef SEEK_SET # define SEEK_SET 0 /* Seek from beginning of file. */ # define SEEK_CUR 1 /* Seek from current position. */ # define SEEK_END 2 /* Set file pointer to EOF plus "offset" */ #endif #ifndef z_off_t # define z_off_t long #endif /* MVS linker does not support external names larger than 8 bytes */ #if defined(__MVS__) # pragma map(deflateInit_,"DEIN") # pragma map(deflateInit2_,"DEIN2") # pragma map(deflateEnd,"DEEND") # pragma map(inflateInit_,"ININ") # pragma map(inflateInit2_,"ININ2") # pragma map(inflateEnd,"INEND") # pragma map(inflateSync,"INSY") # pragma map(inflateSetDictionary,"INSEDI") # pragma map(inflate_blocks,"INBL") # pragma map(inflate_blocks_new,"INBLNE") # pragma map(inflate_blocks_free,"INBLFR") # pragma map(inflate_blocks_reset,"INBLRE") # pragma map(inflate_codes_free,"INCOFR") # pragma map(inflate_codes,"INCO") # pragma map(inflate_fast,"INFA") # pragma map(inflate_flush,"INFLU") # pragma map(inflate_mask,"INMA") # pragma map(inflate_set_dictionary,"INSEDI2") # pragma map(inflate_copyright,"INCOPY") # pragma map(inflate_trees_bits,"INTRBI") # pragma map(inflate_trees_dynamic,"INTRDY") # pragma map(inflate_trees_fixed,"INTRFI") # pragma map(inflate_trees_free,"INTRFR") #endif #endif /* _ZCONF_H */ avfs-1.1.4/zlib/Makefile.in0000644000175000001440000005104314032341013012370 00000000000000# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = zlib ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libzlib_la_LIBADD = am_libzlib_la_OBJECTS = adler32.lo crc32.lo deflate.lo infblock.lo \ infcodes.lo inffast.lo inflate.lo inftrees.lo infutil.lo \ trees.lo zutil.lo libzlib_la_OBJECTS = $(am_libzlib_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libzlib_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libzlib_la_LDFLAGS) $(LDFLAGS) -o $@ @USE_SYSTEM_ZLIB_FALSE@am_libzlib_la_rpath = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/adler32.Plo ./$(DEPDIR)/crc32.Plo \ ./$(DEPDIR)/deflate.Plo ./$(DEPDIR)/infblock.Plo \ ./$(DEPDIR)/infcodes.Plo ./$(DEPDIR)/inffast.Plo \ ./$(DEPDIR)/inflate.Plo ./$(DEPDIR)/inftrees.Plo \ ./$(DEPDIR)/infutil.Plo ./$(DEPDIR)/trees.Plo \ ./$(DEPDIR)/zutil.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libzlib_la_SOURCES) DIST_SOURCES = $(libzlib_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BZLIB_INCLUDE = @BZLIB_INCLUDE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAV = @DAV@ DAV_LS = @DAV_LS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FUSELIBS = @FUSELIBS@ GREP = @GREP@ HAVE_ZIPINFO = @HAVE_ZIPINFO@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ LIBZSTD_LIBS = @LIBZSTD_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NUMVERSION = @NUMVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ ZIP = @ZIP@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_INCLUDE = @ZLIB_INCLUDE@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AM_CFLAGS = -I$(top_srcdir)/include @ZLIB_CFLAGS@ @CPPFLAGS@ @USE_SYSTEM_ZLIB_FALSE@noinst_LTLIBRARIES = libzlib.la libzlib_la_LDFLAGS = -module libzlib_la_SOURCES = adler32.c \ crc32.c \ deflate.c \ infblock.c \ infcodes.c \ inffast.c \ inflate.c \ inftrees.c \ infutil.c \ trees.c \ zutil.c noinst_HEADERS = \ deflate.h \ infblock.h \ infcodes.h \ inffast.h \ inffixed.h \ inftrees.h \ infutil.h \ trees.h \ zconf.h \ zlib.h \ zutil.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu zlib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu zlib/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libzlib.la: $(libzlib_la_OBJECTS) $(libzlib_la_DEPENDENCIES) $(EXTRA_libzlib_la_DEPENDENCIES) $(AM_V_CCLD)$(libzlib_la_LINK) $(am_libzlib_la_rpath) $(libzlib_la_OBJECTS) $(libzlib_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adler32.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc32.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deflate.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/infblock.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/infcodes.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inffast.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inflate.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inftrees.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/infutil.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trees.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zutil.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/adler32.Plo -rm -f ./$(DEPDIR)/crc32.Plo -rm -f ./$(DEPDIR)/deflate.Plo -rm -f ./$(DEPDIR)/infblock.Plo -rm -f ./$(DEPDIR)/infcodes.Plo -rm -f ./$(DEPDIR)/inffast.Plo -rm -f ./$(DEPDIR)/inflate.Plo -rm -f ./$(DEPDIR)/inftrees.Plo -rm -f ./$(DEPDIR)/infutil.Plo -rm -f ./$(DEPDIR)/trees.Plo -rm -f ./$(DEPDIR)/zutil.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/adler32.Plo -rm -f ./$(DEPDIR)/crc32.Plo -rm -f ./$(DEPDIR)/deflate.Plo -rm -f ./$(DEPDIR)/infblock.Plo -rm -f ./$(DEPDIR)/infcodes.Plo -rm -f ./$(DEPDIR)/inffast.Plo -rm -f ./$(DEPDIR)/inflate.Plo -rm -f ./$(DEPDIR)/inftrees.Plo -rm -f ./$(DEPDIR)/infutil.Plo -rm -f ./$(DEPDIR)/trees.Plo -rm -f ./$(DEPDIR)/zutil.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: avfs-1.1.4/zlib/infblock.h0000644000175000001440000000267314032341001012265 00000000000000/* infblock.h -- header to use infblock.c * Copyright (C) 1995-2002 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ struct inflate_blocks_state; typedef struct inflate_blocks_state FAR inflate_blocks_statef; extern inflate_blocks_statef * inflate_blocks_new OF(( z_streamp z, check_func c, /* check function */ uInt w)); /* window size */ extern int inflate_blocks OF(( inflate_blocks_statef *, z_streamp , int)); /* initial return code */ extern void inflate_blocks_reset OF(( inflate_blocks_statef *, z_streamp , uLongf *)); /* check value on output */ extern int inflate_blocks_free OF(( inflate_blocks_statef *, z_streamp)); extern void inflate_set_dictionary OF(( inflate_blocks_statef *s, const Bytef *d, /* dictionary */ uInt n)); /* dictionary length */ extern int inflate_blocks_sync_point OF(( inflate_blocks_statef *s)); extern int inflate_blocks_save OF(( char **bufp, int at, inflate_blocks_statef *s, z_streamp z, uInt w)); extern inflate_blocks_statef * inflate_blocks_restore OF(( char **bufp, z_streamp z, check_func c, uInt w)); avfs-1.1.4/zlib/infcodes.h0000644000175000001440000000172014032341001012260 00000000000000/* infcodes.h -- header to use infcodes.c * Copyright (C) 1995-2002 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ struct inflate_codes_state; typedef struct inflate_codes_state FAR inflate_codes_statef; extern inflate_codes_statef *inflate_codes_new OF(( uInt, uInt, inflate_huft *, inflate_huft *, z_streamp )); extern int inflate_codes OF(( inflate_blocks_statef *, z_streamp , int)); extern void inflate_codes_free OF(( inflate_codes_statef *, z_streamp )); extern int inflate_codes_save OF(( char **bufp, int at, inflate_blocks_statef *s, z_streamp z )); extern inflate_codes_statef * inflate_codes_restore OF(( char **bufp, inflate_blocks_statef *s, z_streamp z )); avfs-1.1.4/zlib/zutil.c0000644000175000001440000001224114032341001011630 00000000000000/* zutil.c -- target dependent utility functions for the compression library * Copyright (C) 1995-2002 Jean-loup Gailly. * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id: zutil.c,v 1.2 2002/12/03 18:50:27 mszeredi Exp $ */ #include "zutil.h" struct internal_state {int dummy;}; /* for buggy compilers */ #ifndef STDC extern void exit OF((int)); #endif const char *z_errmsg[10] = { "need dictionary", /* Z_NEED_DICT 2 */ "stream end", /* Z_STREAM_END 1 */ "", /* Z_OK 0 */ "file error", /* Z_ERRNO (-1) */ "stream error", /* Z_STREAM_ERROR (-2) */ "data error", /* Z_DATA_ERROR (-3) */ "insufficient memory", /* Z_MEM_ERROR (-4) */ "buffer error", /* Z_BUF_ERROR (-5) */ "incompatible version",/* Z_VERSION_ERROR (-6) */ ""}; const char * ZEXPORT zlibVersion() { return ZLIB_VERSION; } #ifdef DEBUG # ifndef verbose # define verbose 0 # endif int z_verbose = verbose; void z_error (m) char *m; { fprintf(stderr, "%s\n", m); exit(1); } #endif /* exported to allow conversion of error code to string for compress() and * uncompress() */ const char * ZEXPORT zError(err) int err; { return ERR_MSG(err); } #ifndef HAVE_MEMCPY void zmemcpy(dest, source, len) Bytef* dest; const Bytef* source; uInt len; { if (len == 0) return; do { *dest++ = *source++; /* ??? to be unrolled */ } while (--len != 0); } int zmemcmp(s1, s2, len) const Bytef* s1; const Bytef* s2; uInt len; { uInt j; for (j = 0; j < len; j++) { if (s1[j] != s2[j]) return 2*(s1[j] > s2[j])-1; } return 0; } void zmemzero(dest, len) Bytef* dest; uInt len; { if (len == 0) return; do { *dest++ = 0; /* ??? to be unrolled */ } while (--len != 0); } #endif #ifdef __TURBOC__ #if (defined( __BORLANDC__) || !defined(SMALL_MEDIUM)) && !defined(__32BIT__) /* Small and medium model in Turbo C are for now limited to near allocation * with reduced MAX_WBITS and MAX_MEM_LEVEL */ # define MY_ZCALLOC /* Turbo C malloc() does not allow dynamic allocation of 64K bytes * and farmalloc(64K) returns a pointer with an offset of 8, so we * must fix the pointer. Warning: the pointer must be put back to its * original form in order to free it, use zcfree(). */ #define MAX_PTR 10 /* 10*64K = 640K */ local int next_ptr = 0; typedef struct ptr_table_s { voidpf org_ptr; voidpf new_ptr; } ptr_table; local ptr_table table[MAX_PTR]; /* This table is used to remember the original form of pointers * to large buffers (64K). Such pointers are normalized with a zero offset. * Since MSDOS is not a preemptive multitasking OS, this table is not * protected from concurrent access. This hack doesn't work anyway on * a protected system like OS/2. Use Microsoft C instead. */ voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) { voidpf buf = opaque; /* just to make some compilers happy */ ulg bsize = (ulg)items*size; /* If we allocate less than 65520 bytes, we assume that farmalloc * will return a usable pointer which doesn't have to be normalized. */ if (bsize < 65520L) { buf = farmalloc(bsize); if (*(ush*)&buf != 0) return buf; } else { buf = farmalloc(bsize + 16L); } if (buf == NULL || next_ptr >= MAX_PTR) return NULL; table[next_ptr].org_ptr = buf; /* Normalize the pointer to seg:0 */ *((ush*)&buf+1) += ((ush)((uch*)buf-0) + 15) >> 4; *(ush*)&buf = 0; table[next_ptr++].new_ptr = buf; return buf; } void zcfree (voidpf opaque, voidpf ptr) { int n; if (*(ush*)&ptr != 0) { /* object < 64K */ farfree(ptr); return; } /* Find the original pointer */ for (n = 0; n < next_ptr; n++) { if (ptr != table[n].new_ptr) continue; farfree(table[n].org_ptr); while (++n < next_ptr) { table[n-1] = table[n]; } next_ptr--; return; } ptr = opaque; /* just to make some compilers happy */ Assert(0, "zcfree: ptr not found"); } #endif #endif /* __TURBOC__ */ #if defined(M_I86) && !defined(__32BIT__) /* Microsoft C in 16-bit mode */ # define MY_ZCALLOC #if (!defined(_MSC_VER) || (_MSC_VER <= 600)) # define _halloc halloc # define _hfree hfree #endif voidpf zcalloc (voidpf opaque, unsigned items, unsigned size) { if (opaque) opaque = 0; /* to make compiler happy */ return _halloc((long)items, size); } void zcfree (voidpf opaque, voidpf ptr) { if (opaque) opaque = 0; /* to make compiler happy */ _hfree(ptr); } #endif /* MSC */ #ifndef MY_ZCALLOC /* Any system without a special alloc function */ #ifndef STDC extern voidp calloc OF((uInt items, uInt size)); extern void free OF((voidpf ptr)); #endif voidpf zcalloc (opaque, items, size) voidpf opaque; unsigned items; unsigned size; { if (opaque) items += size - size; /* make compiler happy */ return (voidpf)calloc(items, size); } void zcfree (opaque, ptr) voidpf opaque; voidpf ptr; { free(ptr); if (opaque) return; /* make compiler happy */ } #endif /* MY_ZCALLOC */ avfs-1.1.4/zlib/crc32.c0000644000175000001440000001555714032341001011412 00000000000000/* crc32.c -- compute the CRC-32 of a data stream * Copyright (C) 1995-2002 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ /* @(#) $Id: crc32.c,v 1.2 2002/12/03 18:50:25 mszeredi Exp $ */ #include "zlib.h" #define local static #ifdef DYNAMIC_CRC_TABLE local int crc_table_empty = 1; local uLongf crc_table[256]; local void make_crc_table OF((void)); /* Generate a table for a byte-wise 32-bit CRC calculation on the polynomial: x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1. Polynomials over GF(2) are represented in binary, one bit per coefficient, with the lowest powers in the most significant bit. Then adding polynomials is just exclusive-or, and multiplying a polynomial by x is a right shift by one. If we call the above polynomial p, and represent a byte as the polynomial q, also with the lowest power in the most significant bit (so the byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p, where a mod b means the remainder after dividing a by b. This calculation is done using the shift-register method of multiplying and taking the remainder. The register is initialized to zero, and for each incoming bit, x^32 is added mod p to the register if the bit is a one (where x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by x (which is shifting right by one and adding x^32 mod p if the bit shifted out is a one). We start with the highest power (least significant bit) of q and repeat for all eight bits of q. The table is simply the CRC of all possible eight bit values. This is all the information needed to generate CRC's on data a byte at a time for all combinations of CRC register values and incoming bytes. */ local void make_crc_table() { uLong c; int n, k; uLong poly; /* polynomial exclusive-or pattern */ /* terms of polynomial defining this crc (except x^32): */ static const Byte p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26}; /* make exclusive-or pattern from polynomial (0xedb88320L) */ poly = 0L; for (n = 0; n < sizeof(p)/sizeof(Byte); n++) poly |= 1L << (31 - p[n]); for (n = 0; n < 256; n++) { c = (uLong)n; for (k = 0; k < 8; k++) c = c & 1 ? poly ^ (c >> 1) : c >> 1; crc_table[n] = c; } crc_table_empty = 0; } #else /* ======================================================================== * Table of CRC-32's of all single-byte values (made by make_crc_table) */ local const uLongf crc_table[256] = { 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, 0x2d02ef8dL }; #endif /* ========================================================================= * This function can be used by asm versions of crc32() */ const uLongf * ZEXPORT get_crc_table() { #ifdef DYNAMIC_CRC_TABLE if (crc_table_empty) make_crc_table(); #endif return (const uLongf *)crc_table; } /* ========================================================================= */ #define DO1(buf) crc = crc_table[((int)crc ^ (*buf++)) & 0xff] ^ (crc >> 8); #define DO2(buf) DO1(buf); DO1(buf); #define DO4(buf) DO2(buf); DO2(buf); #define DO8(buf) DO4(buf); DO4(buf); /* ========================================================================= */ uLong ZEXPORT crc32(crc, buf, len) uLong crc; const Bytef *buf; uInt len; { if (buf == Z_NULL) return 0L; #ifdef DYNAMIC_CRC_TABLE if (crc_table_empty) make_crc_table(); #endif crc = crc ^ 0xffffffffL; while (len >= 8) { DO8(buf); len -= 8; } if (len) do { DO1(buf); } while (--len); return crc ^ 0xffffffffL; } avfs-1.1.4/zlib/Makefile.am0000644000175000001440000000074714032341001012361 00000000000000AM_CFLAGS = -I$(top_srcdir)/include @ZLIB_CFLAGS@ @CPPFLAGS@ if !USE_SYSTEM_ZLIB noinst_LTLIBRARIES = libzlib.la endif libzlib_la_LDFLAGS = -module libzlib_la_SOURCES = adler32.c \ crc32.c \ deflate.c \ infblock.c \ infcodes.c \ inffast.c \ inflate.c \ inftrees.c \ infutil.c \ trees.c \ zutil.c noinst_HEADERS = \ deflate.h \ infblock.h \ infcodes.h \ inffast.h \ inffixed.h \ inftrees.h \ infutil.h \ trees.h \ zconf.h \ zlib.h \ zutil.h avfs-1.1.4/zlib/deflate.h0000644000175000001440000002661214032341001012101 00000000000000/* deflate.h -- internal compression state * Copyright (C) 1995-2002 Jean-loup Gailly * For conditions of distribution and use, see copyright notice in zlib.h */ /* WARNING: this file should *not* be used by applications. It is part of the implementation of the compression library and is subject to change. Applications should only use zlib.h. */ /* @(#) $Id: deflate.h,v 1.2 2002/12/03 18:50:25 mszeredi Exp $ */ #ifndef _DEFLATE_H #define _DEFLATE_H #include "zutil.h" /* =========================================================================== * Internal compression state. */ #define LENGTH_CODES 29 /* number of length codes, not counting the special END_BLOCK code */ #define LITERALS 256 /* number of literal bytes 0..255 */ #define L_CODES (LITERALS+1+LENGTH_CODES) /* number of Literal or Length codes, including the END_BLOCK code */ #define D_CODES 30 /* number of distance codes */ #define BL_CODES 19 /* number of codes used to transfer the bit lengths */ #define HEAP_SIZE (2*L_CODES+1) /* maximum heap size */ #define MAX_BITS 15 /* All codes must not exceed MAX_BITS bits */ #define INIT_STATE 42 #define BUSY_STATE 113 #define FINISH_STATE 666 /* Stream status */ /* Data structure describing a single value and its code string. */ typedef struct ct_data_s { union { ush freq; /* frequency count */ ush code; /* bit string */ } fc; union { ush dad; /* father node in Huffman tree */ ush len; /* length of bit string */ } dl; } FAR ct_data; #define Freq fc.freq #define Code fc.code #define Dad dl.dad #define Len dl.len typedef struct static_tree_desc_s static_tree_desc; typedef struct tree_desc_s { ct_data *dyn_tree; /* the dynamic tree */ int max_code; /* largest code with non zero frequency */ static_tree_desc *stat_desc; /* the corresponding static tree */ } FAR tree_desc; typedef ush Pos; typedef Pos FAR Posf; typedef unsigned IPos; /* A Pos is an index in the character window. We use short instead of int to * save space in the various tables. IPos is used only for parameter passing. */ typedef struct internal_state { z_streamp strm; /* pointer back to this zlib stream */ int status; /* as the name implies */ Bytef *pending_buf; /* output still pending */ ulg pending_buf_size; /* size of pending_buf */ Bytef *pending_out; /* next pending byte to output to the stream */ int pending; /* nb of bytes in the pending buffer */ int noheader; /* suppress zlib header and adler32 */ Byte data_type; /* UNKNOWN, BINARY or ASCII */ Byte method; /* STORED (for zip only) or DEFLATED */ int last_flush; /* value of flush param for previous deflate call */ /* used by deflate.c: */ uInt w_size; /* LZ77 window size (32K by default) */ uInt w_bits; /* log2(w_size) (8..16) */ uInt w_mask; /* w_size - 1 */ Bytef *window; /* Sliding window. Input bytes are read into the second half of the window, * and move to the first half later to keep a dictionary of at least wSize * bytes. With this organization, matches are limited to a distance of * wSize-MAX_MATCH bytes, but this ensures that IO is always * performed with a length multiple of the block size. Also, it limits * the window size to 64K, which is quite useful on MSDOS. * To do: use the user input buffer as sliding window. */ ulg window_size; /* Actual size of window: 2*wSize, except when the user input buffer * is directly used as sliding window. */ Posf *prev; /* Link to older string with same hash index. To limit the size of this * array to 64K, this link is maintained only for the last 32K strings. * An index in this array is thus a window index modulo 32K. */ Posf *head; /* Heads of the hash chains or NIL. */ uInt ins_h; /* hash index of string to be inserted */ uInt hash_size; /* number of elements in hash table */ uInt hash_bits; /* log2(hash_size) */ uInt hash_mask; /* hash_size-1 */ uInt hash_shift; /* Number of bits by which ins_h must be shifted at each input * step. It must be such that after MIN_MATCH steps, the oldest * byte no longer takes part in the hash key, that is: * hash_shift * MIN_MATCH >= hash_bits */ long block_start; /* Window position at the beginning of the current output block. Gets * negative when the window is moved backwards. */ uInt match_length; /* length of best match */ IPos prev_match; /* previous match */ int match_available; /* set if previous match exists */ uInt strstart; /* start of string to insert */ uInt match_start; /* start of matching string */ uInt lookahead; /* number of valid bytes ahead in window */ uInt prev_length; /* Length of the best match at previous step. Matches not greater than this * are discarded. This is used in the lazy match evaluation. */ uInt max_chain_length; /* To speed up deflation, hash chains are never searched beyond this * length. A higher limit improves compression ratio but degrades the * speed. */ uInt max_lazy_match; /* Attempt to find a better match only when the current match is strictly * smaller than this value. This mechanism is used only for compression * levels >= 4. */ # define max_insert_length max_lazy_match /* Insert new strings in the hash table only if the match length is not * greater than this length. This saves time but degrades compression. * max_insert_length is used only for compression levels <= 3. */ int level; /* compression level (1..9) */ int strategy; /* favor or force Huffman coding*/ uInt good_match; /* Use a faster search when the previous match is longer than this */ int nice_match; /* Stop searching when current match exceeds this */ /* used by trees.c: */ /* Didn't use ct_data typedef below to supress compiler warning */ struct ct_data_s dyn_ltree[HEAP_SIZE]; /* literal and length tree */ struct ct_data_s dyn_dtree[2*D_CODES+1]; /* distance tree */ struct ct_data_s bl_tree[2*BL_CODES+1]; /* Huffman tree for bit lengths */ struct tree_desc_s l_desc; /* desc. for literal tree */ struct tree_desc_s d_desc; /* desc. for distance tree */ struct tree_desc_s bl_desc; /* desc. for bit length tree */ ush bl_count[MAX_BITS+1]; /* number of codes at each bit length for an optimal tree */ int heap[2*L_CODES+1]; /* heap used to build the Huffman trees */ int heap_len; /* number of elements in the heap */ int heap_max; /* element of largest frequency */ /* The sons of heap[n] are heap[2*n] and heap[2*n+1]. heap[0] is not used. * The same heap array is used to build all trees. */ uch depth[2*L_CODES+1]; /* Depth of each subtree used as tie breaker for trees of equal frequency */ uchf *l_buf; /* buffer for literals or lengths */ uInt lit_bufsize; /* Size of match buffer for literals/lengths. There are 4 reasons for * limiting lit_bufsize to 64K: * - frequencies can be kept in 16 bit counters * - if compression is not successful for the first block, all input * data is still in the window so we can still emit a stored block even * when input comes from standard input. (This can also be done for * all blocks if lit_bufsize is not greater than 32K.) * - if compression is not successful for a file smaller than 64K, we can * even emit a stored file instead of a stored block (saving 5 bytes). * This is applicable only for zip (not gzip or zlib). * - creating new Huffman trees less frequently may not provide fast * adaptation to changes in the input data statistics. (Take for * example a binary file with poorly compressible code followed by * a highly compressible string table.) Smaller buffer sizes give * fast adaptation but have of course the overhead of transmitting * trees more frequently. * - I can't count above 4 */ uInt last_lit; /* running index in l_buf */ ushf *d_buf; /* Buffer for distances. To simplify the code, d_buf and l_buf have * the same number of elements. To use different lengths, an extra flag * array would be necessary. */ ulg opt_len; /* bit length of current block with optimal trees */ ulg static_len; /* bit length of current block with static trees */ uInt matches; /* number of string matches in current block */ int last_eob_len; /* bit length of EOB code for last block */ #ifdef DEBUG ulg compressed_len; /* total bit length of compressed file mod 2^32 */ ulg bits_sent; /* bit length of compressed data sent mod 2^32 */ #endif ush bi_buf; /* Output buffer. bits are inserted starting at the bottom (least * significant bits). */ int bi_valid; /* Number of valid bits in bi_buf. All bits above the last valid bit * are always zero. */ } FAR deflate_state; /* Output a byte on the stream. * IN assertion: there is enough room in pending_buf. */ #define put_byte(s, c) {s->pending_buf[s->pending++] = (c);} #define MIN_LOOKAHEAD (MAX_MATCH+MIN_MATCH+1) /* Minimum amount of lookahead, except at the end of the input file. * See deflate.c for comments about the MIN_MATCH+1. */ #define MAX_DIST(s) ((s)->w_size-MIN_LOOKAHEAD) /* In order to simplify the code, particularly on 16 bit machines, match * distances are limited to MAX_DIST instead of WSIZE. */ /* in trees.c */ void _tr_init OF((deflate_state *s)); int _tr_tally OF((deflate_state *s, unsigned dist, unsigned lc)); void _tr_flush_block OF((deflate_state *s, charf *buf, ulg stored_len, int eof)); void _tr_align OF((deflate_state *s)); void _tr_stored_block OF((deflate_state *s, charf *buf, ulg stored_len, int eof)); #define d_code(dist) \ ((dist) < 256 ? _dist_code[dist] : _dist_code[256+((dist)>>7)]) /* Mapping from a distance to a distance code. dist is the distance - 1 and * must not have side effects. _dist_code[256] and _dist_code[257] are never * used. */ #ifndef DEBUG /* Inline versions of _tr_tally for speed: */ #if defined(GEN_TREES_H) || !defined(STDC) extern uch _length_code[]; extern uch _dist_code[]; #else extern const uch _length_code[]; extern const uch _dist_code[]; #endif # define _tr_tally_lit(s, c, flush) \ { uch cc = (c); \ s->d_buf[s->last_lit] = 0; \ s->l_buf[s->last_lit++] = cc; \ s->dyn_ltree[cc].Freq++; \ flush = (s->last_lit == s->lit_bufsize-1); \ } # define _tr_tally_dist(s, distance, length, flush) \ { uch len = (length); \ ush dist = (distance); \ s->d_buf[s->last_lit] = dist; \ s->l_buf[s->last_lit++] = len; \ dist--; \ s->dyn_ltree[_length_code[len]+LITERALS+1].Freq++; \ s->dyn_dtree[d_code(dist)].Freq++; \ flush = (s->last_lit == s->lit_bufsize-1); \ } #else # define _tr_tally_lit(s, c, flush) flush = _tr_tally(s, 0, c) # define _tr_tally_dist(s, distance, length, flush) \ flush = _tr_tally(s, distance, length) #endif #endif avfs-1.1.4/zlib/inffast.c0000644000175000001440000001321714032341001012117 00000000000000/* inffast.c -- process literals and length/distance pairs fast * Copyright (C) 1995-2002 Mark Adler * For conditions of distribution and use, see copyright notice in zlib.h */ #include "zutil.h" #include "inftrees.h" #include "infblock.h" #include "infcodes.h" #include "infutil.h" #include "inffast.h" struct inflate_codes_state {int dummy;}; /* for buggy compilers */ /* simplify the use of the inflate_huft type with some defines */ #define exop word.what.Exop #define bits word.what.Bits /* macros for bit input with no checking and for returning unused bytes */ #define GRABBITS(j) {while(k<(j)){b|=((uLong)NEXTBYTE)<avail_in-n;c=(k>>3)>3:c;n+=c;p-=c;k-=c<<3;} /* Called with number of bytes left to write in window at least 258 (the maximum string length) and number of input bytes available at least ten. The ten bytes are six bytes for the longest length/ distance pair plus four bytes for overloading the bit buffer. */ int inflate_fast(bl, bd, tl, td, s, z) uInt bl, bd; inflate_huft *tl; inflate_huft *td; /* need separate declaration for Borland C++ */ inflate_blocks_statef *s; z_streamp z; { inflate_huft *t; /* temporary pointer */ uInt e; /* extra bits or operation */ uLong b; /* bit buffer */ uInt k; /* bits in bit buffer */ Bytef *p; /* input data pointer */ uInt n; /* bytes available there */ Bytef *q; /* output window write pointer */ uInt m; /* bytes to end of window or read pointer */ uInt ml; /* mask for literal/length tree */ uInt md; /* mask for distance tree */ uInt c; /* bytes to copy */ uInt d; /* distance back to copy from */ Bytef *r; /* copy source pointer */ /* load input, output, bit values */ LOAD /* initialize masks */ ml = inflate_mask[bl]; md = inflate_mask[bd]; /* do until not enough input or output space for fast loop */ do { /* assume called with m >= 258 && n >= 10 */ /* get literal/length code */ GRABBITS(20) /* max bits for literal/length code */ if ((e = (t = tl + ((uInt)b & ml))->exop) == 0) { DUMPBITS(t->bits) Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ? "inflate: * literal '%c'\n" : "inflate: * literal 0x%02x\n", t->base)); *q++ = (Byte)t->base; m--; continue; } do { DUMPBITS(t->bits) if (e & 16) { /* get extra bits for length */ e &= 15; c = t->base + ((uInt)b & inflate_mask[e]); DUMPBITS(e) Tracevv((stderr, "inflate: * length %u\n", c)); /* decode distance base of block to copy */ GRABBITS(15); /* max bits for distance code */ e = (t = td + ((uInt)b & md))->exop; do { DUMPBITS(t->bits) if (e & 16) { /* get extra bits to add to distance base */ e &= 15; GRABBITS(e) /* get extra bits (up to 13) */ d = t->base + ((uInt)b & inflate_mask[e]); DUMPBITS(e) Tracevv((stderr, "inflate: * distance %u\n", d)); /* do the copy */ m -= c; r = q - d; if (r < s->window) /* wrap if needed */ { do { r += s->end - s->window; /* force pointer in window */ } while (r < s->window); /* covers invalid distances */ e = s->end - r; if (c > e) { c -= e; /* wrapped copy */ do { *q++ = *r++; } while (--e); r = s->window; do { *q++ = *r++; } while (--c); } else /* normal copy */ { *q++ = *r++; c--; *q++ = *r++; c--; do { *q++ = *r++; } while (--c); } } else /* normal copy */ { *q++ = *r++; c--; *q++ = *r++; c--; do { *q++ = *r++; } while (--c); } break; } else if ((e & 64) == 0) { t += t->base; e = (t += ((uInt)b & inflate_mask[e]))->exop; } else { z->msg = (char*)"invalid distance code"; UNGRAB UPDATE return Z_DATA_ERROR; } } while (1); break; } if ((e & 64) == 0) { t += t->base; if ((e = (t += ((uInt)b & inflate_mask[e]))->exop) == 0) { DUMPBITS(t->bits) Tracevv((stderr, t->base >= 0x20 && t->base < 0x7f ? "inflate: * literal '%c'\n" : "inflate: * literal 0x%02x\n", t->base)); *q++ = (Byte)t->base; m--; break; } } else if (e & 32) { Tracevv((stderr, "inflate: * end of block\n")); UNGRAB UPDATE return Z_STREAM_END; } else { z->msg = (char*)"invalid literal/length code"; UNGRAB UPDATE return Z_DATA_ERROR; } } while (1); } while (m >= 258 && n >= 10); /* not enough input or output--restore pointers and return */ UNGRAB UPDATE return Z_OK; } avfs-1.1.4/config.guess0000755000175000001440000014102114032341013011677 00000000000000#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2020 Free Software Foundation, Inc. timestamp='2020-11-07' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # # Originally written by Per Bothner; maintained since 2000 by Ben Elliston. # # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess # # Please send patches to . me=$(echo "$0" | sed -e 's,.*/,,') usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; esac done if test $# != 0; then echo "$me: too many arguments$help" >&2 exit 1 fi # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. tmp= # shellcheck disable=SC2172 trap 'test -z "$tmp" || rm -fr "$tmp"' 0 1 2 13 15 set_cc_for_build() { # prevent multiple calls if $tmp is already set test "$tmp" && return 0 : "${TMPDIR=/tmp}" # shellcheck disable=SC2039 { tmp=$( (umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null) && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir "$tmp" 2>/dev/null) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir "$tmp" 2>/dev/null) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } dummy=$tmp/dummy case ${CC_FOR_BUILD-},${HOST_CC-},${CC-} in ,,) echo "int x;" > "$dummy.c" for driver in cc gcc c89 c99 ; do if ($driver -c -o "$dummy.o" "$dummy.c") >/dev/null 2>&1 ; then CC_FOR_BUILD="$driver" break fi done if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac } # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if test -f /.attbin/uname ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=$( (uname -m) 2>/dev/null) || UNAME_MACHINE=unknown UNAME_RELEASE=$( (uname -r) 2>/dev/null) || UNAME_RELEASE=unknown UNAME_SYSTEM=$( (uname -s) 2>/dev/null) || UNAME_SYSTEM=unknown UNAME_VERSION=$( (uname -v) 2>/dev/null) || UNAME_VERSION=unknown case "$UNAME_SYSTEM" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu set_cc_for_build cat <<-EOF > "$dummy.c" #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else #include #ifdef __DEFINED_va_list LIBC=musl #else LIBC=gnu #endif #endif EOF eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^LIBC' | sed 's, ,,g')" ;; esac case "${UNAME_MACHINE}" in i?86) test -z "$VENDOR" && VENDOR=pc ;; *) test -z "$VENDOR" && VENDOR=unknown ;; esac test -f /etc/SuSE-release -o -f /.buildenv && VENDOR=suse test -f /etc/os-release && grep -q suse /etc/os-release && VENDOR=suse # Note: order is significant - the case branches are not exclusive. case "$UNAME_MACHINE:$UNAME_SYSTEM:$UNAME_RELEASE:$UNAME_VERSION" in *:NetBSD:*:*) # NetBSD (nbsd) targets should (where applicable) match one or # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*, # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently # switched to ELF, *-*-netbsd* would select the old # object file format. This provides both forward # compatibility and a consistent mechanism for selecting the # object file format. # # Note: NetBSD doesn't particularly care about the vendor # portion of the name. We always set it to "unknown". sysctl="sysctl -n hw.machine_arch" UNAME_MACHINE_ARCH=$( (uname -p 2>/dev/null || \ "/sbin/$sysctl" 2>/dev/null || \ "/usr/sbin/$sysctl" 2>/dev/null || \ echo unknown)) case "$UNAME_MACHINE_ARCH" in aarch64eb) machine=aarch64_be-unknown ;; armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; earmv*) arch=$(echo "$UNAME_MACHINE_ARCH" | sed -e 's,^e\(armv[0-9]\).*$,\1,') endian=$(echo "$UNAME_MACHINE_ARCH" | sed -ne 's,^.*\(eb\)$,\1,p') machine="${arch}${endian}"-unknown ;; *) machine="$UNAME_MACHINE_ARCH"-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently (or will in the future) and ABI. case "$UNAME_MACHINE_ARCH" in earm*) os=netbsdelf ;; arm*|i386|m68k|ns32k|sh3*|sparc|vax) set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ELF__ then # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). # Return netbsd for either. FIX? os=netbsd else os=netbsdelf fi ;; *) os=netbsd ;; esac # Determine ABI tags. case "$UNAME_MACHINE_ARCH" in earm*) expr='s/^earmv[0-9]/-eabi/;s/eb$//' abi=$(echo "$UNAME_MACHINE_ARCH" | sed -e "$expr") ;; esac # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "$UNAME_VERSION" in Debian*) release='-gnu' ;; *) release=$(echo "$UNAME_RELEASE" | sed -e 's/[-_].*//' | cut -d. -f1,2) ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "$machine-${os}${release}${abi-}" exit ;; *:Bitrig:*:*) UNAME_MACHINE_ARCH=$(arch | sed 's/Bitrig.//') echo "$UNAME_MACHINE_ARCH"-${VENDOR}-bitrig"$UNAME_RELEASE" exit ;; *:OpenBSD:*:*) UNAME_MACHINE_ARCH=$(arch | sed 's/OpenBSD.//') echo "$UNAME_MACHINE_ARCH"-${VENDOR}-openbsd"$UNAME_RELEASE" exit ;; *:LibertyBSD:*:*) UNAME_MACHINE_ARCH=$(arch | sed 's/^.*BSD\.//') echo "$UNAME_MACHINE_ARCH"-${VENDOR}-libertybsd"$UNAME_RELEASE" exit ;; *:MidnightBSD:*:*) echo "$UNAME_MACHINE"-${VENDOR}-midnightbsd"$UNAME_RELEASE" exit ;; *:ekkoBSD:*:*) echo "$UNAME_MACHINE"-${VENDOR}-ekkobsd"$UNAME_RELEASE" exit ;; *:SolidBSD:*:*) echo "$UNAME_MACHINE"-${VENDOR}-solidbsd"$UNAME_RELEASE" exit ;; *:OS108:*:*) echo "$UNAME_MACHINE"-${VENDOR}-os108_"$UNAME_RELEASE" exit ;; macppc:MirBSD:*:*) echo powerpc-${VENDOR}-mirbsd"$UNAME_RELEASE" exit ;; *:MirBSD:*:*) echo "$UNAME_MACHINE"-${VENDOR}-mirbsd"$UNAME_RELEASE" exit ;; *:Sortix:*:*) echo "$UNAME_MACHINE"-${VENDOR}-sortix exit ;; *:Twizzler:*:*) echo "$UNAME_MACHINE"-${VENDOR}-twizzler exit ;; *:Redox:*:*) echo "$UNAME_MACHINE"-${VENDOR}-redox exit ;; mips:OSF1:*.*) echo mips-dec-osf1 exit ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $3}') ;; *5.*) UNAME_RELEASE=$(/usr/sbin/sizer -v | awk '{print $4}') ;; esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU # types through head -n 1, so we only detect the type of CPU 0. ALPHA_CPU_TYPE=$(/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1) case "$ALPHA_CPU_TYPE" in "EV4 (21064)") UNAME_MACHINE=alpha ;; "EV4.5 (21064)") UNAME_MACHINE=alpha ;; "LCA4 (21066/21068)") UNAME_MACHINE=alpha ;; "EV5 (21164)") UNAME_MACHINE=alphaev5 ;; "EV5.6 (21164A)") UNAME_MACHINE=alphaev56 ;; "EV5.6 (21164PC)") UNAME_MACHINE=alphapca56 ;; "EV5.7 (21164PC)") UNAME_MACHINE=alphapca57 ;; "EV6 (21264)") UNAME_MACHINE=alphaev6 ;; "EV6.7 (21264A)") UNAME_MACHINE=alphaev67 ;; "EV6.8CB (21264C)") UNAME_MACHINE=alphaev68 ;; "EV6.8AL (21264B)") UNAME_MACHINE=alphaev68 ;; "EV6.8CX (21264D)") UNAME_MACHINE=alphaev68 ;; "EV6.9A (21264/EV69A)") UNAME_MACHINE=alphaev69 ;; "EV7 (21364)") UNAME_MACHINE=alphaev7 ;; "EV7.9 (21364A)") UNAME_MACHINE=alphaev79 ;; esac # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. echo "$UNAME_MACHINE"-dec-osf"$(echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz)" # Reset EXIT trap before exiting to avoid spurious non-zero exit code. exitcode=$? trap '' 0 exit $exitcode ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-${VENDOR}-sysv4 exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-${VENDOR}-amigaos exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo "$UNAME_MACHINE"-${VENDOR}-morphos exit ;; *:OS/390:*:*) echo i370-ibm-openedition exit ;; *:z/VM:*:*) echo s390-ibm-zvmoe exit ;; *:OS400:*:*) echo powerpc-ibm-os400 exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix"$UNAME_RELEASE" exit ;; arm*:riscos:*:*|arm*:RISCOS:*:*) echo arm-${VENDOR}-riscos exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "$( (/bin/universe) 2>/dev/null)" = att ; then echo pyramid-pyramid-sysv3 else echo pyramid-pyramid-bsd fi exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 exit ;; DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case $(/usr/bin/uname -p) in sparc) echo sparc-icl-nx7; exit ;; esac ;; s390x:SunOS:*:*) echo "$UNAME_MACHINE"-ibm-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')" exit ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2"$(echo "$UNAME_RELEASE" | sed -e 's/[^.]*//')" exit ;; i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) echo i386-${VENDOR}-auroraux"$UNAME_RELEASE" exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) set_cc_for_build SUN_ARCH=i386 # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH=x86_64 fi fi echo "$SUN_ARCH"-${VENDOR}-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" exit ;; sun4*:SunOS:*:*) case "$(/usr/bin/arch -k)" in Series*|S4*) UNAME_RELEASE=$(uname -v) ;; esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/')" exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos"$UNAME_RELEASE" exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=$( (sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null) test "x$UNAME_RELEASE" = x && UNAME_RELEASE=3 case "$(/bin/arch)" in sun3) echo m68k-sun-sunos"$UNAME_RELEASE" ;; sun4) echo sparc-sun-sunos"$UNAME_RELEASE" ;; esac exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos"$UNAME_RELEASE" exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor # > m68000). The system name ranges from "MiNT" over "FreeMiNT" # to the lowercase version "mint" (or "freemint"). Finally # the system name "TOS" denotes a system which is actually not # MiNT. But MiNT is downward compatible to TOS, so this should # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint"$UNAME_RELEASE" exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint"$UNAME_RELEASE" exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint"$UNAME_RELEASE" exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-${VENDOR}-mint"$UNAME_RELEASE" exit ;; m68k:machten:*:*) echo m68k-apple-machten"$UNAME_RELEASE" exit ;; powerpc:machten:*:*) echo powerpc-apple-machten"$UNAME_RELEASE" exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix"$UNAME_RELEASE" exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix"$UNAME_RELEASE" exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix"$UNAME_RELEASE" exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && dummyarg=$(echo "$UNAME_RELEASE" | sed -n 's/\([0-9]*\).*/\1/p') && SYSTEM_NAME=$("$dummy" "$dummyarg") && { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos"$UNAME_RELEASE" exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=$(/usr/bin/uname -p) if test "$UNAME_PROCESSOR" = mc88100 || test "$UNAME_PROCESSOR" = mc88110 then if test "$TARGET_BINARY_INTERFACE"x = m88kdguxelfx || \ test "$TARGET_BINARY_INTERFACE"x = x then echo m88k-dg-dgux"$UNAME_RELEASE" else echo m88k-dg-dguxbcs"$UNAME_RELEASE" fi else echo i586-dg-dgux"$UNAME_RELEASE" fi exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd exit ;; *:IRIX*:*:*) echo mips-sgi-irix"$(echo "$UNAME_RELEASE"|sed -e 's/-/_/g')" exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id exit ;; # Note that: echo "'$(uname -s)'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix exit ;; ia64:AIX:*:*) if test -x /usr/bin/oslevel ; then IBM_REV=$(/usr/bin/oslevel) else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$UNAME_MACHINE"-ibm-aix"$IBM_REV" exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF if $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") then echo "$SYSTEM_NAME" else echo rs6000-ibm-aix3.2.5 fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi exit ;; *:AIX:*:[4567]) IBM_CPU_ID=$(/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }') if /usr/sbin/lsattr -El "$IBM_CPU_ID" | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc fi if test -x /usr/bin/lslpp ; then IBM_REV=$(/usr/bin/lslpp -Lqc bos.rte.libc | awk -F: '{ print $3 }' | sed s/[0-9]*$/0/) else IBM_REV="$UNAME_VERSION.$UNAME_RELEASE" fi echo "$IBM_ARCH"-ibm-aix"$IBM_REV" exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:4.4BSD:*) echo romp-ibm-bsd4.4 exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd"$UNAME_RELEASE" # 4.3 with uname added to exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//') case "$UNAME_MACHINE" in 9000/31?) HP_ARCH=m68000 ;; 9000/[34]??) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) if test -x /usr/bin/getconf; then sc_cpu_version=$(/usr/bin/getconf SC_CPU_VERSION 2>/dev/null) sc_kernel_bits=$(/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null) case "$sc_cpu_version" in 523) HP_ARCH=hppa1.0 ;; # CPU_PA_RISC1_0 528) HP_ARCH=hppa1.1 ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "$sc_kernel_bits" in 32) HP_ARCH=hppa2.0n ;; 64) HP_ARCH=hppa2.0w ;; '') HP_ARCH=hppa2.0 ;; # HP-UX 10.20 esac ;; esac fi if test "$HP_ARCH" = ""; then set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS="" $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null) && HP_ARCH=$("$dummy") test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if test "$HP_ARCH" = hppa2.0w then set_cc_for_build # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler # generating 64-bit code. GNU and HP use different nomenclature: # # $ CC_FOR_BUILD=cc ./config.guess # => hppa2.0w-hp-hpux11.23 # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess # => hppa64-hp-hpux11.23 if echo __LP64__ | (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | grep -q __LP64__ then HP_ARCH=hppa2.0w else HP_ARCH=hppa64 fi fi echo "$HP_ARCH"-hp-hpux"$HPUX_REV" exit ;; ia64:HP-UX:*:*) HPUX_REV=$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*.[0B]*//') echo ia64-hp-hpux"$HPUX_REV" exit ;; 3050*:HI-UX:*:*) set_cc_for_build sed 's/^ //' << EOF > "$dummy.c" #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" && SYSTEM_NAME=$("$dummy") && { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:*) echo hppa1.1-hp-bsd exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:*) echo hppa1.1-hp-osf exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf exit ;; i*86:OSF1:*:*) if test -x /usr/sbin/sysversion ; then echo "$UNAME_MACHINE"-${VENDOR}-osf1mk else echo "$UNAME_MACHINE"-${VENDOR}-osf1 fi exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*[A-Z]90:*:*:*) echo "$UNAME_MACHINE"-cray-unicos"$UNAME_RELEASE" \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; *:UNICOS/mp:*:*) echo craynv-cray-unicosmp"$UNAME_RELEASE" | sed -e 's/\.[^.]*$/.X/' exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=$(uname -m | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz) FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///') FUJITSU_REL=$(echo "$UNAME_RELEASE" | sed -e 's/ /_/') echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; 5000:UNIX_System_V:4.*:*) FUJITSU_SYS=$(uname -p | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/\///') FUJITSU_REL=$(echo "$UNAME_RELEASE" | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz | sed -e 's/ /_/') echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo "$UNAME_MACHINE"-${VENDOR}-bsdi"$UNAME_RELEASE" exit ;; sparc*:BSD/OS:*:*) echo sparc-${VENDOR}-bsdi"$UNAME_RELEASE" exit ;; *:BSD/OS:*:*) echo "$UNAME_MACHINE"-${VENDOR}-bsdi"$UNAME_RELEASE" exit ;; arm:FreeBSD:*:*) UNAME_PROCESSOR=$(uname -p) set_cc_for_build if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "${UNAME_PROCESSOR}"-${VENDOR}-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabi else echo "${UNAME_PROCESSOR}"-${VENDOR}-freebsd"$(echo ${UNAME_RELEASE}|sed -e 's/[-(].*//')"-gnueabihf fi exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=$(/usr/bin/uname -p) case "$UNAME_PROCESSOR" in amd64) UNAME_PROCESSOR=x86_64 ;; i386) UNAME_PROCESSOR=i586 ;; esac echo "$UNAME_PROCESSOR"-${VENDOR}-freebsd"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')" exit ;; i*:CYGWIN*:*) echo "$UNAME_MACHINE"-${VENDOR}-cygwin exit ;; *:MINGW64*:*) echo "$UNAME_MACHINE"-${VENDOR}-mingw64 exit ;; *:MINGW*:*) echo "$UNAME_MACHINE"-${VENDOR}-mingw32 exit ;; *:MSYS*:*) echo "$UNAME_MACHINE"-${VENDOR}-msys exit ;; i*:PW*:*) echo "$UNAME_MACHINE"-${VENDOR}-pw32 exit ;; *:Interix*:*) case "$UNAME_MACHINE" in x86) echo i586-${VENDOR}-interix"$UNAME_RELEASE" exit ;; authenticamd | genuineintel | EM64T) echo x86_64-${VENDOR}-interix"$UNAME_RELEASE" exit ;; IA64) echo ia64-${VENDOR}-interix"$UNAME_RELEASE" exit ;; esac ;; i*:UWIN*:*) echo "$UNAME_MACHINE"-${VENDOR}-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-${VENDOR}-cygwin exit ;; prep*:SunOS:5.*:*) echo powerpcle-${VENDOR}-solaris2"$(echo "$UNAME_RELEASE"|sed -e 's/[^.]*//')" exit ;; *:GNU:*:*) # the GNU system echo "$(echo "$UNAME_MACHINE"|sed -e 's,[-/].*$,,')-${VENDOR}-$LIBC$(echo "$UNAME_RELEASE"|sed -e 's,/.*$,,')" exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo "$UNAME_MACHINE-${VENDOR}-$(echo "$UNAME_SYSTEM" | sed 's,^[^/]*/,,' | tr "[:upper:]" "[:lower:]")$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')-$LIBC" exit ;; *:Minix:*:*) echo "$UNAME_MACHINE"-${VENDOR}-minix exit ;; aarch64:Linux:*:*) echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; aarch64_be:Linux:*:*) UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; alpha:Linux:*:*) case $(sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' /proc/cpuinfo 2>/dev/null) in EV5) UNAME_MACHINE=alphaev5 ;; EV56) UNAME_MACHINE=alphaev56 ;; PCA56) UNAME_MACHINE=alphapca56 ;; PCA57) UNAME_MACHINE=alphapca56 ;; EV6) UNAME_MACHINE=alphaev6 ;; EV67) UNAME_MACHINE=alphaev67 ;; EV68*) UNAME_MACHINE=alphaev68 ;; esac objdump --private-headers /bin/sh | grep -q ld.so.1 if test "$?" = 0 ; then LIBC=gnulibc1 ; fi echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; arc:Linux:*:* | arceb:Linux:*:*) echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; arm*:Linux:*:*) set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" else if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_PCS_VFP then echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC"eabi else echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC"eabihf fi fi exit ;; avr32*:Linux:*:*) echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; cris:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; crisv32:Linux:*:*) echo "$UNAME_MACHINE"-axis-linux-"$LIBC" exit ;; e2k:Linux:*:*) echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; frv:Linux:*:*) echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; hexagon:Linux:*:*) echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; i*86:Linux:*:*) echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; ia64:Linux:*:*) echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; k1om:Linux:*:*) echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; m32r*:Linux:*:*) echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; m68*:Linux:*:*) echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; mips:Linux:*:* | mips64:Linux:*:*) set_cc_for_build IS_GLIBC=0 test x"${LIBC}" = xgnu && IS_GLIBC=1 sed 's/^ //' << EOF > "$dummy.c" #undef CPU #undef mips #undef mipsel #undef mips64 #undef mips64el #if ${IS_GLIBC} && defined(_ABI64) LIBCABI=gnuabi64 #else #if ${IS_GLIBC} && defined(_ABIN32) LIBCABI=gnuabin32 #else LIBCABI=${LIBC} #endif #endif #if ${IS_GLIBC} && defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa64r6 #else #if ${IS_GLIBC} && !defined(__mips64) && defined(__mips_isa_rev) && __mips_isa_rev>=6 CPU=mipsisa32r6 #else #if defined(__mips64) CPU=mips64 #else CPU=mips #endif #endif #endif #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) MIPS_ENDIAN=el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) MIPS_ENDIAN= #else MIPS_ENDIAN= #endif #endif EOF eval "$($CC_FOR_BUILD -E "$dummy.c" 2>/dev/null | grep '^CPU\|^MIPS_ENDIAN\|^LIBCABI')" test "x$CPU" != x && { echo "$CPU${MIPS_ENDIAN}-${VENDOR}-linux-$LIBCABI"; exit; } ;; mips64el:Linux:*:*) echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; openrisc*:Linux:*:*) echo or1k-${VENDOR}-linux-"$LIBC" exit ;; or32:Linux:*:* | or1k*:Linux:*:*) echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; padre:Linux:*:*) echo sparc-${VENDOR}-linux-"$LIBC" exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-${VENDOR}-linux-"$LIBC" exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case $(grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2) in PA7*) echo hppa1.1-${VENDOR}-linux-"$LIBC" ;; PA8*) echo hppa2.0-${VENDOR}-linux-"$LIBC" ;; *) echo hppa-${VENDOR}-linux-"$LIBC" ;; esac exit ;; ppc64:Linux:*:*) echo powerpc64-${VENDOR}-linux-"$LIBC" exit ;; ppc:Linux:*:*) echo powerpc-${VENDOR}-linux-"$LIBC" exit ;; ppc64le:Linux:*:*) echo powerpc64le-${VENDOR}-linux-"$LIBC" exit ;; ppcle:Linux:*:*) echo powerpcle-${VENDOR}-linux-"$LIBC" exit ;; riscv32:Linux:*:* | riscv64:Linux:*:*) echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo "$UNAME_MACHINE"-ibm-linux-"$LIBC" exit ;; sh64*:Linux:*:*) echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; sh*:Linux:*:*) echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; tile*:Linux:*:*) echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; vax:Linux:*:*) echo "$UNAME_MACHINE"-dec-linux-"$LIBC" exit ;; x86_64:Linux:*:*) set_cc_for_build LIBCABI=$LIBC if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __ILP32__'; echo IS_X32; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_X32 >/dev/null then LIBCABI="$LIBC"x32 fi fi echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBCABI" exit ;; xtensa*:Linux:*:*) echo "$UNAME_MACHINE"-${VENDOR}-linux-"$LIBC" exit ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... # I am not positive that other SVR4 systems won't match this, # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo "$UNAME_MACHINE"-${VENDOR}-sysv4.2uw"$UNAME_VERSION" exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo "$UNAME_MACHINE"-${VENDOR}-os2-emx exit ;; i*86:XTS-300:*:STOP) echo "$UNAME_MACHINE"-${VENDOR}-stop exit ;; i*86:atheos:*:*) echo "$UNAME_MACHINE"-${VENDOR}-atheos exit ;; i*86:syllable:*:*) echo "$UNAME_MACHINE"-${VENDOR}-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-${VENDOR}-lynxos"$UNAME_RELEASE" exit ;; i*86:*DOS:*:*) echo "$UNAME_MACHINE"-${VENDOR}-msdosdjgpp exit ;; i*86:*:4.*:*) UNAME_REL=$(echo "$UNAME_RELEASE" | sed 's/\/MP$//') if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo "$UNAME_MACHINE"-univel-sysv"$UNAME_REL" else echo "$UNAME_MACHINE"-${VENDOR}-sysv"$UNAME_REL" fi exit ;; i*86:*:5:[678]*) # UnixWare 7.x, OpenUNIX and OpenServer 6. case $(/bin/uname -X | grep "^Machine") in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo "$UNAME_MACHINE-${VENDOR}-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}" exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=$(sed -n 's/.*Version //p' /dev/null >/dev/null ; then UNAME_REL=$( (/bin/uname -X|grep Release|sed -e 's/.*= //')) (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ && UNAME_MACHINE=i586 (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ && UNAME_MACHINE=i686 (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ && UNAME_MACHINE=i686 echo "$UNAME_MACHINE"-${VENDOR}-sco"$UNAME_REL" else echo "$UNAME_MACHINE"-${VENDOR}-sysv32 fi exit ;; pc:*:*:*) # Left here for compatibility: # uname -m prints for DJGPP always 'pc', but it prints nothing about # the processor, so we play safe by assuming i586. # Note: whatever this is, it MUST be the same as what config.sub # prints for the "djgpp" host, or else GDB configure will decide that # this is a cross-build. echo i586-${VENDOR}-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-${VENDOR}-mach3 exit ;; paragon:*:*:*) echo i860-intel-osf1 exit ;; i860:*:4.*:*) # i860-SVR4 if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then echo i860-stardent-sysv"$UNAME_RELEASE" # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-${VENDOR}-sysv"$UNAME_RELEASE" # Unknown i860-SVR4 fi exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix exit ;; M68*:*:R3V[5678]*:*) test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4; exit; } ;; NCR*:*:4.2:* | MPRAS*:*:4.2:*) OS_REL='.3' test -r /etc/.relid \ && OS_REL=.$(sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ && { echo i486-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ && { echo i586-ncr-sysv4.3"$OS_REL"; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-${VENDOR}-lynxos"$UNAME_RELEASE" exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-${VENDOR}-lynxos"$UNAME_RELEASE" exit ;; rs6000:LynxOS:2.*:*) echo rs6000-${VENDOR}-lynxos"$UNAME_RELEASE" exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) echo powerpc-${VENDOR}-lynxos"$UNAME_RELEASE" exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv"$UNAME_RELEASE" exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=$( (uname -p) 2>/dev/null) echo "$UNAME_MACHINE"-sni-sysv4 else echo ns32k-sni-sysv fi exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 exit ;; i*86:VOS:*:*) # From Paul.Green@stratus.com. echo "$UNAME_MACHINE"-stratus-vos exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux"$UNAME_RELEASE" exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if test -d /usr/nec; then echo mips-nec-sysv"$UNAME_RELEASE" else echo mips-${VENDOR}-sysv"$UNAME_RELEASE" fi exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-${VENDOR}-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-${VENDOR}-haiku exit ;; x86_64:Haiku:*:*) echo x86_64-${VENDOR}-haiku exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux"$UNAME_RELEASE" exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux"$UNAME_RELEASE" exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux"$UNAME_RELEASE" exit ;; SX-7:SUPER-UX:*:*) echo sx7-nec-superux"$UNAME_RELEASE" exit ;; SX-8:SUPER-UX:*:*) echo sx8-nec-superux"$UNAME_RELEASE" exit ;; SX-8R:SUPER-UX:*:*) echo sx8r-nec-superux"$UNAME_RELEASE" exit ;; SX-ACE:SUPER-UX:*:*) echo sxace-nec-superux"$UNAME_RELEASE" exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody"$UNAME_RELEASE" exit ;; *:Rhapsody:*:*) echo "$UNAME_MACHINE"-apple-rhapsody"$UNAME_RELEASE" exit ;; arm64:Darwin:*:*) echo aarch64-apple-darwin"$UNAME_RELEASE" exit ;; *:Darwin:*:*) UNAME_PROCESSOR=$(uname -p) case $UNAME_PROCESSOR in unknown) UNAME_PROCESSOR=powerpc ;; esac if command -v xcode-select > /dev/null 2> /dev/null && \ ! xcode-select --print-path > /dev/null 2> /dev/null ; then # Avoid executing cc if there is no toolchain installed as # cc will be a stub that puts up a graphical alert # prompting the user to install developer tools. CC_FOR_BUILD=no_compiler_found else set_cc_for_build fi if test "$CC_FOR_BUILD" != no_compiler_found; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi # On 10.4-10.6 one might compile for PowerPC via gcc -arch ppc if (echo '#ifdef __POWERPC__'; echo IS_PPC; echo '#endif') | \ (CCOPTS="" $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_PPC >/dev/null then UNAME_PROCESSOR=powerpc fi elif test "$UNAME_PROCESSOR" = i386 ; then # uname -m returns i386 or x86_64 UNAME_PROCESSOR=$UNAME_MACHINE fi echo "$UNAME_PROCESSOR"-apple-darwin"$UNAME_RELEASE" exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=$(uname -p) if test "$UNAME_PROCESSOR" = x86; then UNAME_PROCESSOR=i386 UNAME_MACHINE=pc fi echo "$UNAME_PROCESSOR"-"$UNAME_MACHINE"-nto-qnx"$UNAME_RELEASE" exit ;; *:QNX:*:4*) echo i386-${VENDOR}-qnx exit ;; NEO-*:NONSTOP_KERNEL:*:*) echo neo-tandem-nsk"$UNAME_RELEASE" exit ;; NSE-*:NONSTOP_KERNEL:*:*) echo nse-tandem-nsk"$UNAME_RELEASE" exit ;; NSR-*:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk"$UNAME_RELEASE" exit ;; NSV-*:NONSTOP_KERNEL:*:*) echo nsv-tandem-nsk"$UNAME_RELEASE" exit ;; NSX-*:NONSTOP_KERNEL:*:*) echo nsx-tandem-nsk"$UNAME_RELEASE" exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv exit ;; DS/*:UNIX_System_V:*:*) echo "$UNAME_MACHINE"-"$UNAME_SYSTEM"-"$UNAME_RELEASE" exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 # operating systems. # shellcheck disable=SC2154 if test "$cputype" = 386; then UNAME_MACHINE=i386 else UNAME_MACHINE="$cputype" fi echo "$UNAME_MACHINE"-${VENDOR}-plan9 exit ;; *:TOPS-10:*:*) echo pdp10-${VENDOR}-tops10 exit ;; *:TENEX:*:*) echo pdp10-${VENDOR}-tenex exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 exit ;; *:TOPS-20:*:*) echo pdp10-${VENDOR}-tops20 exit ;; *:ITS:*:*) echo pdp10-${VENDOR}-its exit ;; SEI:*:*:SEIUX) echo mips-sei-seiux"$UNAME_RELEASE" exit ;; *:DragonFly:*:*) echo "$UNAME_MACHINE"-${VENDOR}-dragonfly"$(echo "$UNAME_RELEASE"|sed -e 's/[-(].*//')" exit ;; *:*VMS:*:*) UNAME_MACHINE=$( (uname -p) 2>/dev/null) case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; *:XENIX:*:SysV) echo i386-${VENDOR}-xenix exit ;; i*86:skyos:*:*) echo "$UNAME_MACHINE"-${VENDOR}-skyos"$(echo "$UNAME_RELEASE" | sed -e 's/ .*$//')" exit ;; i*86:rdos:*:*) echo "$UNAME_MACHINE"-${VENDOR}-rdos exit ;; i*86:AROS:*:*) echo "$UNAME_MACHINE"-${VENDOR}-aros exit ;; x86_64:VMkernel:*:*) echo "$UNAME_MACHINE"-${VENDOR}-esx exit ;; amd64:Isilon\ OneFS:*:*) echo x86_64-${VENDOR}-onefs exit ;; *:Unleashed:*:*) echo "$UNAME_MACHINE"-${VENDOR}-unleashed"$UNAME_RELEASE" exit ;; esac # No uname command or uname output not recognized. set_cc_for_build cat > "$dummy.c" < #include #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined (vax) || defined (__vax) || defined (__vax__) || defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #include #if defined(_SIZE_T_) || defined(SIGLOST) #include #endif #endif #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=$( (hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null); if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) #if !defined (ultrix) #include #if defined (BSD) #if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); #else #if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); #else printf ("vax-dec-bsd\n"); exit (0); #endif #endif #else printf ("vax-dec-bsd\n"); exit (0); #endif #else #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname un; uname (&un); printf ("vax-dec-ultrix%s\n", un.release); exit (0); #else printf ("vax-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined(ultrix) || defined(_ultrix) || defined(__ultrix) || defined(__ultrix__) #if defined(mips) || defined(__mips) || defined(__mips__) || defined(MIPS) || defined(__MIPS__) #if defined(_SIZE_T_) || defined(SIGLOST) struct utsname *un; uname (&un); printf ("mips-dec-ultrix%s\n", un.release); exit (0); #else printf ("mips-dec-ultrix\n"); exit (0); #endif #endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o "$dummy" "$dummy.c" 2>/dev/null && SYSTEM_NAME=$($dummy) && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo "$ISP-apollo-$SYSTYPE"; exit; } echo "$0: unable to guess system type" >&2 case "$UNAME_MACHINE:$UNAME_SYSTEM" in mips:Linux | mips64:Linux) # If we got here on MIPS GNU/Linux, output extra information. cat >&2 <&2 <&2 </dev/null || echo unknown) uname -r = $( (uname -r) 2>/dev/null || echo unknown) uname -s = $( (uname -s) 2>/dev/null || echo unknown) uname -v = $( (uname -v) 2>/dev/null || echo unknown) /usr/bin/uname -p = $( (/usr/bin/uname -p) 2>/dev/null) /bin/uname -X = $( (/bin/uname -X) 2>/dev/null) hostinfo = $( (hostinfo) 2>/dev/null) /bin/universe = $( (/bin/universe) 2>/dev/null) /usr/bin/arch -k = $( (/usr/bin/arch -k) 2>/dev/null) /bin/arch = $( (/bin/arch) 2>/dev/null) /usr/bin/oslevel = $( (/usr/bin/oslevel) 2>/dev/null) /usr/convex/getsysinfo = $( (/usr/convex/getsysinfo) 2>/dev/null) UNAME_MACHINE = "$UNAME_MACHINE" UNAME_RELEASE = "$UNAME_RELEASE" UNAME_SYSTEM = "$UNAME_SYSTEM" UNAME_VERSION = "$UNAME_VERSION" EOF fi exit 1 # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: avfs-1.1.4/COPYING.LIB0000644000175000001440000006130314032341001011020 00000000000000 GNU LIBRARY GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1991 Free Software Foundation, Inc. 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. [This is the first released version of the library GPL. It is numbered 2 because it goes with version 2 of the ordinary GPL.] Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public Licenses are intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This license, the Library General Public License, applies to some specially designated Free Software Foundation software, and to any other libraries whose authors decide to use it. You can use it for your libraries, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the library, or if you modify it. For example, if you distribute copies of the library, whether gratis or for a fee, you must give the recipients all the rights that we gave you. You must make sure that they, too, receive or can get the source code. If you link a program with the library, you must provide complete object files to the recipients so that they can relink them with the library, after making changes to the library and recompiling it. And you must show them these terms so they know their rights. Our method of protecting your rights has two steps: (1) copyright the library, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the library. Also, for each distributor's protection, we want to make certain that everyone understands that there is no warranty for this free library. If the library is modified by someone else and passed on, we want its recipients to know that what they have is not the original version, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that companies distributing free software will individually obtain patent licenses, thus in effect transforming the program into proprietary software. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. Most GNU software, including some libraries, is covered by the ordinary GNU General Public License, which was designed for utility programs. This license, the GNU Library General Public License, applies to certain designated libraries. This license is quite different from the ordinary one; be sure to read it in full, and don't assume that anything in it is the same as in the ordinary license. The reason we have a separate public license for some libraries is that they blur the distinction we usually make between modifying or adding to a program and simply using it. Linking a program with a library, without changing the library, is in some sense simply using the library, and is analogous to running a utility program or application program. However, in a textual and legal sense, the linked executable is a combined work, a derivative of the original library, and the ordinary General Public License treats it as such. Because of this blurred distinction, using the ordinary General Public License for libraries did not effectively promote software sharing, because most developers did not use the libraries. We concluded that weaker conditions might promote sharing better. However, unrestricted linking of non-free programs would deprive the users of those programs of all benefit from the free status of the libraries themselves. This Library General Public License is intended to permit developers of non-free programs to use free libraries, while preserving your freedom as a user of such programs to change the free libraries that are incorporated in them. (We have not seen how to achieve this as regards changes in header files, but we have achieved it as regards changes in the actual functions of the Library.) The hope is that this will lead to faster development of free libraries. The precise terms and conditions for copying, distribution and modification follow. Pay close attention to the difference between a "work based on the library" and a "work that uses the library". The former contains code derived from the library, while the latter only works together with the library. Note that it is possible for a library to be covered by the ordinary General Public License rather than by this special one. GNU LIBRARY GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License Agreement applies to any software library which contains a notice placed by the copyright holder or other authorized party saying it may be distributed under the terms of this Library General Public License (also called "this License"). Each licensee is addressed as "you". A "library" means a collection of software functions and/or data prepared so as to be conveniently linked with application programs (which use some of those functions and data) to form executables. The "Library", below, refers to any such software library or work which has been distributed under these terms. A "work based on the Library" means either the Library or any derivative work under copyright law: that is to say, a work containing the Library or a portion of it, either verbatim or with modifications and/or translated straightforwardly into another language. (Hereinafter, translation is included without limitation in the term "modification".) "Source code" for a work means the preferred form of the work for making modifications to it. For a library, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the library. Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running a program using the Library is not restricted, and output from such a program is covered only if its contents constitute a work based on the Library (independent of the use of the Library in a tool for writing it). Whether that is true depends on what the Library does and what the program that uses the Library does. 1. You may copy and distribute verbatim copies of the Library's complete source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and distribute a copy of this License along with the Library. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Library or any portion of it, thus forming a work based on the Library, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) The modified work must itself be a software library. b) You must cause the files modified to carry prominent notices stating that you changed the files and the date of any change. c) You must cause the whole of the work to be licensed at no charge to all third parties under the terms of this License. d) If a facility in the modified Library refers to a function or a table of data to be supplied by an application program that uses the facility, other than as an argument passed when the facility is invoked, then you must make a good faith effort to ensure that, in the event an application does not supply such function or table, the facility still operates, and performs whatever part of its purpose remains meaningful. (For example, a function in a library to compute square roots has a purpose that is entirely well-defined independent of the application. Therefore, Subsection 2d requires that any application-supplied function or table used by this function must be optional: if the application does not supply it, the square root function must still compute square roots.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Library, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Library, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Library. In addition, mere aggregation of another work not based on the Library with the Library (or with a work based on the Library) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may opt to apply the terms of the ordinary GNU General Public License instead of this License to a given copy of the Library. To do this, you must alter all the notices that refer to this License, so that they refer to the ordinary GNU General Public License, version 2, instead of to this License. (If a newer version than version 2 of the ordinary GNU General Public License has appeared, then you can specify that version instead if you wish.) Do not make any other change in these notices. Once this change is made in a given copy, it is irreversible for that copy, so the ordinary GNU General Public License applies to all subsequent copies and derivative works made from that copy. This option is useful when you wish to copy part of the code of the Library into a program that is not a library. 4. You may copy and distribute the Library (or a portion or derivative of it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange. If distribution of object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place satisfies the requirement to distribute the source code, even though third parties are not compelled to copy the source along with the object code. 5. A program that contains no derivative of any portion of the Library, but is designed to work with the Library by being compiled or linked with it, is called a "work that uses the Library". Such a work, in isolation, is not a derivative work of the Library, and therefore falls outside the scope of this License. However, linking a "work that uses the Library" with the Library creates an executable that is a derivative of the Library (because it contains portions of the Library), rather than a "work that uses the library". The executable is therefore covered by this License. Section 6 states terms for distribution of such executables. When a "work that uses the Library" uses material from a header file that is part of the Library, the object code for the work may be a derivative work of the Library even though the source code is not. Whether this is true is especially significant if the work can be linked without the Library, or if the work is itself a library. The threshold for this to be true is not precisely defined by law. If such an object file uses only numerical parameters, data structure layouts and accessors, and small macros and small inline functions (ten lines or less in length), then the use of the object file is unrestricted, regardless of whether it is legally a derivative work. (Executables containing this object code plus portions of the Library will still fall under Section 6.) Otherwise, if the work is a derivative of the Library, you may distribute the object code for the work under the terms of Section 6. Any executables containing that work also fall under Section 6, whether or not they are linked directly with the Library itself. 6. As an exception to the Sections above, you may also compile or link a "work that uses the Library" with the Library to produce a work containing portions of the Library, and distribute that work under terms of your choice, provided that the terms permit modification of the work for the customer's own use and reverse engineering for debugging such modifications. You must give prominent notice with each copy of the work that the Library is used in it and that the Library and its use are covered by this License. You must supply a copy of this License. If the work during execution displays copyright notices, you must include the copyright notice for the Library among them, as well as a reference directing the user to the copy of this License. Also, you must do one of these things: a) Accompany the work with the complete corresponding machine-readable source code for the Library including whatever changes were used in the work (which must be distributed under Sections 1 and 2 above); and, if the work is an executable linked with the Library, with the complete machine-readable "work that uses the Library", as object code and/or source code, so that the user can modify the Library and then relink to produce a modified executable containing the modified Library. (It is understood that the user who changes the contents of definitions files in the Library will not necessarily be able to recompile the application to use the modified definitions.) b) Accompany the work with a written offer, valid for at least three years, to give the same user the materials specified in Subsection 6a, above, for a charge no more than the cost of performing this distribution. c) If distribution of the work is made by offering access to copy from a designated place, offer equivalent access to copy the above specified materials from the same place. d) Verify that the user has already received a copy of these materials or that you have already sent this user a copy. For an executable, the required form of the "work that uses the Library" must include any data and utility programs needed for reproducing the executable from it. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. It may happen that this requirement contradicts the license restrictions of other proprietary libraries that do not normally accompany the operating system. Such a contradiction means you cannot use both them and the Library together in an executable that you distribute. 7. You may place library facilities that are a work based on the Library side-by-side in a single library together with other library facilities not covered by this License, and distribute such a combined library, provided that the separate distribution of the work based on the Library and of the other library facilities is otherwise permitted, and provided that you do these two things: a) Accompany the combined library with a copy of the same work based on the Library, uncombined with any other library facilities. This must be distributed under the terms of the Sections above. b) Give prominent notice with the combined library of the fact that part of it is a work based on the Library, and explaining where to find the accompanying uncombined form of the same work. 8. You may not copy, modify, sublicense, link with, or distribute the Library except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense, link with, or distribute the Library is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 9. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Library or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Library (or any work based on the Library), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Library or works based on it. 10. Each time you redistribute the Library (or any work based on the Library), the recipient automatically receives a license from the original licensor to copy, distribute, link with or modify the Library subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 11. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Library at all. For example, if a patent license would not permit royalty-free redistribution of the Library by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Library. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply, and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 12. If the distribution and/or use of the Library is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Library under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 13. The Free Software Foundation may publish revised and/or new versions of the Library General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Library specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Library does not specify a license version number, you may choose any version ever published by the Free Software Foundation. 14. If you wish to incorporate parts of the Library into other free programs whose distribution conditions are incompatible with these, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Libraries If you develop a new library, and you want it to be of the greatest possible use to the public, we recommend making it free software that everyone can redistribute and change. You can do so by permitting redistribution under these terms (or, alternatively, under the terms of the ordinary General Public License). To apply these terms, attach the following notices to the library. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This library is free software; you can redistribute it and/or modify it under the terms of the GNU Library General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA Also add information on how to contact you by electronic and paper mail. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the library, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the library `Frob' (a library for tweaking knobs) written by James Random Hacker. , 1 April 1990 Ty Coon, President of Vice That's all there is to it! avfs-1.1.4/patch/0000755000175000001440000000000014032341025010542 500000000000000avfs-1.1.4/patch/virtual-2.4.1.patch0000644000175000001440000002011214032341001013617 00000000000000diff -ruN /tmp/linux/fs/namei.c linux/fs/namei.c --- /tmp/linux/fs/namei.c Fri Dec 29 23:07:23 2000 +++ linux/fs/namei.c Tue Jan 30 16:02:37 2001 @@ -99,6 +99,9 @@ * XEmacs seems to be relying on it... */ +/* lookup function for "virtual" files */ +struct dentry *(*lookup_virtual)(struct nameidata *, struct dentry *); + /* In order to reduce some races, while at the same time doing additional * checking and hopefully speeding things up, we copy filenames to the * kernel data space before using them.. @@ -265,9 +268,10 @@ * make sure that nobody added the entry to the dcache in the meantime.. * SMP-safe */ -static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, int flags) +static struct dentry * real_lookup(struct nameidata * nd, struct qstr * name, int flags) { struct dentry * result; + struct dentry *parent = nd->dentry; struct inode *dir = parent->d_inode; down(&dir->i_sem); @@ -286,12 +290,24 @@ lock_kernel(); result = dir->i_op->lookup(dir, dentry); unlock_kernel(); - if (result) + if (result) { dput(dentry); - else + up(&dir->i_sem); + } + else { + up(&dir->i_sem); result = dentry; - } - up(&dir->i_sem); + /* + * If the dentry is negative it might + * refer to a 'virtual' file + */ + if (lookup_virtual && !dentry->d_inode) + lookup_virtual(nd, dentry); + } + } + else + up(&dir->i_sem); + return result; } @@ -494,7 +510,7 @@ /* This does the actual lookups.. */ dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE); if (!dentry) { - dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE); + dentry = real_lookup(nd, &this, LOOKUP_CONTINUE); err = PTR_ERR(dentry); if (IS_ERR(dentry)) break; @@ -557,7 +573,7 @@ } dentry = cached_lookup(nd->dentry, &this, 0); if (!dentry) { - dentry = real_lookup(nd->dentry, &this, 0); + dentry = real_lookup(nd, &this, 0); err = PTR_ERR(dentry); if (IS_ERR(dentry)) break; diff -ruN /tmp/linux/fs/super.c linux/fs/super.c --- /tmp/linux/fs/super.c Tue Jan 30 15:57:40 2001 +++ linux/fs/super.c Tue Jan 30 16:02:37 2001 @@ -47,7 +47,7 @@ * unmounting a filesystem and re-mounting it (or something * else). */ -static DECLARE_MUTEX(mount_sem); +DECLARE_MUTEX(mount_sem); extern void wait_for_keypress(void); @@ -304,9 +304,10 @@ * support for such beasts we'll have to change prototype. */ -static struct vfsmount *add_vfsmnt(struct nameidata *nd, - struct dentry *root, - const char *dev_name) +struct vfsmount *add_vfsmnt(struct nameidata *nd, + struct dentry *root, + const char *dev_name, + struct mount_operations *mnt_op) { struct vfsmount *mnt; struct super_block *sb = root->d_inode->i_sb; @@ -331,6 +332,7 @@ mnt->mnt_owner = current->uid; atomic_set(&mnt->mnt_count,1); mnt->mnt_sb = sb; + mnt->mnt_op = mnt_op; spin_lock(&dcache_lock); if (nd && !IS_ROOT(nd->dentry) && d_unhashed(nd->dentry)) @@ -418,6 +420,8 @@ list_del(&mnt->mnt_child); spin_unlock(&dcache_lock); /* Now we can work safely */ + if(mnt->mnt_op && mnt->mnt_op->release) + mnt->mnt_op->release(mnt); if (mnt->mnt_parent != mnt) mntput(mnt->mnt_parent); @@ -980,7 +984,7 @@ put_unnamed_dev(dev); return ERR_PTR(-EINVAL); } - mnt = add_vfsmnt(NULL, sb->s_root, NULL); + mnt = add_vfsmnt(NULL, sb->s_root, NULL, NULL); if (!mnt) { kill_super(sb, 0); return ERR_PTR(-ENOMEM); @@ -1011,7 +1015,23 @@ return 0; } -static int do_umount(struct vfsmount *mnt, int umount_root, int flags) +static void try_umount_children(struct vfsmount *mnt) +{ + struct list_head *next, *curr; + struct vfsmount *child; + + /* The mount list is protected by mount_sem */ + curr = mnt->mnt_mounts.next; + while(curr != &mnt->mnt_mounts) { + next = curr->next; + child = list_entry(curr, struct vfsmount, mnt_child); + if(child->mnt_op && child->mnt_op->umount) + child->mnt_op->umount(child); + curr = next; + } +} + +int do_umount(struct vfsmount *mnt, int umount_root, int flags) { struct super_block * sb = mnt->mnt_sb; @@ -1034,6 +1054,9 @@ return do_remount("/", MS_RDONLY, NULL); } + /* umount any automatic mounts */ + try_umount_children(mnt); + spin_lock(&dcache_lock); if (mnt->mnt_instances.next != mnt->mnt_instances.prev) { @@ -1211,7 +1234,7 @@ down(&new_nd.dentry->d_inode->i_zombie); if (IS_DEADDIR(new_nd.dentry->d_inode)) err = -ENOENT; - else if (add_vfsmnt(&new_nd, old_nd.dentry, old_nd.mnt->mnt_devname)) + else if (add_vfsmnt(&new_nd, old_nd.dentry, old_nd.mnt->mnt_devname, NULL)) err = 0; up(&new_nd.dentry->d_inode->i_zombie); up(&mount_sem); @@ -1396,7 +1419,7 @@ down(&nd.dentry->d_inode->i_zombie); if (!IS_DEADDIR(nd.dentry->d_inode)) { retval = -ENOMEM; - mnt = add_vfsmnt(&nd, sb->s_root, dev_name); + mnt = add_vfsmnt(&nd, sb->s_root, dev_name, NULL); } up(&nd.dentry->d_inode->i_zombie); if (!mnt) @@ -1601,10 +1624,10 @@ devfs_mk_symlink (NULL, "root", DEVFS_FL_DEFAULT, path + 5 + path_start, NULL, NULL); memcpy (path + path_start, "/dev/", 5); - vfsmnt = add_vfsmnt(NULL, sb->s_root, path + path_start); + vfsmnt = add_vfsmnt(NULL, sb->s_root, path + path_start, NULL); } else - vfsmnt = add_vfsmnt(NULL, sb->s_root, "/dev/root"); + vfsmnt = add_vfsmnt(NULL, sb->s_root, "/dev/root", NULL); /* FIXME: if something will try to umount us right now... */ if (vfsmnt) { set_fs_root(current->fs, vfsmnt, sb->s_root); diff -ruN /tmp/linux/include/linux/fs.h linux/include/linux/fs.h --- /tmp/linux/include/linux/fs.h Tue Jan 30 15:57:42 2001 +++ linux/include/linux/fs.h Tue Jan 30 16:02:37 2001 @@ -886,6 +886,10 @@ extern void kern_umount(struct vfsmount *); extern int may_umount(struct vfsmount *); extern long do_mount(char *, char *, char *, unsigned long, void *); +extern struct vfsmount *add_vfsmnt(struct nameidata *nd, struct dentry *root, + const char *dev_name, + struct mount_operations *mnt_op); +extern int do_umount(struct vfsmount *mnt, int umount_root, int flags); extern int vfs_statfs(struct super_block *, struct statfs *); @@ -1178,6 +1182,9 @@ /* needed for stackable file system support */ extern loff_t default_llseek(struct file *file, loff_t offset, int origin); + +/* lookup function for "virtual" files */ +extern struct dentry *(*lookup_virtual)(struct nameidata *, struct dentry *); extern int __user_walk(const char *, unsigned, struct nameidata *); extern int path_init(const char *, unsigned, struct nameidata *); diff -ruN /tmp/linux/include/linux/mount.h linux/include/linux/mount.h --- /tmp/linux/include/linux/mount.h Sun Sep 17 18:51:57 2000 +++ linux/include/linux/mount.h Tue Jan 30 16:02:37 2001 @@ -14,6 +14,8 @@ #define MNT_VISIBLE 1 +extern struct semaphore mount_sem; + struct vfsmount { struct dentry *mnt_mountpoint; /* dentry of mountpoint */ @@ -30,6 +32,20 @@ char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ struct list_head mnt_list; uid_t mnt_owner; + struct mount_operations *mnt_op; /* Operations on vfsmount */ +}; + +/* + * Mount operations: + * release(node) - called when this node has been umounted + * umount(node) - called when the parent is being umounted + * + * mount_sem is held in all + */ + +struct mount_operations { + void (*release) (struct vfsmount *); + void (*umount) (struct vfsmount *); }; static inline struct vfsmount *mntget(struct vfsmount *mnt) diff -ruN /tmp/linux/kernel/ksyms.c linux/kernel/ksyms.c --- /tmp/linux/kernel/ksyms.c Tue Jan 30 15:57:42 2001 +++ linux/kernel/ksyms.c Tue Jan 30 16:02:37 2001 @@ -262,6 +262,9 @@ EXPORT_SYMBOL(filemap_sync); EXPORT_SYMBOL(lock_page); +/* lookup function for "virtual" files */ +EXPORT_SYMBOL(lookup_virtual); + /* device registration */ EXPORT_SYMBOL(register_chrdev); EXPORT_SYMBOL(unregister_chrdev); @@ -314,6 +317,9 @@ EXPORT_SYMBOL(kern_mount); EXPORT_SYMBOL(kern_umount); EXPORT_SYMBOL(may_umount); +EXPORT_SYMBOL(add_vfsmnt); +EXPORT_SYMBOL(do_umount); +EXPORT_SYMBOL(mount_sem); /* executable format registration */ EXPORT_SYMBOL(register_binfmt); avfs-1.1.4/patch/virtual-2.4.0-test10.patch0000644000175000001440000002016114032341001014740 00000000000000diff -ru /tmp/linux/linux/fs/namei.c linux/fs/namei.c --- /tmp/linux/linux/fs/namei.c Fri Sep 22 23:21:18 2000 +++ linux/fs/namei.c Thu Nov 2 10:23:25 2000 @@ -99,6 +99,9 @@ * XEmacs seems to be relying on it... */ +/* lookup function for "virtual" files */ +struct dentry *(*lookup_virtual)(struct nameidata *, struct dentry *); + /* In order to reduce some races, while at the same time doing additional * checking and hopefully speeding things up, we copy filenames to the * kernel data space before using them.. @@ -261,9 +264,10 @@ * make sure that nobody added the entry to the dcache in the meantime.. * SMP-safe */ -static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, int flags) +static struct dentry * real_lookup(struct nameidata * nd, struct qstr * name, int flags) { struct dentry * result; + struct dentry *parent = nd->dentry; struct inode *dir = parent->d_inode; down(&dir->i_sem); @@ -282,12 +286,24 @@ lock_kernel(); result = dir->i_op->lookup(dir, dentry); unlock_kernel(); - if (result) + if (result) { dput(dentry); - else + up(&dir->i_sem); + } + else { + up(&dir->i_sem); result = dentry; - } - up(&dir->i_sem); + /* + * If the dentry is negative it might + * refer to a 'virtual' file + */ + if (lookup_virtual && !dentry->d_inode) + lookup_virtual(nd, dentry); + } + } + else + up(&dir->i_sem); + return result; } @@ -490,7 +506,7 @@ /* This does the actual lookups.. */ dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE); if (!dentry) { - dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE); + dentry = real_lookup(nd, &this, LOOKUP_CONTINUE); err = PTR_ERR(dentry); if (IS_ERR(dentry)) break; @@ -553,7 +569,7 @@ } dentry = cached_lookup(nd->dentry, &this, 0); if (!dentry) { - dentry = real_lookup(nd->dentry, &this, 0); + dentry = real_lookup(nd, &this, 0); err = PTR_ERR(dentry); if (IS_ERR(dentry)) break; diff -ru /tmp/linux/linux/fs/super.c linux/fs/super.c --- /tmp/linux/linux/fs/super.c Mon Oct 16 21:57:59 2000 +++ linux/fs/super.c Thu Nov 2 10:23:25 2000 @@ -47,7 +47,7 @@ * unmounting a filesystem and re-mounting it (or something * else). */ -static DECLARE_MUTEX(mount_sem); +DECLARE_MUTEX(mount_sem); extern void wait_for_keypress(void); @@ -303,9 +303,10 @@ * support for such beasts we'll have to change prototype. */ -static struct vfsmount *add_vfsmnt(struct nameidata *nd, - struct dentry *root, - const char *dev_name) +struct vfsmount *add_vfsmnt(struct nameidata *nd, + struct dentry *root, + const char *dev_name, + struct mount_operations *mnt_op) { struct vfsmount *mnt; struct super_block *sb = root->d_inode->i_sb; @@ -330,6 +331,7 @@ mnt->mnt_owner = current->uid; atomic_set(&mnt->mnt_count,1); mnt->mnt_sb = sb; + mnt->mnt_op = mnt_op; spin_lock(&dcache_lock); if (nd && !IS_ROOT(nd->dentry) && d_unhashed(nd->dentry)) @@ -417,6 +419,8 @@ list_del(&mnt->mnt_child); spin_unlock(&dcache_lock); /* Now we can work safely */ + if(mnt->mnt_op && mnt->mnt_op->release) + mnt->mnt_op->release(mnt); if (mnt->mnt_parent != mnt) mntput(mnt->mnt_parent); @@ -979,7 +983,7 @@ put_unnamed_dev(dev); return ERR_PTR(-EINVAL); } - mnt = add_vfsmnt(NULL, sb->s_root, NULL); + mnt = add_vfsmnt(NULL, sb->s_root, NULL, NULL); if (!mnt) { kill_super(sb, 0); return ERR_PTR(-ENOMEM); @@ -1010,7 +1014,23 @@ return 0; } -static int do_umount(struct vfsmount *mnt, int umount_root, int flags) +static void try_umount_children(struct vfsmount *mnt) +{ + struct list_head *next, *curr; + struct vfsmount *child; + + /* The mount list is protected by mount_sem */ + curr = mnt->mnt_mounts.next; + while(curr != &mnt->mnt_mounts) { + next = curr->next; + child = list_entry(curr, struct vfsmount, mnt_child); + if(child->mnt_op && child->mnt_op->umount) + child->mnt_op->umount(child); + curr = next; + } +} + +int do_umount(struct vfsmount *mnt, int umount_root, int flags) { struct super_block * sb = mnt->mnt_sb; @@ -1036,6 +1056,9 @@ return retval; } + /* umount any automatic mounts */ + try_umount_children(mnt); + spin_lock(&dcache_lock); if (atomic_read(&mnt->mnt_count) > 2) { spin_unlock(&dcache_lock); @@ -1213,7 +1236,7 @@ down(&new_nd.dentry->d_inode->i_zombie); if (IS_DEADDIR(new_nd.dentry->d_inode)) err = -ENOENT; - else if (add_vfsmnt(&new_nd, old_nd.dentry, old_nd.mnt->mnt_devname)) + else if (add_vfsmnt(&new_nd, old_nd.dentry, old_nd.mnt->mnt_devname, NULL)) err = 0; up(&new_nd.dentry->d_inode->i_zombie); up(&mount_sem); @@ -1398,7 +1421,7 @@ down(&nd.dentry->d_inode->i_zombie); if (!IS_DEADDIR(nd.dentry->d_inode)) { retval = -ENOMEM; - mnt = add_vfsmnt(&nd, sb->s_root, dev_name); + mnt = add_vfsmnt(&nd, sb->s_root, dev_name, NULL); } up(&nd.dentry->d_inode->i_zombie); if (!mnt) @@ -1603,10 +1626,10 @@ devfs_mk_symlink (NULL, "root", DEVFS_FL_DEFAULT, path + 5 + path_start, NULL, NULL); memcpy (path + path_start, "/dev/", 5); - vfsmnt = add_vfsmnt(NULL, sb->s_root, path + path_start); + vfsmnt = add_vfsmnt(NULL, sb->s_root, path + path_start, NULL); } else - vfsmnt = add_vfsmnt(NULL, sb->s_root, "/dev/root"); + vfsmnt = add_vfsmnt(NULL, sb->s_root, "/dev/root", NULL); /* FIXME: if something will try to umount us right now... */ if (vfsmnt) { set_fs_root(current->fs, vfsmnt, sb->s_root); diff -ru /tmp/linux/linux/include/linux/fs.h linux/include/linux/fs.h --- /tmp/linux/linux/include/linux/fs.h Tue Oct 31 20:18:05 2000 +++ linux/include/linux/fs.h Thu Nov 2 10:23:25 2000 @@ -849,6 +849,10 @@ extern void kern_umount(struct vfsmount *); extern int may_umount(struct vfsmount *); extern long do_mount(char *, char *, char *, unsigned long, void *); +extern struct vfsmount *add_vfsmnt(struct nameidata *nd, struct dentry *root, + const char *dev_name, + struct mount_operations *mnt_op); +extern int do_umount(struct vfsmount *mnt, int umount_root, int flags); extern int vfs_statfs(struct super_block *, struct statfs *); @@ -1124,6 +1128,9 @@ /* needed for stackable file system support */ extern loff_t default_llseek(struct file *file, loff_t offset, int origin); + +/* lookup function for "virtual" files */ +extern struct dentry *(*lookup_virtual)(struct nameidata *, struct dentry *); extern int __user_walk(const char *, unsigned, struct nameidata *); extern int path_init(const char *, unsigned, struct nameidata *); diff -ru /tmp/linux/linux/include/linux/mount.h linux/include/linux/mount.h --- /tmp/linux/linux/include/linux/mount.h Sun Sep 17 18:51:57 2000 +++ linux/include/linux/mount.h Thu Nov 2 10:23:25 2000 @@ -14,6 +14,8 @@ #define MNT_VISIBLE 1 +extern struct semaphore mount_sem; + struct vfsmount { struct dentry *mnt_mountpoint; /* dentry of mountpoint */ @@ -30,6 +32,20 @@ char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ struct list_head mnt_list; uid_t mnt_owner; + struct mount_operations *mnt_op; /* Operations on vfsmount */ +}; + +/* + * Mount operations: + * release(node) - called when this node has been umounted + * umount(node) - called when the parent is being umounted + * + * mount_sem is held in all + */ + +struct mount_operations { + void (*release) (struct vfsmount *); + void (*umount) (struct vfsmount *); }; static inline struct vfsmount *mntget(struct vfsmount *mnt) diff -ru /tmp/linux/linux/kernel/ksyms.c linux/kernel/ksyms.c --- /tmp/linux/linux/kernel/ksyms.c Mon Oct 30 19:50:27 2000 +++ linux/kernel/ksyms.c Thu Nov 2 10:23:25 2000 @@ -270,6 +270,9 @@ EXPORT_SYMBOL(filemap_sync); EXPORT_SYMBOL(lock_page); +/* lookup function for "virtual" files */ +EXPORT_SYMBOL(lookup_virtual); + /* device registration */ EXPORT_SYMBOL(register_chrdev); EXPORT_SYMBOL(unregister_chrdev); @@ -322,6 +325,9 @@ EXPORT_SYMBOL(kern_mount); EXPORT_SYMBOL(kern_umount); EXPORT_SYMBOL(may_umount); +EXPORT_SYMBOL(add_vfsmnt); +EXPORT_SYMBOL(do_umount); +EXPORT_SYMBOL(mount_sem); /* executable format registration */ EXPORT_SYMBOL(register_binfmt); avfs-1.1.4/patch/Makefile.in0000644000175000001440000003071614032341013012533 00000000000000# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = patch ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BZLIB_INCLUDE = @BZLIB_INCLUDE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAV = @DAV@ DAV_LS = @DAV_LS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FUSELIBS = @FUSELIBS@ GREP = @GREP@ HAVE_ZIPINFO = @HAVE_ZIPINFO@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ LIBZSTD_LIBS = @LIBZSTD_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NUMVERSION = @NUMVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ ZIP = @ZIP@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_INCLUDE = @ZLIB_INCLUDE@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = \ virtual-2.4.0-test10.patch \ virtual-2.4.0.patch \ virtual-2.4.1.patch all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu patch/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu patch/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: avfs-1.1.4/patch/Makefile.am0000644000175000001440000000013114032341001012503 00000000000000EXTRA_DIST = \ virtual-2.4.0-test10.patch \ virtual-2.4.0.patch \ virtual-2.4.1.patch avfs-1.1.4/patch/virtual-2.4.0.patch0000644000175000001440000002047114032341001013626 00000000000000diff -ru /tmp/linux/linux-2.4.0.tar.bz2@/linux/fs/namei.c linux/fs/namei.c --- /tmp/linux/linux-2.4.0.tar.bz2@/linux/fs/namei.c Fri Dec 29 23:07:23 2000 +++ linux/fs/namei.c Wed Jan 10 10:04:21 2001 @@ -99,6 +99,9 @@ * XEmacs seems to be relying on it... */ +/* lookup function for "virtual" files */ +struct dentry *(*lookup_virtual)(struct nameidata *, struct dentry *); + /* In order to reduce some races, while at the same time doing additional * checking and hopefully speeding things up, we copy filenames to the * kernel data space before using them.. @@ -265,9 +268,10 @@ * make sure that nobody added the entry to the dcache in the meantime.. * SMP-safe */ -static struct dentry * real_lookup(struct dentry * parent, struct qstr * name, int flags) +static struct dentry * real_lookup(struct nameidata * nd, struct qstr * name, int flags) { struct dentry * result; + struct dentry *parent = nd->dentry; struct inode *dir = parent->d_inode; down(&dir->i_sem); @@ -286,12 +290,24 @@ lock_kernel(); result = dir->i_op->lookup(dir, dentry); unlock_kernel(); - if (result) + if (result) { dput(dentry); - else + up(&dir->i_sem); + } + else { + up(&dir->i_sem); result = dentry; - } - up(&dir->i_sem); + /* + * If the dentry is negative it might + * refer to a 'virtual' file + */ + if (lookup_virtual && !dentry->d_inode) + lookup_virtual(nd, dentry); + } + } + else + up(&dir->i_sem); + return result; } @@ -494,7 +510,7 @@ /* This does the actual lookups.. */ dentry = cached_lookup(nd->dentry, &this, LOOKUP_CONTINUE); if (!dentry) { - dentry = real_lookup(nd->dentry, &this, LOOKUP_CONTINUE); + dentry = real_lookup(nd, &this, LOOKUP_CONTINUE); err = PTR_ERR(dentry); if (IS_ERR(dentry)) break; @@ -557,7 +573,7 @@ } dentry = cached_lookup(nd->dentry, &this, 0); if (!dentry) { - dentry = real_lookup(nd->dentry, &this, 0); + dentry = real_lookup(nd, &this, 0); err = PTR_ERR(dentry); if (IS_ERR(dentry)) break; diff -ru /tmp/linux/linux-2.4.0.tar.bz2@/linux/fs/super.c linux/fs/super.c --- /tmp/linux/linux-2.4.0.tar.bz2@/linux/fs/super.c Fri Dec 29 23:18:42 2000 +++ linux/fs/super.c Wed Jan 10 10:04:21 2001 @@ -47,7 +47,7 @@ * unmounting a filesystem and re-mounting it (or something * else). */ -static DECLARE_MUTEX(mount_sem); +DECLARE_MUTEX(mount_sem); extern void wait_for_keypress(void); @@ -303,9 +303,10 @@ * support for such beasts we'll have to change prototype. */ -static struct vfsmount *add_vfsmnt(struct nameidata *nd, - struct dentry *root, - const char *dev_name) +struct vfsmount *add_vfsmnt(struct nameidata *nd, + struct dentry *root, + const char *dev_name, + struct mount_operations *mnt_op) { struct vfsmount *mnt; struct super_block *sb = root->d_inode->i_sb; @@ -330,6 +331,7 @@ mnt->mnt_owner = current->uid; atomic_set(&mnt->mnt_count,1); mnt->mnt_sb = sb; + mnt->mnt_op = mnt_op; spin_lock(&dcache_lock); if (nd && !IS_ROOT(nd->dentry) && d_unhashed(nd->dentry)) @@ -417,6 +419,8 @@ list_del(&mnt->mnt_child); spin_unlock(&dcache_lock); /* Now we can work safely */ + if(mnt->mnt_op && mnt->mnt_op->release) + mnt->mnt_op->release(mnt); if (mnt->mnt_parent != mnt) mntput(mnt->mnt_parent); @@ -979,7 +983,7 @@ put_unnamed_dev(dev); return ERR_PTR(-EINVAL); } - mnt = add_vfsmnt(NULL, sb->s_root, NULL); + mnt = add_vfsmnt(NULL, sb->s_root, NULL, NULL); if (!mnt) { kill_super(sb, 0); return ERR_PTR(-ENOMEM); @@ -1010,7 +1014,23 @@ return 0; } -static int do_umount(struct vfsmount *mnt, int umount_root, int flags) +static void try_umount_children(struct vfsmount *mnt) +{ + struct list_head *next, *curr; + struct vfsmount *child; + + /* The mount list is protected by mount_sem */ + curr = mnt->mnt_mounts.next; + while(curr != &mnt->mnt_mounts) { + next = curr->next; + child = list_entry(curr, struct vfsmount, mnt_child); + if(child->mnt_op && child->mnt_op->umount) + child->mnt_op->umount(child); + curr = next; + } +} + +int do_umount(struct vfsmount *mnt, int umount_root, int flags) { struct super_block * sb = mnt->mnt_sb; @@ -1036,6 +1056,9 @@ return retval; } + /* umount any automatic mounts */ + try_umount_children(mnt); + spin_lock(&dcache_lock); if (mnt->mnt_instances.next != mnt->mnt_instances.prev) { @@ -1213,7 +1236,7 @@ down(&new_nd.dentry->d_inode->i_zombie); if (IS_DEADDIR(new_nd.dentry->d_inode)) err = -ENOENT; - else if (add_vfsmnt(&new_nd, old_nd.dentry, old_nd.mnt->mnt_devname)) + else if (add_vfsmnt(&new_nd, old_nd.dentry, old_nd.mnt->mnt_devname, NULL)) err = 0; up(&new_nd.dentry->d_inode->i_zombie); up(&mount_sem); @@ -1398,7 +1421,7 @@ down(&nd.dentry->d_inode->i_zombie); if (!IS_DEADDIR(nd.dentry->d_inode)) { retval = -ENOMEM; - mnt = add_vfsmnt(&nd, sb->s_root, dev_name); + mnt = add_vfsmnt(&nd, sb->s_root, dev_name, NULL); } up(&nd.dentry->d_inode->i_zombie); if (!mnt) @@ -1603,10 +1626,10 @@ devfs_mk_symlink (NULL, "root", DEVFS_FL_DEFAULT, path + 5 + path_start, NULL, NULL); memcpy (path + path_start, "/dev/", 5); - vfsmnt = add_vfsmnt(NULL, sb->s_root, path + path_start); + vfsmnt = add_vfsmnt(NULL, sb->s_root, path + path_start, NULL); } else - vfsmnt = add_vfsmnt(NULL, sb->s_root, "/dev/root"); + vfsmnt = add_vfsmnt(NULL, sb->s_root, "/dev/root", NULL); /* FIXME: if something will try to umount us right now... */ if (vfsmnt) { set_fs_root(current->fs, vfsmnt, sb->s_root); diff -ru /tmp/linux/linux-2.4.0.tar.bz2@/linux/include/linux/fs.h linux/include/linux/fs.h --- /tmp/linux/linux-2.4.0.tar.bz2@/linux/include/linux/fs.h Thu Jan 4 23:50:47 2001 +++ linux/include/linux/fs.h Wed Jan 10 10:04:21 2001 @@ -874,6 +874,10 @@ extern void kern_umount(struct vfsmount *); extern int may_umount(struct vfsmount *); extern long do_mount(char *, char *, char *, unsigned long, void *); +extern struct vfsmount *add_vfsmnt(struct nameidata *nd, struct dentry *root, + const char *dev_name, + struct mount_operations *mnt_op); +extern int do_umount(struct vfsmount *mnt, int umount_root, int flags); extern int vfs_statfs(struct super_block *, struct statfs *); @@ -1163,6 +1167,9 @@ /* needed for stackable file system support */ extern loff_t default_llseek(struct file *file, loff_t offset, int origin); + +/* lookup function for "virtual" files */ +extern struct dentry *(*lookup_virtual)(struct nameidata *, struct dentry *); extern int __user_walk(const char *, unsigned, struct nameidata *); extern int path_init(const char *, unsigned, struct nameidata *); diff -ru /tmp/linux/linux-2.4.0.tar.bz2@/linux/include/linux/mount.h linux/include/linux/mount.h --- /tmp/linux/linux-2.4.0.tar.bz2@/linux/include/linux/mount.h Sun Sep 17 18:51:57 2000 +++ linux/include/linux/mount.h Wed Jan 10 10:04:21 2001 @@ -14,6 +14,8 @@ #define MNT_VISIBLE 1 +extern struct semaphore mount_sem; + struct vfsmount { struct dentry *mnt_mountpoint; /* dentry of mountpoint */ @@ -30,6 +32,20 @@ char *mnt_devname; /* Name of device e.g. /dev/dsk/hda1 */ struct list_head mnt_list; uid_t mnt_owner; + struct mount_operations *mnt_op; /* Operations on vfsmount */ +}; + +/* + * Mount operations: + * release(node) - called when this node has been umounted + * umount(node) - called when the parent is being umounted + * + * mount_sem is held in all + */ + +struct mount_operations { + void (*release) (struct vfsmount *); + void (*umount) (struct vfsmount *); }; static inline struct vfsmount *mntget(struct vfsmount *mnt) diff -ru /tmp/linux/linux-2.4.0.tar.bz2@/linux/kernel/ksyms.c linux/kernel/ksyms.c --- /tmp/linux/linux-2.4.0.tar.bz2@/linux/kernel/ksyms.c Wed Jan 3 01:45:37 2001 +++ linux/kernel/ksyms.c Wed Jan 10 10:04:21 2001 @@ -261,6 +261,9 @@ EXPORT_SYMBOL(filemap_sync); EXPORT_SYMBOL(lock_page); +/* lookup function for "virtual" files */ +EXPORT_SYMBOL(lookup_virtual); + /* device registration */ EXPORT_SYMBOL(register_chrdev); EXPORT_SYMBOL(unregister_chrdev); @@ -313,6 +316,9 @@ EXPORT_SYMBOL(kern_mount); EXPORT_SYMBOL(kern_umount); EXPORT_SYMBOL(may_umount); +EXPORT_SYMBOL(add_vfsmnt); +EXPORT_SYMBOL(do_umount); +EXPORT_SYMBOL(mount_sem); /* executable format registration */ EXPORT_SYMBOL(register_binfmt); avfs-1.1.4/TODO0000644000175000001440000000100514032341001010041 00000000000000Write support for: - ftp - floppy - dav - ugz - ubz2 - utar Flush file caches uzip - symlinks ucpio - builtin option for uzip, not to convert filenames to lowercase automatic handler detection based on extension AND content Redir should support operations: - open(..., O_CREAT, ...) - creat - truncate - utime - chmod - chown - lchown - unlink - rmdir - mkdir - mknod - symlink - rename - link Redir can't support following symlinks to virtual files. Find better solution avfs-1.1.4/spec/0000755000175000001440000000000014032341025010375 500000000000000avfs-1.1.4/spec/Makefile.in0000644000175000001440000003062014032341013012360 00000000000000# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = spec ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BZLIB_INCLUDE = @BZLIB_INCLUDE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAV = @DAV@ DAV_LS = @DAV_LS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FUSELIBS = @FUSELIBS@ GREP = @GREP@ HAVE_ZIPINFO = @HAVE_ZIPINFO@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ LIBZSTD_LIBS = @LIBZSTD_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NUMVERSION = @NUMVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ ZIP = @ZIP@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_INCLUDE = @ZLIB_INCLUDE@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = avfsfuse-fc6.spec all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu spec/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu spec/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: avfs-1.1.4/spec/Makefile.am0000644000175000001440000000003714032341001012343 00000000000000EXTRA_DIST = avfsfuse-fc6.spec avfs-1.1.4/spec/avfsfuse-fc6.spec0000644000175000001440000000336514032341001013470 00000000000000%define avfs_version 0.9.8 Summary: A Virtual File System Name: avfsfuse Version: %{avfs_version} Release: 1 License: LGPL Group: System Environment/Daemons URL: http://www.inf.bme.hu/~mszeredi/avfs Source0: avfs-%{version}.tar.bz2 # Patch0: sizefix.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root %description AVFS is a system, which enables all programs to look inside gzip, tar, zip, ... files, without recompiling the programs or changing the kernel. It also has capability of mounting remote directories by ftp and ssh, and remote documents by http. An implementation of extfs allows browsing of installed rpms etc. %prep %setup -q -n avfs-%{version} # avfs extfs needs the size to be correct # %patch0 -p1 %build aclocal -I macros && autoconf && automake ./configure --enable-fuse --enable-dav --enable-libxml make %install rm -rf $RPM_BUILD_ROOT make prefix="$RPM_BUILD_ROOT/usr" install %clean rm -rf "$RPM_BUILD_ROOT" %pre if test "$1" -gt 1; then for t in `sed -n -e 's/avfsd \([^ ]*\).*/\1/p' /etc/mtab`; do /usr/bin/fusermount -u "$t" done fi %preun if test "$1" -gt 1; then for t in `sed -n -e 's/avfsd \([^ ]*\).*/\1/p' /etc/mtab`; do /usr/bin/fusermount -u "$t" done fi %files %defattr(-,root,root,-) %doc README doc/README.avfs-fuse doc/INSTALL.fuse COPYING COPYING.LIB doc/FORMAT NEWS TODO %dir /usr/lib/avfs %dir /usr/lib/avfs/extfs /usr/bin/avfsd /usr/bin/avfs-config /usr/bin/ftppass /usr/bin/davpass /usr/bin/mountavfs /usr/bin/umountavfs /usr/lib/libavfs.a /usr/lib/libavfs.la /usr/lib/libavfs.so /usr/lib/libavfs.so.0 /usr/lib/libavfs.so.0.0.1 /usr/lib/avfs/extfs/* /usr/include/avfs.h /usr/include/virtual.h %changelog * Sat Feb 10 2007 Tanmoy Bhattacharya - 0.9.7 - Initial build. avfs-1.1.4/include/0000755000175000001440000000000014032341025011066 500000000000000avfs-1.1.4/include/passwords.h0000644000175000001440000000310614032341001013176 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #ifndef INCLUDED_PASSWORDS_H #define INCLUDED_PASSWORDS_H 1 #include "avfs.h" #include "state.h" #define USER_SEP_STR "@" #define USER_SEP_CHAR (USER_SEP_STR[0]) /** * Note: FTP uses "user@host" or just "user@" for the account key, * since the username is passed in as part of the path. In the FTP * case the "username" member in this struct can be left NULL. * * HTTP/DAV uses "realm@host" or just "@host", and stores the username * as well as the password in this struct. */ struct pass_session { char *account; char *username; char *password; struct pass_session *next; struct pass_session *prev; }; /* these two are only needed for HTTP (see comment above) */ extern int pass_username_get(struct entry *ent, const char *param, char **resp); extern int pass_username_set(struct entry *ent, const char *param, const char *val); extern int pass_password_get(struct entry *ent, const char *param, char **resp); extern int pass_password_set(struct entry *ent, const char *param, const char *val); extern int pass_loggedin_get(struct entry *ent, const char *param, char **resp); extern int pass_loggedin_set(struct entry *ent, const char *param, const char *val); struct pass_session *pass_get_password(struct pass_session *passd, const char *host, const char *user); void pass_remove_session(struct pass_session *fts); #endif /* INCLUDED_PASSWORDS_H */ avfs-1.1.4/include/state.h0000644000175000001440000000105514032341001012272 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" #include "namespace.h" struct statefile { void *data; int (*get) (struct entry *ent, const char *param, char **resp); int (*set) (struct entry *ent, const char *param, const char *val); }; int av_state_new(struct vmodule *module, const char *name, struct namespace **resp, struct avfs **avfsp); avfs-1.1.4/include/virtual.h0000644000175000001440000000445014032341001012642 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-1999 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #ifndef _VIRTUAL_H #define _VIRTUAL_H #include #include #include #include /* some fs functions which still need virtual equivalents: fchdir, statfs, sync */ int virt_stat (const char *path, struct stat *buf); int virt_lstat (const char *path, struct stat *buf); int virt_access (const char *path, int amode); int virt_readlink (const char *path, char *buf, size_t bsiz); int virt_truncate (const char *path, off_t length); int virt_utime (const char *path, struct utimbuf *buf); int virt_chmod (const char *path, mode_t mode); int virt_chown (const char *path, uid_t owner, gid_t grp); int virt_lchown (const char *path, uid_t owner, gid_t grp); int virt_unlink (const char *path); int virt_rmdir (const char *path); int virt_mkdir (const char *path, mode_t mode); int virt_mknod (const char *path, mode_t mode, dev_t dev); int virt_symlink (const char *path, const char *newpath); int virt_rename (const char *path, const char *newpath); int virt_link (const char *path, const char *newpath); int virt_fstat (int fh, struct stat *buf); int virt_ftruncate (int fh, off_t length); int virt_fchmod (int fh, mode_t mode); int virt_fchown (int fh, uid_t owner, gid_t grp); int virt_open (const char *path, int flags, mode_t mode); int virt_close (int fh); ssize_t virt_read (int fh, void *buf, size_t nbyte); ssize_t virt_write (int fh, const void *buf, size_t nbyte); off_t virt_lseek (int fh, off_t offset, int whence); DIR *virt_opendir (const char *path); int virt_closedir (DIR *dirp); struct dirent *virt_readdir (DIR *dirp); void virt_rewinddir (DIR *dirp); int virt_remove (const char *path); int virt_islocal (const char *path); #endif /* _VIRTUAL_H */ avfs-1.1.4/include/archive.h0000644000175000001440000000355114032341001012576 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" #include "namespace.h" struct archive; struct archnode; struct archfile; #define ARF_NOBASE (1 << 0) struct archparams { void *data; int flags; int (*parse) (void *data, ventry *ent, struct archive *arch); int (*open) (ventry *ve, struct archfile *fil); int (*close) (struct archfile *fil); avssize_t (*read) (vfile *vf, char *buf, avsize_t nbyte); void (*release) (struct archive *arch, struct archnode *nod); }; #define ANOF_DIRTY (1 << 0) #define ANOF_CREATED (1 << 1) #define ANOF_AUTODIR (1 << 2) struct archnode { struct avstat st; char *linkname; int flags; avoff_t offset; avoff_t realsize; int numopen; void *data; }; struct archfile { vfile *basefile; struct archive *arch; struct archnode *nod; struct entry *ent; /* Only for readdir */ struct entry *curr; int currn; void *data; }; int av_archive_init(const char *name, struct ext_info *exts, int version, struct vmodule *module, struct avfs **avfsp); avssize_t av_arch_read(vfile *vf, char *buf, avsize_t nbyte); struct archnode *av_arch_new_node(struct archive *arch, struct entry *ent, int isdir); void av_arch_del_node(struct entry *ent); struct entry *av_arch_resolve(struct archive *arch, const char *path, int create, int flags); int av_arch_isroot(struct archive *arch, struct entry *ent); struct entry *av_arch_create(struct archive *arch, const char *path, int flags); static inline struct archfile *arch_vfile_file(vfile *vf) { return (struct archfile *) vf->data; } avfs-1.1.4/include/zfile.h0000644000175000001440000000140514032341001012262 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" struct zfile; struct zcache; avssize_t av_zfile_pread(struct zfile *fil, struct zcache *zc, char *buf, avsize_t nbyte, avoff_t offset); int av_zfile_size(struct zfile *fil, struct zcache *zc, avoff_t *sizep); enum av_zfile_data_type { AV_ZFILE_DATA_PLAIN, AV_ZFILE_DATA_GZIP_ENCAPSULATED }; struct zfile *av_zfile_new(vfile *vf, avoff_t dataoff, avuint crc, enum av_zfile_data_type data_type); struct zcache *av_zcache_new(); avoff_t av_zcache_size(struct zcache *zc); avfs-1.1.4/include/socket.h0000644000175000001440000000040614032341001012441 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ int av_sock_connect(const char *name, int defaultport); avfs-1.1.4/include/runprog.h0000644000175000001440000000116314032341001012646 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ struct program; int av_start_program(const char **prog, struct program **resp); int av_program_getline(struct program *pr, char **linep, long timeoutms); int av_program_log_output(struct program *pr); int av_run_program(const char **prog); /* av_program_getline() will return: 1 and *linep != NULL -- success 1 and *linep == NULL -- eof 0 -- timeout < 0 -- error */ avfs-1.1.4/include/exit.h0000644000175000001440000000036214032341001012123 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ void av_add_exithandler(void (*func)()); avfs-1.1.4/include/oper.h0000644000175000001440000000255014032341001012120 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" int av_open(ventry *ve, int flags, avmode_t mode, vfile **retp); int av_close(vfile *vf); avssize_t av_read(vfile *vf, char *buf, avsize_t nbyte); avssize_t av_write(vfile *vf, const char *buf, avsize_t nbyte); avssize_t av_pread(vfile *vf, char *buf, avsize_t nbyte, avoff_t offset); avssize_t av_pwrite(vfile *vf, const char *buf, avsize_t nbyte, avoff_t offset); avoff_t av_lseek(vfile *vf, avoff_t offset, int whence); int av_ftruncate(vfile *vf, avoff_t length); int av_getattr(ventry *ve, struct avstat *buf, int attrmask, int flags); int av_fgetattr(vfile *vf, struct avstat *buf, int attrmask); int av_fsetattr(vfile *vf, struct avstat *buf, int attrmask); int av_access(ventry *ve, int amode); int av_readlink(ventry *ve, char **bufp); int av_unlink(ventry *ve); int av_rmdir(ventry *ve); int av_mkdir(ventry *ve, avmode_t mode); int av_mknod(ventry *ve, avmode_t mode, avdev_t dev); int av_symlink(const char *path, ventry *newve); int av_rename(ventry *ve, ventry *newve); int av_link(ventry *ve, ventry *newve); avfs-1.1.4/include/ugid.h0000644000175000001440000000104714032341001012103 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ struct ugidcache; struct ugidcache *av_new_ugidcache(); char *av_finduname(struct ugidcache *cache, int uid, const char *deflt); int av_finduid(struct ugidcache *cache, const char *uname, int deflt); char *av_findgname(struct ugidcache *cache, int gid, const char *deflt); int av_findgid(struct ugidcache *cache, const char *gname, int deflt); avfs-1.1.4/include/tmpfile.h0000644000175000001440000000051014032341001012605 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2006 Ralf Hoffmann (ralf@boomerangsworld.de) This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #ifndef _AVFS_TMPFILE_H #define _AVFS_TMPFILE_H #include "avfs.h" avoff_t av_tmpfile_blksize(const char *tmpf); #endif avfs-1.1.4/include/filecache.h0000644000175000001440000000056014032341001013055 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" void *av_filecache_get(const char *key); void av_filecache_set(const char *key, void *obj); int av_filecache_getkey(ventry *ve, char **resp); avfs-1.1.4/include/namespace.h0000644000175000001440000000232514032341001013107 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #define NSF_NOCASE (1 << 0) /* for case-insensitive key comparisons */ struct namespace; struct entry; struct namespace *av_namespace_new(); struct entry *av_namespace_lookup(struct namespace *ns, struct entry *parent, const char *name); struct entry *av_namespace_lookup_all(struct namespace *ns, struct entry *prev, const char *name); struct entry *av_namespace_resolve(struct namespace *ns, const char *path); char *av_namespace_getpath(struct entry *ent); void av_namespace_set(struct entry *ent, void *data); void *av_namespace_get(struct entry *ent); char *av_namespace_name(struct entry *ent); struct entry *av_namespace_next(struct entry *ent); struct entry *av_namespace_subdir(struct namespace *ns, struct entry *ent); struct entry *av_namespace_parent(struct entry *ent); void av_namespace_setflags(struct entry *ent, int setflags, int resetflags); struct entry *av_namespace_nth(struct namespace *ns, struct entry *parent, unsigned int n); avfs-1.1.4/include/Makefile.in0000644000175000001440000004466714032341013013071 00000000000000# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @USE_LIBLZMA_TRUE@am__append_1 = xzfile.h @USE_LIBZSTD_TRUE@am__append_2 = zstdfile.h @USE_LIBLZIP_TRUE@am__append_3 = lzipfile.h subdir = include ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__include_HEADERS_DIST) \ $(am__noinst_HEADERS_DIST) $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = config.h CONFIG_CLEAN_FILES = version.h CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__include_HEADERS_DIST = avfs.h virtual.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(includedir)" am__noinst_HEADERS_DIST = archive.h bzfile.h cache.h exit.h filebuf.h \ filecache.h filter.h internal.h namespace.h oper.h operutil.h \ parsels.h passwords.h prog.h realfile.h remote.h runprog.h \ serialfile.h socket.h state.h tmpfile.h ugid.h zfile.h avfs.h \ virtual.h xzfile.h zstdfile.h lzipfile.h HEADERS = $(include_HEADERS) $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/version.h.in \ $(top_srcdir)/config.h.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BZLIB_INCLUDE = @BZLIB_INCLUDE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAV = @DAV@ DAV_LS = @DAV_LS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FUSELIBS = @FUSELIBS@ GREP = @GREP@ HAVE_ZIPINFO = @HAVE_ZIPINFO@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ LIBZSTD_LIBS = @LIBZSTD_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NUMVERSION = @NUMVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ ZIP = @ZIP@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_INCLUDE = @ZLIB_INCLUDE@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @BUILD_SHARED_FALSE@include_HEADERS = avfs.h @BUILD_SHARED_TRUE@include_HEADERS = avfs.h virtual.h noinst_HEADERS = archive.h bzfile.h cache.h exit.h filebuf.h \ filecache.h filter.h internal.h namespace.h oper.h operutil.h \ parsels.h passwords.h prog.h realfile.h remote.h runprog.h \ serialfile.h socket.h state.h tmpfile.h ugid.h zfile.h avfs.h \ virtual.h $(am__append_1) $(am__append_2) $(am__append_3) BUILT_SOURCES = version.h all: $(BUILT_SOURCES) config.h $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu include/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu include/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): config.h: stamp-h1 @test -f $@ || rm -f stamp-h1 @test -f $@ || $(MAKE) $(AM_MAKEFLAGS) stamp-h1 stamp-h1: $(top_srcdir)/config.h.in $(top_builddir)/config.status @rm -f stamp-h1 cd $(top_builddir) && $(SHELL) ./config.status include/config.h $(top_srcdir)/config.h.in: $(am__configure_deps) ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) rm -f stamp-h1 touch $@ distclean-hdr: -rm -f config.h stamp-h1 version.h: $(top_builddir)/config.status $(srcdir)/version.h.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-includeHEADERS: $(include_HEADERS) @$(NORMAL_INSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \ $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \ $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \ done uninstall-includeHEADERS: @$(NORMAL_UNINSTALL) @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir) ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(HEADERS) config.h installdirs: for dir in "$(DESTDIR)$(includedir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic distclean-hdr distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-includeHEADERS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-includeHEADERS .MAKE: all check install install-am install-exec install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool cscopelist-am ctags ctags-am distclean \ distclean-generic distclean-hdr distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-includeHEADERS install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am uninstall-includeHEADERS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: avfs-1.1.4/include/filebuf.h0000644000175000001440000000176014032341001012571 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" #define FILEBUF_NONBLOCK (1 << 0) #define FILEBUF_WRITE (1 << 1) struct filebuf; struct filebuf *av_filebuf_new(int fd, int flags); int av_filebuf_eof(struct filebuf *fb); int av_filebuf_check(struct filebuf *fbs[], unsigned int numfbs, long timeoutms); int av_filebuf_readline(struct filebuf *fb, char **linep); int av_filebuf_getline(struct filebuf *fb, char **linep, long timeoutms); avssize_t av_filebuf_read(struct filebuf *fb, char *buf, avsize_t nbytes); avssize_t av_filebuf_write(struct filebuf *fb, const char *buf, avsize_t nbytes); /* av_filebuf_getline() will return: 1 and *linep != NULL -- success 1 and *linep == NULL -- eof 0 -- timeout < 0 -- read error */ avfs-1.1.4/include/zstdfile.h0000644000175000001440000000112314032341001012772 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2018 Ralf Hoffmann This program can be distributed under the terms of the GNU GPL. See the file COPYING. based on bzfile.h */ #include "avfs.h" struct zstdfile; struct zstdcache; avssize_t av_zstdfile_pread(struct zstdfile *fil, struct zstdcache *zc, char *buf, avsize_t nbyte, avoff_t offset); struct zstdfile *av_zstdfile_new(vfile *vf); int av_zstdfile_size(struct zstdfile *fil, struct zstdcache *zc, avoff_t *sizep); struct zstdcache *av_zstdcache_new(); avfs-1.1.4/include/avfs.h0000644000175000001440000002350014032341001012110 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #ifndef _AVFS_H #define _AVFS_H #include #include #include #include /* The following 3 includes are not needed except for some * systems which redefine open to open64 etc. (namely Sun) */ #include #include #include #ifndef __GNUC__ #define __attribute__(x) #endif typedef unsigned char avbyte; /* 1 byte unsigned */ typedef unsigned short avushort; /* 2 bytes unsigned */ typedef unsigned int avuint; /* 4 bytes unsigned */ typedef unsigned long avulong; /* 4-8 bytes unsigned */ typedef long long avquad; /* 8 bytes signed */ typedef unsigned long long avuquad; /* 8 bytes unsigned */ typedef avuquad avdev_t; typedef avuint avmode_t; typedef avuint avnlink_t; typedef avuint avuid_t; typedef avuint avgid_t; typedef avuquad avino_t; typedef avquad avoff_t; typedef long avtime_t; typedef avuint avsize_t; typedef int avssize_t; typedef avulong avblksize_t; typedef avquad avblkcnt_t; typedef pthread_mutex_t avmutex; typedef struct _avtimestruc_t avtimestruc_t; struct _avtimestruc_t { avtime_t sec; long nsec; }; struct avstat { avdev_t dev; avino_t ino; avmode_t mode; avnlink_t nlink; avuid_t uid; avgid_t gid; avdev_t rdev; avoff_t size; avblksize_t blksize; avblkcnt_t blocks; avtimestruc_t atime; avtimestruc_t mtime; avtimestruc_t ctime; }; struct avdirent { avino_t ino; int type; char *name; }; typedef struct _ventry ventry; struct _ventry { void *data; struct avmount *mnt; }; typedef struct _vfile vfile; struct _vfile { void *data; struct avmount *mnt; int flags; avoff_t ptr; avmutex lock; }; struct avmount { ventry *base; struct avfs *avfs; char *opts; int flags; }; struct avfs { /* private */ struct vmodule *module; avmutex lock; avino_t inoctr; /* read-only: */ char *name; struct ext_info *exts; void *data; int version; int flags; avdev_t dev; void (*destroy) (struct avfs *avfs); int (*lookup) (ventry *ve, const char *name, void **retp); void (*putent) (ventry *ve); int (*copyent) (ventry *ve, void **retp); int (*getpath) (ventry *ve, char **retp); int (*access) (ventry *ve, int amode); int (*readlink)(ventry *ve, char **bufp); int (*symlink) (const char *path, ventry *newve); int (*unlink) (ventry *ve); int (*rmdir) (ventry *ve); int (*mknod) (ventry *ve, avmode_t mode, avdev_t dev); int (*mkdir) (ventry *ve, avmode_t mode); int (*rename) (ventry *ve, ventry *newve); int (*link) (ventry *ve, ventry *newve); int (*open) (ventry *ve, int flags, avmode_t mode, void **retp); int (*close) (vfile *vf); avssize_t (*read) (vfile *vf, char *buf, avsize_t nbyte); avssize_t (*write) (vfile *vf, const char *buf, avsize_t nbyte); int (*readdir) (vfile *vf, struct avdirent *buf); int (*getattr) (vfile *vf, struct avstat *buf, int attrmask); int (*setattr) (vfile *vf, struct avstat *buf, int attrmask); int (*truncate)(vfile *vf, avoff_t length); avoff_t (*lseek) (vfile *vf, avoff_t offset, int whence); }; struct ext_info { const char *from; const char *to; }; struct avtm { int sec; /* [0-59] (note: 61 _can_ happen) */ int min; /* [0-59] */ int hour; /* [0-23] */ int day; /* [1-31] */ int mon; /* [0-11] */ int year; /* Year - 1900 */ }; typedef struct { char *name; int is_tmp; } real_file; typedef struct { int outfd; ventry *ve; } rep_file; #define AV_NEW(ptr) ptr = av_calloc(sizeof(*(ptr))) #define AV_NEW_OBJ(ptr, destr) \ ptr = av_new_obj(sizeof(*(ptr)), (void (*)(void *)) destr) #define AV_LOCK_DECL(mutex) avmutex mutex #define AV_INITLOCK(mutex) pthread_mutex_init(&(mutex), NULL) #define AV_INIT_RECURSIVELOCK(mutex) { pthread_mutexattr_t attr; \ pthread_mutexattr_init(&attr); \ if (pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE) != 0) { \ av_log(AVLOG_ERROR, "Couldn't init recursive mutex"); \ exit(1); \ } \ if (pthread_mutex_init(&(mutex), &attr) != 0) { \ av_log(AVLOG_ERROR, "Couldn't init recursive mutex"); \ exit(1); \ } \ pthread_mutexattr_destroy(&attr);} #define AV_FREELOCK(mutex) pthread_mutex_destroy(&(mutex)); #define AV_LOCK(mutex) pthread_mutex_lock(&(mutex)) #define AV_UNLOCK(mutex) pthread_mutex_unlock(&(mutex)) #define AV_INIT_EXT(e, f, t) (e).from = (f), (e).to = (t) #define AV_MAX(x, y) ((x) > (y) ? (x) : (y)) #define AV_MIN(x, y) ((x) < (y) ? (x) : (y)) #define AV_DIV(x, y) ((x) ? (((x) - 1) / (y) + 1) : 0) #define AV_TIME_LESS(t1, t2) ((t1).sec < (t2).sec || \ ((t1).sec == (t2).sec && (t1).nsec < (t2).nsec)) #define AV_TIME_EQ(t1, t2) ((t1).sec == (t2).sec && (t1).nsec == (t2).nsec) #define AV_BLOCKS(x) AV_DIV(x, 512) #define AV_MAXTIME (~(1L << (sizeof(avtime_t) * 8 - 1))) #define AV_MAXOFF 0x7FFFFFFFFFFFFFFFLL #define AV_DIR_SEP_CHAR '/' #define AV_DIR_SEP_STR "/" #ifndef NULL #define NULL ((void *) 0) #endif #define AVSEEK_SET 0 #define AVSEEK_CUR 1 #define AVSEEK_END 2 #define AVR_OK 4 #define AVW_OK 2 #define AVX_OK 1 #define AVF_OK 0 #define AVO_ACCMODE 0x03 #define AVO_RDONLY 0 #define AVO_WRONLY 1 #define AVO_RDWR 2 #define AVO_NOPERM 3 #define AV_ISWRITE(flags) ((flags & AVO_ACCMODE) == AVO_WRONLY || \ (flags & AVO_ACCMODE) == AVO_RDWR) #define AVO_CREAT 0x00000040 #define AVO_EXCL 0x00000080 #define AVO_TRUNC 0x00000200 #define AVO_APPEND 0x00000400 #define AVO_NONBLOCK 0x00000800 #define AVO_SYNC 0x00001000 #define AVO_DIRECTORY 0x00010000 #define AVO_NOFOLLOW 0x00020000 #define AVA_DEV (1 << 0) #define AVA_INO (1 << 1) #define AVA_MODE (1 << 2) #define AVA_NLINK (1 << 3) #define AVA_UID (1 << 4) #define AVA_GID (1 << 5) #define AVA_RDEV (1 << 6) #define AVA_SIZE (1 << 7) #define AVA_BLKSIZE (1 << 8) #define AVA_BLKCNT (1 << 9) #define AVA_ATIME (1 << 10) #define AVA_MTIME (1 << 11) #define AVA_CTIME (1 << 12) #define AVA_ALL 0x00001fff #define AV_IFMT 0170000 #define AV_IFDIR 0040000 #define AV_IFCHR 0020000 #define AV_IFBLK 0060000 #define AV_IFREG 0100000 #define AV_IFIFO 0010000 #define AV_IFLNK 0120000 #define AV_IFSOCK 0140000 #define AV_ISVTX 01000 #define AV_ISGID 02000 #define AV_ISUID 04000 #define AV_ISTYPE(mode, mask) (((mode) & AV_IFMT) == (mask)) #define AV_ISDIR(mode) AV_ISTYPE((mode), AV_IFDIR) #define AV_ISCHR(mode) AV_ISTYPE((mode), AV_IFCHR) #define AV_ISBLK(mode) AV_ISTYPE((mode), AV_IFBLK) #define AV_ISREG(mode) AV_ISTYPE((mode), AV_IFREG) #define AV_ISFIFO(mode) AV_ISTYPE((mode), AV_IFIFO) #define AV_ISLNK(mode) AV_ISTYPE((mode), AV_IFLNK) #define AV_ISSOCK(mode) AV_ISTYPE((mode), AV_IFSOCK) #define AV_TYPE(mode) (((mode) & AV_IFMT) >> 12) #define AVLOG_ERROR 001 #define AVLOG_WARNING 002 #define AVLOG_DEBUG 004 #define AVLOG_SYSCALL 010 #define AVF_NEEDSLASH (1 << 0) #define AVF_ONLYROOT (1 << 1) #define AVF_NOLOCK (1 << 2) int av_new_avfs(const char *name, struct ext_info *exts, int version, int flags, struct vmodule *module, struct avfs **retp); void av_add_avfs(struct avfs *avfs); avino_t av_new_ino(struct avfs *avfs); int av_check_version(const char *modname, const char *name, int version, int need_ver, int provide_ver); int av_copy_ventry(ventry *ve, ventry **retp); void av_free_ventry(ventry *ve); int av_generate_path(ventry *ve, char **pathp); avdev_t av_mkdev(int major, int minor); void av_splitdev(avdev_t dev, int *majorp, int *minorp); void av_default_stat(struct avstat *stbuf); void av_log(int level, const char *format, ...) __attribute__ ((format (printf, 2, 3))); char *av_get_config(const char *param); void *av_malloc(avsize_t nbyte); void *av_calloc(avsize_t nbyte); void *av_realloc(void *ptr, avsize_t nbyte); void av_free(void *ptr); void *av_new_obj(avsize_t nbyte, void (*destr)(void *)); void av_ref_obj(void *obj); void av_unref_obj(void *obj); void av_obj_set_ref_lock(void *obj, avmutex *lock); void av_obj_set_destr_locked(void *obj, void (*destr)(void *)); char *av_strdup(const char *s); char *av_strndup(const char *s, avsize_t len); char *av_stradd(char *s1, ...); void av_registerfd(int fd); void av_curr_time(avtimestruc_t *tim); avtime_t av_time(); void av_sleep(unsigned long msec); avtime_t av_mktime(struct avtm *tp); void av_localtime(avtime_t t, struct avtm *tp); int av_get_tmpfile(char **retp); void av_del_tmpfile(char *tmpfile); avoff_t av_tmp_free(); avssize_t av_read_all(vfile *vf, char *buf, avsize_t nbyte); avssize_t av_pread_all(vfile *vf, char *buf, avsize_t nbyte, avoff_t offset); #endif /* _AVFS_H */ avfs-1.1.4/include/cache.h0000644000175000001440000000211014032341001012206 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi Copyright (C) 2006 Ralf Hoffmann (ralf@boomerangsworld.de) This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" struct cacheobj; void av_cache_checkspace(); void av_cache_diskfull(); /** * cache V1 interface using external cache objects * The object created by _new is not referenced by the cache * itself so the user has to take care of this. The object * is required to access to object stored in the cache. */ struct cacheobj *av_cacheobj_new(void *obj, const char *name); void *av_cacheobj_get(struct cacheobj *cobj); void av_cacheobj_setsize(struct cacheobj *cobj, avoff_t diskusage); /** * cache V2 interface using internal cache objects * The interface doesn't returns the cache object storing * the obj. The name is used to access the object. */ int av_cache2_set(void *obj, const char *name); void *av_cache2_get(const char *name); void av_cache2_setsize(const char *name, avoff_t diskusage); avfs-1.1.4/include/realfile.h0000644000175000001440000000051714032341001012737 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" struct realfile { char *name; int is_tmp; }; int av_get_realfile(ventry *ve, struct realfile **resp); avfs-1.1.4/include/serialfile.h0000644000175000001440000000215514032341001013273 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" #define SFILE_NOCACHE (1 << 0) struct sfilefuncs { int (*startget) (void *data, void **resp); avssize_t (*read) (void *data, char *buf, avsize_t nbyte); int (*startput) (void *data, void **resp); avssize_t (*write) (void *data, const char *buf, avsize_t nbyte); int (*endput) (void *data); }; struct sfile; struct sfile *av_sfile_new(const struct sfilefuncs *func, void *data, int flags); avssize_t av_sfile_pread(struct sfile *fil, char *buf, avsize_t nbyte, avoff_t offset); avssize_t av_sfile_pwrite(struct sfile *fil, const char *buf, avsize_t nbyte, avoff_t offset); avoff_t av_sfile_size(struct sfile *fil); int av_sfile_truncate(struct sfile *fil, avoff_t length); int av_sfile_startget(struct sfile *fil); int av_sfile_flush(struct sfile *fil); void *av_sfile_getdata(struct sfile *fil); avoff_t av_sfile_diskusage(struct sfile *fil); avfs-1.1.4/include/operutil.h0000644000175000001440000000277114032341001013023 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" int av_file_open(vfile *vf, ventry *ve, int flags, avmode_t mode); int av_file_close(vfile *vf); avssize_t av_file_read(vfile *vf, char *buf, avsize_t nbyte); avssize_t av_file_pread(vfile *vf, char *buf, avsize_t nbyte, avoff_t offset); avssize_t av_file_write(vfile *vf, const char *buf, avsize_t nbyte); avssize_t av_file_pwrite(vfile *vf, const char *buf, avsize_t nbyte, avoff_t offset); int av_file_truncate(vfile *vf, avoff_t length); int av_file_getattr(vfile *vf, struct avstat *buf, int attrmask); int av_file_setattr(vfile *vf, struct avstat *buf, int attrmask); avoff_t av_file_lseek(vfile *vf, avoff_t offset, int whence); int av_open(ventry *ve, int flags, avmode_t mode, vfile **resp); int av_close(vfile *vf); int av_fd_open_entry(ventry *ve, int flags, avmode_t mode); int av_fd_open(const char *path, int flags, avmode_t mode); int av_fd_close(int fd); avssize_t av_fd_read(int fd, void *buf, avsize_t nbyte); avssize_t av_fd_write(int fd, const char *buf, avsize_t nbyte); avoff_t av_fd_lseek(int fd, avoff_t offset, int whence); int av_fd_readdir(int fd, struct avdirent *buf, avoff_t *posp); int av_fd_getattr(int fd, struct avstat *buf, int attrmask); int av_fd_setattr(int fd, struct avstat *buf, int attrmask); int av_fd_truncate(int fd, avoff_t length); avfs-1.1.4/include/remote.h0000644000175000001440000000231614032341001012446 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" #define REM_LIST_SINGLE (1 << 0) #define REM_LIST_PARENT (1 << 1) struct remdirent { char *name; char *linkname; struct avstat attr; }; struct remhostpath { char *host; char *path; }; struct remdirlist { int flags; struct remhostpath hostpath; avsize_t num; struct remdirent *ents; }; struct remgetparam { struct remhostpath hostpath; char *localname; void *data; }; #define REM_DIR_ONLY (1 << 0) #define REM_NOCASE (1 << 1) struct remote { void *data; char *name; int flags; int (*list) (struct remote *rem, struct remdirlist *dl); int (*get) (struct remote *rem, struct remgetparam *gp); int (*wait) (struct remote *rem, void *data, avoff_t end); void (*destroy) (struct remote *rem); }; int av_remote_init(struct vmodule *module, struct remote *rem, struct avfs **resp); void av_remote_add(struct remdirlist *dl, const char *name, const char *linkname, struct avstat *attr); avfs-1.1.4/include/internal.h0000644000175000001440000000205414032341001012766 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-1999 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" #include "state.h" #define AVFS_SEP_CHAR '#' #define AVFS_SEP_STR "#" #define AVFS_LOCK(avfs) if(!(avfs->flags & AVF_NOLOCK)) AV_LOCK(avfs->lock) #define AVFS_UNLOCK(avfs) if(!(avfs->flags & AVF_NOLOCK)) AV_UNLOCK(avfs->lock) int av_get_ventry(const char *path, int resolvelast, ventry **retp); int av_copy_vmount(struct avmount *mnt, struct avmount **retp); void av_free_vmount(struct avmount *mnt); void av_default_avfs(struct avfs *avfs); void av_init_dynamic_modules(); void av_close_all_files(); void av_delete_tmpdir(); void av_init_avfsstat(); void av_init_logstat(); void av_init_cache(); void av_check_malloc(); void av_init_filecache(); void av_do_exit(); void av_avfsstat_register(const char *path, struct statefile *func); int av_get_symlink_rewrite(); int av_avfs_implements_readdir( const struct avfs *avfs ); avfs-1.1.4/include/Makefile.am0000644000175000001440000000143414032341001013036 00000000000000## Before Automake 1.8.1 the conditional include_HEADERS are not ## correctly added to the distribution ## Possible solution: Require Automake 1.8.1 ## Or (chosen here): Add both files to noinst_HEADERS if BUILD_SHARED include_HEADERS = avfs.h virtual.h else include_HEADERS = avfs.h endif noinst_HEADERS = archive.h \ bzfile.h \ cache.h \ exit.h \ filebuf.h \ filecache.h \ filter.h \ internal.h \ namespace.h \ oper.h \ operutil.h \ parsels.h \ passwords.h \ prog.h \ realfile.h \ remote.h \ runprog.h \ serialfile.h \ socket.h \ state.h \ tmpfile.h \ ugid.h \ zfile.h \ avfs.h \ virtual.h if USE_LIBLZMA noinst_HEADERS += xzfile.h endif if USE_LIBZSTD noinst_HEADERS += zstdfile.h endif if USE_LIBLZIP noinst_HEADERS += lzipfile.h endif BUILT_SOURCES = version.h avfs-1.1.4/include/version.h.in0000644000175000001440000000035214032341001013243 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #define AV_VER @NUMVERSION@ avfs-1.1.4/include/parsels.h0000644000175000001440000000063014032341001012621 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" struct lscache; struct lscache *av_new_lscache(); int av_parse_ls(struct lscache *cache,const char *line, struct avstat *stbuf, char **filename, char **linkname); avfs-1.1.4/include/lzipfile.h0000644000175000001440000000130414032341001012765 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2021 Ralf Hoffmann This program can be distributed under the terms of the GNU GPL. See the file COPYING. based on zstdfile.h */ #ifndef LZIPFILE_H #define LZIPFILE_H #include "avfs.h" struct lzipfile; struct lzipcache; avssize_t av_lzipfile_pread(struct lzipfile *fil, struct lzipcache *zc, char *buf, avsize_t nbyte, avoff_t offset); struct lzipfile *av_lzipfile_new(vfile *vf); int av_lzipfile_size(struct lzipfile *fil, struct lzipcache *zc, avoff_t *sizep); struct lzipcache *av_lzipcache_new(); avoff_t av_lzipcache_size(struct lzipcache *zc); #endif /* LZIPFILE_H */ avfs-1.1.4/include/xzfile.h0000644000175000001440000000107114032341001012451 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2010 Ralf Hoffmann This program can be distributed under the terms of the GNU GPL. See the file COPYING. based on bzfile.h */ #include "avfs.h" struct xzfile; struct xzcache; avssize_t av_xzfile_pread(struct xzfile *fil, struct xzcache *zc, char *buf, avsize_t nbyte, avoff_t offset); struct xzfile *av_xzfile_new(vfile *vf); int av_xzfile_size(struct xzfile *fil, struct xzcache *zc, avoff_t *sizep); struct xzcache *av_xzcache_new(); avfs-1.1.4/include/filter.h0000644000175000001440000000064314032341001012441 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" int av_init_filt(struct vmodule *module, int version, const char *name, const char *prog[], const char *revprog[], struct ext_info *exts, struct avfs **resp); avfs-1.1.4/include/bzfile.h0000644000175000001440000000104214032341001012421 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" struct bzfile; struct bzcache; avssize_t av_bzfile_pread(struct bzfile *fil, struct bzcache *zc, char *buf, avsize_t nbyte, avoff_t offset); struct bzfile *av_bzfile_new(vfile *vf); int av_bzfile_size(struct bzfile *fil, struct bzcache *zc, avoff_t *sizep); struct bzcache *av_bzcache_new(); avfs-1.1.4/include/prog.h0000644000175000001440000000100314032341001012112 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ struct proginfo { const char **prog; int ifd; int ofd; int efd; int pid; const char *wd; }; void av_init_proginfo(struct proginfo *pi); int av_start_prog(struct proginfo *pi); int av_wait_prog(struct proginfo *pi, int tokill, int check); avfs-1.1.4/scripts/0000755000175000001440000000000014032341025011132 500000000000000avfs-1.1.4/scripts/davpass0000755000175000001440000000256314032341001012441 00000000000000#! /bin/sh usage () { echo "davpass [-r 'realm'] [-h hostname] [-u username] [-p passwd]" 1>&2 exit 1 } while [ $# -gt 0 ] ; do case "x$1" in x-r ) realm="$2"; shift; continue ;; x-h ) host="$2"; shift; continue ;; x-u ) username="$2"; shift; continue ;; x-p ) passwd="$2"; shift; continue ;; * ) usage ;; esac shift done if test -r "$AVFSBASE/#avfsstat" ; then basedir="$AVFSBASE" elif test -r "$HOME/.avfs/#avfsstat" ; then basedir="$HOME/.avfs" elif test -r "/#avfsstat" ; then basedir= elif test -r "/overlay/#avfsstat" ; then basedir=/overlay else echo "AVFS not running" 1>&2 exit 1 fi ctrlc () { stty echo exit 127 } if [ "${host:-//UNSET//}" = //UNSET// ] ; then printf "Hostname: " read host < /dev/tty fi if [ "${realm:-//UNSET//}" = //UNSET// ] ; then printf "Realm (hit enter for any realm): " read realm < /dev/tty fi if [ "${username:-//UNSET//}" = //UNSET// ] ; then printf "Username: " read username < /dev/tty fi if [ "${passwd:-//UNSET//}" = //UNSET// ] ; then printf "Password: " trap ctrlc 2 3 15 stty -echo read passwd < /dev/tty stty echo fi echo acct="$host@$realm" if [ "$acct" = @ ] ; then usage; fi echo $username | cp /dev/stdin $basedir/#dav_ctl:$acct/username echo $passwd | cp /dev/stdin $basedir/#dav_ctl:$acct/password avfs-1.1.4/scripts/mountavfs0000755000175000001440000000141014032341001013010 00000000000000#!/bin/bash # mountavfs -- program to mount avfs file system # and load avfsd daemon. # companion program to umountavfs # will check to see if avfs is mounted and then # load the avfsd daemon which will mount avfs. # last updated 2010-09-12 # suggested use: in a login script or wm startup routine if [ -d "$AVFSBASE" ]; then MntDir="$AVFSBASE" else MntDir=${HOME}/.avfs fi grep -qE "avfsd ${MntDir}" /proc/mounts || { if [ ! -e "$MntDir" ]; then mkdir -p "$MntDir" fi if [ ! -d "$MntDir" ]; then echo "$MntDir exists but is no directory" exit 1 fi echo Mounting AVFS on $MntDir... avfsd "$MntDir" while test ! -e "$MntDir/#avfsstat/symlink_rewrite" do sleep 0.5 ; done echo "1" >| "$MntDir/#avfsstat/symlink_rewrite" } avfs-1.1.4/scripts/umountavfs0000644000175000001440000000110314032341001013171 00000000000000#!/bin/bash # umountavfs -- program to unmount avfs file system # and unload avfsd daemon. # companion program to mountavfs # will check to see if avfsd is mounted and then # unmount using fusermount. # last updated 2010-09-12 # suggested use: in a logout script or wm exit routine if [ -d "$AVFSBASE" ]; then MntDir="$AVFSBASE" else MntDir="${HOME}/.avfs" fi grep -qE "${MntDir}.*avfsd" /proc/mounts && { echo unMounting AVFS on $MntDir... if type -p fusermount > /dev/null 2>&1 ; then fusermount -u -z "$MntDir" else umount -l "$MntDir" fi } avfs-1.1.4/scripts/avfs-config.in0000644000175000001440000000223714032341001013602 00000000000000#!/bin/sh # based on glib-config prefix=@prefix@ exec_prefix=@exec_prefix@ exec_prefix_set=no usage() { cat <&2 fi while test $# -gt 0; do case "$1" in -*=*) optarg=`echo "$1" | sed 's/[-_a-zA-Z0-9]*=//'` ;; *) optarg= ;; esac case $1 in --prefix=*) prefix=$optarg if test $exec_prefix_set = no ; then exec_prefix=$optarg fi ;; --prefix) echo_prefix=yes ;; --exec-prefix=*) exec_prefix=$optarg exec_prefix_set=yes ;; --exec-prefix) echo_exec_prefix=yes ;; --version) echo @VERSION@ exit 0 ;; --cflags) echo_cflags=yes ;; --libs) echo_libs=yes ;; *) usage 1 1>&2 ;; esac shift done if test "$echo_prefix" = "yes"; then echo $prefix fi if test "$echo_exec_prefix" = "yes"; then echo $exec_prefix fi if test "$echo_cflags" = "yes"; then echo -I@includedir@ @CPPFLAGS@ fi if test "$echo_libs" = "yes"; then echo -L@libdir@ -lavfs fi avfs-1.1.4/scripts/ftppass0000755000175000001440000000134014032341001012450 00000000000000#! /bin/sh if test -z "$1" ; then echo "usage: $0 username@[hostname]" 1>&2 exit 1 fi userhost=$1 if test -r "$AVFSBASE/#avfsstat" ; then basedir="$AVFSBASE" elif test -r "$HOME/.avfs/#avfsstat" ; then basedir="$HOME/.avfs" elif test -r "/#avfsstat" ; then basedir= elif test -r "/overlay/#avfsstat" ; then basedir=/overlay else echo "AVFS not running" 1>&2 exit 1 fi ctrlc () { stty $oldsetting echo exit 127 } oldsetting=`stty -g` printf "Password: " trap ctrlc 2 3 15 stty -echo read passwd < /dev/tty stty $oldsetting echo echo $passwd | cp /dev/stdin $basedir/#ftp_ctl:$userhost/password if [ -e "$basedir/#ucftp_ctl" ]; then echo $passwd | cp /dev/stdin $basedir/#ucftp_ctl:$userhost/password fi avfs-1.1.4/scripts/Makefile.in0000644000175000001440000003673314032341013013130 00000000000000# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = scripts ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = avfs-config CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(bindir)" SCRIPTS = $(bin_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/avfs-config.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BZLIB_INCLUDE = @BZLIB_INCLUDE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAV = @DAV@ DAV_LS = @DAV_LS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FUSELIBS = @FUSELIBS@ GREP = @GREP@ HAVE_ZIPINFO = @HAVE_ZIPINFO@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ LIBZSTD_LIBS = @LIBZSTD_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NUMVERSION = @NUMVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ ZIP = @ZIP@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_INCLUDE = @ZLIB_INCLUDE@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = davpass ftppass mountavfs umountavfs bin_SCRIPTS = ftppass davpass @install_scriptcomps@ EXTRA_SCRIPTS = avfs-config all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu scripts/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu scripts/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): avfs-config: $(top_builddir)/config.status $(srcdir)/avfs-config.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-binSCRIPTS: $(bin_SCRIPTS) @$(NORMAL_INSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir) mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(SCRIPTS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binSCRIPTS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binSCRIPTS .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-binSCRIPTS install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \ uninstall-am uninstall-binSCRIPTS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: avfs-1.1.4/scripts/Makefile.am0000644000175000001440000000020314032341001013073 00000000000000EXTRA_DIST = davpass ftppass mountavfs umountavfs bin_SCRIPTS = ftppass davpass @install_scriptcomps@ EXTRA_SCRIPTS = avfs-config avfs-1.1.4/macros/0000755000175000001440000000000014032341025010727 500000000000000avfs-1.1.4/macros/pkg.m40000644000175000001440000001206314032341001011666 00000000000000# pkg.m4 - Macros to locate and utilise pkg-config. -*- Autoconf -*- # # Copyright © 2004 Scott James Remnant . # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # PKG_PROG_PKG_CONFIG([MIN-VERSION]) # ---------------------------------- AC_DEFUN([PKG_PROG_PKG_CONFIG], [m4_pattern_forbid([^_?PKG_[A-Z_]+$]) m4_pattern_allow([^PKG_CONFIG(_PATH)?$]) AC_ARG_VAR([PKG_CONFIG], [path to pkg-config utility])dnl if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then AC_PATH_TOOL([PKG_CONFIG], [pkg-config]) fi if test -n "$PKG_CONFIG"; then _pkg_min_version=m4_default([$1], [0.9.0]) AC_MSG_CHECKING([pkg-config is at least version $_pkg_min_version]) if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) PKG_CONFIG="" fi fi[]dnl ])# PKG_PROG_PKG_CONFIG # PKG_CHECK_EXISTS(MODULES, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND]) # # Check to see whether a particular set of modules exists. Similar # to PKG_CHECK_MODULES(), but does not set variables or print errors. # # # Similar to PKG_CHECK_MODULES, make sure that the first instance of # this or PKG_CHECK_MODULES is called, or make sure to call # PKG_CHECK_EXISTS manually # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_EXISTS], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl if test -n "$PKG_CONFIG" && \ AC_RUN_LOG([$PKG_CONFIG --exists --print-errors "$1"]); then m4_ifval([$2], [$2], [:]) m4_ifvaln([$3], [else $3])dnl fi]) # _PKG_CONFIG([VARIABLE], [COMMAND], [MODULES]) # --------------------------------------------- m4_define([_PKG_CONFIG], [if test -n "$$1"; then pkg_cv_[]$1="$$1" elif test -n "$PKG_CONFIG"; then PKG_CHECK_EXISTS([$3], [pkg_cv_[]$1=`$PKG_CONFIG --[]$2 "$3" 2>/dev/null`], [pkg_failed=yes]) else pkg_failed=untried fi[]dnl ])# _PKG_CONFIG # _PKG_SHORT_ERRORS_SUPPORTED # ----------------------------- AC_DEFUN([_PKG_SHORT_ERRORS_SUPPORTED], [AC_REQUIRE([PKG_PROG_PKG_CONFIG]) if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi[]dnl ])# _PKG_SHORT_ERRORS_SUPPORTED # PKG_CHECK_MODULES(VARIABLE-PREFIX, MODULES, [ACTION-IF-FOUND], # [ACTION-IF-NOT-FOUND]) # # # Note that if there is a possibility the first call to # PKG_CHECK_MODULES might not happen, you should be sure to include an # explicit call to PKG_PROG_PKG_CONFIG in your configure.ac # # # -------------------------------------------------------------- AC_DEFUN([PKG_CHECK_MODULES], [AC_REQUIRE([PKG_PROG_PKG_CONFIG])dnl AC_ARG_VAR([$1][_CFLAGS], [C compiler flags for $1, overriding pkg-config])dnl AC_ARG_VAR([$1][_LIBS], [linker flags for $1, overriding pkg-config])dnl pkg_failed=no AC_MSG_CHECKING([for $1]) _PKG_CONFIG([$1][_CFLAGS], [cflags], [$2]) _PKG_CONFIG([$1][_LIBS], [libs], [$2]) m4_define([_PKG_TEXT], [Alternatively, you may set the environment variables $1[]_CFLAGS and $1[]_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details.]) if test $pkg_failed = yes; then _PKG_SHORT_ERRORS_SUPPORTED if test $_pkg_short_errors_supported = yes; then $1[]_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "$2" 2>&1` else $1[]_PKG_ERRORS=`$PKG_CONFIG --print-errors "$2" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$$1[]_PKG_ERRORS" >&AS_MESSAGE_LOG_FD ifelse([$4], , [AC_MSG_ERROR(dnl [Package requirements ($2) were not met: $$1_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. _PKG_TEXT ])], [AC_MSG_RESULT([no]) $4]) elif test $pkg_failed = untried; then ifelse([$4], , [AC_MSG_FAILURE(dnl [The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. _PKG_TEXT To get pkg-config, see .])], [$4]) else $1[]_CFLAGS=$pkg_cv_[]$1[]_CFLAGS $1[]_LIBS=$pkg_cv_[]$1[]_LIBS AC_MSG_RESULT([yes]) ifelse([$3], , :, [$3]) fi[]dnl ])# PKG_CHECK_MODULES avfs-1.1.4/macros/ld-versionscript.m40000644000175000001440000000202514032341001014411 00000000000000# Copyright (C) 2005 Ralf Hoffmann # This file is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # See if the linker supports symbol versioning AC_DEFUN([CHECK_LD_VERSIONSCRIPT],[ AC_MSG_CHECKING([whether the linker ($LD) supports symbol versioning]) ld_versionscript=no if test "$ld_shlibs" = yes -a "$enable_shared" = yes; then if test "$with_gnu_ld" = yes; then if test -n "`$LD --help 2>/dev/null | grep version-script`"; then ld_versionscript=yes VERSIONSCRIPT_OPTS="-Wl,--version-script=\$(srcdir)/libavfs.map" fi else case $host_os in solaris*|sunos4*) if test -n "`$LD --help 2>&1 | grep "M mapfile"`"; then ld_versionscript=yes VERSIONSCRIPT_OPTS="-Wl,-M,\$(srcdir)/libavfs.map" fi ;; *) ;; esac fi fi AC_SUBST(VERSIONSCRIPT_OPTS) AC_MSG_RESULT([$ld_versionscript]) ]) avfs-1.1.4/macros/Makefile.in0000644000175000001440000003072514032341013012720 00000000000000# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = macros ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BZLIB_INCLUDE = @BZLIB_INCLUDE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAV = @DAV@ DAV_LS = @DAV_LS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FUSELIBS = @FUSELIBS@ GREP = @GREP@ HAVE_ZIPINFO = @HAVE_ZIPINFO@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ LIBZSTD_LIBS = @LIBZSTD_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NUMVERSION = @NUMVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ ZIP = @ZIP@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_INCLUDE = @ZLIB_INCLUDE@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = neon-ssl.m4 \ neon-xml-parser.m4 \ neon.m4 \ ld-versionscript.m4 \ extfs.m4 all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu macros/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu macros/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: avfs-1.1.4/macros/neon.m40000644000175000001440000002221514032341001012044 00000000000000# Copyright (C) 1998-2000 Joe Orton. # This file is free software; you may copy and/or distribute it with # or without modifications, as long as this notice is preserved. # This software is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY, to the extent permitted by law; without even # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR # PURPOSE. # The above license applies to THIS FILE ONLY, the neon library code # itself may be copied and distributed under the terms of the GNU # LGPL, see COPYING.LIB for more details # This file is part of the neon HTTP/WebDAV client library. # See http://www.webdav.org/neon/ for the latest version. # Please send any feedback to # # Usage: # # NEON_LIBRARY # or NEON_BUNDLED(srcdir, [ACTIONS-IF-BUNDLED]) # or NEON_VPATH_BUNDLED(srcdir, builddir, [ACTIONS-IF-BUNDLED]) # # where srcdir is the location of bundled neon 'src' directory. # If using a VPATH-enabled build, builddir is the location of the # build directory corresponding to srcdir. # # If a bundled build *is* being used, ACTIONS-IF-BUNDLED will be # evaluated. These actions should ensure that 'make' is run # in srcdir, and that one of NEON_NORMAL_BUILD or NEON_LIBTOOL_BUILD # is called. # # After calling one of the above macros, if the NEON_NEED_XML_PARSER # variable is set to "yes", then you must configure an XML parser # too. You can do this your own way, or do it easily using the # NEON_XML_PARSER() macro. Example usage for where we have bundled the # neon sources in a directory called libneon, and bundled expat # sources in a directory called 'expat'. # # NEON_BUNDLED(libneon, [ # SUBDIRS="$SUBDIRS libneon" # NEON_XML_PARSER(expat) # NEON_NORMAL_BUILD # ]) # # Alternatively, for a simple standalone app with neon as a # dependancy, use just: # # NEON_LIBRARY # # and rely on the user installing neon correctly. # # You are free to configure an XML parser any other way you like, # but the end result must be, either expat or libxml will get linked # in, and HAVE_EXPAT or HAVE_LIBXML is defined appropriately. # # To set up the bundled build environment, call # # NEON_NORMAL_BUILD # or # NEON_LIBTOOL_BUILD # # depending on whether you are using libtool to build, or not. # Both these macros take an optional argument specifying the set # of object files you wish to build: if the argument is not given, # all of neon will be built. AC_DEFUN([NEON_BUNDLED],[ neon_bundled_srcdir=$1 neon_bundled_builddir=$1 NEON_COMMON_BUNDLED([$2]) ]) AC_DEFUN([NEON_VPATH_BUNDLED],[ neon_bundled_srcdir=$1 neon_bundled_builddir=$2 NEON_COMMON_BUNDLED([$3]) ]) AC_DEFUN([NEON_COMMON_BUNDLED],[ AC_ARG_WITH(included-neon, [ --with-included-neon Force use of included neon library ], [neon_force_included="$withval"], [neon_force_included="no"]) NEON_COMMON if test "$neon_force_included" = "yes"; then # The colon is here so there is something to evaluate # here in case the argument was not passed. : $1 fi ]) dnl Not got any bundled sources: AC_DEFUN([NEON_LIBRARY],[ neon_force_included=no neon_bundled_srcdir= neon_bundled_builddir= NEON_COMMON ]) AC_DEFUN([NEON_VERSIONS], [ # Define the current versions. NEON_VERSION_MAJOR=0 NEON_VERSION_MINOR=12 NEON_VERSION_RELEASE=0 NEON_VERSION_TAG= NEON_VERSION="${NEON_VERSION_MAJOR}.${NEON_VERSION_MINOR}.${NEON_VERSION_RELEASE}${NEON_VERSION_TAG}" # the libtool interface version is # current:revision:age NEON_INTERFACE_VERSION="12:0:0" AC_DEFINE_UNQUOTED(NEON_VERSION, "${NEON_VERSION}", [Define to be the neon version string]) AC_DEFINE_UNQUOTED(NEON_VERSION_MAJOR, [(${NEON_VERSION_MAJOR})], [Define to be major number of neon version]) AC_DEFINE_UNQUOTED(NEON_VERSION_MINOR, [(${NEON_VERSION_MINOR})], [Define to be minor number of neon version]) ]) dnl Define the minimum required version AC_DEFUN([NEON_REQUIRE], [ neon_require_major=$1 neon_require_minor=$2 ]) dnl Check that the external library found in a given location dnl matches the min. required version (if any) dnl Usage: dnl NEON_CHECK_VERSION(instroot[, ACTIONS-IF-OKAY[, ACTIONS-IF-FAILURE]]) dnl AC_DEFUN([NEON_CHECK_VERSION], [ if test "x$neon_require_major" = "x"; then : $2 else config=$1/bin/neon-config oLIBS="$LIBS" oCFLAGS="$CFLAGS" CFLAGS="$CFLAGS `$config --cflags`" LIBS="$LIBS `$config --libs`" ver=`$config --version` AC_MSG_CHECKING(for neon library version) AC_TRY_RUN([ #include int main(void) { return neon_version_minimum($neon_require_major, $neon_require_minor); } ], [ AC_MSG_RESULT([okay (found $ver)]) LIBS="$oLIBS" CFLAGS="$oCFLAGS" $2 ], [ AC_MSG_RESULT([failed, found $ver wanted >=$neon_require_major.$neon_require_minor]) LIBS="$oLIBS" CFLAGS="$oCFLAGS" $3 ]) fi ]) AC_DEFUN([NEON_COMMON],[ NEON_VERSIONS AC_ARG_WITH(neon, [ --with-neon Specify location of neon library ], [neon_loc="$withval"]) AC_MSG_CHECKING(for neon location) if test "$neon_force_included" = "no"; then # We don't have an included neon source directory, # or they aren't force us to use it. if test -z "$neon_loc"; then # Look in standard places for d in /usr /usr/local; do if test -x $d/bin/neon-config; then neon_loc=$d fi done fi if test -x $neon_loc/bin/neon-config; then # Found it! AC_MSG_RESULT(found in $neon_loc) NEON_CHECK_VERSION([$neon_loc], [ NEON_CONFIG=$neon_loc/bin/neon-config CFLAGS="$CFLAGS `$NEON_CONFIG --cflags`" NEONLIBS="$NEONLIBS `$NEON_CONFIG --libs`" neon_library_message="library in $neon_loc (`$NEON_CONFIG --version`)" neon_xml_parser_message="using whatever libneon uses" neon_got_library=yes ], [ neon_got_library=no ]) else neon_got_library=no fi if test "$neon_got_library" = "no"; then if test -n "$neon_bundled_srcdir"; then # Couldn't find external neon, forced to use bundled sources neon_force_included="yes" else # Couldn't find neon, and don't have bundled sources AC_MSG_ERROR(could not find neon) fi fi fi # This isn't a simple 'else' branch, since neon_force_included # is set to yes if the search fails. if test "$neon_force_included" = "yes"; then AC_MSG_RESULT([using supplied ($NEON_VERSION)]) CFLAGS="$CFLAGS -I$neon_bundled_srcdir" LDFLAGS="$LDFLAGS -L$neon_bundled_builddir" NEONLIBS="$LIBS -lneon" NEON_BUILD_BUNDLED="yes" LIBNEON_SOURCE_CHECKS NEON_NEED_XML_PARSER=yes neon_library_message="included libneon (${NEON_VERSION})" else # Don't need to configure an XML parser NEON_NEED_XML_PARSER=no NEON_BUILD_BUNDLED="yes" fi AC_SUBST(NEON_BUILD_BUNDLED) AC_SUBST(NEONLIBS) ]) dnl Call these checks when compiling the libneon source package. AC_DEFUN([LIBNEON_SOURCE_CHECKS],[ AC_C_BIGENDIAN AC_C_INLINE AC_C_CONST AC_CHECK_HEADERS(stdarg.h string.h strings.h sys/time.h regex.h \ stdlib.h unistd.h limits.h sys/select.h arpa/inet.h) AC_REPLACE_FUNCS(strcasecmp) AC_SEARCH_LIBS(gethostbyname, nsl) AC_SEARCH_LIBS(socket, socket inet) NEON_SSL() ]) dnl Call to put lib/snprintf.o in LIBOBJS and define HAVE_SNPRINTF_H dnl if snprintf isn't in libc. AC_DEFUN([NEON_REPLACE_SNPRINTF], [ dnl Check for snprintf AC_CHECK_FUNC(snprintf,, AC_DEFINE(HAVE_SNPRINTF_H, 1, [Define if need to include snprintf.h]) AC_LIBOBJ([lib/snprintf.o]) ]) dnl Common macro to NEON_LIBTOOL_BUILD and NEON_NORMAL_BUILD dnl Sets NEONOBJS appropriately if it has not already been set. dnl dnl NOT FOR EXTERNAL USE: use LIBTOOL_BUILD or NORMAL_BUILD. dnl dnl turn off webdav, boo hoo. AC_DEFUN([NEON_WITHOUT_WEBDAV], [ neon_no_webdav=yes NEON_NEED_XML_PARSER=no neon_xml_parser_message="none needed" ]) AC_DEFUN([NEON_COMMON_BUILD], [ dnl Cunning hack: $1 is passed as the number of arguments passed dnl to the NORMAL or LIBTOOL macro, so we know whether they dnl passed any arguments or not. ifelse($1, 0, [ # Using the default set of object files to build. # 'o' is the object extension in use o=$NEON_OBJEXT AC_MSG_CHECKING(whether to enable WebDAV support in neon) dnl Did they want DAV support? if test "x$neon_no_webdav" = "xyes"; then # No WebDAV support NEONOBJS="http_request.$o http_basic.$o string_utils.$o uri.$o \ dates.$o ne_alloc.$o base64.$o md5.$o http_utils.$o \ socket.$o http_auth.$o http_cookies.$o http_redirect.$o" AC_MSG_RESULT(no) else # WebDAV support NEONOBJS="http_request.$o http_basic.$o dav_basic.$o \ dav_207.$o string_utils.$o dates.$o ne_alloc.$o \ hip_xml.$o base64.$o md5.$o http_utils.$o \ uri.$o socket.$o http_auth.$o dav_props.$o \ http_cookies.$o dav_locks.$o http_redirect.$o" # Turn on DAV locking please then. AC_DEFINE(USE_DAV_LOCKS, 1, [Support WebDAV locking through the library]) AC_MSG_RESULT(yes) fi ], [ # Using a specified set of object files. NEONOBJS=$1 ]) AC_SUBST(NEON_TARGET) AC_SUBST(NEON_OBJEXT) AC_SUBST(NEONOBJS) AC_SUBST(NEON_LINK_FLAGS) AC_PATH_PROG(AR, ar) ]) # The libtoolized build case: AC_DEFUN([NEON_LIBTOOL_BUILD], [ NEON_TARGET=libneon.la NEON_OBJEXT=lo NEON_COMMON_BUILD($#, $*) ]) # The non-libtool build case: AC_DEFUN([NEON_NORMAL_BUILD], [ NEON_TARGET=libneon.a NEON_OBJEXT=o NEON_COMMON_BUILD($#, $*) ]) avfs-1.1.4/macros/neon-ssl.m40000644000175000001440000000370514032341001012646 00000000000000# Copyright (C) 1998-2000 Joe Orton. # This file is free software; you may copy and/or distribute it with # or without modifications, as long as this notice is preserved. # This software is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY, to the extent permitted by law; without even # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR # PURPOSE. # The above license applies to THIS FILE ONLY, the neon library code # itself may be copied and distributed under the terms of the GNU # LGPL, see COPYING.LIB for more details # This file is part of the neon HTTP/WebDAV client library. # See http://www.webdav.org/neon/ for the latest version. # Please send any feedback to # $Id: neon-ssl.m4,v 1.1 2001/03/13 09:47:51 mszeredi Exp $ # $1 specifies the location of the bundled neon "src" directory, or # is empty if none is bundled. $1 specifies the location of the bundled # expat directory, or is empty if none is bundled. AC_DEFUN([NEON_SSL],[ AC_ARG_WITH(ssl, [ --with-ssl[=DIR] enable OpenSSL support ],, [with_ssl="no"]) # In an ideal world, we would default to with_ssl="yes". # But this might lead to packagers of neon-enabled apps # unknowingly exporting crypto binaries. AC_MSG_CHECKING(for OpenSSL) if test "$with_ssl" = "yes"; then # They didn't specify a location: look in # some usual places neon_ssl_dirs="/usr/local/ssl /usr/ssl /usr" neon_ssl_location="" for d in $neon_ssl_dirs; do if test -r $d/include/openssl/ssl.h; then neon_ssl_location=$d break fi done elif test "$with_ssl" = "no"; then neon_ssl_location="" else neon_ssl_location=$with_ssl fi if test -n "$neon_ssl_location"; then CFLAGS="$CFLAGS -I${neon_ssl_location}/include" LDFLAGS="$LDFLAGS -L${neon_ssl_location}/lib" NEONLIBS="$NEONLIBS -lssl -lcrypto" AC_DEFINE([ENABLE_SSL], 1, [Define to enable OpenSSL support]) AC_MSG_RESULT(found in $neon_ssl_location) else AC_MSG_RESULT(not found) fi ]) avfs-1.1.4/macros/Makefile.am0000644000175000001440000000013514032341001012674 00000000000000EXTRA_DIST = neon-ssl.m4 \ neon-xml-parser.m4 \ neon.m4 \ ld-versionscript.m4 \ extfs.m4 avfs-1.1.4/macros/extfs.m40000644000175000001440000000112514032341001012233 00000000000000dnl MC_EXTFS_CHECKS dnl Check for tools used in extfs scripts. dnl Macro is from the mc-4.6.1pre1 distribution AC_DEFUN([MC_EXTFS_CHECKS], [ AC_PATH_PROG([ZIP], [zip], [/usr/bin/zip]) AC_PATH_PROG([UNZIP], [unzip], [/usr/bin/unzip]) AC_CACHE_CHECK([for zipinfo code in unzip], [mc_cv_have_zipinfo], [mc_cv_have_zipinfo=no if $UNZIP -Z /dev/null 2>&1; then mc_cv_have_zipinfo=yes fi]) if test "x$mc_cv_have_zipinfo" = xyes; then HAVE_ZIPINFO=1 else HAVE_ZIPINFO=0 fi AC_SUBST([HAVE_ZIPINFO]) AC_PATH_PROG([PERL], [perl], [/usr/bin/perl]) ]) avfs-1.1.4/macros/neon-xml-parser.m40000644000175000001440000001024614032341001014135 00000000000000# Copyright (C) 1998-2000 Joe Orton. # This file is free software; you may copy and/or distribute it with # or without modifications, as long as this notice is preserved. # This software is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY, to the extent permitted by law; without even # the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR # PURPOSE. # The above license applies to THIS FILE ONLY, the neon library code # itself may be copied and distributed under the terms of the GNU # LGPL, see COPYING.LIB for more details # This file is part of the neon HTTP/WebDAV client library. # See http://www.webdav.org/neon/ for the latest version. # Please send any feedback to # $Id: neon-xml-parser.m4,v 1.2 2002/12/03 18:51:31 mszeredi Exp $ # Check for XML parser. # Supports: # * libxml (requires version 1.8.3 or later) # * expat in -lexpat # * expat in -lxmlparse and -lxmltok (as packaged by Debian/Red Hat) # * Bundled expat if a directory name argument is passed # -> expat dir must contain minimal expat sources, i.e. # xmltok, xmlparse sub-directories. See sitecopy/cadaver for # examples of how to do this. # # Usage: # NEON_XML_PARSER() # or # NEON_XML_PARSER(expat-dir) AC_DEFUN([NEON_XML_PARSER], [ if test "$NEON_NEED_XML_PARSER" = "yes"; then AC_ARG_ENABLE([libxml], [ --enable-libxml force use of libxml ], [neon_force_libxml=$enableval], [neon_force_libxml=no]) AC_ARG_WITH([expat], [ --with-expat=DIR specify Expat location], [ if test "$withval" != "no"; then case "$withval" in */libexpat.la) neon_using_libtool_expat=yes withval=`echo $withval | sed 's:/libexpat.la$::'` esac if test -r "$withval/xmlparse.h"; then AC_DEFINE(HAVE_EXPAT, 1, [Define if you have expat]) CFLAGS="$CFLAGS -I$withval" dnl add the library (if it isn't a libtool library) if test -z "$neon_using_libtool_expat"; then NEONLIBS="$NEONLIBS -L$withval -lexpat" fi neon_xml_parser_message="expat in $withval" neon_found_parser="yes" fi fi ],[ neon_found_parser="no" ]) if test "$neon_found_parser" = "no" -a "$neon_force_libxml" = "no"; then AC_CHECK_LIB(expat, XML_Parse, neon_expat_libs="-lexpat" neon_found_parser="expat", AC_CHECK_LIB(xmlparse, XML_Parse, neon_expat_libs="-lxmltok -lxmlparse" neon_found_parser="expat", neon_found_parser="no", -lxmltok ) ) fi if test "$neon_found_parser" = "no"; then # Have we got libxml 1.8.3 or later? AC_CHECK_PROG(XML_CONFIG, xml-config, xml-config) if test "$XML_CONFIG" != ""; then # Check for recent library oLIBS="$LIBS" oCFLAGS="$CFLAGS" NEWLIBS="`$XML_CONFIG --libs`" LIBS="$LIBS $NEWLIBS" CFLAGS="$CFLAGS `$XML_CONFIG --cflags`" AC_CHECK_LIB(xml, xmlCreatePushParserCtxt, neon_found_parser="libxml" neon_xml_parser_message="libxml" NEONLIBS="$NEONLIBS $NEWLIBS" AC_DEFINE(HAVE_LIBXML, 1, [Define if you have libxml]) , CFLAGS="$oCFLAGS" LIBS="$oLIBS" AC_WARN([cannot use old libxml (1.8.3 or newer required)]) ) fi fi if test "$neon_found_parser" = "expat"; then # This is crap. Maybe just use AC_CHECK_HEADERS and use the # right file by ifdef'ing is best AC_CHECK_HEADER(xmlparse.h, [neon_expat_incs="" neon_found_expatincs="yes"], [AC_CHECK_HEADER(xmltok/xmlparse.h, [neon_expat_incs="-I/usr/include/xmltok" neon_found_expatincs="yes"], )]) if test "$neon_found_expatincs" = "yes"; then AC_DEFINE(HAVE_EXPAT, 1, [Define if you have expat]) if test "$neon_expat_incs"; then CFLAGS="$CFLAGS $neon_expat_incs" fi NEONLIBS="$NEONLIBS $neon_expat_libs" else AC_MSG_ERROR(["found expat library but could not find xmlparse.h"]) fi neon_xml_parser_message="expat in $neon_expat_libs" fi if test "$neon_found_parser" = "no" ; then if test "x$1" != "x"; then # Use the bundled expat sources AC_LIBOBJ([$1/xmltok/xmltok.o $1/xmltok/xmlrole.o $1/xmlparse/xmlparse.o $1/xmlparse/hashtable.o]) CFLAGS="$CFLAGS -DXML_DTD -I$1/xmlparse -I$1/xmltok" AC_MSG_RESULT(using supplied expat XML parser) AC_DEFINE(HAVE_EXPAT, 1, [Define if you have expat] ) neon_xml_parser_message="supplied expat in $1" else AC_MSG_ERROR([no XML parser was found]) fi fi fi ]) avfs-1.1.4/install-sh0000755000175000001440000003577614032341013011406 00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2020-11-14.01; # UTC # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # 'make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. tab=' ' nl=' ' IFS=" $tab$nl" # Set DOITPROG to "echo" to test this script. doit=${DOITPROG-} doit_exec=${doit:-exec} # Put in absolute file names if you don't have them in your path; # or use environment vars. chgrpprog=${CHGRPPROG-chgrp} chmodprog=${CHMODPROG-chmod} chownprog=${CHOWNPROG-chown} cmpprog=${CMPPROG-cmp} cpprog=${CPPROG-cp} mkdirprog=${MKDIRPROG-mkdir} mvprog=${MVPROG-mv} rmprog=${RMPROG-rm} stripprog=${STRIPPROG-strip} posix_mkdir= # Desired mode of installed file. mode=0755 # Create dirs (including intermediate dirs) using mode 755. # This is like GNU 'install' as of coreutils 8.32 (2020). mkdir_umask=22 backupsuffix= chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false is_target_a_directory=possibly usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve data modification time) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -p pass -p to $cpprog. -s $stripprog installed files. -S SUFFIX attempt to back up existing files, with suffix SUFFIX. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG By default, rm is invoked with -f; when overridden with RMPROG, it's up to you to specify -f if you want it. If -S is not specified, no backups are attempted. Email bug reports to bug-automake@gnu.org. Automake home page: https://www.gnu.org/software/automake/ " while test $# -ne 0; do case $1 in -c) ;; -C) copy_on_change=true;; -d) dir_arg=true;; -g) chgrpcmd="$chgrpprog $2" shift;; --help) echo "$usage"; exit $?;; -m) mode=$2 case $mode in *' '* | *"$tab"* | *"$nl"* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -p) cpprog="$cpprog -p";; -s) stripcmd=$stripprog;; -S) backupsuffix="$2" shift;; -t) is_target_a_directory=always dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) is_target_a_directory=never;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done # We allow the use of options -d and -T together, by making -d # take the precedence; this is for compatibility with GNU install. if test -n "$dir_arg"; then if test -n "$dst_arg"; then echo "$0: target directory not allowed when installing a directory." >&2 exit 1 fi fi if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dst_arg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dst_arg" shift # fnord fi shift # arg dst_arg=$arg # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call 'install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then if test $# -gt 1 || test "$is_target_a_directory" = always; then if test ! -d "$dst_arg"; then echo "$0: $dst_arg: Is not a directory." >&2 exit 1 fi fi fi if test -z "$dir_arg"; then do_exit='(exit $ret); exit $ret' trap "ret=129; $do_exit" 1 trap "ret=130; $do_exit" 2 trap "ret=141; $do_exit" 13 trap "ret=143; $do_exit" 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names problematic for 'test' and other utilities. case $src in -* | [=\(\)!]) src=./$src;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? # Don't chown directories that already exist. if test $dstdir_status = 0; then chowncmd="" fi else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dst_arg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dst_arg # If destination is a directory, append the input filename. if test -d "$dst"; then if test "$is_target_a_directory" = never; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dstbase=`basename "$src"` case $dst in */) dst=$dst$dstbase;; *) dst=$dst/$dstbase;; esac dstdir_status=0 else dstdir=`dirname "$dst"` test -d "$dstdir" dstdir_status=$? fi fi case $dstdir in */) dstdirslash=$dstdir;; *) dstdirslash=$dstdir/;; esac obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false # The $RANDOM variable is not portable (e.g., dash). Use it # here however when possible just to lower collision chance. tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap ' ret=$? rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" 2>/dev/null exit $ret ' 0 # Because "mkdir -p" follows existing symlinks and we likely work # directly in world-writeable /tmp, make sure that the '$tmpdir' # directory is successfully created first before we actually test # 'mkdir -p'. if (umask $mkdir_umask && $mkdirprog $mkdir_mode "$tmpdir" && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/a/b") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. test_tmpdir="$tmpdir/a" ls_ld_tmpdir=`ls -ld "$test_tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$test_tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$test_tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/a/b" "$tmpdir/a" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- "$tmpdir" 2>/dev/null fi trap '' 0;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix='/';; [-=\(\)!]*) prefix='./';; *) prefix='';; esac oIFS=$IFS IFS=/ set -f set fnord $dstdir shift set +f IFS=$oIFS prefixes= for d do test X"$d" = X && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=${dstdirslash}_inst.$$_ rmtmp=${dstdirslash}_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && { test -z "$stripcmd" || { # Create $dsttmp read-write so that cp doesn't create it read-only, # which would cause strip to fail. if test -z "$doit"; then : >"$dsttmp" # No need to fork-exec 'touch'. else $doit touch "$dsttmp" fi } } && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # If -C, don't bother to copy if it wouldn't change the file. if $copy_on_change && old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # If $backupsuffix is set, and the file being installed # already exists, attempt a backup. Don't worry if it fails, # e.g., if mv doesn't support -f. if test -n "$backupsuffix" && test -f "$dst"; then $doit $mvcmd -f "$dst" "$dst$backupsuffix" 2>/dev/null fi # Rename the file to the real destination. $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. { # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { test ! -f "$dst" || $doit $rmcmd "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd "$rmtmp" 2>/dev/null; :; } } || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } fi || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: avfs-1.1.4/ChangeLog0000644000175000001440000004414614032341001011140 000000000000002021-04-04 Ralf Hoffmann * add support for lzip (ulzip module for .lz files) * bump version to 1.1.4 2020-08-12 Ralf Hoffmann * bump version to 1.1.3 2020-07-05 Ralf Hoffmann * urar: fix missing include for PATH_MAX 2020-05-02 Ralf Hoffmann * ulha: run in C locale to avoid encoding problems 2020-04-27 Ralf Hoffmann * bump version to 1.1.2 2020-04-21 Ralf Hoffmann * zstd: fix memory leak 2020-02-22 Ralf Hoffmann * urar.c: add basic support for rar 5.0 files 2019-08-09 Ralf Hoffmann * bump version to 1.1.1 2019-08-09 Ralf Hoffmann * add pkgconfig file 2019-07-21 Ralf Hoffmann * updated internal bzlib to 1.0.8 to fix security bug 2019-06-21 Ralf Hoffmann * bump version to 1.1.0 2019-06-09 Ralf Hoffmann * dav: update dav module for latest libneon and removed bundled neon. 2019-06-02 Ralf Hoffmann * ugz.c, zread.c: fix handling of gzip files with multiple members. It now extract all members after each other just like gzip does. 2019-05-26 Ralf Hoffmann * remove coda and LD_PRELOAD support 2019-05-24 Ralf Hoffmann * parse.c: improve lookup of autofs via # to stop at first dir-like avfs. 2018-09-09 Ralf Hoffmann * uzip.c: add .apk extension. 2018-08-26 Ralf Hoffmann * bump version to 1.0.6 2018-08-18 Ralf Hoffmann * uzip.c: set regular file mode if unix attributes are actually zero. 2018-08-10 Ralf Hoffmann * security fix for possible command execution in rsh/ssh module. User or host name could contain special characters to force rsh or ssh to execute commands within the name on the local or remote machine. Thanks to Jann Horn for pointing that out. 2018-02-03 Ralf Hoffmann * added support for libzstd (zst files) 2017-05-03 Ralf Hoffmann * urar.c: fix possible crash of external rar/unrar tool because of readonly filehandle * final changes for release 1.0.5 2017-04-19 Ralf Hoffmann * parsels.c: fix potential out-of-bound read access when parsing ls output * parsels.c: only parse year when it is not the last column 2017-04-17 Ralf Hoffmann * bumped version to 1.0.5 2017-04-17 Ralf Hoffmann * limit the file cache to 50 elements and age of 10 minutes 2016-12-28 Ralf Hoffmann * allow reproducable builds (patch from Bernhard M. Wiedemann) 2016-09-14 Ralf Hoffmann * bumped version to 1.0.4 2016-08-23 Ralf Hoffmann * use correct unsigned read for zip header values, fixing handling large zip files. 2015-06-13 Ralf Hoffmann * bumped version to 1.0.3 2015-05-10 Ralf Hoffmann * added rar v5 support in extfs urar module. * renamed extfs urar module to uextrar so internal urar and external module can be used simultaneously. 2015-03-08 Ralf Hoffmann * fixed zlib state saving/restoring when a Huffman tree is not a dynamic one. This fixes an assertion triggered by some rare cases when accessing zip'ed content. Triggering the assertion did also depend on the block size when reading content. 2015-02-04 Ralf Hoffmann * changed info.h dependency for out-of-src builds * changed configure to allow forcing to build with fuse and/or liblzma support 2014-06-19 Ralf Hoffmann * uzip: added support for zip64 format. Allows more than 64k files per archive and files larger than 4 GiB. 2014-02-23 Ralf Hoffmann * extfs: updated some scripts to not require bash (patch from Michael Meskes) * ucftp: unregistered lseek to avoid some problems (like cat not working) 2014-02-05 Ralf Hoffmann * utar: handle extended header so there will be no PaxHeaders files 2013-05-11 Ralf Hoffmann * utar: added support for files larger than 8GB in archives. 2013-05-09 Ralf Hoffmann * fixed some 32bit overflows for archive, utar, and state module. It prevented accessing large files. 2012-06-11 Ralf Hoffmann * removed recursive locks and made other changes so it compiles on Mac OS * fixed number of hard links counter for extfs directories (find would skip some subdirectories) * bumped version to 1.0.1 2011-07-01 Ralf Hoffmann * fixed race condition in namespace module. * added patch which can be used for testing with valgrind. 2010-10-05 Ralf Hoffmann * bumped version to 0.9.9 2010-09-28 Ralf Hoffmann * registered .lzma for uxze module 2010-09-27 Ralf Hoffmann * udar: handled h and r entries as regular files 2010-09-23 Ralf Hoffmann * bumped library revision to 2 2010-09-21 Ralf Hoffmann * updated internal bzlib to 1.0.6 to fix security bug 2010-09-16 Ralf Hoffmann * extfs: updated existing and added some new extfs handler * fixed typo in extfs.ini * fixed typo in modules/Makefile.am * fixed typo in extfs/Makefile.am * updated gitignore file 2010-09-12 Ralf Hoffmann * ucftp: added ucftp module for uncached ftp support with read and write * avfsd: added avfsd_create function for fuse * mountavfs: changed mountavfs to also check AVFSBASE env var and to create the base directory $HOME/.avfs 2010-08-30 Ralf Hoffmann * ftp: fixed crash when password file is empty 2010-08-22 Ralf Hoffmann * utar: disabled warning about empty file names, it happens for archives create with . as base directory 2010-07-10 Ralf Hoffmann * simplified modules/Makefile.am for dav conditional 2010-07-10 Ralf Hoffmann * added xz filter module uxze 2010-07-09 Ralf Hoffmann * changed AV_VER to be replaced with NUMVERSION from configure script 2010-07-09 Ralf Hoffmann * added some m4 macros in configure.in to handle version number 2010-07-08 Ralf Hoffmann * fixed wrong conditional for liblzma * fixed compilation of xzread 2010-07-08 Ralf Hoffmann * set m4 macros directory in configure.in 2010-07-07 Ralf Hoffmann * added pkg.m4 from pkg-config to macros * added macros directory makefile.am * also build bzip2 package when creating a distribution 2010-03-10 Ralf Hoffmann * added support for liblzma (xz files) 2010-03-04 Ralf Hoffmann * forgotten to remove old bzread.c version and add new one 2010-03-04 Ralf Hoffmann * patch/avfs-bzlib-1.0.5-changes.diff, patch/avfs-zlib-1.1.4-changes.diff: added zlib and bzlib patch for reference * bzlib/blocksort.c, bzlib/bzlib.c, bzlib/bzlib.h, bzlib/bzlib_private.h, bzlib/compress.c, bzlib/crctable.c, bzlib/decompress.c, bzlib/huffman.c, bzlib/randtable.c: updated bzlib to 1.0.5 * bzlib/Makefile.am, configure.in, lib/Makefile.am, src/Makefile.am: updated bz2 support to be able to use system library * bzlib/Makefile.am, src/Makefile.am: moved bzread.c into src directory just like zread.c * src/Makefile.am, src/zread.c, zlib/Makefile.am, lib/Makefile.am, configure.in: added configure option to use system zlib 2010-02-12 Miklos Szeredi * Fix a couple of compiler warnings 2010-02-05 Miklos Szeredi * It is unnecessary to save state on EOF for zip/gzip files 2010-02-05 Miklos Szeredi * Ignore "g" type tar headers. * Make "du" on gzip files show the disk usage of the underlying file 2009-06-03 Ralf Hoffmann * fuse/avfsd.c, NEWS: fixed race condition in avfsd 2007-05-31 Ralf Hoffmann * configure.in: missing or too old fuse is no longer an error in the configure script 2007-05-30 Ralf Hoffmann * NEWS: updated * extfs/ulha.in, extfs/u7z.in: fixed trap in some extfs scripts to use single quoted command * configure.in: added fuse test using pkg-config 2007-05-23 Ralf Hoffmann * spec/Makefile.am, spec/avfsfuse-fc6.spec: added RPM spec file for avfs-fuse (from Tanmoy Bhattacharya) * extfs/rpm, extfs/trpm: changed rpm and trpm extfs scripts to output correct file sizes (patch from Tanmoy Bhattacharya) 2007-05-14 Ralf Hoffmann * NEWS: updated * zlib/inftrees.c, bzlib/bzread.c, modules/ugz.c, modules/urar.c, src/zread.c: fixed some compiler warnings * modules/utar.c: the last byte of the name field in the tar header is no longer overwritten by a null byte, the name field is not necessarily null-terminated support for POSIX ustar long file names (prefix/name) * src/zread.c: the eof flag is also stored in zlib streamcache so seeking back from the end of the file works correctly * src/Makefile.am: changed utils.c dependency 2007-05-07 Ralf Hoffmann * fixed ucpio to to use default cat command if file ending doesn't match and the cpio option -c is not used when unpacking the archive * fixed bug in extfs symlink handling, it was possible that hardlinks were created instead of symlinks (triggered by ftplist and lslR) (patch from Tanmoy Bhattacharya) * fixed ftplist to output symlink to /#ftp... and to also support http and ssh handlers (patch from Tanmoy Bhattacharya) * added some more directories to test for avfsstat in ftppass/davpass (patch from Tanmoy Bhattacharya) * only install avfscoda.el if avfscoda is built * fixed typo in README * ftp module: search for last @ in username/host so @ in username are supported * changed configure script to always build library and additionally fuse/avfscoda/preload depending on the actual system 2007-05-02 Miklos Szeredi * Update avfsd to use fuse API version 26. Fixes bug where access(2) would report a file writable, but opening the file for write would be denied. Reported by Giuseppe Bilotta 2007-03-11 Ralf Hoffmann * fixed extfs deadlock * bumped version to 0.9.8 2007-01-24 Miklos Szeredi * Fix re-reading bzipped files. Reported by Andrew Collier 2006-11-27 Ralf Hoffmann * fixed crash in save/restore of an inflate state when fixed trees are used * updated bzlib to version 1.0.3 2006-06-14 Ralf Hoffmann * Updated NEWS and AUTHORS * Added missing include in extfs module 2006-06-06 Ralf Hoffmann * Set fuse_build to no in configure.in if fuse is not found 2006-06-05 Ralf Hoffmann * Added configure.in hack to always set _FILE_OFFSET_BITS because fuse requires this even on 64bit archs 2006-05-16 Ralf Hoffmann * Updated documentation * Bumped version to 0.9.7 2006-04-05 Ralf Hoffmann * Extended cache to supply an interface similar to filecache * Used new cache interface in extfs to store tmpfiles * Fixed invisible hidden files for iso9660 * Added extfs support for 7zip * Added installation prefix output in configure script * Fuse daemon can now be installed with --enable-fuse * Added symlink rewriting to make absolute symlinks relative * Added avfsstat interface to toggle this symlink rewrite * Added parsing of iso date format in parsels 2006-02-21 Ralf Hoffmann * urar module uses unrar in case of missing rar (based on patch by Mark) 2006-02-06 Ralf Hoffmann * Fixed segfault when using open on base archives (same bug as for extfs) 2006-02-05 Ralf Hoffmann * Changed ftp module to use "LIST -al" instead of "LIST -an" to support ftp servers which don't allow the "-an" argument * The configure script will output some configuration details 2006-01-30 Ralf Hoffmann * Fixed segfault in extfs when using open on base archive (e.g., open("test.lha#") ) * Integrated two patches from the patched avfs version from Zemljanka Commander team (http://sourceforge.net/projects/zemljanka). There was one bug in virt_link and one bug when getting ftp files from the root directory. * av_parse_ls uses now atoll() to parse file size (if available). The ftp module can now supports files larger than 2GB. * Fixed bug in the ulha extfs module which had problems with file names containing spaces * Updated the other extfs modules to the current mc-4.6.1 versions 2006-01-02 Miklos Szeredi * Utar module should be able to handle >2G files. Report from Pete 2005-07-16 Ralf Hoffmann * fixed urar module: The CRC calculation now also takes optional header entries of newer rar versions into account 2005-07-15 Ralf Hoffmann * updated dos date parsing in parsels.c to handle years with more than 3 digits (from mc-4.6.1-pre1). patchfs from extfs output such dates 2005-07-13 Ralf Hoffmann * fixed return value of local_close 2005-06-20 Ralf Hoffmann * updated docs 2005-06-19 Ralf Hoffmann * fixed cache handling: When setting a new size for a cache entry, the entry is not removed even if it is larger than the cache limit. * updated extfs handlers (from mc-4.6.1-pre1) 2005-06-13 Ralf Hoffmann * changed build system to automake which should improve portability. At least the shared (or static) library should build on any system. The other targets still only works on Solaris (for preload) and Linux kernel 2.2 and 2.4 (for avfscoda) * fixes to allow compilation on AIX 2005-06-08 Ralf Hoffmann * magic character in filenames is supported without escaping * fix in bzlib to prevent endless loop in corrupt archives * change inode calculation in state.c to prevent inode numbers 0 and 1 2004-03-07 Miklos Szeredi * Don't lowercase zipfiles with MSDOS filetype 2004-01-09 Miklos Szeredi * Configure target selection fix 2004-01-05 Miklos Szeredi * Applied FreeBSD support patch by Mikulas Patocka 2003-12-09 Miklos Szeredi * Don't include DAV by default 2003-12-08 Miklos Szeredi * Shared library fix by Miroslav Spousta 2003-05-08 Miklos Szeredi * avfs-config and logging improvements by Daniel Koukola 2003-04-28 Miklos Szeredi * Added shared lib build and fixes by Daniel Koukola 2003-04-14 Miklos Szeredi * Added API documentation by Frederik Eaton 2002-12-05 Miklos Szeredi * 64 bit file offset fixes * Gunzip (#ugz) speed improvement: CRC is checked only once 2002-12-03 Miklos Szeredi * Upgraded to zlib 1.1.4 * Added .ear and .war extensions to the uzip handler * Check for large-file support 2002-11-18 Miklos Szeredi * Fixed bug in runprog, which leaked file descriptors in extfs. * Added /etc/init.d/avfscoda improvements by David Hanak * Top level makefile fix: 'install' target now depends on 'all' 2002-01-17 Miklos Szeredi * Started merging Frederik Eaton's stuff: spelling fixes, comments and logging to stderr. Changes from 0.9.1 to 0.9.3 * Fixed PT_DTRACE bug in redir.c * Removed nredir cruft * Configure now accepts kernel source directory argument * redir.c now includes modversions.h * Fix bug in virt_readdir * Fix redir compilation so it finds the apropriate kernel headers * Fix redir module license tag * Emacs tweak installed in /etc/emacs/site-start.d so that ange-ftp doesn't steal files beginning with '#'. This does not affect the operaton of ange-ftp * Better cross compilation support * Ported to Compaq IPAQ (still needs better cache handling) * Fix truncation code in cache state (/#avfsstat/cache/*) * Support free space handling on filesystems not supporting disk usage and disk free information (e.g. ramfs) Changes from 0.9.0 to 0.9.1 * Make preload compile on linux (does not work yet) (Frederik Eaton) * Fix bug in module loader (Frederik Eaton) * The magic char (#) is escaped when reading a virtual directory * Avfscoda correctly returns error codes when reading a file or a directory * Fixed bug in virt_open(), to actually return the file descriptor instead of zero. This fixes bad behaivor of avfscoda under heavier load. * Commented out HAVE_FIFO_BUG define in child.c. If you have a very old kernel, you need to uncomment this. * Avfscoda uses hash table for lookups. This improves performance for large directories. * Namespace uses hash table for lookups. This improves performance for large directories. TODO: current namespace implementation doesn't honor the NSF_NOCASE flag. * Removed buggy 'mkdir' from redir.c * Added execve (only for ix86) to redir.c * Fixed deadlock in bzip2 handling * Utar (and archive) now correctly handle open/read/close for auto-directories * Preload is now working on Solaris 2.5 (thanks to Richard Curnow) * Fix bug in archive, for multiple opens on same file * Archive now handles gracefully the case when file type is symlink, but linkname is not filled in by handler. TODO: Handle symlinks in zipfiles * Handle archives which have '.' or '..' in their internal paths. avfs-1.1.4/COPYING0000644000175000001440000004313314032341001010414 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. avfs-1.1.4/lib/0000755000175000001440000000000014032341025010211 500000000000000avfs-1.1.4/lib/libavfs.map0000644000175000001440000000106414032341001012251 00000000000000LIBAVFS { global: virt_access; virt_chmod; virt_chown; virt_close; virt_closedir; virt_fchmod; virt_fchown; virt_fstat; virt_ftruncate; virt_islocal; virt_lchown; virt_link; virt_lseek; virt_lstat; virt_mkdir; virt_mknod; virt_open; virt_opendir; virt_read; virt_readdir; virt_readlink; virt_remove; virt_rename; virt_rewinddir; virt_rmdir; virt_stat; virt_symlink; virt_truncate; virt_unlink; virt_utime; virt_write; local: *; }; avfs-1.1.4/lib/Makefile.in0000644000175000001440000004434614032341013012206 00000000000000# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = lib ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(libdir)" LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) libavfs_la_DEPENDENCIES = ../src/libavfscore.la \ ../modules/libmodules.la am_libavfs_la_OBJECTS = libavfs_la_OBJECTS = $(am_libavfs_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libavfs_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libavfs_la_LDFLAGS) $(LDFLAGS) -o $@ @BUILD_SHARED_TRUE@am_libavfs_la_rpath = -rpath $(libdir) libavfs_static_la_DEPENDENCIES = ../src/libavfscore.la \ ../modules/libmodules.la am_libavfs_static_la_OBJECTS = libavfs_static_la_OBJECTS = $(am_libavfs_static_la_OBJECTS) libavfs_static_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(libavfs_static_la_LDFLAGS) $(LDFLAGS) \ -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libavfs_la_SOURCES) $(libavfs_static_la_SOURCES) DIST_SOURCES = $(libavfs_la_SOURCES) $(libavfs_static_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BZLIB_INCLUDE = @BZLIB_INCLUDE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAV = @DAV@ DAV_LS = @DAV_LS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FUSELIBS = @FUSELIBS@ GREP = @GREP@ HAVE_ZIPINFO = @HAVE_ZIPINFO@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ LIBZSTD_LIBS = @LIBZSTD_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NUMVERSION = @NUMVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ ZIP = @ZIP@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_INCLUDE = @ZLIB_INCLUDE@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @BUILD_SHARED_TRUE@lib_LTLIBRARIES = libavfs.la noinst_LTLIBRARIES = libavfs_static.la libavfs_la_LDFLAGS = @VERSIONSCRIPT_OPTS@ -version-info 0:2:0 libavfs_la_LIBADD = ../src/libavfscore.la ../modules/libmodules.la @LIBZ@ @LIBBZ2@ @LIBDAV@ libavfs_la_SOURCES = libavfs_static_la_LDFLAGS = -static libavfs_static_la_LIBADD = ../src/libavfscore.la ../modules/libmodules.la @LIBZ@ @LIBBZ2@ @LIBDAV@ libavfs_static_la_SOURCES = EXTRA_DIST = libavfs.map all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu lib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu lib/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-libLTLIBRARIES: $(lib_LTLIBRARIES) @$(NORMAL_INSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ list2=; for p in $$list; do \ if test -f $$p; then \ list2="$$list2 $$p"; \ else :; fi; \ done; \ test -z "$$list2" || { \ echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ } uninstall-libLTLIBRARIES: @$(NORMAL_UNINSTALL) @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ for p in $$list; do \ $(am__strip_dir) \ echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ done clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) @list='$(lib_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libavfs.la: $(libavfs_la_OBJECTS) $(libavfs_la_DEPENDENCIES) $(EXTRA_libavfs_la_DEPENDENCIES) $(AM_V_CCLD)$(libavfs_la_LINK) $(am_libavfs_la_rpath) $(libavfs_la_OBJECTS) $(libavfs_la_LIBADD) $(LIBS) libavfs_static.la: $(libavfs_static_la_OBJECTS) $(libavfs_static_la_DEPENDENCIES) $(EXTRA_libavfs_static_la_DEPENDENCIES) $(AM_V_CCLD)$(libavfs_static_la_LINK) $(libavfs_static_la_OBJECTS) $(libavfs_static_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) installdirs: for dir in "$(DESTDIR)$(libdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \ clean-noinstLTLIBRARIES mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-libLTLIBRARIES install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-libLTLIBRARIES .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distdir dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-libLTLIBRARIES install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am uninstall-libLTLIBRARIES .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: avfs-1.1.4/lib/Makefile.am0000644000175000001440000000175414032341001012166 00000000000000##TODO Using automake 1.9 it would be possible to conditional ## use lib_ or noinst_ for libavfs depending on configure flag ## Currently a static is always built but the shared is only built if wanted if BUILD_SHARED lib_LTLIBRARIES = libavfs.la endif noinst_LTLIBRARIES = libavfs_static.la ##TODO --version-script is not supported by some linkers (Sun linker for example) ##libavfs_la_LDFLAGS = -Wl,--version-script=libavfs.map -version-info 0:1:0 ##TODO Exporting only virt_ symbols doesn't work because avfs_server needs ## other symbols too ## Possible solution: Also build a static library which doesn't get installed libavfs_la_LDFLAGS = @VERSIONSCRIPT_OPTS@ -version-info 0:2:0 libavfs_la_LIBADD = ../src/libavfscore.la ../modules/libmodules.la @LIBZ@ @LIBBZ2@ @LIBDAV@ libavfs_la_SOURCES = libavfs_static_la_LDFLAGS = -static libavfs_static_la_LIBADD = ../src/libavfscore.la ../modules/libmodules.la @LIBZ@ @LIBBZ2@ @LIBDAV@ libavfs_static_la_SOURCES = EXTRA_DIST = libavfs.map avfs-1.1.4/ltmain.sh0000755000175000001440000117077114032341012011220 00000000000000#! /bin/sh ## DO NOT EDIT - This file generated from ./build-aux/ltmain.in ## by inline-source v2014-01-03.01 # libtool (GNU libtool) 2.4.6 # Provide generalized library-building support services. # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . PROGRAM=libtool PACKAGE=libtool VERSION=2.4.6 package_revision=2.4.6 ## ------ ## ## Usage. ## ## ------ ## # Run './libtool --help' for help with using this script from the # command line. ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # After configure completes, it has a better idea of some of the # shell tools we need than the defaults used by the functions shared # with bootstrap, so set those here where they can still be over- # ridden by the user, but otherwise take precedence. : ${AUTOCONF="autoconf"} : ${AUTOMAKE="automake"} ## -------------------------- ## ## Source external libraries. ## ## -------------------------- ## # Much of our low-level functionality needs to be sourced from external # libraries, which are installed to $pkgauxdir. # Set a version string for this script. scriptversion=2015-01-20.17; # UTC # General shell script boiler plate, and helper functions. # Written by Gary V. Vaughan, 2004 # Copyright (C) 2004-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # As a special exception to the GNU General Public License, if you distribute # this file as part of a program or library that is built using GNU Libtool, # you may include this file under the same distribution terms that you use # for the rest of that program. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # Evaluate this file near the top of your script to gain access to # the functions and variables defined here: # # . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh # # If you need to override any of the default environment variable # settings, do that before evaluating this file. ## -------------------- ## ## Shell normalisation. ## ## -------------------- ## # Some shells need a little help to be as Bourne compatible as possible. # Before doing anything else, make sure all that help has been provided! DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # NLS nuisances: We save the old values in case they are required later. _G_user_locale= _G_safe_locale= for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test set = \"\${$_G_var+set}\"; then save_$_G_var=\$$_G_var $_G_var=C export $_G_var _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\" _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\" fi" done # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Make sure IFS has a sensible default sp=' ' nl=' ' IFS="$sp $nl" # There are apparently some retarded systems that use ';' as a PATH separator! if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi ## ------------------------- ## ## Locate command utilities. ## ## ------------------------- ## # func_executable_p FILE # ---------------------- # Check that FILE is an executable regular file. func_executable_p () { test -f "$1" && test -x "$1" } # func_path_progs PROGS_LIST CHECK_FUNC [PATH] # -------------------------------------------- # Search for either a program that responds to --version with output # containing "GNU", or else returned by CHECK_FUNC otherwise, by # trying all the directories in PATH with each of the elements of # PROGS_LIST. # # CHECK_FUNC should accept the path to a candidate program, and # set $func_check_prog_result if it truncates its output less than # $_G_path_prog_max characters. func_path_progs () { _G_progs_list=$1 _G_check_func=$2 _G_PATH=${3-"$PATH"} _G_path_prog_max=0 _G_path_prog_found=false _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:} for _G_dir in $_G_PATH; do IFS=$_G_save_IFS test -z "$_G_dir" && _G_dir=. for _G_prog_name in $_G_progs_list; do for _exeext in '' .EXE; do _G_path_prog=$_G_dir/$_G_prog_name$_exeext func_executable_p "$_G_path_prog" || continue case `"$_G_path_prog" --version 2>&1` in *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;; *) $_G_check_func $_G_path_prog func_path_progs_result=$func_check_prog_result ;; esac $_G_path_prog_found && break 3 done done done IFS=$_G_save_IFS test -z "$func_path_progs_result" && { echo "no acceptable sed could be found in \$PATH" >&2 exit 1 } } # We want to be able to use the functions in this file before configure # has figured out where the best binaries are kept, which means we have # to search for them ourselves - except when the results are already set # where we skip the searches. # Unless the user overrides by setting SED, search the path for either GNU # sed, or the sed that truncates its output the least. test -z "$SED" && { _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for _G_i in 1 2 3 4 5 6 7; do _G_sed_script=$_G_sed_script$nl$_G_sed_script done echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed _G_sed_script= func_check_prog_sed () { _G_path_prog=$1 _G_count=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo '' >> conftest.nl "$_G_path_prog" -f conftest.sed conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin rm -f conftest.sed SED=$func_path_progs_result } # Unless the user overrides by setting GREP, search the path for either GNU # grep, or the grep that truncates its output the least. test -z "$GREP" && { func_check_prog_grep () { _G_path_prog=$1 _G_count=0 _G_path_prog_max=0 printf 0123456789 >conftest.in while : do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo 'GREP' >> conftest.nl "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' conftest.out 2>/dev/null || break diff conftest.out conftest.nl >/dev/null 2>&1 || break _G_count=`expr $_G_count + 1` if test "$_G_count" -gt "$_G_path_prog_max"; then # Best one so far, save it but keep looking for a better one func_check_prog_result=$_G_path_prog _G_path_prog_max=$_G_count fi # 10*(2^10) chars as input seems more than enough test 10 -lt "$_G_count" && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out } func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin GREP=$func_path_progs_result } ## ------------------------------- ## ## User overridable command paths. ## ## ------------------------------- ## # All uppercase variable names are used for environment variables. These # variables can be overridden by the user before calling a script that # uses them if a suitable command of that name is not already available # in the command search PATH. : ${CP="cp -f"} : ${ECHO="printf %s\n"} : ${EGREP="$GREP -E"} : ${FGREP="$GREP -F"} : ${LN_S="ln -s"} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} ## -------------------- ## ## Useful sed snippets. ## ## -------------------- ## sed_dirname='s|/[^/]*$||' sed_basename='s|^.*/||' # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='s|\([`"$\\]\)|\\\1|g' # Same as above, but do not quote variable references. sed_double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution that turns a string into a regex matching for the # string literally. sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g' # Sed substitution that converts a w32 file name or path # that contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-'\' parameter expansions in output of sed_double_quote_subst that # were '\'-ed in input to the same. If an odd number of '\' preceded a # '$' in input to sed_double_quote_subst, that '$' was protected from # expansion. Since each input '\' is now two '\'s, look for any number # of runs of four '\'s followed by two '\'s and then a '$'. '\' that '$'. _G_bs='\\' _G_bs2='\\\\' _G_bs4='\\\\\\\\' _G_dollar='\$' sed_double_backslash="\ s/$_G_bs4/&\\ /g s/^$_G_bs2$_G_dollar/$_G_bs&/ s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g s/\n//g" ## ----------------- ## ## Global variables. ## ## ----------------- ## # Except for the global variables explicitly listed below, the following # functions in the '^func_' namespace, and the '^require_' namespace # variables initialised in the 'Resource management' section, sourcing # this file will not pollute your global namespace with anything # else. There's no portable way to scope variables in Bourne shell # though, so actually running these functions will sometimes place # results into a variable named after the function, and often use # temporary variables in the '^_G_' namespace. If you are careful to # avoid using those namespaces casually in your sourcing script, things # should continue to work as you expect. And, of course, you can freely # overwrite any of the functions or variables defined here before # calling anything to customize them. EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. # Allow overriding, eg assuming that you follow the convention of # putting '$debug_cmd' at the start of all your functions, you can get # bash to show function call trace with: # # debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name debug_cmd=${debug_cmd-":"} exit_cmd=: # By convention, finish your script with: # # exit $exit_status # # so that you can set exit_status to non-zero if you want to indicate # something went wrong during execution without actually bailing out at # the point of failure. exit_status=$EXIT_SUCCESS # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh # is ksh but when the shell is invoked as "sh" and the current value of # the _XPG environment variable is not equal to 1 (one), the special # positional parameter $0, within a function call, is the name of the # function. progpath=$0 # The name of this program. progname=`$ECHO "$progpath" |$SED "$sed_basename"` # Make sure we have an absolute progpath for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=`$ECHO "$progpath" |$SED "$sed_dirname"` progdir=`cd "$progdir" && pwd` progpath=$progdir/$progname ;; *) _G_IFS=$IFS IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS=$_G_IFS test -x "$progdir/$progname" && break done IFS=$_G_IFS test -n "$progdir" || progdir=`pwd` progpath=$progdir/$progname ;; esac ## ----------------- ## ## Standard options. ## ## ----------------- ## # The following options affect the operation of the functions defined # below, and should be set appropriately depending on run-time para- # meters passed on the command line. opt_dry_run=false opt_quiet=false opt_verbose=false # Categories 'all' and 'none' are always available. Append any others # you will pass as the first argument to func_warning from your own # code. warning_categories= # By default, display warnings according to 'opt_warning_types'. Set # 'warning_func' to ':' to elide all warnings, or func_fatal_error to # treat the next displayed warning as a fatal error. warning_func=func_warn_and_continue # Set to 'all' to display all warnings, 'none' to suppress all # warnings, or a space delimited list of some subset of # 'warning_categories' to display only the listed warnings. opt_warning_types=all ## -------------------- ## ## Resource management. ## ## -------------------- ## # This section contains definitions for functions that each ensure a # particular resource (a file, or a non-empty configuration variable for # example) is available, and if appropriate to extract default values # from pertinent package files. Call them using their associated # 'require_*' variable to ensure that they are executed, at most, once. # # It's entirely deliberate that calling these functions can set # variables that don't obey the namespace limitations obeyed by the rest # of this file, in order that that they be as useful as possible to # callers. # require_term_colors # ------------------- # Allow display of bold text on terminals that support it. require_term_colors=func_require_term_colors func_require_term_colors () { $debug_cmd test -t 1 && { # COLORTERM and USE_ANSI_COLORS environment variables take # precedence, because most terminfo databases neglect to describe # whether color sequences are supported. test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"} if test 1 = "$USE_ANSI_COLORS"; then # Standard ANSI escape sequences tc_reset='' tc_bold=''; tc_standout='' tc_red=''; tc_green='' tc_blue=''; tc_cyan='' else # Otherwise trust the terminfo database after all. test -n "`tput sgr0 2>/dev/null`" && { tc_reset=`tput sgr0` test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold` tc_standout=$tc_bold test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso` test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1` test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2` test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4` test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5` } fi } require_term_colors=: } ## ----------------- ## ## Function library. ## ## ----------------- ## # This section contains a variety of useful functions to call in your # scripts. Take note of the portable wrappers for features provided by # some modern shells, which will fall back to slower equivalents on # less featureful shells. # func_append VAR VALUE # --------------------- # Append VALUE onto the existing contents of VAR. # We should try to minimise forks, especially on Windows where they are # unreasonably slow, so skip the feature probes when bash or zsh are # being used: if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then : ${_G_HAVE_ARITH_OP="yes"} : ${_G_HAVE_XSI_OPS="yes"} # The += operator was introduced in bash 3.1 case $BASH_VERSION in [12].* | 3.0 | 3.0*) ;; *) : ${_G_HAVE_PLUSEQ_OP="yes"} ;; esac fi # _G_HAVE_PLUSEQ_OP # Can be empty, in which case the shell is probed, "yes" if += is # useable or anything else if it does not work. test -z "$_G_HAVE_PLUSEQ_OP" \ && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \ && _G_HAVE_PLUSEQ_OP=yes if test yes = "$_G_HAVE_PLUSEQ_OP" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_append () { $debug_cmd eval "$1+=\$2" }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_append () { $debug_cmd eval "$1=\$$1\$2" } fi # func_append_quoted VAR VALUE # ---------------------------- # Quote VALUE and append to the end of shell variable VAR, separated # by a space. if test yes = "$_G_HAVE_PLUSEQ_OP"; then eval 'func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1+=\\ \$func_quote_for_eval_result" }' else func_append_quoted () { $debug_cmd func_quote_for_eval "$2" eval "$1=\$$1\\ \$func_quote_for_eval_result" } fi # func_append_uniq VAR VALUE # -------------------------- # Append unique VALUE onto the existing contents of VAR, assuming # entries are delimited by the first character of VALUE. For example: # # func_append_uniq options " --another-option option-argument" # # will only append to $options if " --another-option option-argument " # is not already present somewhere in $options already (note spaces at # each end implied by leading space in second argument). func_append_uniq () { $debug_cmd eval _G_current_value='`$ECHO $'$1'`' _G_delim=`expr "$2" : '\(.\)'` case $_G_delim$_G_current_value$_G_delim in *"$2$_G_delim"*) ;; *) func_append "$@" ;; esac } # func_arith TERM... # ------------------ # Set func_arith_result to the result of evaluating TERMs. test -z "$_G_HAVE_ARITH_OP" \ && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \ && _G_HAVE_ARITH_OP=yes if test yes = "$_G_HAVE_ARITH_OP"; then eval 'func_arith () { $debug_cmd func_arith_result=$(( $* )) }' else func_arith () { $debug_cmd func_arith_result=`expr "$@"` } fi # func_basename FILE # ------------------ # Set func_basename_result to FILE with everything up to and including # the last / stripped. if test yes = "$_G_HAVE_XSI_OPS"; then # If this shell supports suffix pattern removal, then use it to avoid # forking. Hide the definitions single quotes in case the shell chokes # on unsupported syntax... _b='func_basename_result=${1##*/}' _d='case $1 in */*) func_dirname_result=${1%/*}$2 ;; * ) func_dirname_result=$3 ;; esac' else # ...otherwise fall back to using sed. _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`' _d='func_dirname_result=`$ECHO "$1" |$SED "$sed_dirname"` if test "X$func_dirname_result" = "X$1"; then func_dirname_result=$3 else func_append func_dirname_result "$2" fi' fi eval 'func_basename () { $debug_cmd '"$_b"' }' # func_dirname FILE APPEND NONDIR_REPLACEMENT # ------------------------------------------- # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. eval 'func_dirname () { $debug_cmd '"$_d"' }' # func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT # -------------------------------------------------------- # Perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # For efficiency, we do not delegate to the functions above but instead # duplicate the functionality here. eval 'func_dirname_and_basename () { $debug_cmd '"$_b"' '"$_d"' }' # func_echo ARG... # ---------------- # Echo program name prefixed message. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname: $_G_line" done IFS=$func_echo_IFS } # func_echo_all ARG... # -------------------- # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_echo_infix_1 INFIX ARG... # ------------------------------ # Echo program name, followed by INFIX on the first line, with any # additional lines not showing INFIX. func_echo_infix_1 () { $debug_cmd $require_term_colors _G_infix=$1; shift _G_indent=$_G_infix _G_prefix="$progname: $_G_infix: " _G_message=$* # Strip color escape sequences before counting printable length for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan" do test -n "$_G_tc" && { _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"` _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"` } done _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`" " ## exclude from sc_prohibit_nested_quotes func_echo_infix_1_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_infix_1_IFS $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2 _G_prefix=$_G_indent done IFS=$func_echo_infix_1_IFS } # func_error ARG... # ----------------- # Echo program name prefixed message to standard error. func_error () { $debug_cmd $require_term_colors func_echo_infix_1 " $tc_standout${tc_red}error$tc_reset" "$*" >&2 } # func_fatal_error ARG... # ----------------------- # Echo program name prefixed message to standard error, and exit. func_fatal_error () { $debug_cmd func_error "$*" exit $EXIT_FAILURE } # func_grep EXPRESSION FILENAME # ----------------------------- # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $debug_cmd $GREP "$1" "$2" >/dev/null 2>&1 } # func_len STRING # --------------- # Set func_len_result to the length of STRING. STRING may not # start with a hyphen. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_len () { $debug_cmd func_len_result=${#1} }' else func_len () { $debug_cmd func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len` } fi # func_mkdir_p DIRECTORY-PATH # --------------------------- # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { $debug_cmd _G_directory_path=$1 _G_dir_list= if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then # Protect directory names starting with '-' case $_G_directory_path in -*) _G_directory_path=./$_G_directory_path ;; esac # While some portion of DIR does not yet exist... while test ! -d "$_G_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. _G_dir_list=$_G_directory_path:$_G_dir_list # If the last portion added has no slash in it, the list is done case $_G_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"` done _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'` func_mkdir_p_IFS=$IFS; IFS=: for _G_dir in $_G_dir_list; do IFS=$func_mkdir_p_IFS # mkdir can fail with a 'File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$_G_dir" 2>/dev/null || : done IFS=$func_mkdir_p_IFS # Bail out if we (or some other process) failed to create a directory. test -d "$_G_directory_path" || \ func_fatal_error "Failed to create '$1'" fi } # func_mktempdir [BASENAME] # ------------------------- # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, BASENAME is the basename for that directory. func_mktempdir () { $debug_cmd _G_template=${TMPDIR-/tmp}/${1-$progname} if test : = "$opt_dry_run"; then # Return a directory name, but don't create it in dry-run mode _G_tmpdir=$_G_template-$$ else # If mktemp works, use that first and foremost _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null` if test ! -d "$_G_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race _G_tmpdir=$_G_template-${RANDOM-0}$$ func_mktempdir_umask=`umask` umask 0077 $MKDIR "$_G_tmpdir" umask $func_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$_G_tmpdir" || \ func_fatal_error "cannot create temporary directory '$_G_tmpdir'" fi $ECHO "$_G_tmpdir" } # func_normal_abspath PATH # ------------------------ # Remove doubled-up and trailing slashes, "." path components, # and cancel out any ".." path components in PATH after making # it an absolute path. func_normal_abspath () { $debug_cmd # These SED scripts presuppose an absolute path with a trailing slash. _G_pathcar='s|^/\([^/]*\).*$|\1|' _G_pathcdr='s|^/[^/]*||' _G_removedotparts=':dotsl s|/\./|/|g t dotsl s|/\.$|/|' _G_collapseslashes='s|/\{1,\}|/|g' _G_finalslash='s|/*$|/|' # Start from root dir and reassemble the path. func_normal_abspath_result= func_normal_abspath_tpath=$1 func_normal_abspath_altnamespace= case $func_normal_abspath_tpath in "") # Empty path, that just means $cwd. func_stripname '' '/' "`pwd`" func_normal_abspath_result=$func_stripname_result return ;; # The next three entries are used to spot a run of precisely # two leading slashes without using negated character classes; # we take advantage of case's first-match behaviour. ///*) # Unusual form of absolute path, do nothing. ;; //*) # Not necessarily an ordinary path; POSIX reserves leading '//' # and for example Cygwin uses it to access remote file shares # over CIFS/SMB, so we conserve a leading double slash if found. func_normal_abspath_altnamespace=/ ;; /*) # Absolute path, do nothing. ;; *) # Relative path, prepend $cwd. func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath ;; esac # Cancel out all the simple stuff to save iterations. We also want # the path to end with a slash for ease of parsing, so make sure # there is one (and only one) here. func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"` while :; do # Processed it all yet? if test / = "$func_normal_abspath_tpath"; then # If we ascended to the root using ".." the result may be empty now. if test -z "$func_normal_abspath_result"; then func_normal_abspath_result=/ fi break fi func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$_G_pathcdr"` # Figure out what to do with it case $func_normal_abspath_tcomponent in "") # Trailing empty path component, ignore it. ;; ..) # Parent dir; strip last assembled component from result. func_dirname "$func_normal_abspath_result" func_normal_abspath_result=$func_dirname_result ;; *) # Actual path component, append it. func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent" ;; esac done # Restore leading double-slash if one was found on entry. func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result } # func_notquiet ARG... # -------------------- # Echo program name prefixed message only when not in quiet mode. func_notquiet () { $debug_cmd $opt_quiet || func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_relative_path SRCDIR DSTDIR # -------------------------------- # Set func_relative_path_result to the relative path from SRCDIR to DSTDIR. func_relative_path () { $debug_cmd func_relative_path_result= func_normal_abspath "$1" func_relative_path_tlibdir=$func_normal_abspath_result func_normal_abspath "$2" func_relative_path_tbindir=$func_normal_abspath_result # Ascend the tree starting from libdir while :; do # check if we have found a prefix of bindir case $func_relative_path_tbindir in $func_relative_path_tlibdir) # found an exact match func_relative_path_tcancelled= break ;; $func_relative_path_tlibdir*) # found a matching prefix func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" func_relative_path_tcancelled=$func_stripname_result if test -z "$func_relative_path_result"; then func_relative_path_result=. fi break ;; *) func_dirname $func_relative_path_tlibdir func_relative_path_tlibdir=$func_dirname_result if test -z "$func_relative_path_tlibdir"; then # Have to descend all the way to the root! func_relative_path_result=../$func_relative_path_result func_relative_path_tcancelled=$func_relative_path_tbindir break fi func_relative_path_result=../$func_relative_path_result ;; esac done # Now calculate path; take care to avoid doubling-up slashes. func_stripname '' '/' "$func_relative_path_result" func_relative_path_result=$func_stripname_result func_stripname '/' '/' "$func_relative_path_tcancelled" if test -n "$func_stripname_result"; then func_append func_relative_path_result "/$func_stripname_result" fi # Normalisation. If bindir is libdir, return '.' else relative path. if test -n "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result" func_relative_path_result=$func_stripname_result fi test -n "$func_relative_path_result" || func_relative_path_result=. : } # func_quote_for_eval ARG... # -------------------------- # Aesthetically quote ARGs to be evaled later. # This function returns two values: # i) func_quote_for_eval_result # double-quoted, suitable for a subsequent eval # ii) func_quote_for_eval_unquoted_result # has all characters that are still active within double # quotes backslashified. func_quote_for_eval () { $debug_cmd func_quote_for_eval_unquoted_result= func_quote_for_eval_result= while test 0 -lt $#; do case $1 in *[\\\`\"\$]*) _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;; *) _G_unquoted_arg=$1 ;; esac if test -n "$func_quote_for_eval_unquoted_result"; then func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg" else func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg" fi case $_G_unquoted_arg in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and variable expansion # for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_quoted_arg=\"$_G_unquoted_arg\" ;; *) _G_quoted_arg=$_G_unquoted_arg ;; esac if test -n "$func_quote_for_eval_result"; then func_append func_quote_for_eval_result " $_G_quoted_arg" else func_append func_quote_for_eval_result "$_G_quoted_arg" fi shift done } # func_quote_for_expand ARG # ------------------------- # Aesthetically quote ARG to be evaled later; same as above, # but do not quote variable references. func_quote_for_expand () { $debug_cmd case $1 in *[\\\`\"]*) _G_arg=`$ECHO "$1" | $SED \ -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;; *) _G_arg=$1 ;; esac case $_G_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") _G_arg=\"$_G_arg\" ;; esac func_quote_for_expand_result=$_G_arg } # func_stripname PREFIX SUFFIX NAME # --------------------------------- # strip PREFIX and SUFFIX from NAME, and store in func_stripname_result. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_stripname () { $debug_cmd # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary variable first. func_stripname_result=$3 func_stripname_result=${func_stripname_result#"$1"} func_stripname_result=${func_stripname_result%"$2"} }' else func_stripname () { $debug_cmd case $2 in .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;; *) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;; esac } fi # func_show_eval CMD [FAIL_EXP] # ----------------------------- # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} func_quote_for_expand "$_G_cmd" eval "func_notquiet $func_quote_for_expand_result" $opt_dry_run || { eval "$_G_cmd" _G_status=$? if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_show_eval_locale CMD [FAIL_EXP] # ------------------------------------ # Unless opt_quiet is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { $debug_cmd _G_cmd=$1 _G_fail_exp=${2-':'} $opt_quiet || { func_quote_for_expand "$_G_cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || { eval "$_G_user_locale $_G_cmd" _G_status=$? eval "$_G_safe_locale" if test 0 -ne "$_G_status"; then eval "(exit $_G_status); $_G_fail_exp" fi } } # func_tr_sh # ---------- # Turn $1 into a string suitable for a shell variable name. # Result is stored in $func_tr_sh_result. All characters # not in the set a-zA-Z0-9_ are replaced with '_'. Further, # if $1 begins with a digit, a '_' is prepended as well. func_tr_sh () { $debug_cmd case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_verbose ARG... # ------------------- # Echo program name prefixed message in verbose mode only. func_verbose () { $debug_cmd $opt_verbose && func_echo "$*" : } # func_warn_and_continue ARG... # ----------------------------- # Echo program name prefixed warning message to standard error. func_warn_and_continue () { $debug_cmd $require_term_colors func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2 } # func_warning CATEGORY ARG... # ---------------------------- # Echo program name prefixed warning message to standard error. Warning # messages can be filtered according to CATEGORY, where this function # elides messages where CATEGORY is not listed in the global variable # 'opt_warning_types'. func_warning () { $debug_cmd # CATEGORY must be in the warning_categories list! case " $warning_categories " in *" $1 "*) ;; *) func_internal_error "invalid warning category '$1'" ;; esac _G_category=$1 shift case " $opt_warning_types " in *" $_G_category "*) $warning_func ${1+"$@"} ;; esac } # func_sort_ver VER1 VER2 # ----------------------- # 'sort -V' is not generally available. # Note this deviates from the version comparison in automake # in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a # but this should suffice as we won't be specifying old # version formats or redundant trailing .0 in bootstrap.conf. # If we did want full compatibility then we should probably # use m4_version_compare from autoconf. func_sort_ver () { $debug_cmd printf '%s\n%s\n' "$1" "$2" \ | sort -t. -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n } # func_lt_ver PREV CURR # --------------------- # Return true if PREV and CURR are in the correct order according to # func_sort_ver, otherwise false. Use it like this: # # func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..." func_lt_ver () { $debug_cmd test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q` } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: #! /bin/sh # Set a version string for this script. scriptversion=2014-01-07.03; # UTC # A portable, pluggable option parser for Bourne shell. # Written by Gary V. Vaughan, 2010 # Copyright (C) 2010-2015 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # Please report bugs or propose patches to gary@gnu.org. ## ------ ## ## Usage. ## ## ------ ## # This file is a library for parsing options in your shell scripts along # with assorted other useful supporting features that you can make use # of too. # # For the simplest scripts you might need only: # # #!/bin/sh # . relative/path/to/funclib.sh # . relative/path/to/options-parser # scriptversion=1.0 # func_options ${1+"$@"} # eval set dummy "$func_options_result"; shift # ...rest of your script... # # In order for the '--version' option to work, you will need to have a # suitably formatted comment like the one at the top of this file # starting with '# Written by ' and ending with '# warranty; '. # # For '-h' and '--help' to work, you will also need a one line # description of your script's purpose in a comment directly above the # '# Written by ' line, like the one at the top of this file. # # The default options also support '--debug', which will turn on shell # execution tracing (see the comment above debug_cmd below for another # use), and '--verbose' and the func_verbose function to allow your script # to display verbose messages only when your user has specified # '--verbose'. # # After sourcing this file, you can plug processing for additional # options by amending the variables from the 'Configuration' section # below, and following the instructions in the 'Option parsing' # section further down. ## -------------- ## ## Configuration. ## ## -------------- ## # You should override these variables in your script after sourcing this # file so that they reflect the customisations you have added to the # option parser. # The usage line for option parsing errors and the start of '-h' and # '--help' output messages. You can embed shell variables for delayed # expansion at the time the message is displayed, but you will need to # quote other shell meta-characters carefully to prevent them being # expanded when the contents are evaled. usage='$progpath [OPTION]...' # Short help message in response to '-h' and '--help'. Add to this or # override it after sourcing this library to reflect the full set of # options your script accepts. usage_message="\ --debug enable verbose shell tracing -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -v, --verbose verbosely report processing --version print version information and exit -h, --help print short or long help message and exit " # Additional text appended to 'usage_message' in response to '--help'. long_help_message=" Warning categories include: 'all' show all warnings 'none' turn off all the warnings 'error' warnings are treated as fatal errors" # Help message printed before fatal option parsing errors. fatal_help="Try '\$progname --help' for more information." ## ------------------------- ## ## Hook function management. ## ## ------------------------- ## # This section contains functions for adding, removing, and running hooks # to the main code. A hook is just a named list of of function, that can # be run in order later on. # func_hookable FUNC_NAME # ----------------------- # Declare that FUNC_NAME will run hooks added with # 'func_add_hook FUNC_NAME ...'. func_hookable () { $debug_cmd func_append hookable_fns " $1" } # func_add_hook FUNC_NAME HOOK_FUNC # --------------------------------- # Request that FUNC_NAME call HOOK_FUNC before it returns. FUNC_NAME must # first have been declared "hookable" by a call to 'func_hookable'. func_add_hook () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not accept hook functions." ;; esac eval func_append ${1}_hooks '" $2"' } # func_remove_hook FUNC_NAME HOOK_FUNC # ------------------------------------ # Remove HOOK_FUNC from the list of functions called by FUNC_NAME. func_remove_hook () { $debug_cmd eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`' } # func_run_hooks FUNC_NAME [ARG]... # --------------------------------- # Run all hook functions registered to FUNC_NAME. # It is assumed that the list of hook functions contains nothing more # than a whitespace-delimited list of legal shell function names, and # no effort is wasted trying to catch shell meta-characters or preserve # whitespace. func_run_hooks () { $debug_cmd case " $hookable_fns " in *" $1 "*) ;; *) func_fatal_error "'$1' does not support hook funcions.n" ;; esac eval _G_hook_fns=\$$1_hooks; shift for _G_hook in $_G_hook_fns; do eval $_G_hook '"$@"' # store returned options list back into positional # parameters for next 'cmd' execution. eval _G_hook_result=\$${_G_hook}_result eval set dummy "$_G_hook_result"; shift done func_quote_for_eval ${1+"$@"} func_run_hooks_result=$func_quote_for_eval_result } ## --------------- ## ## Option parsing. ## ## --------------- ## # In order to add your own option parsing hooks, you must accept the # full positional parameter list in your hook function, remove any # options that you action, and then pass back the remaining unprocessed # options in '_result', escaped suitably for # 'eval'. Like this: # # my_options_prep () # { # $debug_cmd # # # Extend the existing usage message. # usage_message=$usage_message' # -s, --silent don'\''t print informational messages # ' # # func_quote_for_eval ${1+"$@"} # my_options_prep_result=$func_quote_for_eval_result # } # func_add_hook func_options_prep my_options_prep # # # my_silent_option () # { # $debug_cmd # # # Note that for efficiency, we parse as many options as we can # # recognise in a loop before passing the remainder back to the # # caller on the first unrecognised argument we encounter. # while test $# -gt 0; do # opt=$1; shift # case $opt in # --silent|-s) opt_silent=: ;; # # Separate non-argument short options: # -s*) func_split_short_opt "$_G_opt" # set dummy "$func_split_short_opt_name" \ # "-$func_split_short_opt_arg" ${1+"$@"} # shift # ;; # *) set dummy "$_G_opt" "$*"; shift; break ;; # esac # done # # func_quote_for_eval ${1+"$@"} # my_silent_option_result=$func_quote_for_eval_result # } # func_add_hook func_parse_options my_silent_option # # # my_option_validation () # { # $debug_cmd # # $opt_silent && $opt_verbose && func_fatal_help "\ # '--silent' and '--verbose' options are mutually exclusive." # # func_quote_for_eval ${1+"$@"} # my_option_validation_result=$func_quote_for_eval_result # } # func_add_hook func_validate_options my_option_validation # # You'll alse need to manually amend $usage_message to reflect the extra # options you parse. It's preferable to append if you can, so that # multiple option parsing hooks can be added safely. # func_options [ARG]... # --------------------- # All the functions called inside func_options are hookable. See the # individual implementations for details. func_hookable func_options func_options () { $debug_cmd func_options_prep ${1+"$@"} eval func_parse_options \ ${func_options_prep_result+"$func_options_prep_result"} eval func_validate_options \ ${func_parse_options_result+"$func_parse_options_result"} eval func_run_hooks func_options \ ${func_validate_options_result+"$func_validate_options_result"} # save modified positional parameters for caller func_options_result=$func_run_hooks_result } # func_options_prep [ARG]... # -------------------------- # All initialisations required before starting the option parse loop. # Note that when calling hook functions, we pass through the list of # positional parameters. If a hook function modifies that list, and # needs to propogate that back to rest of this script, then the complete # modified list must be put in 'func_run_hooks_result' before # returning. func_hookable func_options_prep func_options_prep () { $debug_cmd # Option defaults: opt_verbose=false opt_warning_types= func_run_hooks func_options_prep ${1+"$@"} # save modified positional parameters for caller func_options_prep_result=$func_run_hooks_result } # func_parse_options [ARG]... # --------------------------- # The main option parsing loop. func_hookable func_parse_options func_parse_options () { $debug_cmd func_parse_options_result= # this just eases exit handling while test $# -gt 0; do # Defer to hook functions for initial option parsing, so they # get priority in the event of reusing an option name. func_run_hooks func_parse_options ${1+"$@"} # Adjust func_parse_options positional parameters to match eval set dummy "$func_run_hooks_result"; shift # Break out of the loop if we already parsed every option. test $# -gt 0 || break _G_opt=$1 shift case $_G_opt in --debug|-x) debug_cmd='set -x' func_echo "enabling shell trace mode" $debug_cmd ;; --no-warnings|--no-warning|--no-warn) set dummy --warnings none ${1+"$@"} shift ;; --warnings|--warning|-W) test $# = 0 && func_missing_arg $_G_opt && break case " $warning_categories $1" in *" $1 "*) # trailing space prevents matching last $1 above func_append_uniq opt_warning_types " $1" ;; *all) opt_warning_types=$warning_categories ;; *none) opt_warning_types=none warning_func=: ;; *error) opt_warning_types=$warning_categories warning_func=func_fatal_error ;; *) func_fatal_error \ "unsupported warning category: '$1'" ;; esac shift ;; --verbose|-v) opt_verbose=: ;; --version) func_version ;; -\?|-h) func_usage ;; --help) func_help ;; # Separate optargs to long options (plugins may need this): --*=*) func_split_equals "$_G_opt" set dummy "$func_split_equals_lhs" \ "$func_split_equals_rhs" ${1+"$@"} shift ;; # Separate optargs to short options: -W*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "$func_split_short_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-v*|-x*) func_split_short_opt "$_G_opt" set dummy "$func_split_short_opt_name" \ "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognised option: '$_G_opt'" ;; *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} func_parse_options_result=$func_quote_for_eval_result } # func_validate_options [ARG]... # ------------------------------ # Perform any sanity checks on option settings and/or unconsumed # arguments. func_hookable func_validate_options func_validate_options () { $debug_cmd # Display all warnings if -W was not given. test -n "$opt_warning_types" || opt_warning_types=" $warning_categories" func_run_hooks func_validate_options ${1+"$@"} # Bail if the options were screwed! $exit_cmd $EXIT_FAILURE # save modified positional parameters for caller func_validate_options_result=$func_run_hooks_result } ## ----------------- ## ## Helper functions. ## ## ----------------- ## # This section contains the helper functions used by the rest of the # hookable option parser framework in ascii-betical order. # func_fatal_help ARG... # ---------------------- # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { $debug_cmd eval \$ECHO \""Usage: $usage"\" eval \$ECHO \""$fatal_help"\" func_error ${1+"$@"} exit $EXIT_FAILURE } # func_help # --------- # Echo long help message to standard output and exit. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message" exit 0 } # func_missing_arg ARGNAME # ------------------------ # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $debug_cmd func_error "Missing argument for '$1'." exit_cmd=exit } # func_split_equals STRING # ------------------------ # Set func_split_equals_lhs and func_split_equals_rhs shell variables after # splitting STRING at the '=' sign. test -z "$_G_HAVE_XSI_OPS" \ && (eval 'x=a/b/c; test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \ && _G_HAVE_XSI_OPS=yes if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_equals () { $debug_cmd func_split_equals_lhs=${1%%=*} func_split_equals_rhs=${1#*=} test "x$func_split_equals_lhs" = "x$1" \ && func_split_equals_rhs= }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_equals () { $debug_cmd func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'` func_split_equals_rhs= test "x$func_split_equals_lhs" = "x$1" \ || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'` } fi #func_split_equals # func_split_short_opt SHORTOPT # ----------------------------- # Set func_split_short_opt_name and func_split_short_opt_arg shell # variables after splitting SHORTOPT after the 2nd character. if test yes = "$_G_HAVE_XSI_OPS" then # This is an XSI compatible shell, allowing a faster implementation... eval 'func_split_short_opt () { $debug_cmd func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"} }' else # ...otherwise fall back to using expr, which is often a shell builtin. func_split_short_opt () { $debug_cmd func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'` func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'` } fi #func_split_short_opt # func_usage # ---------- # Echo short help message to standard output and exit. func_usage () { $debug_cmd func_usage_message $ECHO "Run '$progname --help |${PAGER-more}' for full usage" exit 0 } # func_usage_message # ------------------ # Echo short help message to standard output. func_usage_message () { $debug_cmd eval \$ECHO \""Usage: $usage"\" echo $SED -n 's|^# || /^Written by/{ x;p;x } h /^Written by/q' < "$progpath" echo eval \$ECHO \""$usage_message"\" } # func_version # ------------ # Echo version message to standard output and exit. func_version () { $debug_cmd printf '%s\n' "$progname $scriptversion" $SED -n ' /(C)/!b go :more /\./!{ N s|\n# | | b more } :go /^# Written by /,/# warranty; / { s|^# || s|^# *$|| s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2| p } /^# Written by / { s|^# || p } /^warranty; /q' < "$progpath" exit $? } # Local variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC" # time-stamp-time-zone: "UTC" # End: # Set a version string. scriptversion='(GNU libtool) 2.4.6' # func_echo ARG... # ---------------- # Libtool also displays the current mode in messages, so override # funclib.sh func_echo with this custom definition. func_echo () { $debug_cmd _G_message=$* func_echo_IFS=$IFS IFS=$nl for _G_line in $_G_message; do IFS=$func_echo_IFS $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line" done IFS=$func_echo_IFS } # func_warning ARG... # ------------------- # Libtool warnings are not categorized, so override funclib.sh # func_warning with this simpler definition. func_warning () { $debug_cmd $warning_func ${1+"$@"} } ## ---------------- ## ## Options parsing. ## ## ---------------- ## # Hook in the functions to make sure our own options are parsed during # the option parsing loop. usage='$progpath [OPTION]... [MODE-ARG]...' # Short help message in response to '-h'. usage_message="Options: --config show all configuration variables --debug enable verbose shell tracing -n, --dry-run display commands without modifying any files --features display basic configuration information and exit --mode=MODE use operation mode MODE --no-warnings equivalent to '-Wnone' --preserve-dup-deps don't remove duplicate dependency libraries --quiet, --silent don't print informational messages --tag=TAG use configuration variables from tag TAG -v, --verbose print more informational messages than default --version print version information -W, --warnings=CATEGORY report the warnings falling in CATEGORY [all] -h, --help, --help-all print short, long, or detailed help message " # Additional text appended to 'usage_message' in response to '--help'. func_help () { $debug_cmd func_usage_message $ECHO "$long_help_message MODE must be one of the following: clean remove files from the build directory compile compile a source file into a libtool object execute automatically set library path, then run a program finish complete the installation of libtool libraries install install libraries or executables link create a library or an executable uninstall remove libraries from an installed directory MODE-ARGS vary depending on the MODE. When passed as first option, '--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that. Try '$progname --help --mode=MODE' for a more detailed description of MODE. When reporting a bug, please describe a test case to reproduce it and include the following information: host-triplet: $host shell: $SHELL compiler: $LTCC compiler flags: $LTCFLAGS linker: $LD (gnu? $with_gnu_ld) version: $progname (GNU libtool) 2.4.6 automake: `($AUTOMAKE --version) 2>/dev/null |$SED 1q` autoconf: `($AUTOCONF --version) 2>/dev/null |$SED 1q` Report bugs to . GNU libtool home page: . General help using GNU software: ." exit 0 } # func_lo2o OBJECT-NAME # --------------------- # Transform OBJECT-NAME from a '.lo' suffix to the platform specific # object suffix. lo2o=s/\\.lo\$/.$objext/ o2lo=s/\\.$objext\$/.lo/ if test yes = "$_G_HAVE_XSI_OPS"; then eval 'func_lo2o () { case $1 in *.lo) func_lo2o_result=${1%.lo}.$objext ;; * ) func_lo2o_result=$1 ;; esac }' # func_xform LIBOBJ-OR-SOURCE # --------------------------- # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise) # suffix to a '.lo' libtool-object suffix. eval 'func_xform () { func_xform_result=${1%.*}.lo }' else # ...otherwise fall back to using sed. func_lo2o () { func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"` } func_xform () { func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'` } fi # func_fatal_configuration ARG... # ------------------------------- # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func__fatal_error ${1+"$@"} \ "See the $PACKAGE documentation for more information." \ "Fatal configuration error." } # func_config # ----------- # Display the configuration for all the tags in this script. func_config () { re_begincf='^# ### BEGIN LIBTOOL' re_endcf='^# ### END LIBTOOL' # Default configuration. $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" # Now print the configurations for the tags. for tagname in $taglist; do $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" done exit $? } # func_features # ------------- # Display the features supported by this script. func_features () { echo "host: $host" if test yes = "$build_libtool_libs"; then echo "enable shared libraries" else echo "disable shared libraries" fi if test yes = "$build_old_libs"; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # func_enable_tag TAGNAME # ----------------------- # Verify that TAGNAME is valid, and either flag an error and exit, or # enable the TAGNAME tag. We also add TAGNAME to the global $taglist # variable here. func_enable_tag () { # Global variable: tagname=$1 re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" sed_extractcf=/$re_begincf/,/$re_endcf/p # Validate tagname. case $tagname in *[!-_A-Za-z0-9,/]*) func_fatal_error "invalid tag name: $tagname" ;; esac # Don't test for the "default" C tag, as we know it's # there but not specially marked. case $tagname in CC) ;; *) if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then taglist="$taglist $tagname" # Evaluate the configuration. Be careful to quote the path # and the sed script, to avoid splitting on whitespace, but # also don't use non-portable quotes within backquotes within # quotes we have to do it in 2 steps: extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` eval "$extractedcf" else func_error "ignoring unknown tag $tagname" fi ;; esac } # func_check_version_match # ------------------------ # Ensure that we are using m4 macros, and libtool script from the same # release of libtool. func_check_version_match () { if test "$package_revision" != "$macro_revision"; then if test "$VERSION" != "$macro_version"; then if test -z "$macro_version"; then cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from an older release. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, but the $progname: definition of this LT_INIT comes from $PACKAGE $macro_version. $progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION $progname: and run autoconf again. _LT_EOF fi else cat >&2 <<_LT_EOF $progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, $progname: but the definition of this LT_INIT comes from revision $macro_revision. $progname: You should recreate aclocal.m4 with macros from revision $package_revision $progname: of $PACKAGE $VERSION and run autoconf again. _LT_EOF fi exit $EXIT_MISMATCH fi } # libtool_options_prep [ARG]... # ----------------------------- # Preparation for options parsed by libtool. libtool_options_prep () { $debug_mode # Option defaults: opt_config=false opt_dlopen= opt_dry_run=false opt_help=false opt_mode= opt_preserve_dup_deps=false opt_quiet=false nonopt= preserve_args= # Shorthand for --mode=foo, only valid as the first argument case $1 in clean|clea|cle|cl) shift; set dummy --mode clean ${1+"$@"}; shift ;; compile|compil|compi|comp|com|co|c) shift; set dummy --mode compile ${1+"$@"}; shift ;; execute|execut|execu|exec|exe|ex|e) shift; set dummy --mode execute ${1+"$@"}; shift ;; finish|finis|fini|fin|fi|f) shift; set dummy --mode finish ${1+"$@"}; shift ;; install|instal|insta|inst|ins|in|i) shift; set dummy --mode install ${1+"$@"}; shift ;; link|lin|li|l) shift; set dummy --mode link ${1+"$@"}; shift ;; uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) shift; set dummy --mode uninstall ${1+"$@"}; shift ;; esac # Pass back the list of options. func_quote_for_eval ${1+"$@"} libtool_options_prep_result=$func_quote_for_eval_result } func_add_hook func_options_prep libtool_options_prep # libtool_parse_options [ARG]... # --------------------------------- # Provide handling for libtool specific options. libtool_parse_options () { $debug_cmd # Perform our own loop to consume as many options as possible in # each iteration. while test $# -gt 0; do _G_opt=$1 shift case $_G_opt in --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) func_config ;; --dlopen|-dlopen) opt_dlopen="${opt_dlopen+$opt_dlopen }$1" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) func_features ;; --finish) set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $_G_opt && break opt_mode=$1 case $1 in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $_G_opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_quiet=false func_append preserve_args " $_G_opt" ;; --no-warnings|--no-warning|--no-warn) opt_warning=false func_append preserve_args " $_G_opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $_G_opt" ;; --silent|--quiet) opt_quiet=: opt_verbose=false func_append preserve_args " $_G_opt" ;; --tag) test $# = 0 && func_missing_arg $_G_opt && break opt_tag=$1 func_append preserve_args " $_G_opt $1" func_enable_tag "$1" shift ;; --verbose|-v) opt_quiet=false opt_verbose=: func_append preserve_args " $_G_opt" ;; # An option not handled by this hook function: *) set dummy "$_G_opt" ${1+"$@"}; shift; break ;; esac done # save modified positional parameters for caller func_quote_for_eval ${1+"$@"} libtool_parse_options_result=$func_quote_for_eval_result } func_add_hook func_parse_options libtool_parse_options # libtool_validate_options [ARG]... # --------------------------------- # Perform any sanity checks on option settings and/or unconsumed # arguments. libtool_validate_options () { # save first non-option argument if test 0 -lt $#; then nonopt=$1 shift fi # preserve --debug test : = "$debug_cmd" || func_append preserve_args " --debug" case $host in # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452 # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788 *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*) # don't eliminate duplications in $postdeps and $predeps opt_duplicate_compiler_generated_deps=: ;; *) opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps ;; esac $opt_help || { # Sanity checks first: func_check_version_match test yes != "$build_libtool_libs" \ && test yes != "$build_old_libs" \ && func_fatal_configuration "not configured to build any kind of library" # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test execute != "$opt_mode"; then func_error "unrecognized option '-dlopen'" $ECHO "$help" 1>&2 exit $EXIT_FAILURE fi # Change the help message to a mode-specific one. generic_help=$help help="Try '$progname --help --mode=$opt_mode' for more information." } # Pass back the unparsed argument list func_quote_for_eval ${1+"$@"} libtool_validate_options_result=$func_quote_for_eval_result } func_add_hook func_validate_options libtool_validate_options # Process options as early as possible so that --help and --version # can return quickly. func_options ${1+"$@"} eval set dummy "$func_options_result"; shift ## ----------- ## ## Main. ## ## ----------- ## magic='%%%MAGIC variable%%%' magic_exe='%%%MAGIC EXE variable%%%' # Global variables. extracted_archives= extracted_serial=0 # If this variable is set in any of the actions, the command in it # will be execed at the end. This prevents here-documents from being # left over by shells. exec_cmd= # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # func_generated_by_libtool # True iff stdin has been generated by Libtool. This function is only # a basic sanity check; it will hardly flush out determined imposters. func_generated_by_libtool_p () { $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p } # func_lalib_unsafe_p file # True iff FILE is a libtool '.la' library or '.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if 'file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case $lalib_p_line in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test yes = "$lalib_p" } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { test -f "$1" && $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_dirname_and_basename "$1" "" "." func_stripname '' '.exe' "$func_basename_result" func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper } # func_ltwrapper_p file # True iff FILE is a libtool wrapper script or wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_p () { func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" } # func_execute_cmds commands fail_cmd # Execute tilde-delimited COMMANDS. # If FAIL_CMD is given, eval that upon failure. # FAIL_CMD may read-access the current command in variable CMD! func_execute_cmds () { $debug_cmd save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # 'FILE.' does not work on cygwin managed mounts. func_source () { $debug_cmd case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_resolve_sysroot PATH # Replace a leading = in PATH with a sysroot. Store the result into # func_resolve_sysroot_result func_resolve_sysroot () { func_resolve_sysroot_result=$1 case $func_resolve_sysroot_result in =*) func_stripname '=' '' "$func_resolve_sysroot_result" func_resolve_sysroot_result=$lt_sysroot$func_stripname_result ;; esac } # func_replace_sysroot PATH # If PATH begins with the sysroot, replace it with = and # store the result into func_replace_sysroot_result. func_replace_sysroot () { case $lt_sysroot:$1 in ?*:"$lt_sysroot"*) func_stripname "$lt_sysroot" '' "$1" func_replace_sysroot_result='='$func_stripname_result ;; *) # Including no sysroot. func_replace_sysroot_result=$1 ;; esac } # func_infer_tag arg # Infer tagged configuration to use if any are available and # if one wasn't chosen via the "--tag" command line option. # Only attempt this if the compiler in the base compile # command doesn't match the default compiler. # arg is usually of the form 'gcc ...' func_infer_tag () { $debug_cmd if test -n "$available_tags" && test -z "$tagname"; then CC_quoted= for arg in $CC; do func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case $@ in # Blanks in the command may have been stripped by the calling shell, # but not from the CC environment variable when configure was run. " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; # Blanks at the start of $base_compile will cause this to fail # if we don't check for them as well. *) for z in $available_tags; do if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then # Evaluate the configuration. eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" CC_quoted= for arg in $CC; do # Double-quote args containing other shell metacharacters. func_append_quoted CC_quoted "$arg" done CC_expanded=`func_echo_all $CC` CC_quoted_expanded=`func_echo_all $CC_quoted` case "$@ " in " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) # The compiler in the base compile command matches # the one in the tagged configuration. # Assume this is the tagged configuration we want. tagname=$z break ;; esac fi done # If $tagname still isn't set, then no tagged configuration # was found and let the user know that the "--tag" command # line option must be used. if test -z "$tagname"; then func_echo "unable to infer tagged configuration" func_fatal_error "specify a tag with '--tag'" # else # func_verbose "using $tagname tagged configuration" fi ;; esac fi } # func_write_libtool_object output_name pic_name nonpic_name # Create a libtool object file (analogous to a ".la" file), # but don't create it if we're doing a dry run. func_write_libtool_object () { write_libobj=$1 if test yes = "$build_libtool_libs"; then write_lobj=\'$2\' else write_lobj=none fi if test yes = "$build_old_libs"; then write_oldobj=\'$3\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </dev/null` if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | $SED -e "$sed_naive_backslashify"` else func_convert_core_file_wine_to_w32_result= fi fi } # end: func_convert_core_file_wine_to_w32 # func_convert_core_path_wine_to_w32 ARG # Helper function used by path conversion functions when $build is *nix, and # $host is mingw, cygwin, or some other w32 environment. Relies on a correctly # configured wine environment available, with the winepath program in $build's # $PATH. Assumes ARG has no leading or trailing path separator characters. # # ARG is path to be converted from $build format to win32. # Result is available in $func_convert_core_path_wine_to_w32_result. # Unconvertible file (directory) names in ARG are skipped; if no directory names # are convertible, then the result may be empty. func_convert_core_path_wine_to_w32 () { $debug_cmd # unfortunately, winepath doesn't convert paths, only file names func_convert_core_path_wine_to_w32_result= if test -n "$1"; then oldIFS=$IFS IFS=: for func_convert_core_path_wine_to_w32_f in $1; do IFS=$oldIFS func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" if test -n "$func_convert_core_file_wine_to_w32_result"; then if test -z "$func_convert_core_path_wine_to_w32_result"; then func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result else func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" fi fi done IFS=$oldIFS fi } # end: func_convert_core_path_wine_to_w32 # func_cygpath ARGS... # Wrapper around calling the cygpath program via LT_CYGPATH. This is used when # when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) # $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or # (2), returns the Cygwin file name or path in func_cygpath_result (input # file name or path is assumed to be in w32 format, as previously converted # from $build's *nix or MSYS format). In case (3), returns the w32 file name # or path in func_cygpath_result (input file name or path is assumed to be in # Cygwin format). Returns an empty string on error. # # ARGS are passed to cygpath, with the last one being the file name or path to # be converted. # # Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH # environment variable; do not put it in $PATH. func_cygpath () { $debug_cmd if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` if test "$?" -ne 0; then # on failure, ensure result is empty func_cygpath_result= fi else func_cygpath_result= func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'" fi } #end: func_cygpath # func_convert_core_msys_to_w32 ARG # Convert file name or path ARG from MSYS format to w32 format. Return # result in func_convert_core_msys_to_w32_result. func_convert_core_msys_to_w32 () { $debug_cmd # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"` } #end: func_convert_core_msys_to_w32 # func_convert_file_check ARG1 ARG2 # Verify that ARG1 (a file name in $build format) was converted to $host # format in ARG2. Otherwise, emit an error message, but continue (resetting # func_to_host_file_result to ARG1). func_convert_file_check () { $debug_cmd if test -z "$2" && test -n "$1"; then func_error "Could not determine host file name corresponding to" func_error " '$1'" func_error "Continuing, but uninstalled executables may not work." # Fallback: func_to_host_file_result=$1 fi } # end func_convert_file_check # func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH # Verify that FROM_PATH (a path in $build format) was converted to $host # format in TO_PATH. Otherwise, emit an error message, but continue, resetting # func_to_host_file_result to a simplistic fallback value (see below). func_convert_path_check () { $debug_cmd if test -z "$4" && test -n "$3"; then func_error "Could not determine the host path corresponding to" func_error " '$3'" func_error "Continuing, but uninstalled executables may not work." # Fallback. This is a deliberately simplistic "conversion" and # should not be "improved". See libtool.info. if test "x$1" != "x$2"; then lt_replace_pathsep_chars="s|$1|$2|g" func_to_host_path_result=`echo "$3" | $SED -e "$lt_replace_pathsep_chars"` else func_to_host_path_result=$3 fi fi } # end func_convert_path_check # func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG # Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT # and appending REPL if ORIG matches BACKPAT. func_convert_path_front_back_pathsep () { $debug_cmd case $4 in $1 ) func_to_host_path_result=$3$func_to_host_path_result ;; esac case $4 in $2 ) func_append func_to_host_path_result "$3" ;; esac } # end func_convert_path_front_back_pathsep ################################################## # $build to $host FILE NAME CONVERSION FUNCTIONS # ################################################## # invoked via '$to_host_file_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # Result will be available in $func_to_host_file_result. # func_to_host_file ARG # Converts the file name ARG from $build format to $host format. Return result # in func_to_host_file_result. func_to_host_file () { $debug_cmd $to_host_file_cmd "$1" } # end func_to_host_file # func_to_tool_file ARG LAZY # converts the file name ARG from $build format to toolchain format. Return # result in func_to_tool_file_result. If the conversion in use is listed # in (the comma separated) LAZY, no conversion takes place. func_to_tool_file () { $debug_cmd case ,$2, in *,"$to_tool_file_cmd",*) func_to_tool_file_result=$1 ;; *) $to_tool_file_cmd "$1" func_to_tool_file_result=$func_to_host_file_result ;; esac } # end func_to_tool_file # func_convert_file_noop ARG # Copy ARG to func_to_host_file_result. func_convert_file_noop () { func_to_host_file_result=$1 } # end func_convert_file_noop # func_convert_file_msys_to_w32 ARG # Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_file_result. func_convert_file_msys_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_to_host_file_result=$func_convert_core_msys_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_w32 # func_convert_file_cygwin_to_w32 ARG # Convert file name ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_file_cygwin_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # because $build is cygwin, we call "the" cygpath in $PATH; no need to use # LT_CYGPATH in this case. func_to_host_file_result=`cygpath -m "$1"` fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_cygwin_to_w32 # func_convert_file_nix_to_w32 ARG # Convert file name ARG from *nix to w32 format. Requires a wine environment # and a working winepath. Returns result in func_to_host_file_result. func_convert_file_nix_to_w32 () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_file_wine_to_w32 "$1" func_to_host_file_result=$func_convert_core_file_wine_to_w32_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_w32 # func_convert_file_msys_to_cygwin ARG # Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_file_msys_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then func_convert_core_msys_to_w32 "$1" func_cygpath -u "$func_convert_core_msys_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_msys_to_cygwin # func_convert_file_nix_to_cygwin ARG # Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed # in a wine environment, working winepath, and LT_CYGPATH set. Returns result # in func_to_host_file_result. func_convert_file_nix_to_cygwin () { $debug_cmd func_to_host_file_result=$1 if test -n "$1"; then # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. func_convert_core_file_wine_to_w32 "$1" func_cygpath -u "$func_convert_core_file_wine_to_w32_result" func_to_host_file_result=$func_cygpath_result fi func_convert_file_check "$1" "$func_to_host_file_result" } # end func_convert_file_nix_to_cygwin ############################################# # $build to $host PATH CONVERSION FUNCTIONS # ############################################# # invoked via '$to_host_path_cmd ARG' # # In each case, ARG is the path to be converted from $build to $host format. # The result will be available in $func_to_host_path_result. # # Path separators are also converted from $build format to $host format. If # ARG begins or ends with a path separator character, it is preserved (but # converted to $host format) on output. # # All path conversion functions are named using the following convention: # file name conversion function : func_convert_file_X_to_Y () # path conversion function : func_convert_path_X_to_Y () # where, for any given $build/$host combination the 'X_to_Y' value is the # same. If conversion functions are added for new $build/$host combinations, # the two new functions must follow this pattern, or func_init_to_host_path_cmd # will break. # func_init_to_host_path_cmd # Ensures that function "pointer" variable $to_host_path_cmd is set to the # appropriate value, based on the value of $to_host_file_cmd. to_host_path_cmd= func_init_to_host_path_cmd () { $debug_cmd if test -z "$to_host_path_cmd"; then func_stripname 'func_convert_file_' '' "$to_host_file_cmd" to_host_path_cmd=func_convert_path_$func_stripname_result fi } # func_to_host_path ARG # Converts the path ARG from $build format to $host format. Return result # in func_to_host_path_result. func_to_host_path () { $debug_cmd func_init_to_host_path_cmd $to_host_path_cmd "$1" } # end func_to_host_path # func_convert_path_noop ARG # Copy ARG to func_to_host_path_result. func_convert_path_noop () { func_to_host_path_result=$1 } # end func_convert_path_noop # func_convert_path_msys_to_w32 ARG # Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic # conversion to w32 is not available inside the cwrapper. Returns result in # func_to_host_path_result. func_convert_path_msys_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from ARG. MSYS # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; # and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_msys_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_msys_to_w32 # func_convert_path_cygwin_to_w32 ARG # Convert path ARG from Cygwin to w32 format. Returns result in # func_to_host_file_result. func_convert_path_cygwin_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_cygwin_to_w32 # func_convert_path_nix_to_w32 ARG # Convert path ARG from *nix to w32 format. Requires a wine environment and # a working winepath. Returns result in func_to_host_file_result. func_convert_path_nix_to_w32 () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_to_host_path_result=$func_convert_core_path_wine_to_w32_result func_convert_path_check : ";" \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" fi } # end func_convert_path_nix_to_w32 # func_convert_path_msys_to_cygwin ARG # Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. # Returns result in func_to_host_file_result. func_convert_path_msys_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # See func_convert_path_msys_to_w32: func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_msys_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_msys_to_cygwin # func_convert_path_nix_to_cygwin ARG # Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a # a wine environment, working winepath, and LT_CYGPATH set. Returns result in # func_to_host_file_result. func_convert_path_nix_to_cygwin () { $debug_cmd func_to_host_path_result=$1 if test -n "$1"; then # Remove leading and trailing path separator characters from # ARG. msys behavior is inconsistent here, cygpath turns them # into '.;' and ';.', and winepath ignores them completely. func_stripname : : "$1" func_to_host_path_tmp1=$func_stripname_result func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" func_to_host_path_result=$func_cygpath_result func_convert_path_check : : \ "$func_to_host_path_tmp1" "$func_to_host_path_result" func_convert_path_front_back_pathsep ":*" "*:" : "$1" fi } # end func_convert_path_nix_to_cygwin # func_dll_def_p FILE # True iff FILE is a Windows DLL '.def' file. # Keep in sync with _LT_DLL_DEF_P in libtool.m4 func_dll_def_p () { $debug_cmd func_dll_def_p_tmp=`$SED -n \ -e 's/^[ ]*//' \ -e '/^\(;.*\)*$/d' \ -e 's/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p' \ -e q \ "$1"` test DEF = "$func_dll_def_p_tmp" } # func_mode_compile arg... func_mode_compile () { $debug_cmd # Get the compilation command and the source file. base_compile= srcfile=$nonopt # always keep a non-empty value in "srcfile" suppress_opt=yes suppress_output= arg_mode=normal libobj= later= pie_flag= for arg do case $arg_mode in arg ) # do not "continue". Instead, add this to base_compile lastarg=$arg arg_mode=normal ;; target ) libobj=$arg arg_mode=normal continue ;; normal ) # Accept any command-line options. case $arg in -o) test -n "$libobj" && \ func_fatal_error "you cannot specify '-o' more than once" arg_mode=target continue ;; -pie | -fpie | -fPIE) func_append pie_flag " $arg" continue ;; -shared | -static | -prefer-pic | -prefer-non-pic) func_append later " $arg" continue ;; -no-suppress) suppress_opt=no continue ;; -Xcompiler) arg_mode=arg # the next one goes into the "base_compile" arg list continue # The current "srcfile" will either be retained or ;; # replaced later. I would guess that would be a bug. -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result lastarg= save_ifs=$IFS; IFS=, for arg in $args; do IFS=$save_ifs func_append_quoted lastarg "$arg" done IFS=$save_ifs func_stripname ' ' '' "$lastarg" lastarg=$func_stripname_result # Add the arguments to base_compile. func_append base_compile " $lastarg" continue ;; *) # Accept the current argument as the source file. # The previous "srcfile" becomes the current argument. # lastarg=$srcfile srcfile=$arg ;; esac # case $arg ;; esac # case $arg_mode # Aesthetically quote the previous argument. func_append_quoted base_compile "$lastarg" done # for arg case $arg_mode in arg) func_fatal_error "you must specify an argument for -Xcompile" ;; target) func_fatal_error "you must specify a target with '-o'" ;; *) # Get the name of the library object. test -z "$libobj" && { func_basename "$srcfile" libobj=$func_basename_result } ;; esac # Recognize several different file suffixes. # If the user specifies -o file.o, it is replaced with file.lo case $libobj in *.[cCFSifmso] | \ *.ada | *.adb | *.ads | *.asm | \ *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup) func_xform "$libobj" libobj=$func_xform_result ;; esac case $libobj in *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; *) func_fatal_error "cannot determine name of library object from '$libobj'" ;; esac func_infer_tag $base_compile for arg in $later; do case $arg in -shared) test yes = "$build_libtool_libs" \ || func_fatal_configuration "cannot build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -prefer-pic) pic_mode=yes continue ;; -prefer-non-pic) pic_mode=no continue ;; esac done func_quote_for_eval "$libobj" test "X$libobj" != "X$func_quote_for_eval_result" \ && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ && func_warning "libobj name '$libobj' may not contain shell special characters." func_dirname_and_basename "$obj" "/" "" objname=$func_basename_result xdir=$func_dirname_result lobj=$xdir$objdir/$objname test -z "$base_compile" && \ func_fatal_help "you must specify a compilation command" # Delete any leftover library objects. if test yes = "$build_old_libs"; then removelist="$obj $lobj $libobj ${libobj}T" else removelist="$lobj $libobj ${libobj}T" fi # On Cygwin there's no "real" PIC flag so we must build both object types case $host_os in cygwin* | mingw* | pw32* | os2* | cegcc*) pic_mode=default ;; esac if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test no = "$compiler_c_o"; then output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext lockfile=$output_obj.lock else output_obj= need_locks=no lockfile= fi # Lock this critical section if it is needed # We use this script file to make the link, it avoids creating a new file if test yes = "$need_locks"; then until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done elif test warn = "$need_locks"; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi func_append removelist " $output_obj" $ECHO "$srcfile" > "$lockfile" fi $opt_dry_run || $RM $removelist func_append removelist " $lockfile" trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 srcfile=$func_to_tool_file_result func_quote_for_eval "$srcfile" qsrcfile=$func_quote_for_eval_result # Only build a PIC object if we are building libtool libraries. if test yes = "$build_libtool_libs"; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test no != "$pic_mode"; then command="$base_compile $qsrcfile $pic_flag" else # Don't build PIC code command="$base_compile $qsrcfile" fi func_mkdir_p "$xdir$objdir" if test -z "$output_obj"; then # Place PIC objects in $objdir func_append command " -o $lobj" fi func_show_eval_locale "$command" \ 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed, then go on to compile the next one if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then func_show_eval '$MV "$output_obj" "$lobj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi # Allow error messages only from the first compilation. if test yes = "$suppress_opt"; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test yes = "$build_old_libs"; then if test yes != "$pic_mode"; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test yes = "$compiler_c_o"; then func_append command " -o $obj" fi # Suppress compiler output if we already did a PIC compilation. func_append command "$suppress_output" func_show_eval_locale "$command" \ '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' if test warn = "$need_locks" && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support '-c' and '-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $opt_dry_run || $RM $removelist exit $EXIT_FAILURE fi # Just move the object if needed if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then func_show_eval '$MV "$output_obj" "$obj"' \ 'error=$?; $opt_dry_run || $RM $removelist; exit $error' fi fi $opt_dry_run || { func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" # Unlock the critical section if it was locked if test no != "$need_locks"; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test compile = "$opt_mode" && func_mode_compile ${1+"$@"} } func_mode_help () { # We need to display help for each of the modes. case $opt_mode in "") # Generic help is extracted from the usage comments # at the start of this file. func_help ;; clean) $ECHO \ "Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... Remove files from the build directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, object or program, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; compile) $ECHO \ "Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE Compile a source file into a libtool library object. This mode accepts the following additional options: -o OUTPUT-FILE set the output file name to OUTPUT-FILE -no-suppress do not suppress compiler output for multiple passes -prefer-pic try to build PIC objects only -prefer-non-pic try to build non-PIC objects only -shared do not build a '.o' file suitable for static linking -static only build a '.o' file suitable for static linking -Wc,FLAG pass FLAG directly to the compiler COMPILE-COMMAND is a command to be used in creating a 'standard' object file from the given SOURCEFILE. The output file name is determined by removing the directory component from SOURCEFILE, then substituting the C source code suffix '.c' with the library object suffix, '.lo'." ;; execute) $ECHO \ "Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... Automatically set library path, then run a program. This mode accepts the following additional options: -dlopen FILE add the directory containing FILE to the library path This mode sets the library path environment variable according to '-dlopen' flags. If any of the ARGS are libtool executable wrappers, then they are translated into their corresponding uninstalled binary, and any of their required library directories are added to the library path. Then, COMMAND is executed, with ARGS as arguments." ;; finish) $ECHO \ "Usage: $progname [OPTION]... --mode=finish [LIBDIR]... Complete the installation of libtool libraries. Each LIBDIR is a directory that contains libtool libraries. The commands that this mode executes may require superuser privileges. Use the '--dry-run' option if you just want to see what would be executed." ;; install) $ECHO \ "Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... Install executables or libraries. INSTALL-COMMAND is the installation command. The first component should be either the 'install' or 'cp' program. The following components of INSTALL-COMMAND are treated specially: -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation The rest of the components are interpreted as arguments to that command (only BSD-compatible install options are recognized)." ;; link) $ECHO \ "Usage: $progname [OPTION]... --mode=link LINK-COMMAND... Link object files or libraries together to form another library, or to create an executable program. LINK-COMMAND is a command using the C compiler that you would use to create a program from several object files. The following components of LINK-COMMAND are treated specially: -all-static do not do any dynamic linking at all -avoid-version do not add a version suffix if possible -bindir BINDIR specify path to binaries directory (for systems where libraries must be found in the PATH setting at runtime) -dlopen FILE '-dlpreopen' FILE if it cannot be dlopened at runtime -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE -export-symbols-regex REGEX try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened -no-fast-install disable the fast-install mode -no-install link a not-installable executable -no-undefined declare that a library does not refer to external symbols -o OUTPUT-FILE create OUTPUT-FILE from the specified objects -objectlist FILE use a list of object files found in FILE to specify objects -os2dllname NAME force a short DLL name on OS/2 (no effect on other OSes) -precious-files-regex REGEX don't remove output files matching REGEX -release RELEASE specify package release information -rpath LIBDIR the created library will eventually be installed in LIBDIR -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries -shared only do dynamic linking of libtool libraries -shrext SUFFIX override the standard shared library file extension -static do not do any dynamic linking of uninstalled libtool libraries -static-libtool-libs do not do any dynamic linking of libtool libraries -version-info CURRENT[:REVISION[:AGE]] specify library version info [each variable defaults to 0] -weak LIBNAME declare that the target provides the LIBNAME interface -Wc,FLAG -Xcompiler FLAG pass linker-specific FLAG directly to the compiler -Wl,FLAG -Xlinker FLAG pass linker-specific FLAG directly to the linker -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) All other options (arguments beginning with '-') are ignored. Every other argument is treated as a filename. Files ending in '.la' are treated as uninstalled libtool libraries, other files are standard or library object files. If the OUTPUT-FILE ends in '.la', then a libtool library is created, only library objects ('.lo' files) may be specified, and '-rpath' is required, except when creating a convenience library. If OUTPUT-FILE ends in '.a' or '.lib', then a standard library is created using 'ar' and 'ranlib', or on Windows using 'lib'. If OUTPUT-FILE ends in '.lo' or '.$objext', then a reloadable object file is created, otherwise an executable program is created." ;; uninstall) $ECHO \ "Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. RM is the name of the program to use to delete files associated with each FILE (typically '/bin/rm'). RM-OPTIONS are options (such as '-f') to be passed to RM. If FILE is a libtool library, all the files associated with it are deleted. Otherwise, only FILE itself is deleted using RM." ;; *) func_fatal_help "invalid operation mode '$opt_mode'" ;; esac echo $ECHO "Try '$progname --help' for more information about other modes." } # Now that we've collected a possible --mode arg, show help if necessary if $opt_help; then if test : = "$opt_help"; then func_mode_help else { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do func_mode_help done } | $SED -n '1p; 2,$s/^Usage:/ or: /p' { func_help noexit for opt_mode in compile link execute install finish uninstall clean; do echo func_mode_help done } | $SED '1d /^When reporting/,/^Report/{ H d } $x /information about other modes/d /more detailed .*MODE/d s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' fi exit $? fi # func_mode_execute arg... func_mode_execute () { $debug_cmd # The first argument is the command name. cmd=$nonopt test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $opt_dlopen; do test -f "$file" \ || func_fatal_help "'$file' is not a file" dir= case $file in *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$lib' is not a valid libtool archive" # Read the libtool library. dlname= library_names= func_source "$file" # Skip this library if it cannot be dlopened. if test -z "$dlname"; then # Warn if it was a shared library. test -n "$library_names" && \ func_warning "'$file' was not linked with '-export-dynamic'" continue fi func_dirname "$file" "" "." dir=$func_dirname_result if test -f "$dir/$objdir/$dlname"; then func_append dir "/$objdir" else if test ! -f "$dir/$dlname"; then func_fatal_error "cannot find '$dlname' in '$dir' or '$dir/$objdir'" fi fi ;; *.lo) # Just add the directory containing the .lo file. func_dirname "$file" "" "." dir=$func_dirname_result ;; *) func_warning "'-dlopen' is ignored for non-libtool libraries and objects" continue ;; esac # Get the absolute pathname. absdir=`cd "$dir" && pwd` test -n "$absdir" && dir=$absdir # Now add the directory to shlibpath_var. if eval "test -z \"\$$shlibpath_var\""; then eval "$shlibpath_var=\"\$dir\"" else eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" fi done # This variable tells wrapper scripts just to set shlibpath_var # rather than running their programs. libtool_execute_magic=$magic # Check if any of the arguments is a wrapper script. args= for file do case $file in -* | *.la | *.lo ) ;; *) # Do a test to see if this is really a libtool program. if func_ltwrapper_script_p "$file"; then func_source "$file" # Transform arg to wrapped name. file=$progdir/$program elif func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" func_source "$func_ltwrapper_scriptname_result" # Transform arg to wrapped name. file=$progdir/$program fi ;; esac # Quote arguments (to preserve shell metacharacters). func_append_quoted args "$file" done if $opt_dry_run; then # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS else if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd=\$cmd$args fi } test execute = "$opt_mode" && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $debug_cmd libs= libdirs= admincmds= for opt in "$nonopt" ${1+"$@"} do if test -d "$opt"; then func_append libdirs " $opt" elif test -f "$opt"; then if func_lalib_unsafe_p "$opt"; then func_append libs " $opt" else func_warning "'$opt' is not a valid libtool archive" fi else func_fatal_error "invalid argument '$opt'" fi done if test -n "$libs"; then if test -n "$lt_sysroot"; then sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" else sysroot_cmd= fi # Remove sysroot references if $opt_dry_run; then for lib in $libs; do echo "removing references to $lt_sysroot and '=' prefixes from $lib" done else tmpdir=`func_mktempdir` for lib in $libs; do $SED -e "$sysroot_cmd s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ > $tmpdir/tmp-la mv -f $tmpdir/tmp-la $lib done ${RM}r "$tmpdir" fi fi if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then for libdir in $libdirs; do if test -n "$finish_cmds"; then # Do each command in the finish commands. func_execute_cmds "$finish_cmds" 'admincmds="$admincmds '"$cmd"'"' fi if test -n "$finish_eval"; then # Do the single finish_eval. eval cmds=\"$finish_eval\" $opt_dry_run || eval "$cmds" || func_append admincmds " $cmds" fi done fi # Exit here if they wanted silent mode. $opt_quiet && exit $EXIT_SUCCESS if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then echo "----------------------------------------------------------------------" echo "Libraries have been installed in:" for libdir in $libdirs; do $ECHO " $libdir" done echo echo "If you ever happen to want to link against installed libraries" echo "in a given directory, LIBDIR, you must either use libtool, and" echo "specify the full pathname of the library, or use the '-LLIBDIR'" echo "flag during linking and do at least one of the following:" if test -n "$shlibpath_var"; then echo " - add LIBDIR to the '$shlibpath_var' environment variable" echo " during execution" fi if test -n "$runpath_var"; then echo " - add LIBDIR to the '$runpath_var' environment variable" echo " during linking" fi if test -n "$hardcode_libdir_flag_spec"; then libdir=LIBDIR eval flag=\"$hardcode_libdir_flag_spec\" $ECHO " - use the '$flag' linker flag" fi if test -n "$admincmds"; then $ECHO " - have your system administrator run these commands:$admincmds" fi if test -f /etc/ld.so.conf; then echo " - have your system administrator add LIBDIR to '/etc/ld.so.conf'" fi echo echo "See any operating system documentation about shared libraries for" case $host in solaris2.[6789]|solaris2.1[0-9]) echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" echo "pages." ;; *) echo "more information, such as the ld(1) and ld.so(8) manual pages." ;; esac echo "----------------------------------------------------------------------" fi exit $EXIT_SUCCESS } test finish = "$opt_mode" && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $debug_cmd # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$SHELL" = "$nonopt" || test /bin/sh = "$nonopt" || # Allow the use of GNU shtool's install command. case $nonopt in *shtool*) :;; *) false;; esac then # Aesthetically quote it. func_quote_for_eval "$nonopt" install_prog="$func_quote_for_eval_result " arg=$1 shift else install_prog= arg=$nonopt fi # The real first argument should be the name of the installation program. # Aesthetically quote it. func_quote_for_eval "$arg" func_append install_prog "$func_quote_for_eval_result" install_shared_prog=$install_prog case " $install_prog " in *[\\\ /]cp\ *) install_cp=: ;; *) install_cp=false ;; esac # We need to accept at least all the BSD install flags. dest= files= opts= prev= install_type= isdir=false stripme= no_mode=: for arg do arg2= if test -n "$dest"; then func_append files " $dest" dest=$arg continue fi case $arg in -d) isdir=: ;; -f) if $install_cp; then :; else prev=$arg fi ;; -g | -m | -o) prev=$arg ;; -s) stripme=" -s" continue ;; -*) ;; *) # If the previous option needed an argument, then skip it. if test -n "$prev"; then if test X-m = "X$prev" && test -n "$install_override_mode"; then arg2=$install_override_mode no_mode=false fi prev= else dest=$arg continue fi ;; esac # Aesthetically quote the argument. func_quote_for_eval "$arg" func_append install_prog " $func_quote_for_eval_result" if test -n "$arg2"; then func_quote_for_eval "$arg2" fi func_append install_shared_prog " $func_quote_for_eval_result" done test -z "$install_prog" && \ func_fatal_help "you must specify an install program" test -n "$prev" && \ func_fatal_help "the '$prev' option requires an argument" if test -n "$install_override_mode" && $no_mode; then if $install_cp; then :; else func_quote_for_eval "$install_override_mode" func_append install_shared_prog " -m $func_quote_for_eval_result" fi fi if test -z "$files"; then if test -z "$dest"; then func_fatal_help "no file or destination specified" else func_fatal_help "you must specify a destination" fi fi # Strip any trailing slash from the destination. func_stripname '' '/' "$dest" dest=$func_stripname_result # Check to see that the destination is a directory. test -d "$dest" && isdir=: if $isdir; then destdir=$dest destname= else func_dirname_and_basename "$dest" "" "." destdir=$func_dirname_result destname=$func_basename_result # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "'$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "'$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. func_append staticlibs " $file" ;; *.la) func_resolve_sysroot "$file" file=$func_resolve_sysroot_result # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$file" \ || func_fatal_help "'$file' is not a valid libtool archive" library_names= old_library= relink_command= func_source "$file" # Add the libdir to current_libdirs if it is the destination. if test "X$destdir" = "X$libdir"; then case "$current_libdirs " in *" $libdir "*) ;; *) func_append current_libdirs " $libdir" ;; esac else # Note the libdir as a future libdir. case "$future_libdirs " in *" $libdir "*) ;; *) func_append future_libdirs " $libdir" ;; esac fi func_dirname "$file" "/" "" dir=$func_dirname_result func_append dir "$objdir" if test -n "$relink_command"; then # Determine the prefix the user has applied to our future dir. inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` # Don't allow the user to place us outside of our expected # location b/c this prevents finding dependent libraries that # are installed to the same prefix. # At present, this check doesn't affect windows .dll's that # are installed into $libdir/../bin (currently, that works fine) # but it's something to keep an eye on. test "$inst_prefix_dir" = "$destdir" && \ func_fatal_error "error: cannot install '$file' to a directory not ending in $libdir" if test -n "$inst_prefix_dir"; then # Stick the inst_prefix_dir data into the link command. relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` else relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` fi func_warning "relinking '$file'" func_show_eval "$relink_command" \ 'func_fatal_error "error: relink '\''$file'\'' with the above command before installing it"' fi # See the names of the shared library. set dummy $library_names; shift if test -n "$1"; then realname=$1 shift srcname=$realname test -n "$relink_command" && srcname=${realname}T # Install the shared library and build the symlinks. func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ 'exit $?' tstripme=$stripme case $host_os in cygwin* | mingw* | pw32* | cegcc*) case $realname in *.dll.a) tstripme= ;; esac ;; os2*) case $realname in *_dll.a) tstripme= ;; esac ;; esac if test -n "$tstripme" && test -n "$striplib"; then func_show_eval "$striplib $destdir/$realname" 'exit $?' fi if test "$#" -gt 0; then # Delete the old symlinks, and create new ones. # Try 'ln -sf' first, because the 'ln' binary might depend on # the symlink we replace! Solaris /bin/ln does not understand -f, # so we also need to try rm && ln -s. for linkname do test "$linkname" != "$realname" \ && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" done fi # Do each command in the postinstall commands. lib=$destdir/$realname func_execute_cmds "$postinstall_cmds" 'exit $?' fi # Install the pseudo-library for information purposes. func_basename "$file" name=$func_basename_result instname=$dir/${name}i func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' # Maybe install the static library, too. test -n "$old_library" && func_append staticlibs " $dir/$old_library" ;; *.lo) # Install (i.e. copy) a libtool object. # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # Deduce the name of the destination old-style object file. case $destfile in *.lo) func_lo2o "$destfile" staticdest=$func_lo2o_result ;; *.$objext) staticdest=$destfile destfile= ;; *) func_fatal_help "cannot copy a libtool object to '$destfile'" ;; esac # Install the libtool object if requested. test -n "$destfile" && \ func_show_eval "$install_prog $file $destfile" 'exit $?' # Install the old object if enabled. if test yes = "$build_old_libs"; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile=$destdir/$destname else func_basename "$file" destfile=$func_basename_result destfile=$destdir/$destfile fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext= case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=.exe fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script '$wrapper'" finalize=: for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile=$libdir/`$ECHO "$lib" | $SED 's%^.*/%%g'` if test -n "$libdir" && test ! -f "$libfile"; then func_warning "'$lib' has not been installed in '$libdir'" finalize=false fi done relink_command= func_source "$wrapper" outputname= if test no = "$fast_install" && test -n "$relink_command"; then $opt_dry_run || { if $finalize; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file=$func_basename_result outputname=$tmpdir/$file # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_quiet || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink '$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file=$outputname else func_warning "cannot relink '$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` fi fi # remove .exe since cygwin /usr/bin/install will append another # one anyway case $install_prog,$host in */usr/bin/install*,*cygwin*) case $file:$destfile in *.exe:*.exe) # this is ok ;; *.exe:*) destfile=$destfile.exe ;; *:*.exe) func_stripname '' '.exe' "$destfile" destfile=$func_stripname_result ;; esac ;; esac func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' $opt_dry_run || if test -n "$outputname"; then ${RM}r "$tmpdir" fi ;; esac done for file in $staticlibs; do func_basename "$file" name=$func_basename_result # Set up the ranlib parameters. oldlib=$destdir/$name func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result func_show_eval "$install_prog \$file \$oldlib" 'exit $?' if test -n "$stripme" && test -n "$old_striplib"; then func_show_eval "$old_striplib $tool_oldlib" 'exit $?' fi # Do each command in the postinstall commands. func_execute_cmds "$old_postinstall_cmds" 'exit $?' done test -n "$future_libdirs" && \ func_warning "remember to run '$progname --finish$future_libdirs'" if test -n "$current_libdirs"; then # Maybe just do a dry run. $opt_dry_run && current_libdirs=" -n$current_libdirs" exec_cmd='$SHELL "$progpath" $preserve_args --finish$current_libdirs' else exit $EXIT_SUCCESS fi } test install = "$opt_mode" && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $debug_cmd my_outputname=$1 my_originator=$2 my_pic_p=${3-false} my_prefix=`$ECHO "$my_originator" | $SED 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms=${my_outputname}S.c else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist=$output_objdir/$my_outputname.nm func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for '$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #if defined __GNUC__ && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) #pragma GCC diagnostic ignored \"-Wstrict-prototypes\" #endif /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* External symbol declarations for the compiler. */\ " if test yes = "$dlself"; then func_verbose "generating symbol list for '$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` for progfile in $progfiles; do func_to_tool_file "$progfile" func_convert_file_msys_to_w32 func_verbose "extracting global C symbols from '$func_to_tool_file_result'" $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" done if test -n "$exclude_expsyms"; then $opt_dry_run || { eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi if test -n "$export_symbols_regex"; then $opt_dry_run || { eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' } fi # Prepare the list of exported symbols if test -z "$export_symbols"; then export_symbols=$output_objdir/$outputname.exp $opt_dry_run || { $RM $export_symbols eval "$SED -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' ;; esac } else $opt_dry_run || { eval "$SED -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' eval '$MV "$nlist"T "$nlist"' case $host in *cygwin* | *mingw* | *cegcc* ) eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' ;; esac } fi fi for dlprefile in $dlprefiles; do func_verbose "extracting global C symbols from '$dlprefile'" func_basename "$dlprefile" name=$func_basename_result case $host in *cygwin* | *mingw* | *cegcc* ) # if an import library, we need to obtain dlname if func_win32_import_lib_p "$dlprefile"; then func_tr_sh "$dlprefile" eval "curr_lafile=\$libfile_$func_tr_sh_result" dlprefile_dlbasename= if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then # Use subshell, to avoid clobbering current variable values dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` if test -n "$dlprefile_dlname"; then func_basename "$dlprefile_dlname" dlprefile_dlbasename=$func_basename_result else # no lafile. user explicitly requested -dlpreopen . $sharedlib_from_linklib_cmd "$dlprefile" dlprefile_dlbasename=$sharedlib_from_linklib_result fi fi $opt_dry_run || { if test -n "$dlprefile_dlbasename"; then eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' else func_warning "Could not compute DLL name from $name" eval '$ECHO ": $name " >> "$nlist"' fi func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" } else # not an import lib $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } fi ;; *) $opt_dry_run || { eval '$ECHO ": $name " >> "$nlist"' func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" } ;; esac done $opt_dry_run || { # Make sure we have at least an empty file. test -f "$nlist" || : > "$nlist" if test -n "$exclude_expsyms"; then $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T $MV "$nlist"T "$nlist" fi # Try sorting and uniquifying the output. if $GREP -v "^: " < "$nlist" | if sort -k 3 /dev/null 2>&1; then sort -k 3 else sort +2 fi | uniq > "$nlist"S; then : else $GREP -v "^: " < "$nlist" > "$nlist"S fi if test -f "$nlist"S; then eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' else echo '/* NONE */' >> "$output_objdir/$my_dlsyms" fi func_show_eval '$RM "${nlist}I"' if test -n "$global_symbol_to_import"; then eval "$global_symbol_to_import"' < "$nlist"S > "$nlist"I' fi echo >> "$output_objdir/$my_dlsyms" "\ /* The mapping between symbol names and symbols. */ typedef struct { const char *name; void *address; } lt_dlsymlist; extern LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[];\ " if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ static void lt_syminit(void) { LT_DLSYM_CONST lt_dlsymlist *symbol = lt_${my_prefix}_LTX_preloaded_symbols; for (; symbol->name; ++symbol) {" $SED 's/.*/ if (STREQ (symbol->name, \"&\")) symbol->address = (void *) \&&;/' < "$nlist"I >> "$output_objdir/$my_dlsyms" echo >> "$output_objdir/$my_dlsyms" "\ } }" fi echo >> "$output_objdir/$my_dlsyms" "\ LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = { {\"$my_originator\", (void *) 0}," if test -s "$nlist"I; then echo >> "$output_objdir/$my_dlsyms" "\ {\"@INIT@\", (void *) <_syminit}," fi case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) $my_pic_p && pic_flag_for_symtable=" $pic_flag" ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) func_append symtab_cflags " $arg" ;; esac done # Now compile the dynamic symbol file. func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' # Clean up the generated files. func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T" "${nlist}I"' # Transform the symbol file into the correct name. symfileobj=$output_objdir/${my_outputname}S.$objext case $host in *cygwin* | *mingw* | *cegcc* ) if test -f "$output_objdir/$my_outputname.def"; then compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` else compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` fi ;; *) compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` ;; esac ;; *) func_fatal_error "unknown suffix for '$my_dlsyms'" ;; esac else # We keep going just in case the user didn't refer to # lt_preloaded_symbols. The linker will fail if global_symbol_pipe # really was required. # Nullify the symbol file. compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` fi } # func_cygming_gnu_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is a GNU/binutils-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_gnu_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` test -n "$func_cygming_gnu_implib_tmp" } # func_cygming_ms_implib_p ARG # This predicate returns with zero status (TRUE) if # ARG is an MS-style import library. Returns # with nonzero status (FALSE) otherwise. func_cygming_ms_implib_p () { $debug_cmd func_to_tool_file "$1" func_convert_file_msys_to_w32 func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` test -n "$func_cygming_ms_implib_tmp" } # func_win32_libid arg # return the library type of file 'arg' # # Need a lot of goo to handle *both* DLLs and import libs # Has to be a shell function in order to 'eat' the argument # that is supplied when $file_magic_command is called. # Despite the name, also deal with 64 bit binaries. func_win32_libid () { $debug_cmd win32_libid_type=unknown win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then case $nm_interface in "MS dumpbin") if func_cygming_ms_implib_p "$1" || func_cygming_gnu_implib_p "$1" then win32_nmres=import else win32_nmres= fi ;; *) func_to_tool_file "$1" func_convert_file_msys_to_w32 win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | $SED -n -e ' 1,100{ / I /{ s|.*|import| p q } }'` ;; esac case $win32_nmres in import*) win32_libid_type="x86 archive import";; *) win32_libid_type="x86 archive static";; esac fi ;; *DLL*) win32_libid_type="x86 DLL" ;; *executable*) # but shell scripts are "executable" too... case $win32_fileres in *MS\ Windows\ PE\ Intel*) win32_libid_type="x86 DLL" ;; esac ;; esac $ECHO "$win32_libid_type" } # func_cygming_dll_for_implib ARG # # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib () { $debug_cmd sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` } # func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs # # The is the core of a fallback implementation of a # platform-specific function to extract the name of the # DLL associated with the specified import library LIBNAME. # # SECTION_NAME is either .idata$6 or .idata$7, depending # on the platform and compiler that created the implib. # # Echos the name of the DLL associated with the # specified import library. func_cygming_dll_for_implib_fallback_core () { $debug_cmd match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` $OBJDUMP -s --section "$1" "$2" 2>/dev/null | $SED '/^Contents of section '"$match_literal"':/{ # Place marker at beginning of archive member dllname section s/.*/====MARK====/ p d } # These lines can sometimes be longer than 43 characters, but # are always uninteresting /:[ ]*file format pe[i]\{,1\}-/d /^In archive [^:]*:/d # Ensure marker is printed /^====MARK====/p # Remove all lines with less than 43 characters /^.\{43\}/!d # From remaining lines, remove first 43 characters s/^.\{43\}//' | $SED -n ' # Join marker and all lines until next marker into a single line /^====MARK====/ b para H $ b para b :para x s/\n//g # Remove the marker s/^====MARK====// # Remove trailing dots and whitespace s/[\. \t]*$// # Print /./p' | # we now have a list, one entry per line, of the stringified # contents of the appropriate section of all members of the # archive that possess that section. Heuristic: eliminate # all those that have a first or second character that is # a '.' (that is, objdump's representation of an unprintable # character.) This should work for all archives with less than # 0x302f exports -- but will fail for DLLs whose name actually # begins with a literal '.' or a single character followed by # a '.'. # # Of those that remain, print the first one. $SED -e '/^\./d;/^.\./d;q' } # func_cygming_dll_for_implib_fallback ARG # Platform-specific function to extract the # name of the DLL associated with the specified # import library ARG. # # This fallback implementation is for use when $DLLTOOL # does not support the --identify-strict option. # Invoked by eval'ing the libtool variable # $sharedlib_from_linklib_cmd # Result is available in the variable # $sharedlib_from_linklib_result func_cygming_dll_for_implib_fallback () { $debug_cmd if func_cygming_gnu_implib_p "$1"; then # binutils import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` elif func_cygming_ms_implib_p "$1"; then # ms-generated import library sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` else # unknown sharedlib_from_linklib_result= fi } # func_extract_an_archive dir oldlib func_extract_an_archive () { $debug_cmd f_ex_an_ar_dir=$1; shift f_ex_an_ar_oldlib=$1 if test yes = "$lock_old_archive_extraction"; then lockfile=$f_ex_an_ar_oldlib.lock until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do func_echo "Waiting for $lockfile to be removed" sleep 2 done fi func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ 'stat=$?; rm -f "$lockfile"; exit $stat' if test yes = "$lock_old_archive_extraction"; then $opt_dry_run || rm -f "$lockfile" fi if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then : else func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" fi } # func_extract_archives gentop oldlib ... func_extract_archives () { $debug_cmd my_gentop=$1; shift my_oldlibs=${1+"$@"} my_oldobjs= my_xlib= my_xabs= my_xdir= for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs=$my_xlib ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib=$func_basename_result my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir=$my_gentop/$my_xlib_u func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` func_basename "$darwin_archive" darwin_base_archive=$func_basename_result darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches; do func_mkdir_p "unfat-$$/$darwin_base_archive-$darwin_arch" $LIPO -thin $darwin_arch -output "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" "$darwin_archive" cd "unfat-$$/$darwin_base_archive-$darwin_arch" func_extract_an_archive "`pwd`" "$darwin_base_archive" cd "$darwin_curdir" $RM "unfat-$$/$darwin_base_archive-$darwin_arch/$darwin_base_archive" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$sed_basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` $LIPO -create -output "$darwin_file" $darwin_files done # $darwin_filelist $RM -rf unfat-$$ cd "$darwin_orig_dir" else cd $darwin_orig_dir func_extract_an_archive "$my_xdir" "$my_xabs" fi # $darwin_arches } # !$opt_dry_run ;; *) func_extract_an_archive "$my_xdir" "$my_xabs" ;; esac my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` done func_extract_archives_result=$my_oldobjs } # func_emit_wrapper [arg=no] # # Emit a libtool wrapper script on stdout. # Don't directly open a file because we may want to # incorporate the script contents within a cygwin/mingw # wrapper executable. Must ONLY be called from within # func_mode_link because it depends on a number of variables # set therein. # # ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR # variable will take. If 'yes', then the emitted script # will assume that the directory where it is stored is # the $objdir directory. This is a cygwin/mingw-specific # behavior. func_emit_wrapper () { func_emit_wrapper_arg1=${1-no} $ECHO "\ #! $SHELL # $output - temporary wrapper script for $objdir/$outputname # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. sed_quote_subst='$sed_quote_subst' # Be Bourne compatible if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac fi BIN_SH=xpg4; export BIN_SH # for Tru64 DUALCASE=1; export DUALCASE # for MKS sh # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH relink_command=\"$relink_command\" # This environment variable determines our operation mode. if test \"\$libtool_install_magic\" = \"$magic\"; then # install mode needs the following variables: generated_by_libtool_version='$macro_version' notinst_deplibs='$notinst_deplibs' else # When we are sourced in execute mode, \$file and \$ECHO are already set. if test \"\$libtool_execute_magic\" != \"$magic\"; then file=\"\$0\"" qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` $ECHO "\ # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } ECHO=\"$qECHO\" fi # Very basic option parsing. These options are (a) specific to # the libtool wrapper, (b) are identical between the wrapper # /script/ and the wrapper /executable/ that is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options that match # this pattern). # # There are only two supported options: --lt-debug and # --lt-dump-script. There is, deliberately, no --lt-help. # # The first argument to this parsing function should be the # script's $0 value, followed by "$@". lt_option_debug= func_parse_lt_options () { lt_script_arg0=\$0 shift for lt_opt do case \"\$lt_opt\" in --lt-debug) lt_option_debug=1 ;; --lt-dump-script) lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` cat \"\$lt_dump_D/\$lt_dump_F\" exit 0 ;; --lt-*) \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 exit 1 ;; esac done # Print the debug banner immediately: if test -n \"\$lt_option_debug\"; then echo \"$outputname:$output:\$LINENO: libtool wrapper (GNU $PACKAGE) $VERSION\" 1>&2 fi } # Used when --lt-debug. Prints its arguments to stdout # (redirection is the responsibility of the caller) func_lt_dump_args () { lt_dump_args_N=1; for lt_arg do \$ECHO \"$outputname:$output:\$LINENO: newargv[\$lt_dump_args_N]: \$lt_arg\" lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` done } # Core function for launching the target application func_exec_program_core () { " case $host in # Backslashes separate directories on plain windows *-*-mingw | *-*-os2* | *-cegcc*) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir\\\\\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} " ;; *) $ECHO "\ if test -n \"\$lt_option_debug\"; then \$ECHO \"$outputname:$output:\$LINENO: newargv[0]: \$progdir/\$program\" 1>&2 func_lt_dump_args \${1+\"\$@\"} 1>&2 fi exec \"\$progdir/\$program\" \${1+\"\$@\"} " ;; esac $ECHO "\ \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 exit 1 } # A function to encapsulate launching the target application # Strips options in the --lt-* namespace from \$@ and # launches target application with the remaining arguments. func_exec_program () { case \" \$* \" in *\\ --lt-*) for lt_wr_arg do case \$lt_wr_arg in --lt-*) ;; *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; esac shift done ;; esac func_exec_program_core \${1+\"\$@\"} } # Parse options func_parse_lt_options \"\$0\" \${1+\"\$@\"} # Find the directory that this script lives in. thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` test \"x\$thisdir\" = \"x\$file\" && thisdir=. # Follow symbolic links until we get to the real thisdir. file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` while test -n \"\$file\"; do destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` done # Usually 'no', except on cygwin/mingw when embedded into # the cwrapper. WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then # special case for '.' if test \"\$thisdir\" = \".\"; then thisdir=\`pwd\` fi # remove .libs from thisdir case \"\$thisdir\" in *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; $objdir ) thisdir=. ;; esac fi # Try to get the absolute directory name. absdir=\`cd \"\$thisdir\" && pwd\` test -n \"\$absdir\" && thisdir=\"\$absdir\" " if test yes = "$fast_install"; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | $SED 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else \$ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # fixup the dll searchpath if we need to. # # Fix the DLL searchpath if we need to. Do this before prepending # to shlibpath, because on Windows, both are PATH and uninstalled # libraries must come first. if test -n "$dllsearchpath"; then $ECHO "\ # Add the dll search path components to the executable PATH PATH=$dllsearchpath:\$PATH " fi # Export our shlibpath_var if we have one. if test yes = "$shlibpath_overrides_runpath" && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` export $shlibpath_var " fi $ECHO "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. func_exec_program \${1+\"\$@\"} fi else # The program doesn't exist. \$ECHO \"\$0: error: '\$progdir/\$program' does not exist\" 1>&2 \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 exit 1 fi fi\ " } # func_emit_cwrapperexe_src # emit the source code for a wrapper executable on stdout # Must ONLY be called from within func_mode_link because # it depends on a number of variable set therein. func_emit_cwrapperexe_src () { cat < #include #ifdef _MSC_VER # include # include # include #else # include # include # ifdef __CYGWIN__ # include # endif #endif #include #include #include #include #include #include #include #include #define STREQ(s1, s2) (strcmp ((s1), (s2)) == 0) /* declarations of non-ANSI functions */ #if defined __MINGW32__ # ifdef __STRICT_ANSI__ int _putenv (const char *); # endif #elif defined __CYGWIN__ # ifdef __STRICT_ANSI__ char *realpath (const char *, char *); int putenv (char *); int setenv (const char *, const char *, int); # endif /* #elif defined other_platform || defined ... */ #endif /* portability defines, excluding path handling macros */ #if defined _MSC_VER # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv # define S_IXUSR _S_IEXEC #elif defined __MINGW32__ # define setmode _setmode # define stat _stat # define chmod _chmod # define getcwd _getcwd # define putenv _putenv #elif defined __CYGWIN__ # define HAVE_SETENV # define FOPEN_WB "wb" /* #elif defined other platforms ... */ #endif #if defined PATH_MAX # define LT_PATHMAX PATH_MAX #elif defined MAXPATHLEN # define LT_PATHMAX MAXPATHLEN #else # define LT_PATHMAX 1024 #endif #ifndef S_IXOTH # define S_IXOTH 0 #endif #ifndef S_IXGRP # define S_IXGRP 0 #endif /* path handling portability macros */ #ifndef DIR_SEPARATOR # define DIR_SEPARATOR '/' # define PATH_SEPARATOR ':' #endif #if defined _WIN32 || defined __MSDOS__ || defined __DJGPP__ || \ defined __OS2__ # define HAVE_DOS_BASED_FILE_SYSTEM # define FOPEN_WB "wb" # ifndef DIR_SEPARATOR_2 # define DIR_SEPARATOR_2 '\\' # endif # ifndef PATH_SEPARATOR_2 # define PATH_SEPARATOR_2 ';' # endif #endif #ifndef DIR_SEPARATOR_2 # define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) #else /* DIR_SEPARATOR_2 */ # define IS_DIR_SEPARATOR(ch) \ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) #endif /* DIR_SEPARATOR_2 */ #ifndef PATH_SEPARATOR_2 # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) #else /* PATH_SEPARATOR_2 */ # define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) #endif /* PATH_SEPARATOR_2 */ #ifndef FOPEN_WB # define FOPEN_WB "w" #endif #ifndef _O_BINARY # define _O_BINARY 0 #endif #define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) #define XFREE(stale) do { \ if (stale) { free (stale); stale = 0; } \ } while (0) #if defined LT_DEBUGWRAPPER static int lt_debug = 1; #else static int lt_debug = 0; #endif const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ void *xmalloc (size_t num); char *xstrdup (const char *string); const char *base_name (const char *name); char *find_executable (const char *wrapper); char *chase_symlinks (const char *pathspec); int make_executable (const char *path); int check_executable (const char *path); char *strendzap (char *str, const char *pat); void lt_debugprintf (const char *file, int line, const char *fmt, ...); void lt_fatal (const char *file, int line, const char *message, ...); static const char *nonnull (const char *s); static const char *nonempty (const char *s); void lt_setenv (const char *name, const char *value); char *lt_extend_str (const char *orig_value, const char *add, int to_end); void lt_update_exe_path (const char *name, const char *value); void lt_update_lib_path (const char *name, const char *value); char **prepare_spawn (char **argv); void lt_dump_script (FILE *f); EOF cat <= 0) && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) return 1; else return 0; } int make_executable (const char *path) { int rval = 0; struct stat st; lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", nonempty (path)); if ((!path) || (!*path)) return 0; if (stat (path, &st) >= 0) { rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); } return rval; } /* Searches for the full path of the wrapper. Returns newly allocated full path name if found, NULL otherwise Does not chase symlinks, even on platforms that support them. */ char * find_executable (const char *wrapper) { int has_slash = 0; const char *p; const char *p_next; /* static buffer for getcwd */ char tmp[LT_PATHMAX + 1]; size_t tmp_len; char *concat_name; lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", nonempty (wrapper)); if ((wrapper == NULL) || (*wrapper == '\0')) return NULL; /* Absolute path? */ #if defined HAVE_DOS_BASED_FILE_SYSTEM if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } else { #endif if (IS_DIR_SEPARATOR (wrapper[0])) { concat_name = xstrdup (wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } #if defined HAVE_DOS_BASED_FILE_SYSTEM } #endif for (p = wrapper; *p; p++) if (*p == '/') { has_slash = 1; break; } if (!has_slash) { /* no slashes; search PATH */ const char *path = getenv ("PATH"); if (path != NULL) { for (p = path; *p; p = p_next) { const char *q; size_t p_len; for (q = p; *q; q++) if (IS_PATH_SEPARATOR (*q)) break; p_len = (size_t) (q - p); p_next = (*q == '\0' ? q : q + 1); if (p_len == 0) { /* empty path: current directory */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); } else { concat_name = XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, p, p_len); concat_name[p_len] = '/'; strcpy (concat_name + p_len + 1, wrapper); } if (check_executable (concat_name)) return concat_name; XFREE (concat_name); } } /* not found in PATH; assume curdir */ } /* Relative path | not found in path: prepend cwd */ if (getcwd (tmp, LT_PATHMAX) == NULL) lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", nonnull (strerror (errno))); tmp_len = strlen (tmp); concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); memcpy (concat_name, tmp, tmp_len); concat_name[tmp_len] = '/'; strcpy (concat_name + tmp_len + 1, wrapper); if (check_executable (concat_name)) return concat_name; XFREE (concat_name); return NULL; } char * chase_symlinks (const char *pathspec) { #ifndef S_ISLNK return xstrdup (pathspec); #else char buf[LT_PATHMAX]; struct stat s; char *tmp_pathspec = xstrdup (pathspec); char *p; int has_symlinks = 0; while (strlen (tmp_pathspec) && !has_symlinks) { lt_debugprintf (__FILE__, __LINE__, "checking path component for symlinks: %s\n", tmp_pathspec); if (lstat (tmp_pathspec, &s) == 0) { if (S_ISLNK (s.st_mode) != 0) { has_symlinks = 1; break; } /* search backwards for last DIR_SEPARATOR */ p = tmp_pathspec + strlen (tmp_pathspec) - 1; while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) p--; if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) { /* no more DIR_SEPARATORS left */ break; } *p = '\0'; } else { lt_fatal (__FILE__, __LINE__, "error accessing file \"%s\": %s", tmp_pathspec, nonnull (strerror (errno))); } } XFREE (tmp_pathspec); if (!has_symlinks) { return xstrdup (pathspec); } tmp_pathspec = realpath (pathspec, buf); if (tmp_pathspec == 0) { lt_fatal (__FILE__, __LINE__, "could not follow symlinks for %s", pathspec); } return xstrdup (tmp_pathspec); #endif } char * strendzap (char *str, const char *pat) { size_t len, patlen; assert (str != NULL); assert (pat != NULL); len = strlen (str); patlen = strlen (pat); if (patlen <= len) { str += len - patlen; if (STREQ (str, pat)) *str = '\0'; } return str; } void lt_debugprintf (const char *file, int line, const char *fmt, ...) { va_list args; if (lt_debug) { (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); va_start (args, fmt); (void) vfprintf (stderr, fmt, args); va_end (args); } } static void lt_error_core (int exit_status, const char *file, int line, const char *mode, const char *message, va_list ap) { fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); vfprintf (stderr, message, ap); fprintf (stderr, ".\n"); if (exit_status >= 0) exit (exit_status); } void lt_fatal (const char *file, int line, const char *message, ...) { va_list ap; va_start (ap, message); lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); va_end (ap); } static const char * nonnull (const char *s) { return s ? s : "(null)"; } static const char * nonempty (const char *s) { return (s && !*s) ? "(empty)" : nonnull (s); } void lt_setenv (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_setenv) setting '%s' to '%s'\n", nonnull (name), nonnull (value)); { #ifdef HAVE_SETENV /* always make a copy, for consistency with !HAVE_SETENV */ char *str = xstrdup (value); setenv (name, str, 1); #else size_t len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { size_t orig_value_len = strlen (orig_value); size_t add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } void lt_update_exe_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); /* some systems can't cope with a ':'-terminated path #' */ size_t len = strlen (new_value); while ((len > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[--len] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { lt_debugprintf (__FILE__, __LINE__, "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", nonnull (name), nonnull (value)); if (name && *name && value && *value) { char *new_value = lt_extend_str (getenv (name), value, 0); lt_setenv (name, new_value); XFREE (new_value); } } EOF case $host_os in mingw*) cat <<"EOF" /* Prepares an argument vector before calling spawn(). Note that spawn() does not by itself call the command interpreter (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&v); v.dwPlatformId == VER_PLATFORM_WIN32_NT; }) ? "cmd.exe" : "command.com"). Instead it simply concatenates the arguments, separated by ' ', and calls CreateProcess(). We must quote the arguments since Win32 CreateProcess() interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a special way: - Space and tab are interpreted as delimiters. They are not treated as delimiters if they are surrounded by double quotes: "...". - Unescaped double quotes are removed from the input. Their only effect is that within double quotes, space and tab are treated like normal characters. - Backslashes not followed by double quotes are not special. - But 2*n+1 backslashes followed by a double quote become n backslashes followed by a double quote (n >= 0): \" -> " \\\" -> \" \\\\\" -> \\" */ #define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" #define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" char ** prepare_spawn (char **argv) { size_t argc; char **new_argv; size_t i; /* Count number of arguments. */ for (argc = 0; argv[argc] != NULL; argc++) ; /* Allocate new argument vector. */ new_argv = XMALLOC (char *, argc + 1); /* Put quoted arguments into the new argument vector. */ for (i = 0; i < argc; i++) { const char *string = argv[i]; if (string[0] == '\0') new_argv[i] = xstrdup ("\"\""); else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) { int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); size_t length; unsigned int backslashes; const char *s; char *quoted_string; char *p; length = 0; backslashes = 0; if (quote_around) length++; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') length += backslashes + 1; length++; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) length += backslashes + 1; quoted_string = XMALLOC (char, length + 1); p = quoted_string; backslashes = 0; if (quote_around) *p++ = '"'; for (s = string; *s != '\0'; s++) { char c = *s; if (c == '"') { unsigned int j; for (j = backslashes + 1; j > 0; j--) *p++ = '\\'; } *p++ = c; if (c == '\\') backslashes++; else backslashes = 0; } if (quote_around) { unsigned int j; for (j = backslashes; j > 0; j--) *p++ = '\\'; *p++ = '"'; } *p = '\0'; new_argv[i] = quoted_string; } else new_argv[i] = (char *) string; } new_argv[argc] = NULL; return new_argv; } EOF ;; esac cat <<"EOF" void lt_dump_script (FILE* f) { EOF func_emit_wrapper yes | $SED -n -e ' s/^\(.\{79\}\)\(..*\)/\1\ \2/ h s/\([\\"]\)/\\\1/g s/$/\\n/ s/\([^\n]*\).*/ fputs ("\1", f);/p g D' cat <<"EOF" } EOF } # end: func_emit_cwrapperexe_src # func_win32_import_lib_p ARG # True if ARG is an import lib, as indicated by $file_magic_cmd func_win32_import_lib_p () { $debug_cmd case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_suncc_cstd_abi # !!ONLY CALL THIS FOR SUN CC AFTER $compile_command IS FULLY EXPANDED!! # Several compiler flags select an ABI that is incompatible with the # Cstd library. Avoid specifying it if any are in CXXFLAGS. func_suncc_cstd_abi () { $debug_cmd case " $compile_command " in *" -compat=g "*|*\ -std=c++[0-9][0-9]\ *|*" -library=stdcxx4 "*|*" -library=stlport4 "*) suncc_use_cstd_abi=no ;; *) suncc_use_cstd_abi=yes ;; esac } # func_mode_link arg... func_mode_link () { $debug_cmd case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # what system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll that has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt base_compile="$nonopt $@" compile_command=$nonopt finalize_command=$nonopt compile_rpath= finalize_rpath= compile_shlibpath= finalize_shlibpath= convenience= old_convenience= deplibs= old_deplibs= compiler_flags= linker_flags= dllsearchpath= lib_search_path=`pwd` inst_prefix_dir= new_inherited_linker_flags= avoid_version=no bindir= dlfiles= dlprefiles= dlself=no export_dynamic=no export_symbols= export_symbols_regex= generated= libobjs= ltlibs= module=no no_install=no objs= os2dllname= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=false prev= prevarg= release= rpath= xrpath= perm_rpath= temp_rpath= thread_safe=no vinfo= vinfo_number=no weak_libs= single_module=$wl-single_module func_infer_tag $base_compile # We need to know -static, to get the right output filenames. for arg do case $arg in -shared) test yes != "$build_libtool_libs" \ && func_fatal_configuration "cannot build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test yes = "$build_libtool_libs" && test -z "$link_static_flag"; then func_warning "complete static linking is impossible in this configuration" fi if test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; -static) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=built ;; -static-libtool-libs) if test -z "$pic_flag" && test -n "$link_static_flag"; then dlopen_self=$dlopen_self_static fi prefer_static_libs=yes ;; esac build_libtool_libs=no build_old_libs=yes break ;; esac done # See if our shared archives depend on static archives. test -n "$old_archive_from_new_cmds" && build_old_libs=yes # Go through the arguments, transforming them on the way. while test "$#" -gt 0; do arg=$1 shift func_quote_for_eval "$arg" qarg=$func_quote_for_eval_unquoted_result func_append libtool_args " $func_quote_for_eval_result" # If the previous option needs an argument, assign it. if test -n "$prev"; then case $prev in output) func_append compile_command " @OUTPUT@" func_append finalize_command " @OUTPUT@" ;; esac case $prev in bindir) bindir=$arg prev= continue ;; dlfiles|dlprefiles) $preload || { # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=: } case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test no = "$dlself"; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test dlprefiles = "$prev"; then dlself=yes elif test dlfiles = "$prev" && test yes != "$dlopen_self"; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test dlfiles = "$prev"; then func_append dlfiles " $arg" else func_append dlprefiles " $arg" fi prev= continue ;; esac ;; expsyms) export_symbols=$arg test -f "$arg" \ || func_fatal_error "symbol file '$arg' does not exist" prev= continue ;; expsyms_regex) export_symbols_regex=$arg prev= continue ;; framework) case $host in *-*-darwin*) case "$deplibs " in *" $qarg.ltframework "*) ;; *) func_append deplibs " $qarg.ltframework" # this is fixed later ;; esac ;; esac prev= continue ;; inst_prefix) inst_prefix_dir=$arg prev= continue ;; mllvm) # Clang does not use LLVM to link, so we can simply discard any # '-mllvm $arg' options when doing the link step. prev= continue ;; objectlist) if test -f "$arg"; then save_arg=$arg moreargs= for fil in `cat "$save_arg"` do # func_append moreargs " $fil" arg=$fil # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result if test none != "$pic_object"; then # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object fi # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi done else func_fatal_error "link input file '$arg' does not exist" fi arg=$save_arg prev= continue ;; os2dllname) os2dllname=$arg prev= continue ;; precious_regex) precious_files_regex=$arg prev= continue ;; release) release=-$arg prev= continue ;; rpath | xrpath) # We need an absolute path. case $arg in [\\/]* | [A-Za-z]:[\\/]*) ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac if test rpath = "$prev"; then case "$rpath " in *" $arg "*) ;; *) func_append rpath " $arg" ;; esac else case "$xrpath " in *" $arg "*) ;; *) func_append xrpath " $arg" ;; esac fi prev= continue ;; shrext) shrext_cmds=$arg prev= continue ;; weak) func_append weak_libs " $arg" prev= continue ;; xcclinker) func_append linker_flags " $qarg" func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xcompiler) func_append compiler_flags " $qarg" prev= func_append compile_command " $qarg" func_append finalize_command " $qarg" continue ;; xlinker) func_append linker_flags " $qarg" func_append compiler_flags " $wl$qarg" prev= func_append compile_command " $wl$qarg" func_append finalize_command " $wl$qarg" continue ;; *) eval "$prev=\"\$arg\"" prev= continue ;; esac fi # test -n "$prev" prevarg=$arg case $arg in -all-static) if test -n "$link_static_flag"; then # See comment for -static flag below, for more details. func_append compile_command " $link_static_flag" func_append finalize_command " $link_static_flag" fi continue ;; -allow-undefined) # FIXME: remove this flag sometime in the future. func_fatal_error "'-allow-undefined' must not be used because it is the default" ;; -avoid-version) avoid_version=yes continue ;; -bindir) prev=bindir continue ;; -dlopen) prev=dlfiles continue ;; -dlpreopen) prev=dlprefiles continue ;; -export-dynamic) export_dynamic=yes continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then func_fatal_error "more than one -exported-symbols argument is not allowed" fi if test X-export-symbols = "X$arg"; then prev=expsyms else prev=expsyms_regex fi continue ;; -framework) prev=framework continue ;; -inst-prefix-dir) prev=inst_prefix continue ;; # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* # so, if we see these flags be careful not to treat them like -L -L[A-Z][A-Z]*:*) case $with_gcc/$host in no/*-*-irix* | /*-*-irix*) func_append compile_command " $arg" func_append finalize_command " $arg" ;; esac continue ;; -L*) func_stripname "-L" '' "$arg" if test -z "$func_stripname_result"; then if test "$#" -gt 0; then func_fatal_error "require no space between '-L' and '$1'" else func_fatal_error "need path for '-L' option" fi fi func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) absdir=`cd "$dir" && pwd` test -z "$absdir" && \ func_fatal_error "cannot determine absolute directory name of '$dir'" dir=$absdir ;; esac case "$deplibs " in *" -L$dir "* | *" $arg "*) # Will only happen for absolute or sysroot arguments ;; *) # Preserve sysroot, but never include relative directories case $dir in [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; *) func_append deplibs " -L$dir" ;; esac func_append lib_search_path " $dir" ;; esac case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` case :$dllsearchpath: in *":$dir:"*) ;; ::) dllsearchpath=$dir;; *) func_append dllsearchpath ":$dir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac continue ;; -l*) if test X-lc = "X$arg" || test X-lm = "X$arg"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) # These systems don't actually have a C or math library (as such) continue ;; *-*-os2*) # These systems don't actually have a C library (as such) test X-lc = "X$arg" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc due to us having libc/libc_r. test X-lc = "X$arg" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test X-lc = "X$arg" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test X-lc = "X$arg" && continue ;; esac elif test X-lc_r = "X$arg"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" continue ;; -mllvm) prev=mllvm continue ;; -module) module=yes continue ;; # Tru64 UNIX uses -model [arg] to determine the layout of C++ # classes, name mangling, and exception handling. # Darwin uses the -arch flag to determine output architecture. -model|-arch|-isysroot|--sysroot) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" prev=xcompiler continue ;; -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) func_append compiler_flags " $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case "$new_inherited_linker_flags " in *" $arg "*) ;; * ) func_append new_inherited_linker_flags " $arg" ;; esac continue ;; -multi_module) single_module=$wl-multi_module continue ;; -no-fast-install) fast_install=no continue ;; -no-install) case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) # The PATH hackery in wrapper scripts is required on Windows # and Darwin in order for the loader to find any dlls it needs. func_warning "'-no-install' is ignored for $host" func_warning "assuming '-no-fast-install' instead" fast_install=no ;; *) no_install=yes ;; esac continue ;; -no-undefined) allow_undefined=no continue ;; -objectlist) prev=objectlist continue ;; -os2dllname) prev=os2dllname continue ;; -o) prev=output ;; -precious-files-regex) prev=precious_regex continue ;; -release) prev=release continue ;; -rpath) prev=rpath continue ;; -R) prev=xrpath continue ;; -R*) func_stripname '-R' '' "$arg" dir=$func_stripname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) ;; =*) func_stripname '=' '' "$dir" dir=$lt_sysroot$func_stripname_result ;; *) func_fatal_error "only absolute run-paths are allowed" ;; esac case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac continue ;; -shared) # The effects of -shared are defined in a previous loop. continue ;; -shrext) prev=shrext continue ;; -static | -static-libtool-libs) # The effects of -static are defined in a previous loop. # We used to do the same as -all-static on platforms that # didn't have a PIC flag, but the assumption that the effects # would be equivalent was wrong. It would break on at least # Digital Unix and AIX. continue ;; -thread-safe) thread_safe=yes continue ;; -version-info) prev=vinfo continue ;; -version-number) prev=vinfo vinfo_number=yes continue ;; -weak) prev=weak continue ;; -Wc,*) func_stripname '-Wc,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $func_quote_for_eval_result" func_append compiler_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Wl,*) func_stripname '-Wl,' '' "$arg" args=$func_stripname_result arg= save_ifs=$IFS; IFS=, for flag in $args; do IFS=$save_ifs func_quote_for_eval "$flag" func_append arg " $wl$func_quote_for_eval_result" func_append compiler_flags " $wl$func_quote_for_eval_result" func_append linker_flags " $func_quote_for_eval_result" done IFS=$save_ifs func_stripname ' ' '' "$arg" arg=$func_stripname_result ;; -Xcompiler) prev=xcompiler continue ;; -Xlinker) prev=xlinker continue ;; -XCClinker) prev=xcclinker continue ;; # -msg_* for osf cc -msg_*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; # Flags to be passed through unchanged, with rationale: # -64, -mips[0-9] enable 64-bit mode for the SGI compiler # -r[0-9][0-9]* specify processor for the SGI compiler # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler # +DA*, +DD* enable 64-bit mode for the HP compiler # -q* compiler args for the IBM compiler # -m*, -t[45]*, -txscale* architecture-specific flags for GCC # -F/path path to uninstalled frameworks, gcc on darwin # -p, -pg, --coverage, -fprofile-* profiling flags for GCC # -fstack-protector* stack protector flags for GCC # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -g*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization # -stdlib=* select c++ std lib with clang -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ -O*|-g*|-flto*|-fwhopr*|-fuse-linker-plugin|-fstack-protector*|-stdlib=*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result func_append compile_command " $arg" func_append finalize_command " $arg" func_append compiler_flags " $arg" continue ;; -Z*) if test os2 = "`expr $host : '.*\(os2\)'`"; then # OS/2 uses -Zxxx to specify OS/2-specific options compiler_flags="$compiler_flags $arg" func_append compile_command " $arg" func_append finalize_command " $arg" case $arg in -Zlinker | -Zstack) prev=xcompiler ;; esac continue else # Otherwise treat like 'Some other compiler flag' below func_quote_for_eval "$arg" arg=$func_quote_for_eval_result fi ;; # Some other compiler flag. -* | +*) func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; *.$objext) # A standard object. func_append objs " $arg" ;; *.lo) # A libtool-controlled object. # Check to see that this really is a libtool object. if func_lalib_unsafe_p "$arg"; then pic_object= non_pic_object= # Read the .lo file func_source "$arg" if test -z "$pic_object" || test -z "$non_pic_object" || test none = "$pic_object" && test none = "$non_pic_object"; then func_fatal_error "cannot find name of object for '$arg'" fi # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result test none = "$pic_object" || { # Prepend the subdirectory the object is found in. pic_object=$xdir$pic_object if test dlfiles = "$prev"; then if test yes = "$build_libtool_libs" && test yes = "$dlopen_support"; then func_append dlfiles " $pic_object" prev= continue else # If libtool objects are unsupported, then we need to preload. prev=dlprefiles fi fi # CHECK ME: I think I busted this. -Ossama if test dlprefiles = "$prev"; then # Preload the old-style object. func_append dlprefiles " $pic_object" prev= fi # A PIC object. func_append libobjs " $pic_object" arg=$pic_object } # Non-PIC object. if test none != "$non_pic_object"; then # Prepend the subdirectory the object is found in. non_pic_object=$xdir$non_pic_object # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test none = "$pic_object"; then arg=$non_pic_object fi else # If the PIC object exists, use it instead. # $xdir was prepended to $pic_object above. non_pic_object=$pic_object func_append non_pic_objects " $non_pic_object" fi else # Only an error if not doing a dry-run. if $opt_dry_run; then # Extract subdirectory from the argument. func_dirname "$arg" "/" "" xdir=$func_dirname_result func_lo2o "$arg" pic_object=$xdir$objdir/$func_lo2o_result non_pic_object=$xdir$func_lo2o_result func_append libobjs " $pic_object" func_append non_pic_objects " $non_pic_object" else func_fatal_error "'$arg' is not a valid libtool object" fi fi ;; *.$libext) # An archive. func_append deplibs " $arg" func_append old_deplibs " $arg" continue ;; *.la) # A libtool-controlled library. func_resolve_sysroot "$arg" if test dlfiles = "$prev"; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test dlprefiles = "$prev"; then # The library was specified with -dlpreopen. func_append dlprefiles " $func_resolve_sysroot_result" prev= else func_append deplibs " $func_resolve_sysroot_result" fi continue ;; # Some other compiler argument. *) # Unknown arguments in both finalize_command and compile_command need # to be aesthetically quoted because they are evaled later. func_quote_for_eval "$arg" arg=$func_quote_for_eval_result ;; esac # arg # Now actually substitute the argument into the commands. if test -n "$arg"; then func_append compile_command " $arg" func_append finalize_command " $arg" fi done # argument parsing loop test -n "$prev" && \ func_fatal_help "the '$prevarg' option requires an argument" if test yes = "$export_dynamic" && test -n "$export_dynamic_flag_spec"; then eval arg=\"$export_dynamic_flag_spec\" func_append compile_command " $arg" func_append finalize_command " $arg" fi oldlibs= # calculate the name of the file, without its directory func_basename "$output" outputname=$func_basename_result libobjs_save=$libobjs if test -n "$shlibpath_var"; then # get the directories listed in $shlibpath_var eval shlib_search_path=\`\$ECHO \"\$$shlibpath_var\" \| \$SED \'s/:/ /g\'\` else shlib_search_path= fi eval sys_lib_search_path=\"$sys_lib_search_path_spec\" eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" # Definition is injected by LT_CONFIG during libtool generation. func_munge_path_list sys_lib_dlsearch_path "$LT_SYS_LIBRARY_PATH" func_dirname "$output" "/" "" output_objdir=$func_dirname_result$objdir func_to_tool_file "$output_objdir/" tool_output_objdir=$func_to_tool_file_result # Create the object directory. func_mkdir_p "$output_objdir" # Determine the type of output case $output in "") func_fatal_help "you must specify an output file" ;; *.$libext) linkmode=oldlib ;; *.lo | *.$objext) linkmode=obj ;; *.la) linkmode=lib ;; *) linkmode=prog ;; # Anything else should be a program. esac specialdeplibs= libs= # Find all interdependent deplibs by searching for libraries # that are linked more than once (e.g. -la -lb -la) for deplib in $deplibs; do if $opt_preserve_dup_deps; then case "$libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append libs " $deplib" done if test lib = "$linkmode"; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $opt_duplicate_compiler_generated_deps; then for pre_post_dep in $predeps $postdeps; do case "$pre_post_deps " in *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; esac func_append pre_post_deps " $pre_post_dep" done fi pre_post_deps= fi deplibs= newdependency_libs= newlib_search_path= need_relink=no # whether we're linking any uninstalled libtool libraries notinst_deplibs= # not-installed libtool libraries notinst_path= # paths that contain not-installed libtool libraries case $linkmode in lib) passes="conv dlpreopen link" for file in $dlfiles $dlprefiles; do case $file in *.la) ;; *) func_fatal_help "libraries can '-dlopen' only libtool libraries: $file" ;; esac done ;; prog) compile_deplibs= finalize_deplibs= alldeplibs=false newdlfiles= newdlprefiles= passes="conv scan dlopen dlpreopen link" ;; *) passes="conv" ;; esac for pass in $passes; do # The preopen pass in lib mode reverses $deplibs; put it back here # so that -L comes before libs that need it for instance... if test lib,link = "$linkmode,$pass"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs=$tmp_deplibs fi if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass"; then libs=$deplibs deplibs= fi if test prog = "$linkmode"; then case $pass in dlopen) libs=$dlfiles ;; dlpreopen) libs=$dlprefiles ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test lib,dlpreopen = "$linkmode,$pass"; then # Collect and forward deplibs of preopened libtool libs for lib in $dlprefiles; do # Ignore non-libtool-libs dependency_libs= func_resolve_sysroot "$lib" case $lib in *.la) func_source "$func_resolve_sysroot_result" ;; esac # Collect preopened libtool deplibs, except any this library # has declared as weak libs for deplib in $dependency_libs; do func_basename "$deplib" deplib_base=$func_basename_result case " $weak_libs " in *" $deplib_base "*) ;; *) func_append deplibs " $deplib" ;; esac done done libs=$dlprefiles fi if test dlopen = "$pass"; then # Collect dlpreopened libraries save_deplibs=$deplibs deplibs= fi for deplib in $libs; do lib= found=false case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test lib != "$linkmode" && test prog != "$linkmode"; then func_warning "'-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test lib = "$linkmode"; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" fi for searchdir in $searchdirs; do for search_ext in .la $std_shrext .so .a; do # Search the libtool library lib=$searchdir/lib$name$search_ext if test -f "$lib"; then if test .la = "$search_ext"; then found=: else found=false fi break 2 fi done done if $found; then # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $deplib "*) if func_lalib_p "$lib"; then library_names= old_library= func_source "$lib" for l in $old_library $library_names; do ll=$l done if test "X$ll" = "X$old_library"; then # only static version available found=false func_dirname "$lib" "" "." ladir=$func_dirname_result lib=$ladir/$old_library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi else # deplib doesn't seem to be a libtool library if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test lib = "$linkmode" && newdependency_libs="$deplib $newdependency_libs" fi continue fi ;; # -l *.ltframework) if test prog,link = "$linkmode,$pass"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test lib = "$linkmode"; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test conv = "$pass" && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi if test scan = "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; *) func_warning "'-L' is ignored for archives/objects" ;; esac # linkmode continue ;; # -L -R*) if test link = "$pass"; then func_stripname '-R' '' "$deplib" func_resolve_sysroot "$func_stripname_result" dir=$func_resolve_sysroot_result # Make sure the xrpath contains only unique directories. case "$xrpath " in *" $dir "*) ;; *) func_append xrpath " $dir" ;; esac fi deplibs="$deplib $deplibs" continue ;; *.la) func_resolve_sysroot "$deplib" lib=$func_resolve_sysroot_result ;; *.$libext) if test conv = "$pass"; then deplibs="$deplib $deplibs" continue fi case $linkmode in lib) # Linking convenience modules into shared libraries is allowed, # but linking other static libraries is non-portable. case " $dlpreconveniencelibs " in *" $deplib "*) ;; *) valid_a_lib=false case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=: fi ;; pass_all) valid_a_lib=: ;; esac if $valid_a_lib; then echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" else echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." fi ;; esac continue ;; prog) if test link != "$pass"; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test conv = "$pass"; then deplibs="$deplib $deplibs" elif test prog = "$linkmode"; then if test dlpreopen = "$pass" || test yes != "$dlopen_support" || test no = "$build_libtool_libs"; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=: continue ;; esac # case $deplib $found || test -f "$lib" \ || func_fatal_error "cannot find the library '$lib' or unhandled argument '$deplib'" # Check to see that this really is a libtool archive. func_lalib_unsafe_p "$lib" \ || func_fatal_error "'$lib' is not a valid libtool archive" func_dirname "$lib" "" "." ladir=$func_dirname_result dlname= dlopen= dlpreopen= libdir= library_names= old_library= inherited_linker_flags= # If the library was installed with an old release of libtool, # it will not redefine variables installed, or shouldnotlink installed=yes shouldnotlink=no avoidtemprpath= # Read the .la file func_source "$lib" # Convert "-framework foo" to "foo.ltframework" if test -n "$inherited_linker_flags"; then tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do case " $new_inherited_linker_flags " in *" $tmp_inherited_linker_flag "*) ;; *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; esac done fi dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` if test lib,link = "$linkmode,$pass" || test prog,scan = "$linkmode,$pass" || { test prog != "$linkmode" && test lib != "$linkmode"; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test conv = "$pass"; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then func_fatal_error "cannot find name of link library for '$lib'" fi # It is a libtool convenience library, so add in its objects. func_append convenience " $ladir/$objdir/$old_library" func_append old_convenience " $ladir/$objdir/$old_library" elif test prog != "$linkmode" && test lib != "$linkmode"; then func_fatal_error "'$lib' is not a convenience library" fi tmp_libs= for deplib in $dependency_libs; do deplibs="$deplib $deplibs" if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done continue fi # $pass = conv # Get the name of the library we link against. linklib= if test -n "$old_library" && { test yes = "$prefer_static_libs" || test built,no = "$prefer_static_libs,$installed"; }; then linklib=$old_library else for l in $old_library $library_names; do linklib=$l done fi if test -z "$linklib"; then func_fatal_error "cannot find name of link library for '$lib'" fi # This library was specified with -dlopen. if test dlopen = "$pass"; then test -z "$libdir" \ && func_fatal_error "cannot -dlopen a convenience library: '$lib'" if test -z "$dlname" || test yes != "$dlopen_support" || test no = "$build_libtool_libs" then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. func_append dlprefiles " $lib $dependency_libs" else func_append newdlfiles " $lib" fi continue fi # $pass = dlopen # We need an absolute path. case $ladir in [\\/]* | [A-Za-z]:[\\/]*) abs_ladir=$ladir ;; *) abs_ladir=`cd "$ladir" && pwd` if test -z "$abs_ladir"; then func_warning "cannot determine absolute directory name of '$ladir'" func_warning "passing it literally to the linker, although it might fail" abs_ladir=$ladir fi ;; esac func_basename "$lib" laname=$func_basename_result # Find the relevant object directory and library name. if test yes = "$installed"; then if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then func_warning "library '$lib' was moved." dir=$ladir absdir=$abs_ladir libdir=$abs_ladir else dir=$lt_sysroot$libdir absdir=$lt_sysroot$libdir fi test yes = "$hardcode_automatic" && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir=$ladir absdir=$abs_ladir # Remove this search path later func_append notinst_path " $abs_ladir" else dir=$ladir/$objdir absdir=$abs_ladir/$objdir # Remove this search path later func_append notinst_path " $abs_ladir" fi fi # $installed = yes func_stripname 'lib' '.la' "$laname" name=$func_stripname_result # This library was specified with -dlpreopen. if test dlpreopen = "$pass"; then if test -z "$libdir" && test prog = "$linkmode"; then func_fatal_error "only libraries may -dlpreopen a convenience library: '$lib'" fi case $host in # special handling for platforms with PE-DLLs. *cygwin* | *mingw* | *cegcc* ) # Linker will automatically link against shared library if both # static and shared are present. Therefore, ensure we extract # symbols from the import library if a shared library is present # (otherwise, the dlopen module name will be incorrect). We do # this by putting the import library name into $newdlprefiles. # We recover the dlopen module name by 'saving' the la file # name in a special purpose variable, and (later) extracting the # dlname from the la file. if test -n "$dlname"; then func_tr_sh "$dir/$linklib" eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" func_append newdlprefiles " $dir/$linklib" else func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" fi ;; * ) # Prefer using a static library (so that no silly _DYNAMIC symbols # are required to link). if test -n "$old_library"; then func_append newdlprefiles " $dir/$old_library" # Keep a list of preopened convenience libraries to check # that they are being used correctly in the link pass. test -z "$libdir" && \ func_append dlpreconveniencelibs " $dir/$old_library" # Otherwise, use the dlname, so that lt_dlopen finds it. elif test -n "$dlname"; then func_append newdlprefiles " $dir/$dlname" else func_append newdlprefiles " $dir/$linklib" fi ;; esac fi # $pass = dlpreopen if test -z "$libdir"; then # Link the convenience library if test lib = "$linkmode"; then deplibs="$dir/$old_library $deplibs" elif test prog,link = "$linkmode,$pass"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test prog = "$linkmode" && test link != "$pass"; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=false if test no != "$link_all_deplibs" || test -z "$library_names" || test no = "$build_libtool_libs"; then linkalldeplibs=: fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; esac # Need to link against all dependency_libs? if $linkalldeplibs; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $deplib "*) func_append specialdeplibs " $deplib" ;; esac fi func_append tmp_libs " $deplib" done # for deplib continue fi # $linkmode = prog... if test prog,link = "$linkmode,$pass"; then if test -n "$library_names" && { { test no = "$prefer_static_libs" || test built,yes = "$prefer_static_libs,$installed"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath"; then # Make sure the rpath contains only unique directories. case $temp_rpath: in *"$absdir:"*) ;; *) func_append temp_rpath "$absdir:" ;; esac fi # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi # $linkmode,$pass = prog,link... if $alldeplibs && { test pass_all = "$deplibs_check_method" || { test yes = "$build_libtool_libs" && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test built = "$use_static_libs" && test yes = "$installed"; then use_static_libs=no fi if test -n "$library_names" && { test no = "$use_static_libs" || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc* | *os2*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test no = "$installed"; then func_append notinst_deplibs " $lib" need_relink=yes fi ;; esac # This is a shared library # Warn about portability, can't link against -module's on some # systems (darwin). Don't bleat about dlopened modules though! dlopenmodule= for dlpremoduletest in $dlprefiles; do if test "X$dlpremoduletest" = "X$lib"; then dlopenmodule=$dlpremoduletest break fi done if test -z "$dlopenmodule" && test yes = "$shouldnotlink" && test link = "$pass"; then echo if test prog = "$linkmode"; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test lib = "$linkmode" && test yes = "$hardcode_into_libs"; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) func_append compile_rpath " $absdir" ;; esac ;; esac case " $sys_lib_dlsearch_path " in *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac ;; esac fi if test -n "$old_archive_from_expsyms_cmds"; then # figure out the soname set dummy $library_names shift realname=$1 shift libname=`eval "\\$ECHO \"$libname_spec\""` # use dlname if we got it. it's perfectly good, no? if test -n "$dlname"; then soname=$dlname elif test -n "$soname_spec"; then # bleh windows case $host in *cygwin* | mingw* | *cegcc* | *os2*) func_arith $current - $age major=$func_arith_result versuffix=-$major ;; esac eval soname=\"$soname_spec\" else soname=$realname fi # Make a new name for the extract_expsyms_cmds to use soroot=$soname func_basename "$soroot" soname=$func_basename_result func_stripname 'lib' '.dll' "$soname" newlib=libimp-$func_stripname_result.a # If the library has no export list, then create one now if test -f "$output_objdir/$soname-def"; then : else func_verbose "extracting exported symbol list from '$soname'" func_execute_cmds "$extract_expsyms_cmds" 'exit $?' fi # Create $newlib if test -f "$output_objdir/$newlib"; then :; else func_verbose "generating import library for '$soname'" func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' fi # make sure the library variables are pointing to the new library dir=$output_objdir linklib=$newlib fi # test -n "$old_archive_from_expsyms_cmds" if test prog = "$linkmode" || test relink != "$opt_mode"; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test no = "$hardcode_direct"; then add=$dir/$linklib case $host in *-*-sco3.2v5.0.[024]*) add_dir=-L$dir ;; *-*-sysv4*uw2*) add_dir=-L$dir ;; *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ *-*-unixware7*) add_dir=-L$dir ;; *-*-darwin* ) # if the lib is a (non-dlopened) module then we cannot # link against it, someone is ignoring the earlier warnings if /usr/bin/file -L $add 2> /dev/null | $GREP ": [^:]* bundle" >/dev/null; then if test "X$dlopenmodule" != "X$lib"; then $ECHO "*** Warning: lib $linklib is a module, not a shared library" if test -z "$old_library"; then echo echo "*** And there doesn't seem to be a static archive available" echo "*** The link will probably fail, sorry" else add=$dir/$old_library fi elif test -n "$old_library"; then add=$dir/$old_library fi fi esac elif test no = "$hardcode_minus_L"; then case $host in *-*-sunos*) add_shlibpath=$dir ;; esac add_dir=-L$dir add=-l$name elif test no = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; relink) if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$dir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$absdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name elif test yes = "$hardcode_shlibpath_var"; then add_shlibpath=$dir add=-l$name else lib_linked=no fi ;; *) lib_linked=no ;; esac if test yes != "$lib_linked"; then func_fatal_configuration "unsupported hardcode properties" fi if test -n "$add_shlibpath"; then case :$compile_shlibpath: in *":$add_shlibpath:"*) ;; *) func_append compile_shlibpath "$add_shlibpath:" ;; esac fi if test prog = "$linkmode"; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test yes != "$hardcode_direct" && test yes != "$hardcode_minus_L" && test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test prog = "$linkmode" || test relink = "$opt_mode"; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test yes = "$hardcode_direct" && test no = "$hardcode_direct_absolute"; then add=$libdir/$linklib elif test yes = "$hardcode_minus_L"; then add_dir=-L$libdir add=-l$name elif test yes = "$hardcode_shlibpath_var"; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add=-l$name elif test yes = "$hardcode_automatic"; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib"; then add=$inst_prefix_dir$libdir/$linklib else add=$libdir/$linklib fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir=-L$libdir # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add=-l$name fi if test prog = "$linkmode"; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test prog = "$linkmode"; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test unsupported != "$hardcode_direct"; then test -n "$old_library" && linklib=$old_library compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test yes = "$build_libtool_libs"; then # Not a shared library if test pass_all != "$deplibs_check_method"; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system cannot link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test yes = "$module"; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test lib = "$linkmode"; then if test -n "$dependency_libs" && { test yes != "$hardcode_into_libs" || test yes = "$build_old_libs" || test yes = "$link_static"; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) func_stripname '-R' '' "$libdir" temp_xrpath=$func_stripname_result case " $xrpath " in *" $temp_xrpath "*) ;; *) func_append xrpath " $temp_xrpath";; esac;; *) func_append temp_deplibs " $libdir";; esac done dependency_libs=$temp_deplibs fi func_append newlib_search_path " $absdir" # Link against this library test no = "$link_static" && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $deplib in -L*) func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result";; *) func_resolve_sysroot "$deplib" ;; esac if $opt_preserve_dup_deps; then case "$tmp_libs " in *" $func_resolve_sysroot_result "*) func_append specialdeplibs " $func_resolve_sysroot_result" ;; esac fi func_append tmp_libs " $func_resolve_sysroot_result" done if test no != "$link_all_deplibs"; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path=$deplib ;; *.la) func_resolve_sysroot "$deplib" deplib=$func_resolve_sysroot_result func_dirname "$deplib" "" "." dir=$func_dirname_result # We need an absolute path. case $dir in [\\/]* | [A-Za-z]:[\\/]*) absdir=$dir ;; *) absdir=`cd "$dir" && pwd` if test -z "$absdir"; then func_warning "cannot determine absolute directory name of '$dir'" absdir=$dir fi ;; esac if $GREP "^installed=no" $deplib > /dev/null; then case $host in *-*-darwin*) depdepl= eval deplibrary_names=`$SED -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` if test -n "$deplibrary_names"; then for tmp in $deplibrary_names; do depdepl=$tmp done if test -f "$absdir/$objdir/$depdepl"; then depdepl=$absdir/$objdir/$depdepl darwin_install_name=`$OTOOL -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` if test -z "$darwin_install_name"; then darwin_install_name=`$OTOOL64 -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` fi func_append compiler_flags " $wl-dylib_file $wl$darwin_install_name:$depdepl" func_append linker_flags " -dylib_file $darwin_install_name:$depdepl" path= fi fi ;; *) path=-L$absdir/$objdir ;; esac else eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" test "$absdir" != "$libdir" && \ func_warning "'$deplib' seems to be moved" path=-L$absdir fi ;; esac case " $deplibs " in *" $path "*) ;; *) deplibs="$path $deplibs" ;; esac done fi # link_all_deplibs != no fi # linkmode = lib done # for deplib in $libs if test link = "$pass"; then if test prog = "$linkmode"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs=$newdependency_libs if test dlpreopen = "$pass"; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test dlopen != "$pass"; then test conv = "$pass" || { # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= } if test prog,link = "$linkmode,$pass"; then vars="compile_deplibs finalize_deplibs" else vars=deplibs fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Add Sun CC postdeps if required: test CXX = "$tagname" && { case $host_os in linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; solaris*) func_cc_basename "$CC" case $func_cc_basename_result in CC* | sunCC*) func_suncc_cstd_abi if test no != "$suncc_use_cstd_abi"; then func_append postdeps ' -library=Cstd -library=Crun' fi ;; esac ;; esac } # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i= ;; esac if test -n "$i"; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test prog = "$linkmode"; then dlfiles=$newdlfiles fi if test prog = "$linkmode" || test lib = "$linkmode"; then dlprefiles=$newdlprefiles fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for archives" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for archives" test -n "$xrpath" && \ func_warning "'-R' is ignored for archives" test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for archives" test -n "$release" && \ func_warning "'-release' is ignored for archives" test -n "$export_symbols$export_symbols_regex" && \ func_warning "'-export-symbols' is ignored for archives" # Now set the variables for building old libraries. build_libtool_libs=no oldlibs=$output func_append objs "$old_deplibs" ;; lib) # Make sure we only generate libraries of the form 'libNAME.la'. case $outputname in lib*) func_stripname 'lib' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" ;; *) test no = "$module" \ && func_fatal_help "libtool library '$output' must begin with 'lib'" if test no != "$need_lib_prefix"; then # Add the "lib" prefix for modules if required func_stripname '' '.la' "$outputname" name=$func_stripname_result eval shared_ext=\"$shrext_cmds\" eval libname=\"$libname_spec\" else func_stripname '' '.la' "$outputname" libname=$func_stripname_result fi ;; esac if test -n "$objs"; then if test pass_all != "$deplibs_check_method"; then func_fatal_error "cannot build libtool library '$output' from non-libtool objects on this host:$objs" else echo $ECHO "*** Warning: Linking the shared library $output against the non-libtool" $ECHO "*** objects $objs is not portable!" func_append libobjs " $objs" fi fi test no = "$dlself" \ || func_warning "'-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test 1 -lt "$#" \ && func_warning "ignoring multiple '-rpath's for a libtool library" install_libdir=$1 oldlibs= if test -z "$rpath"; then if test yes = "$build_libtool_libs"; then # Building a libtool convenience library. # Some compilers have problems with a '.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi test -n "$vinfo" && \ func_warning "'-version-info/-version-number' is ignored for convenience libraries" test -n "$release" && \ func_warning "'-release' is ignored for convenience libraries" else # Parse the version information argument. save_ifs=$IFS; IFS=: set dummy $vinfo 0 0 0 shift IFS=$save_ifs test -n "$7" && \ func_fatal_help "too many parameters to '-version-info'" # convert absolute version numbers to libtool ages # this retains compatibility with .la files and attempts # to make the code below a bit more comprehensible case $vinfo_number in yes) number_major=$1 number_minor=$2 number_revision=$3 # # There are really only two kinds -- those that # use the current revision as the major version # and those that subtract age and use age as # a minor version. But, then there is irix # that has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|freebsd-elf|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_revision ;; freebsd-aout|qnx|sunos) current=$number_major revision=$number_minor age=0 ;; irix|nonstopux) func_arith $number_major + $number_minor current=$func_arith_result age=$number_minor revision=$number_minor lt_irix_increment=no ;; esac ;; no) current=$1 revision=$2 age=$3 ;; esac # Check that each of the things are valid numbers. case $current in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "CURRENT '$current' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $revision in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "REVISION '$revision' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac case $age in 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; *) func_error "AGE '$age' must be a nonnegative integer" func_fatal_error "'$vinfo' is not valid version information" ;; esac if test "$age" -gt "$current"; then func_error "AGE '$age' is greater than the current interface number '$current'" func_fatal_error "'$vinfo' is not valid version information" fi # Calculate the version variables. major= versuffix= verstring= case $version_type in none) ;; darwin) # Like Linux, but with the current version available in # verstring for coding it into the library header func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision # Darwin ld doesn't like 0 for these options... func_arith $current + 1 minor_current=$func_arith_result xlcverstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" # On Darwin other compilers case $CC in nagfor*) verstring="$wl-compatibility_version $wl$minor_current $wl-current_version $wl$minor_current.$revision" ;; *) verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" ;; esac ;; freebsd-aout) major=.$current versuffix=.$current.$revision ;; freebsd-elf) func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; irix | nonstopux) if test no = "$lt_irix_increment"; then func_arith $current - $age else func_arith $current - $age + 1 fi major=$func_arith_result case $version_type in nonstopux) verstring_prefix=nonstopux ;; *) verstring_prefix=sgi ;; esac verstring=$verstring_prefix$major.$revision # Add in all the interfaces that we are compatible with. loop=$revision while test 0 -ne "$loop"; do func_arith $revision - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring_prefix$major.$iface:$verstring done # Before this point, $major must not contain '.'. major=.$major versuffix=$major.$revision ;; linux) # correct to gnu/linux during the next big refactor func_arith $current - $age major=.$func_arith_result versuffix=$major.$age.$revision ;; osf) func_arith $current - $age major=.$func_arith_result versuffix=.$current.$age.$revision verstring=$current.$age.$revision # Add in all the interfaces that we are compatible with. loop=$age while test 0 -ne "$loop"; do func_arith $current - $loop iface=$func_arith_result func_arith $loop - 1 loop=$func_arith_result verstring=$verstring:$iface.0 done # Make executables depend on our current version. func_append verstring ":$current.0" ;; qnx) major=.$current versuffix=.$current ;; sco) major=.$current versuffix=.$current ;; sunos) major=.$current versuffix=.$current.$revision ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 file systems. func_arith $current - $age major=$func_arith_result versuffix=-$major ;; *) func_fatal_configuration "unknown library version type '$version_type'" ;; esac # Clear the version info if we defaulted, and they specified a release. if test -z "$vinfo" && test -n "$release"; then major= case $version_type in darwin) # we can't check for "0.0" in archive_cmds due to quoting # problems, so we reset it completely verstring= ;; *) verstring=0.0 ;; esac if test no = "$need_version"; then versuffix= else versuffix=.0.0 fi fi # Remove version info from name if versioning should be avoided if test yes,no = "$avoid_version,$need_version"; then major= versuffix= verstring= fi # Check to see if the archive will have undefined symbols. if test yes = "$allow_undefined"; then if test unsupported = "$allow_undefined_flag"; then if test yes = "$build_old_libs"; then func_warning "undefined symbols not allowed in $host shared libraries; building static only" build_libtool_libs=no else func_fatal_error "can't build $host shared library unless -no-undefined is specified" fi fi else # Don't allow undefined symbols. allow_undefined_flag=$no_undefined_flag fi fi func_generate_dlsyms "$libname" "$libname" : func_append libobjs " $symfileobj" test " " = "$libobjs" && libobjs= if test relink != "$opt_mode"; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/$libname$release.*) if test -n "$precious_files_regex"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then continue fi fi func_append removelist " $p" ;; *) ;; esac done test -n "$removelist" && \ func_show_eval "${RM}r \$removelist" fi # Now set the variables for building old libraries. if test yes = "$build_old_libs" && test convenience != "$build_libtool_libs"; then func_append oldlibs " $output_objdir/$libname.$libext" # Transform .lo files to .o files. oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; $lo2o" | $NL2SP` fi # Eliminate all temporary directories. #for path in $notinst_path; do # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` #done if test -n "$xrpath"; then # If the user specified any rpath flags, then add them. temp_xrpath= for libdir in $xrpath; do func_replace_sysroot "$libdir" func_append temp_xrpath " -R$func_replace_sysroot_result" case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done if test yes != "$hardcode_into_libs" || test yes = "$build_old_libs"; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles=$dlfiles dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) func_append dlfiles " $lib" ;; esac done # Make sure dlprefiles contains only unique files old_dlprefiles=$dlprefiles dlprefiles= for lib in $old_dlprefiles; do case "$dlprefiles " in *" $lib "*) ;; *) func_append dlprefiles " $lib" ;; esac done if test yes = "$build_libtool_libs"; then if test -n "$rpath"; then case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) # these systems don't actually have a c library (as such)! ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C library is in the System framework func_append deplibs " System.ltframework" ;; *-*-netbsd*) # Don't link with libc until the a.out ld.so is fixed. ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work ;; *) # Add libc to deplibs on all other systems if necessary. if test yes = "$build_libtool_need_lc"; then func_append deplibs " -lc" fi ;; esac fi # Transform deplibs into only deplibs that can be linked in shared. name_save=$name libname_save=$libname release_save=$release versuffix_save=$versuffix major_save=$major # I'm not sure if I'm treating the release correctly. I think # release should show up in the -l (ie -lgmp5) so we don't want to # add it in twice. Is that correct? release= versuffix= major= newdeplibs= droppeddeps=no case $deplibs_check_method in pass_all) # Don't check for shared/static. Everything works. # This might be a little naive. We might want to check # whether the library exists or not. But this is on # osf3 & osf4 and I'm not really sure... Just # implementing what was already the behavior. newdeplibs=$deplibs ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it # against the deplibs as a proxy for the library. Then we can check # whether they linked in statically or dynamically with ldd. $opt_dry_run || $RM conftest.c cat > conftest.c </dev/null` $nocaseglob else potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` fi for potent_lib in $potential_libs; do # Follow soft links. if ls -lLd "$potent_lib" 2>/dev/null | $GREP " -> " >/dev/null; then continue fi # The statement above tries to avoid entering an # endless loop below, in case of cyclic links. # We might still enter an endless loop, since a link # loop can be closed while we follow links, # but so what? potlib=$potent_lib while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | $SED 's/.* -> //'` case $potliblink in [\\/]* | [A-Za-z]:[\\/]*) potlib=$potliblink;; *) potlib=`$ECHO "$potlib" | $SED 's|[^/]*$||'`"$potliblink";; esac done if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | $SED -e 10q | $EGREP "$file_magic_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for file magic test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a file magic. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` for a_deplib in $deplibs; do case $a_deplib in -l*) func_stripname -l '' "$a_deplib" name=$func_stripname_result if test yes = "$allow_libtool_libs_with_static_runtimes"; then case " $predeps $postdeps " in *" $a_deplib "*) func_append newdeplibs " $a_deplib" a_deplib= ;; esac fi if test -n "$a_deplib"; then libname=`eval "\\$ECHO \"$libname_spec\""` for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do potlib=$potent_lib # see symlink-check above in file_magic test if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ $EGREP "$match_pattern_regex" > /dev/null; then func_append newdeplibs " $a_deplib" a_deplib= break 2 fi done done fi if test -n "$a_deplib"; then droppeddeps=yes echo $ECHO "*** Warning: linker path does not have real file for library $a_deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because I did check the linker path looking for a file starting" if test -z "$potlib"; then $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" else $ECHO "*** with $libname and none of the candidates passed a file format test" $ECHO "*** using a regex pattern. Last file checked: $potlib" fi fi ;; *) # Add a -L argument. func_append newdeplibs " $a_deplib" ;; esac done # Gone through all deplibs. ;; none | unknown | *) newdeplibs= tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` if test yes = "$allow_libtool_libs_with_static_runtimes"; then for i in $predeps $postdeps; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s|$i||"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test none = "$deplibs_check_method"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; esac ;; esac versuffix=$versuffix_save major=$major_save release=$release_save libname=$libname_save name=$name_save case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library with the System framework newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac if test yes = "$droppeddeps"; then if test yes = "$module"; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using 'nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** 'nm' from GNU binutils and a full rebuild may help." fi if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test no = "$allow_undefined"; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test no = "$build_old_libs"; then oldlibs=$output_objdir/$libname.$libext build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" case $host in *-*-darwin*) newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done deplibs=$new_libs # All the library-specific variables (install_libdir is set above). library_names= old_library= dlname= # Test again, we may have decided not to build it any more if test yes = "$build_libtool_libs"; then # Remove $wl instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test yes = "$hardcode_into_libs"; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath=$finalize_rpath test relink = "$opt_mode" || rpath=$compile_rpath$rpath for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then func_replace_sysroot "$libdir" libdir=$func_replace_sysroot_result if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append dep_rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval "dep_rpath=\"$hardcode_libdir_flag_spec\"" fi if test -n "$runpath_var" && test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" fi test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" fi shlibpath=$finalize_shlibpath test relink = "$opt_mode" || shlibpath=$compile_shlibpath$shlibpath if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names shift realname=$1 shift if test -n "$soname_spec"; then eval soname=\"$soname_spec\" else soname=$realname fi if test -z "$dlname"; then dlname=$soname fi lib=$output_objdir/$realname linknames= for link do func_append linknames " $link" done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` test "X$libobjs" = "X " && libobjs= delfiles= if test -n "$export_symbols" && test -n "$include_expsyms"; then $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" export_symbols=$output_objdir/$libname.uexp func_append delfiles " $export_symbols" fi orig_export_symbols= case $host_os in cygwin* | mingw* | cegcc*) if test -n "$export_symbols" && test -z "$export_symbols_regex"; then # exporting using user supplied symfile func_dll_def_p "$export_symbols" || { # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols=$export_symbols export_symbols= always_export_symbols=yes } fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test yes = "$always_export_symbols" || test -n "$export_symbols_regex"; then func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols cmds=$export_symbols_cmds save_ifs=$IFS; IFS='~' for cmd1 in $cmds; do IFS=$save_ifs # Take the normal branch if the nm_file_list_spec branch # doesn't work or if tool conversion is not needed. case $nm_file_list_spec~$to_tool_file_cmd in *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) try_normal_branch=yes eval cmd=\"$cmd1\" func_len " $cmd" len=$func_len_result ;; *) try_normal_branch=no ;; esac if test yes = "$try_normal_branch" \ && { test "$len" -lt "$max_cmd_len" \ || test "$max_cmd_len" -le -1; } then func_show_eval "$cmd" 'exit $?' skipped_export=false elif test -n "$nm_file_list_spec"; then func_basename "$output" output_la=$func_basename_result save_libobjs=$libobjs save_output=$output output=$output_objdir/$output_la.nm func_to_tool_file "$output" libobjs=$nm_file_list_spec$func_to_tool_file_result func_append delfiles " $output" func_verbose "creating $NM input file list: $output" for obj in $save_libobjs; do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > "$output" eval cmd=\"$cmd1\" func_show_eval "$cmd" 'exit $?' output=$save_output libobjs=$save_libobjs skipped_export=false else # The command line is too long to execute in one step. func_verbose "using reloadable object file for export list..." skipped_export=: # Break out early, otherwise skipped_export may be # set to false by a later but shorter cmd. break fi done IFS=$save_ifs if test -n "$export_symbols_regex" && test : != "$skipped_export"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test : != "$skipped_export" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi tmp_deplibs= for test_deplib in $deplibs; do case " $convenience " in *" $test_deplib "*) ;; *) func_append tmp_deplibs " $test_deplib" ;; esac done deplibs=$tmp_deplibs if test -n "$convenience"; then if test -n "$whole_archive_flag_spec" && test yes = "$compiler_needs_object" && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $convenience func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi fi if test yes = "$thread_safe" && test -n "$thread_safe_flag_spec"; then eval flag=\"$thread_safe_flag_spec\" func_append linker_flags " $flag" fi # Make a backup of the uninstalled library when relinking if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? fi # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test : != "$skipped_export" && func_len " $test_cmds" && len=$func_len_result && test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then : else # The command line is too long to link in one step, link piecewise # or, if using GNU ld and skipped_export is not :, use a linker # script. # Save the value of $output and $libobjs because we want to # use them later. If we have whole_archive_flag_spec, we # want to use save_libobjs as it was before # whole_archive_flag_spec was expanded, because we can't # assume the linker understands whole_archive_flag_spec. # This may have to be revisited, in case too many # convenience libraries get linked in and end up exceeding # the spec. if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then save_libobjs=$libobjs fi save_output=$output func_basename "$output" output_la=$func_basename_result # Clear the reloadable object creation command queue and # initialize k to one. test_cmds= concat_cmds= objlist= last_robj= k=1 if test -n "$save_libobjs" && test : != "$skipped_export" && test yes = "$with_gnu_ld"; then output=$output_objdir/$output_la.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done echo ')' >> $output func_append delfiles " $output" func_to_tool_file "$output" output=$func_to_tool_file_result elif test -n "$save_libobjs" && test : != "$skipped_export" && test -n "$file_list_spec"; then output=$output_objdir/$output_la.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test yes = "$compiler_needs_object"; then firstobj="$1 " shift fi for obj do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" >> $output done func_append delfiles " $output" func_to_tool_file "$output" output=$firstobj\"$file_list_spec$func_to_tool_file_result\" else if test -n "$save_libobjs"; then func_verbose "creating reloadable object files..." output=$output_objdir/$output_la-$k.$objext eval test_cmds=\"$reload_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 # Loop over the list of objects to be linked. for obj in $save_libobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result if test -z "$objlist" || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test 1 -eq "$k"; then # The first file doesn't have a previous command to add. reload_objs=$objlist eval concat_cmds=\"$reload_cmds\" else # All subsequent reloadable object files will link in # the last one created. reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" fi last_robj=$output_objdir/$output_la-$k.$objext func_arith $k + 1 k=$func_arith_result output=$output_objdir/$output_la-$k.$objext objlist=" $obj" func_len " $last_robj" func_arith $len0 + $func_len_result len=$func_arith_result fi done # Handle the remaining objects by creating one last # reloadable object file. All subsequent reloadable object # files will link in the last one created. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ reload_objs="$objlist $last_robj" eval concat_cmds=\"\$concat_cmds$reload_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi func_append delfiles " $output" else output= fi ${skipped_export-false} && { func_verbose "generating symbol list for '$libname.la'" export_symbols=$output_objdir/$libname.exp $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi } test -n "$save_libobjs" && func_verbose "creating a temporary reloadable object file: $output" # Loop through the commands generated above and execute them. save_ifs=$IFS; IFS='~' for cmd in $concat_cmds; do IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs if test -n "$export_symbols_regex" && ${skipped_export-false}; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi ${skipped_export-false} && { if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols=$export_symbols test -n "$orig_export_symbols" && tmp_export_symbols=$orig_export_symbols $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' fi if test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for '$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands, which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter func_append delfiles " $export_symbols $output_objdir/$libname.filter" export_symbols=$output_objdir/$libname.def $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols fi } libobjs=$output # Restore the value of output. output=$save_output if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= fi # Expand the library linking commands again to reset the # value of $libobjs for piecewise linking. # Do each of the archive commands. if test yes = "$module" && test -n "$module_cmds"; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi fi if test -n "$delfiles"; then # Append the command to remove temporary files to $cmds. eval cmds=\"\$cmds~\$RM $delfiles\" fi # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append libobjs " $func_extract_archives_result" test "X$libobjs" = "X " && libobjs= fi save_ifs=$IFS; IFS='~' for cmd in $cmds; do IFS=$sp$nl eval cmd=\"$cmd\" IFS=$save_ifs $opt_quiet || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test relink = "$opt_mode"; then ( cd "$output_objdir" && \ $RM "${realname}T" && \ $MV "${realname}U" "$realname" ) fi exit $lt_exit } done IFS=$save_ifs # Restore the uninstalled library and exit if test relink = "$opt_mode"; then $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? if test -n "$convenience"; then if test -z "$whole_archive_flag_spec"; then func_show_eval '${RM}r "$gentop"' fi fi exit $EXIT_SUCCESS fi # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' fi done # If -module or -export-dynamic was specified, set the dlname. if test yes = "$module" || test yes = "$export_dynamic"; then # On all known operating systems, these are identical. dlname=$soname fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test no != "$dlself"; then func_warning "'-dlopen' is ignored for objects" fi case " $deplibs" in *\ -l* | *\ -L*) func_warning "'-l' and '-L' are ignored for objects" ;; esac test -n "$rpath" && \ func_warning "'-rpath' is ignored for objects" test -n "$xrpath" && \ func_warning "'-R' is ignored for objects" test -n "$vinfo" && \ func_warning "'-version-info' is ignored for objects" test -n "$release" && \ func_warning "'-release' is ignored for objects" case $output in *.lo) test -n "$objs$old_deplibs" && \ func_fatal_error "cannot build library object '$output' from non-libtool objects" libobj=$output func_lo2o "$libobj" obj=$func_lo2o_result ;; *) libobj= obj=$output ;; esac # Delete the old objects. $opt_dry_run || $RM $obj $libobj # Objects from convenience libraries. This assumes # single-version convenience libraries. Whenever we create # different ones for PIC/non-PIC, this we'll have to duplicate # the extraction. reload_conv_objs= gentop= # if reload_cmds runs $LD directly, get rid of -Wl from # whole_archive_flag_spec and hope we can get by with turning comma # into space. case $reload_cmds in *\$LD[\ \$]*) wl= ;; esac if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" test -n "$wl" || tmp_whole_archive_flags=`$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` reload_conv_objs=$reload_objs\ $tmp_whole_archive_flags else gentop=$output_objdir/${obj}x func_append generated " $gentop" func_extract_archives $gentop $convenience reload_conv_objs="$reload_objs $func_extract_archives_result" fi fi # If we're not building shared, we need to use non_pic_objs test yes = "$build_libtool_libs" || libobjs=$non_pic_objects # Create the old-style object. reload_objs=$objs$old_deplibs' '`$ECHO "$libobjs" | $SP2NL | $SED "/\.$libext$/d; /\.lib$/d; $lo2o" | $NL2SP`' '$reload_conv_objs output=$obj func_execute_cmds "$reload_cmds" 'exit $?' # Exit if we aren't doing a library object file. if test -z "$libobj"; then if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS fi test yes = "$build_libtool_libs" || { if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. # $show "echo timestamp > $libobj" # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? exit $EXIT_SUCCESS } if test -n "$pic_flag" || test default != "$pic_mode"; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output=$libobj func_execute_cmds "$reload_cmds" 'exit $?' fi if test -n "$gentop"; then func_show_eval '${RM}r "$gentop"' fi exit $EXIT_SUCCESS ;; prog) case $host in *cygwin*) func_stripname '' '.exe' "$output" output=$func_stripname_result.exe;; esac test -n "$vinfo" && \ func_warning "'-version-info' is ignored for programs" test -n "$release" && \ func_warning "'-release' is ignored for programs" $preload \ && test unknown,unknown,unknown = "$dlopen_support,$dlopen_self,$dlopen_self_static" \ && func_warning "'LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` ;; esac case $host in *-*-darwin*) # Don't allow lazy linking, it breaks C++ global constructors # But is supposedly fixed on 10.4 or later (yay!). if test CXX = "$tagname"; then case ${MACOSX_DEPLOYMENT_TARGET-10.0} in 10.[0123]) func_append compile_command " $wl-bind_at_load" func_append finalize_command " $wl-bind_at_load" ;; esac fi # Time to change all our "foo.ltframework" stuff back to "-framework foo" compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` ;; esac # move library search paths that coincide with paths to not yet # installed libraries to the beginning of the library search list new_libs= for path in $notinst_path; do case " $new_libs " in *" -L$path/$objdir "*) ;; *) case " $compile_deplibs " in *" -L$path/$objdir "*) func_append new_libs " -L$path/$objdir" ;; esac ;; esac done for deplib in $compile_deplibs; do case $deplib in -L*) case " $new_libs " in *" $deplib "*) ;; *) func_append new_libs " $deplib" ;; esac ;; *) func_append new_libs " $deplib" ;; esac done compile_deplibs=$new_libs func_append compile_command " $compile_deplibs" func_append finalize_command " $finalize_deplibs" if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do # This is the magic to use -rpath. case "$finalize_rpath " in *" $libdir "*) ;; *) func_append finalize_rpath " $libdir" ;; esac done fi # Now hardcode the library paths rpath= hardcode_libdirs= for libdir in $compile_rpath $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$perm_rpath " in *" $libdir "*) ;; *) func_append perm_rpath " $libdir" ;; esac fi case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) testbindir=`$ECHO "$libdir" | $SED -e 's*/lib$*/bin*'` case :$dllsearchpath: in *":$libdir:"*) ;; ::) dllsearchpath=$libdir;; *) func_append dllsearchpath ":$libdir";; esac case :$dllsearchpath: in *":$testbindir:"*) ;; ::) dllsearchpath=$testbindir;; *) func_append dllsearchpath ":$testbindir";; esac ;; esac done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi compile_rpath=$rpath rpath= hardcode_libdirs= for libdir in $finalize_rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then if test -z "$hardcode_libdirs"; then hardcode_libdirs=$libdir else # Just accumulate the unique libdirs. case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) ;; *) func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" ;; esac fi else eval flag=\"$hardcode_libdir_flag_spec\" func_append rpath " $flag" fi elif test -n "$runpath_var"; then case "$finalize_perm_rpath " in *" $libdir "*) ;; *) func_append finalize_perm_rpath " $libdir" ;; esac fi done # Substitute the hardcoded libdirs into the rpath. if test -n "$hardcode_libdir_separator" && test -n "$hardcode_libdirs"; then libdir=$hardcode_libdirs eval rpath=\" $hardcode_libdir_flag_spec\" fi finalize_rpath=$rpath if test -n "$libobjs" && test yes = "$build_old_libs"; then # Transform all the library objects into standard objects. compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` fi func_generate_dlsyms "$outputname" "@PROGRAM@" false # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=: case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=false ;; *cygwin* | *mingw* ) test yes = "$build_libtool_libs" || wrappers_required=false ;; *) if test no = "$need_relink" || test yes != "$build_libtool_libs"; then wrappers_required=false fi ;; esac $wrappers_required || { # Replace the output file specification. compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` link_command=$compile_command$compile_rpath # We have no uninstalled library dependencies, so finalize right now. exit_status=0 func_show_eval "$link_command" 'exit_status=$?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Delete the generated files. if test -f "$output_objdir/${outputname}S.$objext"; then func_show_eval '$RM "$output_objdir/${outputname}S.$objext"' fi exit $exit_status } if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do func_append rpath "$dir:" done compile_var="$runpath_var=\"$rpath\$$runpath_var\" " fi if test -n "$finalize_perm_rpath"; then # We should set the runpath_var. rpath= for dir in $finalize_perm_rpath; do func_append rpath "$dir:" done finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " fi fi if test yes = "$no_install"; then # We don't need to create a wrapper script. link_command=$compile_var$compile_command$compile_rpath # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` # Delete the old output file. $opt_dry_run || $RM $output # Link the executable and exit func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi exit $EXIT_SUCCESS fi case $hardcode_action,$fast_install in relink,*) # Fast installation is not supported link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath func_warning "this platform does not like uninstalled shared libraries" func_warning "'$output' will be relinked during installation" ;; *,yes) link_command=$finalize_var$compile_command$finalize_rpath relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` ;; *,no) link_command=$compile_var$compile_command$compile_rpath relink_command=$finalize_var$finalize_command$finalize_rpath ;; *,needless) link_command=$finalize_var$compile_command$finalize_rpath relink_command= ;; esac # Replace the output file specification. link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` # Delete the old output files. $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname func_show_eval "$link_command" 'exit $?' if test -n "$postlink_cmds"; then func_to_tool_file "$output_objdir/$outputname" postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` func_execute_cmds "$postlink_cmds" 'exit $?' fi # Now create the wrapper script. func_verbose "creating $output" # Quote the relink command for shipping. if test -n "$relink_command"; then # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done relink_command="(cd `pwd`; $relink_command)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` fi # Only actually do things if not in dry run mode. $opt_dry_run || { # win32 will think the script is a binary if it has # a .exe suffix, so we strip it off here. case $output in *.exe) func_stripname '' '.exe' "$output" output=$func_stripname_result ;; esac # test for cygwin because mv fails w/o .exe extensions case $host in *cygwin*) exeext=.exe func_stripname '' '.exe' "$outputname" outputname=$func_stripname_result ;; *) exeext= ;; esac case $host in *cygwin* | *mingw* ) func_dirname_and_basename "$output" "" "." output_name=$func_basename_result output_path=$func_dirname_result cwrappersource=$output_path/$objdir/lt-$output_name.c cwrapper=$output_path/$output_name.exe $RM $cwrappersource $cwrapper trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 func_emit_cwrapperexe_src > $cwrappersource # The wrapper executable is built using the $host compiler, # because it contains $host paths and files. If cross- # compiling, it, like the target executable, must be # executed on the $host or under an emulation environment. $opt_dry_run || { $LTCC $LTCFLAGS -o $cwrapper $cwrappersource $STRIP $cwrapper } # Now, create the wrapper script for func_source use: func_ltwrapper_scriptname $cwrapper $RM $func_ltwrapper_scriptname_result trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 $opt_dry_run || { # note: this script will not be executed, so do not chmod. if test "x$build" = "x$host"; then $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result else func_emit_wrapper no > $func_ltwrapper_scriptname_result fi } ;; * ) $RM $output trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 func_emit_wrapper no > $output chmod +x $output ;; esac } exit $EXIT_SUCCESS ;; esac # See if we need to build an old-fashioned archive. for oldlib in $oldlibs; do case $build_libtool_libs in convenience) oldobjs="$libobjs_save $symfileobj" addlibs=$convenience build_libtool_libs=no ;; module) oldobjs=$libobjs_save addlibs=$old_convenience build_libtool_libs=no ;; *) oldobjs="$old_deplibs $non_pic_objects" $preload && test -f "$symfileobj" \ && func_append oldobjs " $symfileobj" addlibs=$old_convenience ;; esac if test -n "$addlibs"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $addlibs func_append oldobjs " $func_extract_archives_result" fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test yes = "$build_libtool_libs"; then cmds=$old_archive_from_new_cmds else # Add any objects from preloaded convenience libraries if test -n "$dlprefiles"; then gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_extract_archives $gentop $dlprefiles func_append oldobjs " $func_extract_archives_result" fi # POSIX demands no paths to be encoded in archives. We have # to avoid creating archives with duplicate basenames if we # might have to extract them afterwards, e.g., when creating a # static archive out of a convenience library, or when linking # the entirety of a libtool archive into another (currently # not supported by libtool). if (for obj in $oldobjs do func_basename "$obj" $ECHO "$func_basename_result" done | sort | sort -uc >/dev/null 2>&1); then : else echo "copying selected object files to avoid basename conflicts..." gentop=$output_objdir/${outputname}x func_append generated " $gentop" func_mkdir_p "$gentop" save_oldobjs=$oldobjs oldobjs= counter=1 for obj in $save_oldobjs do func_basename "$obj" objbase=$func_basename_result case " $oldobjs " in " ") oldobjs=$obj ;; *[\ /]"$objbase "*) while :; do # Make sure we don't pick an alternate name that also # overlaps. newobj=lt$counter-$objbase func_arith $counter + 1 counter=$func_arith_result case " $oldobjs " in *[\ /]"$newobj "*) ;; *) if test ! -f "$gentop/$newobj"; then break; fi ;; esac done func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" func_append oldobjs " $gentop/$newobj" ;; *) func_append oldobjs " $obj" ;; esac done fi func_to_tool_file "$oldlib" func_convert_file_msys_to_w32 tool_oldlib=$func_to_tool_file_result eval cmds=\"$old_archive_cmds\" func_len " $cmds" len=$func_len_result if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then cmds=$old_archive_cmds elif test -n "$archiver_list_spec"; then func_verbose "using command file archive linking..." for obj in $oldobjs do func_to_tool_file "$obj" $ECHO "$func_to_tool_file_result" done > $output_objdir/$libname.libcmd func_to_tool_file "$output_objdir/$libname.libcmd" oldobjs=" $archiver_list_spec$func_to_tool_file_result" cmds=$old_archive_cmds else # the command line is too long to link in one step, link in parts func_verbose "using piecewise archive linking..." save_RANLIB=$RANLIB RANLIB=: objlist= concat_cmds= save_oldobjs=$oldobjs oldobjs= # Is there a better way of finding the last object in the list? for obj in $save_oldobjs do last_oldobj=$obj done eval test_cmds=\"$old_archive_cmds\" func_len " $test_cmds" len0=$func_len_result len=$len0 for obj in $save_oldobjs do func_len " $obj" func_arith $len + $func_len_result len=$func_arith_result func_append objlist " $obj" if test "$len" -lt "$max_cmd_len"; then : else # the above command should be used before it gets too long oldobjs=$objlist if test "$obj" = "$last_oldobj"; then RANLIB=$save_RANLIB fi test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$old_archive_cmds\" objlist= len=$len0 fi done RANLIB=$save_RANLIB oldobjs=$objlist if test -z "$oldobjs"; then eval cmds=\"\$concat_cmds\" else eval cmds=\"\$concat_cmds~\$old_archive_cmds\" fi fi fi func_execute_cmds "$cmds" 'exit $?' done test -n "$generated" && \ func_show_eval "${RM}r$generated" # Now create the libtool archive. case $output in *.la) old_library= test yes = "$build_old_libs" && old_library=$libname.$libext func_verbose "creating $output" # Preserve any variables that may affect compiler behavior for var in $variables_saved_for_relink; do if eval test -z \"\${$var+set}\"; then relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" elif eval var_value=\$$var; test -z "$var_value"; then relink_command="$var=; export $var; $relink_command" else func_quote_for_eval "$var_value" relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" fi done # Quote the link command for shipping. relink_command="(cd `pwd`; $SHELL \"$progpath\" $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` if test yes = "$hardcode_automatic"; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test yes = "$installed"; then if test -z "$install_libdir"; then break fi output=$output_objdir/${outputname}i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) func_basename "$deplib" name=$func_basename_result func_resolve_sysroot "$deplib" eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result` test -z "$libdir" && \ func_fatal_error "'$deplib' is not a valid libtool archive" func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" ;; -L*) func_stripname -L '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -L$func_replace_sysroot_result" ;; -R*) func_stripname -R '' "$deplib" func_replace_sysroot "$func_stripname_result" func_append newdependency_libs " -R$func_replace_sysroot_result" ;; *) func_append newdependency_libs " $deplib" ;; esac done dependency_libs=$newdependency_libs newdlfiles= for lib in $dlfiles; do case $lib in *.la) func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" ;; *) func_append newdlfiles " $lib" ;; esac done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in *.la) # Only pass preopened files to the pseudo-archive (for # eventual linking with the app. that links it) if we # didn't already link the preopened objects directly into # the library: func_basename "$lib" name=$func_basename_result eval libdir=`$SED -n -e 's/^libdir=\(.*\)$/\1/p' $lib` test -z "$libdir" && \ func_fatal_error "'$lib' is not a valid libtool archive" func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" ;; esac done dlprefiles=$newdlprefiles else newdlfiles= for lib in $dlfiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlfiles " $abs" done dlfiles=$newdlfiles newdlprefiles= for lib in $dlprefiles; do case $lib in [\\/]* | [A-Za-z]:[\\/]*) abs=$lib ;; *) abs=`pwd`"/$lib" ;; esac func_append newdlprefiles " $abs" done dlprefiles=$newdlprefiles fi $RM $output # place dlname in correct position for cygwin # In fact, it would be nice if we could use this code for all target # systems that can't hard-code library paths into their executables # and that have no shared library path variable independent of PATH, # but it turns out we can't easily determine that from inspecting # libtool variables, so we have to hard-code the OSs to which it # applies here; at the moment, that means platforms that use the PE # object format with DLL files. See the long comment at the top of # tests/bindir.at for full details. tdlname=$dlname case $host,$output,$installed,$module,$dlname in *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) # If a -bindir argument was supplied, place the dll there. if test -n "$bindir"; then func_relative_path "$install_libdir" "$bindir" tdlname=$func_relative_path_result/$dlname else # Otherwise fall back on heuristic. tdlname=../bin/$dlname fi ;; esac $ECHO > $output "\ # $outputname - a libtool library file # Generated by $PROGRAM (GNU $PACKAGE) $VERSION # # Please DO NOT delete this file! # It is necessary for linking the library. # The name that we can dlopen(3). dlname='$tdlname' # Names of this library. library_names='$library_names' # The name of the static archive. old_library='$old_library' # Linker flags that cannot go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test no,yes = "$installed,$need_relink"; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # Do a symbolic link so that the libtool archive can be found in # LD_LIBRARY_PATH before the program is installed. func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' ;; esac exit $EXIT_SUCCESS } if test link = "$opt_mode" || test relink = "$opt_mode"; then func_mode_link ${1+"$@"} fi # func_mode_uninstall arg... func_mode_uninstall () { $debug_cmd RM=$nonopt files= rmforce=false exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic=$magic for arg do case $arg in -f) func_append RM " $arg"; rmforce=: ;; -*) func_append RM " $arg" ;; *) func_append files " $arg" ;; esac done test -z "$RM" && \ func_fatal_help "you must specify an RM program" rmdirs= for file in $files; do func_dirname "$file" "" "." dir=$func_dirname_result if test . = "$dir"; then odir=$objdir else odir=$dir/$objdir fi func_basename "$file" name=$func_basename_result test uninstall = "$opt_mode" && odir=$dir # Remember odir for removal later, being careful to avoid duplicates if test clean = "$opt_mode"; then case " $rmdirs " in *" $odir "*) ;; *) func_append rmdirs " $odir" ;; esac fi # Don't error if the file doesn't exist and rm -f was used. if { test -L "$file"; } >/dev/null 2>&1 || { test -h "$file"; } >/dev/null 2>&1 || test -f "$file"; then : elif test -d "$file"; then exit_status=1 continue elif $rmforce; then continue fi rmfiles=$file case $name in *.la) # Possibly a libtool archive, so verify it. if func_lalib_p "$file"; then func_source $dir/$name # Delete the libtool libraries and symlinks. for n in $library_names; do func_append rmfiles " $odir/$n" done test -n "$old_library" && func_append rmfiles " $odir/$old_library" case $opt_mode in clean) case " $library_names " in *" $dlname "*) ;; *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; esac test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" ;; uninstall) if test -n "$library_names"; then # Do each command in the postuninstall commands. func_execute_cmds "$postuninstall_cmds" '$rmforce || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" '$rmforce || exit_status=1' fi # FIXME: should reinstall the best remaining shared library. ;; esac fi ;; *.lo) # Possibly a libtool object, so verify it. if func_lalib_p "$file"; then # Read the .lo file func_source $dir/$name # Add PIC object to the list of files to remove. if test -n "$pic_object" && test none != "$pic_object"; then func_append rmfiles " $dir/$pic_object" fi # Add non-PIC object to the list of files to remove. if test -n "$non_pic_object" && test none != "$non_pic_object"; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test clean = "$opt_mode"; then noexename=$name case $file in *.exe) func_stripname '' '.exe' "$file" file=$func_stripname_result func_stripname '' '.exe' "$name" noexename=$func_stripname_result # $file with .exe has already been added to rmfiles, # add $file without .exe func_append rmfiles " $file" ;; esac # Do a test to see if this is a libtool program. if func_ltwrapper_p "$file"; then if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" relink_command= func_source $func_ltwrapper_scriptname_result func_append rmfiles " $func_ltwrapper_scriptname_result" else relink_command= func_source $dir/$noexename fi # note $name still contains .exe if it was in $file originally # as does the version of $file that was added into $rmfiles func_append rmfiles " $odir/$name $odir/${name}S.$objext" if test yes = "$fast_install" && test -n "$relink_command"; then func_append rmfiles " $odir/lt-$name" fi if test "X$noexename" != "X$name"; then func_append rmfiles " $odir/lt-$noexename.c" fi fi fi ;; esac func_show_eval "$RM $rmfiles" 'exit_status=1' done # Try to remove the $objdir's in the directories where we deleted files for dir in $rmdirs; do if test -d "$dir"; then func_show_eval "rmdir $dir >/dev/null 2>&1" fi done exit $exit_status } if test uninstall = "$opt_mode" || test clean = "$opt_mode"; then func_mode_uninstall ${1+"$@"} fi test -z "$opt_mode" && { help=$generic_help func_fatal_help "you must specify a MODE" } test -z "$exec_cmd" && \ func_fatal_help "invalid operation mode '$opt_mode'" if test -n "$exec_cmd"; then eval exec "$exec_cmd" exit $EXIT_FAILURE fi exit $exit_status # The TAGs below are defined such that we never get into a situation # where we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: avfs-1.1.4/Makefile.in0000644000175000001440000006326514032341013011441 00000000000000# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(top_srcdir)/configure \ $(am__configure_deps) $(am__DIST_COMMON) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive cscopelist-recursive \ ctags-recursive dvi-recursive html-recursive info-recursive \ install-data-recursive install-dvi-recursive \ install-exec-recursive install-html-recursive \ install-info-recursive install-pdf-recursive \ install-ps-recursive install-recursive installcheck-recursive \ installdirs-recursive pdf-recursive ps-recursive \ tags-recursive uninstall-recursive am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive am__recursive_targets = \ $(RECURSIVE_TARGETS) \ $(RECURSIVE_CLEAN_TARGETS) \ $(am__extra_recursive_targets) AM_RECURSIVE_TARGETS = $(am__recursive_targets:-recursive=) TAGS CTAGS \ cscope distdir distdir-am dist dist-all distcheck am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) \ config.h.in # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags CSCOPE = cscope DIST_SUBDIRS = $(SUBDIRS) am__DIST_COMMON = $(srcdir)/Makefile.in AUTHORS COPYING COPYING.LIB \ ChangeLog INSTALL NEWS README TODO compile config.guess \ config.sub install-sh ltmain.sh missing DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ if test -d "$(distdir)"; then \ find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -rf "$(distdir)" \ || { sleep 5 && rm -rf "$(distdir)"; }; \ else :; fi am__post_remove_distdir = $(am__remove_distdir) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 GZIP_ENV = --best DIST_TARGETS = dist-bzip2 dist-gzip # Exists only to be overridden by the user if desired. AM_DISTCHECK_DVI_TARGET = dvi distuninstallcheck_listfiles = find . -type f -print am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \ | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$' distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BZLIB_INCLUDE = @BZLIB_INCLUDE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAV = @DAV@ DAV_LS = @DAV_LS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FUSELIBS = @FUSELIBS@ GREP = @GREP@ HAVE_ZIPINFO = @HAVE_ZIPINFO@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ LIBZSTD_LIBS = @LIBZSTD_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NUMVERSION = @NUMVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ ZIP = @ZIP@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_INCLUDE = @ZLIB_INCLUDE@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ AUTOMAKE_OPTIONS = dist-bzip2 ACLOCAL_AMFLAGS = -I macros SUBDIRS = \ src \ modules \ zlib \ bzlib \ lib \ include \ test \ scripts \ spec \ patch \ macros \ extfs \ doc \ fuse \ pkgconfig EXTRA_DIST = \ glassfs/Makefile \ glassfs/glassfs.c \ glassfs/redir2.c \ glassfs/redir2mount.c all: all-recursive .SUFFIXES: am--refresh: Makefile @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu'; \ $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs distclean-libtool: -rm -f libtool config.lt # This directory's subdirectories are mostly independent; you can cd # into them and run 'make' without going through this Makefile. # To change the values of 'make' variables: instead of editing Makefiles, # (1) if the variable is set in 'config.status', edit 'config.status' # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. $(am__recursive_targets): @fail=; \ if $(am__make_keepgoing); then \ failcom='fail=yes'; \ else \ failcom='exit 1'; \ fi; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-recursive TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-recursive CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscope: cscope.files test ! -s cscope.files \ || $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS) clean-cscope: -rm -f cscope.files cscope.files: clean-cscope cscopelist cscopelist: cscopelist-recursive cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f cscope.out cscope.in.out cscope.po.out cscope.files distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) $(am__remove_distdir) test -d "$(distdir)" || mkdir "$(distdir)" @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ $(am__make_dryrun) \ || test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ $(am__relativize); \ new_distdir=$$reldir; \ dir1=$$subdir; dir2="$(top_distdir)"; \ $(am__relativize); \ new_top_distdir=$$reldir; \ echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ ($(am__cd) $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$new_top_distdir" \ distdir="$$new_distdir" \ am__remove_distdir=: \ am__skip_length_check=: \ am__skip_mode_fix=: \ distdir) \ || exit 1; \ fi; \ done -test -n "$(am__skip_mode_fix)" \ || find "$(distdir)" -type d ! -perm -755 \ -exec chmod u+rwx,go+rx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r "$(distdir)" dist-gzip: distdir tardir=$(distdir) && $(am__tar) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).tar.gz $(am__post_remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2 $(am__post_remove_distdir) dist-lzip: distdir tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz $(am__post_remove_distdir) dist-xz: distdir tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz $(am__post_remove_distdir) dist-zstd: distdir tardir=$(distdir) && $(am__tar) | zstd -c $${ZSTD_CLEVEL-$${ZSTD_OPT--19}} >$(distdir).tar.zst $(am__post_remove_distdir) dist-tarZ: distdir @echo WARNING: "Support for distribution archives compressed with" \ "legacy program 'compress' is deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir @echo WARNING: "Support for shar distribution archives is" \ "deprecated." >&2 @echo WARNING: "It will be removed altogether in Automake 2.0" >&2 shar $(distdir) | eval GZIP= gzip $(GZIP_ENV) -c >$(distdir).shar.gz $(am__post_remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__post_remove_distdir) dist dist-all: $(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:' $(am__post_remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.lz*) \ lzip -dc $(distdir).tar.lz | $(am__untar) ;;\ *.tar.xz*) \ xz -dc $(distdir).tar.xz | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ eval GZIP= gzip $(GZIP_ENV) -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ *.tar.zst*) \ zstd -dc $(distdir).tar.zst | $(am__untar) ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_build/sub $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build/sub \ && ../../configure \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ --srcdir=../.. --prefix="$$dc_install_base" \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) $(AM_DISTCHECK_DVI_TARGET) \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__post_remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @test -n '$(distuninstallcheck_dir)' || { \ echo 'ERROR: trying to run $@ with an empty' \ '$$(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ $(am__cd) '$(distuninstallcheck_dir)' || { \ echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \ exit 1; \ }; \ test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-libtool \ distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-html: install-html-recursive install-html-am: install-info: install-info-recursive install-info-am: install-man: install-pdf: install-pdf-recursive install-pdf-am: install-ps: install-ps-recursive install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am \ am--refresh check check-am clean clean-cscope clean-generic \ clean-libtool cscope cscopelist-am ctags ctags-am dist \ dist-all dist-bzip2 dist-gzip dist-lzip dist-shar dist-tarZ \ dist-xz dist-zip dist-zstd distcheck distclean \ distclean-generic distclean-libtool distclean-tags \ distcleancheck distdir distuninstallcheck dvi dvi-am html \ html-am info info-am install install-am install-data \ install-data-am install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic \ mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: avfs-1.1.4/configure0000755000175000001440000166204614032341013011306 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for avfs 1.1.4. # # # Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc. # # # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # Use a proper internal environment variable to ensure we don't fall # into an infinite loop, continuously re-executing ourselves. if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then _as_can_reexec=no; export _as_can_reexec; # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 as_fn_exit 255 fi # We don't want this to propagate to other subprocesses. { _as_can_reexec=; unset _as_can_reexec;} if test "x$CONFIG_SHELL" = x; then as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which # is contrary to our usage. Disable this feature. alias -g '\${1+\"\$@\"}'='\"\$@\"' setopt NO_GLOB_SUBST else case \`(set -o) 2>/dev/null\` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi " as_required="as_fn_return () { (exit \$1); } as_fn_success () { as_fn_return 0; } as_fn_failure () { as_fn_return 1; } as_fn_ret_success () { return 0; } as_fn_ret_failure () { return 1; } exitcode=0 as_fn_success || { exitcode=1; echo as_fn_success failed.; } as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : else exitcode=1; echo positional parameters were not saved. fi test x\$exitcode = x0 || exit 1 test -x / || exit 1" as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 test \$(( 1 + 1 )) = 2 || exit 1" if (eval "$as_required") 2>/dev/null; then : as_have_required=yes else as_have_required=no fi if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR as_found=false for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. as_found=: case $as_dir in #( /*) for as_base in sh bash ksh sh5; do # Try only shells that exist, to save several forks. as_shell=$as_dir/$as_base if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : CONFIG_SHELL=$as_shell as_have_required=yes if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : break 2 fi fi done;; esac as_found=false done $as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : CONFIG_SHELL=$SHELL as_have_required=yes fi; } IFS=$as_save_IFS if test "x$CONFIG_SHELL" != x; then : export CONFIG_SHELL # We cannot yet assume a decent shell, so we have to provide a # neutralization value for shells without unset; and this also # works around shells that cannot unset nonexistent variables. # Preserve -v and -x to the replacement shell. BASH_ENV=/dev/null ENV=/dev/null (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV case $- in # (((( *v*x* | *x*v* ) as_opts=-vx ;; *v* ) as_opts=-v ;; *x* ) as_opts=-x ;; * ) as_opts= ;; esac exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"} # Admittedly, this is quite paranoid, since all the known shells bail # out after a failed `exec'. $as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2 exit 255 fi if test x$as_have_required = xno; then : $as_echo "$0: This script requires a shell more modern than all" $as_echo "$0: the shells that I found on your system." if test x${ZSH_VERSION+set} = xset ; then $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" $as_echo "$0: be upgraded to zsh 4.3.4 or later." else $as_echo "$0: Please tell bug-autoconf@gnu.org about your system, $0: including any error possibly output before this $0: message. Then install a modern shell, or manually run $0: the script under such a shell if you do have one." fi exit 1 fi fi fi SHELL=${CONFIG_SHELL-/bin/sh} export SHELL # Unset more variables known to interfere with behavior of common tools. CLICOLOR_FORCE= GREP_OPTIONS= unset CLICOLOR_FORCE GREP_OPTIONS ## --------------------- ## ## M4sh Shell Functions. ## ## --------------------- ## # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits as_lineno_1=$LINENO as_lineno_1a=$LINENO as_lineno_2=$LINENO as_lineno_2a=$LINENO eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } # If we had to re-execute with $CONFIG_SHELL, we're ensured to have # already done that, so ensure we don't try to do so again and fall # in an infinite loop. This has already happened in practice. _as_can_reexec=no; export _as_can_reexec # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" SHELL=${CONFIG_SHELL-/bin/sh} test -n "$DJDIR" || exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= # Identity of this package. PACKAGE_NAME='avfs' PACKAGE_TARNAME='avfs' PACKAGE_VERSION='1.1.4' PACKAGE_STRING='avfs 1.1.4' PACKAGE_BUGREPORT='' PACKAGE_URL='' ac_unique_file="include/avfs.h" ac_default_prefix=/usr # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS LIBOBJS shared_build install_scriptcomps VERSIONSCRIPT_OPTS BUILD_SHARED_FALSE BUILD_SHARED_TRUE INSTALL_FUSE_FALSE INSTALL_FUSE_TRUE USE_LIBLZIP_FALSE USE_LIBLZIP_TRUE USE_LIBZSTD_FALSE USE_LIBZSTD_TRUE USE_LIBLZMA_FALSE USE_LIBLZMA_TRUE LIBZSTD_LIBS LIBZSTD_CFLAGS LIBLZMA_LIBS LIBLZMA_CFLAGS FUSELIBS LIBFUSE_LIBS LIBFUSE_CFLAGS PERL HAVE_ZIPINFO UNZIP ZIP moduledir LIBDAV DAV_LS DAV BUILD_DAVSUPPORT_FALSE BUILD_DAVSUPPORT_TRUE LIBNEON_LIBS LIBNEON_CFLAGS ZLIB_CFLAGS PKG_CONFIG LT_SYS_LIBRARY_PATH OTOOL64 OTOOL LIPO NMEDIT DSYMUTIL MANIFEST_TOOL RANLIB ac_ct_AR AR DLLTOOL OBJDUMP LN_S NM ac_ct_DUMPBIN DUMPBIN LD FGREP EGREP GREP SED LIBTOOL CPP am__fastdepCC_FALSE am__fastdepCC_TRUE CCDEPMODE am__nodep AMDEPBACKSLASH AMDEP_FALSE AMDEP_TRUE am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC pkgconfigdir BZLIB_INCLUDE LIBBZ2 USE_SYSTEM_BZLIB_FALSE USE_SYSTEM_BZLIB_TRUE ZLIB_INCLUDE LIBZ USE_SYSTEM_ZLIB_FALSE USE_SYSTEM_ZLIB_TRUE NUMVERSION host_os host_vendor host_cpu host build_os build_vendor build_cpu build AM_BACKSLASH AM_DEFAULT_VERBOSITY AM_DEFAULT_V AM_V am__untar am__tar AMTAR am__leading_dot SET_MAKE AWK mkdir_p MKDIR_P INSTALL_STRIP_PROGRAM STRIP install_sh MAKEINFO AUTOHEADER AUTOMAKE AUTOCONF ACLOCAL VERSION PACKAGE CYGPATH_W am__isrc INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM target_alias host_alias build_alias LIBS ECHO_T ECHO_N ECHO_C DEFS mandir localedir libdir psdir pdfdir dvidir htmldir infodir docdir oldincludedir includedir localstatedir sharedstatedir sysconfdir datadir datarootdir libexecdir sbindir bindir program_transform_name prefix exec_prefix PACKAGE_URL PACKAGE_BUGREPORT PACKAGE_STRING PACKAGE_VERSION PACKAGE_TARNAME PACKAGE_NAME PATH_SEPARATOR SHELL am__quote' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_library enable_fuse enable_debug enable_dav with_system_zlib with_system_bzlib with_pkgconfigdir enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_aix_soname with_gnu_ld with_sysroot enable_libtool_lock enable_largefile enable_fuse_test with_xz with_zstd with_lzip ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP LT_SYS_LIBRARY_PATH PKG_CONFIG LIBNEON_CFLAGS LIBNEON_LIBS LIBFUSE_CFLAGS LIBFUSE_LIBS LIBLZMA_CFLAGS LIBLZMA_LIBS LIBZSTD_CFLAGS LIBZSTD_LIBS' # Initialize some variables set by options. ac_init_help= ac_init_version=false ac_unrecognized_opts= ac_unrecognized_sep= # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *=) ac_optarg= ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid feature name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "enable_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval enable_$ac_useropt=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=\$ac_optarg ;; -without-* | --without-*) ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && as_fn_error $? "invalid package name: $ac_useropt" ac_useropt_orig=$ac_useropt ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` case $ac_user_opts in *" "with_$ac_useropt" "*) ;; *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" ac_unrecognized_sep=', ';; esac eval with_$ac_useropt=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) as_fn_error $? "unrecognized option: \`$ac_option' Try \`$0 --help' for more information" ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. case $ac_envvar in #( '' | [0-9]* | *[!_$as_cr_alnum]* ) as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; esac eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` as_fn_error $? "missing argument to $ac_option" fi if test -n "$ac_unrecognized_opts"; then case $enable_option_checking in no) ;; fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; esac fi # Check all directory arguments for consistency. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var # Remove trailing slashes. case $ac_val in */ ) ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` eval $ac_var=\$ac_val;; esac # Be sure to have absolute directory names. case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || as_fn_error $? "working directory cannot be determined" test "X$ac_ls_di" = "X$ac_pwd_ls_di" || as_fn_error $? "pwd does not report name of working directory" # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$as_myself" || $as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_myself" : 'X\(//\)[^/]' \| \ X"$as_myself" : 'X\(//\)$' \| \ X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_myself" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures avfs 1.1.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking ...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/avfs] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names System types: --build=BUILD configure for building on BUILD [guessed] --host=HOST cross-compile to build programs to run on HOST [BUILD] _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of avfs 1.1.4:";; esac cat <<\_ACEOF Optional Features: --disable-option-checking ignore unrecognized --enable/--with options --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --enable-silent-rules less verbose build output (undo: "make V=1") --disable-silent-rules verbose build output (undo: "make V=0") --enable-library Compile avfs as a shared or static library --enable-fuse Compile avfsd for fuse --enable-debug Compile in debug information --disable-debug Do not compile in debug information --enable-dav Compile the dav module (requires libneon) --enable-dependency-tracking do not reject slow dependency extractors --disable-dependency-tracking speeds up one-time build --enable-shared[=PKGS] build shared libraries [default=yes] --enable-static[=PKGS] build static libraries [default=yes] --enable-fast-install[=PKGS] optimize for fast installation [default=yes] --disable-libtool-lock avoid locking (might break parallel builds) --disable-largefile omit support for large files --disable-fuse-test Disable test for fuse version Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-system-zlib Use system zlib instead of builtin --with-system-bzlib Use system bzlib instead of builtin --with-pkgconfigdir=DIR pkgconfig file in DIR [LIBDIR/pkgconfig] --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --with-aix-soname=aix|svr4|both shared library versioning (aka "SONAME") variant to provide on AIX, [default=aix]. --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-sysroot[=DIR] Search for dependent libraries within DIR (or the compiler's sysroot if not specified). --with-xz use xz (default is YES, force to always enable) --with-zstd use zstd (default is YES) --with-lzip use lzip (default is YES) Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if you have headers in a nonstandard directory CPP C preprocessor LT_SYS_LIBRARY_PATH User-defined run-time library search path. PKG_CONFIG path to pkg-config utility LIBNEON_CFLAGS C compiler flags for LIBNEON, overriding pkg-config LIBNEON_LIBS linker flags for LIBNEON, overriding pkg-config LIBFUSE_CFLAGS C compiler flags for LIBFUSE, overriding pkg-config LIBFUSE_LIBS linker flags for LIBFUSE, overriding pkg-config LIBLZMA_CFLAGS C compiler flags for LIBLZMA, overriding pkg-config LIBLZMA_LIBS linker flags for LIBLZMA, overriding pkg-config LIBZSTD_CFLAGS C compiler flags for LIBZSTD, overriding pkg-config LIBZSTD_LIBS linker flags for LIBZSTD, overriding pkg-config Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to the package provider. _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF avfs configure 1.1.4 generated by GNU Autoconf 2.69 Copyright (C) 2012 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. _ACEOF exit fi ## ------------------------ ## ## Autoconf initialization. ## ## ------------------------ ## # ac_fn_c_try_compile LINENO # -------------------------- # Try to compile conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_compile # ac_fn_c_try_cpp LINENO # ---------------------- # Try to preprocess conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_cpp () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } > conftest.i && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_cpp # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_run LINENO # ---------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. Assumes # that executables *can* be run. ac_fn_c_try_run () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then : ac_retval=0 else $as_echo "$as_me: program exited with status $ac_status" >&5 $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=$ac_status fi rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_run # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=\$ac_header_compiler" fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_mongrel cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by avfs $as_me 1.1.4, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi as_fn_append ac_header_list " sys/types.h" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 $as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then # differences in whitespace do not lead to failure. ac_old_val_w=`echo x $ac_old_val` ac_new_val_w=`echo x $ac_new_val` if test "$ac_old_val_w" != "$ac_new_val_w"; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 $as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} ac_cache_corrupted=: else { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 $as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} eval $ac_var=\$ac_old_val fi { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 $as_echo "$as_me: former value: \`$ac_old_val'" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 $as_echo "$as_me: current value: \`$ac_new_val'" >&2;} fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) as_fn_append ac_configure_args " '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 $as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 fi ## -------------------- ## ## Main body of script. ## ## -------------------- ## ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu am__api_version='1.16' ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 $as_echo_n "checking whether build environment is sane... " >&6; } # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: '$srcdir'" "$LINENO" 5;; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi if test "$2" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$2" = conftest.file ) then # Ok. : else as_fn_error $? "newly created file is older than distributed files! Check your system clock" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi rm -f conftest.file test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. # By default was `s,x,x', remove it if useless. ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: 'missing' script is too old or missing" >&5 $as_echo "$as_me: WARNING: 'missing' script is too old or missing" >&2;} fi if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 $as_echo_n "checking for a thread-safe mkdir -p... " >&6; } if test -z "$MKDIR_P"; then if ${ac_cv_path_mkdir+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi test -d ./--version && rmdir ./--version if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. MKDIR_P="$ac_install_sh -d" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 $as_echo "$MKDIR_P" >&6; } for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AWK+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AWK="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 $as_echo "$AWK" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AWK" && break done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 $as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } set x ${MAKE-make} ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : $as_echo_n "(cached) " >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering ...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } SET_MAKE= else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null # Check whether --enable-silent-rules was given. if test "${enable_silent_rules+set}" = set; then : enableval=$enable_silent_rules; fi case $enable_silent_rules in # ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=1;; esac am_make=${MAKE-make} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $am_make supports nested variables" >&5 $as_echo_n "checking whether $am_make supports nested variables... " >&6; } if ${am_cv_make_support_nested_variables+:} false; then : $as_echo_n "(cached) " >&6 else if $as_echo 'TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit' | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_make_support_nested_variables" >&5 $as_echo "$am_cv_make_support_nested_variables" >&6; } if test $am_cv_make_support_nested_variables = yes; then AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AM_BACKSLASH='\' if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='avfs' VERSION='1.1.4' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # mkdir_p='$(MKDIR_P)' # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. # Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AMTAR='$${TAR-tar}' # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar pax cpio none' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END as_fn_error $? "Your 'rm' program is bad, sorry." "$LINENO" 5 fi fi ac_config_headers="$ac_config_headers include/config.h:config.h.in" # Make sure we can run config.sub. $SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 $as_echo_n "checking build system type... " >&6; } if ${ac_cv_build+:} false; then : $as_echo_n "(cached) " >&6 else ac_build_alias=$build_alias test "x$ac_build_alias" = x && ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` test "x$ac_build_alias" = x && as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 $as_echo "$ac_cv_build" >&6; } case $ac_cv_build in *-*-*) ;; *) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; esac build=$ac_cv_build ac_save_IFS=$IFS; IFS='-' set x $ac_cv_build shift build_cpu=$1 build_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: build_os=$* IFS=$ac_save_IFS case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 $as_echo_n "checking host system type... " >&6; } if ${ac_cv_host+:} false; then : $as_echo_n "(cached) " >&6 else if test "x$host_alias" = x; then ac_cv_host=$ac_cv_build else ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 $as_echo "$ac_cv_host" >&6; } case $ac_cv_host in *-*-*) ;; *) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; esac host=$ac_cv_host ac_save_IFS=$IFS; IFS='-' set x $ac_cv_host shift host_cpu=$1 host_vendor=$2 shift; shift # Remember, the first character of IFS is used to create $*, # except with old shells: host_os=$* IFS=$ac_save_IFS case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if configuration is valid" >&5 $as_echo_n "checking if configuration is valid... " >&6; } if ${szm_cv_host_system+:} false; then : $as_echo_n "(cached) " >&6 else szm_cv_host_system=$host fi if test "$host" = "$szm_cv_host_system"; then validstring="valid" else validstring="invalid" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $validstring" >&5 $as_echo "$validstring" >&6; } if test "$validstring" = invalid; then as_fn_error $? "type 'make realclean' before running configure" "$LINENO" 5 fi VERSION=1.1.4 NUMVERSION=114 os=`uname -s` kernver=`uname -r | sed -n 's/\([0-9]\+\)\.\([0-9]\+\)\..*/\1\2/p'` if test -z "$kernver"; then kernver="0" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared library and/or fuse daemon" >&5 $as_echo_n "checking whether to build shared library and/or fuse daemon... " >&6; } shared=yes if test "$os" = "Linux"; then fuse=yes fi # Check whether --enable-library was given. if test "${enable_library+set}" = set; then : enableval=$enable_library; if test "$enableval" = yes; then shared=yes; else shared=no; fi fi # Check whether --enable-fuse was given. if test "${enable_fuse+set}" = set; then : enableval=$enable_fuse; if test "$enableval" = yes; then fuse=yes; else fuse=no; fi fi shared_build=no fuse_build=no build_result= if test "$shared" = yes; then shared_build=yes if test -z "$build_result"; then build_result=shared else build_result="$build_result shared" fi fi if test "$fuse" = yes; then fuse_build=yes if test -z "$build_result"; then build_result=fuse else build_result="$build_result fuse" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $build_result" >&5 $as_echo "$build_result" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether debugging is enabled" >&5 $as_echo_n "checking whether debugging is enabled... " >&6; } # Check whether --enable-debug was given. if test "${enable_debug+set}" = set; then : enableval=$enable_debug; if test "$enableval" = yes; then debugmode=yes; else debugmode=no; fi else debugmode=yes fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $debugmode" >&5 $as_echo "$debugmode" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether building the dav module is enabled" >&5 $as_echo_n "checking whether building the dav module is enabled... " >&6; } # Check whether --enable-dav was given. if test "${enable_dav+set}" = set; then : enableval=$enable_dav; if test "$enableval" = yes; then dav=yes; else dav=no; fi else dav=yes fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dav" >&5 $as_echo "$dav" >&6; } # Check whether --with-system-zlib was given. if test "${with_system_zlib+set}" = set; then : withval=$with_system_zlib; if test "$withval" = yes; then use_system_zlib=yes; else use_system_zlib=no; fi else use_system_zlib=no fi if test x$use_system_zlib = xyes; then USE_SYSTEM_ZLIB_TRUE= USE_SYSTEM_ZLIB_FALSE='#' else USE_SYSTEM_ZLIB_TRUE='#' USE_SYSTEM_ZLIB_FALSE= fi if test x$use_system_zlib = xyes; then $as_echo "#define USE_SYSTEM_ZLIB 1" >>confdefs.h LIBZ=-lz ZLIB_INCLUDE= else LIBZ=../zlib/libzlib.la ZLIB_INCLUDE='-I$(top_srcdir)/zlib' fi # Check whether --with-system-bzlib was given. if test "${with_system_bzlib+set}" = set; then : withval=$with_system_bzlib; if test "$withval" = yes; then use_system_bzlib=yes; else use_system_bzlib=no; fi else use_system_bzlib=no fi if test x$use_system_bzlib = xyes; then USE_SYSTEM_BZLIB_TRUE= USE_SYSTEM_BZLIB_FALSE='#' else USE_SYSTEM_BZLIB_TRUE='#' USE_SYSTEM_BZLIB_FALSE= fi if test x$use_system_bzlib = xyes; then $as_echo "#define USE_SYSTEM_BZLIB 1" >>confdefs.h LIBBZ2=-lbz2 BZLIB_INCLUDE= else LIBBZ2=../bzlib/libbz.la BZLIB_INCLUDE='-I$(top_srcdir)/bzlib' fi # Check whether --with-pkgconfigdir was given. if test "${with_pkgconfigdir+set}" = set; then : withval=$with_pkgconfigdir; pkgconfigdir=$withval else pkgconfigdir='${libdir}/pkgconfig' fi cflags="$CFLAGS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="gcc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="${ac_tool_prefix}cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 $as_echo "$CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_CC+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_CC="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 $as_echo "$ac_ct_CC" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "no acceptable C compiler found in \$PATH See \`config.log' for more details" "$LINENO" 5; } # Provide some information about the compiler. $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 set X $ac_compile ac_compiler=$2 for ac_option in --version -v -V -qversion; do { { ac_try="$ac_compiler $ac_option >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compiler $ac_option >&5") 2>conftest.err ac_status=$? if test -s conftest.err; then sed '10a\ ... rest of stderr output deleted ... 10q' conftest.err >conftest.er1 cat conftest.er1 >&5 fi rm -f conftest.er1 conftest.err $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } done cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 $as_echo_n "checking whether the C compiler works... " >&6; } ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # The possible output files: ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { { ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link_default") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi if test -z "$ac_file"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error 77 "C compiler cannot create executables See \`config.log' for more details" "$LINENO" 5; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 $as_echo_n "checking for C compiler default output file name... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 $as_echo "$ac_file" >&6; } ac_exeext=$ac_cv_exeext rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 $as_echo_n "checking for suffix of executables... " >&6; } if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of executables: cannot compile and link See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest conftest$ac_cv_exeext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 $as_echo "$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { FILE *f = fopen ("conftest.out", "w"); return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF ac_clean_files="$ac_clean_files conftest.out" # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 $as_echo_n "checking whether we are cross compiling... " >&6; } if test "$cross_compiling" != yes; then { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if { ac_try='./conftest$ac_cv_exeext' { { case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_try") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details" "$LINENO" 5; } fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 $as_echo "$cross_compiling" >&6; } rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out ac_clean_files=$ac_clean_files_save { $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 $as_echo_n "checking for suffix of object files... " >&6; } if ${ac_cv_objext+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { { ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_compile") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then : for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "cannot compute suffix of object files: cannot compile See \`config.log' for more details" "$LINENO" 5; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 $as_echo "$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 $as_echo_n "checking whether we are using the GNU C compiler... " >&6; } if ${ac_cv_c_compiler_gnu+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_compiler_gnu=yes else ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 $as_echo "$ac_cv_c_compiler_gnu" >&6; } if test $ac_compiler_gnu = yes; then GCC=yes else GCC= fi ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 $as_echo_n "checking whether $CC accepts -g... " >&6; } if ${ac_cv_prog_cc_g+:} false; then : $as_echo_n "(cached) " >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes else CFLAGS="" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_g=yes fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 $as_echo "$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 $as_echo_n "checking for $CC option to accept ISO C89... " >&6; } if ${ac_cv_prog_cc_c89+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include struct stat; /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_prog_cc_c89=$ac_arg fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 $as_echo "none needed" >&6; } ;; xno) { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 $as_echo "unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 $as_echo "$ac_cv_prog_cc_c89" >&6; } ;; esac if test "x$ac_cv_prog_cc_c89" != xno; then : fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC understands -c and -o together" >&5 $as_echo_n "checking whether $CC understands -c and -o together... " >&6; } if ${am_cv_prog_cc_c_o+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if { echo "$as_me:$LINENO: $CC -c conftest.$ac_ext -o conftest2.$ac_objext" >&5 ($CC -c conftest.$ac_ext -o conftest2.$ac_objext) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_prog_cc_c_o" >&5 $as_echo "$am_cv_prog_cc_c_o" >&6; } if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} supports the include directive" >&5 $as_echo_n "checking whether ${MAKE-make} supports the include directive... " >&6; } cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do { echo "$as_me:$LINENO: ${MAKE-make} -f confmf.$s && cat confinc.out" >&5 (${MAKE-make} -f confmf.$s && cat confinc.out) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } case $?:`cat confinc.out 2>/dev/null` in #( '0:this is the am__doit target') : case $s in #( BSD) : am__include='.include' am__quote='"' ;; #( *) : am__include='include' am__quote='' ;; esac ;; #( *) : ;; esac if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${_am_result}" >&5 $as_echo "${_am_result}" >&6; } # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 $as_echo_n "checking dependency style of $depcc... " >&6; } if ${am_cv_CC_dependencies_compiler_type+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi am__universal=false case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 $as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 $as_echo_n "checking how to run the C preprocessor... " >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if ${ac_cv_prog_CPP+:} false; then : $as_echo_n "(cached) " >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 $as_echo "$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : else # Broken: fails on valid input. continue fi rm -f conftest.err conftest.i conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : # Broken: success on invalid input. continue else # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.i conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.i conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details" "$LINENO" 5; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu case `pwd` in *\ * | *\ *) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 $as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; esac macro_version='2.4.6' macro_revision='2.4.6' ltmain=$ac_aux_dir/ltmain.sh # Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\(["`$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 $as_echo_n "checking how to print strings... " >&6; } # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "" } case $ECHO in printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 $as_echo "printf" >&6; } ;; print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 $as_echo "print -r" >&6; } ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 $as_echo "cat" >&6; } ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 $as_echo_n "checking for a sed that does not truncate output... " >&6; } if ${ac_cv_path_SED+:} false; then : $as_echo_n "(cached) " >&6 else ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ for ac_i in 1 2 3 4 5 6 7; do ac_script="$ac_script$as_nl$ac_script" done echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed { ac_script=; unset ac_script;} if test -z "$SED"; then ac_path_SED_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_SED" || continue # Check for GNU ac_path_SED and select it if it is found. # Check for GNU $ac_path_SED case `"$ac_path_SED" --version 2>&1` in *GNU*) ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo '' >> "conftest.nl" "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_SED_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_SED="$ac_path_SED" ac_path_SED_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_SED_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_SED"; then as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 fi else ac_cv_path_SED=$SED fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 $as_echo "$ac_cv_path_SED" >&6; } SED="$ac_cv_path_SED" rm -f conftest.sed test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 $as_echo_n "checking for grep that handles long lines and -e... " >&6; } if ${ac_cv_path_GREP+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$GREP"; then ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_GREP" || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_GREP"; then as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_GREP=$GREP fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 $as_echo "$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 $as_echo_n "checking for egrep... " >&6; } if ${ac_cv_path_EGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else if test -z "$EGREP"; then ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_EGREP" || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_EGREP"; then as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_EGREP=$EGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 $as_echo "$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 $as_echo_n "checking for fgrep... " >&6; } if ${ac_cv_path_FGREP+:} false; then : $as_echo_n "(cached) " >&6 else if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 then ac_cv_path_FGREP="$GREP -F" else if test -z "$FGREP"; then ac_path_FGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in fgrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_FGREP" || continue # Check for GNU ac_path_FGREP and select it if it is found. # Check for GNU $ac_path_FGREP case `"$ac_path_FGREP" --version 2>&1` in *GNU*) ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; *) ac_count=0 $as_echo_n 0123456789 >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" $as_echo 'FGREP' >> "conftest.nl" "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break as_fn_arith $ac_count + 1 && ac_count=$as_val if test $ac_count -gt ${ac_path_FGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_FGREP_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_FGREP"; then as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 fi else ac_cv_path_FGREP=$FGREP fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 $as_echo "$ac_cv_path_FGREP" >&6; } FGREP="$ac_cv_path_FGREP" test -z "$GREP" && GREP=grep # Check whether --with-gnu-ld was given. if test "${with_gnu_ld+set}" = set; then : withval=$with_gnu_ld; test no = "$withval" || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${lt_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${lt_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU lds only accept -v. case `$LD -v 2>&1 &5 $as_echo "$lt_cv_prog_gnu_ld" >&6; } with_gnu_ld=$lt_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 $as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } if ${lt_cv_path_NM+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else if test -n "$ac_tool_prefix"; then for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DUMPBIN"; then ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DUMPBIN=$ac_cv_prog_DUMPBIN if test -n "$DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 $as_echo "$DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$DUMPBIN" && break done fi if test -z "$DUMPBIN"; then ac_ct_DUMPBIN=$DUMPBIN for ac_prog in dumpbin "link -dump" do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DUMPBIN"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN if test -n "$ac_ct_DUMPBIN"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 $as_echo "$ac_ct_DUMPBIN" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_DUMPBIN" && break done if test "x$ac_ct_DUMPBIN" = x; then DUMPBIN=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DUMPBIN=$ac_ct_DUMPBIN fi fi case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm { $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 $as_echo_n "checking the name lister ($NM) interface... " >&6; } if ${lt_cv_nm_interface+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&5 (eval echo "\"\$as_me:$LINENO: output\"" >&5) cat conftest.out >&5 if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 $as_echo "$lt_cv_nm_interface" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 $as_echo_n "checking whether ln -s works... " >&6; } LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 $as_echo "no, using $LN_S" >&6; } fi # find the maximum length of command line arguments { $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 $as_echo_n "checking the maximum length of command line arguments... " >&6; } if ${lt_cv_sys_max_cmd_len+:} false; then : $as_echo_n "(cached) " >&6 else i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac fi if test -n "$lt_cv_sys_max_cmd_len"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 $as_echo "$lt_cv_sys_max_cmd_len" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 $as_echo "none" >&6; } fi max_cmd_len=$lt_cv_sys_max_cmd_len : ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 $as_echo_n "checking how to convert $build file names to $host format... " >&6; } if ${lt_cv_to_host_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac fi to_host_file_cmd=$lt_cv_to_host_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 $as_echo "$lt_cv_to_host_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 $as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } if ${lt_cv_to_tool_file_cmd+:} false; then : $as_echo_n "(cached) " >&6 else #assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac fi to_tool_file_cmd=$lt_cv_to_tool_file_cmd { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 $as_echo "$lt_cv_to_tool_file_cmd" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 $as_echo_n "checking for $LD option to reload object files... " >&6; } if ${lt_cv_ld_reload_flag+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_reload_flag='-r' fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 $as_echo "$lt_cv_ld_reload_flag" >&6; } reload_flag=$lt_cv_ld_reload_flag case $reload_flag in "" | " "*) ;; *) reload_flag=" $reload_flag" ;; esac reload_cmds='$LD$reload_flag -o $output$reload_objs' case $host_os in cygwin* | mingw* | pw32* | cegcc*) if test yes != "$GCC"; then reload_cmds=false fi ;; darwin*) if test yes = "$GCC"; then reload_cmds='$LTCC $LTCFLAGS -nostdlib $wl-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. set dummy ${ac_tool_prefix}objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OBJDUMP"; then ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OBJDUMP=$ac_cv_prog_OBJDUMP if test -n "$OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 $as_echo "$OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OBJDUMP"; then ac_ct_OBJDUMP=$OBJDUMP # Extract the first word of "objdump", so it can be a program name with args. set dummy objdump; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OBJDUMP"; then ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OBJDUMP="objdump" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP if test -n "$ac_ct_OBJDUMP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 $as_echo "$ac_ct_OBJDUMP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OBJDUMP" = x; then OBJDUMP="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OBJDUMP=$ac_ct_OBJDUMP fi else OBJDUMP="$ac_cv_prog_OBJDUMP" fi test -z "$OBJDUMP" && OBJDUMP=objdump { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 $as_echo_n "checking how to recognize dependent libraries... " >&6; } if ${lt_cv_deplibs_check_method+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[3-9]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 $as_echo "$lt_cv_deplibs_check_method" >&6; } file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. set dummy ${ac_tool_prefix}dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DLLTOOL"; then ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DLLTOOL=$ac_cv_prog_DLLTOOL if test -n "$DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 $as_echo "$DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DLLTOOL"; then ac_ct_DLLTOOL=$DLLTOOL # Extract the first word of "dlltool", so it can be a program name with args. set dummy dlltool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DLLTOOL"; then ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DLLTOOL="dlltool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL if test -n "$ac_ct_DLLTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 $as_echo "$ac_ct_DLLTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DLLTOOL" = x; then DLLTOOL="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DLLTOOL=$ac_ct_DLLTOOL fi else DLLTOOL="$ac_cv_prog_DLLTOOL" fi test -z "$DLLTOOL" && DLLTOOL=dlltool { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 $as_echo_n "checking how to associate runtime and link libraries... " >&6; } if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 $as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO if test -n "$ac_tool_prefix"; then for ac_prog in ar do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$AR"; then ac_cv_prog_AR="$AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_AR="$ac_tool_prefix$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 $as_echo "$AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$AR" && break done fi if test -z "$AR"; then ac_ct_AR=$AR for ac_prog in ar do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_AR+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_AR"; then ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_AR="$ac_prog" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 $as_echo "$ac_ct_AR" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$ac_ct_AR" && break done if test "x$ac_ct_AR" = x; then AR="false" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac AR=$ac_ct_AR fi fi : ${AR=ar} : ${AR_FLAGS=cru} { $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 $as_echo_n "checking for archiver @FILE support... " >&6; } if ${lt_cv_ar_at_file+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ar_at_file=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 (eval $lt_ar_try) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 $as_echo "$lt_cv_ar_at_file" >&6; } if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 $as_echo "$STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_STRIP+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_STRIP="strip" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 $as_echo "$ac_ct_STRIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi test -z "$STRIP" && STRIP=: if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$RANLIB"; then ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 $as_echo "$RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_RANLIB"; then ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_RANLIB="ranlib" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 $as_echo "$ac_ct_RANLIB" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_RANLIB" = x; then RANLIB=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac RANLIB=$ac_ct_RANLIB fi else RANLIB="$ac_cv_prog_RANLIB" fi test -z "$RANLIB" && RANLIB=: # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Check for command to grab the raw symbol name followed by C symbol from nm. { $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 $as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } if ${lt_cv_sys_global_symbol_pipe+:} false; then : $as_echo_n "(cached) " >&6 else # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[BCDEGRST]' # Regexp to match symbols that can be accessed directly from C. sympat='\([_A-Za-z][_A-Za-z0-9]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[BCDT]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[ABCDGISTW]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then # Now try to grab the symbols. nlist=conftest.nm if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT_DLSYM_CONST #else # define LT_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&5 fi else echo "cannot find nm_test_var in $nlist" >&5 fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 fi else echo "$progname: failed program was:" >&5 cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 $as_echo "failed" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 $as_echo "ok" >&6; } fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then nm_file_list_spec='@' fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 $as_echo_n "checking for sysroot... " >&6; } # Check whether --with-sysroot was given. if test "${with_sysroot+set}" = set; then : withval=$with_sysroot; else with_sysroot=no fi lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_sysroot" >&5 $as_echo "$with_sysroot" >&6; } as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 $as_echo "${lt_sysroot:-no}" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a working dd" >&5 $as_echo_n "checking for a working dd... " >&6; } if ${ac_cv_path_lt_DD+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} if test -z "$lt_DD"; then ac_path_lt_DD_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in dd; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_lt_DD="$as_dir/$ac_prog$ac_exec_ext" as_fn_executable_p "$ac_path_lt_DD" || continue if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi $ac_path_lt_DD_found && break 3 done done done IFS=$as_save_IFS if test -z "$ac_cv_path_lt_DD"; then : fi else ac_cv_path_lt_DD=$lt_DD fi rm -f conftest.i conftest2.i conftest.out fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_lt_DD" >&5 $as_echo "$ac_cv_path_lt_DD" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to truncate binary pipes" >&5 $as_echo_n "checking how to truncate binary pipes... " >&6; } if ${lt_cv_truncate_bin+:} false; then : $as_echo_n "(cached) " >&6 else printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_truncate_bin" >&5 $as_echo "$lt_cv_truncate_bin" >&6; } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '#line '$LINENO' "configure"' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 $as_echo_n "checking whether the C compiler needs -belf... " >&6; } if ${lt_cv_cc_needs_belf+:} false; then : $as_echo_n "(cached) " >&6 else ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_cc_needs_belf=yes else lt_cv_cc_needs_belf=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 $as_echo "$lt_cv_cc_needs_belf" >&6; } if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. set dummy ${ac_tool_prefix}mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$MANIFEST_TOOL"; then ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL if test -n "$MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 $as_echo "$MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_MANIFEST_TOOL"; then ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL # Extract the first word of "mt", so it can be a program name with args. set dummy mt; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_MANIFEST_TOOL"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL if test -n "$ac_ct_MANIFEST_TOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 $as_echo "$ac_ct_MANIFEST_TOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_MANIFEST_TOOL" = x; then MANIFEST_TOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL fi else MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" fi test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 $as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } if ${lt_cv_path_mainfest_tool+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&5 if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 $as_echo "$lt_cv_path_mainfest_tool" >&6; } if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi case $host_os in rhapsody* | darwin*) if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$DSYMUTIL"; then ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi DSYMUTIL=$ac_cv_prog_DSYMUTIL if test -n "$DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 $as_echo "$DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_DSYMUTIL"; then ac_ct_DSYMUTIL=$DSYMUTIL # Extract the first word of "dsymutil", so it can be a program name with args. set dummy dsymutil; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_DSYMUTIL"; then ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL if test -n "$ac_ct_DSYMUTIL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 $as_echo "$ac_ct_DSYMUTIL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_DSYMUTIL" = x; then DSYMUTIL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac DSYMUTIL=$ac_ct_DSYMUTIL fi else DSYMUTIL="$ac_cv_prog_DSYMUTIL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. set dummy ${ac_tool_prefix}nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$NMEDIT"; then ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi NMEDIT=$ac_cv_prog_NMEDIT if test -n "$NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 $as_echo "$NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_NMEDIT"; then ac_ct_NMEDIT=$NMEDIT # Extract the first word of "nmedit", so it can be a program name with args. set dummy nmedit; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_NMEDIT"; then ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_NMEDIT="nmedit" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT if test -n "$ac_ct_NMEDIT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 $as_echo "$ac_ct_NMEDIT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_NMEDIT" = x; then NMEDIT=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac NMEDIT=$ac_ct_NMEDIT fi else NMEDIT="$ac_cv_prog_NMEDIT" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. set dummy ${ac_tool_prefix}lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LIPO"; then ac_cv_prog_LIPO="$LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LIPO="${ac_tool_prefix}lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi LIPO=$ac_cv_prog_LIPO if test -n "$LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 $as_echo "$LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_LIPO"; then ac_ct_LIPO=$LIPO # Extract the first word of "lipo", so it can be a program name with args. set dummy lipo; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_LIPO+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_LIPO"; then ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_LIPO="lipo" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO if test -n "$ac_ct_LIPO"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 $as_echo "$ac_ct_LIPO" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_LIPO" = x; then LIPO=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac LIPO=$ac_ct_LIPO fi else LIPO="$ac_cv_prog_LIPO" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. set dummy ${ac_tool_prefix}otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL"; then ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL="${ac_tool_prefix}otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL=$ac_cv_prog_OTOOL if test -n "$OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 $as_echo "$OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL"; then ac_ct_OTOOL=$OTOOL # Extract the first word of "otool", so it can be a program name with args. set dummy otool; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL"; then ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL="otool" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL if test -n "$ac_ct_OTOOL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 $as_echo "$ac_ct_OTOOL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL" = x; then OTOOL=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL=$ac_ct_OTOOL fi else OTOOL="$ac_cv_prog_OTOOL" fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. set dummy ${ac_tool_prefix}otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$OTOOL64"; then ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi OTOOL64=$ac_cv_prog_OTOOL64 if test -n "$OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 $as_echo "$OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_prog_OTOOL64"; then ac_ct_OTOOL64=$OTOOL64 # Extract the first word of "otool64", so it can be a program name with args. set dummy otool64; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$ac_ct_OTOOL64"; then ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_ac_ct_OTOOL64="otool64" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 if test -n "$ac_ct_OTOOL64"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 $as_echo "$ac_ct_OTOOL64" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_ct_OTOOL64" = x; then OTOOL64=":" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac OTOOL64=$ac_ct_OTOOL64 fi else OTOOL64="$ac_cv_prog_OTOOL64" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 $as_echo_n "checking for -single_module linker flag... " >&6; } if ${lt_cv_apple_cc_single_mod+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&5 $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&5 # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&5 fi rm -rf libconftest.dylib* rm -f conftest.* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 $as_echo "$lt_cv_apple_cc_single_mod" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 $as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } if ${lt_cv_ld_exported_symbols_list+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_ld_exported_symbols_list=yes else lt_cv_ld_exported_symbols_list=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 $as_echo "$lt_cv_ld_exported_symbols_list" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 $as_echo_n "checking for -force_load linker flag... " >&6; } if ${lt_cv_ld_force_load+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 echo "$AR cru libconftest.a conftest.o" >&5 $AR cru libconftest.a conftest.o 2>&5 echo "$RANLIB libconftest.a" >&5 $RANLIB libconftest.a 2>&5 cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&5 elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&5 fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 $as_echo "$lt_cv_ld_force_load" >&6; } case $host_os in rhapsody* | darwin1.[012]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[91]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[012][,.]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 $as_echo_n "checking for ANSI C header files... " >&6; } if ${ac_cv_header_stdc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_stdc=yes else ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : : else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : else ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 $as_echo "$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then $as_echo "#define STDC_HEADERS 1" >>confdefs.h fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done for ac_header in dlfcn.h do : ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default " if test "x$ac_cv_header_dlfcn_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_DLFCN_H 1 _ACEOF fi done # Set options enable_dlopen=no enable_win32_dll=no # Check whether --enable-shared was given. if test "${enable_shared+set}" = set; then : enableval=$enable_shared; p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac else enable_shared=yes fi # Check whether --enable-static was given. if test "${enable_static+set}" = set; then : enableval=$enable_static; p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac else enable_static=yes fi # Check whether --with-pic was given. if test "${with_pic+set}" = set; then : withval=$with_pic; lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac else pic_mode=default fi # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac else enable_fast_install=yes fi shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[5-9]*,yes) { $as_echo "$as_me:${as_lineno-$LINENO}: checking which variant of shared library versioning to provide" >&5 $as_echo_n "checking which variant of shared library versioning to provide... " >&6; } # Check whether --with-aix-soname was given. if test "${with_aix_soname+set}" = set; then : withval=$with_aix_soname; case $withval in aix|svr4|both) ;; *) as_fn_error $? "Unknown argument to --with-aix-soname" "$LINENO" 5 ;; esac lt_cv_with_aix_soname=$with_aix_soname else if ${lt_cv_with_aix_soname+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_with_aix_soname=aix fi with_aix_soname=$lt_cv_with_aix_soname fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $with_aix_soname" >&5 $as_echo "$with_aix_soname" >&6; } if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${lt_cv_objdir+:} false; then : $as_echo_n "(cached) " >&6 else rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 $as_echo "$lt_cv_objdir" >&6; } objdir=$lt_cv_objdir cat >>confdefs.h <<_ACEOF #define LT_OBJDIR "$lt_cv_objdir/" _ACEOF case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o func_cc_basename $compiler cc_basename=$func_cc_basename_result # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/${ac_tool_prefix}file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"${ac_tool_prefix}file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 $as_echo_n "checking for file... " >&6; } if ${lt_cv_path_MAGIC_CMD+:} false; then : $as_echo_n "(cached) " >&6 else case $MAGIC_CMD in [\\/*] | ?:[\\/]*) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/file"; then lt_cv_path_MAGIC_CMD=$ac_dir/"file" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac fi MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 $as_echo "$MAGIC_CMD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else MAGIC_CMD=: fi fi fi ;; esac # Use C for the default configuration in the libtool script lt_save_CC=$CC ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o objext=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* if test -n "$compiler"; then lt_prog_compiler_no_builtin_flag= if test yes = "$GCC"; then case $cc_basename in nvcc*) lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; *) lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 $as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_rtti_exceptions=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-fno-rtti -fno-exceptions" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_rtti_exceptions=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 $as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } if test yes = "$lt_cv_prog_compiler_rtti_exceptions"; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test yes = "$GCC"; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi lt_prog_compiler_pic='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support lt_prog_compiler_pic='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. lt_prog_compiler_static= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) lt_prog_compiler_pic='-fPIC' ;; esac ;; interix[3-9]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. lt_prog_compiler_can_build_shared=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic=-Kconform_pic fi ;; *) lt_prog_compiler_pic='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 lt_prog_compiler_wl='-Xlinker ' if test -n "$lt_prog_compiler_pic"; then lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) lt_prog_compiler_wl='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files lt_prog_compiler_pic='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). lt_prog_compiler_pic='-DDLL_EXPORT' case $host_os in os2*) lt_prog_compiler_static='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) lt_prog_compiler_wl='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) lt_prog_compiler_pic='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? lt_prog_compiler_static='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) lt_prog_compiler_wl='-Wl,' # PIC (with -KPIC) is the default. lt_prog_compiler_static='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; # Lahey Fortran 8.1. lf95*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='--shared' lt_prog_compiler_static='--static' ;; nagfor*) # NAG Fortran compiler lt_prog_compiler_wl='-Wl,-Wl,,' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; ccc*) lt_prog_compiler_wl='-Wl,' # All Alpha code is PIC. lt_prog_compiler_static='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-qpic' lt_prog_compiler_static='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [1-7].* | *Sun*Fortran*\ 8.[0-3]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='' ;; *Sun\ F* | *Sun*Fortran*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' lt_prog_compiler_wl='-Wl,' ;; *Intel*\ [CF]*Compiler*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fPIC' lt_prog_compiler_static='-static' ;; *Portland\ Group*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-fpic' lt_prog_compiler_static='-Bstatic' ;; esac ;; esac ;; newsos6) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. lt_prog_compiler_pic='-fPIC -shared' ;; osf3* | osf4* | osf5*) lt_prog_compiler_wl='-Wl,' # All OSF/1 code is PIC. lt_prog_compiler_static='-non_shared' ;; rdos*) lt_prog_compiler_static='-non_shared' ;; solaris*) lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) lt_prog_compiler_wl='-Qoption ld ';; *) lt_prog_compiler_wl='-Wl,';; esac ;; sunos4*) lt_prog_compiler_wl='-Qoption ld ' lt_prog_compiler_pic='-PIC' lt_prog_compiler_static='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then lt_prog_compiler_pic='-Kconform_pic' lt_prog_compiler_static='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_pic='-KPIC' lt_prog_compiler_static='-Bstatic' ;; unicos*) lt_prog_compiler_wl='-Wl,' lt_prog_compiler_can_build_shared=no ;; uts4*) lt_prog_compiler_pic='-pic' lt_prog_compiler_static='-Bstatic' ;; *) lt_prog_compiler_can_build_shared=no ;; esac fi case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 $as_echo_n "checking for $compiler option to produce PIC... " >&6; } if ${lt_cv_prog_compiler_pic+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic=$lt_prog_compiler_pic fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 $as_echo "$lt_cv_prog_compiler_pic" >&6; } lt_prog_compiler_pic=$lt_cv_prog_compiler_pic # # Check to make sure the PIC flag actually works. # if test -n "$lt_prog_compiler_pic"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 $as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } if ${lt_cv_prog_compiler_pic_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_pic_works=no ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$lt_prog_compiler_pic -DPIC" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_pic_works=yes fi fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 $as_echo "$lt_cv_prog_compiler_pic_works" >&6; } if test yes = "$lt_cv_prog_compiler_pic_works"; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # Check to make sure the static flag actually works. # wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 $as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } if ${lt_cv_prog_compiler_static_works+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_static_works=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $lt_tmp_static_flag" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler_static_works=yes fi else lt_cv_prog_compiler_static_works=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 $as_echo "$lt_cv_prog_compiler_static_works" >&6; } if test yes = "$lt_cv_prog_compiler_static_works"; then : else lt_prog_compiler_static= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 $as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } if ${lt_cv_prog_compiler_c_o+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler_c_o=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then lt_cv_prog_compiler_c_o=yes fi fi chmod u+w . 2>&5 $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 $as_echo "$lt_cv_prog_compiler_c_o" >&6; } hard_links=nottested if test no = "$lt_cv_prog_compiler_c_o" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 $as_echo_n "checking if we can lock with hard links... " >&6; } hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 $as_echo "$hard_links" >&6; } if test no = "$hard_links"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&5 $as_echo "$as_me: WARNING: '$CC' does not support '-c -o', so 'make -j' may be unsafe" >&2;} need_locks=warn fi else need_locks=no fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 $as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } runpath_var= allow_undefined_flag= always_export_symbols=no archive_cmds= archive_expsym_cmds= compiler_needs_object=no enable_shared_with_static_runtimes=no export_dynamic_flag_spec= export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' hardcode_automatic=no hardcode_direct=no hardcode_direct_absolute=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_minus_L=no hardcode_shlibpath_var=unsupported inherit_rpath=no link_all_deplibs=unknown module_cmds= module_expsym_cmds= old_archive_from_new_cmds= old_archive_from_expsyms_cmds= thread_safe_flag_spec= whole_archive_flag_spec= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list include_expsyms= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; esac ld_shlibs=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; *\ \(GNU\ Binutils\)\ [3-9]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' export_dynamic_flag_spec='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/(^)\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then allow_undefined_flag=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else ld_shlibs=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, # as there is no search path for DLLs. hardcode_libdir_flag_spec='-L$libdir' export_dynamic_flag_spec='$wl--export-all-symbols' allow_undefined_flag=unsupported always_export_symbols=no enable_shared_with_static_runtimes=yes export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else ld_shlibs=no fi ;; haiku*) archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' link_all_deplibs=yes ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; interix[3-9]*) hardcode_direct=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' archive_expsym_cmds='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 whole_archive_flag_spec= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 whole_archive_flag_spec='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 whole_archive_flag_spec='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' compiler_needs_object=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) export_dynamic_flag_spec='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else ld_shlibs=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) ld_shlibs=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac ;; sunos4*) archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= hardcode_direct=yes hardcode_shlibpath_var=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else ld_shlibs=no fi ;; esac if test no = "$ld_shlibs"; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. hardcode_direct=unsupported fi ;; aix[4-9]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='`func_echo_all $NM | $SED -e '\''s/B\([^B]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && (substr(\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. hardcode_direct=no hardcode_direct_absolute=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 hardcode_direct=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking hardcode_minus_L=yes hardcode_libdir_flag_spec='-L$libdir' hardcode_libdir_separator= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi export_dynamic_flag_spec='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. always_export_symbols=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then hardcode_libdir_flag_spec='$wl-R $libdir:/usr/lib:/lib' allow_undefined_flag="-z nodefs" archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else if ${lt_cv_aix_libpath_+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_aix_libpath_sed=' /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }' lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test -z "$lt_cv_aix_libpath_"; then lt_cv_aix_libpath_=/usr/lib:/lib fi fi aix_libpath=$lt_cv_aix_libpath_ fi hardcode_libdir_flag_spec='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. no_undefined_flag=' $wl-bernotok' allow_undefined_flag=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. whole_archive_flag_spec='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives whole_archive_flag_spec='$convenience' fi archive_cmds_need_lc=yes archive_expsym_cmds='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([, ]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then archive_expsym_cmds="$archive_expsym_cmds"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols archive_expsym_cmds="$archive_expsym_cmds"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi archive_expsym_cmds="$archive_expsym_cmds"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' archive_expsym_cmds='' ;; m68k) archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes ;; esac ;; bsdi[45]*) export_dynamic_flag_spec=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported always_export_symbols=yes file_list_spec='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' archive_expsym_cmds='if test DEF = "`$SED -n -e '\''s/^[ ]*//'\'' -e '\''/^\(;.*\)*$/d'\'' -e '\''s/^\(EXPORTS\|LIBRARY\)\([ ].*\)*$/DEF/p'\'' -e q $export_symbols`" ; then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, )='true' enable_shared_with_static_runtimes=yes exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib old_postinstall_cmds='chmod 644 $oldlib' postlink_cmds='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper hardcode_libdir_flag_spec=' ' allow_undefined_flag=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. old_archive_from_new_cmds='true' # FIXME: Should let the user specify the lib program. old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' enable_shared_with_static_runtimes=yes ;; esac ;; darwin* | rhapsody*) archive_cmds_need_lc=no hardcode_direct=no hardcode_automatic=yes hardcode_shlibpath_var=unsupported if test yes = "$lt_cv_ld_force_load"; then whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' else whole_archive_flag_spec='' fi link_all_deplibs=yes allow_undefined_flag=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" archive_expsym_cmds="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" module_expsym_cmds="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" else ld_shlibs=no fi ;; dgux*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; hpux9*) if test yes = "$GCC"; then archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) archive_cmds='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) archive_cmds='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) archive_cmds='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) archive_cmds='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 $as_echo_n "checking if $CC understands -b... " >&6; } if ${lt_cv_prog_compiler__b+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_prog_compiler__b=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -b" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&5 $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then lt_cv_prog_compiler__b=yes fi else lt_cv_prog_compiler__b=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 $as_echo "$lt_cv_prog_compiler__b" >&6; } if test yes = "$lt_cv_prog_compiler__b"; then archive_cmds='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi ;; esac fi if test no = "$with_gnu_ld"; then hardcode_libdir_flag_spec='$wl+b $wl$libdir' hardcode_libdir_separator=: case $host_cpu in hppa*64*|ia64*) hardcode_direct=no hardcode_shlibpath_var=no ;; *) hardcode_direct=yes hardcode_direct_absolute=yes export_dynamic_flag_spec='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 $as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } if ${lt_cv_irix_exported_symbol+:} false; then : $as_echo_n "(cached) " >&6 else save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int foo (void) { return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : lt_cv_irix_exported_symbol=yes else lt_cv_irix_exported_symbol=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 $as_echo "$lt_cv_irix_exported_symbol" >&6; } if test yes = "$lt_cv_irix_exported_symbol"; then archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi else archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: inherit_rpath=yes link_all_deplibs=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler ld_shlibs=yes archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi hardcode_libdir_flag_spec='-R$libdir' hardcode_direct=yes hardcode_shlibpath_var=no ;; newsos6) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: hardcode_shlibpath_var=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then hardcode_direct=yes hardcode_shlibpath_var=no hardcode_direct_absolute=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='$wl-rpath,$libdir' export_dynamic_flag_spec='$wl-E' else archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='$wl-rpath,$libdir' fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported shrext_cmds=.dll archive_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' archive_expsym_cmds='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' old_archive_From_new_cmds='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' enable_shared_with_static_runtimes=yes ;; osf3*) if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi archive_cmds_need_lc='no' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' hardcode_libdir_separator=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then allow_undefined_flag=' $wl-expect_unresolved $wl\*' archive_cmds='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' hardcode_libdir_flag_spec='$wl-rpath $wl$libdir' else allow_undefined_flag=' -expect_unresolved \*' archive_cmds='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly hardcode_libdir_flag_spec='-rpath $libdir' fi archive_cmds_need_lc='no' hardcode_libdir_separator=: ;; solaris*) no_undefined_flag=' -z defs' if test yes = "$GCC"; then wlarc='$wl' archive_cmds='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' archive_cmds='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' archive_cmds='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi hardcode_libdir_flag_spec='-R$libdir' hardcode_shlibpath_var=no case $host_os in solaris2.[0-5] | solaris2.[0-5].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then whole_archive_flag_spec='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else whole_archive_flag_spec='-z allextract$convenience -z defaultextract' fi ;; esac link_all_deplibs=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) no_undefined_flag='$wl-z,text' archive_cmds_need_lc=no hardcode_shlibpath_var=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='$wl-z,text' allow_undefined_flag='$wl-z,nodefs' archive_cmds_need_lc=no hardcode_shlibpath_var=no hardcode_libdir_flag_spec='$wl-R,$libdir' hardcode_libdir_separator=':' link_all_deplibs=yes export_dynamic_flag_spec='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then archive_cmds='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-L$libdir' hardcode_shlibpath_var=no ;; *) ld_shlibs=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) export_dynamic_flag_spec='$wl-Blargedynsym' ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 $as_echo "$ld_shlibs" >&6; } test no = "$ld_shlibs" && can_build_shared=no with_gnu_ld=$with_gnu_ld # # Do we need to explicitly link libc? # case "x$archive_cmds_need_lc" in x|xyes) # Assume -lc should be added archive_cmds_need_lc=yes if test yes,yes = "$GCC,$enable_shared"; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 $as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } if ${lt_cv_archive_cmds_need_lc+:} false; then : $as_echo_n "(cached) " >&6 else $RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$lt_prog_compiler_wl pic_flag=$lt_prog_compiler_pic compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$allow_undefined_flag allow_undefined_flag= if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } then lt_cv_archive_cmds_need_lc=no else lt_cv_archive_cmds_need_lc=yes fi allow_undefined_flag=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 $as_echo "$lt_cv_archive_cmds_need_lc" >&6; } archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc ;; esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 $as_echo_n "checking dynamic linker characteristics... " >&6; } if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([A-Za-z]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([A-Za-z]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[4-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a(lib.so.V)' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V($shared_archive_member_spec.o), lib.a(lib.so.V)" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a(lib.so.V), lib.so.V($shared_archive_member_spec.o)" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[.]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[23].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[3-9]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. hardcode_libdir_flag_spec='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH if ${lt_cv_shlibpath_overrides_runpath+:} false; then : $as_echo_n "(cached) " >&6 else lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : lt_cv_shlibpath_overrides_runpath=yes fi fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LDFLAGS=$save_LDFLAGS libdir=$save_libdir fi shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 $as_echo "$dynamic_linker" >&6; } test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 $as_echo_n "checking how to hardcode library paths into programs... " >&6; } hardcode_action= if test -n "$hardcode_libdir_flag_spec" || test -n "$runpath_var" || test yes = "$hardcode_automatic"; then # We can hardcode non-existent directories. if test no != "$hardcode_direct" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, )" && test no != "$hardcode_minus_L"; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test relink = "$hardcode_action" || test yes = "$inherit_rpath"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes fi ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" if test "x$ac_cv_func_shl_load" = xyes; then : lt_cv_dlopen=shl_load else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 $as_echo_n "checking for shl_load in -ldld... " >&6; } if ${ac_cv_lib_dld_shl_load+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char shl_load (); int main () { return shl_load (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_shl_load=yes else ac_cv_lib_dld_shl_load=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 $as_echo "$ac_cv_lib_dld_shl_load" >&6; } if test "x$ac_cv_lib_dld_shl_load" = xyes; then : lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld else ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" if test "x$ac_cv_func_dlopen" = xyes; then : lt_cv_dlopen=dlopen else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 $as_echo_n "checking for dlopen in -lsvld... " >&6; } if ${ac_cv_lib_svld_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lsvld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_svld_dlopen=yes else ac_cv_lib_svld_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 $as_echo "$ac_cv_lib_svld_dlopen" >&6; } if test "x$ac_cv_lib_svld_dlopen" = xyes; then : lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 $as_echo_n "checking for dld_link in -ldld... " >&6; } if ${ac_cv_lib_dld_dld_link+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldld $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dld_link (); int main () { return dld_link (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dld_dld_link=yes else ac_cv_lib_dld_dld_link=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 $as_echo "$ac_cv_lib_dld_dld_link" >&6; } if test "x$ac_cv_lib_dld_dld_link" = xyes; then : lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld fi fi fi fi fi fi ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 $as_echo_n "checking whether a program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; esac else : # compilation failed lt_cv_dlopen_self=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 $as_echo "$lt_cv_dlopen_self" >&6; } if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 $as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } if ${lt_cv_dlopen_self_static+:} false; then : $as_echo_n "(cached) " >&6 else if test yes = "$cross_compiling"; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF #line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; } _LT_EOF if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 (eval $ac_link) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&5 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; esac else : # compilation failed lt_cv_dlopen_self_static=no fi fi rm -fr conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 $as_echo "$lt_cv_dlopen_self_static" >&6; } fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi striplib= old_striplib= { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 $as_echo_n "checking whether stripping libraries is possible... " >&6; } if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi ;; *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } ;; esac fi # Report what library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 $as_echo "$enable_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 $as_echo_n "checking whether to build static libraries... " >&6; } # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 $as_echo "$enable_static" >&6; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu CC=$lt_save_CC ac_config_commands="$ac_config_commands libtool" # Only expand once: if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then : enableval=$enable_largefile; fi if test "$enable_largefile" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for special C compiler options needed for large files" >&5 $as_echo_n "checking for special C compiler options needed for large files... " >&6; } if ${ac_cv_sys_largefile_CC+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_sys_largefile_CC=no if test "$GCC" != yes; then ac_save_CC=$CC while :; do # IRIX 6.2 and later do not support large files by default, # so use the C compiler's -n32 option if that helps. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : break fi rm -f core conftest.err conftest.$ac_objext CC="$CC -n32" if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_largefile_CC=' -n32'; break fi rm -f core conftest.err conftest.$ac_objext break done CC=$ac_save_CC rm -f conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_largefile_CC" >&5 $as_echo "$ac_cv_sys_largefile_CC" >&6; } if test "$ac_cv_sys_largefile_CC" != no; then CC=$CC$ac_cv_sys_largefile_CC fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _FILE_OFFSET_BITS value needed for large files" >&5 $as_echo_n "checking for _FILE_OFFSET_BITS value needed for large files... " >&6; } if ${ac_cv_sys_file_offset_bits+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _FILE_OFFSET_BITS 64 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_file_offset_bits=64; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_file_offset_bits=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_file_offset_bits" >&5 $as_echo "$ac_cv_sys_file_offset_bits" >&6; } case $ac_cv_sys_file_offset_bits in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _FILE_OFFSET_BITS $ac_cv_sys_file_offset_bits _ACEOF ;; esac rm -rf conftest* if test $ac_cv_sys_file_offset_bits = unknown; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _LARGE_FILES value needed for large files" >&5 $as_echo_n "checking for _LARGE_FILES value needed for large files... " >&6; } if ${ac_cv_sys_large_files+:} false; then : $as_echo_n "(cached) " >&6 else while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=no; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #define _LARGE_FILES 1 #include /* Check that off_t can represent 2**63 - 1 correctly. We can't simply define LARGE_OFF_T to be 9223372036854775807, since some C++ compilers masquerading as C compilers incorrectly reject 9223372036854775807. */ #define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 && LARGE_OFF_T % 2147483647 == 1) ? 1 : -1]; int main () { ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_sys_large_files=1; break fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_sys_large_files=unknown break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sys_large_files" >&5 $as_echo "$ac_cv_sys_large_files" >&6; } case $ac_cv_sys_large_files in #( no | unknown) ;; *) cat >>confdefs.h <<_ACEOF #define _LARGE_FILES $ac_cv_sys_large_files _ACEOF ;; esac rm -rf conftest* fi fi fob_set=no if test "x$ac_cv_sys_file_offset_bits" != x -a "$ac_cv_sys_file_offset_bits" != no; then CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits" fob_set=yes fi if test "x$ac_cv_sys_large_files" != x -a "$ac_cv_sys_large_files" != no; then CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files" fi if test "$enable_largefile" != no -a "$fob_set" != "yes" -a "$fuse_build" = "yes"; then CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64" fob_set=yes fi if test -z "$cflags"; then if test "$GCC" = yes; then if test "$debugmode" = yes; then CFLAGS="-Wall -g" else CFLAGS="-Wall -O3" fi ZLIB_CFLAGS="-Wall -O3" else if test "$debugmode" = yes; then CFLAGS="-g" else CFLAGS="-O" fi ZLIB_CFLAGS="-O" fi fi CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_GNU_SOURCE" if test -z "$LD"; then # Extract the first word of "ld", so it can be a program name with args. set dummy ld; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_prog_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$LD"; then ac_cv_prog_LD="$LD" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_prog_LD="ld -r" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_prog_LD" && ac_cv_prog_LD="$CC -Wl,-r -nostdlib" fi fi LD=$ac_cv_prog_LD if test -n "$LD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi else LD="$LD -r" fi for ac_func in vsnprintf strncasecmp strcasecmp mkdtemp do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in getpwuid_r getpwnam_r getgrgid_r getgrnam_r do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done for ac_func in atoll do : ac_fn_c_check_func "$LINENO" "atoll" "ac_cv_func_atoll" if test "x$ac_cv_func_atoll" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_ATOLL 1 _ACEOF fi done for ac_header in $ac_header_list do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "sys/mkdev.h" "ac_cv_header_sys_mkdev_h" "$ac_includes_default" if test "x$ac_cv_header_sys_mkdev_h" = xyes; then : $as_echo "#define MAJOR_IN_MKDEV 1" >>confdefs.h fi if test $ac_cv_header_sys_mkdev_h = no; then ac_fn_c_check_header_mongrel "$LINENO" "sys/sysmacros.h" "ac_cv_header_sys_sysmacros_h" "$ac_includes_default" if test "x$ac_cv_header_sys_sysmacros_h" = xyes; then : $as_echo "#define MAJOR_IN_SYSMACROS 1" >>confdefs.h fi fi for ac_header in unistd.h do : ac_fn_c_check_header_mongrel "$LINENO" "unistd.h" "ac_cv_header_unistd_h" "$ac_includes_default" if test "x$ac_cv_header_unistd_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_UNISTD_H 1 _ACEOF fi done for ac_header in sys/statvfs.h do : ac_fn_c_check_header_mongrel "$LINENO" "sys/statvfs.h" "ac_cv_header_sys_statvfs_h" "$ac_includes_default" if test "x$ac_cv_header_sys_statvfs_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_SYS_STATVFS_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for d_type in struct dirent" >&5 $as_echo_n "checking for d_type in struct dirent... " >&6; } if ${my_cv_struct_d_type+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { struct dirent d; d.d_type; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : my_cv_struct_d_type=yes else my_cv_struct_d_type=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $my_cv_struct_d_type" >&5 $as_echo "$my_cv_struct_d_type" >&6; } if test $my_cv_struct_d_type = yes; then $as_echo "#define HAVE_D_TYPE 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for d_off in struct dirent" >&5 $as_echo_n "checking for d_off in struct dirent... " >&6; } if ${my_cv_struct_d_off+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { struct dirent d; d.d_off; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : my_cv_struct_d_off=yes else my_cv_struct_d_off=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $my_cv_struct_d_off" >&5 $as_echo "$my_cv_struct_d_off" >&6; } if test $my_cv_struct_d_off = yes; then $as_echo "#define HAVE_D_OFF 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing nanosleep" >&5 $as_echo_n "checking for library containing nanosleep... " >&6; } if ${ac_cv_search_nanosleep+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char nanosleep (); int main () { return nanosleep (); ; return 0; } _ACEOF for ac_lib in '' posix4; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_nanosleep=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_nanosleep+:} false; then : break fi done if ${ac_cv_search_nanosleep+:} false; then : else ac_cv_search_nanosleep=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_nanosleep" >&5 $as_echo "$ac_cv_search_nanosleep" >&6; } ac_res=$ac_cv_search_nanosleep if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing gethostbyname" >&5 $as_echo_n "checking for library containing gethostbyname... " >&6; } if ${ac_cv_search_gethostbyname+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char gethostbyname (); int main () { return gethostbyname (); ; return 0; } _ACEOF for ac_lib in '' nsl; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_gethostbyname=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_gethostbyname+:} false; then : break fi done if ${ac_cv_search_gethostbyname+:} false; then : else ac_cv_search_gethostbyname=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_gethostbyname" >&5 $as_echo "$ac_cv_search_gethostbyname" >&6; } ac_res=$ac_cv_search_gethostbyname if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing socket" >&5 $as_echo_n "checking for library containing socket... " >&6; } if ${ac_cv_search_socket+:} false; then : $as_echo_n "(cached) " >&6 else ac_func_search_save_LIBS=$LIBS cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char socket (); int main () { return socket (); ; return 0; } _ACEOF for ac_lib in '' socket inet; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi if ac_fn_c_try_link "$LINENO"; then : ac_cv_search_socket=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_socket+:} false; then : break fi done if ${ac_cv_search_socket+:} false; then : else ac_cv_search_socket=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_socket" >&5 $as_echo "$ac_cv_search_socket" >&6; } ac_res=$ac_cv_search_socket if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi neon_found=no if test "$dav" = yes; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"neon\""; } >&5 ($PKG_CONFIG --exists --print-errors "neon") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBNEON" >&5 $as_echo_n "checking for LIBNEON... " >&6; } if test -n "$LIBNEON_CFLAGS"; then pkg_cv_LIBNEON_CFLAGS="$LIBNEON_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"neon >= 0.27.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "neon >= 0.27.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBNEON_CFLAGS=`$PKG_CONFIG --cflags "neon >= 0.27.0" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$LIBNEON_LIBS"; then pkg_cv_LIBNEON_LIBS="$LIBNEON_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"neon >= 0.27.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "neon >= 0.27.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBNEON_LIBS=`$PKG_CONFIG --libs "neon >= 0.27.0" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then LIBNEON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "neon >= 0.27.0" 2>&1` else LIBNEON_PKG_ERRORS=`$PKG_CONFIG --print-errors "neon >= 0.27.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$LIBNEON_PKG_ERRORS" >&5 { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } neon_found=no elif test $pkg_failed = untried; then neon_found=no else LIBNEON_CFLAGS=$pkg_cv_LIBNEON_CFLAGS LIBNEON_LIBS=$pkg_cv_LIBNEON_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } neon_found=yes fi fi if test "$neon_found" = "yes"; then $as_echo "#define HAVE_LIBNEON 1" >>confdefs.h CPPFLAGS="$CPPFLAGS $LIBNEON_CFLAGS" LIBS="$LIBS $LIBNEON_LIBS" DAV=dav.c DAV_LS=dav_ls.c else DAV= DAV_LS= fi else DAV= DAV_LS= LIBDAV= fi if test x$neon_found = xyes; then BUILD_DAVSUPPORT_TRUE= BUILD_DAVSUPPORT_FALSE='#' else BUILD_DAVSUPPORT_TRUE='#' BUILD_DAVSUPPORT_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 $as_echo_n "checking for dlopen in -ldl... " >&6; } if ${ac_cv_lib_dl_dlopen+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-ldl $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char dlopen (); int main () { return dlopen (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_dl_dlopen=yes else ac_cv_lib_dl_dlopen=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 $as_echo "$ac_cv_lib_dl_dlopen" >&6; } if test "x$ac_cv_lib_dl_dlopen" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBDL 1 _ACEOF LIBS="-ldl $LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_create in -lpthread" >&5 $as_echo_n "checking for pthread_create in -lpthread... " >&6; } if ${ac_cv_lib_pthread_pthread_create+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lpthread $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char pthread_create (); int main () { return pthread_create (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_pthread_pthread_create=yes else ac_cv_lib_pthread_pthread_create=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_create" >&5 $as_echo "$ac_cv_lib_pthread_pthread_create" >&6; } if test "x$ac_cv_lib_pthread_pthread_create" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LIBPTHREAD 1 _ACEOF LIBS="-lpthread $LIBS" fi if test -z "`echo "$LIBS"|grep pthread`"; then LIBS="$LIBS -pthread" fi moduledir='${libdir}/avfs' install_scriptcomps= # Extract the first word of "zip", so it can be a program name with args. set dummy zip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ZIP+:} false; then : $as_echo_n "(cached) " >&6 else case $ZIP in [\\/]* | ?:[\\/]*) ac_cv_path_ZIP="$ZIP" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ZIP="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_ZIP" && ac_cv_path_ZIP="/usr/bin/zip" ;; esac fi ZIP=$ac_cv_path_ZIP if test -n "$ZIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ZIP" >&5 $as_echo "$ZIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "unzip", so it can be a program name with args. set dummy unzip; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_UNZIP+:} false; then : $as_echo_n "(cached) " >&6 else case $UNZIP in [\\/]* | ?:[\\/]*) ac_cv_path_UNZIP="$UNZIP" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_UNZIP="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_UNZIP" && ac_cv_path_UNZIP="/usr/bin/unzip" ;; esac fi UNZIP=$ac_cv_path_UNZIP if test -n "$UNZIP"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $UNZIP" >&5 $as_echo "$UNZIP" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for zipinfo code in unzip" >&5 $as_echo_n "checking for zipinfo code in unzip... " >&6; } if ${mc_cv_have_zipinfo+:} false; then : $as_echo_n "(cached) " >&6 else mc_cv_have_zipinfo=no if $UNZIP -Z /dev/null 2>&1; then mc_cv_have_zipinfo=yes fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $mc_cv_have_zipinfo" >&5 $as_echo "$mc_cv_have_zipinfo" >&6; } if test "x$mc_cv_have_zipinfo" = xyes; then HAVE_ZIPINFO=1 else HAVE_ZIPINFO=0 fi # Extract the first word of "perl", so it can be a program name with args. set dummy perl; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PERL+:} false; then : $as_echo_n "(cached) " >&6 else case $PERL in [\\/]* | ?:[\\/]*) ac_cv_path_PERL="$PERL" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PERL="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_PERL" && ac_cv_path_PERL="/usr/bin/perl" ;; esac fi PERL=$ac_cv_path_PERL if test -n "$PERL"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PERL" >&5 $as_echo "$PERL" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi install_fuse=no run_fuse_test=yes # Check whether --enable-fuse-test was given. if test "${enable_fuse_test+set}" = set; then : enableval=$enable_fuse_test; if test "$enableval" = yes; then run_fuse_test=yes; else run_fuse_test=no; fi fi if test $fuse_build = yes; then if test $run_fuse_test = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether fuse is new enough" >&5 $as_echo_n "checking whether fuse is new enough... " >&6; } pkg-config --atleast-version=2.6.0 fuse >/dev/null 2>/dev/null if test $? != 0; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fuse_build=no else { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi fi fi if test $fuse_build = yes; then fuse_pkg_found=no if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fuse\""; } >&5 ($PKG_CONFIG --exists --print-errors "fuse") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBFUSE" >&5 $as_echo_n "checking for LIBFUSE... " >&6; } if test -n "$LIBFUSE_CFLAGS"; then pkg_cv_LIBFUSE_CFLAGS="$LIBFUSE_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fuse\""; } >&5 ($PKG_CONFIG --exists --print-errors "fuse") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBFUSE_CFLAGS=`$PKG_CONFIG --cflags "fuse" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$LIBFUSE_LIBS"; then pkg_cv_LIBFUSE_LIBS="$LIBFUSE_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fuse\""; } >&5 ($PKG_CONFIG --exists --print-errors "fuse") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBFUSE_LIBS=`$PKG_CONFIG --libs "fuse" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then LIBFUSE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "fuse" 2>&1` else LIBFUSE_PKG_ERRORS=`$PKG_CONFIG --print-errors "fuse" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$LIBFUSE_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (fuse) were not met: $LIBFUSE_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables LIBFUSE_CFLAGS and LIBFUSE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " "$LINENO" 5 elif test $pkg_failed = untried; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables LIBFUSE_CFLAGS and LIBFUSE_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else LIBFUSE_CFLAGS=$pkg_cv_LIBFUSE_CFLAGS LIBFUSE_LIBS=$pkg_cv_LIBFUSE_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fuse_pkg_found=yes fi fi if test "$fuse_pkg_found" = "yes" -o "$run_fuse_test" = "no"; then $as_echo "#define HAVE_LIBFUSE 1" >>confdefs.h CPPFLAGS="$CPPFLAGS $LIBFUSE_CFLAGS" FUSELIBS="$LIBFUSE_LIBS" install_fuse=yes install_scriptcomps="$install_scriptcomps mountavfs umountavfs" else fuse_build=no fi fi have_liblzma=no use_liblzma=no # Check whether --with-xz was given. if test "${with_xz+set}" = set; then : withval=$with_xz; ac_cv_use_xz=$withval else ac_cv_use_xz=yes fi if test "$ac_cv_use_xz" = "yes" -o "$ac_cv_use_xz" = "force"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"liblzma\""; } >&5 ($PKG_CONFIG --exists --print-errors "liblzma") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBLZMA" >&5 $as_echo_n "checking for LIBLZMA... " >&6; } if test -n "$LIBLZMA_CFLAGS"; then pkg_cv_LIBLZMA_CFLAGS="$LIBLZMA_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"liblzma\""; } >&5 ($PKG_CONFIG --exists --print-errors "liblzma") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBLZMA_CFLAGS=`$PKG_CONFIG --cflags "liblzma" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$LIBLZMA_LIBS"; then pkg_cv_LIBLZMA_LIBS="$LIBLZMA_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"liblzma\""; } >&5 ($PKG_CONFIG --exists --print-errors "liblzma") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBLZMA_LIBS=`$PKG_CONFIG --libs "liblzma" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then LIBLZMA_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "liblzma" 2>&1` else LIBLZMA_PKG_ERRORS=`$PKG_CONFIG --print-errors "liblzma" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$LIBLZMA_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (liblzma) were not met: $LIBLZMA_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables LIBLZMA_CFLAGS and LIBLZMA_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " "$LINENO" 5 elif test $pkg_failed = untried; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables LIBLZMA_CFLAGS and LIBLZMA_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else LIBLZMA_CFLAGS=$pkg_cv_LIBLZMA_CFLAGS LIBLZMA_LIBS=$pkg_cv_LIBLZMA_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } have_liblzma=yes fi fi if test "$have_liblzma" = "yes" -o "$ac_cv_use_xz" = "force"; then $as_echo "#define HAVE_LIBLZMA 1" >>confdefs.h CPPFLAGS="$CPPFLAGS $LIBLZMA_CFLAGS" LIBS="$LIBS $LIBLZMA_LIBS" use_liblzma=yes fi fi have_libzstd=no use_libzstd=no # Check whether --with-zstd was given. if test "${with_zstd+set}" = set; then : withval=$with_zstd; ac_cv_use_zstd=$withval else ac_cv_use_zstd=yes fi if test "$ac_cv_use_zstd" = "yes"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libzstd\""; } >&5 ($PKG_CONFIG --exists --print-errors "libzstd") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LIBZSTD" >&5 $as_echo_n "checking for LIBZSTD... " >&6; } if test -n "$LIBZSTD_CFLAGS"; then pkg_cv_LIBZSTD_CFLAGS="$LIBZSTD_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libzstd\""; } >&5 ($PKG_CONFIG --exists --print-errors "libzstd") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBZSTD_CFLAGS=`$PKG_CONFIG --cflags "libzstd" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$LIBZSTD_LIBS"; then pkg_cv_LIBZSTD_LIBS="$LIBZSTD_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libzstd\""; } >&5 ($PKG_CONFIG --exists --print-errors "libzstd") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_LIBZSTD_LIBS=`$PKG_CONFIG --libs "libzstd" 2>/dev/null` else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then LIBZSTD_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors "libzstd" 2>&1` else LIBZSTD_PKG_ERRORS=`$PKG_CONFIG --print-errors "libzstd" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$LIBZSTD_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (libzstd) were not met: $LIBZSTD_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables LIBZSTD_CFLAGS and LIBZSTD_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. " "$LINENO" 5 elif test $pkg_failed = untried; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables LIBZSTD_CFLAGS and LIBZSTD_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else LIBZSTD_CFLAGS=$pkg_cv_LIBZSTD_CFLAGS LIBZSTD_LIBS=$pkg_cv_LIBZSTD_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } have_libzstd=yes fi fi if test "$have_libzstd" = "yes"; then $as_echo "#define HAVE_LIBZSTD 1" >>confdefs.h CPPFLAGS="$CPPFLAGS $LIBZSTD_CFLAGS" LIBS="$LIBS $LIBZSTD_LIBS" use_libzstd=yes fi fi use_liblzip=no # Check whether --with-lzip was given. if test "${with_lzip+set}" = set; then : withval=$with_lzip; ac_cv_use_lzip=$withval else ac_cv_use_lzip=yes fi if test "$ac_cv_use_lzip" = "yes"; then for ac_header in lzlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "lzlib.h" "ac_cv_header_lzlib_h" "$ac_includes_default" if test "x$ac_cv_header_lzlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_LZLIB_H 1 _ACEOF { $as_echo "$as_me:${as_lineno-$LINENO}: checking for LZ_decompress_open in -llz" >&5 $as_echo_n "checking for LZ_decompress_open in -llz... " >&6; } if ${ac_cv_lib_lz_LZ_decompress_open+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-llz $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char LZ_decompress_open (); int main () { return LZ_decompress_open (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_lz_LZ_decompress_open=yes else ac_cv_lib_lz_LZ_decompress_open=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lz_LZ_decompress_open" >&5 $as_echo "$ac_cv_lib_lz_LZ_decompress_open" >&6; } if test "x$ac_cv_lib_lz_LZ_decompress_open" = xyes; then : LIBS="$LIBS -llz" $as_echo "#define HAVE_LIBLZIP 1" >>confdefs.h use_liblzip=yes fi fi done fi if test x$use_liblzma = xyes; then USE_LIBLZMA_TRUE= USE_LIBLZMA_FALSE='#' else USE_LIBLZMA_TRUE='#' USE_LIBLZMA_FALSE= fi if test x$use_libzstd = xyes; then USE_LIBZSTD_TRUE= USE_LIBZSTD_FALSE='#' else USE_LIBZSTD_TRUE='#' USE_LIBZSTD_FALSE= fi if test x$use_liblzip = xyes; then USE_LIBLZIP_TRUE= USE_LIBLZIP_FALSE='#' else USE_LIBLZIP_TRUE='#' USE_LIBLZIP_FALSE= fi if test x$install_fuse = xyes; then INSTALL_FUSE_TRUE= INSTALL_FUSE_FALSE='#' else INSTALL_FUSE_TRUE='#' INSTALL_FUSE_FALSE= fi if test $shared_build = yes; then install_scriptcomps="$install_scriptcomps avfs-config" fi if test x$shared_build = xyes; then BUILD_SHARED_TRUE= BUILD_SHARED_FALSE='#' else BUILD_SHARED_TRUE='#' BUILD_SHARED_FALSE= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the linker ($LD) supports symbol versioning" >&5 $as_echo_n "checking whether the linker ($LD) supports symbol versioning... " >&6; } ld_versionscript=no if test "$ld_shlibs" = yes -a "$enable_shared" = yes; then if test "$with_gnu_ld" = yes; then if test -n "`$LD --help 2>/dev/null | grep version-script`"; then ld_versionscript=yes VERSIONSCRIPT_OPTS="-Wl,--version-script=\$(srcdir)/libavfs.map" fi else case $host_os in solaris*|sunos4*) if test -n "`$LD --help 2>&1 | grep "M mapfile"`"; then ld_versionscript=yes VERSIONSCRIPT_OPTS="-Wl,-M,\$(srcdir)/libavfs.map" fi ;; *) ;; esac fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_versionscript" >&5 $as_echo "$ld_versionscript" >&6; } ac_config_files="$ac_config_files pkgconfig/avfs.pc" ac_config_files="$ac_config_files Makefile src/Makefile modules/Makefile zlib/Makefile bzlib/Makefile lib/Makefile include/Makefile extfs/Makefile scripts/Makefile test/Makefile spec/Makefile macros/Makefile patch/Makefile doc/Makefile fuse/Makefile pkgconfig/Makefile scripts/avfs-config extfs/a extfs/apt extfs/audio extfs/deb extfs/deba extfs/debd extfs/dpkg extfs/hp48 extfs/iso9660 extfs/lslR extfs/mailfs extfs/patchfs extfs/rpms extfs/u7z extfs/uace extfs/uar extfs/uarj extfs/uc1541 extfs/uha extfs/ulha extfs/upp extfs/uextrar extfs/uxdms extfs/uxpk extfs/uzip extfs/uzoo include/version.h" ac_config_commands="$ac_config_commands default" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes: double-quote # substitution turns \\\\ into \\, and sed turns \\ into \. sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then if test "x$cache_file" != "x/dev/null"; then { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 $as_echo "$as_me: updating cache $cache_file" >&6;} if test ! -f "$cache_file" || test -h "$cache_file"; then cat confcache >"$cache_file" else case $cache_file in #( */* | ?:*) mv -f confcache "$cache_file"$$ && mv -f "$cache_file"$$ "$cache_file" ;; #( *) mv -f confcache "$cache_file" ;; esac fi fi else { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 $as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' DEFS=-DHAVE_CONFIG_H ac_libobjs= ac_ltlibobjs= U= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`$as_echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5 $as_echo_n "checking that generated files are newer than configure... " >&6; } if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5 $as_echo "done" >&6; } if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= fi if test -z "${USE_SYSTEM_ZLIB_TRUE}" && test -z "${USE_SYSTEM_ZLIB_FALSE}"; then as_fn_error $? "conditional \"USE_SYSTEM_ZLIB\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_SYSTEM_BZLIB_TRUE}" && test -z "${USE_SYSTEM_BZLIB_FALSE}"; then as_fn_error $? "conditional \"USE_SYSTEM_BZLIB\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then as_fn_error $? "conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then as_fn_error $? "conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_DAVSUPPORT_TRUE}" && test -z "${BUILD_DAVSUPPORT_FALSE}"; then as_fn_error $? "conditional \"BUILD_DAVSUPPORT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_LIBLZMA_TRUE}" && test -z "${USE_LIBLZMA_FALSE}"; then as_fn_error $? "conditional \"USE_LIBLZMA\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_LIBZSTD_TRUE}" && test -z "${USE_LIBZSTD_FALSE}"; then as_fn_error $? "conditional \"USE_LIBZSTD\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${USE_LIBLZIP_TRUE}" && test -z "${USE_LIBLZIP_FALSE}"; then as_fn_error $? "conditional \"USE_LIBLZIP\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${INSTALL_FUSE_TRUE}" && test -z "${INSTALL_FUSE_FALSE}"; then as_fn_error $? "conditional \"INSTALL_FUSE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${BUILD_SHARED_TRUE}" && test -z "${BUILD_SHARED_FALSE}"; then as_fn_error $? "conditional \"BUILD_SHARED\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi : "${CONFIG_STATUS=./config.status}" ac_write_fail=0 ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 $as_echo "$as_me: creating $CONFIG_STATUS" >&6;} as_write_fail=0 cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 ## -------------------- ## ## M4sh Initialization. ## ## -------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : emulate sh NULLCMD=: # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in #( *posix*) : set -o posix ;; #( *) : ;; esac fi as_nl=' ' export as_nl # Printing a long string crashes Solaris 7 /usr/bin/printf. as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo # Prefer a ksh shell builtin over an external printf program on Solaris, # but without wasting forks for bash or zsh. if test -z "$BASH_VERSION$ZSH_VERSION" \ && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='print -r --' as_echo_n='print -rn --' elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then as_echo='printf %s\n' as_echo_n='printf %s' else if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' as_echo_n='/usr/ucb/echo -n' else as_echo_body='eval expr "X$1" : "X\\(.*\\)"' as_echo_n_body='eval arg=$1; case $arg in #( *"$as_nl"*) expr "X$arg" : "X\\(.*\\)$as_nl"; arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; esac; expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" ' export as_echo_n_body as_echo_n='sh -c $as_echo_n_body as_echo' fi export as_echo_body as_echo='sh -c $as_echo_body as_echo' fi # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then PATH_SEPARATOR=: (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || PATH_SEPARATOR=';' } fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. as_myself= case $0 in #(( *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 exit 1 fi # Unset variables that we do not need and which cause bugs (e.g. in # pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" # suppresses any "Segmentation fault" message there. '((' could # trigger a bug in pdksh 5.2.14. for as_var in BASH_ENV ENV MAIL MAILPATH do eval test x\${$as_var+set} = xset \ && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. LC_ALL=C export LC_ALL LANGUAGE=C export LANGUAGE # CDPATH. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH # as_fn_error STATUS ERROR [LINENO LOG_FD] # ---------------------------------------- # Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are # provided, also output the error to LOG_FD, referencing LINENO. Then exit the # script with STATUS, using 1 if that was 0. as_fn_error () { as_status=$1; test $as_status -eq 0 && as_status=1 if test "$4"; then as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 fi $as_echo "$as_me: error: $2" >&2 as_fn_exit $as_status } # as_fn_error # as_fn_set_status STATUS # ----------------------- # Set $? to STATUS, without forking. as_fn_set_status () { return $1 } # as_fn_set_status # as_fn_exit STATUS # ----------------- # Exit the shell with STATUS, even in a "trap 0" or "set -e" context. as_fn_exit () { set +e as_fn_set_status $1 exit $1 } # as_fn_exit # as_fn_unset VAR # --------------- # Portably unset VAR. as_fn_unset () { { eval $1=; unset $1;} } as_unset=as_fn_unset # as_fn_append VAR VALUE # ---------------------- # Append the text in VALUE to the end of the definition contained in VAR. Take # advantage of any shell optimizations that allow amortized linear growth over # repeated appends, instead of the typical quadratic growth present in naive # implementations. if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : eval 'as_fn_append () { eval $1+=\$2 }' else as_fn_append () { eval $1=\$$1\$2 } fi # as_fn_append # as_fn_arith ARG... # ------------------ # Perform arithmetic evaluation on the ARGs, and store the result in the # global $as_val. Take advantage of shells that can avoid forks. The arguments # must be portable across $(()) and expr. if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : eval 'as_fn_arith () { as_val=$(( $* )) }' else as_fn_arith () { as_val=`expr "$@" || test $? -eq 1` } fi # as_fn_arith if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in #((((( -n*) case `echo 'xy\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. xy) ECHO_C='\c';; *) echo `echo ksh88 bug on AIX 6.1` > /dev/null ECHO_T=' ';; esac;; *) ECHO_N='-n';; esac rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir 2>/dev/null fi if (echo >conf$$.file) 2>/dev/null; then if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -pR'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -pR' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -pR' fi else as_ln_s='cp -pR' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null # as_fn_mkdir_p # ------------- # Create "$as_dir" as a directory, including parents if necessary. as_fn_mkdir_p () { case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || eval $as_mkdir_p || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" } # as_fn_mkdir_p if mkdir -p . 2>/dev/null; then as_mkdir_p='mkdir -p "$as_dir"' else test -d ./-p && rmdir ./-p as_mkdir_p=false fi # as_fn_executable_p FILE # ----------------------- # Test if FILE is an executable regular file. as_fn_executable_p () { test -f "$1" && test -x "$1" } # as_fn_executable_p as_test_x='test -x' as_executable_p=as_fn_executable_p # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 ## ----------------------------------- ## ## Main body of $CONFIG_STATUS script. ## ## ----------------------------------- ## _ASEOF test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Save the log message, to keep $0 and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by avfs $as_me 1.1.4, which was generated by GNU Autoconf 2.69. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF case $ac_config_files in *" "*) set x $ac_config_files; shift; ac_config_files=$*;; esac case $ac_config_headers in *" "*) set x $ac_config_headers; shift; ac_config_headers=$*;; esac cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # Files that config.status was made for. config_files="$ac_config_files" config_headers="$ac_config_headers" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 ac_cs_usage="\ \`$as_me' instantiates files and other configuration actions from templates according to the current configuration. Unless the files and actions are specified as TAGs, all are instantiated by default. Usage: $0 [OPTION]... [TAG]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit --config print configuration, then exit -q, --quiet, --silent do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE --header=FILE[:TEMPLATE] instantiate the configuration header FILE Configuration files: $config_files Configuration headers: $config_headers Configuration commands: $config_commands Report bugs to the package provider." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ avfs config.status 1.1.4 configured by $0, generated by GNU Autoconf 2.69, with options \\"\$ac_cs_config\\" Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' AWK='$AWK' test -n "\$AWK" || AWK=awk _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # The default lists apply if the user does not specify any file. ac_need_defaults=: while test $# != 0 do case $1 in --*=?*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; --*=) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg= ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) $as_echo "$ac_cs_version"; exit ;; --config | --confi | --conf | --con | --co | --c ) $as_echo "$ac_cs_config"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; '') as_fn_error $? "missing file argument" ;; esac as_fn_append CONFIG_FILES " '$ac_optarg'" ac_need_defaults=false;; --header | --heade | --head | --hea ) $ac_shift case $ac_optarg in *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; esac as_fn_append CONFIG_HEADERS " '$ac_optarg'" ac_need_defaults=false;; --he | --h) # Conflict between --help and --header as_fn_error $? "ambiguous option: \`$1' Try \`$0 --help' for more information.";; --help | --hel | -h ) $as_echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) as_fn_error $? "unrecognized option: \`$1' Try \`$0 --help' for more information." ;; *) as_fn_append ac_config_targets " $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 if \$ac_cs_recheck; then set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion shift \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 CONFIG_SHELL='$SHELL' export CONFIG_SHELL exec "\$@" fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX $as_echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' shared_archive_member_spec='`$ECHO "$shared_archive_member_spec" | $SED "$delay_single_quote_subst"`' SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`' host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_import='`$ECHO "$lt_cv_sys_global_symbol_to_import" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' lt_cv_nm_interface='`$ECHO "$lt_cv_nm_interface" | $SED "$delay_single_quote_subst"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' lt_cv_truncate_bin='`$ECHO "$lt_cv_truncate_bin" | $SED "$delay_single_quote_subst"`' objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' configure_time_dlsearch_path='`$ECHO "$configure_time_dlsearch_path" | $SED "$delay_single_quote_subst"`' configure_time_lt_sys_library_path='`$ECHO "$configure_time_lt_sys_library_path" | $SED "$delay_single_quote_subst"`' hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$1 _LTECHO_EOF' } # Quote evaled strings. for var in SHELL \ ECHO \ PATH_SEPARATOR \ SED \ GREP \ EGREP \ FGREP \ LD \ NM \ LN_S \ lt_SP2NL \ lt_NL2SP \ reload_flag \ OBJDUMP \ deplibs_check_method \ file_magic_cmd \ file_magic_glob \ want_nocaseglob \ DLLTOOL \ sharedlib_from_linklib_cmd \ AR \ AR_FLAGS \ archiver_list_spec \ STRIP \ RANLIB \ CC \ CFLAGS \ compiler \ lt_cv_sys_global_symbol_pipe \ lt_cv_sys_global_symbol_to_cdecl \ lt_cv_sys_global_symbol_to_import \ lt_cv_sys_global_symbol_to_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ lt_cv_nm_interface \ nm_file_list_spec \ lt_cv_truncate_bin \ lt_prog_compiler_no_builtin_flag \ lt_prog_compiler_pic \ lt_prog_compiler_wl \ lt_prog_compiler_static \ lt_cv_prog_compiler_c_o \ need_locks \ MANIFEST_TOOL \ DSYMUTIL \ NMEDIT \ LIPO \ OTOOL \ OTOOL64 \ shrext_cmds \ export_dynamic_flag_spec \ whole_archive_flag_spec \ compiler_needs_object \ with_gnu_ld \ allow_undefined_flag \ no_undefined_flag \ hardcode_libdir_flag_spec \ hardcode_libdir_separator \ exclude_expsyms \ include_expsyms \ file_list_spec \ variables_saved_for_relink \ libname_spec \ library_names_spec \ soname_spec \ install_override_mode \ finish_eval \ old_striplib \ striplib; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in reload_cmds \ old_postinstall_cmds \ old_postuninstall_cmds \ old_archive_cmds \ extract_expsyms_cmds \ old_archive_from_new_cmds \ old_archive_from_expsyms_cmds \ archive_cmds \ archive_expsym_cmds \ module_cmds \ module_expsym_cmds \ export_symbols_cmds \ prelink_cmds \ postlink_cmds \ postinstall_cmds \ postuninstall_cmds \ finish_cmds \ sys_lib_search_path_spec \ configure_time_dlsearch_path \ configure_time_lt_sys_library_path; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "include/config.h") CONFIG_HEADERS="$CONFIG_HEADERS include/config.h:config.h.in" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; "pkgconfig/avfs.pc") CONFIG_FILES="$CONFIG_FILES pkgconfig/avfs.pc" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "modules/Makefile") CONFIG_FILES="$CONFIG_FILES modules/Makefile" ;; "zlib/Makefile") CONFIG_FILES="$CONFIG_FILES zlib/Makefile" ;; "bzlib/Makefile") CONFIG_FILES="$CONFIG_FILES bzlib/Makefile" ;; "lib/Makefile") CONFIG_FILES="$CONFIG_FILES lib/Makefile" ;; "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; "extfs/Makefile") CONFIG_FILES="$CONFIG_FILES extfs/Makefile" ;; "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;; "test/Makefile") CONFIG_FILES="$CONFIG_FILES test/Makefile" ;; "spec/Makefile") CONFIG_FILES="$CONFIG_FILES spec/Makefile" ;; "macros/Makefile") CONFIG_FILES="$CONFIG_FILES macros/Makefile" ;; "patch/Makefile") CONFIG_FILES="$CONFIG_FILES patch/Makefile" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "fuse/Makefile") CONFIG_FILES="$CONFIG_FILES fuse/Makefile" ;; "pkgconfig/Makefile") CONFIG_FILES="$CONFIG_FILES pkgconfig/Makefile" ;; "scripts/avfs-config") CONFIG_FILES="$CONFIG_FILES scripts/avfs-config" ;; "extfs/a") CONFIG_FILES="$CONFIG_FILES extfs/a" ;; "extfs/apt") CONFIG_FILES="$CONFIG_FILES extfs/apt" ;; "extfs/audio") CONFIG_FILES="$CONFIG_FILES extfs/audio" ;; "extfs/deb") CONFIG_FILES="$CONFIG_FILES extfs/deb" ;; "extfs/deba") CONFIG_FILES="$CONFIG_FILES extfs/deba" ;; "extfs/debd") CONFIG_FILES="$CONFIG_FILES extfs/debd" ;; "extfs/dpkg") CONFIG_FILES="$CONFIG_FILES extfs/dpkg" ;; "extfs/hp48") CONFIG_FILES="$CONFIG_FILES extfs/hp48" ;; "extfs/iso9660") CONFIG_FILES="$CONFIG_FILES extfs/iso9660" ;; "extfs/lslR") CONFIG_FILES="$CONFIG_FILES extfs/lslR" ;; "extfs/mailfs") CONFIG_FILES="$CONFIG_FILES extfs/mailfs" ;; "extfs/patchfs") CONFIG_FILES="$CONFIG_FILES extfs/patchfs" ;; "extfs/rpms") CONFIG_FILES="$CONFIG_FILES extfs/rpms" ;; "extfs/u7z") CONFIG_FILES="$CONFIG_FILES extfs/u7z" ;; "extfs/uace") CONFIG_FILES="$CONFIG_FILES extfs/uace" ;; "extfs/uar") CONFIG_FILES="$CONFIG_FILES extfs/uar" ;; "extfs/uarj") CONFIG_FILES="$CONFIG_FILES extfs/uarj" ;; "extfs/uc1541") CONFIG_FILES="$CONFIG_FILES extfs/uc1541" ;; "extfs/uha") CONFIG_FILES="$CONFIG_FILES extfs/uha" ;; "extfs/ulha") CONFIG_FILES="$CONFIG_FILES extfs/ulha" ;; "extfs/upp") CONFIG_FILES="$CONFIG_FILES extfs/upp" ;; "extfs/uextrar") CONFIG_FILES="$CONFIG_FILES extfs/uextrar" ;; "extfs/uxdms") CONFIG_FILES="$CONFIG_FILES extfs/uxdms" ;; "extfs/uxpk") CONFIG_FILES="$CONFIG_FILES extfs/uxpk" ;; "extfs/uzip") CONFIG_FILES="$CONFIG_FILES extfs/uzip" ;; "extfs/uzoo") CONFIG_FILES="$CONFIG_FILES extfs/uzoo" ;; "include/version.h") CONFIG_FILES="$CONFIG_FILES include/version.h" ;; "default") CONFIG_COMMANDS="$CONFIG_COMMANDS default" ;; *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= ac_tmp= trap 'exit_status=$? : "${ac_tmp:=$tmp}" { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status ' 0 trap 'as_fn_exit 1' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 ac_tmp=$tmp # Set up the scripts for CONFIG_FILES section. # No need to generate them if there are no CONFIG_FILES. # This happens for instance with `./config.status config.h'. if test -n "$CONFIG_FILES"; then ac_cr=`echo X | tr X '\015'` # On cygwin, bash can eat \r inside `` if the user requested igncr. # But we know of no other shell where ac_cr would be empty at this # point, so we can use a bashism as a fallback. if test "x$ac_cr" = x; then eval ac_cr=\$\'\\r\' fi ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then ac_cs_awk_cr='\\r' else ac_cs_awk_cr=$ac_cr fi echo 'BEGIN {' >"$ac_tmp/subs1.awk" && _ACEOF { echo "cat >conf$$subs.awk <<_ACEOF" && echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && echo "_ACEOF" } >conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` ac_delim='%!_!# ' for ac_last_try in false false false false false :; do . ./conf$$subs.sh || as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` if test $ac_delim_n = $ac_delim_num; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done rm -f conf$$subs.sh cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && _ACEOF sed -n ' h s/^/S["/; s/!.*/"]=/ p g s/^[^!]*!// :repl t repl s/'"$ac_delim"'$// t delim :nl h s/\(.\{148\}\)..*/\1/ t more1 s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ p n b repl :more1 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t nl :delim h s/\(.\{148\}\)..*/\1/ t more2 s/["\\]/\\&/g; s/^/"/; s/$/"/ p b :more2 s/["\\]/\\&/g; s/^/"/; s/$/"\\/ p g s/.\{148\}// t delim ' >$CONFIG_STATUS || ac_write_fail=1 rm -f conf$$subs.awk cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 _ACAWK cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && for (key in S) S_is_set[key] = 1 FS = "" } { line = $ 0 nfields = split(line, field, "@") substed = 0 len = length(field[1]) for (i = 2; i < nfields; i++) { key = field[i] keylen = length(key) if (S_is_set[key]) { value = S[key] line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) len += length(value) + length(field[++i]) substed = 1 } else len += 1 + keylen } print line } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" else cat fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 _ACEOF # VPATH may cause trouble with some makes, so we remove sole $(srcdir), # ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ h s/// s/^/:/ s/[ ]*$/:/ s/:\$(srcdir):/:/g s/:\${srcdir}:/:/g s/:@srcdir@:/:/g s/^:*// s/:*$// x s/\(=[ ]*\).*/\1/ G s/\n// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 fi # test -n "$CONFIG_FILES" # Set up the scripts for CONFIG_HEADERS section. # No need to generate them if there are no CONFIG_HEADERS. # This happens for instance with `./config.status Makefile'. if test -n "$CONFIG_HEADERS"; then cat >"$ac_tmp/defines.awk" <<\_ACAWK || BEGIN { _ACEOF # Transform confdefs.h into an awk script `defines.awk', embedded as # here-document in config.status, that substitutes the proper values into # config.h.in to produce config.h. # Create a delimiter string that does not exist in confdefs.h, to ease # handling of long lines. ac_delim='%!_!# ' for ac_last_try in false false :; do ac_tt=`sed -n "/$ac_delim/p" confdefs.h` if test -z "$ac_tt"; then break elif $ac_last_try; then as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done # For the awk script, D is an array of macro values keyed by name, # likewise P contains macro parameters if any. Preserve backslash # newline sequences. ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* sed -n ' s/.\{148\}/&'"$ac_delim"'/g t rset :rset s/^[ ]*#[ ]*define[ ][ ]*/ / t def d :def s/\\$// t bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3"/p s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p d :bsnl s/["\\]/\\&/g s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ D["\1"]=" \3\\\\\\n"\\/p t cont s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p t cont d :cont n s/.\{148\}/&'"$ac_delim"'/g t clear :clear s/\\$// t bsnlc s/["\\]/\\&/g; s/^/"/; s/$/"/p d :bsnlc s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p b cont ' >$CONFIG_STATUS || ac_write_fail=1 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 for (key in D) D_is_set[key] = 1 FS = "" } /^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { line = \$ 0 split(line, arg, " ") if (arg[1] == "#") { defundef = arg[2] mac1 = arg[3] } else { defundef = substr(arg[1], 2) mac1 = arg[2] } split(mac1, mac2, "(") #) macro = mac2[1] prefix = substr(line, 1, index(line, defundef) - 1) if (D_is_set[macro]) { # Preserve the white space surrounding the "#". print prefix "define", macro P[macro] D[macro] next } else { # Replace #undef with comments. This is necessary, for example, # in the case of _POSIX_SOURCE, which is predefined and required # on some systems where configure will not decide to define it. if (defundef == "undef") { print "/*", prefix defundef, macro, "*/" next } } } { print } _ACAWK _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 fi # test -n "$CONFIG_HEADERS" eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :C $CONFIG_COMMANDS" shift for ac_tag do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$ac_tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; esac case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac as_fn_append ac_file_inputs " '$ac_f'" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input='Generated from '` $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' `' by configure.' if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 $as_echo "$as_me: creating $ac_file" >&6;} fi # Neutralize special characters interpreted by sed in replacement strings. case $configure_input in #( *\&* | *\|* | *\\* ) ac_sed_conf_input=`$as_echo "$configure_input" | sed 's/[\\\\&|]/\\\\&/g'`;; #( *) ac_sed_conf_input=$configure_input;; esac case $ac_tag in *:-:* | *:-) cat >"$ac_tmp/stdin" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir="$ac_dir"; as_fn_mkdir_p ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= ac_sed_dataroot=' /datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p' case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 $as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_sed_extra="$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s|@configure_input@|$ac_sed_conf_input|;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@top_build_prefix@&$ac_top_build_prefix&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ "$ac_tmp/out"`; test -z "$ac_out"; } && { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&5 $as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined" >&2;} rm -f "$ac_tmp/stdin" case $ac_file in -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; esac \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; :H) # # CONFIG_HEADER # if test x"$ac_file" != x-; then { $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" } >"$ac_tmp/config.h" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 $as_echo "$as_me: $ac_file is unchanged" >&6;} else rm -f "$ac_file" mv "$ac_tmp/config.h" "$ac_file" \ || as_fn_error $? "could not create $ac_file" "$LINENO" 5 fi else $as_echo "/* $configure_input */" \ && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ || as_fn_error $? "could not create -" "$LINENO" 5 fi # Compute "$ac_file"'s index in $config_headers. _am_arg="$ac_file" _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || $as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$_am_arg" : 'X\(//\)[^/]' \| \ X"$_am_arg" : 'X\(//\)$' \| \ X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$_am_arg" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'`/stamp-h$_am_stamp_count ;; :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 $as_echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || { # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. case $CONFIG_FILES in #( *\'*) : eval set x "$CONFIG_FILES" ;; #( *) : set x $CONFIG_FILES ;; #( *) : ;; esac shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`$as_echo "$am_mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`$as_dirname -- "$am_mf" || $as_expr X"$am_mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$am_mf" : 'X\(//\)[^/]' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$am_mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` am_filepart=`$as_basename -- "$am_mf" || $as_expr X/"$am_mf" : '.*/\([^/][^/]*\)/*$' \| \ X"$am_mf" : 'X\(//\)$' \| \ X"$am_mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X/"$am_mf" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` { echo "$as_me:$LINENO: cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles" >&5 (cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles) >&5 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } || am_rc=$? done if test $am_rc -ne 0; then { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE=\"gmake\" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking). See \`config.log' for more details" "$LINENO" 5; } fi { am_dirpart=; unset am_dirpart;} { am_filepart=; unset am_filepart;} { am_mf=; unset am_mf;} { am_rc=; unset am_rc;} rm -f conftest-deps.mk } ;; "libtool":C) # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . # The names of the tagged configurations supported by this script. available_tags='' # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # Shared archive member basename,for filename based shared library versioning on AIX. shared_archive_member_spec=$shared_archive_member_spec # Shell to use when invoking shell scripts. SHELL=$lt_SHELL # An echo program that protects backslashes. ECHO=$lt_ECHO # The PATH separator for the build system. PATH_SEPARATOR=$lt_PATH_SEPARATOR # The host system. host_alias=$host_alias host=$host host_os=$host_os # The build system. build_alias=$build_alias build=$build build_os=$build_os # A sed program that does not truncate output. SED=$lt_SED # Sed that helps us avoid accidentally triggering echo(1) options like -n. Xsed="\$SED -e 1s/^X//" # A grep program that handles long lines. GREP=$lt_GREP # An ERE matcher. EGREP=$lt_EGREP # A literal string matcher. FGREP=$lt_FGREP # A BSD- or MS-compatible name lister. NM=$lt_NM # Whether we need soft or hard links. LN_S=$lt_LN_S # What is the maximum length of a command? max_cmd_len=$max_cmd_len # Object file suffix (normally "o"). objext=$ac_objext # Executable file suffix (normally ""). exeext=$exeext # whether the shell understands "unset". lt_unset=$lt_unset # turn spaces into newlines. SP2NL=$lt_lt_SP2NL # turn newlines into spaces. NL2SP=$lt_lt_NL2SP # convert \$build file names to \$host format. to_host_file_cmd=$lt_cv_to_host_file_cmd # convert \$build files to toolchain format. to_tool_file_cmd=$lt_cv_to_tool_file_cmd # An object symbol dumper. OBJDUMP=$lt_OBJDUMP # Method to check whether dependent libraries are shared objects. deplibs_check_method=$lt_deplibs_check_method # Command to use when deplibs_check_method = "file_magic". file_magic_cmd=$lt_file_magic_cmd # How to find potential files when deplibs_check_method = "file_magic". file_magic_glob=$lt_file_magic_glob # Find potential files using nocaseglob when deplibs_check_method = "file_magic". want_nocaseglob=$lt_want_nocaseglob # DLL creation program. DLLTOOL=$lt_DLLTOOL # Command to associate shared and link libraries. sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd # The archiver. AR=$lt_AR # Flags to create an archive. AR_FLAGS=$lt_AR_FLAGS # How to feed a file listing to the archiver. archiver_list_spec=$lt_archiver_list_spec # A symbol stripping program. STRIP=$lt_STRIP # Commands used to install an old-style archive. RANLIB=$lt_RANLIB old_postinstall_cmds=$lt_old_postinstall_cmds old_postuninstall_cmds=$lt_old_postuninstall_cmds # Whether to use a lock for old archive extraction. lock_old_archive_extraction=$lock_old_archive_extraction # A C compiler. LTCC=$lt_CC # LTCC compiler flags. LTCFLAGS=$lt_CFLAGS # Take the output of nm and produce a listing of raw symbols and C names. global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe # Transform the output of nm in a proper C declaration. global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl # Transform the output of nm into a list of symbols to manually relocate. global_symbol_to_import=$lt_lt_cv_sys_global_symbol_to_import # Transform the output of nm in a C name address pair. global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address # Transform the output of nm in a C name address pair when lib prefix is needed. global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix # The name lister interface. nm_interface=$lt_lt_cv_nm_interface # Specify filename containing input files for \$NM. nm_file_list_spec=$lt_nm_file_list_spec # The root where to search for dependent libraries,and where our libraries should be installed. lt_sysroot=$lt_sysroot # Command to truncate a binary pipe. lt_truncate_bin=$lt_lt_cv_truncate_bin # The name of the directory that contains temporary libtool files. objdir=$objdir # Used to examine libraries when file_magic_cmd begins with "file". MAGIC_CMD=$MAGIC_CMD # Must we lock files when doing compilation? need_locks=$lt_need_locks # Manifest tool. MANIFEST_TOOL=$lt_MANIFEST_TOOL # Tool to manipulate archived DWARF debug symbol files on Mac OS X. DSYMUTIL=$lt_DSYMUTIL # Tool to change global to local symbols on Mac OS X. NMEDIT=$lt_NMEDIT # Tool to manipulate fat objects and archives on Mac OS X. LIPO=$lt_LIPO # ldd/readelf like tool for Mach-O binaries on Mac OS X. OTOOL=$lt_OTOOL # ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. OTOOL64=$lt_OTOOL64 # Old archive suffix (normally "a"). libext=$libext # Shared library suffix (normally ".so"). shrext_cmds=$lt_shrext_cmds # The commands to extract the exported symbol list from a shared archive. extract_expsyms_cmds=$lt_extract_expsyms_cmds # Variables whose values should be saved in libtool wrapper scripts and # restored at link time. variables_saved_for_relink=$lt_variables_saved_for_relink # Do we need the "lib" prefix for modules? need_lib_prefix=$need_lib_prefix # Do we need a version for libraries? need_version=$need_version # Library versioning type. version_type=$version_type # Shared library runtime path variable. runpath_var=$runpath_var # Shared library path variable. shlibpath_var=$shlibpath_var # Is shlibpath searched before the hard-coded library search path? shlibpath_overrides_runpath=$shlibpath_overrides_runpath # Format of library name prefix. libname_spec=$lt_libname_spec # List of archive names. First name is the real one, the rest are links. # The last name is the one that the linker finds with -lNAME library_names_spec=$lt_library_names_spec # The coded name of the library, if different from the real name. soname_spec=$lt_soname_spec # Permission mode override for installation of shared libraries. install_override_mode=$lt_install_override_mode # Command to use after installation of a shared archive. postinstall_cmds=$lt_postinstall_cmds # Command to use after uninstallation of a shared archive. postuninstall_cmds=$lt_postuninstall_cmds # Commands used to finish a libtool library installation in a directory. finish_cmds=$lt_finish_cmds # As "finish_cmds", except a single script fragment to be evaled but # not shown. finish_eval=$lt_finish_eval # Whether we should hardcode library paths into libraries. hardcode_into_libs=$hardcode_into_libs # Compile-time system search path for libraries. sys_lib_search_path_spec=$lt_sys_lib_search_path_spec # Detected run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_configure_time_dlsearch_path # Explicit LT_SYS_LIBRARY_PATH set during ./configure time. configure_time_lt_sys_library_path=$lt_configure_time_lt_sys_library_path # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # How to create reloadable object files. reload_flag=$lt_reload_flag reload_cmds=$lt_reload_cmds # Commands used to build an old-style archive. old_archive_cmds=$lt_old_archive_cmds # A language specific compiler. CC=$lt_compiler # Is the compiler the GNU compiler? with_gcc=$GCC # Compiler flag to turn off builtin functions. no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag # Additional compiler flags for building library objects. pic_flag=$lt_lt_prog_compiler_pic # How to pass a linker flag through the compiler. wl=$lt_lt_prog_compiler_wl # Compiler flag to prevent dynamic linking. link_static_flag=$lt_lt_prog_compiler_static # Does compiler simultaneously support -c and -o options? compiler_c_o=$lt_lt_cv_prog_compiler_c_o # Whether or not to add -lc for building shared libraries. build_libtool_need_lc=$archive_cmds_need_lc # Whether or not to disallow shared libs when runtime libs are static. allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes # Compiler flag to allow reflexive dlopens. export_dynamic_flag_spec=$lt_export_dynamic_flag_spec # Compiler flag to generate shared objects directly from archives. whole_archive_flag_spec=$lt_whole_archive_flag_spec # Whether the compiler copes with passing no objects directly. compiler_needs_object=$lt_compiler_needs_object # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$lt_old_archive_from_new_cmds # Create a temporary old-style archive to link instead of a shared archive. old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds # Commands used to build a shared archive. archive_cmds=$lt_archive_cmds archive_expsym_cmds=$lt_archive_expsym_cmds # Commands used to build a loadable module if different from building # a shared archive. module_cmds=$lt_module_cmds module_expsym_cmds=$lt_module_expsym_cmds # Whether we are building with GNU ld or not. with_gnu_ld=$lt_with_gnu_ld # Flag that allows shared libraries with undefined symbols to be built. allow_undefined_flag=$lt_allow_undefined_flag # Flag that enforces no undefined symbols. no_undefined_flag=$lt_no_undefined_flag # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec # Whether we need a single "-rpath" flag with a separated argument. hardcode_libdir_separator=$lt_hardcode_libdir_separator # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary. hardcode_direct=$hardcode_direct # Set to "yes" if using DIR/libNAME\$shared_ext during linking hardcodes # DIR into the resulting binary and the resulting library dependency is # "absolute",i.e impossible to change by setting \$shlibpath_var if the # library is relocated. hardcode_direct_absolute=$hardcode_direct_absolute # Set to "yes" if using the -LDIR flag during linking hardcodes DIR # into the resulting binary. hardcode_minus_L=$hardcode_minus_L # Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR # into the resulting binary. hardcode_shlibpath_var=$hardcode_shlibpath_var # Set to "yes" if building a shared library automatically hardcodes DIR # into the library and all subsequent libraries and executables linked # against it. hardcode_automatic=$hardcode_automatic # Set to yes if linker adds runtime paths of dependent libraries # to runtime path list. inherit_rpath=$inherit_rpath # Whether libtool must link a program against all its dependency libraries. link_all_deplibs=$link_all_deplibs # Set to "yes" if exported symbols are required. always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$lt_export_symbols_cmds # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$lt_exclude_expsyms # Symbols that must always be exported. include_expsyms=$lt_include_expsyms # Commands necessary for linking programs (against libraries) with templates. prelink_cmds=$lt_prelink_cmds # Commands necessary for finishing linking programs. postlink_cmds=$lt_postlink_cmds # Specify filename containing input files. file_list_spec=$lt_file_list_spec # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE # func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x$2 in x) ;; *:) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\" ;; x:*) eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\" ;; *::*) eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\" ;; *) eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\" ;; esac } # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in $*""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain=$ac_aux_dir/ltmain.sh # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ;; "default":C) chmod +x scripts/avfs-config ;; esac done # for ac_tag as_fn_exit 0 _ACEOF ac_clean_files=$ac_clean_files_save test $ac_write_fail = 0 || as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || as_fn_exit 1 fi if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi echo "" echo "Configuration details:" if test "$shared_build" = "yes"; then echo " Building library : yes" else echo " Building library : no" fi if test "$fuse_build" = "yes"; then echo " Building avfsd for fuse : yes" else echo " Building avfsd for fuse : no" fi echo "" if test "x$use_system_zlib" = "xyes"; then echo " Use zlib : system (not recommended, slower random access)" else echo " Use zlib : internal (recommended, faster random access)" fi if test "x$use_system_bzlib" = "xyes"; then echo " Use bzlib : system (not recommended, slower random access)" else echo " Use bzlib : internal (recommended, faster random access)" fi if test "x$use_liblzma" = "xyes"; then echo " Use liblzma : yes" else echo " Use liblzma : no" fi if test "x$use_libzstd" = "xyes"; then echo " Use libzstd : yes" else echo " Use libzstd : no" fi if test "x$dav" = "xyes" -a "x$neon_found" = "xyes"; then echo " WebDAV support : yes" else echo " WebDAV support : no" fi if test "x$use_liblzip" = "xyes"; then echo " Use liblzip : yes" else echo " Use liblzip : no" fi echo "" echo " Installation prefix : $prefix" echo "" avfs-1.1.4/pkgconfig/0000755000175000001440000000000014032341025011412 500000000000000avfs-1.1.4/pkgconfig/Makefile.in0000644000175000001440000003545714032341013013412 00000000000000# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = pkgconfig ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = avfs.pc CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(pkgconfigdir)" DATA = $(pkgconfig_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/avfs.pc.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BZLIB_INCLUDE = @BZLIB_INCLUDE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAV = @DAV@ DAV_LS = @DAV_LS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FUSELIBS = @FUSELIBS@ GREP = @GREP@ HAVE_ZIPINFO = @HAVE_ZIPINFO@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ LIBZSTD_LIBS = @LIBZSTD_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NUMVERSION = @NUMVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ ZIP = @ZIP@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_INCLUDE = @ZLIB_INCLUDE@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = avfs.pc.in pkgconfig_DATA = avfs.pc all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu pkgconfig/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu pkgconfig/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): avfs.pc: $(top_builddir)/config.status $(srcdir)/avfs.pc.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-pkgconfigDATA: $(pkgconfig_DATA) @$(NORMAL_INSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(pkgconfigdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ done uninstall-pkgconfigDATA: @$(NORMAL_UNINSTALL) @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(pkgconfigdir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(DATA) installdirs: for dir in "$(DESTDIR)$(pkgconfigdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-pkgconfigDATA install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-pkgconfigDATA .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkgconfigDATA install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ ps ps-am tags-am uninstall uninstall-am \ uninstall-pkgconfigDATA .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: avfs-1.1.4/pkgconfig/avfs.pc.in0000644000175000001440000000035014032341001013212 00000000000000prefix=@prefix@ exec_prefix=@exec_prefix@ libdir=@libdir@ includedir=@includedir@ Name: avfs Description: AVFS virtual file system Version: @VERSION@ Libs: -L${libdir} -lavfs Libs.private: @LIBS@ Cflags: -I${includedir} @CPPFLAGS@ avfs-1.1.4/pkgconfig/Makefile.am0000644000175000001440000000012014032341001013351 00000000000000EXTRA_DIST = avfs.pc.in pkgconfigdir = @pkgconfigdir@ pkgconfig_DATA = avfs.pc avfs-1.1.4/src/0000755000175000001440000000000014032341025010232 500000000000000avfs-1.1.4/src/passwords.c0000644000175000001440000001343214032341001012340 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ /* Taken from FTP code, and renamed. Can be used more-or-less verbatim in DAV and HTTP code. Reuse in FTP code will require noting that the ftpdata struct is not passed in; instead the sessions member is used. Also FTP code will need to pass in NULL for "realm" arguments. TODO: more fine-grained locking */ #include "remote.h" #include "filebuf.h" #include "passwords.h" #include #include #include #include #include #include #include static AV_LOCK_DECL(pass_lock); static struct pass_session *pass_find_session(struct pass_session *passd, const char *account) { struct pass_session *fts; if (passd == NULL) { return NULL; } for(fts = passd->next; fts != NULL && fts != passd; fts = fts->next) { av_log(AVLOG_DEBUG, "passwords: lookup '%s' == '%s'", account, fts->account); if(fts->account != NULL && strcmp(account, fts->account) == 0) return fts; } return NULL; } static struct pass_session *pass_get_session(struct pass_session *passd, const char *account) { struct pass_session *fts; if (passd == NULL) { return NULL; } fts = pass_find_session(passd, account); if(fts == NULL) { struct pass_session *next; struct pass_session *prev; AV_NEW(fts); fts->account = av_strdup(account); fts->password = NULL; fts->next = next = passd->next; fts->prev = prev = passd; if (next != NULL) { next->prev = fts; } prev->next = fts; } return fts; } void pass_remove_session(struct pass_session *fts) { struct pass_session *next = fts->next; struct pass_session *prev = fts->prev; next->prev = prev; prev->next = next; av_free(fts->account); av_free(fts->password); av_free(fts); } struct pass_session *pass_get_password(struct pass_session *passd, const char *host, const char *user) { struct pass_session *fts = NULL; char *account; if (passd == NULL) { return NULL; } if (fts == NULL) { account = av_stradd(NULL, user, USER_SEP_STR, host, NULL); fts = pass_find_session(passd, account); av_free(account); } if(fts == NULL) { account = av_stradd(NULL, user, USER_SEP_STR, NULL); fts = pass_find_session(passd, account); av_free(account); } if(fts == NULL) { account = av_stradd(NULL, USER_SEP_STR, host, NULL); fts = pass_find_session(passd, account); av_free(account); } av_log(AVLOG_DEBUG, "passwords: fts=%lx", (long) fts); return fts; } int pass_username_get(struct entry *ent, const char *param, char **resp) { *resp = av_strdup(""); return 0; } int pass_username_set(struct entry *ent, const char *param, const char *val) { struct pass_session *fts; struct statefile *sf = (struct statefile *) av_namespace_get(ent); struct pass_session *passd = (struct pass_session *) sf->data; unsigned int len; AV_LOCK(pass_lock); fts = pass_get_session(passd, param); av_log(AVLOG_DEBUG, "passwords: setting username '%s' %s'", param, val); av_free(fts->username); fts->username = av_strdup(val); len = strlen(fts->username); if(fts->username[len - 1] == '\n') fts->username[len - 1] = '\0'; AV_UNLOCK(pass_lock); return 0; } int pass_password_get(struct entry *ent, const char *param, char **resp) { *resp = av_strdup(""); return 0; } int pass_password_set(struct entry *ent, const char *param, const char *val) { struct pass_session *fts; struct statefile *sf = (struct statefile *) av_namespace_get(ent); struct pass_session *passd = (struct pass_session *) sf->data; unsigned int len; AV_LOCK(pass_lock); fts = pass_get_session(passd, param); /* av_log(AVLOG_DEBUG, "passwords: setting password '%s' %s'", * param, val);*/ av_free(fts->password); fts->password = av_strdup(val); len = strlen(fts->password); if(fts->password[len - 1] == '\n') fts->password[len - 1] = '\0'; AV_UNLOCK(pass_lock); return 0; } int pass_loggedin_get(struct entry *ent, const char *param, char **resp) { struct pass_session *fts; struct statefile *sf = (struct statefile *) av_namespace_get(ent); struct pass_session *passd = (struct pass_session *) sf->data; AV_LOCK(pass_lock); fts = pass_find_session(passd, param); if(fts == NULL) *resp = av_strdup("0\n"); else *resp = av_strdup("1\n"); AV_UNLOCK(pass_lock); return 0; } static int pass_loggedin_val(const char *val, int *resp) { char *end; int ival; ival = strtol(val, &end, 10); if(end == val) return -EINVAL; if(*end == '\n') end++; if(*end != '\0') return -EINVAL; if(ival < 0 || ival > 1) return -EINVAL; *resp = ival; return 0; } int pass_loggedin_set(struct entry *ent, const char *param, const char *val) { int res; struct pass_session *fts; struct statefile *sf = (struct statefile *) av_namespace_get(ent); struct pass_session *passd = (struct pass_session *) sf->data; AV_LOCK(pass_lock); fts = pass_find_session(passd, param); if(fts == NULL) res = -EACCES; else { int ival; res = pass_loggedin_val(val, &ival); if(res == 0 && ival == 0) { /* FIXME: end connections using this session */ pass_remove_session(fts); } } AV_UNLOCK(pass_lock); return res; } // vim:sw=4: avfs-1.1.4/src/filtprog.c0000644000175000001440000001642014032341001012141 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "filtprog.h" #include "filebuf.h" #include "prog.h" #include "oper.h" #include #include struct filtprog { vfile *vf; struct filtdata *filtdat; }; #define cbufsize 16384 struct filtconn { struct filtprog *fp; struct filebuf *fbs[3]; struct proginfo pri; int cbufat; int cbuflen; char cbuf[cbufsize]; }; static int filtprog_fill_cbuf(struct filtconn *fc) { avssize_t res; res = av_read(fc->fp->vf, fc->cbuf, cbufsize); if(res < 0) return res; if(res == 0) { av_unref_obj(fc->fbs[0]); fc->fbs[0] = NULL; } else { fc->cbuflen = res; fc->cbufat = 0; } return 0; } static int filtprog_check_error(struct filtconn *fc) { char *line; int res; int gotsome = 0; do { res = av_filebuf_readline(fc->fbs[2], &line); if(res < 0) return res; if(res == 1) { av_log(AVLOG_ERROR, "%s stderr: %s", fc->fp->filtdat->prog[0], line); av_free(line); gotsome = 1; } } while(res == 1); return gotsome; } static int filtprog_write_input(struct filtconn *fc) { int res; if(fc->cbuflen == 0) { res = filtprog_fill_cbuf(fc); if(res < 0) return res; if(fc->fbs[0] == NULL) return 0; } res = av_filebuf_write(fc->fbs[0], fc->cbuf + fc->cbufat, fc->cbuflen); if(res < 0) return res; fc->cbufat += res; fc->cbuflen -= res; return 0; } static avssize_t filtprog_read(void *data, char *buf, avsize_t nbyte) { avssize_t res; struct filtconn *fc = (struct filtconn *) data; while(1) { res = filtprog_check_error(fc); if(res < 0) return res; if(res == 0) { res = av_filebuf_read(fc->fbs[1], buf, nbyte); if(res != 0) return res; if(av_filebuf_eof(fc->fbs[1])) { res = av_wait_prog(&fc->pri, 0, 0); if(res < 0) return res; return 0; } if(fc->fbs[0] != NULL) { res = filtprog_write_input(fc); if(res < 0) return res; } } res = av_filebuf_check(fc->fbs, 3, -1); if(res < 0) return res; } } static int filtprog_read_input(struct filtconn *fc) { avssize_t res; res = av_filebuf_read(fc->fbs[1], fc->cbuf + fc->cbufat, cbufsize - fc->cbufat); if(res > 0) { fc->cbufat += res; if(fc->cbufat == cbufsize) { res = av_write(fc->fp->vf, fc->cbuf, fc->cbufat); fc->cbufat = 0; } } return res; } static avssize_t filtprog_write(void *data, const char *buf, avsize_t nbyte) { avssize_t res; struct filtconn *fc = (struct filtconn *) data; while(1) { res = filtprog_check_error(fc); if(res < 0) return res; if(res == 0) { res = av_filebuf_write(fc->fbs[0], buf, nbyte); if(res != 0) return res; res = filtprog_read_input(fc); if(res < 0) return res; } res = av_filebuf_check(fc->fbs, 3, -1); if(res < 0) return res; } } static int filtprog_endput(void *data) { int res; struct filtconn *fc = (struct filtconn *) data; av_unref_obj(fc->fbs[0]); fc->fbs[0] = NULL; while(1) { res = filtprog_check_error(fc); if(res < 0) return res; if(res == 0) { res = filtprog_read_input(fc); if(res < 0) return res; if(av_filebuf_eof(fc->fbs[1])) break; } res = av_filebuf_check(fc->fbs, 3, -1); if(res < 0) return res; } res = av_write(fc->fp->vf, fc->cbuf, fc->cbufat); if(res < 0) return res; res = av_wait_prog(&fc->pri, 0, 0); if(res < 0) return res; return 0; } static void filtprog_stop(struct filtconn *fc) { av_unref_obj(fc->fbs[0]); av_unref_obj(fc->fbs[1]); av_unref_obj(fc->fbs[2]); av_wait_prog(&fc->pri, 1, 0); av_lseek(fc->fp->vf, 0, AVSEEK_SET); } static int filtprog_init_pipes(int pipein[2], int pipeout[2], int pipeerr[2]) { int res; pipein[0] = -1, pipein[1] = -1; pipeout[0] = -1, pipeout[1] = -1; pipeerr[0] = -1, pipeerr[1] = -1; if(pipe(pipein) == -1 || pipe(pipeout) == -1 || pipe(pipeerr) == -1) { res = -errno; close(pipein[0]), close(pipein[1]); close(pipeout[0]), close(pipeout[1]); return res; } av_registerfd(pipein[1]); av_registerfd(pipeout[0]); av_registerfd(pipeerr[0]); return 0; } static int filtprog_start(struct filtprog *fp, char **prog, struct filtconn **resp) { struct filtconn *fc; int res; int pipein[2]; int pipeout[2]; int pipeerr[2]; struct proginfo pri; res = filtprog_init_pipes(pipein, pipeout, pipeerr); if(res < 0) return res; av_init_proginfo(&pri); pri.prog = (const char **) prog; pri.ifd = pipein[0]; pri.ofd = pipeout[1]; pri.efd = pipeerr[1]; res = av_start_prog(&pri); close(pri.ifd); close(pri.ofd); close(pri.efd); if(res < 0) { close(pipein[1]); close(pipeout[0]); close(pipeerr[0]); return res; } AV_NEW_OBJ(fc, filtprog_stop); fc->fp = fp; fc->fbs[0] = av_filebuf_new(pipein[1], FILEBUF_NONBLOCK | FILEBUF_WRITE); fc->fbs[1] = av_filebuf_new(pipeout[0], FILEBUF_NONBLOCK); fc->fbs[2] = av_filebuf_new(pipeerr[0], FILEBUF_NONBLOCK); fc->pri = pri; fc->cbufat = 0; fc->cbuflen = 0; *resp = fc; return 0; } static int filtprog_startget(void *data, void **resp) { int res; struct filtprog *fp = (struct filtprog *) data; struct filtconn *fc; res = filtprog_start(fp, fp->filtdat->prog, &fc); if(res < 0) return res; *resp = fc; return 0; } static int filtprog_startput(void *data, void **resp) { int res; struct filtprog *fp = (struct filtprog *) data; struct filtconn *fc; res = av_ftruncate(fp->vf, 0); if(res < 0) return res; res = filtprog_start(fp, fp->filtdat->revprog, &fc); if(res < 0) return res; *resp = fc; return 0; } struct sfile *av_filtprog_new(vfile *vf, struct filtdata *filtdat) { struct filtprog *fp; struct sfile *sf; static const struct sfilefuncs func = { filtprog_startget, filtprog_read, filtprog_startput, filtprog_write, filtprog_endput }; AV_NEW_OBJ(fp, NULL); fp->vf = vf; fp->filtdat = filtdat; sf = av_sfile_new(&func, fp, 0); return sf; } void av_filtprog_change(struct sfile *sf, vfile *newvf) { struct filtprog *fp = (struct filtprog *) av_sfile_getdata(sf); fp->vf = newvf; } avfs-1.1.4/src/runprog.c0000644000175000001440000001122714032341001012007 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "runprog.h" #include "prog.h" #include "filebuf.h" #include #include struct program { char **prog; struct proginfo pri; struct filebuf *fbs[2]; }; static char **copy_prog(const char **prog) { unsigned int len; unsigned int i; const char **p; char **cp; for(len = 0, p = prog; *p != NULL; p++, len++); cp = av_malloc(sizeof(*cp) * (len + 1)); for(i = 0; i < len; i++) cp[i] = av_strdup(prog[i]); cp[len] = NULL; return cp; } static void free_prog(char **prog) { unsigned int i; for(i = 0; prog[i] != NULL; i++) av_free(prog[i]); av_free(prog); } static void program_delete(struct program *pr) { av_wait_prog(&pr->pri, 1, 0); free_prog(pr->prog); av_unref_obj(pr->fbs[0]); av_unref_obj(pr->fbs[1]); } int av_start_program(const char **prog, struct program **resp) { int res; int pipeout[2]; int pipeerr[2]; struct program *pr; pipeout[0] = -1; pipeout[1] = -1; if(pipe(pipeout) == -1 || pipe(pipeerr) == -1) { res = -errno; av_log(AVLOG_ERROR, "RUNPROG: unable to create pipe: %s", strerror(errno)); close(pipeout[0]); close(pipeout[1]); return res; } av_registerfd(pipeout[0]); av_registerfd(pipeerr[0]); AV_NEW_OBJ(pr, program_delete); av_init_proginfo(&pr->pri); pr->fbs[0] = NULL; pr->fbs[1] = NULL; pr->prog = copy_prog(prog); pr->pri.prog = (const char **) pr->prog; pr->pri.ifd = open("/dev/null", O_RDONLY); if(pr->pri.ifd == -1) { res = -errno; av_log(AVLOG_ERROR, "RUNPROG: unable to open '/dev/null': %s", strerror(errno)); close(pipeout[0]); close(pipeout[1]); close(pipeerr[0]); close(pipeerr[1]); av_unref_obj(pr); return res; } pr->pri.ofd = pipeout[1]; pr->pri.efd = pipeerr[1]; res = av_start_prog(&pr->pri); close(pr->pri.ifd); close(pr->pri.ofd); close(pr->pri.efd); if(res < 0) { close(pipeout[0]); close(pipeerr[0]); av_unref_obj(pr); return res; } pr->fbs[0] = av_filebuf_new(pipeout[0], FILEBUF_NONBLOCK); pr->fbs[1] = av_filebuf_new(pipeerr[0], FILEBUF_NONBLOCK); *resp = pr; return 0; } static int flush_error(struct program *pr) { int res; char *line; while((res = av_filebuf_readline(pr->fbs[1], &line)) == 1) { av_log(AVLOG_WARNING, "%s: stderr: %s", pr->pri.prog[0], line); av_free(line); } return res; } static int flush_output(struct program *pr) { int res; char *line; while((res = av_filebuf_readline(pr->fbs[0], &line)) == 1) { av_log(AVLOG_WARNING, "%s: stdout: %s", pr->pri.prog[0], line); av_free(line); } return res; } int av_program_getline(struct program *pr, char **linep, long timeoutms) { int res; char *line; *linep = NULL; while(1) { res = flush_error(pr); if(res < 0) return res; res = av_filebuf_readline(pr->fbs[0], &line); if(res < 0) return res; if(res == 1) break; if(av_filebuf_eof(pr->fbs[0]) && av_filebuf_eof(pr->fbs[1])) { res = av_wait_prog(&pr->pri, 0, 0); if(res < 0) return res; return 1; } res = av_filebuf_check(pr->fbs, 2, timeoutms); if(res <= 0) return res; } *linep = line; return 1; } int av_program_log_output(struct program *pr) { int res; res = av_wait_prog(&pr->pri, 0, 1); if(res < 0) return res; if(res == 1) return 0; return 1; } static int av_process_program(struct program *pr) { int res; while(!av_filebuf_eof(pr->fbs[0]) || !av_filebuf_eof(pr->fbs[1])) { res = av_filebuf_check(pr->fbs, 2, 0); if(res < 0) return res; if(res == 1) { res = flush_error(pr); if(res < 0) return res; res = flush_output(pr); if(res < 0) return res; } } res = av_wait_prog(&pr->pri, 0, 0); if(res < 0) return res; return 0; } int av_run_program(const char **prog) { int res; struct program *pr; res = av_start_program(prog, &pr); if(res < 0) return res; res = av_process_program(pr); av_unref_obj(pr); return res; } avfs-1.1.4/src/zstdread.c0000644000175000001440000001772214032341001012141 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2018 Ralf Hoffmann This program can be distributed under the terms of the GNU GPL. See the file COPYING. based on bzread.c */ #include "config.h" #include "zstdfile.h" #include "zstd.h" #include "oper.h" #include "exit.h" #include #include #include // we use smaller buffer size than recommened to save memory since we // may have a lot of objects alive #define INBUFSIZE 16384 #define OUTBUFSIZE 32768 static int zstdread_nextid; static AV_LOCK_DECL(zstdread_lock); struct zstdcache { int id; avoff_t size; }; struct zstdfile { ZSTD_DStream *s; int iseof; int iserror; int id; /* The id of the last used zstdcache */ vfile *infile; char inbuf[INBUFSIZE]; avoff_t total_in; avoff_t total_out; ZSTD_inBuffer inBuffer; ZSTD_outBuffer outBuffer; }; static void zstd_delete_stream(ZSTD_DStream *s) { if(s != NULL) { size_t res = ZSTD_freeDStream(s); if (ZSTD_isError(res)) { av_log(AVLOG_ERROR, "ZSTD: error during stream destroy"); } } } static int zstd_new_stream(ZSTD_DStream **resp) { int res; ZSTD_DStream *s; s = ZSTD_createDStream(); if(s == NULL) { *resp = NULL; av_log(AVLOG_ERROR, "ZSTD: could not create decompress stream"); return -EIO; } res = ZSTD_initDStream(s); if (ZSTD_isError(res)) { ZSTD_freeDStream(s); *resp = NULL; av_log(AVLOG_ERROR, "ZSTD: decompress init error: %s", ZSTD_getErrorName(res)); return -EIO; } *resp = s; return 0; } static int zstdfile_reset(struct zstdfile *fil) { zstd_delete_stream(fil->s); fil->iseof = 0; fil->iserror = 0; fil->total_in = fil->total_out = 0; memset( &fil->inBuffer, 0, sizeof( fil->inBuffer ) ); return zstd_new_stream(&fil->s); } static int zstdfile_fill_inbuf(struct zstdfile *fil) { avssize_t res; if (fil->inBuffer.size > 0 && fil->inBuffer.pos > 0) { // there are some remaining bytes from previous calls fil->total_in += fil->inBuffer.size; if (fil->inBuffer.pos == fil->inBuffer.size) { fil->inBuffer.pos = fil->inBuffer.size = 0; } else { memmove(fil->inbuf, fil->inbuf + fil->inBuffer.pos, fil->inBuffer.size - fil->inBuffer.pos); fil->inBuffer.size -= fil->inBuffer.pos; fil->inBuffer.pos = 0; } } res = av_pread(fil->infile, fil->inbuf + fil->inBuffer.size, INBUFSIZE - fil->inBuffer.size, fil->total_in); if(res < 0) return res; fil->inBuffer.src = fil->inbuf; fil->inBuffer.size += res; fil->inBuffer.pos = 0; return 0; } static int zstdfile_decompress(struct zstdfile *fil, struct zstdcache *zc) { int res; if (fil->outBuffer.size == 0) return 0; for (;;) { if(fil->inBuffer.pos == fil->inBuffer.size) { res = zstdfile_fill_inbuf(fil); if(res < 0) return res; if(fil->inBuffer.size == 0) { /* still no byte available */ av_log(AVLOG_ERROR, "ZSTD: decompress error"); return -EIO; } } size_t old_out_pos = fil->outBuffer.pos; size_t r = ZSTD_decompressStream(fil->s, &fil->outBuffer, &fil->inBuffer); if (ZSTD_isError(r)) { av_log(AVLOG_ERROR, "ZSTD: decompress error"); return -EIO; } fil->total_out += fil->outBuffer.pos - old_out_pos; if (r == 0) { //TODO docs are not clear if this really indicates end of file. fil->iseof = 1; AV_LOCK(zstdread_lock); zc->size = fil->total_out; AV_UNLOCK(zstdread_lock); break; } if (fil->outBuffer.pos == fil->outBuffer.size) { // everything we are requested for is available break; } } return 0; } static int zstdfile_read(struct zstdfile *fil, struct zstdcache *zc, char *buf, avsize_t nbyte) { int res; int sum = 0; while (nbyte > 0 && !fil->iseof) { fil->outBuffer.dst = buf; fil->outBuffer.size = nbyte; fil->outBuffer.pos = 0; res = zstdfile_decompress(fil, zc); if(res < 0) return res; if (fil->outBuffer.pos == 0) { fil->iseof = 1; } else { buf += fil->outBuffer.pos; nbyte -= fil->outBuffer.pos; sum += fil->outBuffer.pos; } } return sum; } static int zstdfile_skip_to(struct zstdfile *fil, struct zstdcache *zc, avoff_t offset) { int res; uint8_t outbuf[OUTBUFSIZE]; while(!fil->iseof) { avoff_t curroff = fil->total_out; if(curroff == offset) break; fil->outBuffer.dst = outbuf; fil->outBuffer.size = AV_MIN(OUTBUFSIZE, offset - curroff);; fil->outBuffer.pos = 0; res = zstdfile_decompress(fil, zc); if(res < 0) return res; if (fil->outBuffer.pos == 0) { fil->iseof = 1; } } return 0; } static avssize_t av_zstdfile_do_pread(struct zstdfile *fil, struct zstdcache *zc, char *buf, avsize_t nbyte, avoff_t offset) { avssize_t res; avoff_t curroff; fil->id = zc->id; curroff = fil->total_out; if(offset != curroff) { AV_LOCK(zstdread_lock); if ( curroff > offset ) { res = zstdfile_reset( fil ); } else { res = 0; } AV_UNLOCK(zstdread_lock); if(res < 0) return res; res = zstdfile_skip_to(fil, zc, offset); if(res < 0) return res; } res = zstdfile_read(fil, zc, buf, nbyte); return res; } avssize_t av_zstdfile_pread(struct zstdfile *fil, struct zstdcache *zc, char *buf, avsize_t nbyte, avoff_t offset) { avssize_t res; if(fil->iserror) return -EIO; res = av_zstdfile_do_pread(fil, zc, buf, nbyte, offset); if(res < 0) fil->iserror = 1; return res; } int av_zstdfile_size(struct zstdfile *fil, struct zstdcache *zc, avoff_t *sizep) { int res; avoff_t size; AV_LOCK(zstdread_lock); size = zc->size; AV_UNLOCK(zstdread_lock); if(size != -1 || fil == NULL) { *sizep = size; return 0; } fil->id = zc->id; AV_LOCK(zstdread_lock); res = zstdfile_reset( fil ); AV_UNLOCK(zstdread_lock); if(res < 0) return res; res = zstdfile_skip_to(fil, zc, AV_MAXOFF); if(res < 0) return res; AV_LOCK(zstdread_lock); size = zc->size; AV_UNLOCK(zstdread_lock); if(size == -1) { av_log(AVLOG_ERROR, "ZSTD: Internal error: could not find size"); return -EIO; } *sizep = size; return 0; } static void zstdfile_destroy(struct zstdfile *fil) { AV_LOCK(zstdread_lock); zstd_delete_stream(fil->s); AV_UNLOCK(zstdread_lock); } struct zstdfile *av_zstdfile_new(vfile *vf) { int res; struct zstdfile *fil; AV_NEW_OBJ(fil, zstdfile_destroy); fil->iseof = 0; fil->iserror = 0; fil->infile = vf; fil->id = 0; fil->total_in = fil->total_out = 0; memset( &fil->inBuffer, 0, sizeof( fil->inBuffer ) ); res = zstd_new_stream(&fil->s); if(res < 0) fil->iserror = 1; return fil; } static void zstdcache_destroy(struct zstdcache *zc) { } struct zstdcache *av_zstdcache_new() { struct zstdcache *zc; AV_NEW_OBJ(zc, zstdcache_destroy); zc->size = -1; AV_LOCK(zstdread_lock); if(zstdread_nextid == 0) zstdread_nextid = 1; zc->id = zstdread_nextid ++; AV_UNLOCK(zstdread_lock); return zc; } avfs-1.1.4/src/mod_static.h0000644000175000001440000000037314032341001012446 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" void av_init_static_modules(); avfs-1.1.4/src/ugid.c0000644000175000001440000001066614032341001011251 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" #include "config.h" #include #include #include #include #define NAMLEN 256 struct ugidcache { int uid; char *uname; int myuid; int gid; char *gname; int mygid; }; static void free_ugidcache(struct ugidcache *cache) { av_free(cache->uname); av_free(cache->gname); } struct ugidcache *av_new_ugidcache() { struct ugidcache *cache; AV_NEW_OBJ(cache, free_ugidcache); cache->uname = NULL; cache->myuid = getuid(); cache->gname = NULL; cache->mygid = getgid(); return cache; } char *av_finduname(struct ugidcache *cache, int uid, const char *deflt) { if(uid == -1) return av_strdup(deflt); if(cache->uname == NULL || uid != cache->uid) { int res; struct passwd pw; struct passwd *pwres; char *buf = NULL; size_t bufsize = 0; #ifdef HAVE_GETPWUID_R do { bufsize += 256; buf = av_realloc(buf, bufsize); res = getpwuid_r(uid, &pw, buf, bufsize, &pwres); } while(res == ERANGE); #else pwres = getpwuid(uid); #endif av_free(cache->uname); if(pwres == NULL) cache->uname = av_strdup(""); else cache->uname = av_strdup(pwres->pw_name); cache->uid = uid; #ifdef HAVE_GETPWUID_R av_free(buf); #endif } if(!cache->uname[0]) return av_strdup(deflt); else return av_strdup(cache->uname); } int av_finduid(struct ugidcache *cache, const char *uname, int deflt) { if(uname == NULL || !uname[0]) return deflt == -1 ? cache->myuid : deflt; if(cache->uname == NULL || strcmp(uname, cache->uname) != 0) { int res; struct passwd pw; struct passwd *pwres; char *buf = NULL; size_t bufsize = 0; #ifdef HAVE_GETPWNAM_R do { bufsize += 256; buf = av_realloc(buf, bufsize); res = getpwnam_r(uname, &pw, buf, bufsize, &pwres); } while(res == ERANGE); #else pwres = getpwnam(uname); #endif if(pwres == NULL) cache->uid = -1; else cache->uid = pwres->pw_uid; av_free(cache->uname); cache->uname = av_strdup(uname); #ifdef HAVE_GETPWNAM_R av_free(buf); #endif } if(cache->uid == -1) return deflt == -1 ? cache->myuid : deflt; else return cache->uid; } char *av_findgname(struct ugidcache *cache, int gid, const char *deflt) { if(gid == -1) return av_strdup(deflt); if(cache->gname == NULL || gid != cache->gid) { int res; struct group gr; struct group *grres; char *buf = NULL; size_t bufsize = 0; #ifdef HAVE_GETGRGID_R do { bufsize += 256; buf = av_realloc(buf, bufsize); res = getgrgid_r(gid, &gr, buf, bufsize, &grres); } while(res == ERANGE); #else grres = getgrgid(gid); #endif av_free(cache->gname); if(grres == NULL) cache->gname = av_strdup(""); else cache->gname = av_strdup(grres->gr_name); cache->gid = gid; #ifdef HAVE_GETGRGID_R av_free(buf); #endif } if(!cache->gname[0]) return av_strdup(deflt); else return av_strdup(cache->gname); } int av_findgid(struct ugidcache *cache, const char *gname, int deflt) { if(gname == NULL || !gname[0]) return deflt == -1 ? cache->mygid : deflt; if(cache->gname == NULL || strcmp(gname, cache->gname) != 0) { int res; struct group gr; struct group *grres; char *buf = NULL; size_t bufsize = 0; #ifdef HAVE_GETGRNAM_R do { bufsize += 256; buf = av_realloc(buf, bufsize); res = getgrnam_r(gname, &gr, buf, bufsize, &grres); } while(res == ERANGE); #else grres = getgrnam(gname); #endif if(grres == NULL) cache->gid = -1; else cache->gid = grres->gr_gid; av_free(cache->gname); cache->gname = av_strdup(gname); #ifdef HAVE_GETGRNAM_R av_free(buf); #endif } if(cache->gid == -1) return deflt == -1 ? cache->mygid : deflt; else return cache->gid; } avfs-1.1.4/src/remote.c0000644000175000001440000005426314032341001011615 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "remote.h" #include "version.h" #include "namespace.h" #include "cache.h" #include #include #include #define REM_ST_VALID 20 #define REM_DIR_VALID 10 struct remsig { avtimestruc_t modif; avoff_t size; }; struct rementry { char *name; int type; struct rementry *next; }; struct remdir { avtime_t valid; struct rementry *dirlist; }; struct remattr { avtime_t valid; int negative; struct avstat st; char *linkname; }; struct remfile { struct remsig sig; char *localname; void *data; }; struct remnode { avmutex lock; avmutex filelock; struct remnode *next; struct remnode *prev; struct entry *ent; avino_t ino; struct remattr attr; struct remdir dir; struct cacheobj *file; }; struct remfs { struct namespace *ns; struct remnode list; struct remote *rem; struct avfs *avfs; }; static AV_LOCK_DECL(rem_lock); static void rem_free_dir(struct remdir *dir) { struct rementry *re; while((re = dir->dirlist) != NULL) { dir->dirlist = re->next; av_free(re->name); av_free(re); } } static void rem_free_node(struct remnode *nod) { av_namespace_set(nod->ent, NULL); av_unref_obj(nod->ent); rem_free_dir(&nod->dir); av_free(nod->attr.linkname); av_unref_obj(nod->file); AV_FREELOCK(nod->lock); AV_FREELOCK(nod->filelock); } static struct remnode *rem_new_node(struct remfs *fs) { struct remnode *nod; AV_NEW_OBJ(nod, rem_free_node); AV_INITLOCK(nod->lock); AV_INITLOCK(nod->filelock); nod->ino = av_new_ino(fs->avfs); nod->attr.valid = 0; nod->attr.linkname = NULL; nod->dir.valid = 0; nod->file = NULL; return nod; } static void rem_remove_node(struct remnode *nod) { struct remnode *next = nod->next; struct remnode *prev = nod->prev; next->prev = prev; prev->next = next; } static void rem_insert_node(struct remfs *fs, struct remnode *nod) { struct remnode *next = fs->list.next; struct remnode *prev = &fs->list; next->prev = nod; prev->next = nod; nod->prev = prev; nod->next = next; } static struct remnode *rem_get_node(struct remfs *fs, struct entry *ent) { struct remnode *nod; AV_LOCK(rem_lock); nod = (struct remnode *) av_namespace_get(ent); if(nod != NULL) rem_remove_node(nod); else { nod = rem_new_node(fs); nod->ent = ent; av_namespace_set(ent, nod); if((fs->rem->flags & REM_NOCASE) != 0) av_namespace_setflags(ent, NSF_NOCASE, 0); av_ref_obj(ent); } rem_insert_node(fs, nod); av_ref_obj(nod); AV_UNLOCK(rem_lock); return nod; } static void rem_get_locked_node(struct remfs *fs, struct entry *ent, struct remnode **nodep, struct remnode **parentp) { struct remnode *nod; struct remnode *parent; struct entry *pent; pent = av_namespace_lookup(fs->ns, ent, NULL); if(pent != NULL) { parent = rem_get_node(fs, pent); av_unref_obj(pent); } else parent = NULL; nod = rem_get_node(fs, ent); if(parent != NULL) AV_LOCK(parent->lock); AV_LOCK(nod->lock); *nodep = nod; *parentp = parent; } static void rem_put_locked_node(struct remnode *nod, struct remnode *parent) { AV_UNLOCK(nod->lock); if(parent != NULL) AV_UNLOCK(parent->lock); av_unref_obj(nod); av_unref_obj(parent); } static void rem_free_dirlist(struct remdirlist *dl) { int i; for(i = 0; i < dl->num; i++) { av_free(dl->ents[i].name); av_free(dl->ents[i].linkname); } av_free(dl->ents); av_free(dl->hostpath.host); av_free(dl->hostpath.path); } static void rem_fill_attr(struct remfs *fs, struct remnode *nod, struct remdirent *de, avtime_t now) { struct remattr *attr = &nod->attr; attr->valid = now + REM_ST_VALID; attr->negative = 0; attr->st = de->attr; attr->st.ino = nod->ino; attr->st.dev = fs->avfs->dev; av_free(attr->linkname); attr->linkname = av_strdup(de->linkname); } static void rem_fill_root(struct remfs *fs, struct remnode *nod) { struct remattr *attr = &nod->attr; attr->valid = AV_MAXTIME; attr->negative = 0; attr->st.ino = nod->ino; attr->st.dev = fs->avfs->dev; attr->st.mode = AV_IFDIR | 0777; attr->st.nlink = 2; attr->st.uid = 0; attr->st.gid = 0; attr->st.size = 0; attr->st.blksize = 512; attr->st.blocks = 0; attr->st.atime.sec = 0; attr->st.atime.nsec = 0; attr->st.mtime = attr->st.atime; attr->st.ctime = attr->st.atime; } static int rem_list_single(struct remfs *fs, struct remnode *nod, struct remdirlist *dl) { int i; for(i = 0; i < dl->num; i++) { struct remdirent *de = &dl->ents[i]; if(strcmp(de->name, dl->hostpath.path) == 0) { rem_fill_attr(fs, nod, de, av_time()); return 0; } } return -ENOENT; } static void rem_dir_add(struct remdir *dir, struct remdirent *de) { struct rementry **rep; struct rementry *re; for(rep = &dir->dirlist; *rep != NULL; rep = &(*rep)->next); AV_NEW(re); re->name = av_strdup(de->name); re->type = AV_TYPE(de->attr.mode); re->next = NULL; *rep = re; } static void rem_dir_add_beg(struct remdir *dir, const char *name, int type) { struct rementry *re; AV_NEW(re); re->name = av_strdup(name); re->type = type; re->next = dir->dirlist; dir->dirlist = re; } static int rem_list_dir(struct remfs *fs, struct remnode *nod, struct remnode *child, struct remdirlist *dl, struct remnode *need) { int i; avtime_t now = av_time(); int found = 0; int gotdots = 0; rem_free_dir(&nod->dir); for(i = 0; i < dl->num; i++) { struct remdirent *de = &dl->ents[i]; rem_dir_add(&nod->dir, de); if(strcmp(de->name, ".") == 0) { rem_fill_attr(fs, nod, de, now); if(nod == need) found = 1; gotdots = 1; } else if(strcmp(de->name, "..") == 0) gotdots = 1; else { struct entry *cent; struct remnode *cnod; cent = av_namespace_lookup(fs->ns, nod->ent, de->name); cnod = rem_get_node(fs, cent); av_unref_obj(cent); if(cnod != child) { AV_LOCK(cnod->lock); rem_fill_attr(fs, cnod, de, now); AV_UNLOCK(cnod->lock); } else rem_fill_attr(fs, cnod, de, now); if(cnod == need) found = 1; av_unref_obj(cnod); } } if(!gotdots) { rem_dir_add_beg(&nod->dir, "..", AV_TYPE(AV_IFDIR)); rem_dir_add_beg(&nod->dir, ".", AV_TYPE(AV_IFDIR)); } nod->dir.valid = now + REM_DIR_VALID; if(found) return 0; else return -ENOENT; } static void rem_get_hostpath(struct entry *ent, struct remhostpath *hp) { char *hostpath = av_namespace_getpath(ent); char *s; s = strchr(hostpath, '/'); if(s == NULL) { hp->host = av_strdup(hostpath); hp->path = av_strdup("/"); } else { *s = '\0'; hp->host = av_strdup(hostpath); *s = '/'; hp->path = av_strdup(s); } av_free(hostpath); } static void rem_dir_only(struct remdirlist *dl) { if((dl->flags & REM_LIST_SINGLE) != 0) { char *dir = dl->hostpath.path; if(strcmp(dir, "/") == 0) dl->flags = 0; else { char *s; s = strrchr(dir, '/'); if(s == dir) s++; *s = '\0'; dl->flags = REM_LIST_PARENT; } } } static int rem_get_attr(struct remfs *fs, struct remnode *nod, struct remnode *parent) { int res; struct remote *rem = fs->rem; struct remdirlist dl; dl.flags = REM_LIST_SINGLE; dl.num = 0; dl.ents = NULL; rem_get_hostpath(nod->ent, &dl.hostpath); if((rem->flags & REM_DIR_ONLY) != 0) rem_dir_only(&dl); res = rem->list(rem, &dl); if(res == 0) { if((dl.flags & REM_LIST_SINGLE) != 0) res = rem_list_single(fs, nod, &dl); else if((dl.flags & REM_LIST_PARENT) != 0) res = rem_list_dir(fs, parent, nod, &dl, nod); else res = rem_list_dir(fs, nod, NULL, &dl, nod); /* It can happen, that the root directory cannot be listed */ if(parent == NULL && res == -ENOENT) { rem_fill_root(fs, nod); res = 0; } } rem_free_dirlist(&dl); if(res == -ENOENT) { nod->attr.valid = av_time() + REM_ST_VALID; nod->attr.negative = 1; } return res; } static int rem_check_node(struct remfs *fs, struct remnode *nod, struct remnode *parent) { int res; avtime_t now = av_time(); if(now < nod->attr.valid) { if(nod->attr.negative) res = -ENOENT; else res = 0; } else { nod->attr.valid = 0; res = rem_get_attr(fs, nod, parent); } return res; } static int rem_signature_valid(struct remsig *sig, struct avstat *stbuf) { if(sig->modif.sec != stbuf->mtime.sec || sig->modif.nsec != stbuf->mtime.nsec || sig->size != stbuf->size) return 0; else return 1; } static int rem_get_dir(struct remfs *fs, struct remnode *nod) { int res; struct remote *rem = fs->rem; struct remdirlist dl; dl.flags = 0; dl.num = 0; dl.ents = NULL; rem_get_hostpath(nod->ent, &dl.hostpath); res = rem->list(rem, &dl); if(res == 0) rem_list_dir(fs, nod, NULL, &dl, NULL); rem_free_dirlist(&dl); return res; } static int rem_check_dir(struct remfs *fs, struct remnode *nod) { int res; avtime_t now = av_time(); if(now < nod->dir.valid) res = 0; else res = rem_get_dir(fs, nod); return res; } static int rem_node_type(struct remfs *fs, struct entry *ent) { int res; struct remnode *nod; struct remnode *parent; rem_get_locked_node(fs, ent, &nod, &parent); if(nod->attr.valid != 0 && !nod->attr.negative) res = 0; else res = rem_check_node(fs, nod, parent); if(res == 0) res = AV_TYPE(nod->attr.st.mode); rem_put_locked_node(nod, parent); return res; } static struct entry *rem_ventry_entry(ventry *ve) { return (struct entry *) ve->data; } static struct entry *rem_vfile_entry(vfile *vf) { return (struct entry *) vf->data; } static struct remfs *rem_ventry_filesys(ventry *ve) { return (struct remfs *) ve->mnt->avfs->data; } static struct remfs *rem_vfile_filesys(vfile *vf) { return (struct remfs *) vf->mnt->avfs->data; } static int rem_lookup(ventry *ve, const char *name, void **newp) { int res; int type; struct entry *prev = rem_ventry_entry(ve); struct remfs *fs = rem_ventry_filesys(ve); struct entry *ent; if(prev != NULL) { res = rem_node_type(fs, prev); if(res < 0) return res; if(name != NULL && res != AV_TYPE(AV_IFDIR)) return -ENOTDIR; } ent = av_namespace_lookup_all(fs->ns, prev, name); if(ent == NULL) type = 0; else { type = rem_node_type(fs, ent); if(type < 0) { av_unref_obj(ent); return type; } } av_unref_obj(prev); *newp = ent; return type; } static int rem_getpath(ventry *ve, char **resp) { struct entry *ent = rem_ventry_entry(ve); *resp = av_namespace_getpath(ent); return 0; } static void rem_putent(ventry *ve) { struct entry *ent = rem_ventry_entry(ve); av_unref_obj(ent); } static int rem_copyent(ventry *ve, void **resp) { struct entry *ent = rem_ventry_entry(ve); av_ref_obj(ent); *resp = (void *) ent; return 0; } static void rem_check_file(struct remfs * fs, struct entry *ent) { int res; struct remnode *nod; struct remnode *parent; struct remfile *fil; rem_get_locked_node(fs, ent, &nod, &parent); fil = av_cacheobj_get(nod->file); if(fil != NULL) { res = rem_check_node(fs, nod, parent); if(res < 0 || !rem_signature_valid(&fil->sig, &nod->attr.st)) { av_unref_obj(nod->file); nod->file = NULL; } av_unref_obj(fil); } rem_put_locked_node(nod, parent); } static int rem_open(ventry *ve, int flags, avmode_t mode, void **resp) { int res; struct entry *ent = rem_ventry_entry(ve); struct remfs *fs = rem_ventry_filesys(ve); int accmode = (flags & AVO_ACCMODE); res = rem_node_type(fs, ent); if(res < 0) return res; if((flags & AVO_DIRECTORY) != 0) { if(res != AV_TYPE(AV_IFDIR)) return -ENOTDIR; } else { if(accmode == AVO_WRONLY || accmode == AVO_RDWR) return -EROFS; rem_check_file(fs, ent); } av_ref_obj(ent); *resp = (void *) ent; return 0; } static struct entry *rem_dirent_lookup(struct namespace *ns, struct entry *parent, const char *name) { struct entry *ent; ent = av_namespace_lookup_all(ns, parent, name); if(ent == NULL) { ent = parent; av_ref_obj(ent); } return ent; } static struct rementry *rem_nth_entry(struct remdir *dir, int n) { struct rementry *re; int i; re = dir->dirlist; for(i = 0; i < n && re != NULL; i++) re = re->next; return re; } static int rem_get_direntry(struct remfs *fs, struct remnode *nod, vfile *vf, struct avdirent *buf) { struct rementry *re; struct entry *cent; struct remnode *cnod; re = rem_nth_entry(&nod->dir, vf->ptr); if(re == NULL) return 0; cent = rem_dirent_lookup(fs->ns, nod->ent, re->name); cnod = rem_get_node(fs, cent); av_unref_obj(cent); buf->name = av_strdup(re->name); buf->type = re->type; buf->ino = cnod->ino; av_unref_obj(cnod); vf->ptr ++; return 1; } static int rem_readdir(vfile *vf, struct avdirent *buf) { int res; struct entry *ent = rem_vfile_entry(vf); struct remfs *fs = rem_vfile_filesys(vf); struct remnode *nod; nod = rem_get_node(fs, ent); AV_LOCK(nod->lock); res = rem_check_dir(fs, nod); if(res == 0) res = rem_get_direntry(fs, nod, vf, buf); AV_UNLOCK(nod->lock); av_unref_obj(nod); return res; } static int rem_close(vfile *vf) { struct entry *ent = rem_vfile_entry(vf); av_unref_obj(ent); return 0; } static void rem_get_signature(struct remfs *fs, struct entry *ent, struct remsig *sig) { int res; struct remnode *nod; struct remnode *parent; rem_get_locked_node(fs, ent, &nod, &parent); res = rem_check_node(fs, nod, parent); if(res == 0) { sig->modif = nod->attr.st.mtime; sig->size = nod->attr.st.size; } else sig->size = -1; rem_put_locked_node(nod, parent); } static void rem_delete_file(struct remfile *fil) { av_del_tmpfile(fil->localname); av_unref_obj(fil->data); } static avoff_t rem_local_size(const char *localname) { int res; struct stat stbuf; res = stat(localname, &stbuf); if(res == 0) { /* Ramfs returns 0 diskusage */ if(stbuf.st_blocks == 0) return stbuf.st_size; else return stbuf.st_blocks * 512; } else return -1; } static int rem_get_file(struct remfs *fs, struct remnode *nod, struct remfile **resp) { int res; struct remfile *fil; struct remote *rem = fs->rem; struct remgetparam gp; char *objname; fil = (struct remfile *) av_cacheobj_get(nod->file); if(fil != NULL) { *resp = fil; return 0; } rem_get_hostpath(nod->ent, &gp.hostpath); objname = av_stradd(NULL, rem->name, ":", gp.hostpath.host, gp.hostpath.path, NULL); if(rem->get != NULL) res = rem->get(rem, &gp); else res = -ENOENT; av_free(gp.hostpath.host); av_free(gp.hostpath.path); if(res < 0) { av_free(objname); return res; } AV_NEW_OBJ(fil, rem_delete_file); fil->localname = gp.localname; fil->data = gp.data; rem_get_signature(fs, nod->ent, &fil->sig); av_unref_obj(nod->file); nod->file = av_cacheobj_new(fil, objname); av_free(objname); if(res == 0) av_cacheobj_setsize(nod->file, rem_local_size(fil->localname)); *resp = fil; return 0; } static int rem_wait_data(struct remfs *fs, struct remnode *nod, struct remfile *fil, avoff_t end) { int res; struct remote *rem = fs->rem; if(fil->data == NULL) return 0; res = rem->wait(rem, fil->data, end); if(res < 0) return res; if(res == 0) { av_unref_obj(fil->data); fil->data = NULL; av_cacheobj_setsize(nod->file, rem_local_size(fil->localname)); } return 0; } static avssize_t rem_real_read(struct remfile *fil, vfile *vf, char *buf, avsize_t nbyte) { avssize_t res; avoff_t sres; int fd; fd = open(fil->localname, O_RDONLY); if(fd == -1) return -errno; sres = lseek(fd, vf->ptr, SEEK_SET); if(sres == -1) res = -errno; else { res = read(fd, buf, nbyte); if(res == -1) res = -errno; else vf->ptr += res; } close(fd); return res; } static avssize_t rem_read(vfile *vf, char *buf, avsize_t nbyte) { avssize_t res; struct remfs *fs = rem_vfile_filesys(vf); struct entry *ent = rem_vfile_entry(vf); struct remnode *nod; struct remfile *fil = NULL; nod = rem_get_node(fs, ent); AV_LOCK(nod->filelock); res = rem_get_file(fs, nod, &fil); if(res == 0) { res = rem_wait_data(fs, nod, fil, vf->ptr + nbyte); if(res == 0) res = rem_real_read(fil, vf, buf, nbyte); if(res < 0) { av_unref_obj(nod->file); nod->file = NULL; } av_unref_obj(fil); } AV_UNLOCK(nod->filelock); av_unref_obj(nod); return res; } static int rem_getattr(vfile *vf, struct avstat *buf, int attrmask) { int res; struct remfs *fs = rem_vfile_filesys(vf); struct entry *ent = rem_vfile_entry(vf); struct remnode *nod; struct remnode *parent; rem_get_locked_node(fs, ent, &nod, &parent); res = rem_check_node(fs, nod, parent); if(res == 0) *buf = nod->attr.st; rem_put_locked_node(nod, parent); return res; } static int rem_access(ventry *ve, int amode) { int res; struct remfs *fs = rem_ventry_filesys(ve); struct entry *ent = rem_ventry_entry(ve); res = rem_node_type(fs, ent); if(res < 0) return res; if((amode & AVW_OK) != 0) return -EACCES; return 0; } static int rem_readlink(ventry *ve, char **bufp) { int res; struct remfs *fs = rem_ventry_filesys(ve); struct entry *ent = rem_ventry_entry(ve); struct remnode *nod; struct remnode *parent; rem_get_locked_node(fs, ent, &nod, &parent); res = rem_check_node(fs, nod, parent); if(res == 0) { if(!AV_ISLNK(nod->attr.st.mode)) res = -EINVAL; else *bufp = av_strdup(nod->attr.linkname); } rem_put_locked_node(nod, parent); return res; } static void rem_log_tree(struct namespace *ns, struct entry *ent) { char *path; struct entry *next; while(ent != NULL) { path = av_namespace_getpath(ent); av_log(AVLOG_ERROR, " %s", path); av_free(path); rem_log_tree(ns, av_namespace_subdir(ns, ent)); next = av_namespace_next(ent); av_unref_obj(ent); ent = next; } } static void rem_destroy(struct avfs *avfs) { struct remfs *fs = (struct remfs *) avfs->data; struct remote *rem = fs->rem; struct remnode *nod; struct entry *root; AV_LOCK(rem_lock); nod = fs->list.next; while(nod != &fs->list) { struct remnode *next = nod->next; av_unref_obj(nod); nod = next; } AV_UNLOCK(rem_lock); root = av_namespace_subdir(fs->ns, NULL); if(root != NULL) { av_log(AVLOG_ERROR, "%s: busy entries after destroy:", avfs->name); rem_log_tree(fs->ns, root); } av_unref_obj(fs->ns); rem->destroy(rem); av_free(fs); } void av_remote_add(struct remdirlist *dl, const char *name, const char *linkname, struct avstat *attr) { struct remdirent *de; dl->ents = av_realloc(dl->ents, sizeof(*dl->ents) * (dl->num + 1)); de = &dl->ents[dl->num]; dl->num++; de->name = av_strdup(name); de->linkname = av_strdup(linkname); de->attr = *attr; } int av_remote_init(struct vmodule *module, struct remote *rem, struct avfs **resp) { int res; struct avfs *avfs; struct remfs *fs; res = av_new_avfs(rem->name, NULL, AV_VER, AVF_ONLYROOT | AVF_NOLOCK, module, &avfs); if(res < 0) { rem->destroy(rem); return res; } AV_NEW(fs); fs->ns = av_namespace_new(); fs->list.next = fs->list.prev = &fs->list; fs->rem = rem; fs->avfs = avfs; avfs->data = fs; avfs->destroy = rem_destroy; avfs->lookup = rem_lookup; avfs->putent = rem_putent; avfs->copyent = rem_copyent; avfs->getpath = rem_getpath; avfs->open = rem_open; avfs->close = rem_close; avfs->read = rem_read; avfs->readdir = rem_readdir; avfs->getattr = rem_getattr; avfs->access = rem_access; avfs->readlink = rem_readlink; av_add_avfs(avfs); *resp = avfs; return 0; } avfs-1.1.4/src/utils.c0000644000175000001440000001631614032341001011457 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "internal.h" #include "version.h" #include "oper.h" #include #include #define NEED_VER 90 /* FIXME: This is just a random value */ #define AVFS_MAJOR 0xa5f static struct namespace *avfsstat_ns; struct av_obj { int refctr; void (*destr)(void *); avmutex *ref_lock; void (*destr_locked)(void *); }; static AV_LOCK_DECL(objlock); int av_check_version(const char *modname, const char *name, int version, int need_ver, int provide_ver) { if(version < need_ver || version > provide_ver) { if(version < need_ver) av_log(AVLOG_WARNING, "%s: %s has version %i. Needs to be at least %i.", modname, name, version, need_ver); else av_log(AVLOG_WARNING, "%s: %s has version %i. Cannot handle above %i.", modname, name, version, provide_ver); return -ENODEV; } return 0; } static struct ext_info *copy_exts(struct ext_info *exts) { int i, num, len; struct ext_info *newexts; char *pp; if(exts == NULL) return NULL; len = 0; for(i = 0; exts[i].from != NULL; i++) { len += (strlen(exts[i].from) + 1); if(exts[i].to != NULL) len += (strlen(exts[i].to) + 1); } num = i; newexts = av_malloc((num + 1) * sizeof(*newexts) + len); pp = (char *) (&newexts[num + 1]); for(i = 0; i < num; i++) { strcpy(pp, exts[i].from); newexts[i].from = pp; pp += (strlen(pp) + 1); if(exts[i].to != NULL) { strcpy(pp, exts[i].to); newexts[i].to = pp; pp += (strlen(pp) + 1); } else newexts[i].to = NULL; } newexts[i].from = NULL; newexts[i].to = NULL; return newexts; } static void free_avfs(struct avfs *avfs) { AVFS_LOCK(avfs); avfs->destroy(avfs); AVFS_UNLOCK(avfs); av_free(avfs->name); av_free(avfs->exts); av_unref_obj(avfs->module); AV_FREELOCK(avfs->lock); } static int new_minor() { static AV_LOCK_DECL(lock); static int minor = 1; int res; AV_LOCK(lock); res = minor; minor++; AV_UNLOCK(lock); return res; } avino_t av_new_ino(struct avfs *avfs) { static AV_LOCK_DECL(lock); avino_t res; AV_LOCK(lock); res = avfs->inoctr; avfs->inoctr++; AV_UNLOCK(lock); return res; } int av_new_avfs(const char *name, struct ext_info *exts, int version, int flags, struct vmodule *module, struct avfs **retp) { int ret; struct avfs *avfs; ret = av_check_version("CoreLib", name, version, NEED_VER, AV_VER); if(ret < 0) return ret; AV_NEW_OBJ(avfs, free_avfs); AV_INITLOCK(avfs->lock); avfs->name = av_strdup(name); avfs->exts = copy_exts(exts); avfs->data = NULL; avfs->version = version; avfs->flags = flags; avfs->module = module; avfs->dev = av_mkdev(AVFS_MAJOR, new_minor()); avfs->inoctr = 2; av_ref_obj(module); av_default_avfs(avfs); *retp = avfs; return 0; } void av_init_avfsstat() { struct avfs *avfs; av_state_new(NULL, "avfsstat", &avfsstat_ns, &avfs); av_unref_obj(avfsstat_ns); } void av_avfsstat_register(const char *path, struct statefile *func) { struct entry *ent; struct statefile *stf; ent = av_namespace_resolve(avfsstat_ns, path); AV_NEW(stf); *stf = *func; av_namespace_set(ent, stf); } char *av_strdup(const char *s) { char *ns; if(s == NULL) return NULL; ns = (char *) av_malloc(strlen(s) + 1); strcpy(ns, s); return ns; } char *av_strndup(const char *s, avsize_t len) { char *ns; if(s == NULL) return NULL; ns = (char *) av_malloc(len + 1); strncpy(ns, s, len); ns[len] = '\0'; return ns; } char *av_stradd(char *str, ...) { va_list ap; unsigned int origlen; unsigned int len; char *s, *ns; origlen = 0; if(str != NULL) origlen = strlen(str); len = origlen; va_start(ap, str); while((s = va_arg(ap, char*)) != NULL) len += strlen(s); va_end(ap); str = av_realloc(str, len + 1); ns = str + origlen; ns[0] = '\0'; va_start(ap, str); while((s = va_arg(ap, char*)) != NULL) { strcpy(ns, s); ns += strlen(ns); } va_end(ap); return str; } void *av_new_obj(avsize_t nbyte, void (*destr)(void *)) { struct av_obj *ao; ao = (struct av_obj *) av_calloc(sizeof(*ao) + nbyte); ao->refctr = 1; ao->destr = destr; ao->ref_lock = NULL; ao->destr_locked = NULL; return (void *) (ao + 1); } void av_obj_set_ref_lock(void *obj, avmutex *lock) { if(obj != NULL) { struct av_obj *ao = ((struct av_obj *) obj) - 1; ao->ref_lock = lock; } } void av_obj_set_destr_locked(void *obj, void (*destr_locked)(void *)) { if(obj != NULL) { struct av_obj *ao = ((struct av_obj *) obj) - 1; ao->destr_locked = destr_locked; } } void av_ref_obj(void *obj) { if(obj != NULL) { struct av_obj *ao = ((struct av_obj *) obj) - 1; int refctr; if(ao->ref_lock != NULL) { AV_LOCK(*ao->ref_lock); } else { AV_LOCK(objlock); } if(ao->refctr > 0) ao->refctr ++; refctr = ao->refctr; if(ao->ref_lock != NULL) { AV_UNLOCK(*ao->ref_lock); } else { AV_UNLOCK(objlock); } if(refctr <= 0) av_log(AVLOG_ERROR, "Referencing deleted object (%p)", obj); } } void av_unref_obj(void *obj) { if(obj != NULL) { struct av_obj *ao = ((struct av_obj *) obj) - 1; int refctr; if(ao->ref_lock != NULL) { AV_LOCK(*ao->ref_lock); } else { AV_LOCK(objlock); } if(ao->refctr >= 0) ao->refctr --; refctr = ao->refctr; if(refctr == 0) { if(ao->destr_locked != NULL) ao->destr_locked(obj); } if(ao->ref_lock != NULL) { AV_UNLOCK(*ao->ref_lock); } else { AV_UNLOCK(objlock); } if(refctr == 0) { if(ao->destr != NULL) ao->destr(obj); av_free(ao); return; } else if(refctr < 0) av_log(AVLOG_ERROR, "Unreferencing deleted object (%p)", obj); } } avssize_t av_pread_all(vfile *vf, char *buf, avsize_t nbyte, avoff_t offset) { avssize_t res; res = av_pread(vf, buf, nbyte, offset); if(res < 0) return res; if(res != nbyte) { av_log(AVLOG_ERROR, "Premature end of file"); return -EIO; } return res; } avssize_t av_read_all(vfile *vf, char *buf, avsize_t nbyte) { avssize_t res; res = av_read(vf, buf, nbyte); if(res < 0) return res; if(res != nbyte) { av_log(AVLOG_ERROR, "Premature end of file"); return -EIO; } return res; } avfs-1.1.4/src/filebuf.c0000644000175000001440000001250414032341001011726 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ /* filebuf.c Implements buffered i/o with avfs fs functions. Includes facilities for i/o multiplexing as well. */ #include "filebuf.h" #include #include #include struct filebuf { int flags; int fd; avsize_t size; avsize_t ptr; avsize_t nbytes; char *buf; int eof; int avail; }; static void free_filebuf(struct filebuf *fb) { av_free(fb->buf); close(fb->fd); } struct filebuf *av_filebuf_new(int fd, int flags) { struct filebuf *fb; int oflags; AV_NEW_OBJ(fb, free_filebuf); if(flags & FILEBUF_NONBLOCK) { oflags = fcntl(fd, F_GETFL); oflags = oflags == -1 ? 0 : oflags; fcntl(fd, F_SETFL, oflags | O_NONBLOCK); } fb->flags = flags; fb->fd = fd; fb->size = 0; fb->nbytes = 0; fb->ptr = 0; fb->buf = NULL; fb->eof = 0; fb->avail = 0; return fb; } int av_filebuf_eof(struct filebuf *fb) { return fb->eof; } static void filebuf_fill_poll(struct filebuf *fbs[], struct pollfd *pf, int numfbs) { int i; for(i = 0; i < numfbs; i++) { pf[i].fd = -1; pf[i].events = 0; if(fbs[i] != NULL && !fbs[i]->eof) { pf[i].fd = fbs[i]->fd; if((fbs[i]->flags & FILEBUF_WRITE) != 0) pf[i].events = POLLOUT; else pf[i].events = POLLIN; } } } static void filebuf_check_poll(struct filebuf *fbs[], struct pollfd *pf, int numfbs) { int i; for(i = 0; i < numfbs; i++) { if(fbs[i] != NULL && !fbs[i]->eof) { if(pf[i].revents != 0) fbs[i]->avail = 1; else fbs[i]->avail = 0; } } } int av_filebuf_check(struct filebuf *fbs[], unsigned int numfbs, long timeoutms) { int res; struct pollfd *pf; pf = (struct pollfd *) av_malloc(sizeof(*pf) * numfbs); filebuf_fill_poll(fbs, pf, numfbs); res = poll(pf, numfbs, timeoutms); if(res == -1) { av_log(AVLOG_ERROR, "filebuf: poll error: %s", strerror(errno)); res = -EIO; } else if(res > 0) { filebuf_check_poll(fbs, pf, numfbs); res = 1; } av_free(pf); return res; } static avssize_t filebuf_real_read(struct filebuf *fb, char *buf, avsize_t nbytes) { avssize_t res; if(!fb->avail) return 0; fb->avail = 0; res = read(fb->fd, buf, nbytes); if(res < 0) { av_log(AVLOG_ERROR, "filebuf: read error: %s", strerror(errno)); return -EIO; } if(res == 0) fb->eof = 1; return res; } avssize_t av_filebuf_read(struct filebuf *fb, char *buf, avsize_t nbytes) { if(fb->nbytes > 0) { avsize_t nact = AV_MIN(fb->nbytes, nbytes); memcpy(buf, fb->buf + fb->ptr, nact); fb->ptr += nact; fb->nbytes -= nact; return nact; } return filebuf_real_read(fb, buf, nbytes); } avssize_t av_filebuf_write(struct filebuf *fb, const char *buf, avsize_t nbytes) { avssize_t res; if(!fb->avail) return 0; fb->avail = 0; res = write(fb->fd, buf, nbytes); if(res < 0) { av_log(AVLOG_ERROR, "filebuf: write error: %s", strerror(errno)); return -EIO; } return res; } static avssize_t read_data(struct filebuf *fb) { avssize_t res; const int readsize = 256; avsize_t newsize; if(fb->ptr != 0 && fb->nbytes != 0) memmove(fb->buf, fb->buf + fb->ptr, fb->nbytes); fb->ptr = 0; newsize = fb->nbytes + readsize; if(newsize > fb->size) { fb->buf = av_realloc(fb->buf, newsize); fb->size = newsize; } res = filebuf_real_read(fb, fb->buf + fb->nbytes, readsize); if(res > 0) fb->nbytes += res; return res; } static avssize_t filebuf_lineend(struct filebuf *fb) { avssize_t res; char *start; char *s; do { start = fb->buf + fb->ptr; if(fb->nbytes > 0) { s = memchr(start, '\n', fb->nbytes); if(s != NULL) return (s + 1) - start; } if(fb->eof) return fb->nbytes; res = read_data(fb); } while(res > 0); return res; } int av_filebuf_readline(struct filebuf *fb, char **resp) { avssize_t nbytes; *resp = NULL; nbytes = filebuf_lineend(fb); if(nbytes <= 0) return nbytes; *resp = av_strndup(fb->buf + fb->ptr, nbytes); fb->ptr += nbytes; fb->nbytes -= nbytes; return 1; } int av_filebuf_getline(struct filebuf *fb, char **linep, long timeoutms) { int res; char *line; *linep = NULL; while(1) { res = av_filebuf_readline(fb, &line); if(res < 0) return res; if(res == 1) break; if(av_filebuf_eof(fb)) return 1; res = av_filebuf_check(&fb, 1, timeoutms); if(res < 0) return res; if(res == 0) return 0; } *linep = line; return 1; } avfs-1.1.4/src/realfile.c0000644000175000001440000000442314032341001012076 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "realfile.h" #include "oper.h" #include "cache.h" #include #include #define COPY_BUFSIZE 16384 static int copy_file(ventry *ve, const char *destpath) { int res; avssize_t num; char buf[COPY_BUFSIZE]; int ctr; vfile *vf; int destfd; res = av_open(ve, AVO_RDONLY, 0, &vf); if(res < 0) return res; destfd = open(destpath, O_WRONLY | O_CREAT | O_TRUNC, 0600); if(destfd == -1) { res = -errno; av_close(vf); av_log(AVLOG_ERROR, "Error opening file %s: %s", destpath, strerror(errno)); return res; } ctr = 0; while(1) { res = av_read(vf, buf, COPY_BUFSIZE); if(res <= 0) break; num = res; res = write(destfd, buf, num); if(res == -1 && (errno == ENOSPC || errno == EDQUOT)) { av_cache_diskfull(); res = write(destfd, buf, num); } if(res == -1) { res = -errno; av_log(AVLOG_ERROR, "Error writing file %s: %s", destpath, strerror(errno)); break; } /* Check free space after each Meg */ if((ctr++ % 64) == 0) av_cache_checkspace(); } close(destfd); if(res == 0) res = av_close(vf); else av_close(vf); return res; } static void realfile_delete(struct realfile *rf) { if(!rf->is_tmp) av_free(rf->name); else av_del_tmpfile(rf->name); } int av_get_realfile(ventry *ve, struct realfile **resp) { int res; struct realfile *rf; AV_NEW_OBJ(rf, realfile_delete); rf->is_tmp = 0; rf->name = NULL; if(ve->mnt->base == NULL) { rf->name = av_strdup((char *) ve->data); rf->is_tmp = 0; *resp = rf; return 0; } res = av_get_tmpfile(&rf->name); if(res < 0) { av_unref_obj(rf); return res; } rf->is_tmp = 1; res = copy_file(ve, rf->name); if(res < 0) { av_unref_obj(rf); return res; } *resp = rf; return 0; } avfs-1.1.4/src/bzread.c0000644000175000001440000002715014032341001011564 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "config.h" #include "bzfile.h" #include "bzlib.h" #include "oper.h" #include "exit.h" #include #include #define INBUFSIZE 16384 #define OUTBUFSIZE 32768 struct bzstreamcache { int id; bz_stream *s; }; /* FIXME: the streamcache should be cleaned up after a short timeout because it uses a LOT of memory */ static struct bzstreamcache bzscache; static int bzread_nextid; static AV_LOCK_DECL(bzread_lock); struct bzindex { avoff_t offset; /* The number of output bytes */ avoff_t inbits; /* The number of input bits */ avuint crc; /* The cumulative CRC up to this point */ avbyte blocksize; /* the blocksize in 100k (1 .. 9) */ avbyte startbits; /* the bits at the start of the block */ }; struct bzcache { int id; avoff_t size; unsigned int numindex; struct bzindex *indexes; }; struct bzfile { bz_stream *s; int iseof; int iserror; int id; /* The id of the last used bzcache */ vfile *infile; char inbuf[INBUFSIZE]; }; void bz_internal_error(int errorcode) { av_log(AVLOG_ERROR, "BZLIB: internal error %i", errorcode); } static avoff_t bz_total_in(bz_stream *s) { return (avoff_t) s->total_in_lo32 + ((avoff_t) s->total_in_hi32 << 32); } static avoff_t bz_total_out(bz_stream *s) { return (avoff_t) s->total_out_lo32 + ((avoff_t) s->total_out_hi32 << 32); } static void bz_delete_stream(bz_stream *s) { int res; if(s != NULL) { res = BZ2_bzDecompressEnd(s); if(res != BZ_OK) av_log(AVLOG_ERROR, "BZFILE: decompress end error: %i", res); av_free(s); } } static int bz_new_stream(bz_stream **resp) { int res; bz_stream *s; AV_NEW(s); memset(s, 0, sizeof(*s)); res = BZ2_bzDecompressInit(s, 0, 0); if(res != BZ_OK) { *resp = NULL; av_log(AVLOG_ERROR, "BZFILE: decompress init error: %i", res); return -EIO; } *resp = s; return 0; } static void bzfile_scache_delete() { AV_LOCK(bzread_lock); if(bzscache.id != 0) { bz_delete_stream(bzscache.s); bzscache.id = 0; } AV_UNLOCK(bzread_lock); } static void bzfile_scache_save(int id, bz_stream *s) { static int regdestroy = 0; if(!regdestroy) { regdestroy = 1; av_add_exithandler(bzfile_scache_delete); } if(id == 0 || s == NULL) { bz_delete_stream(s); return; } if(bzscache.id != 0) bz_delete_stream(bzscache.s); bzscache.id = id; bzscache.s = s; } static int bzfile_reset(struct bzfile *fil) { /* FIXME: Is it a good idea to save the previous state or not? */ if (fil->iseof || fil->iserror) bz_delete_stream(fil->s); else bzfile_scache_save(fil->id, fil->s); fil->iseof = 0; fil->iserror = 0; return bz_new_stream(&fil->s); } #ifndef USE_SYSTEM_BZLIB static int bzfile_seek_index(struct bzfile *fil, struct bzindex *zi) { int res; unsigned int bitsrem; avoff_t total_in; unsigned int val; /* FIXME: Is it a good idea to save the previous state or not? */ bzfile_scache_save(fil->id, fil->s); res = bz_new_stream(&fil->s); if(res < 0) return res; total_in = (zi->inbits + 7) >> 3; bitsrem = (total_in << 3) - zi->inbits; total_in -= 4; fil->s->next_in = fil->inbuf; fil->s->avail_in = 4; fil->s->total_in_lo32 = total_in & 0xFFFFFFFF; fil->s->total_in_hi32 = (total_in >> 32) & 0xFFFFFFFF; fil->s->total_out_lo32 = zi->offset & 0xFFFFFFFF; fil->s->total_out_hi32 = (zi->offset >> 32) & 0xFFFFFFFF; val = ('B' << 24) + ('Z' << 16) + ('h' << 8) + (zi->blocksize + '0'); val <<= bitsrem; val += zi->startbits; fil->inbuf[0] = (val >> 24) & 0xFF; fil->inbuf[1] = (val >> 16) & 0xFF; fil->inbuf[2] = (val >> 8) & 0xFF; fil->inbuf[3] = val & 0xFF; av_log(AVLOG_DEBUG, "BZFILE: restore: %lli %lli/%i %08x %i", bz_total_out(fil->s), bz_total_in(fil->s), bitsrem, zi->crc, zi->blocksize); BZ2_bzRestoreBlockEnd(fil->s, bitsrem, zi->crc); return 0; } static struct bzindex *bzcache_find_index(struct bzcache *zc, avoff_t offset) { unsigned int i; for(i = 0; i < zc->numindex; i++) { if(zc->indexes[i].offset > offset) break; } if(i == 0) return NULL; return &zc->indexes[i-1]; } #endif static int bzfile_fill_inbuf(struct bzfile *fil) { avssize_t res; avoff_t inoff = bz_total_in(fil->s); res = av_pread(fil->infile, fil->inbuf, INBUFSIZE, inoff); if(res < 0) return res; fil->s->next_in = fil->inbuf; fil->s->avail_in = res; return 0; } #ifndef USE_SYSTEM_BZLIB static void bzfile_save_state(struct bzcache *zc, bz_stream *s, unsigned int bitsrem, unsigned int bits, unsigned int crc, unsigned int blocksize) { struct bzindex *zi; avoff_t offset = bz_total_out(s); int i; for(i = 0; i < zc->numindex; i++) { if(zc->indexes[i].offset >= offset) return; } zc->numindex ++; zc->indexes = (struct bzindex *) av_realloc(zc->indexes, sizeof(*zc->indexes) * zc->numindex); zi = &zc->indexes[i]; zi->offset = offset; zi->inbits = (bz_total_in(s) << 3) - bitsrem; zi->startbits = bits & ((1 << bitsrem) - 1); zi->crc = crc; zi->blocksize = blocksize; av_log(AVLOG_DEBUG, "BZFILE: new block end: %lli %lli/%i %08x %i", zi->offset, bz_total_in(s), bitsrem, zi->crc, zi->blocksize); } static void bz_block_end(void *data, bz_stream *s, unsigned int bitsrem, unsigned int bits, unsigned int crc, unsigned int blocksize) { struct bzcache *zc = (struct bzcache *) data; AV_LOCK(bzread_lock); bzfile_save_state(zc, s, bitsrem, bits, crc, blocksize); AV_UNLOCK(bzread_lock); } #endif static int bzfile_decompress(struct bzfile *fil, struct bzcache *zc) { int res; //unsigned char *start; if(fil->s->avail_in == 0) { res = bzfile_fill_inbuf(fil); if(res < 0) return res; if(fil->s->avail_in == 0) { /* still no byte available */ av_log(AVLOG_ERROR, "BZFILE: decompress error"); return -EIO; } } //start = (unsigned char*)( fil->s->next_out ); #ifndef USE_SYSTEM_BZLIB BZ2_bzSetBlockEndHandler(fil->s, bz_block_end, zc); #endif res = BZ2_bzDecompress(fil->s); if(res == BZ_STREAM_END) { fil->iseof = 1; AV_LOCK(bzread_lock); zc->size = bz_total_out(fil->s); AV_UNLOCK(bzread_lock); return 0; } if(res != BZ_OK) { av_log(AVLOG_ERROR, "BZFILE: decompress error: %i", res); return -EIO; } return 0; } static int bzfile_read(struct bzfile *fil, struct bzcache *zc, char *buf, avsize_t nbyte) { int res; fil->s->next_out = buf; fil->s->avail_out = nbyte; while(fil->s->avail_out != 0 && !fil->iseof) { res = bzfile_decompress(fil, zc); if(res < 0) return res; } return nbyte - fil->s->avail_out; } static int bzfile_skip_to(struct bzfile *fil, struct bzcache *zc, avoff_t offset) { int res; char outbuf[OUTBUFSIZE]; while(!fil->iseof) { avoff_t curroff = bz_total_out(fil->s); if(curroff == offset) break; /* FIXME: Maybe cache some data as well */ fil->s->next_out = outbuf; fil->s->avail_out = AV_MIN(OUTBUFSIZE, offset - curroff); res = bzfile_decompress(fil, zc); if(res < 0) return res; } return 0; } #ifndef USE_SYSTEM_BZLIB static int bzfile_seek(struct bzfile *fil, struct bzcache *zc, avoff_t offset) { struct bzindex *zi; avoff_t curroff = bz_total_out(fil->s); avoff_t zcdist; avoff_t scdist; avoff_t dist; if(offset >= curroff) dist = offset - curroff; else dist = -1; zi = bzcache_find_index(zc, offset); if(zi != NULL) zcdist = offset - zi->offset; else zcdist = offset; if(bzscache.id == zc->id) { avoff_t scacheoff = bz_total_out(bzscache.s); if(offset >= scacheoff) { scdist = offset - scacheoff; if((dist == -1 || scdist < dist) && scdist < zcdist) { bz_stream *tmp = fil->s; fil->s = bzscache.s; fil->s->avail_in = 0; bzscache.s = tmp; return 0; } } } if(dist == -1 || zcdist < dist) { if(zi == NULL) return bzfile_reset(fil); else return bzfile_seek_index(fil, zi); } return 0; } #endif static avssize_t av_bzfile_do_pread(struct bzfile *fil, struct bzcache *zc, char *buf, avsize_t nbyte, avoff_t offset) { avssize_t res; avoff_t curroff; fil->id = zc->id; curroff = bz_total_out(fil->s); if(offset != curroff) { AV_LOCK(bzread_lock); #ifndef USE_SYSTEM_BZLIB res = bzfile_seek(fil, zc, offset); #else if ( curroff > offset ) { res = bzfile_reset( fil ); } else { res = 0; } #endif AV_UNLOCK(bzread_lock); if(res < 0) return res; res = bzfile_skip_to(fil, zc, offset); if(res < 0) return res; } res = bzfile_read(fil, zc, buf, nbyte); return res; } avssize_t av_bzfile_pread(struct bzfile *fil, struct bzcache *zc, char *buf, avsize_t nbyte, avoff_t offset) { avssize_t res; if(fil->iserror) return -EIO; res = av_bzfile_do_pread(fil, zc, buf, nbyte, offset); if(res < 0) fil->iserror = 1; return res; } int av_bzfile_size(struct bzfile *fil, struct bzcache *zc, avoff_t *sizep) { int res; avoff_t size; AV_LOCK(bzread_lock); size = zc->size; AV_UNLOCK(bzread_lock); if(size != -1 || fil == NULL) { *sizep = size; return 0; } fil->id = zc->id; AV_LOCK(bzread_lock); #ifndef USE_SYSTEM_BZLIB res = bzfile_seek(fil, zc, AV_MAXOFF); #else res = bzfile_reset( fil ); #endif AV_UNLOCK(bzread_lock); if(res < 0) return res; res = bzfile_skip_to(fil, zc, AV_MAXOFF); if(res < 0) return res; AV_LOCK(bzread_lock); size = zc->size; AV_UNLOCK(bzread_lock); if(size == -1) { av_log(AVLOG_ERROR, "BZFILE: Internal error: could not find size"); return -EIO; } *sizep = size; return 0; } static void bzfile_destroy(struct bzfile *fil) { AV_LOCK(bzread_lock); bzfile_scache_save(fil->id, fil->s); AV_UNLOCK(bzread_lock); } struct bzfile *av_bzfile_new(vfile *vf) { int res; struct bzfile *fil; AV_NEW_OBJ(fil, bzfile_destroy); fil->iseof = 0; fil->iserror = 0; fil->infile = vf; fil->id = 0; res = bz_new_stream(&fil->s); if(res < 0) fil->iserror = 1; return fil; } static void bzcache_destroy(struct bzcache *zc) { av_free(zc->indexes); } struct bzcache *av_bzcache_new() { struct bzcache *zc; AV_NEW_OBJ(zc, bzcache_destroy); zc->numindex = 0; zc->indexes = NULL; zc->size = -1; AV_LOCK(bzread_lock); if(bzread_nextid == 0) bzread_nextid = 1; zc->id = bzread_nextid ++; AV_UNLOCK(bzread_lock); return zc; } avfs-1.1.4/src/virtual.c0000644000175000001440000003151514032341001012003 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "virtual.h" #include "operutil.h" #include "oper.h" #include "internal.h" #include #include #include #include #include static int oflags_to_avfs(int flags) { int avflags; avflags = flags & O_ACCMODE; if(avflags == AVO_NOPERM) avflags = AVO_RDWR; if(flags & O_CREAT) avflags |= AVO_CREAT; if(flags & O_EXCL) avflags |= AVO_EXCL; if(flags & O_TRUNC) avflags |= AVO_TRUNC; if(flags & O_APPEND) avflags |= AVO_APPEND; if(flags & O_NONBLOCK) avflags |= AVO_NONBLOCK; #ifdef O_SYNC if(flags & O_SYNC) avflags |= AVO_SYNC; #endif return avflags; } int virt_open(const char *path, int flags, mode_t mode) { int res; int errno_save = errno; res = av_fd_open(path, oflags_to_avfs(flags), mode & 07777); if(res < 0) { errno = -res; return -1; } errno = errno_save; return res; } int virt_close(int fd) { int res; int errno_save = errno; res = av_fd_close(fd); if(res < 0) { errno = -res; return -1; } errno = errno_save; return 0; } ssize_t virt_write(int fd, const void *buf, size_t nbyte) { ssize_t res; int errno_save = errno; res = av_fd_write(fd, buf, nbyte); if(res < 0) { errno = -res; return -1; } errno = errno_save; return res; } ssize_t virt_read(int fd, void *buf, size_t nbyte) { ssize_t res; int errno_save = errno; res = av_fd_read(fd, buf, nbyte); if(res < 0) { errno = -res; return -1; } errno = errno_save; return res; } off_t virt_lseek(int fd, off_t offset, int whence) { off_t res; int errno_save = errno; res = av_fd_lseek(fd, offset, whence); if(res < 0) { errno = -res; return -1; } errno = errno_save; return res; } static void avstat_to_stat(struct stat *buf, struct avstat *avbuf) { buf->st_dev = avbuf->dev; buf->st_ino = avbuf->ino; buf->st_mode = avbuf->mode; buf->st_nlink = avbuf->nlink; buf->st_uid = avbuf->uid; buf->st_gid = avbuf->gid; buf->st_rdev = avbuf->rdev; buf->st_size = avbuf->size; buf->st_blksize = avbuf->blksize; buf->st_blocks = avbuf->blocks; buf->st_atime = avbuf->atime.sec; buf->st_mtime = avbuf->mtime.sec; buf->st_ctime = avbuf->ctime.sec; } int virt_fstat(int fd, struct stat *buf) { int res; struct avstat avbuf; int errno_save = errno; res = av_fd_getattr(fd, &avbuf, AVA_ALL); if(res < 0) { errno = -res; return -1; } avstat_to_stat(buf, &avbuf); errno = errno_save; return 0; } static int open_path(vfile *vf, const char *path, int flags, avmode_t mode) { int res; ventry *ve; res = av_get_ventry(path, !(flags & AVO_NOFOLLOW), &ve); if(res < 0) return res; res = av_file_open(vf, ve, flags, mode); av_free_ventry(ve); return res; } static int common_stat(const char *path, struct stat *buf, int flags) { int res; vfile vf; struct avstat avbuf; int errno_save = errno; res = open_path(&vf, path, AVO_NOPERM | flags, 0); if(res == 0) { res = av_file_getattr(&vf, &avbuf, AVA_ALL); av_file_close(&vf); if(res == 0) avstat_to_stat(buf, &avbuf); } if(res < 0) { errno = -res; return -1; } errno = errno_save; return 0; } int virt_stat(const char *path, struct stat *buf) { return common_stat(path, buf, 0); } int virt_lstat(const char *path, struct stat *buf) { return common_stat(path, buf, AVO_NOFOLLOW); } #ifndef NAME_MAX #define NAME_MAX 255 #endif typedef struct { int fd; struct dirent entry; char _trail[NAME_MAX + 1]; } AVDIR; DIR *virt_opendir(const char *path) { AVDIR *dp; int res; int errno_save = errno; res = av_fd_open(path, AVO_DIRECTORY, 0); if(res < 0) { errno = -res; return NULL; } AV_NEW(dp); dp->fd = res; errno = errno_save; return (DIR *) dp; } int virt_closedir(DIR *dirp) { int res; AVDIR *dp = (AVDIR *) dirp; int errno_save = errno; int fd; if(dp == NULL) { errno = EINVAL; return -1; } fd = dp->fd; av_free(dp); res = av_fd_close(fd); if(res < 0) { errno = -res; return -1; } errno = errno_save; return 0; } void virt_rewinddir(DIR *dirp) { int res; AVDIR *dp = (AVDIR *) dirp; int errno_save = errno; if(dp == NULL) { errno = EINVAL; return; } res = av_fd_lseek(dp->fd, 0, AVSEEK_SET); if(res < 0) errno = -res; errno = errno_save; } #define AVFS_DIR_RECLEN 256 /* just an arbitary number */ static void avdirent_to_dirent(struct dirent *ent, struct avdirent *avent, avoff_t n) { ent->d_ino = avent->ino; #ifdef HAVE_D_OFF ent->d_off = n * AVFS_DIR_RECLEN; #endif ent->d_reclen = AVFS_DIR_RECLEN; #ifdef HAVE_D_TYPE ent->d_type = avent->type; #endif strncpy(ent->d_name, avent->name, NAME_MAX); ent->d_name[NAME_MAX] = '\0'; } struct dirent *virt_readdir(DIR *dirp) { int res; struct avdirent buf; avoff_t n; AVDIR *dp = (AVDIR *) dirp; int errno_save = errno; if(dp == NULL) { errno = EINVAL; return NULL; } res = av_fd_readdir(dp->fd, &buf, &n); if(res <= 0) { if(res < 0) errno = -res; else errno = errno_save; return NULL; } avdirent_to_dirent(&dp->entry, &buf, n); av_free(buf.name); errno = errno_save; return &dp->entry; } int virt_truncate(const char *path, off_t length) { int res; vfile vf; int errno_save = errno; res = open_path(&vf, path, AVO_WRONLY, 0); if(res == 0) { av_file_truncate(&vf, length); av_file_close(&vf); } if(res < 0) { errno = -res; return -1; } errno = errno_save; return 0; } static int common_setattr(const char *path, struct avstat *buf, int attrmask, int flags) { int res; int errno_save = errno; vfile vf; res = open_path(&vf, path, AVO_NOPERM | flags, 0); if(res == 0) { res = av_file_setattr(&vf, buf, attrmask); av_file_close(&vf); } if(res < 0) { errno = -res; return -1; } errno = errno_save; return 0; } int virt_utime(const char *path, struct utimbuf *buf) { struct avstat stbuf; if(buf == NULL) { int errno_save = errno; av_curr_time(&stbuf.mtime); errno = errno_save; stbuf.atime = stbuf.mtime; } else { stbuf.mtime.sec = buf->modtime; stbuf.mtime.nsec = 0; stbuf.atime.sec = buf->actime; stbuf.atime.nsec = 0; } return common_setattr(path, &stbuf, AVA_MTIME | AVA_ATIME, 0); } int virt_chmod(const char *path, mode_t mode) { struct avstat stbuf; stbuf.mode = mode & 07777; return common_setattr(path, &stbuf, AVA_MODE, 0); } static int common_chown(const char *path, uid_t owner, gid_t grp, int flags) { struct avstat stbuf; int attrmask = 0; stbuf.uid = owner; stbuf.gid = grp; if(owner != (uid_t) -1) attrmask |= AVA_UID; if(grp != (gid_t) -1) attrmask |= AVA_GID; return common_setattr(path, &stbuf, attrmask, flags); } int virt_chown(const char *path, uid_t owner, gid_t grp) { return common_chown(path, owner, grp, 0); } int virt_lchown(const char *path, uid_t owner, gid_t grp) { return common_chown(path, owner, grp, AVO_NOFOLLOW); } int virt_ftruncate(int fd, off_t length) { int res; int errno_save = errno; res = av_fd_truncate(fd, length); if(res < 0) { errno = -res; return -1; } errno = errno_save; return 0; } static int common_fsetattr(int fd, struct avstat *stbuf, int attrmask) { int res; int errno_save = errno; res = av_fd_setattr(fd, stbuf, attrmask); if(res < 0) { errno = -res; return -1; } errno = errno_save; return 0; } int virt_fchmod(int fd, mode_t mode) { struct avstat stbuf; stbuf.mode = mode & 07777; return common_fsetattr(fd, &stbuf, AVA_MODE); } int virt_fchown(int fd, uid_t owner, gid_t grp) { struct avstat stbuf; int attrmask = 0; stbuf.uid = owner; stbuf.gid = grp; if(owner != (uid_t) -1) attrmask |= AVA_UID; if(grp != (gid_t) -1) attrmask |= AVA_GID; return common_fsetattr(fd, &stbuf, attrmask); } int virt_access(const char *path, int amode) { int res; ventry *ve; int errno_save = errno; res = av_get_ventry(path, 1, &ve); if(res == 0) { res = av_access(ve, amode); av_free_ventry(ve); } if(res < 0) { errno = -res; return -1; } errno = errno_save; return 0; } static int copy_readlink(char *buf, size_t bsiz, const char *avbuf) { size_t nact; nact = strlen(avbuf); nact = AV_MIN(nact, bsiz); strncpy(buf, avbuf, nact); return (int) nact; } int virt_readlink(const char *path, char *buf, size_t bsiz) { int res; ventry *ve; char *avbuf; int errno_save = errno; res = av_get_ventry(path, 0, &ve); if(res == 0) { res = av_readlink(ve, &avbuf); if(res == 0) { res = copy_readlink(buf, bsiz, avbuf); av_free(avbuf); } av_free_ventry(ve); } if(res < 0) { errno = -res; return -1; } errno = errno_save; return res; } int virt_unlink(const char *path) { int res; ventry *ve; int errno_save = errno; res = av_get_ventry(path, 0, &ve); if(res == 0) { res = av_unlink(ve); av_free_ventry(ve); } if(res < 0) { errno = -res; return -1; } errno = errno_save; return 0; } int virt_rmdir(const char *path) { int res; ventry *ve; int errno_save = errno; res = av_get_ventry(path, 0, &ve); if(res == 0) { res = av_rmdir(ve); av_free_ventry(ve); } if(res < 0) { errno = -res; return -1; } errno = errno_save; return 0; } int virt_mkdir(const char *path, mode_t mode) { int res; ventry *ve; int errno_save = errno; res = av_get_ventry(path, 0, &ve); if(res == 0) { res = av_mkdir(ve, mode); av_free_ventry(ve); } if(res < 0) { errno = -res; return -1; } errno = errno_save; return 0; } int virt_mknod(const char *path, mode_t mode, dev_t dev) { int res; ventry *ve; int errno_save = errno; res = av_get_ventry(path, 0, &ve); if(res == 0) { res = av_mknod(ve, mode, dev); av_free_ventry(ve); } if(res < 0) { errno = -res; return -1; } errno = errno_save; return 0; } int virt_symlink(const char *path, const char *newpath) { int res; ventry *newve; int errno_save = errno; res = av_get_ventry(newpath, 0, &newve); if(res == 0) { res = av_symlink(path, newve); av_free_ventry(newve); } if(res < 0) { errno = -res; return -1; } errno = errno_save; return 0; } int virt_rename(const char *path, const char *newpath) { int res; ventry *ve; ventry *newve; int errno_save = errno; res = av_get_ventry(path, 0, &ve); if(res == 0) { res = av_get_ventry(newpath, 0, &newve); if(res == 0) { res = av_rename(ve, newve); av_free_ventry(newve); } av_free_ventry(ve); } if(res < 0) { errno = -res; return -1; } errno = errno_save; return 0; } int virt_link(const char *path, const char *newpath) { int res; ventry *ve; ventry *newve; int errno_save = errno; res = av_get_ventry(path, 0, &ve); if(res == 0) { res = av_get_ventry(newpath, 0, &newve); if(res == 0) { res = av_link(ve, newve); av_free_ventry(newve); } av_free_ventry(ve); } if(res < 0) { errno = -res; return -1; } errno = errno_save; return 0; } int virt_remove(const char *path) { struct stat stbuf; if(path != NULL) { if(virt_lstat(path, &stbuf) == 0) { if(S_ISDIR(stbuf.st_mode)) { return virt_rmdir(path); } else { return virt_unlink(path); } } } errno = EFAULT; return -1; } int virt_islocal(const char *path) { int res; ventry *ve; int errno_save = errno; int erg = 0; res = av_get_ventry(path, 0, &ve); if(res == 0) { if(ve->mnt->base == NULL) erg = 1; else erg = 0; av_free_ventry(ve); } if(res < 0) { errno = -res; return -1; } errno = errno_save; return erg; } avfs-1.1.4/src/exit.c0000644000175000001440000000156314032341001011266 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "exit.h" #include "avfs.h" struct exithandler { void (*func) (); struct exithandler *next; }; static AV_LOCK_DECL(exit_lock); static struct exithandler *exit_handlers = NULL; void av_do_exit() { struct exithandler *hand; AV_LOCK(exit_lock); for(hand = exit_handlers; hand != NULL; hand = exit_handlers) { exit_handlers = hand->next; hand->func(); av_free(hand); } AV_UNLOCK(exit_lock); } void av_add_exithandler(void (*func)()) { struct exithandler *hand; AV_NEW(hand); hand->func = func; AV_LOCK(exit_lock); hand->next = exit_handlers; exit_handlers = hand; AV_UNLOCK(exit_lock); } avfs-1.1.4/src/archive.c0000644000175000001440000003375414032341001011745 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "archint.h" #include "namespace.h" #include "filecache.h" #include "internal.h" #include "oper.h" static struct archent *arch_ventry_entry(ventry *ve) { return (struct archent *) ve->data; } static void arch_free_tree(struct entry *parent) { struct entry *ent; struct archnode *nod; ent = av_namespace_subdir(NULL, parent); while(ent != NULL) { struct entry *next; arch_free_tree(ent); next = av_namespace_next(ent); av_unref_obj(ent); ent = next; } nod = (struct archnode *) av_namespace_get(parent); av_unref_obj(nod); av_unref_obj(parent); } static void arch_delete(struct archive *arch) { struct entry *root; if(arch->ns != NULL) { root = av_namespace_subdir(arch->ns, NULL); arch_free_tree(root); av_unref_obj(root); av_unref_obj(arch->ns); } AV_FREELOCK(arch->lock); } static int arch_same(struct archive *arch, struct avstat *stbuf) { if(arch->st.ino == stbuf->ino && arch->st.dev == stbuf->dev && arch->st.size == stbuf->size && AV_TIME_EQ(arch->st.mtime, stbuf->mtime)) return 1; else return 0; } static int new_archive(ventry *ve, struct archive *arch) { int res; struct archparams *ap = (struct archparams *) ve->mnt->avfs->data; struct entry *root; struct avstat stbuf; arch->avfs = ve->mnt->avfs; if(!(ap->flags & ARF_NOBASE)) { res = av_getattr(ve->mnt->base, &arch->st, AVA_ALL & ~AVA_SIZE, 0); if(res < 0) return res; } arch->ns = av_namespace_new(); root = av_namespace_lookup(arch->ns, NULL, ""); av_arch_default_dir(arch, root); av_unref_obj(root); res = ap->parse(ap->data, ve, arch); if(res < 0) return res; if(!(ap->flags & ARF_NOBASE)) { /* The size is only requested _after_ the parse, so bzip2 & al. won't suffer. */ res = av_getattr(ve->mnt->base, &stbuf, AVA_SIZE, 0); if(res < 0) return res; } arch->st.size = stbuf.size; arch->flags |= ARCHF_READY; return 0; } static int check_archive(ventry *ve, struct archive *arch, int *neednew) { int res; struct archparams *ap = (struct archparams *) ve->mnt->avfs->data; struct avstat stbuf; int attrmask = AVA_INO | AVA_DEV | AVA_SIZE | AVA_MTIME; if((ap->flags & ARF_NOBASE) != 0) return 0; res = av_getattr(ve->mnt->base, &stbuf, attrmask, 0); if(res < 0) return res; if(!arch_same(arch, &stbuf)) *neednew = 1; return 0; } static struct archive *find_archive(const char *key) { struct archive *arch; static AV_LOCK_DECL(lock); AV_LOCK(lock); arch = (struct archive *) av_filecache_get(key); if(arch == NULL) { AV_NEW_OBJ(arch, arch_delete); AV_INITLOCK(arch->lock); arch->flags = 0; arch->ns = NULL; arch->numread = 0; av_filecache_set(key, arch); } AV_UNLOCK(lock); return arch; } static int get_archive(ventry *ve, struct archive **archp) { int res; char *key; struct archive *arch = NULL; int neednew; int tries; res = av_filecache_getkey(ve, &key); if(res < 0) return res; tries = 0; do { if(tries > 5) { av_log(AVLOG_ERROR, "ARCH: Giving up trying to create archive"); res = -EIO; break; } arch = find_archive(key); neednew = 0; AV_LOCK(arch->lock); if(!(arch->flags & ARCHF_READY)) res = new_archive(ve, arch); else res = check_archive(ve, arch, &neednew); if(res < 0 || neednew) { AV_UNLOCK(arch->lock); av_unref_obj(arch); av_filecache_set(key, NULL); } tries ++; } while(neednew); av_free(key); if(res < 0) return res; *archp = arch; return 0; } static int lookup_check_node(struct entry *ent, const char *name) { struct archnode *nod = (struct archnode *) av_namespace_get(ent); if(nod == NULL) return -ENOENT; if(name != NULL && !AV_ISDIR(nod->st.mode)) return -ENOTDIR; return 0; } static int arch_lookup(ventry *ve, const char *name, void **newp) { int res; int type; struct archent *ae = arch_ventry_entry(ve); struct entry *ent; struct archive *arch; if(ae == NULL) { if(name[0] != '\0') return -ENOENT; AV_NEW(ae); ae->ent = NULL; res = get_archive(ve, &arch); if(res < 0) { av_free(ae); return res; } ae->arch = arch; } else { arch = ae->arch; AV_LOCK(arch->lock); res = lookup_check_node(ae->ent, name); if(res < 0) { AV_UNLOCK(arch->lock); return res; } } ent = av_namespace_lookup_all(arch->ns, ae->ent, name); av_unref_obj(ae->ent); if(ent == NULL) { av_unref_obj(ae->arch); av_free(ae); ae = NULL; type = 0; } else { struct archnode *nod = (struct archnode *) av_namespace_get(ent); if(nod != NULL) type = AV_TYPE(nod->st.mode); else type = 0; ae->ent = ent; } AV_UNLOCK(arch->lock); *newp = ae; return type; } static void arch_putent(ventry *ve) { struct archent *ae = arch_ventry_entry(ve); av_unref_obj(ae->ent); av_unref_obj(ae->arch); av_free(ae); } static int arch_copyent(ventry *ve, void **resp) { struct archent *ae = arch_ventry_entry(ve); struct archent *nae; AV_NEW(nae); nae->ent = ae->ent; nae->arch = ae->arch; av_ref_obj(nae->ent); av_ref_obj(nae->arch); *resp = nae; return 0; } static int arch_getpath(ventry *ve, char **resp) { struct archent *ae = arch_ventry_entry(ve); *resp = av_namespace_getpath(ae->ent); return 0; } static int arch_real_open(int flags) { if((flags & AVO_DIRECTORY) == 0 && (flags & AVO_ACCMODE) != AVO_NOPERM) return 1; else return 0; } static void arch_do_close(struct archfile *fil, int realopen) { struct archive *arch = fil->arch; struct archparams *ap = (struct archparams *) arch->avfs->data; if(realopen) { if(fil->basefile != NULL) { arch->numread --; if(arch->numread == 0) { av_close(arch->basefile); arch->basefile = NULL; } } fil->nod->numopen --; if(fil->nod->numopen == 0 && ap->release != NULL) ap->release(arch, fil->nod); } av_unref_obj(fil->arch); av_unref_obj(fil->nod); av_unref_obj(fil->ent); av_unref_obj(fil->curr); av_free(fil); } static int arch_do_open(ventry *ve, int flags, avmode_t mode, void **resp) { int res; struct archent *ae = arch_ventry_entry(ve); struct archfile *fil; struct archnode *nod = (struct archnode *) av_namespace_get(ae->ent); struct archive *arch = ae->arch; struct archparams *ap = (struct archparams *) ve->mnt->avfs->data; vfile *basefile = NULL; int realopen; if(nod == NULL) return -ENOENT; if(AV_ISWRITE(flags)) return -EROFS; if((flags & AVO_DIRECTORY) != 0 && !AV_ISDIR(nod->st.mode)) return -ENOTDIR; realopen = arch_real_open(flags); if(realopen) { if(!(ap->flags & ARF_NOBASE)) { if(arch->basefile == NULL) { res = av_open(ve->mnt->base, AVO_RDONLY, 0, &arch->basefile); if(res < 0) return res; } arch->numread ++; basefile = arch->basefile; } nod->numopen ++; } AV_NEW(fil); fil->basefile = basefile; fil->arch = arch; fil->nod = nod; fil->data = NULL; if((flags & AVO_DIRECTORY)) fil->ent = ae->ent; else fil->ent = NULL; fil->curr = NULL; fil->currn = -1; av_ref_obj(fil->arch); av_ref_obj(fil->nod); av_ref_obj(fil->ent); if(realopen && ap->open != NULL) { res = ap->open(ve, fil); if(res < 0) { arch_do_close(fil, realopen); return res; } } *resp = fil; return 0; } static int arch_open(ventry *ve, int flags, avmode_t mode, void **resp) { int res; struct archent *ae = arch_ventry_entry(ve); struct archive *arch = ae->arch; AV_LOCK(arch->lock); res = arch_do_open(ve, flags, mode, resp); AV_UNLOCK(arch->lock); return res; } static int arch_close(vfile *vf) { int res; struct archfile *fil = arch_vfile_file(vf); struct archive *arch = fil->arch; struct archparams *ap = (struct archparams *) vf->mnt->avfs->data; int realopen = arch_real_open(vf->flags); AV_LOCK(arch->lock); if(realopen && ap->close != NULL) res = ap->close(fil); else res = 0; arch_do_close(fil, realopen); AV_UNLOCK(arch->lock); return res; } avssize_t av_arch_read(vfile *vf, char *buf, avsize_t nbyte) { int res; avoff_t realoff; struct archfile *fil = arch_vfile_file(vf); struct archnode *nod = fil->nod; avoff_t nact; if(AV_ISDIR(nod->st.mode)) return -EISDIR; if(nbyte == 0 || vf->ptr >= nod->realsize) return 0; realoff = vf->ptr + nod->offset; nact = AV_MIN((avoff_t)nbyte, (avoff_t) (nod->realsize - vf->ptr)); // due to the MIN, nact is not larger than the range of avsize_t res = av_pread(fil->basefile, buf, (avsize_t)nact, realoff); if(res > 0) vf->ptr += res; return res; } static avssize_t arch_read(vfile *vf, char *buf, avsize_t nbyte) { avssize_t res; struct archfile *fil = arch_vfile_file(vf); struct archive *arch = fil->arch; struct archparams *ap = (struct archparams *) vf->mnt->avfs->data; AV_LOCK(arch->lock); if(AV_ISDIR(fil->nod->st.mode)) res = -EISDIR; else res = ap->read(vf, buf, nbyte); AV_UNLOCK(arch->lock); return res; } static struct archnode *arch_special_entry(int n, struct entry *ent, char **namep) { struct archnode *nod; if(n == 0) { *namep = av_strdup("."); nod = (struct archnode *) av_namespace_get(ent); return nod; } else { struct entry *parent; *namep = av_strdup(".."); parent = av_namespace_parent(ent); if(parent != NULL) nod = (struct archnode *) av_namespace_get(parent); else nod = (struct archnode *) av_namespace_get(ent); av_unref_obj(parent); return nod; } } static struct archnode *arch_nth_entry(int n, struct archfile *fil, char **namep) { struct entry *ent; struct archnode *nod; if(n < 2) return arch_special_entry(n, fil->ent, namep); n -= 2; if(n == 0 || fil->currn != n - 1) ent = av_namespace_nth(NULL, fil->ent, n); else ent = av_namespace_next(fil->curr); av_unref_obj(fil->curr); fil->curr = ent; fil->currn = n; if(ent == NULL) return NULL; *namep = av_namespace_name(ent); nod = (struct archnode *) av_namespace_get(ent); return nod; } static int arch_readdir(vfile *vf, struct avdirent *buf) { int res; struct archfile *fil = arch_vfile_file(vf); struct archive *arch = fil->arch; struct archnode *nod; char *name; AV_LOCK(arch->lock); nod = arch_nth_entry(vf->ptr, fil, &name); if(nod == NULL) res = 0; else { buf->name = name; buf->ino = nod->st.ino; buf->type = AV_TYPE(nod->st.mode); vf->ptr ++; res = 1; } AV_UNLOCK(arch->lock); return res; } static int arch_getattr(vfile *vf, struct avstat *buf, int attrmask) { struct archfile *fil = arch_vfile_file(vf); struct archnode *nod = fil->nod; struct archive *arch = fil->arch; AV_LOCK(arch->lock); *buf = nod->st; AV_UNLOCK(arch->lock); return 0; } static int arch_access(ventry *ve, int amode) { if((amode & AVW_OK) != 0) return -EACCES; return 0; } static int arch_readlink(ventry *ve, char **bufp) { int res; struct archent *ae = arch_ventry_entry(ve); struct archnode *nod; struct archive *arch = ae->arch; AV_LOCK(arch->lock); nod = (struct archnode *) av_namespace_get(ae->ent); if(nod == NULL) res = -ENOENT; else if(!AV_ISLNK(nod->st.mode)) res = -EINVAL; else if(nod->linkname == NULL) { av_log(AVLOG_ERROR, "ARCH: linkname is NULL"); res = -EIO; } else { *bufp = av_strdup(nod->linkname); res = 0; } AV_UNLOCK(arch->lock); return res; } static void arch_destroy(struct avfs *avfs) { struct archparams *ap = (struct archparams *) avfs->data; av_unref_obj(ap->data); av_free(ap); } int av_archive_init(const char *name, struct ext_info *exts, int version, struct vmodule *module, struct avfs **avfsp) { int res; struct avfs *avfs; struct archparams *ap; res = av_new_avfs(name, exts, version, AVF_NOLOCK, module, &avfs); if(res < 0) return res; avfs->lookup = arch_lookup; avfs->putent = arch_putent; avfs->copyent = arch_copyent; avfs->getpath = arch_getpath; avfs->open = arch_open; avfs->close = arch_close; avfs->read = arch_read; avfs->readdir = arch_readdir; avfs->getattr = arch_getattr; avfs->access = arch_access; avfs->readlink = arch_readlink; avfs->destroy = arch_destroy; AV_NEW(ap); ap->data = NULL; ap->flags = 0; ap->parse = NULL; ap->open = NULL; ap->close = NULL; ap->read = av_arch_read; ap->release = NULL; avfs->data = ap; *avfsp = avfs; return 0; } avfs-1.1.4/src/tmpfile.c0000644000175000001440000000732314032341001011755 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi Copyright (C) 2006 Ralf Hoffmann (ralf@boomerangsworld.de) This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "internal.h" #include "config.h" #include #include #include #include #include #include #ifdef HAVE_SYS_STATVFS_H #include #endif struct tmpdir { char *path; int ctr; }; static AV_LOCK_DECL(tmplock); static struct tmpdir *tmpdir; static int unlink_recursive(const char *file) { int res; DIR *dirp; struct dirent *ent; char *name; res = unlink(file); if(res == 0) return 0; res = rmdir(file); if(res == 0) return 0; dirp = opendir(file); if(dirp == NULL) return -1; while((ent = readdir(dirp)) != NULL) { name = ent->d_name; if(name[0] != '.' || (name[1] && (name[1] != '.' || name[2]))) { char *newname; newname = av_stradd(NULL, file, "/", name, NULL); unlink_recursive(newname); av_free(newname); } } closedir(dirp); return rmdir(file); } void av_delete_tmpdir() { AV_LOCK(tmplock); if(tmpdir != NULL) { unlink_recursive(tmpdir->path); av_free(tmpdir->path); av_free(tmpdir); tmpdir = NULL; } AV_UNLOCK(tmplock); } #ifdef HAVE_MKDTEMP static int make_tmp_dir(char *path) { char *res; res = mkdtemp(path); if(res == NULL) { av_log(AVLOG_ERROR, "mkdtemp failed: %s", strerror(errno)); return -EIO; } return 0; } #else /* HAVE_MKDTEMP */ static int make_tmp_dir(char *path) { int res; mktemp(path); if(path[0] == '\0') { av_log(AVLOG_ERROR, "mktemp failed for temporary directory"); return -EIO; } res = mkdir(path, 0700); if(res == -1) { av_log(AVLOG_ERROR, "mkdir(%s) failed: %s", path, strerror(errno)); return -EIO; } return 0; } #endif /* HAVE_MKDTEMP */ int av_get_tmpfile(char **retp) { int res = 0; char buf[64]; AV_LOCK(tmplock); if(tmpdir == NULL) { char *path; path = av_strdup("/tmp/.avfs_tmp_XXXXXX"); res = make_tmp_dir(path); if(res < 0) av_free(path); else { AV_NEW(tmpdir); tmpdir->path = path; tmpdir->ctr = 0; } } if(tmpdir != NULL) { sprintf(buf, "/atmp%06i", tmpdir->ctr++); *retp = av_stradd(NULL, tmpdir->path, buf, NULL); } AV_UNLOCK(tmplock); return res; } void av_del_tmpfile(char *tmpf) { if(tmpf != NULL) { if(unlink(tmpf) == -1) rmdir(tmpf); av_free(tmpf); } } avoff_t av_tmp_free() { #ifdef HAVE_SYS_STATVFS_H int res; struct statvfs stbuf; #endif avoff_t freebytes = -1; #ifdef HAVE_SYS_STATVFS_H AV_LOCK(tmplock); if(tmpdir != NULL) { /* Check if fs supports df info (ramfs doesn't) */ res = statvfs(tmpdir->path, &stbuf); if(res != -1 && stbuf.f_blocks != 0) freebytes = (avoff_t) stbuf.f_bavail * (avoff_t) stbuf.f_frsize; } AV_UNLOCK(tmplock); #endif #if 0 if(freebytes != -1) av_log(AVLOG_DEBUG, "free bytes in tmp directory: %lli", freebytes); #endif return freebytes; } avoff_t av_tmpfile_blksize(const char *tmpf) { int res; struct stat stbuf; if(tmpf == NULL) return -1; res = stat(tmpf, &stbuf); if(res == 0) { /* Ramfs returns 0 diskusage */ if(stbuf.st_blocks == 0) return stbuf.st_size; else return stbuf.st_blocks * 512; } else return -1; } avfs-1.1.4/src/cache.c0000644000175000001440000002321314032341001011354 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi Copyright (C) 2006 Ralf Hoffmann (ralf@boomerangsworld.de) This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ /* TODO: Virtual filesystem where all the cached files can be found. There are two interfaces available: The av_cacheobj* functions are built around the cacheobj structure. The user holds the reference to it and can use it to access the stored object. The cache itself creates the cacheobj but doesn't hold a reference to it so it doesn't destroy the cacheobj but will unref the object stored in the cacheobj struct if the space is needed. The av_cache2* functions are built around the name as a key for stored object. The cacheobj is not return and the cache holds the only reference to it and will destroy it at some point. */ #include "cache.h" #include "internal.h" #include "exit.h" #include #include struct cacheobj { void *obj; avoff_t diskusage; char *name; struct cacheobj *next; struct cacheobj *prev; int internal_obj; }; #define MBYTE (1024 * 1024) static AV_LOCK_DECL(cachelock); static struct cacheobj cachelist; static avoff_t disk_cache_limit = 100 * MBYTE; static avoff_t disk_keep_free = 10 * MBYTE; static avoff_t disk_usage = 0; static int cache_clear(); static int cache_getfunc(struct entry *ent, const char *param, char **retp) { *retp = av_strdup(""); return 0; } static int cache_setfunc(struct entry *ent, const char *param, const char *val) { struct statefile *sf = (struct statefile *) av_namespace_get(ent); int (*func)() = (int (*)()) sf->data; if(strlen(val) > 0) return func(); return 0; } static int cache_getoff(struct entry *ent, const char *param, char **retp) { char buf[64]; struct statefile *sf = (struct statefile *) av_namespace_get(ent); avoff_t *offp = (avoff_t *) sf->data; AV_LOCK(cachelock); sprintf(buf, "%llu\n", *offp); AV_UNLOCK(cachelock); *retp = av_strdup(buf); return 0; } static int cache_setoff(struct entry *ent, const char *param, const char *val) { struct statefile *sf = (struct statefile *) av_namespace_get(ent); avoff_t *offp = (avoff_t *) sf->data; avoff_t offval; char *end; /* Make truncate work with fuse */ if(!val[0]) offval = 0; else { offval = strtoll(val, &end, 0); if(end == val) return -EINVAL; if(*end == '\n') end ++; if(*end != '\0') return -EINVAL; if(offval < 0) return -EINVAL; } AV_LOCK(cachelock); *offp = offval; AV_UNLOCK(cachelock); return 0; } /** * This is the exit handler to remove all temporary file stored * using the V2 interface */ static void destroy_cache() { struct cacheobj *cobj; AV_LOCK(cachelock); for(cobj = &cachelist; cobj->next != &cachelist; ) { if(cobj->next->internal_obj) { /* unref the internal objects which will remove it */ av_unref_obj(cobj->next); } else { /* this shouldn't happen, there shouldn't be * any external object left at exit */ cobj = cobj->next; } } AV_UNLOCK(cachelock); } void av_init_cache() { struct statefile statf; cachelist.next = &cachelist; cachelist.prev = &cachelist; statf.get = cache_getoff; statf.set = cache_setoff; statf.data = &disk_cache_limit; av_avfsstat_register("cache/limit", &statf); statf.data = &disk_keep_free; av_avfsstat_register("cache/keep_free", &statf); statf.set = NULL; statf.data = &disk_usage; av_avfsstat_register("cache/usage", &statf); statf.set = cache_setfunc; statf.get = cache_getfunc; statf.data = cache_clear; av_avfsstat_register("cache/clear", &statf); av_add_exithandler(destroy_cache); } static void cacheobj_remove(struct cacheobj *cobj) { struct cacheobj *next; struct cacheobj *prev; next = cobj->next; prev = cobj->prev; next->prev = prev; prev->next = next; } static void cacheobj_insert(struct cacheobj *cobj) { struct cacheobj *next; struct cacheobj *prev; next = cachelist.next; prev = &cachelist; next->prev = cobj; prev->next = cobj; cobj->next = next; cobj->prev = prev; } static void cacheobj_free(struct cacheobj *cobj) { av_unref_obj(cobj->obj); av_log(AVLOG_DEBUG, "got rid of cached object <%s> size %lli", cobj->name != NULL ? cobj->name : "?", cobj->diskusage); av_free(cobj->name); } /** * This is the destructor for external cacheobj's created * using the V1 interface */ static void cacheobj_delete(struct cacheobj *cobj) { AV_LOCK(cachelock); if(cobj->obj != NULL) { cacheobj_remove(cobj); disk_usage -= cobj->diskusage; } AV_UNLOCK(cachelock); if(cobj->obj != NULL) cacheobj_free(cobj); } /** * This is the destructor for internal cacheobj's created * using the V2 interface * Because of possible race conditions the object can only * by destroyed when holding the lock */ static void cacheobj_internal_delete(struct cacheobj *cobj) { if(cobj->obj != NULL) { cacheobj_remove(cobj); disk_usage -= cobj->diskusage; } AV_UNLOCK(cachelock); if(cobj->obj != NULL) cacheobj_free(cobj); AV_LOCK(cachelock); } struct cacheobj *av_cacheobj_new(void *obj, const char *name) { struct cacheobj *cobj; if(obj == NULL) return NULL; AV_NEW_OBJ(cobj, cacheobj_delete); cobj->obj = obj; cobj->diskusage = 0; cobj->name = av_strdup(name); cobj->internal_obj = 0; av_ref_obj(obj); AV_LOCK(cachelock); cacheobj_insert(cobj); AV_UNLOCK(cachelock); return cobj; } static int cache_free_one(struct cacheobj *skip_entry) { struct cacheobj *cobj; struct cacheobj tmpcobj; cobj = cachelist.prev; if(cobj == skip_entry) cobj = cobj->prev; if(cobj == &cachelist) return 0; if(cobj->internal_obj) { av_unref_obj(cobj); } else { cacheobj_remove(cobj); disk_usage -= cobj->diskusage; tmpcobj = *cobj; cobj->obj = NULL; AV_UNLOCK(cachelock); cacheobj_free(&tmpcobj); AV_LOCK(cachelock); } return 1; } static int cache_clear() { AV_LOCK(cachelock); while(cache_free_one(NULL)); AV_UNLOCK(cachelock); return 0; } static void cache_checkspace(int full, struct cacheobj *skip_entry) { avoff_t tmpfree; avoff_t limit; avoff_t keepfree; if(full) tmpfree = 0; else tmpfree = av_tmp_free(); /* If free space can't be determined, then it is taken to be infinite */ if(tmpfree == -1) tmpfree = AV_MAXOFF; keepfree = disk_keep_free; if(keepfree < 100 * 1024) keepfree = 100 * 1024; limit = disk_usage - disk_keep_free + tmpfree; if(disk_cache_limit < limit) limit = disk_cache_limit; while(disk_usage > limit) if(!cache_free_one(skip_entry)) break; } void av_cache_checkspace() { AV_LOCK(cachelock); cache_checkspace(0,NULL); AV_UNLOCK(cachelock); } void av_cache_diskfull() { AV_LOCK(cachelock); cache_checkspace(1,NULL); AV_UNLOCK(cachelock); } void av_cacheobj_setsize(struct cacheobj *cobj, avoff_t diskusage) { AV_LOCK(cachelock); if(cobj->obj != NULL && cobj->diskusage != diskusage) { disk_usage -= cobj->diskusage; cobj->diskusage = diskusage; disk_usage += cobj->diskusage; cache_checkspace(0, cobj); } AV_UNLOCK(cachelock); } void *av_cacheobj_get(struct cacheobj *cobj) { void *obj; if(cobj == NULL) return NULL; AV_LOCK(cachelock); obj = cobj->obj; if(obj != NULL) { cacheobj_remove(cobj); cacheobj_insert(cobj); av_ref_obj(obj); } AV_UNLOCK(cachelock); return obj; } static struct cacheobj *cacheobj2_find(const char *name) { struct cacheobj *cobj; for(cobj = cachelist.next; cobj != &cachelist; cobj = cobj->next) { if(cobj->internal_obj == 1) if(strcmp(cobj->name, name) == 0) break; } if(cobj->obj == NULL) return NULL; return cobj; } int av_cache2_set(void *obj, const char *name) { struct cacheobj *cobj, *oldcobj; if(obj != NULL) { AV_NEW_OBJ(cobj, cacheobj_internal_delete); cobj->obj = obj; cobj->diskusage = 0; cobj->name = av_strdup(name); cobj->internal_obj = 1; av_ref_obj(obj); } else { cobj = NULL; } AV_LOCK(cachelock); oldcobj = cacheobj2_find(name); if(oldcobj != NULL ) av_unref_obj(oldcobj); if(cobj != NULL) cacheobj_insert(cobj); AV_UNLOCK(cachelock); return 0; } void *av_cache2_get(const char *name) { struct cacheobj *cobj; void *obj = NULL; AV_LOCK(cachelock); cobj = cacheobj2_find(name); if(cobj != NULL) { cacheobj_remove(cobj); cacheobj_insert(cobj); obj = cobj->obj; av_ref_obj(obj); } AV_UNLOCK(cachelock); return obj; } void av_cache2_setsize(const char *name, avoff_t diskusage) { struct cacheobj *cobj; AV_LOCK(cachelock); cobj = cacheobj2_find(name); if(cobj->obj != NULL && cobj->diskusage != diskusage) { disk_usage -= cobj->diskusage; cobj->diskusage = diskusage; disk_usage += cobj->diskusage; cache_checkspace(0, cobj); } AV_UNLOCK(cachelock); } avfs-1.1.4/src/zread.c0000644000175000001440000005047214032341001011425 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "config.h" #include "zfile.h" #include "zlib.h" #include "oper.h" #include #include #define INDEXDISTANCE 1048576 #define INBUFSIZE 16384 #define OUTBUFSIZE 32768 /* This is the 'cost' of the restoration from the index cache */ #define ZCACHE_EXTRA_DIST 45000 /* It is not worth it to compress the state better */ #define STATE_COMPRESS_LEVEL 1 #define BI(ptr, i) ((avbyte) (ptr)[i]) #define DBYTE(ptr) (BI(ptr,0) | (BI(ptr,1)<<8)) #define QBYTE(ptr) ((avuint) (BI(ptr,0) | (BI(ptr,1)<<8) | \ (BI(ptr,2)<<16) | (BI(ptr,3)<<24))) struct streamcache { int id; z_stream s; int calccrc; int iseof; }; static struct streamcache scache; static int zread_nextid; static AV_LOCK_DECL(zread_lock); struct zindex { avoff_t offset; /* The number of output bytes */ avoff_t indexoffset; /* Offset in the indexfile */ avsize_t indexsize; /* Size of state record */ struct zindex *next; }; struct zcache { char *indexfile; avoff_t filesize; avoff_t nextindex; avoff_t size; int id; struct zindex *indexes; avmutex lock; int crc_ok; }; struct zfile { z_stream s; int iseof; int iserror; int id; /* Hack: the id of the last used zcache */ int calccrc; enum av_zfile_data_type data_type; avuint crc; vfile *infile; avoff_t dataoff; char inbuf[INBUFSIZE]; }; #define GZHEADER_SIZE 10 #define GZMAGIC1 0x1f #define GZMAGIC2 0x8b /* gzip flag byte */ #define GZFL_ASCII 0x01 /* bit 0 set: file probably ascii text */ #define GZFL_CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */ #define GZFL_EXTRA_FIELD 0x04 /* bit 2 set: extra field present */ #define GZFL_ORIG_NAME 0x08 /* bit 3 set: original file name present */ #define GZFL_COMMENT 0x10 /* bit 4 set: file comment present */ #define GZFL_RESERVED 0xE0 /* bits 5..7: reserved */ #define METHOD_DEFLATE 8 struct zfile_gzip_header_data { }; struct zfile_gzip_trailer_data { avuint crc; }; static int zfile_parse_gzip_header(struct zfile *fil, struct zfile_gzip_header_data *return_data); #ifndef USE_SYSTEM_ZLIB static int zfile_compress_state(char *state, int statelen, char **resp) { int res; z_stream s; int bufsize = sizeof(int) + statelen + statelen / 1000 + 1 + 12; char *cstate = av_malloc(bufsize); s.next_in = (Bytef*)state; s.avail_in = statelen; s.next_out = (Bytef*)( cstate + sizeof(int) ); s.avail_out = bufsize - sizeof(int); s.zalloc = NULL; s.zfree = NULL; ((int *) cstate)[0] = statelen; res = deflateInit(&s, STATE_COMPRESS_LEVEL); if(res != Z_OK) { av_log(AVLOG_ERROR, "ZFILE: compress state failed"); av_free(cstate); return -EIO; } res = deflate(&s, Z_FINISH); if(res != Z_STREAM_END) { av_log(AVLOG_ERROR, "ZFILE: compress state failed"); av_free(cstate); return -EIO; } res = deflateEnd(&s); if(res != Z_OK) { av_log(AVLOG_ERROR, "ZFILE: compress state failed"); av_free(cstate); return -EIO; } *resp = cstate; return sizeof(int) + s.total_out; } static int zfile_uncompress_state(char *cstate, int cstatelen, char **resp) { int res; z_stream s; int statelen = ((int *) cstate)[0]; char *state = av_malloc(statelen); s.next_in = (Bytef*)( cstate + sizeof(int) ); s.avail_in = cstatelen - sizeof(int); s.next_out = (Bytef*)state; s.avail_out = statelen; s.zalloc = NULL; s.zfree = NULL; res = inflateInit(&s); if(res != Z_OK) { av_log(AVLOG_ERROR, "ZFILE: compress state failed"); av_free(state); return -EIO; } res = inflate(&s, Z_FINISH); if(res != Z_STREAM_END) { av_log(AVLOG_ERROR, "ZFILE: compress state failed"); av_free(state); return -EIO; } res = inflateEnd(&s); if(res != Z_OK) { av_log(AVLOG_ERROR, "ZFILE: compress state failed"); av_free(state); return -EIO; } *resp = state; return 0; } #endif static void zfile_scache_cleanup(void) { inflateEnd(&scache.s); } static void zfile_scache_save(int id, z_stream *s, int calccrc, int iseof) { int res; if(id == 0 || iseof) { res = inflateEnd(s); if(res != Z_OK) { av_log(AVLOG_ERROR, "ZFILE: inflateEnd: %s (%i)", s->msg == NULL ? "" : s->msg, res); } return; } if(scache.id != 0) { res = inflateEnd(&scache.s); if(res != Z_OK) { av_log(AVLOG_ERROR, "ZFILE: inflateEnd: %s (%i)", scache.s.msg == NULL ? "" : scache.s.msg, res); } } if(scache.id == 0) atexit(zfile_scache_cleanup); scache.id = id; scache.s = *s; scache.calccrc = calccrc; scache.iseof = iseof; } static int zfile_reset(struct zfile *fil) { int res; /* FIXME: Is it a good idea to save the previous state or not? */ zfile_scache_save(fil->id, &fil->s, fil->calccrc, fil->iseof); memset(&fil->s, 0, sizeof(z_stream)); res = inflateInit2(&fil->s, -MAX_WBITS); if(res != Z_OK) { av_log(AVLOG_ERROR, "ZFILE: inflateInit: %s (%i)", fil->s.msg == NULL ? "" : fil->s.msg, res); return -EIO; } fil->s.adler = 0; fil->iseof = 0; fil->calccrc = 0; if (fil->data_type == AV_ZFILE_DATA_GZIP_ENCAPSULATED) { struct zfile_gzip_header_data header_data; res = zfile_parse_gzip_header(fil, &header_data); if (res != 0) { av_log(AVLOG_ERROR, "gzip header error"); fil->iserror = 1; } } return 0; } #ifndef USE_SYSTEM_ZLIB static int zfile_save_state(struct zcache *zc, char *state, int statesize, avoff_t offset) { int fd; int res; struct zindex **zp; struct zindex *zi; for(zp = &zc->indexes; *zp != NULL; zp = &(*zp)->next); fd = open(zc->indexfile, O_WRONLY | O_CREAT, 0600); if(fd == -1) { av_log(AVLOG_ERROR, "ZFILE: Error opening indexfile %s: %s", zc->indexfile, strerror(errno)); return -EIO; } lseek(fd, zc->filesize, SEEK_SET); res = write(fd, state, statesize); close(fd); if(res == -1) { av_log(AVLOG_ERROR, "ZFILE: Error writing indexfile %s: %s", zc->indexfile, strerror(errno)); return -EIO; } AV_NEW(zi); zi->offset = offset; zi->indexoffset = zc->filesize; zi->indexsize = statesize; zi->next = NULL; *zp = zi; zc->nextindex += INDEXDISTANCE; zc->filesize += statesize; return 0; } static int zfile_save_index(struct zfile *fil, struct zcache *zc) { int res; char *state; char *cstate; res = inflateSave(&fil->s, &state); if(res < 0) { av_log(AVLOG_ERROR, "ZFILE: inflateSave: (%i)", res); return -EIO; } res = zfile_compress_state(state, res, &cstate); free(state); if(res < 0) return res; res = zfile_save_state(zc, cstate, res, fil->s.total_out); av_free(cstate); return res; } static int zfile_seek_index(struct zfile *fil, struct zcache *zc, struct zindex *zi) { int fd; int res; char *cstate; char *state; /* FIXME: Is it a good idea to save the previous state or not? */ zfile_scache_save(fil->id, &fil->s, fil->calccrc, fil->iseof); memset(&fil->s, 0, sizeof(z_stream)); fd = open(zc->indexfile, O_RDONLY, 0); if(fd == -1) { av_log(AVLOG_ERROR, "ZFILE: Error opening indexfile %s: %s", zc->indexfile, strerror(errno)); return -EIO; } lseek(fd, zi->indexoffset, SEEK_SET); cstate = av_malloc(zi->indexsize); res = read(fd, cstate, zi->indexsize); close(fd); if(res != zi->indexsize) { av_free(cstate); av_log(AVLOG_ERROR, "ZFILE: Error in indexfile %s", zc->indexfile); return -EIO; } res = zfile_uncompress_state(cstate, zi->indexsize, &state); av_free(cstate); if(res < 0) return res; res = inflateRestore(&fil->s, state); av_free(state); if(res != Z_OK) { av_log(AVLOG_ERROR, "ZFILE: inflateRestore: (%i)", res); return -EIO; } fil->iseof = 0; fil->calccrc = 0; return 0; } static struct zindex *zcache_find_index(struct zcache *zc, avoff_t offset) { struct zindex *prevzi; struct zindex *zi; prevzi = NULL; for(zi = zc->indexes; zi != NULL; zi = zi->next) { if(zi->offset > offset) break; prevzi = zi; } return prevzi; } #endif static int zfile_fill_inbuf(struct zfile *fil) { avssize_t res; res = av_pread(fil->infile, fil->inbuf, INBUFSIZE, fil->s.total_in + fil->dataoff); if(res < 0) return res; fil->s.next_in = (Bytef*)( fil->inbuf ); fil->s.avail_in = res; return 0; } static int zfile_parse_gzip_header(struct zfile *fil, struct zfile_gzip_header_data *return_data) { int res = 0; if (fil->s.avail_in < GZHEADER_SIZE) { res = zfile_fill_inbuf(fil); if(res < 0) { return res; } } if (fil->s.avail_in < GZHEADER_SIZE) { return -EIO; } const unsigned char *buf = fil->s.next_in; if (buf[0] != GZMAGIC1 || buf[1] != GZMAGIC2) { av_log(AVLOG_ERROR, "ZREAD: File not in GZIP format"); return -EIO; } int method = buf[2]; int flags = buf[3]; avsize_t offset = GZHEADER_SIZE; if(method != METHOD_DEFLATE) { av_log(AVLOG_ERROR, "ZREAD: File compression is not DEFLATE"); return -EIO; } if ((flags & GZFL_CONTINUATION) != 0) { if(fil->s.avail_in < offset + 2) { return -EIO; } offset += 2; } if ((flags & GZFL_EXTRA_FIELD) != 0) { if(fil->s.avail_in < offset + 2) { return -EIO; } avsize_t len = DBYTE(&buf[offset]); if(fil->s.avail_in < offset + 2 + len) { return -EIO; } offset += 2 + len; } if ((flags & GZFL_ORIG_NAME) != 0) { int c; do { if(fil->s.avail_in < offset + 1) { return -EIO; } c = buf[offset]; offset++; } while (c != '\0'); } if ((flags & GZFL_COMMENT) != 0) { int c; do { if(fil->s.avail_in < offset + 1) { return -EIO; } c = buf[offset]; offset++; } while (c != '\0'); } fil->s.total_in += offset; fil->s.avail_in -= offset; fil->s.next_in += offset; return 0; } static int zfile_parse_gzip_trailer(struct zfile *fil, struct zfile_gzip_trailer_data *return_data) { if (fil->s.avail_in < 8) { int res = zfile_fill_inbuf(fil); if(res < 0) { return res; } if(fil->s.avail_in < 8) { return -EIO; } } // the last 8 bytes are the CRC and the uncompressed file size return_data->crc = QBYTE(fil->s.next_in); fil->s.total_in += 8; fil->s.avail_in -= 8; fil->s.next_in += 8; return 0; } static int zfile_reinit_state(struct zfile *fil) { avoff_t total_in = fil->s.total_in; Bytef *next_out = fil->s.next_out; avoff_t avail_out = fil->s.avail_out; avoff_t total_out = fil->s.total_out; int res = inflateEnd(&fil->s); if (res != Z_OK) { return -EIO; } memset(&fil->s, 0, sizeof(z_stream)); res = inflateInit2(&fil->s, -MAX_WBITS); if(res != Z_OK) { av_log(AVLOG_ERROR, "ZFILE: inflateInit: %s (%i)", fil->s.msg == NULL ? "" : fil->s.msg, res); return -EIO; } fil->s.adler = 0; fil->s.total_in = total_in; fil->s.avail_in = 0; fil->s.next_out = next_out; fil->s.avail_out = avail_out; fil->s.total_out = total_out; fil->iseof = 0; struct zfile_gzip_header_data header_data; res = zfile_parse_gzip_header(fil, &header_data); if (res != 0) { av_log(AVLOG_ERROR, "gzip header error"); return -EIO; } return 0; } static int zfile_inflate(struct zfile *fil, struct zcache *zc) { int res; unsigned char *start; if(fil->s.avail_in == 0) { res = zfile_fill_inbuf(fil); if(res < 0) return res; } start = fil->s.next_out; res = inflate(&fil->s, Z_NO_FLUSH); if(fil->calccrc) { AV_LOCK(zread_lock); if(zc->crc_ok) fil->calccrc = 0; AV_UNLOCK(zread_lock); if(fil->calccrc) fil->s.adler = crc32(fil->s.adler, start, fil->s.next_out - start); } if(res == Z_STREAM_END) { fil->iseof = 1; if (fil->data_type == AV_ZFILE_DATA_GZIP_ENCAPSULATED) { struct zfile_gzip_trailer_data trailer_data; int parse_res = zfile_parse_gzip_trailer(fil, &trailer_data); if (parse_res != 0) { return -EIO; } if (fil->calccrc) { fil->crc = trailer_data.crc; } } if(fil->calccrc && fil->s.adler != fil->crc) { av_log(AVLOG_ERROR, "ZFILE: CRC error"); return -EIO; } int crc_ok = 1; int cont = 0; // if data is gzip encapsulated and there is some data left, // reset deflate state and continue with next gzip member if (fil->data_type == AV_ZFILE_DATA_GZIP_ENCAPSULATED) { if (fil->s.avail_in > 3) { // check gzip method if (fil->s.next_in[2] == METHOD_DEFLATE) { int reinit_res = zfile_reinit_state(fil); if (reinit_res != 0) { return reinit_res; } crc_ok = 0; cont = 1; res = Z_OK; } } } AV_LOCK(zread_lock); if(fil->calccrc) zc->crc_ok = crc_ok; zc->size = fil->s.total_out; AV_UNLOCK(zread_lock); if (!cont) { return 0; } } if(res != Z_OK) { av_log(AVLOG_ERROR, "ZFILE: inflate: %s (%i)", fil->s.msg == NULL ? "" : fil->s.msg, res); return -EIO; } AV_LOCK(zread_lock); #ifdef USE_SYSTEM_ZLIB res = 0; #else if(fil->s.total_out >= zc->nextindex) res = zfile_save_index(fil, zc); else res = 0; #endif AV_UNLOCK(zread_lock); if(res < 0) return res; return 0; } static int zfile_read(struct zfile *fil, struct zcache *zc, char *buf, avsize_t nbyte) { int res; fil->s.next_out = (Bytef*)buf; fil->s.avail_out = nbyte; while(fil->s.avail_out != 0 && !fil->iseof) { res = zfile_inflate(fil, zc); if(res < 0) return res; } return nbyte - fil->s.avail_out; } static int zfile_skip_to(struct zfile *fil, struct zcache *zc, avoff_t offset) { int res; char outbuf[OUTBUFSIZE]; while(fil->s.total_out < offset && !fil->iseof) { /* FIXME: Maybe cache some data as well */ fil->s.next_out = (Bytef*)outbuf; fil->s.avail_out = AV_MIN(OUTBUFSIZE, offset - fil->s.total_out); res = zfile_inflate(fil, zc); if(res < 0) return res; } return 0; } #ifndef USE_SYSTEM_ZLIB static int zfile_seek(struct zfile *fil, struct zcache *zc, avoff_t offset) { struct zindex *zi; avoff_t curroff = fil->s.total_out; avoff_t zcdist; avoff_t scdist; avoff_t dist; if(offset >= curroff) dist = offset - curroff; else dist = -1; zi = zcache_find_index(zc, offset); if(zi != NULL) zcdist = offset - zi->offset + ZCACHE_EXTRA_DIST; else zcdist = offset; if(scache.id == zc->id && offset >= scache.s.total_out) { scdist = offset - scache.s.total_out; if((dist == -1 || scdist < dist) && scdist < zcdist) { z_stream tmp = fil->s; int tmpcc = fil->calccrc; int tmpiseof = fil->iseof; fil->s = scache.s; fil->s.avail_in = 0; fil->calccrc = scache.calccrc; fil->iseof = scache.iseof; scache.s = tmp; scache.calccrc = tmpcc; scache.iseof = tmpiseof; return 0; } } if(dist == -1 || zcdist < dist) { if(zi == NULL) return zfile_reset(fil); else return zfile_seek_index(fil, zc, zi); } return 0; } #endif static int zfile_goto(struct zfile *fil, struct zcache *zc, avoff_t offset) { int res; AV_LOCK(zc->lock); AV_LOCK(zread_lock); #ifdef USE_SYSTEM_ZLIB if ( offset < fil->s.total_out ) { res = zfile_reset(fil); } else res = 0; #else res = zfile_seek(fil, zc, offset); #endif AV_UNLOCK(zread_lock); if(res == 0) res = zfile_skip_to(fil, zc, offset); AV_UNLOCK(zc->lock); return res; } static avssize_t av_zfile_do_pread(struct zfile *fil, struct zcache *zc, char *buf, avsize_t nbyte, avoff_t offset) { avssize_t res; fil->id = zc->id; if(offset != fil->s.total_out) { res = zfile_goto(fil, zc, offset); if(res < 0) return res; } res = zfile_read(fil, zc, buf, nbyte); return res; } avssize_t av_zfile_pread(struct zfile *fil, struct zcache *zc, char *buf, avsize_t nbyte, avoff_t offset) { avssize_t res; if(fil->iserror) return -EIO; res = av_zfile_do_pread(fil, zc, buf, nbyte, offset); if(res < 0) fil->iserror = 1; return res; } int av_zfile_size(struct zfile *fil, struct zcache *zc, avoff_t *sizep) { int res; avoff_t size; AV_LOCK(zread_lock); size = zc->size; AV_UNLOCK(zread_lock); if(size != -1 || fil == NULL) { *sizep = size; return 0; } fil->id = zc->id; res = zfile_goto(fil, zc, AV_MAXOFF); if(res < 0) return res; AV_LOCK(zread_lock); size = zc->size; AV_UNLOCK(zread_lock); if(size == -1) { av_log(AVLOG_ERROR, "ZFILE: Internal error: could not find size"); return -EIO; } *sizep = size; return 0; } static void zfile_destroy(struct zfile *fil) { AV_LOCK(zread_lock); zfile_scache_save(fil->id, &fil->s, fil->calccrc, fil->iseof); AV_UNLOCK(zread_lock); } struct zfile *av_zfile_new(vfile *vf, avoff_t dataoff, avuint crc, enum av_zfile_data_type data_type) { int res; struct zfile *fil; AV_NEW_OBJ(fil, zfile_destroy); fil->iseof = 0; fil->iserror = 0; fil->infile = vf; fil->dataoff = dataoff; fil->id = 0; fil->crc = crc; fil->calccrc = 1; fil->data_type = data_type; memset(&fil->s, 0, sizeof(z_stream)); res = inflateInit2(&fil->s, -MAX_WBITS); if(res != Z_OK) { av_log(AVLOG_ERROR, "ZFILE: inflateInit: %s (%i)", fil->s.msg == NULL ? "" : fil->s.msg, res); fil->iserror = 1; } fil->s.adler = 0; if (fil->data_type == AV_ZFILE_DATA_GZIP_ENCAPSULATED) { struct zfile_gzip_header_data header_data; res = zfile_parse_gzip_header(fil, &header_data); if (res != 0) { av_log(AVLOG_ERROR, "gzip header error"); fil->iserror = 1; } } return fil; } static void zcache_destroy(struct zcache *zc) { struct zindex *zi; struct zindex *nextzi; AV_FREELOCK(zc->lock); av_del_tmpfile(zc->indexfile); for(zi = zc->indexes; zi != NULL; zi = nextzi) { nextzi = zi->next; av_free(zi); } } struct zcache *av_zcache_new() { struct zcache *zc; AV_NEW_OBJ(zc, zcache_destroy); zc->indexfile = NULL; zc->nextindex = INDEXDISTANCE; zc->indexes = NULL; zc->filesize = 0; zc->size = -1; zc->crc_ok = 0; AV_INITLOCK(zc->lock); AV_LOCK(zread_lock); if(zread_nextid == 0) zread_nextid = 1; zc->id = zread_nextid ++; AV_UNLOCK(zread_lock); av_get_tmpfile(&zc->indexfile); return zc; } avoff_t av_zcache_size(struct zcache *zc) { return zc->filesize; } avfs-1.1.4/src/modload.c0000644000175000001440000000526414032341001011736 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" #include #include #include #include #define MAX_MODULENAME 32 #define MODULEPREFIX "avfs_module_" #define MODULEPREFIXLEN 12 struct vmodule { void *handle; }; static void *load_module(const char *modname, const char *moduledir) { char *modpath; void *lib_handle; modpath = av_stradd(NULL, moduledir, "/", modname, NULL); lib_handle = dlopen(modpath, RTLD_NOW); if(lib_handle == NULL) av_log(AVLOG_ERROR, "load_module: %s", dlerror()); av_free(modpath); return lib_handle; } static void delete_module(struct vmodule *module) { dlclose(module->handle); } static int init_module(void *lib_handle, const char *initname) { int (*initfunc) (struct vmodule *); struct vmodule *module; int res; initfunc = (int (*)(struct vmodule *)) dlsym(lib_handle, initname); if(initfunc == NULL) { av_log(AVLOG_ERROR, "init_module: %s", dlerror()); return -EFAULT; } AV_NEW_OBJ(module, delete_module); module->handle = lib_handle; res = (*initfunc)(module); av_unref_obj(module); return res; } static char *get_modulename(const char *filename) { int i; if(strncmp(filename, MODULEPREFIX, MODULEPREFIXLEN) != 0) return NULL; filename += MODULEPREFIXLEN; for(i = 0; filename[i] && filename[i] != '.'; i++); if(strcmp(filename + i, ".so") != 0) return NULL; return av_strndup(filename, i); } static void check_moduledir_entry(const char *moduledir, const char *filename) { int res; char *modulename; void *lib_handle; modulename = get_modulename(filename); if(modulename == NULL) return; lib_handle = load_module(filename, moduledir); if(lib_handle != NULL) { char *initname; void *lib_handle = NULL; initname = av_stradd(NULL, "av_init_module_", modulename, NULL); res = init_module(lib_handle, initname); if(res < 0 && lib_handle != NULL) dlclose(lib_handle); av_free(initname); } av_free(modulename); } void av_init_dynamic_modules(void) { DIR *dirp; struct dirent *ent; char *moduledir; moduledir = av_get_config("moduledir"); if(moduledir == NULL) return; dirp = opendir(moduledir); if(dirp != NULL) { while((ent = readdir(dirp)) != NULL) check_moduledir_entry(moduledir, ent->d_name); closedir(dirp); } av_free(moduledir); } avfs-1.1.4/src/default.c0000644000175000001440000001032414032341001011734 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "internal.h" static void default_destroy(struct avfs *avfs) { } static int default_lookup(ventry *ve, const char *name, void **newp) { char *path = (char *) ve->data; if(path == NULL) path = av_strdup(name); else if(name == NULL || strcmp(name, "..") == 0) { char *s; s = strrchr(path, AV_DIR_SEP_CHAR); if(s == NULL) { av_free(path); path = NULL; } else *s = '\0'; } else if(strcmp(name, ".") != 0) path = av_stradd(path, AV_DIR_SEP_STR, name, NULL); *newp = path; return 0; } static void default_putent(ventry *ve) { char *path = (char *) ve->data; av_free(path); } static int default_copyent(ventry *ve, void **resp) { char *path = (char *) ve->data; *resp = (void *) av_strdup(path); return 0; } static int default_getpath(ventry *ve, char **resp) { char *path = (char *) ve->data; *resp = av_strdup(path); return 0; } static int default_access(ventry *ve, int amode) { return -EINVAL; } static int default_readlink(ventry *ve, char **bufp) { return -EINVAL; } static int default_symlink(const char *path, ventry *newve) { return -ENOSYS; } static int default_unlink(ventry *ve) { return -ENOSYS; } static int default_rmdir(ventry *ve) { return -ENOSYS; } static int default_mknod(ventry *ve, avmode_t mode, avdev_t dev) { return -ENOSYS; } static int default_mkdir(ventry *ve, avmode_t mode) { return -ENOSYS; } static int default_rename(ventry *ve, ventry *newve) { return -ENOSYS; } static int default_link(ventry *ve, ventry *newve) { return -ENOSYS; } static int default_open(ventry *ve, int flags, avmode_t mode, void **resp) { return -ENOSYS; } static int default_close(vfile *vf) { return 0; } static avssize_t default_read(vfile *vf, char *buf, avsize_t nbyte) { return -ENOSYS; } static avssize_t default_write(vfile *vf, const char *buf, avsize_t nbyte) { return -ENOSYS; } static int default_readdir(vfile *vf, struct avdirent *buf) { return -ENOSYS; } static int default_getattr(vfile *vf, struct avstat *buf, int attrmask) { return -ENOSYS; } static int default_setattr(vfile *vf, struct avstat *buf, int attrmask) { return -ENOSYS; } static int default_truncate(vfile *vf, avoff_t length) { return -ENOSYS; } static avoff_t get_size(vfile *vf) { int res; struct avfs *avfs = vf->mnt->avfs; struct avstat stbuf; res = avfs->getattr(vf, &stbuf, AVA_SIZE); if(res < 0) return res; return stbuf.size; } static avoff_t default_lseek(vfile *vf, avoff_t offset, int whence) { avoff_t res; switch(whence) { case AVSEEK_SET: res = offset; break; case AVSEEK_CUR: res = vf->ptr + offset; break; case AVSEEK_END: res = get_size(vf); if(res < 0) return res; res = res + offset; break; default: return -EINVAL; } if(res < 0) return -EINVAL; vf->ptr = res; return res; } void av_default_avfs(struct avfs *avfs) { avfs->destroy = default_destroy; avfs->lookup = default_lookup; avfs->putent = default_putent; avfs->copyent = default_copyent; avfs->getpath = default_getpath; avfs->access = default_access; avfs->readlink = default_readlink; avfs->symlink = default_symlink; avfs->unlink = default_unlink; avfs->rmdir = default_rmdir; avfs->mknod = default_mknod; avfs->mkdir = default_mkdir; avfs->rename = default_rename; avfs->link = default_link; avfs->open = default_open; avfs->close = default_close; avfs->read = default_read; avfs->write = default_write; avfs->readdir = default_readdir; avfs->getattr = default_getattr; avfs->setattr = default_setattr; avfs->truncate = default_truncate; avfs->lseek = default_lseek; } int av_avfs_implements_readdir( const struct avfs *avfs ) { if (!avfs) return 0; if (avfs->readdir != default_readdir) return 1; return 0; } avfs-1.1.4/src/local.c0000644000175000001440000002360614032341001011411 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "local.h" #include "version.h" #include #include #include #include #include #include #include struct localfile { int fd; DIR *dirp; avoff_t entctr; char *path; }; static struct localfile *local_vfile_file(vfile *vf) { return (struct localfile *) vf->data; } static int avoflags_to_oflags(int avflags) { int flags; flags = avflags & AVO_ACCMODE; if(avflags & AVO_CREAT) flags |= O_CREAT; if(avflags & AVO_EXCL) flags |= O_EXCL; if(avflags & AVO_TRUNC) flags |= O_TRUNC; if(avflags & AVO_APPEND) flags |= O_APPEND; if(avflags & AVO_NONBLOCK) flags |= O_NONBLOCK; #ifdef O_SYNC if(avflags & AVO_SYNC) flags |= O_SYNC; #endif return flags; } static int local_open(ventry *ve, int flags, avmode_t mode, void **resp) { struct localfile *fi; const char *path = (char *) ve->data; int fd; DIR *dirp; fd = -1; dirp = NULL; if((flags & AVO_ACCMODE) != AVO_NOPERM) { if(!(flags & AVO_DIRECTORY)) fd = open(path, avoflags_to_oflags(flags), mode); else dirp = opendir(path); if(fd == -1 && dirp == NULL) return -errno; if(fd != -1) av_registerfd(fd); } AV_NEW(fi); fi->fd = fd; fi->dirp = dirp; fi->entctr = 0; fi->path = av_strdup(path); *resp = fi; return 0; } static int local_close(vfile *vf) { int res = 0; struct localfile *fi = local_vfile_file(vf); if(fi->fd != -1) res = close(fi->fd); if(fi->dirp != NULL) res = closedir(fi->dirp); if(res == -1) res = -errno; av_free(fi->path); av_free(fi); return res; } static avssize_t local_read(vfile *vf, char *buf, avsize_t nbyte) { avssize_t res; struct localfile *fi = local_vfile_file(vf); res = read(fi->fd, buf, nbyte); if(res == -1) return -errno; vf->ptr += res; return res; } static avssize_t local_write(vfile *vf, const char *buf, avsize_t nbyte) { avssize_t res; struct localfile *fi = local_vfile_file(vf); res = write(fi->fd, buf, nbyte); if(res == -1) return -errno; /* NOTE: ptr will go astray if file is opened with O_APPEND */ vf->ptr += res; return res; } static avoff_t local_lseek(vfile *vf, avoff_t offset, int whence) { avoff_t res; struct localfile *fi = local_vfile_file(vf); res = lseek(fi->fd, offset, whence); if(res == -1) return -errno; vf->ptr = res; return res; } static int local_readdir(vfile *vf, struct avdirent *buf) { struct dirent *de; struct localfile *fi = local_vfile_file(vf); if(vf->ptr < fi->entctr) { rewinddir(fi->dirp); fi->entctr = 0; } do { errno = 0; de = readdir(fi->dirp); if(de == NULL) return -errno; fi->entctr ++; } while(vf->ptr >= fi->entctr); buf->name = av_strdup(de->d_name); buf->ino = de->d_ino; #ifdef HAVE_D_TYPE buf->type = de->d_type; #else buf->type = 0; #endif vf->ptr ++; return 1; } static int local_truncate(vfile *vf, avoff_t length) { int res; struct localfile *fi = local_vfile_file(vf); if(fi->fd != -1) res = ftruncate(fi->fd, length); else res = truncate(fi->path, length); if(res == -1) return -errno; return 0; } static void stat_to_avstat(struct avstat *vbuf, struct stat *lbuf) { vbuf->dev = lbuf->st_dev; vbuf->ino = lbuf->st_ino; vbuf->mode = lbuf->st_mode; vbuf->nlink = lbuf->st_nlink; vbuf->uid = lbuf->st_uid; vbuf->gid = lbuf->st_gid; vbuf->rdev = lbuf->st_rdev; vbuf->size = lbuf->st_size; vbuf->blksize = lbuf->st_blksize; vbuf->blocks = lbuf->st_blocks; vbuf->atime.sec = lbuf->st_atime; vbuf->atime.nsec = 0; vbuf->mtime.sec = lbuf->st_mtime; vbuf->mtime.nsec = 0; vbuf->ctime.sec = lbuf->st_ctime; vbuf->ctime.nsec = 0; } static int local_getattr(vfile *vf, struct avstat *buf, int attrmask) { int res; struct stat stbuf; struct localfile *fi = local_vfile_file(vf); if(fi->fd != -1) res = fstat(fi->fd, &stbuf); else if((vf->flags & AVO_NOFOLLOW) != 0) res = lstat(fi->path, &stbuf); else res = stat(fi->path, &stbuf); if(res == -1) return -errno; stat_to_avstat(buf, &stbuf); return 0; } static int local_set_time(struct localfile *fi, const struct avstat *buf, int attrmask) { struct utimbuf utbuf; utbuf.actime = buf->atime.sec; utbuf.modtime = buf->mtime.sec; if(!(attrmask & AVA_ATIME)) utbuf.actime = utbuf.modtime; if(!(attrmask & AVA_MTIME)) utbuf.modtime = utbuf.actime; return utime(fi->path, &utbuf); } static int local_set_mode(struct localfile *fi, avmode_t mode) { if(fi->fd != -1) return fchmod(fi->fd, mode); else return chmod(fi->path, mode); } static int local_set_ugid(struct localfile *fi, const struct avstat *buf, int attrmask, int flags) { uid_t uid = (uid_t) -1; gid_t gid = (gid_t) -1; if((attrmask & AVA_UID) != 0) uid = buf->uid; if((attrmask & AVA_GID) != 0) gid = buf->gid; if(fi->fd != -1) return fchown(fi->fd, uid, gid); else if((flags & AVO_NOFOLLOW) != 0) return lchown(fi->path, uid, gid); else return chown(fi->path, uid, gid); } static int local_setattr(vfile *vf, struct avstat *buf, int attrmask) { int res = 0; struct localfile *fi = local_vfile_file(vf); if((attrmask & (AVA_ATIME | AVA_MTIME)) != 0) res = local_set_time(fi, buf, attrmask); if((attrmask & AVA_MODE) != 0) res = local_set_mode(fi, buf->mode); if((attrmask & (AVA_UID | AVA_GID)) != 0) res = local_set_ugid(fi, buf, attrmask, vf->flags); if(res == -1) return -errno; return 0; } static int local_access(ventry *ve, int amode) { int res; const char *path = (char *) ve->data; res = access(path, amode); if(res == -1) return -errno; return 0; } static int local_readlink(ventry *ve, char **bufp) { int res; unsigned int bufsize; char *buf; const char *path = (char *) ve->data; bufsize = 0; buf = NULL; do { bufsize += 1024; buf = av_realloc(buf, bufsize + 1); res = readlink(path, buf, bufsize); if(res == -1) { av_free(buf); return -errno; } } while(res >= bufsize); buf[res] = '\0'; *bufp = buf; return 0; } static int local_unlink(ventry *ve) { int res; char *path = (char *) ve->data; res = unlink(path); if(res == -1) return -errno; return 0; } static int local_rmdir(ventry *ve) { int res; char *path = (char *) ve->data; res = rmdir(path); if(res == -1) return -errno; return 0; } static int local_mkdir(ventry *ve, avmode_t mode) { int res; char *path = (char *) ve->data; res = mkdir(path, mode); if(res == -1) return -errno; return 0; } static int local_mknod(ventry *ve, avmode_t mode, avdev_t dev) { int res; char *path = (char *) ve->data; res = mknod(path, mode, dev); if(res == -1) return -errno; return 0; } static int local_rename(ventry *ve, ventry *newve) { int res; char *path = (char *) ve->data; char *newpath = (char *) newve->data; res = rename(path, newpath); if(res == -1) return -errno; return 0; } static int local_link(ventry *ve, ventry *newve) { int res; char *path = (char *) ve->data; char *newpath = (char *) newve->data; res = link(path, newpath); if(res == -1) return -errno; return 0; } static int local_symlink(const char *path, ventry *newve) { int res; char *newpath = (char *) newve->data; res = symlink(path, newpath); if(res == -1) return -errno; return 0; } static int local_lookup(ventry *ve, const char *name, void **newp) { char *path = (char *) ve->data; if(path == NULL) { /* You can't access the local handler directly*/ return -ENOENT; } else if(name != NULL) { if(path[0] == '/' && path[1] == '\0' && name[0] == '/') path[0] = '\0'; path = av_stradd(path, name, NULL); } else { char *s; s = strrchr(path, AV_DIR_SEP_CHAR); if(s == NULL) { path[0] = '\0'; path = av_stradd(path, ".", NULL); } else if(s != path) s[0] = '\0'; else s[1] = '\0'; } *newp = path; return 0; } int av_init_module_local() { int res; int flags = AVF_NEEDSLASH | AVF_NOLOCK; struct avfs *avfs; res = av_new_avfs("local", NULL, AV_VER, flags, NULL, &avfs); if(res < 0) return res; avfs->lookup = local_lookup; avfs->open = local_open; avfs->close = local_close; avfs->read = local_read; avfs->write = local_write; avfs->lseek = local_lseek; avfs->readdir = local_readdir; avfs->access = local_access; avfs->getattr = local_getattr; avfs->setattr = local_setattr; avfs->readlink = local_readlink; avfs->unlink = local_unlink; avfs->rmdir = local_rmdir; avfs->mkdir = local_mkdir; avfs->mknod = local_mknod; avfs->rename = local_rename; avfs->link = local_link; avfs->symlink = local_symlink; avfs->truncate = local_truncate; av_add_avfs(avfs); return 0; } avfs-1.1.4/src/parse.c0000644000175000001440000005401714032341001011431 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi Copyright (C) 2006 Ralf Hoffmann (ralf@boomerangsworld.de) This program can be distributed under the terms of the GNU GPL. See the file COPYING. Path parser module */ #include "internal.h" #include "version.h" #include "local.h" #include "mod_static.h" #include "operutil.h" #include "oper.h" #include #include #include #include #include #include static AV_LOCK_DECL(initlock); static int inited; struct avfs_list { struct avfs *avfs; struct avfs_list *next; struct avfs_list *prev; }; static AV_LOCK_DECL(avfs_lock); static struct avfs_list avfs_list; static int symlink_rewrite = 0; struct parse_state { ventry *ve; char *path; char *prevseg; int islink; int resolvelast; int nextseg; int linkctr; int first_seg; /* true if no segment was analysed, see segment_len() comment */ }; static int copyrightstat_get(struct entry *ent, const char *param, char **retp) { char buf[256]; sprintf(buf, "AVFS Virtual File System (C) Miklos Szeredi 1998-2001, Version %i.%i.%i,\n" "AVFS comes with ABSOLUTELY NO WARRANTY.\n", AV_VER / 100, (AV_VER / 10) % 10, AV_VER % 10); *retp = av_strdup(buf); return 0; } static int modstat_get(struct entry *ent, const char *param, char **retp) { char *ret = av_strdup(""); char buf[128]; struct avfs_list *li; AV_LOCK(avfs_lock); for(li = avfs_list.next; li != &avfs_list; li = li->next) { struct avfs *avfs = li->avfs; struct ext_info *exts; int ei; int ver = avfs->version; sprintf(buf, "%2d.%d.%d\t", (ver / 100) % 100, (ver / 10) % 10, ver % 10); ret = av_stradd(ret, buf, avfs->name, ":\t", NULL); exts = avfs->exts; if(exts != NULL) for(ei = 0; exts[ei].from != NULL; ei++) { ret = av_stradd(ret, exts[ei].from, NULL); if(exts[ei].to != NULL) ret = av_stradd(ret, "(", exts[ei].to, ")", NULL); ret = av_stradd(ret, " ", NULL); } ret = av_stradd(ret, "\n", NULL); } AV_UNLOCK(avfs_lock); *retp = ret; return 0; } static int versionstat_get(struct entry *ent, const char *param, char **retp) { char buf[128]; char *compiledate; char *compilesys; char *moduledir; sprintf(buf, "%i.%i.%i", AV_VER / 100, (AV_VER / 10) % 10, AV_VER % 10); compiledate = av_get_config("compiledate"); compilesys = av_get_config("compilesystem"); moduledir = av_get_config("moduledir"); *retp = av_stradd(NULL, "Interface version: ", buf, "\nCompile date: ", compiledate, "\nCompile system: ", compilesys, "\nModule directory: ", moduledir, "\n", NULL); av_free(compiledate); av_free(compilesys); av_free(moduledir); return 0; } static int symlinkrewrite_get(struct entry *ent, const char *param, char **retp) { char buf[32]; AV_LOCK(avfs_lock); sprintf(buf, "%d\n", symlink_rewrite); AV_UNLOCK(avfs_lock); *retp = av_strdup(buf); return 0; } static int symlinkrewrite_set(struct entry *ent, const char *param, const char *val) { int mode; if(strlen(val) < 2) return -EINVAL; if(val[1] != '\n' && val[1] != ' ') return -EINVAL; if(val[0] == '0') mode = 0; else if(val[0] == '1') mode = 1; else return -EINVAL; AV_LOCK(avfs_lock); symlink_rewrite = mode; AV_UNLOCK(avfs_lock); return 0; } static void init_stats() { struct statefile statf; statf.data = NULL; statf.set = NULL; statf.get = copyrightstat_get; av_avfsstat_register("copyright", &statf); statf.get = modstat_get; av_avfsstat_register("modules", &statf); statf.get = versionstat_get; av_avfsstat_register("version", &statf); statf.get = symlinkrewrite_get; statf.set = symlinkrewrite_set; av_avfsstat_register("symlink_rewrite", &statf); } static void destroy() { av_log(AVLOG_DEBUG, "DESTROY"); AV_LOCK(initlock); if(inited) { av_close_all_files(); AV_LOCK(avfs_lock); while(avfs_list.next != &avfs_list) { struct avfs_list *li = avfs_list.next; li->next->prev = li->prev; li->prev->next = li->next; av_unref_obj(li->avfs); av_free(li); } AV_UNLOCK(avfs_lock); av_do_exit(); av_delete_tmpdir(); inited = 0; } AV_UNLOCK(initlock); av_check_malloc(); av_log(AVLOG_DEBUG, "DESTROY successful"); } static int init() { int res = 0; AV_LOCK(initlock); if(!inited) { av_log(AVLOG_DEBUG, "INIT"); avfs_list.next = &avfs_list; avfs_list.prev = &avfs_list; res = av_init_module_local(); if(res == 0) { av_init_avfsstat(); av_init_static_modules(); av_init_dynamic_modules(); av_init_logstat(); init_stats(); av_init_cache(); av_init_filecache(); atexit(destroy); inited = 1; av_log(AVLOG_DEBUG, "INIT successful"); } else av_log(AVLOG_DEBUG, "INIT failed"); } AV_UNLOCK(initlock); return res; } void av_add_avfs(struct avfs *newavfs) { struct avfs_list *li; AV_NEW(li); AV_LOCK(avfs_lock); li->avfs = newavfs; li->next = &avfs_list; li->prev = avfs_list.prev; avfs_list.prev = li; li->prev->next = li; AV_UNLOCK(avfs_lock); } static int av_copy_parsestate(struct parse_state *ps, struct parse_state *destps) { destps->linkctr = ps->linkctr; destps->nextseg = ps->nextseg; destps->resolvelast = ps->resolvelast; destps->islink = ps->islink; if(ps->path) destps->path = av_strdup(ps->path); else destps->path = NULL; destps->first_seg = ps->first_seg; if(ps->prevseg) destps->prevseg = av_strdup(ps->prevseg); else destps->prevseg = NULL; av_copy_ventry(ps->ve, &(destps->ve)); return 0; } static void set_prevseg(struct parse_state *ps, const char *name) { av_free(ps->prevseg); ps->prevseg = av_strdup(name); } static int lookup_virtual(struct parse_state *ps, const char *name) { int res; ventry *ve = ps->ve; struct avfs *avfs = ve->mnt->avfs; void *newdata; AVFS_LOCK(avfs); res = avfs->lookup(ve, name, &newdata); AVFS_UNLOCK(avfs); if(res < 0) return res; ve->data = newdata; if(ve->data != NULL) { if(res == (AV_IFLNK >> 12)) ps->islink = 1; res = 0; } else { ps->ve = ve->mnt->base; ve->mnt->base = NULL; av_free_ventry(ve); res = lookup_virtual(ps, NULL); } return res; } static struct avmount *new_mount(ventry *base, struct avfs *avfs, const char *opts) { struct avmount *mnt; AV_NEW(mnt); mnt->base = base; mnt->avfs = avfs; mnt->opts = av_strdup(opts); mnt->flags = 0; return mnt; } static int is_root(ventry *ve) { char *path; struct stat pathstat; struct stat rootstat; int res; if(ve->mnt->base != NULL) return 0; for(path = (char *) ve->data; *path == AV_DIR_SEP_CHAR; path++); if(!*path) return 1; res = stat((char *) ve->data, &pathstat); if(res == -1) return 0; res = stat("/", &rootstat); if(res == -1) return 0; if(rootstat.st_dev == pathstat.st_dev && rootstat.st_ino == pathstat.st_ino) return 1; return 0; } static int enter_mount(struct parse_state *ps, struct avfs *avfs, const char *opts, const char *param) { int res; ventry *newve; AV_NEW(newve); newve->mnt = new_mount(ps->ve, avfs, opts); newve->data = NULL; ps->ve = newve; if((avfs->flags & AVF_ONLYROOT) != 0 && !is_root(ps->ve->mnt->base)) return -ENOENT; res = lookup_virtual(ps, param); return res; } static struct ext_info *find_ext(struct ext_info *exts, const char *prevseg) { int ei; unsigned int prevseglen = strlen(prevseg); for(ei = 0; exts[ei].from != NULL; ei++) { unsigned int extlen = strlen(exts[ei].from); if(prevseglen >= extlen) { const char *prevsegext = prevseg + prevseglen - extlen; if(strncasecmp(prevsegext, exts[ei].from, extlen) == 0) return &exts[ei]; } } return NULL; } static struct avfs *find_auto_avfs(const char *prevseg, struct ext_info **extp) { struct ext_info *exts; struct avfs_list *li; for(li = avfs_list.next; li != &avfs_list; li = li->next) { exts = li->avfs->exts; if(exts != NULL) { struct ext_info *e; e = find_ext(exts, prevseg); if(e != NULL) { *extp = e; return li->avfs; } } } return NULL; } static void get_new_name(struct parse_state *ps, struct ext_info *ext) { unsigned int extlen = strlen(ext->from); unsigned int prevseglen = strlen(ps->prevseg); ps->prevseg[prevseglen - extlen] = '\0'; if(ext->to != NULL) ps->prevseg = av_stradd(ps->prevseg, ext->to, NULL); } static bool avfs_is_filter_like( struct avfs *avfs ) { if (avfs->flags & AVF_ONLYROOT) { return false; } if (av_avfs_implements_readdir(avfs)) { return false; } return true; } static int lookup_auto_avfs(struct parse_state *ps, const char *opts, const char *param) { int res; struct avfs *avfs; struct ext_info *ext = NULL; AV_LOCK(avfs_lock); avfs = find_auto_avfs(ps->prevseg, &ext); if(avfs == NULL) res = -ENOENT; else { av_ref_obj(avfs); get_new_name(ps, ext); // repeat searching for next avfs if the current avfs is a // filter. Otherwise it does not make sense to use another // avfs. Dir-based vfs need to be entered first. if(!avfs_is_filter_like(avfs) || find_auto_avfs(ps->prevseg, &ext) == NULL) { set_prevseg(ps, ""); } else { param = ""; ps->nextseg = 0; } res = 0; } AV_UNLOCK(avfs_lock); if(res == 0) { res = enter_mount(ps, avfs, opts, param); if(res == 0) ps->ve->mnt->flags = 1; } return res; } static int is_handler_char(int ch) { return isalpha(ch) || isdigit(ch) || ch == '_'; } static struct avfs *find_avfs_name(char *name) { struct avfs_list *li; if(!*name) return NULL; AV_LOCK(avfs_lock); for(li = avfs_list.next; li != &avfs_list; li = li->next) if(li->avfs->name != NULL && strcmp(li->avfs->name, name) == 0) { av_ref_obj(li->avfs); break; } AV_UNLOCK(avfs_lock); return li->avfs; } static int is_special(const char *name) { if(name[0] == '.' && (name[1] == '\0' || (name[1] == '.' && name[2] == '\0'))) return 1; return 0; } static int lookup_avfs(struct parse_state *ps, char *name) { int res; char c; char *s; char *opts; const char *param; struct avfs *avfs; if(is_special(ps->prevseg)) return -ENOENT; for(s = name; *s && is_handler_char(*s); s++); opts = s; for(; *s && *s != ':'; s++); c = *s; if(*s == ':') { *s = '\0'; param = s + 1; if(*param == '\0' || *param == AV_DIR_SEP_CHAR) return -ENOENT; } else param = ""; if(name == opts) { res = lookup_auto_avfs(ps, opts, param); *s = c; return res; } c = *opts; *s = '\0'; avfs = find_avfs_name(name); *opts = c; if(avfs == NULL) return -ENOENT; res = enter_mount(ps, avfs, opts, param); set_prevseg(ps, ""); return res; } static int lookup_segment(struct parse_state *ps, int noavfs) { int res; char *name = ps->path; ventry *ve = ps->ve; /* only enter next avfs hierarchie if the magic char is not the very first char (first_seg) and we really want this action (noavfs needed by segment_islocal() test */ if((name[0] == AVFS_SEP_CHAR) && (noavfs == 0) && (ps->first_seg == 0)) res = lookup_avfs(ps, name+1); else { /* reset first_seg as we now process a path segment and from now on the next magic char is always the magic char and not from a local filename */ ps->first_seg = 0; for(;*name && *name == AV_DIR_SEP_CHAR; name++); set_prevseg(ps, name); if((ve->mnt->avfs->flags & AVF_NEEDSLASH) != 0) name = ps->path; if(name[0] != '\0') res = lookup_virtual(ps, name); else res = 0; } return res; } static int segment_islocal(struct parse_state *ps, unsigned int seglen ) { int islocal = 0; //char c; struct parse_state tempps; int f; /* we will copy the whole parse_state and try to find a local entry if open succeed there is a local file and we can return true */ av_copy_parsestate( ps, &tempps ); tempps.nextseg = seglen; //c = tempps.path[seglen]; tempps.path[seglen] = '\0'; /* we force lookup_segment() to not enter any avfs hierarchie */ lookup_segment(&tempps, 1); f = av_fd_open_entry(tempps.ve, AVO_RDONLY, 0); av_free_ventry(tempps.ve); av_free(tempps.path); av_free(tempps.prevseg); if ( f >= 0 ) { islocal = 1; av_fd_close(f); } return islocal; } static unsigned int segment_len(struct parse_state *ps, int ignoreMagic) { const char *s = ps->path, *first_s = ps->path; unsigned int seglen, orig_seglen; int found_magic = 0, search_avfs_key = 0; /* this function will find the next segment len by also checking for local files with magic chars inside the filename two cases: 1.magic at the beginning: in this case we are searching for an avfs key (#utar, #ugz...) so we will stop at the next magic char or dir separator except when this magic char is the very first character where it makes no sense to accept this as an avfs key (imagine open("#utar")) For this case there is a new flag first_seg which takes care of this 2.Otherwise we are searching for the longest path segment starting at the next dir separator skipping any magic char we stop after first local hit If no local file was found we return whole segment len to be able to open new files with magic chars If no magic char was found or we are forced to ignore it we immediately return the whole path segment without any checking */ if(s[0] == AVFS_SEP_CHAR) { s++; if(ps->first_seg == 0) search_avfs_key = 1; } else while(*s == AV_DIR_SEP_CHAR) s++; while(*s && *s != AV_DIR_SEP_CHAR) { if(*s == AVFS_SEP_CHAR) { if(found_magic == 0) { first_s = s; } found_magic++; } s++; } seglen = s - ps->path; if((ignoreMagic == 1) || (found_magic == 0)) return seglen; /* a magic char was already found so first_s is correct */ if(search_avfs_key == 1) return (first_s - ps->path); orig_seglen = seglen; /* found magic char so check for existing local file */ while(seglen > 0) { if(segment_islocal(ps, seglen) == 1) break; for(seglen = seglen - 1; (seglen > 0) && ( ps->path[seglen] != AVFS_SEP_CHAR ); seglen--); } if(seglen > 0) return seglen; else return orig_seglen; } static int is_last(struct parse_state *ps, unsigned int seglen) { const char *s; for(s = ps->path + seglen; *s && *s == AV_DIR_SEP_CHAR; s++); if(!*s) return 1; else return 0; } static struct avfs *get_local_avfs() { struct avfs *localavfs; AV_LOCK(avfs_lock); localavfs = avfs_list.next->avfs; av_ref_obj(localavfs); AV_UNLOCK(avfs_lock); return localavfs; } static int parse_path(struct parse_state *ps, int force_localfile); static int follow_link(struct parse_state *ps) { int res; struct parse_state linkps; char *buf; if(!ps->linkctr) return -ELOOP; res = av_readlink(ps->ve, &buf); if(res < 0) return res; linkps.path = buf; linkps.resolvelast = 1; linkps.linkctr = ps->linkctr - 1; if(buf[0] != AV_DIR_SEP_CHAR) { linkps.ve = ps->ve; res = lookup_virtual(&linkps, NULL); if(res == 0) res = parse_path(&linkps, 0); } else { av_free_ventry(ps->ve); AV_NEW(linkps.ve); linkps.ve->mnt = new_mount(NULL, get_local_avfs(), NULL); linkps.ve->data = av_strdup(""); res = parse_path(&linkps, 0); } av_free(buf); ps->ve = linkps.ve; return res; } static int parse_path(struct parse_state *ps, int force_localfile) { int res = 0; int numseg = 0; ps->prevseg = av_strdup(""); ps->first_seg = 1; while(ps->path[0]) { unsigned int seglen; int lastseg; char c; seglen = segment_len(ps, force_localfile); lastseg = is_last(ps, seglen); ps->nextseg = seglen; c = ps->path[seglen]; ps->path[seglen] = '\0'; ps->islink = 0; res = lookup_segment(ps,0); if(res < 0) break; if(ps->islink && (ps->resolvelast || !lastseg)) { res = follow_link(ps); if(res < 0) break; } ps->path[seglen] = c; ps->path += ps->nextseg; numseg ++; if(numseg > 1000) { av_log(AVLOG_ERROR, "Infinate loop in parse_path"); res = -EFAULT; break; } } av_free(ps->prevseg); return res; } int av_get_ventry(const char *path, int resolvelast, ventry **resp) { int res; struct parse_state ps; char *copypath; res = init(); if(res < 0) return res; if(path == NULL) return -ENOENT; copypath = av_strdup(path); ps.path = copypath; ps.resolvelast = resolvelast; ps.linkctr = 10; AV_NEW(ps.ve); ps.ve->mnt = new_mount(NULL, get_local_avfs(), NULL); ps.ve->data = av_strdup(""); res = parse_path(&ps, 0); /* no ventry so force localfile to be able to create files with the magic character inside filename */ if(res < 0) { av_free(copypath); copypath = av_strdup(path); av_free_ventry(ps.ve); ps.path = copypath; ps.resolvelast = resolvelast; ps.linkctr = 10; AV_NEW(ps.ve); ps.ve->mnt = new_mount(NULL, get_local_avfs(), NULL); ps.ve->data = av_strdup(""); res = parse_path(&ps, 1); } if(res < 0) { av_free_ventry(ps.ve); *resp = NULL; } else *resp = ps.ve; av_free(copypath); return res; } int av_copy_vmount(struct avmount *mnt, struct avmount **resp) { int res; ventry *newbase; if(mnt->base != NULL) { res = av_copy_ventry(mnt->base, &newbase); if(res < 0) return res; } else newbase = NULL; av_ref_obj(mnt->avfs); *resp = new_mount(newbase, mnt->avfs, mnt->opts); return 0; } int av_copy_ventry(ventry *ve, ventry **resp) { int res; ventry *newve; struct avmount *newmnt; void *newdata; struct avfs *avfs = ve->mnt->avfs; res = av_copy_vmount(ve->mnt, &newmnt); if(res < 0) return res; if(ve->data != NULL) { AVFS_LOCK(avfs); res = avfs->copyent(ve, &newdata); AVFS_UNLOCK(avfs); if(res < 0) return res; } else newdata = NULL; AV_NEW(newve); newve->data = newdata; newve->mnt = newmnt; *resp = newve; return 0; } void av_free_vmount(struct avmount *mnt) { av_unref_obj(mnt->avfs); av_free(mnt->opts); av_free_ventry(mnt->base); av_free(mnt); } void av_free_ventry(ventry *ve) { if(ve != NULL) { struct avfs *avfs = ve->mnt->avfs; if(ve->data != NULL) { AVFS_LOCK(avfs); avfs->putent(ve); AVFS_UNLOCK(avfs); } av_free_vmount(ve->mnt); av_free(ve); } } static int ipath_len(const char *s) { int cnt; for(cnt = 0; *s; s++, cnt++); return cnt; } static void ipath_copy(char *dst, const char *src) { for(; *src; dst++, src++) { *dst = *src; } *dst = '\0'; } static char *expand_segment(char *segment) { char *tmp; tmp = (char *) av_malloc(ipath_len(segment) + 1); ipath_copy(tmp, segment); av_free(segment); return tmp; } static int add_segment(ventry *ve, char **pathp) { int res; char *segment; struct avfs *avfs = ve->mnt->avfs; if(ve->data != NULL) { AVFS_LOCK(avfs); res = avfs->getpath(ve, &segment); AVFS_UNLOCK(avfs); if(res < 0) return res; } else segment = av_strdup(""); if(ve->mnt->base == NULL) *pathp = av_stradd(*pathp, segment, NULL); else { char *avfsname = avfs->name; char *opts = ve->mnt->opts; char avfssep[] = { AVFS_SEP_CHAR, '\0' }; const char *paramsep; if(segment[0] && segment[0] != AV_DIR_SEP_CHAR) paramsep = ":"; else paramsep = ""; segment = expand_segment(segment); *pathp = av_stradd(*pathp, avfssep, avfsname, opts, paramsep, segment, NULL); } av_free(segment); return 0; } int av_generate_path(ventry *ve, char **pathp) { int res; if(ve == NULL) *pathp = NULL; else { res = av_generate_path(ve->mnt->base, pathp); if(res < 0) return res; res = add_segment(ve, pathp); if(res < 0) { av_free(*pathp); return res; } } return 0; } int av_get_symlink_rewrite() { return symlink_rewrite; } avfs-1.1.4/src/sysdeps.c0000644000175000001440000001443314032341001012007 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-1999 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "internal.h" #include "config.h" #include "info.h" #include #include #include #include #include #include #include #include #include #include #ifdef MAJOR_IN_MKDEV #include #endif #ifdef MAJOR_IN_SYSMACROS #include #endif #define DEFAULT_LOGMASK (AVLOG_ERROR | AVLOG_WARNING) static int loginited; static int logmask; static char *logfile; static int logfd; static AV_LOCK_DECL(loglock); static int debug_get(struct entry *ent, const char *param, char **retp) { char buf[32]; AV_LOCK(loglock); sprintf(buf, "%02o\n", logmask); AV_UNLOCK(loglock); *retp = av_strdup(buf); return 0; } static int debug_set(struct entry *ent, const char *param, const char *val) { int mask; if(val[0] < '0' || val[0] > '7' || val[1] < '0' || val[1] > '7' || (val[2] != '\0' && !isspace((int) val[2]))) return -EIO; mask = (val[0] - '0') * 8 + (val[1] - '0'); AV_LOCK(loglock); logmask = mask; AV_UNLOCK(loglock); return 0; } static void log_open() { if(logfile != NULL) { if(strcmp(logfile, "-") == 0) logfd = STDERR_FILENO; else logfd = open(logfile, O_WRONLY | O_APPEND | O_CREAT, 0600); } else { openlog("avfs", LOG_CONS | LOG_PID, LOG_USER); } } static void log_close() { if(logfile != NULL) { if(strcmp(logfile, "-") != 0 && logfd != -1) close(logfd); } else { closelog(); } } static void log_init() { char *logenv; logmask = DEFAULT_LOGMASK; logenv = getenv("AVFS_DEBUG"); if(logenv != NULL && logenv[0] >= '0' && logenv[0] <= '7' && logenv[1] >= '0' && logenv[1] <= '7' && logenv[2] == '\0') logmask = (logenv[0] - '0') * 8 + (logenv[1] - '0'); logfile = getenv("AVFS_LOGFILE"); log_open(); loginited = 1; } static int logfile_get(struct entry *ent, const char *param, char **retp) { char *s; AV_LOCK(loglock); if(logfile != NULL) s = av_stradd(NULL, logfile, "\n", NULL); else s = av_strdup(""); AV_UNLOCK(loglock); *retp = s; return 0; } static int logfile_set(struct entry *ent, const char *param, const char *val) { char *s; unsigned int len; s = av_strdup(val); len = strlen(s); if(len > 0 && s[len-1] == '\n') s[len-1] = '\0'; if(s[0] == '\0') { av_free(s); s = NULL; } AV_LOCK(loglock); log_close(); av_free(logfile); logfile = s; log_open(); AV_UNLOCK(loglock); return 0; } #define LOGMSG_SIZE 1024 static void filelog(const char *msg) { char buf[LOGMSG_SIZE + 128]; if(logfd != -1) { struct avtm tmbuf; av_localtime(time(NULL), &tmbuf); sprintf(buf, "%02i/%02i %02i:%02i:%02i avfs[%lu]: %s\n", tmbuf.mon + 1, tmbuf.day, tmbuf.hour, tmbuf.min, tmbuf.sec, (unsigned long) getpid(), msg); write(logfd, buf, strlen(buf)); } } void av_init_logstat() { struct statefile statf; if(!loginited) log_init(); statf.data = NULL; statf.get = debug_get; statf.set = debug_set; av_avfsstat_register("debug", &statf); statf.get = logfile_get; statf.set = logfile_set; av_avfsstat_register("logfile", &statf); } void av_log(int type, const char *format, ...) { va_list ap; char buf[LOGMSG_SIZE+1]; AV_LOCK(loglock); if(!loginited) log_init(); if((type & logmask) == 0) { AV_UNLOCK(loglock); return; } va_start(ap, format); #ifdef HAVE_VSNPRINTF vsnprintf(buf, LOGMSG_SIZE, format, ap); #else strncpy(buf, format, LOGMSG_SIZE); #endif buf[LOGMSG_SIZE] = '\0'; va_end(ap); if(logfile == NULL) syslog(LOG_INFO, "%s", buf); else filelog(buf); AV_UNLOCK(loglock); } avdev_t av_mkdev(int major, int minor) { return makedev(major, minor); } void av_splitdev(avdev_t dev, int *majorp, int *minorp) { *majorp = major(dev); *minorp = minor(dev); } char *av_get_config(const char *param) { const char *val; val = NULL; if(strcmp(param, "moduledir") == 0) val = MODULE_DIR; else if(strcmp(param, "compiledate") == 0) val = COMPILE_DATE; else if(strcmp(param, "compilesystem") == 0) val = COMPILE_SYSTEM; if(val == NULL) return NULL; return av_strdup(val); } void av_default_stat(struct avstat *stbuf) { static avuid_t myuid = -1; static avuid_t mygid = -1; if(myuid == -1) { myuid = getuid(); mygid = getgid(); } stbuf->dev = 0; stbuf->ino = 0; stbuf->mode = 0; stbuf->nlink = 0; stbuf->uid = myuid; stbuf->gid = mygid; stbuf->rdev = 0; stbuf->size = 0; stbuf->blksize = 512; stbuf->blocks = 0; av_curr_time(&stbuf->atime); stbuf->mtime = stbuf->atime; stbuf->ctime = stbuf->atime; } void av_curr_time(avtimestruc_t *tim) { struct timeval tv; gettimeofday(&tv, NULL); tim->sec = tv.tv_sec; tim->nsec = tv.tv_usec * 1000; } avtime_t av_time() { return time(NULL); } void av_sleep(unsigned long msec) { struct timespec rem; int res; rem.tv_sec = msec / 1000; rem.tv_nsec = (msec % 1000) * 1000 * 1000; do { struct timespec req; req = rem; res = nanosleep(&req, &rem); } while(res == -1 && errno == EINTR); } avtime_t av_mktime(struct avtm *tp) { struct tm tms; tms.tm_sec = tp->sec; tms.tm_min = tp->min; tms.tm_hour = tp->hour; tms.tm_mday = tp->day; tms.tm_mon = tp->mon; tms.tm_year = tp->year; tms.tm_isdst = -1; return mktime(&tms); } void av_localtime(avtime_t t, struct avtm *tp) { struct tm tms; localtime_r(&t, &tms); tp->sec = tms.tm_sec; tp->min = tms.tm_min; tp->hour = tms.tm_hour; tp->day = tms.tm_mday; tp->mon = tms.tm_mon; tp->year = tms.tm_year; } void av_registerfd(int fd) { fcntl(fd, F_SETFD, FD_CLOEXEC); } avfs-1.1.4/src/lzipread.c0000644000175000001440000002321114032341001012121 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2021 Ralf Hoffmann This program can be distributed under the terms of the GNU GPL. See the file COPYING. based on zstdread.c */ #include "config.h" #include "lzipfile.h" #include "oper.h" #include "exit.h" #include #include #include #include #define INDEXDISTANCE 1048576 #define LOOKUP_COST_DISTANCE (16 * 1024) // cost for searching for // cached member post instead // of just seeking forward #define INBUFSIZE 16384 #define OUTBUFSIZE 32768 static AV_LOCK_DECL(lzipread_lock); struct lzipindex { avoff_t o_offset; /* The number of output bytes */ avoff_t i_offset; /* The offset within the input file where the member begins */ struct lzipindex *next; }; struct lzipcache { avoff_t cachesize; // size of cache used to decide for cleanup avoff_t nextindex; // min position when next index should happen avoff_t size; // output file size struct lzipindex *indexes; }; struct lzipfile { struct LZ_Decoder *decoder; int iseof; int iserror; vfile *infile; avoff_t total_in; avoff_t total_out; avoff_t last_member_pos; char *outbuf; size_t outbuf_size; size_t output_pos; }; static void lzip_delete_decoder(struct LZ_Decoder *decoder) { if(decoder != NULL) { LZ_decompress_close(decoder); } } static int lzip_new_decoder(struct LZ_Decoder **resp) { struct LZ_Decoder *decoder; decoder = LZ_decompress_open(); if(decoder == NULL) { *resp = NULL; av_log(AVLOG_ERROR, "LZIP: could not create decompress decoder"); return -EIO; } *resp = decoder; return 0; } static int lzipfile_reset(struct lzipfile *fil) { lzip_delete_decoder(fil->decoder); fil->iseof = 0; fil->iserror = 0; fil->total_in = fil->total_out = 0; fil->last_member_pos = 0; return lzip_new_decoder(&fil->decoder); } static int lzipfile_save_index(struct lzipfile *fil, struct lzipcache *zc, avoff_t o_offset, avoff_t i_offset) { struct lzipindex **zp; struct lzipindex *zi; for(zp = &zc->indexes; *zp != NULL; zp = &(*zp)->next); AV_NEW(zi); zi->o_offset = o_offset; zi->i_offset = i_offset; zi->next = NULL; *zp = zi; zc->nextindex += INDEXDISTANCE; zc->cachesize += sizeof(*zi); return 0; } static struct lzipindex *lzipcache_find_index(struct lzipcache *c, avoff_t offset) { struct lzipindex *prevzi; struct lzipindex *zi; prevzi = NULL; for(zi = c->indexes; zi != NULL; zi = zi->next) { if(zi->o_offset > offset) break; prevzi = zi; } return prevzi; } static int lzipfile_fill_inbuf(struct lzipfile *fil) { avssize_t res; char buf[INBUFSIZE]; int ret; int size = AV_MIN(sizeof(buf), LZ_decompress_write_size(fil->decoder)); if (size <= 0) { return 0; } res = av_pread(fil->infile, buf, size, fil->total_in); if(res < 0) return res; ret = LZ_decompress_write(fil->decoder, (const uint8_t*)buf, res); if ( ret < 0 ) { return ret; } fil->total_in += ret; if ( res == 0 ) { LZ_decompress_finish(fil->decoder); } return 0; } static int lzipfile_decompress(struct lzipfile *fil, struct lzipcache *zc) { int res; int ret; if (fil->outbuf_size == 0) return 0; for (;;) { res = lzipfile_fill_inbuf(fil); if(res < 0) return res; ret = LZ_decompress_read(fil->decoder, (uint8_t*)fil->outbuf + fil->output_pos, fil->outbuf_size - fil->output_pos); if( ret < 0 ) { av_log(AVLOG_ERROR, "LZIP: decompress error"); return -EIO; } if (LZ_decompress_member_finished(fil->decoder)){ AV_LOCK(lzipread_lock); if(fil->total_out + ret >= zc->nextindex) { res = lzipfile_save_index(fil, zc, fil->total_out + ret, fil->last_member_pos + LZ_decompress_member_position(fil->decoder)); } AV_UNLOCK(lzipread_lock); fil->last_member_pos += LZ_decompress_member_position(fil->decoder); } fil->total_out += ret; fil->output_pos += ret; if (ret == 0) { if (LZ_decompress_total_in_size(fil->decoder) == fil->total_in) { fil->iseof = 1; AV_LOCK(lzipread_lock); zc->size = fil->total_out; AV_UNLOCK(lzipread_lock); break; } } if (fil->output_pos == fil->outbuf_size) { // everything we are requested for is available break; } } return 0; } static int lzipfile_read(struct lzipfile *fil, struct lzipcache *zc, char *buf, avsize_t nbyte) { int res; int sum = 0; while (nbyte > 0 && !fil->iseof) { fil->outbuf = buf; fil->outbuf_size = nbyte; fil->output_pos = 0; res = lzipfile_decompress(fil, zc); if(res < 0) return res; if (fil->output_pos == 0) { fil->iseof = 1; } else { buf += fil->output_pos; nbyte -= fil->output_pos; sum += fil->output_pos; } } return sum; } static int lzipfile_skip_to(struct lzipfile *fil, struct lzipcache *zc, avoff_t offset) { int res; char outbuf[OUTBUFSIZE]; while(!fil->iseof) { avoff_t curroff = fil->total_out; if(curroff == offset) break; fil->outbuf = outbuf; fil->outbuf_size = AV_MIN(OUTBUFSIZE, offset - curroff);; fil->output_pos = 0; res = lzipfile_decompress(fil, zc); if(res < 0) return res; if (fil->output_pos == 0) { fil->iseof = 1; } } return 0; } static int lzipfile_seek(struct lzipfile *fil, struct lzipcache *zc, avoff_t offset) { struct lzipindex *zi; if ( fil->total_out < offset && offset - fil->total_out < LOOKUP_COST_DISTANCE ) { // do nothing if we just need to go slightly forward return 0; } zi = lzipcache_find_index(zc, offset); if(zi == NULL) { if (fil->total_out > offset) { return lzipfile_reset(fil); } } else { int res; if ( zi->o_offset < fil->total_out && offset > fil->total_out ) { return 0; } res = lzipfile_reset(fil); if ( res < 0 ) { return res; } fil->total_in = zi->i_offset; fil->total_out = zi->o_offset; fil->last_member_pos = zi->i_offset; LZ_decompress_sync_to_member(fil->decoder); } return 0; } static int lzipfile_goto(struct lzipfile *fil, struct lzipcache *zc, avoff_t offset) { int res; AV_LOCK(lzipread_lock); res = lzipfile_seek(fil, zc, offset); AV_UNLOCK(lzipread_lock); if(res == 0) { res = lzipfile_skip_to(fil, zc, offset); } return res; } static avssize_t av_lzipfile_do_pread(struct lzipfile *fil, struct lzipcache *zc, char *buf, avsize_t nbyte, avoff_t offset) { avssize_t res; avoff_t curroff; curroff = fil->total_out; if(offset != curroff) { res = lzipfile_goto(fil, zc, offset); if(res < 0) return res; } res = lzipfile_read(fil, zc, buf, nbyte); return res; } avssize_t av_lzipfile_pread(struct lzipfile *fil, struct lzipcache *zc, char *buf, avsize_t nbyte, avoff_t offset) { avssize_t res; if(fil->iserror) return -EIO; res = av_lzipfile_do_pread(fil, zc, buf, nbyte, offset); if(res < 0) fil->iserror = 1; return res; } int av_lzipfile_size(struct lzipfile *fil, struct lzipcache *zc, avoff_t *sizep) { int res; avoff_t size; AV_LOCK(lzipread_lock); size = zc->size; AV_UNLOCK(lzipread_lock); if(size != -1 || fil == NULL) { *sizep = size; return 0; } res = lzipfile_reset( fil ); if(res < 0) return res; res = lzipfile_skip_to(fil, zc, AV_MAXOFF); if(res < 0) return res; AV_LOCK(lzipread_lock); size = zc->size; AV_UNLOCK(lzipread_lock); if(size == -1) { av_log(AVLOG_ERROR, "LZIP: Internal error: could not find size"); return -EIO; } *sizep = size; return 0; } static void lzipfile_destroy(struct lzipfile *fil) { lzip_delete_decoder(fil->decoder); } struct lzipfile *av_lzipfile_new(vfile *vf) { int res; struct lzipfile *fil; AV_NEW_OBJ(fil, lzipfile_destroy); fil->iseof = 0; fil->iserror = 0; fil->infile = vf; fil->total_in = fil->total_out = 0; fil->last_member_pos = 0; res = lzip_new_decoder(&fil->decoder); if(res < 0) fil->iserror = 1; return fil; } static void lzipcache_destroy(struct lzipcache *zc) { struct lzipindex *zi; struct lzipindex *nextzi; for(zi = zc->indexes; zi != NULL; zi = nextzi) { nextzi = zi->next; av_free(zi); } } struct lzipcache *av_lzipcache_new() { struct lzipcache *zc; AV_NEW_OBJ(zc, lzipcache_destroy); zc->size = -1; zc->cachesize = 0; zc->indexes = NULL; zc->nextindex = INDEXDISTANCE; return zc; } avoff_t av_lzipcache_size(struct lzipcache *zc) { return zc->cachesize; } avfs-1.1.4/src/filecache.c0000644000175000001440000000724014032341001012216 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "filecache.h" #include "internal.h" #include "exit.h" // keep this many elements in the case #define FILECACHE_MAX_SIZE 50 // and remove any additional elements if they are older than this number of seconds #define FILECACHE_MAX_AGE ( 10 * 60 ) struct filecache { struct filecache *next; struct filecache *prev; char *key; void *obj; time_t last_access; }; static struct filecache fclist; static int fclist_len; static AV_LOCK_DECL(fclock); static void filecache_remove(struct filecache *fc) { struct filecache *prev = fc->prev; struct filecache *next = fc->next; prev->next = next; next->prev = prev; fclist_len--; } static void filecache_insert(struct filecache *fc) { struct filecache *prev = &fclist; struct filecache *next = fclist.next; prev->next = fc; next->prev = fc; fc->prev = prev; fc->next = next; fclist_len++; struct timespec tv; if ( clock_gettime( CLOCK_MONOTONIC, &tv ) == 0 ) { fc->last_access = tv.tv_sec; } else { fc->last_access = 0; } } static void filecache_delete(struct filecache *fc) { av_log(AVLOG_DEBUG, "FILECACHE: delete <%s>", fc->key); filecache_remove(fc); av_unref_obj(fc->obj); av_free(fc->key); av_free(fc); } static void filecache_check_limits(void) { struct timespec now; if ( clock_gettime( CLOCK_MONOTONIC, &now ) != 0 ) { now.tv_sec = 0; } while (fclist_len > FILECACHE_MAX_SIZE && fclist.prev != &fclist) { if (now.tv_sec == 0 || (now.tv_sec != 0 && (int)(now.tv_sec - fclist.prev->last_access) > FILECACHE_MAX_AGE)) { filecache_delete(fclist.prev); } else { break; } } } static struct filecache *filecache_find(const char *key) { struct filecache *fc; filecache_check_limits(); for(fc = fclist.next; fc != &fclist; fc = fc->next) { if(strcmp(fc->key, key) == 0) break; } if(fc->obj == NULL) return NULL; return fc; } void *av_filecache_get(const char *key) { struct filecache *fc; void *obj = NULL; AV_LOCK(fclock); fc = filecache_find(key); if(fc != NULL) { filecache_remove(fc); filecache_insert(fc); obj = fc->obj; av_ref_obj(obj); } AV_UNLOCK(fclock); return obj; } void av_filecache_set(const char *key, void *obj) { struct filecache *oldfc; struct filecache *fc; if(obj != NULL) { AV_NEW(fc); fc->key = av_strdup(key); fc->obj = obj; av_ref_obj(obj); } else fc = NULL; AV_LOCK(fclock); oldfc = filecache_find(key); if(oldfc != NULL) filecache_delete(oldfc); if(fc != NULL) { av_log(AVLOG_DEBUG, "FILECACHE: insert <%s>", key); filecache_insert(fc); } AV_UNLOCK(fclock); } static void destroy_filecache() { AV_LOCK(fclock); while(fclist.next != &fclist) filecache_delete(fclist.next); AV_UNLOCK(fclock); } void av_init_filecache() { fclist.next = &fclist; fclist.prev = &fclist; fclist.obj = NULL; fclist.key = NULL; fclist_len = 0; av_add_exithandler(destroy_filecache); } int av_filecache_getkey(ventry *ve, char **resp) { int res; char *key; res = av_generate_path(ve->mnt->base, &key); if(res < 0) return res; key = av_stradd(key, AVFS_SEP_STR, ve->mnt->avfs->name, NULL); *resp = key; return 0; } avfs-1.1.4/src/make_info0000755000175000001440000000101714032341001012021 00000000000000#! /bin/sh if [ -n "$SOURCE_DATE_EPOCH" ]; then compile_date=\"`date -u -d "@$SOURCE_DATE_EPOCH" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" 2>/dev/null || date -u`\" compile_system=\"reproducible\" else compile_date=\"`date`\" compile_system=\"`uname -srm`\" fi moduledir=\"$1\" echo "/* This file was generated automatically by 'make_info' */" echo echo "#define MODULE_DIR $moduledir" echo "#define COMPILE_DATE $compile_date" echo "#define COMPILE_SYSTEM $compile_system" echo echo "/* End of file */" avfs-1.1.4/src/filter.c0000644000175000001440000003020314032341001011573 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "filter.h" #include "version.h" #include "filtprog.h" #include "filecache.h" #include "cache.h" #include "internal.h" #include "oper.h" /* FIXME: If there was an error in read, this shouldn't be kept in cache */ struct filtid { avino_t ino; avdev_t dev; }; struct filtmod { avoff_t size; avtimestruc_t mtime; }; struct filtnode { avmutex lock; vfile *vf; struct sfile *sf; struct filtid id; struct filtmod mod; avino_t ino; unsigned int writers; }; struct filtfile { struct filtnode *nod; struct cacheobj *cobj; int iswrite; }; static char **filt_copy_prog(const char *prog[]) { int num; const char **curr; char **copyprog; int i; if(prog == NULL) return NULL; for(num = 0, curr = prog; *curr != NULL; curr++, num++); copyprog = (char **) av_malloc(sizeof(char *) * (num + 1)); for(i = 0; i < num; i++) copyprog[i] = av_strdup(prog[i]); copyprog[i] = NULL; return copyprog; } static void filt_free_prog(char **prog) { if(prog != NULL) { char **curr; for(curr = prog; *curr != NULL; curr++) av_free(*curr); av_free(prog); } } static int filt_lookup(ventry *ve, const char *name, void **newp) { char *path = (char *) ve->data; if(path == NULL) { if(name[0] != '\0') return -ENOENT; if(ve->mnt->opts[0] != '\0') return -ENOENT; path = av_strdup(name); } else if(name == NULL) { av_free(path); path = NULL; } else return -ENOENT; *newp = path; return 0; } static void filtnode_free(struct filtnode *nod) { av_unref_obj(nod->sf); av_close(nod->vf); AV_FREELOCK(nod->lock) } static int filt_same_file(struct filtid *id, struct avstat *stbuf) { if(id->ino == stbuf->ino && id->dev == stbuf->dev) return 1; else return 0; } static int filt_unmodif_file(struct filtmod *mod, struct avstat *stbuf) { if(mod->size == stbuf->size && mod->mtime.sec == stbuf->mtime.sec && mod->mtime.nsec == stbuf->mtime.nsec) return 1; else return 0; } static void filt_id_set(struct filtid *id, struct avstat *stbuf) { id->ino = stbuf->ino; id->dev = stbuf->dev; } static void filt_mod_set(struct filtmod *mod, struct avstat *stbuf) { mod->size = stbuf->size; mod->mtime = stbuf->mtime; } static void filt_newnode(struct filtfile *ff, ventry *ve, vfile *vf, const char *key, struct avstat *buf) { struct filtnode *nod; struct filtdata *filtdat = (struct filtdata *) ve->mnt->avfs->data; AV_NEW_OBJ(nod, filtnode_free); AV_INITLOCK(nod->lock); nod->vf = vf; nod->sf = av_filtprog_new(vf, filtdat); filt_id_set(&nod->id, buf); filt_mod_set(&nod->mod, buf); nod->ino = av_new_ino(ve->mnt->avfs); nod->writers = 0; AV_LOCK(nod->lock); ff->cobj = av_cacheobj_new(nod, key); ff->nod = nod; av_filecache_set(key, ff->cobj); } static int filt_validate_file(struct filtnode *nod, ventry *ve, vfile *vf, struct avstat *buf, int iswrite) { if(nod->writers == 0 && !filt_unmodif_file(&nod->mod, buf)) { struct filtdata *filtdat = (struct filtdata *) ve->mnt->avfs->data; av_unref_obj(nod->sf); av_close(nod->vf); nod->sf = av_filtprog_new(vf, filtdat); nod->vf = vf; filt_mod_set(&nod->mod, buf); } else if(nod->writers == 0 && iswrite) { avoff_t pos = av_lseek(nod->vf, 0, AVSEEK_CUR); if(pos > 0) pos = av_lseek(vf, pos, AVSEEK_SET); if(pos < 0) return pos; av_filtprog_change(nod->sf, vf); av_close(nod->vf); nod->vf = vf; } else av_close(vf); return 0; } static int filt_getfile(struct filtfile *ff, ventry *ve, vfile *vf, const char *key) { int res; struct avstat buf; int attrmask = AVA_INO | AVA_DEV | AVA_SIZE | AVA_MTIME; res = av_fgetattr(vf, &buf, attrmask); if(res < 0) return res; ff->cobj = (struct cacheobj *) av_filecache_get(key); if(ff->cobj != NULL) ff->nod = (struct filtnode *) av_cacheobj_get(ff->cobj); if(ff->nod == NULL || !filt_same_file(&ff->nod->id, &buf)) { av_unref_obj(ff->nod); av_unref_obj(ff->cobj); filt_newnode(ff, ve, vf, key, &buf); return 0; } AV_LOCK(ff->nod->lock); res = filt_validate_file(ff->nod, ve, vf, &buf, ff->iswrite); if(res < 0) { AV_UNLOCK(ff->nod->lock); av_unref_obj(ff->nod); av_unref_obj(ff->cobj); return res; } return 0; } static int filt_get_baseflags(int flags, int *maybecrp) { int baseflags; int maybecreat = 0; if(AV_ISWRITE(flags)) baseflags = AVO_RDWR; else baseflags = AVO_RDONLY; if((flags & AVO_TRUNC) != 0) baseflags |= AVO_TRUNC; if((flags & AVO_CREAT) != 0) { if(flags & AVO_EXCL) baseflags = AVO_RDWR | AVO_CREAT | AVO_EXCL | AVO_TRUNC; else if(flags & AVO_TRUNC) baseflags = AVO_RDWR | AVO_CREAT | AVO_TRUNC; else maybecreat = 1; } *maybecrp = maybecreat; return baseflags; } static int filt_open_base(ventry *ve, int flags, avmode_t mode, vfile **vfp, int *bfresp) { int res; int maybecreat; int baseflags; baseflags = filt_get_baseflags(flags, &maybecreat); res = av_open(ve->mnt->base, baseflags, mode, vfp); if(res == -ENOENT && maybecreat) { baseflags = AVO_RDWR | AVO_CREAT | AVO_TRUNC; res = av_open(ve->mnt->base, baseflags, mode, vfp); } *bfresp = baseflags; return res; } static int filt_open_file(struct filtfile *ff, ventry *ve, int flags, avmode_t mode) { int res; vfile *vf; char *key; int baseflags; res = filt_open_base(ve, flags, mode, &vf, &baseflags); if(res < 0) return res; res = av_filecache_getkey(ve, &key); if(res == 0) { if((baseflags & AVO_ACCMODE) == AVO_RDWR) ff->iswrite = 1; res = filt_getfile(ff, ve, vf, key); if(res == 0) { if((baseflags & AVO_TRUNC) != 0) av_sfile_truncate(ff->nod->sf, 0); if(ff->iswrite) ff->nod->writers ++; AV_UNLOCK(ff->nod->lock); } av_free(key); } if(res < 0) { av_close(vf); return res; } return 0; } static int filt_open(ventry *ve, int flags, avmode_t mode, void **resp) { int res; struct filtfile *ff; if(flags & AVO_DIRECTORY) return -ENOTDIR; AV_NEW(ff); ff->nod = NULL; ff->cobj = NULL; ff->iswrite = 0; res = filt_open_file(ff, ve, flags, mode); if(res < 0) { av_free(ff); return res; } *resp = ff; return 0; } static avssize_t filt_read(vfile *vf, char *buf, avsize_t nbyte) { avssize_t res; struct filtfile *ff = (struct filtfile *) vf->data; struct filtnode *nod = ff->nod; AV_LOCK(nod->lock); res = av_sfile_pread(nod->sf, buf, nbyte, vf->ptr); AV_UNLOCK(nod->lock); if(res > 0) vf->ptr += res; return res; } static avssize_t filt_write(vfile *vf, const char *buf, avsize_t nbyte) { avssize_t res; struct filtfile *ff = (struct filtfile *) vf->data; struct filtnode *nod = ff->nod; AV_LOCK(nod->lock); if((vf->flags & AVO_APPEND) != 0) { avoff_t pos; pos = av_sfile_size(nod->sf); if(pos < 0) { AV_UNLOCK(nod->lock); return pos; } vf->ptr = pos; } res = av_sfile_pwrite(nod->sf, buf, nbyte, vf->ptr); if(res >= 0) av_curr_time(&nod->mod.mtime); AV_UNLOCK(nod->lock); if(res > 0) vf->ptr += res; return res; } static int filt_truncate(vfile *vf, avoff_t length) { int res; struct filtfile *ff = (struct filtfile *) vf->data; struct filtnode *nod = ff->nod; AV_LOCK(nod->lock); res = av_sfile_truncate(nod->sf, length); AV_UNLOCK(nod->lock); return res; } static void filt_afterflush(vfile *vf, struct filtnode *nod) { int res; struct avstat stbuf; int attrmask = AVA_INO | AVA_DEV | AVA_SIZE | AVA_MTIME; avoff_t size = -1; vfile *bvf; res = av_fgetattr(nod->vf, &stbuf, AVA_SIZE); if(res == 0) size = stbuf.size; av_close(nod->vf); nod->vf = NULL; nod->mod.size = -1; res = av_open(vf->mnt->base, AVO_NOPERM, 0, &bvf); if(res < 0) return; res = av_fgetattr(bvf, &stbuf, attrmask); if(res == 0 && filt_same_file(&nod->id, &stbuf) && stbuf.size == size) filt_mod_set(&nod->mod, &stbuf); av_close(bvf); } static int filt_close(vfile *vf) { int res = 0; struct filtfile *ff = (struct filtfile *) vf->data; struct filtnode *nod = ff->nod; avoff_t du; AV_LOCK(nod->lock); if(ff->iswrite) { nod->writers --; if(nod->writers == 0) { res = av_sfile_flush(nod->sf); filt_afterflush(vf, nod); } } du = av_sfile_diskusage(nod->sf); if(du >= 0) av_cacheobj_setsize(ff->cobj, du); AV_UNLOCK(nod->lock); av_unref_obj(nod); av_unref_obj(ff->cobj); av_free(ff); return res; } static int filt_getattr(vfile *vf, struct avstat *buf, int attrmask) { struct filtfile *ff = (struct filtfile *) vf->data; struct filtnode *nod = ff->nod; struct avstat origbuf; int res; avoff_t size = -1; avino_t ino; avtimestruc_t mtime; AV_LOCK(nod->lock); ino = nod->ino; res = av_fgetattr(nod->vf, &origbuf, AVA_ALL & ~AVA_SIZE); if(res == 0) { size = av_sfile_size(nod->sf); if(size < 0) res = size; } if(nod->writers != 0) mtime = nod->mod.mtime; else mtime = origbuf.mtime; AV_UNLOCK(nod->lock); if(res < 0) return res; *buf = origbuf; buf->mode &= ~(07000); buf->blksize = 4096; buf->dev = vf->mnt->avfs->dev; buf->ino = ino; buf->size = size; buf->blocks = AV_BLOCKS(size); buf->mtime = mtime; return 0; } static int filt_setattr(vfile *vf, struct avstat *buf, int attrmask) { int res; struct filtfile *ff = (struct filtfile *) vf->data; struct filtnode *nod = ff->nod; AV_LOCK(nod->lock); res = av_fsetattr(nod->vf, buf, attrmask); AV_UNLOCK(nod->lock); return res; } static int filt_access(ventry *ve, int amode) { return av_access(ve->mnt->base, amode); } static int filt_rename(ventry *ve, ventry *newve) { return -EXDEV; } static int filt_unlink(ventry *ve) { return av_unlink(ve->mnt->base); } static void filt_destroy(struct avfs *avfs) { struct filtdata *filtdat = (struct filtdata *) avfs->data; filt_free_prog(filtdat->prog); filt_free_prog(filtdat->revprog); av_free(filtdat); } int av_init_filt(struct vmodule *module, int version, const char *name, const char *prog[], const char *revprog[], struct ext_info *exts, struct avfs **resp) { int res; struct avfs *avfs; struct filtdata *filtdat; res = av_new_avfs(name, exts, version, AVF_NOLOCK, module, &avfs); if(res < 0) return res; AV_NEW(filtdat); filtdat->prog = filt_copy_prog(prog); filtdat->revprog = filt_copy_prog(revprog); avfs->data = filtdat; avfs->destroy = filt_destroy; avfs->lookup = filt_lookup; avfs->access = filt_access; avfs->unlink = filt_unlink; avfs->rename = filt_rename; avfs->open = filt_open; avfs->close = filt_close; avfs->read = filt_read; avfs->write = filt_write; avfs->getattr = filt_getattr; avfs->setattr = filt_setattr; avfs->truncate = filt_truncate; av_add_avfs(avfs); *resp = avfs; return 0; } avfs-1.1.4/src/socket.c0000644000175000001440000000374414032341001011610 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "socket.h" #include "avfs.h" #include #include #include #include #include static int sock_connect_host(const char *hostname, int port) { struct hostent *host; struct sockaddr_in sn; int sock; int res; host = gethostbyname(hostname); if(host == NULL) { av_log(AVLOG_ERROR, "Could not resolve host %s", hostname); return -ENOENT; } if(host->h_addrtype != AF_INET) { av_log(AVLOG_ERROR, "Cannot handle non-inet address %s", hostname); return -ENOENT; } sn.sin_family = AF_INET; sn.sin_port = htons(port); memcpy(&sn.sin_addr, host->h_addr_list[0], host->h_length); sock = socket(AF_INET, SOCK_STREAM, 0); if(sock == -1) { av_log(AVLOG_ERROR, "socket(): %s", strerror(errno)); return -errno; } res = connect(sock, (struct sockaddr *) &sn, sizeof(sn)); if(res == -1) { av_log(AVLOG_ERROR, "connect(): %s", strerror(errno)); close(sock); return -errno; } return sock; } int av_sock_connect(const char *name, int defaultport) { char *hostname; char *s; int port = defaultport; int sock; hostname = av_strdup(name); s = strrchr(hostname, ':'); if(s != NULL) { char *end; *s = '\0'; s++; port = strtol(s, &end, 10); if(end == s || *end != '\0') { av_free(hostname); av_log(AVLOG_ERROR, "Bad port: %s", name); return -ENOENT; } } else if(defaultport == -1) { av_free(hostname); av_log(AVLOG_ERROR, "Missing port: %s", name); return -ENOENT; } sock = sock_connect_host(hostname, port); av_free(hostname); return sock; } avfs-1.1.4/src/fdops.c0000644000175000001440000001145314032341001011427 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "operutil.h" #include "internal.h" static vfile **file_table; static unsigned int file_table_size; static AV_LOCK_DECL(files_lock); static int find_unused() { int i; int newsize; for(i = 0; i < file_table_size; i++) if(file_table[i] == NULL) return i; newsize = file_table_size + 16; file_table = av_realloc(file_table, sizeof(*file_table) * newsize); for(i = file_table_size; i < newsize; i++) file_table[i] = NULL; i = file_table_size; file_table_size = newsize; return i; } static void put_file(vfile *vf) { AV_UNLOCK(vf->lock); av_unref_obj(vf); } static int get_file(int fd, vfile **resp) { vfile *vf = NULL; AV_LOCK(files_lock); if(fd >= 0 && fd < file_table_size) { vf = file_table[fd]; if(vf != NULL) av_ref_obj(vf); } AV_UNLOCK(files_lock); if(vf == NULL) return -EBADF; AV_LOCK(vf->lock); if(vf->mnt == NULL) { put_file(vf); return -EBADF; } *resp = vf; return 0; } static void free_vfile(vfile *vf) { AV_FREELOCK(vf->lock); } int av_fd_open_entry(ventry *ve, int flags, avmode_t mode) { int res; int fd; vfile *vf; AV_NEW_OBJ(vf, free_vfile); AV_INITLOCK(vf->lock); res = av_file_open(vf, ve, flags, mode); if(res < 0) { av_unref_obj(vf); return res; } AV_LOCK(files_lock); fd = find_unused(); file_table[fd] = vf; AV_UNLOCK(files_lock); return fd; } int av_fd_open(const char *path, int flags, avmode_t mode) { int res; ventry *ve; res = av_get_ventry(path, !(flags & AVO_NOFOLLOW), &ve); if(res < 0) return res; res = av_fd_open_entry(ve, flags, mode); av_free_ventry(ve); return res; } int av_fd_close(int fd) { int res; vfile *vf; res = get_file(fd, &vf); if(res == 0) { res = av_file_close(vf); put_file(vf); AV_LOCK(files_lock); file_table[fd] = NULL; AV_UNLOCK(files_lock); av_unref_obj(vf); } return res; } avssize_t av_fd_read(int fd, void *buf, avsize_t nbyte) { avssize_t res; vfile *vf; res = get_file(fd, &vf); if(res == 0) { res = av_file_read(vf, buf, nbyte); put_file(vf); } return res; } avssize_t av_fd_write(int fd, const char *buf, avsize_t nbyte) { avssize_t res; vfile *vf; res = get_file(fd, &vf); if(res == 0) { res = av_file_write(vf, buf, nbyte); put_file(vf); } return res; } static avoff_t dir_lseek(vfile *vf, avoff_t offset, int whence) { switch(whence) { case AVSEEK_SET: if(offset < 0) return -EINVAL; vf->ptr = offset; break; case AVSEEK_CUR: if(offset != 0) return -EINVAL; break; default: return -EINVAL; } return vf->ptr; } avoff_t av_fd_lseek(int fd, avoff_t offset, int whence) { avoff_t res; vfile *vf; res = get_file(fd, &vf); if(res == 0) { if((vf->flags & AVO_DIRECTORY) != 0) res = dir_lseek(vf, offset, whence); else res = av_file_lseek(vf, offset, whence); put_file(vf); } return res; } int av_fd_readdir(int fd, struct avdirent *buf, avoff_t *posp) { int res; vfile *vf; res = get_file(fd, &vf); if(res == 0) { struct avfs *avfs = vf->mnt->avfs; *posp = vf->ptr; AVFS_LOCK(avfs); res = avfs->readdir(vf, buf); AVFS_UNLOCK(avfs); put_file(vf); } return res; } int av_fd_getattr(int fd, struct avstat *buf, int attrmask) { int res; vfile *vf; res = get_file(fd, &vf); if(res == 0) { res = av_file_getattr(vf, buf, attrmask); put_file(vf); } return res; } int av_fd_setattr(int fd, struct avstat *buf, int attrmask) { int res; vfile *vf; res = get_file(fd, &vf); if(res == 0) { res = av_file_setattr(vf, buf, attrmask); put_file(vf); } return res; } int av_fd_truncate(int fd, avoff_t length) { int res; vfile *vf; res = get_file(fd, &vf); if(res == 0) { res = av_file_truncate(vf, length); put_file(vf); } return res; } void av_close_all_files() { int fd; vfile *vf; AV_LOCK(files_lock); for(fd = 0; fd < file_table_size; fd++) { vf = file_table[fd]; if(vf != NULL) { av_log(AVLOG_WARNING, "File handle still in use: %i", fd); av_file_close(vf); av_unref_obj(vf); } } av_free(file_table); file_table = NULL; AV_UNLOCK(files_lock); } avfs-1.1.4/src/prog.c0000644000175000001440000000500114032341001011253 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "prog.h" #include "avfs.h" #include #include #include char *strsignal(int sig); void av_init_proginfo(struct proginfo *pi) { pi->prog = NULL; pi->pid = -1; pi->wd = NULL; pi->ifd = -1; pi->ofd = -1; pi->efd = -1; } static char *get_cmdline(const char *args[]) { char *cat = NULL; for(; *args != NULL; args++) cat = av_stradd(cat, *args, " ", NULL); return cat; } int av_start_prog(struct proginfo *pi) { char *cmdline = get_cmdline(pi->prog); av_log(AVLOG_DEBUG, "Starting program %s", cmdline); av_free(cmdline); pi->pid = fork(); if(pi->pid == -1) { av_log(AVLOG_ERROR, "Fork failed: %s", strerror(errno)); return -EIO; } if(pi->pid == 0) { /* Child */ if(pi->wd != NULL) chdir(pi->wd); setsid(); /* Don't want to kill my parent if something goes wrong */ if(pi->ifd != -1) dup2(pi->ifd, 0); if(pi->ofd != -1) dup2(pi->ofd, 1); if(pi->efd != -1) dup2(pi->efd, 2); execvp(pi->prog[0], (char **) pi->prog); av_log(AVLOG_ERROR, "Failed to exec %s", pi->prog[0]); _exit(1); } return 0; } int av_wait_prog(struct proginfo *pi, int tokill, int check) { int res; int retv; if(pi->pid == -1) return 1; if(check) { res = waitpid(pi->pid, &retv, WNOHANG); if(res == 0) return 0; } else { if(tokill) kill(pi->pid, SIGKILL); do res = waitpid(pi->pid, &retv, 0); while(res == -1 && errno == EINTR); } pi->pid = -1; if(res == -1) { av_log(AVLOG_ERROR, "waitpid returned error: %s", strerror(errno)); return -EIO; } if(WIFEXITED(retv)) { int val = WEXITSTATUS(retv); if(val == 0) { av_log(AVLOG_DEBUG, "program %s exited normally", pi->prog[0]); return 1; } av_log(AVLOG_ERROR, "program %s exited with error: %i", pi->prog[0], val); } else if(WIFSIGNALED(retv)) av_log(AVLOG_ERROR, "program %s: %s", pi->prog[0], strsignal(WTERMSIG(retv))); else av_log(AVLOG_ERROR, "program %s killed with unknown reason", pi->prog[0]); return -EIO; } avfs-1.1.4/src/Makefile.in0000644000175000001440000006460114032341013012223 00000000000000# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @USE_LIBLZMA_TRUE@am__append_1 = xzread.c @USE_LIBZSTD_TRUE@am__append_2 = zstdread.c @USE_LIBLZIP_TRUE@am__append_3 = lzipread.c subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libavfscore_la_LIBADD = am__libavfscore_la_SOURCES_DIST = utils.c sysdeps.c tmpfile.c alloc.c \ parsels.c ugid.c parse.c prog.c runprog.c cache.c filebuf.c \ local.c default.c oper.c fdops.c virtual.c modload.c remote.c \ archive.c archutil.c namespace.c state.c serialfile.c \ filtprog.c filter.c filecache.c socket.c passwords.c zread.c \ exit.c realfile.c bzread.c xzread.c zstdread.c lzipread.c @USE_LIBLZMA_TRUE@am__objects_1 = xzread.lo @USE_LIBZSTD_TRUE@am__objects_2 = zstdread.lo @USE_LIBLZIP_TRUE@am__objects_3 = lzipread.lo am_libavfscore_la_OBJECTS = utils.lo sysdeps.lo tmpfile.lo alloc.lo \ parsels.lo ugid.lo parse.lo prog.lo runprog.lo cache.lo \ filebuf.lo local.lo default.lo oper.lo fdops.lo virtual.lo \ modload.lo remote.lo archive.lo archutil.lo namespace.lo \ state.lo serialfile.lo filtprog.lo filter.lo filecache.lo \ socket.lo passwords.lo zread.lo exit.lo realfile.lo bzread.lo \ $(am__objects_1) $(am__objects_2) $(am__objects_3) nodist_libavfscore_la_OBJECTS = libavfscore_la_OBJECTS = $(am_libavfscore_la_OBJECTS) \ $(nodist_libavfscore_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libavfscore_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(libavfscore_la_LDFLAGS) $(LDFLAGS) -o \ $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/alloc.Plo ./$(DEPDIR)/archive.Plo \ ./$(DEPDIR)/archutil.Plo ./$(DEPDIR)/bzread.Plo \ ./$(DEPDIR)/cache.Plo ./$(DEPDIR)/default.Plo \ ./$(DEPDIR)/exit.Plo ./$(DEPDIR)/fdops.Plo \ ./$(DEPDIR)/filebuf.Plo ./$(DEPDIR)/filecache.Plo \ ./$(DEPDIR)/filter.Plo ./$(DEPDIR)/filtprog.Plo \ ./$(DEPDIR)/local.Plo ./$(DEPDIR)/lzipread.Plo \ ./$(DEPDIR)/modload.Plo ./$(DEPDIR)/namespace.Plo \ ./$(DEPDIR)/oper.Plo ./$(DEPDIR)/parse.Plo \ ./$(DEPDIR)/parsels.Plo ./$(DEPDIR)/passwords.Plo \ ./$(DEPDIR)/prog.Plo ./$(DEPDIR)/realfile.Plo \ ./$(DEPDIR)/remote.Plo ./$(DEPDIR)/runprog.Plo \ ./$(DEPDIR)/serialfile.Plo ./$(DEPDIR)/socket.Plo \ ./$(DEPDIR)/state.Plo ./$(DEPDIR)/sysdeps.Plo \ ./$(DEPDIR)/tmpfile.Plo ./$(DEPDIR)/ugid.Plo \ ./$(DEPDIR)/utils.Plo ./$(DEPDIR)/virtual.Plo \ ./$(DEPDIR)/xzread.Plo ./$(DEPDIR)/zread.Plo \ ./$(DEPDIR)/zstdread.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libavfscore_la_SOURCES) $(nodist_libavfscore_la_SOURCES) DIST_SOURCES = $(am__libavfscore_la_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BZLIB_INCLUDE = @BZLIB_INCLUDE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAV = @DAV@ DAV_LS = @DAV_LS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FUSELIBS = @FUSELIBS@ GREP = @GREP@ HAVE_ZIPINFO = @HAVE_ZIPINFO@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ LIBZSTD_LIBS = @LIBZSTD_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NUMVERSION = @NUMVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ ZIP = @ZIP@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_INCLUDE = @ZLIB_INCLUDE@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = make_info AM_CPPFLAGS = -I$(top_srcdir)/include @ZLIB_INCLUDE@ @BZLIB_INCLUDE@ @CPPFLAGS@ -DBZ_NO_STDIO AM_CFLAGS = @CFLAGS@ noinst_LTLIBRARIES = libavfscore.la libavfscore_la_LDFLAGS = -module libavfscore_la_SOURCES = utils.c sysdeps.c tmpfile.c alloc.c parsels.c \ ugid.c parse.c prog.c runprog.c cache.c filebuf.c local.c \ default.c oper.c fdops.c virtual.c modload.c remote.c \ archive.c archutil.c namespace.c state.c serialfile.c \ filtprog.c filter.c filecache.c socket.c passwords.c zread.c \ exit.c realfile.c bzread.c $(am__append_1) $(am__append_2) \ $(am__append_3) noinst_HEADERS = \ archint.h \ filtprog.h \ local.h \ mod_static.h nodist_libavfscore_la_SOURCES = info.h BUILT_SOURCES = info.h CLEANFILES = info.h all: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu src/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu src/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libavfscore.la: $(libavfscore_la_OBJECTS) $(libavfscore_la_DEPENDENCIES) $(EXTRA_libavfscore_la_DEPENDENCIES) $(AM_V_CCLD)$(libavfscore_la_LINK) $(libavfscore_la_OBJECTS) $(libavfscore_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alloc.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/archive.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/archutil.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bzread.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/default.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exit.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fdops.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filebuf.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filecache.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filtprog.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/local.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lzipread.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modload.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/namespace.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oper.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parsels.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/passwords.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prog.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/realfile.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remote.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runprog.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/serialfile.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socket.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/state.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sysdeps.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmpfile.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ugid.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/virtual.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xzread.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zread.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zstdread.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: install: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-am install-exec: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/alloc.Plo -rm -f ./$(DEPDIR)/archive.Plo -rm -f ./$(DEPDIR)/archutil.Plo -rm -f ./$(DEPDIR)/bzread.Plo -rm -f ./$(DEPDIR)/cache.Plo -rm -f ./$(DEPDIR)/default.Plo -rm -f ./$(DEPDIR)/exit.Plo -rm -f ./$(DEPDIR)/fdops.Plo -rm -f ./$(DEPDIR)/filebuf.Plo -rm -f ./$(DEPDIR)/filecache.Plo -rm -f ./$(DEPDIR)/filter.Plo -rm -f ./$(DEPDIR)/filtprog.Plo -rm -f ./$(DEPDIR)/local.Plo -rm -f ./$(DEPDIR)/lzipread.Plo -rm -f ./$(DEPDIR)/modload.Plo -rm -f ./$(DEPDIR)/namespace.Plo -rm -f ./$(DEPDIR)/oper.Plo -rm -f ./$(DEPDIR)/parse.Plo -rm -f ./$(DEPDIR)/parsels.Plo -rm -f ./$(DEPDIR)/passwords.Plo -rm -f ./$(DEPDIR)/prog.Plo -rm -f ./$(DEPDIR)/realfile.Plo -rm -f ./$(DEPDIR)/remote.Plo -rm -f ./$(DEPDIR)/runprog.Plo -rm -f ./$(DEPDIR)/serialfile.Plo -rm -f ./$(DEPDIR)/socket.Plo -rm -f ./$(DEPDIR)/state.Plo -rm -f ./$(DEPDIR)/sysdeps.Plo -rm -f ./$(DEPDIR)/tmpfile.Plo -rm -f ./$(DEPDIR)/ugid.Plo -rm -f ./$(DEPDIR)/utils.Plo -rm -f ./$(DEPDIR)/virtual.Plo -rm -f ./$(DEPDIR)/xzread.Plo -rm -f ./$(DEPDIR)/zread.Plo -rm -f ./$(DEPDIR)/zstdread.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/alloc.Plo -rm -f ./$(DEPDIR)/archive.Plo -rm -f ./$(DEPDIR)/archutil.Plo -rm -f ./$(DEPDIR)/bzread.Plo -rm -f ./$(DEPDIR)/cache.Plo -rm -f ./$(DEPDIR)/default.Plo -rm -f ./$(DEPDIR)/exit.Plo -rm -f ./$(DEPDIR)/fdops.Plo -rm -f ./$(DEPDIR)/filebuf.Plo -rm -f ./$(DEPDIR)/filecache.Plo -rm -f ./$(DEPDIR)/filter.Plo -rm -f ./$(DEPDIR)/filtprog.Plo -rm -f ./$(DEPDIR)/local.Plo -rm -f ./$(DEPDIR)/lzipread.Plo -rm -f ./$(DEPDIR)/modload.Plo -rm -f ./$(DEPDIR)/namespace.Plo -rm -f ./$(DEPDIR)/oper.Plo -rm -f ./$(DEPDIR)/parse.Plo -rm -f ./$(DEPDIR)/parsels.Plo -rm -f ./$(DEPDIR)/passwords.Plo -rm -f ./$(DEPDIR)/prog.Plo -rm -f ./$(DEPDIR)/realfile.Plo -rm -f ./$(DEPDIR)/remote.Plo -rm -f ./$(DEPDIR)/runprog.Plo -rm -f ./$(DEPDIR)/serialfile.Plo -rm -f ./$(DEPDIR)/socket.Plo -rm -f ./$(DEPDIR)/state.Plo -rm -f ./$(DEPDIR)/sysdeps.Plo -rm -f ./$(DEPDIR)/tmpfile.Plo -rm -f ./$(DEPDIR)/ugid.Plo -rm -f ./$(DEPDIR)/utils.Plo -rm -f ./$(DEPDIR)/virtual.Plo -rm -f ./$(DEPDIR)/xzread.Plo -rm -f ./$(DEPDIR)/zread.Plo -rm -f ./$(DEPDIR)/zstdread.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: all check install install-am install-exec install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile info.h: rm -f info.h $(srcdir)/make_info $(moduledir) > info.h # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: avfs-1.1.4/src/state.c0000644000175000001440000002304314032341001011432 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "state.h" #include "version.h" struct stentry { char *param; struct entry *ent; /* namespace.h */ }; struct stfile { struct stentry *stent; char *contents; int modif; }; static struct stentry *state_ventry_stentry(ventry *ve) { return (struct stentry *) ve->data; } static struct namespace *state_ventry_namespace(ventry *ve) { return (struct namespace *) ve->mnt->avfs->data; } static struct stfile *state_vfile_stfile(vfile *vf) { return (struct stfile *) vf->data; } static struct namespace *state_vfile_namespace(vfile *vf) { return (struct namespace *) vf->mnt->avfs->data; } static void state_free_stentry(struct stentry *stent) { av_free(stent->param); av_unref_obj(stent->ent); } static int state_lookup(ventry *ve, const char *name, void **newp) { struct stentry *stent = state_ventry_stentry(ve); struct namespace *ns = state_ventry_namespace(ve); struct stentry *newent; if(stent != NULL) { if(stent->ent == NULL && (name == NULL || strcmp(name, "..") == 0)) newent = NULL; else { AV_NEW_OBJ(newent, state_free_stentry); newent->ent = av_namespace_lookup_all(ns, stent->ent, name); newent->param = av_strdup(stent->param); } } else { AV_NEW_OBJ(newent, state_free_stentry); newent->ent = NULL; newent->param = av_strdup(name); } av_unref_obj(stent); *newp = newent; return 0; } static int state_getpath(ventry *ve, char **resp) { char *path; char *nspath; struct stentry *stent = state_ventry_stentry(ve); path = av_strdup(stent->param); if(stent->ent != NULL) { nspath = av_namespace_getpath(stent->ent); path = av_stradd(path, "/", nspath, NULL); av_free(nspath); } *resp = path; return 0; } static void state_putent(ventry *ve) { struct stentry *stent = state_ventry_stentry(ve); av_unref_obj(stent); } static int state_copyent(ventry *ve, void **resp) { struct stentry *stent = state_ventry_stentry(ve); av_ref_obj(stent); *resp = stent; return 0; } static int state_open(ventry *ve, int flags, avmode_t mode, void **resp) { int res; struct stentry *stent = state_ventry_stentry(ve); struct namespace *ns = state_ventry_namespace(ve); struct stfile *sf; struct entry *subdir; struct statefile *stf; char *contents; subdir = av_namespace_subdir(ns, stent->ent); if(stent->ent != NULL) stf = (struct statefile *) av_namespace_get(stent->ent); else stf = NULL; if(subdir == NULL && (stf == NULL || (flags & AVO_DIRECTORY) != 0)) return -ENOENT; av_unref_obj(subdir); contents = NULL; if(!(flags & AVO_DIRECTORY) && stf != NULL) { if(AV_ISWRITE(flags) && stf->set == NULL) return -EACCES; if((flags & AVO_TRUNC) != 0 || stf->get == NULL) contents = av_strdup(""); else { res = stf->get(stent->ent, stent->param, &contents); if(res < 0) return res; } } AV_NEW(sf); sf->stent = stent; sf->contents = contents; sf->modif = 0; av_ref_obj(stent); if((flags & AVO_TRUNC) != 0) sf->modif = 1; *resp = sf; return 0; } static int state_close(vfile *vf) { struct stfile *sf = state_vfile_stfile(vf); int res = 0; if(sf->modif && sf->stent->ent != NULL) { struct statefile *stf; stf = (struct statefile *) av_namespace_get(sf->stent->ent); res = stf->set(sf->stent->ent, sf->stent->param, sf->contents); } av_unref_obj(sf->stent); av_free(sf->contents); av_free(sf); return res; } static avssize_t state_read(vfile *vf, char *buf, avsize_t nbyte) { avoff_t nact; avoff_t size; struct stfile *sf = state_vfile_stfile(vf); if(sf->contents == NULL) return -EISDIR; size = strlen(sf->contents); if(vf->ptr >= size) return 0; // since nbyte is avsize_t, the min will not be larger than that datatype nact = AV_MIN((avoff_t)nbyte, (avoff_t) (size - vf->ptr)); memcpy(buf, sf->contents + vf->ptr, nact); vf->ptr += nact; return nact; } static avssize_t state_write(vfile *vf, const char *buf, avsize_t nbyte) { avoff_t end; struct stfile *sf = state_vfile_stfile(vf); avoff_t size; size = strlen(sf->contents); if((vf->flags & AVO_APPEND) != 0) vf->ptr = size; end = vf->ptr + nbyte; if(end > size) { sf->contents = av_realloc(sf->contents, end + 1); sf->contents[end] = '\0'; } memcpy(sf->contents + vf->ptr, buf, nbyte); vf->ptr = end; sf->modif = 1; return nbyte; } static int state_truncate(vfile *vf, avoff_t length) { struct stfile *sf = state_vfile_stfile(vf); avoff_t size; size = strlen(sf->contents); if(length < size) sf->contents[length] = '\0'; sf->modif = 1; return 0; } static unsigned int state_paramhash(const char *param) { unsigned long hash = 0; for(; *param; param++) { unsigned long c = *(const unsigned char *) param; hash = (hash + (c << 4) + (c >> 4)) * 11; } return hash; } static int state_readdir(vfile *vf, struct avdirent *buf) { struct stfile *sf = state_vfile_stfile(vf); struct namespace *ns = state_vfile_namespace(vf); struct statefile *stf; struct entry *ent; int n; ent = av_namespace_subdir(ns, sf->stent->ent); for(n = vf->ptr; n > 0 && ent != NULL; n--) { struct entry *next; next = av_namespace_next(ent); av_unref_obj(ent); ent = next; } if(ent == NULL) return 0; buf->name = av_namespace_name(ent); stf = av_namespace_get(ent); /* FIXME: Make ino be some hash function of param and entry */ buf->ino = (long) stf + state_paramhash(sf->stent->param); /* add hash of entry name to hash */ buf->ino += state_paramhash( buf->name ); /* make sure ino is not 0 or 1 */ buf->ino = (avino_t)((((unsigned int)buf->ino) % (~0U - 1)) + 2); buf->type = 0; av_unref_obj(ent); vf->ptr ++; return 1; } static int state_getattr(vfile *vf, struct avstat *buf, int attrmask) { struct stfile *sf = state_vfile_stfile(vf); struct statefile *stf; char *ent_name; if(sf->stent->ent != NULL) stf = (struct statefile *) av_namespace_get(sf->stent->ent); else stf = NULL; av_default_stat(buf); /* This isn't perfect, but... */ buf->ino = (long) stf + state_paramhash(sf->stent->param); /* add hash of entry name to hash */ if( sf->stent->ent != NULL ) { ent_name = av_namespace_name( sf->stent->ent ); buf->ino += state_paramhash( ent_name ); av_free( ent_name ); } /* make sure ino is not 0 or 1 */ buf->ino = (avino_t)((((unsigned int)buf->ino) % (~0U - 1)) + 2); buf->dev = vf->mnt->avfs->dev; if(stf != NULL) { if(stf->set != NULL) buf->mode = AV_IFREG | 0644; else buf->mode = AV_IFREG | 0444; } else buf->mode = AV_IFDIR | 0755; if(sf->contents != NULL) { buf->size = strlen(sf->contents); buf->blocks = AV_DIV(buf->size, 512); } buf->nlink = 1; return 0; } static int state_access(ventry *ve, int amode) { struct stentry *stent = state_ventry_stentry(ve); struct namespace *ns = state_ventry_namespace(ve); struct entry *subdir; struct statefile *stf; subdir = av_namespace_subdir(ns, stent->ent); if(stent->ent != NULL) stf = (struct statefile *) av_namespace_get(stent->ent); else stf = NULL; if(subdir == NULL && stf == NULL) return -ENOENT; if((amode & AVW_OK) != 0 && stf != NULL && stf->set == NULL) return -EACCES; av_unref_obj(subdir); return 0; } static void state_free_tree(struct namespace *ns, struct entry *ent) { struct entry *next; void *data; ent = av_namespace_subdir(ns, ent); while(ent != NULL) { state_free_tree(ns, ent); data = av_namespace_get(ent); if(data != NULL) { av_free(data); av_unref_obj(ent); } next = av_namespace_next(ent); av_unref_obj(ent); ent = next; } } static void state_destroy(struct avfs *avfs) { struct namespace *ns = (struct namespace *) avfs->data; state_free_tree(ns, NULL); av_unref_obj(ns); } int av_state_new(struct vmodule *module, const char *name, struct namespace **resp, struct avfs **avfsp) { int res; struct avfs *avfs; struct namespace *ns; res = av_new_avfs(name, NULL, AV_VER, AVF_ONLYROOT, module, &avfs); if(res < 0) return res; ns = av_namespace_new(); av_ref_obj(ns); avfs->data = ns; avfs->destroy = state_destroy; avfs->lookup = state_lookup; avfs->putent = state_putent; avfs->copyent = state_copyent; avfs->getpath = state_getpath; avfs->open = state_open; avfs->close = state_close; avfs->read = state_read; avfs->write = state_write; avfs->truncate = state_truncate; avfs->readdir = state_readdir; avfs->getattr = state_getattr; avfs->access = state_access; av_add_avfs(avfs); *resp = ns; *avfsp = avfs; return 0; } avfs-1.1.4/src/parsels.c0000644000175000001440000003447414032341001011775 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. PARSELS module This module is partly based on the 'vfs.c' module of Midnight Commander VFS, by Miguel de Icaza, Jakub Jelinek and Pavel Machek. */ #include "parsels.h" #include "ugid.h" #include #include #include #include #include "config.h" #define MAXCOLS 30 struct columns { int idx; int num; char *cols[MAXCOLS]; int cptr[MAXCOLS]; }; #define CURR_COL(col) (col->cols[col->idx]) #define INC_COL(col) (col->cols[col->idx++]) struct lscache { struct ugidcache *ugid; struct avtm currtim; }; static void free_lscache(struct lscache *cache) { av_unref_obj(cache->ugid); } struct lscache *av_new_lscache() { struct lscache *cache; AV_NEW_OBJ(cache, free_lscache); cache->ugid = av_new_ugidcache(); av_localtime(time(NULL), &cache->currtim); return cache; } static void split_text(char *p, struct columns *col) { char *original = p; int numcols; for (numcols = 0; *p && numcols < MAXCOLS; numcols++){ while (*p == ' ' || *p == '\r' || *p == '\n'){ *p = 0; p++; } col->cols [numcols] = p; col->cptr [numcols] = p - original; while (*p && *p != ' ' && *p != '\r' && *p != '\n') p++; } col->idx = 0; col->num = numcols; } static int is_valid_col (struct columns *col) { if (col->idx < col->num) { return 1; } return 0; } static int is_num (struct columns *col) { if (!is_valid_col(col)) { return 0; } if (!CURR_COL(col) || CURR_COL(col)[0] < '0' || CURR_COL(col)[0] > '9') return 0; return 1; } static int is_last_col (struct columns *col) { if (col->idx + 1 >= col->num) { return 1; } return 0; } static int is_dos_date(const char *str) { int len; if (!str) return 0; len = strlen (str); if (len != 8 && len != 10) return 0; if (str[2] != str[5]) return 0; if (!strchr ("\\-/", (int) str[2])) return 0; return 1; } static int is_iso_date(const char *str) { int len; if (!str) return 0; len = strlen (str); if (len != 10) return 0; if (str[4] != str[7]) return 0; if (!strchr ("\\-/", (int) str[4])) return 0; return 1; } static int is_week(const char *str) { if(strstr("SunMonTueWedThuFriSat", str) != NULL) return 1; return 0; } static int is_month(const char *str, struct avtm *tim) { static const char *const month = "JanFebMarAprMayJunJulAugSepOctNovDec"; char *pos; if((pos=strstr(month, str)) != NULL){ if(tim != NULL) tim->mon = (pos - month)/3; return 1; } return 0; } static int is_time(const char *str, struct avtm *tim) { char *p, *p2; if ((p=strchr(str, ':')) && (p2=strrchr(str, ':'))) { if (p != p2) { if (sscanf (str, "%2d:%2d:%2d", &tim->hour, &tim->min, &tim->sec) != 3) return 0; } else { if (sscanf (str, "%2d:%2d", &tim->hour, &tim->min) != 2) return 0; } } else return 0; return 1; } static int is_year(const char *str, struct avtm *tim) { long year; if (strchr(str,':')) return (0); if (strlen(str)!=4) return (0); if (sscanf(str, "%ld", &year) != 1) return (0); if (year < 1900 || year > 3000) return (0); tim->year = (int) (year - 1900); return (1); } /* * FIXME: this is broken. Consider following entry: * -rwx------ 1 root root 1 Aug 31 10:04 2904 1234 * where "2904 1234" is filename. Well, this code decodes it as year :-(. */ static int parse_filetype (char c) { switch (c){ case 'd': return AV_IFDIR; case 'b': return AV_IFBLK; case 'c': return AV_IFCHR; case 'l': return AV_IFLNK; case 's': return AV_IFSOCK; case 'p': return AV_IFIFO; case 'm': case 'n': /* Don't know what these are :-) */ case '-': case '?': return AV_IFREG; default: return -1; } } /* converts rw-rw-rw- into 0666 */ static int parse_filemode (const char *p) { int res = 0; switch (*(p++)){ case 'r': res |= 0400; break; case '-': break; default: return -1; } switch (*(p++)){ case 'w': res |= 0200; break; case '-': break; default: return -1; } switch (*(p++)){ case 'x': res |= 0100; break; case 's': res |= 0100 | AV_ISUID; break; case 'S': res |= AV_ISUID; break; case '-': break; default: return -1; } switch (*(p++)){ case 'r': res |= 0040; break; case '-': break; default: return -1; } switch (*(p++)){ case 'w': res |= 0020; break; case '-': break; default: return -1; } switch (*(p++)){ case 'x': res |= 0010; break; case 's': res |= 0010 | AV_ISGID; break; case 'S': res |= AV_ISGID; break; case '-': break; default: return -1; } switch (*(p++)){ case 'r': res |= 0004; break; case '-': break; default: return -1; } switch (*(p++)){ case 'w': res |= 0002; break; case '-': break; default: return -1; } switch (*(p++)){ case 'x': res |= 0001; break; case 't': res |= 0001 | AV_ISVTX; break; case 'T': res |= AV_ISVTX; break; case '-': break; default: return -1; } return res; } static avtime_t parse_filedate(struct columns *col, struct avtm *currtim) { char *p; struct avtm tim; int d[3]; int got_year = 0; avtime_t t; /* Let's setup default time values */ tim.year = currtim->year; tim.mon = currtim->mon; tim.day = currtim->day; tim.hour = 0; tim.min = 0; tim.sec = 0; if (!is_valid_col(col)) { return -1; } p = INC_COL(col); if (!is_valid_col(col)) { return -1; } /* We eat weekday name in case of extfs */ if(is_week(p)) p = INC_COL(col); /* Month name */ if(is_month(p, &tim)){ /* And we expect, it followed by day number */ if (!is_valid_col(col)) { return -1; } if (is_num (col)) tim.day = (int) atol (INC_COL(col)); else return -1; /* No day */ } else { /* We usually expect: Mon DD hh:mm Mon DD YYYY But in case of extfs we allow these date formats: Mon DD YYYY hh:mm Mon DD hh:mm YYYY Wek Mon DD hh:mm:ss YYYY MM-DD-YY hh:mm YYYY-MM-DD hh:mm (ISO 8601) where Mon is Jan-Dec, DD, MM, YY two digit day, month, year, YYYY four digit year, hh, mm, ss two digit hour, minute or second. */ /* Here just this special case with MM-DD-YY or MM-DD-YYYY */ if (is_dos_date(p)){ p[2] = p[5] = '-'; if(sscanf(p, "%2d-%2d-%2d", &d[0], &d[1], &d[2]) == 3){ /* We expect to get: 1. MM-DD-YY 2. DD-MM-YY 3. YY-MM-DD 4. YY-DD-MM */ /* Hmm... maybe, next time :)*/ /* At last, MM-DD-YY or MM-DD-YYYY*/ /* Months are zero based */ if (d[0] > 0) d[0]--; if (d[2] > 1900) { d[2] -= 1900; } else { /* Y2K madness */ if (d[2] < 70) d[2] += 100; } tim.mon = d[0]; tim.day = d[1]; tim.year = d[2]; got_year = 1; } else return -1; /* sscanf failed */ } else if (is_iso_date(p)) { if(sscanf(p, "%4d-%2d-%2d", &d[0], &d[1], &d[2]) == 3){ if(d[0] < 1900) return -1; d[0] -= 1900; if(d[1] < 1 || d[1] > 12) return -1; d[1]--; /* Months are zero based */ if(d[2] < 1 || d[2] > 31) return -1; tim.mon = d[1]; tim.day = d[2]; tim.year = d[0]; got_year = 1; } else return -1; /* sscanf failed */ } else return -1; /* unsupported format */ } /* Here we expect to find time and/or year */ if (!is_valid_col(col)) { return -1; } if (is_num (col)) { if(is_time(CURR_COL(col), &tim) || (got_year = is_year(CURR_COL(col), &tim))) { col->idx++; if (!is_valid_col(col)) { return -1; } /* This is a special case for ctime() or Mon DD YYYY hh:mm */ if(is_num (col) && !is_last_col(col)) { if(got_year) { if(is_time(CURR_COL(col), &tim)) col->idx++; /* year & time */ } else if((got_year = is_year(CURR_COL(col), &tim))) col->idx++; /* time & year */ } } /* only time or date */ } else return -1; /* Nor time or date */ /* * If the date is less than 6 months in the past, it is shown without year * other dates in the past or future are shown with year but without time * This does not check for years before 1900 ... I don't know, how * to represent them at all */ if (!got_year && currtim->mon < 6 && currtim->mon < tim.mon && tim.mon - currtim->mon >= 6) tim.year--; t = av_mktime(&tim); if(t < 0) t = 0; return t; } int av_parse_ls(struct lscache *cache, const char *line, struct avstat *stbuf, char **filename, char **linkname) { struct columns colstruct; struct columns *col = &colstruct; int i; int saveidx, lnkidx; char *p_copy = NULL; const char *lineorig = line; *linkname = NULL; *filename = NULL; if (strncmp (line, "total", 5) == 0) return 0; if ((i = parse_filetype(*(line++))) == -1) goto error; stbuf->mode = i; if (*line == ' ') /* Notwell 4 */ line++; if (*line == '['){ if (strlen (line) <= 8 || line [8] != ']') goto error; /* Should parse here the Notwell permissions :) */ if (AV_ISDIR (stbuf->mode)) stbuf->mode |= 755; else stbuf->mode |= 644; line += 9; } else { if ((i = parse_filemode(line)) == -1) goto error; stbuf->mode |= i; line += 9; /* This is for an extra ACL attribute (HP-UX) */ if (*line == '+') line++; } p_copy = av_strdup(line); split_text (p_copy, col); if (!is_valid_col(col)) { goto error; } stbuf->nlink = atol (INC_COL(col)); if (stbuf->nlink <= 0) goto error; if (!is_valid_col(col)) { goto error; } if (!is_num (col)) stbuf->uid = av_finduid (cache->ugid, CURR_COL(col), -1); else stbuf->uid = (uid_t) atol (CURR_COL(col)); if (col->num < 6) { goto error; } /* Mhm, the ls -lg did not produce a group field */ for (col->idx = 3; col->idx <= 5; col->idx++) if (is_month(CURR_COL(col), NULL) || is_week(CURR_COL(col)) || is_dos_date(CURR_COL(col)) || is_iso_date(CURR_COL(col))) break; saveidx = col->idx; col->idx = 2; if (saveidx == 6 || (saveidx == 5 && !AV_ISCHR(stbuf->mode) && !AV_ISBLK(stbuf->mode))) goto error; if (!(saveidx == 3 || (saveidx == 4 && (AV_ISCHR(stbuf->mode) || AV_ISBLK (stbuf->mode))))) { /* We have gid field */ if (is_num (col)) stbuf->gid = (gid_t) atol (INC_COL(col)); else stbuf->gid = av_findgid (cache->ugid, INC_COL(col), -1); } /* This is device */ if (AV_ISCHR (stbuf->mode) || AV_ISBLK (stbuf->mode)){ int maj, min; if (!is_num (col) || sscanf(INC_COL(col), " %d,", &maj) != 1) goto error; if (!is_num (col) || sscanf(INC_COL(col), " %d", &min) != 1) goto error; stbuf->rdev = av_mkdev(maj, min); stbuf->size = 0; } else { /* Common file size */ if (!is_num (col)) goto error; #ifdef HAVE_ATOLL stbuf->size = (avoff_t) atoll (INC_COL(col)); #else stbuf->size = (avoff_t) atol (INC_COL(col)); #endif stbuf->rdev = 0; } col->idx = saveidx; if (!is_valid_col(col)) { goto error; } stbuf->mtime.nsec = 0; stbuf->mtime.sec = parse_filedate(col, &cache->currtim); if (stbuf->mtime.sec == -1) goto error; if (!is_valid_col(col)) { goto error; } /* Use resulting time value */ stbuf->atime = stbuf->ctime = stbuf->mtime; stbuf->dev = 0; stbuf->ino = 0; stbuf->blksize = 512; stbuf->blocks = AV_DIV(stbuf->size, 512); saveidx = col->idx; lnkidx = 0; for (col->idx ++; col->idx < col->num; col->idx++) if (strcmp (CURR_COL(col), "->") == 0) { lnkidx = col->idx; break; } col->idx = saveidx; if (((AV_ISLNK (stbuf->mode) || /* Maybe a hardlink? (in extfs) */ (col->num == saveidx + 3 && stbuf->nlink > 1))) && lnkidx){ int p; int len; char *s; len = col->cptr[lnkidx] - col->cptr[col->idx] - 1; s = av_malloc(len + 1); strncpy(s, line + col->cptr[col->idx], len); s[len] = '\0'; *filename = s; s = av_strdup (line + col->cptr[lnkidx + 1]); p = strlen (s); if (s [p-1] == '\r' || s [p-1] == '\n') s [p-1] = 0; if (s [p-2] == '\r' || s [p-2] == '\n') s [p-2] = 0; *linkname = s; } else { int p; char *s; s = av_strdup (line + col->cptr[col->idx]); p = strlen (s); if (p >= 1 && (s [p-1] == '\r' || s [p-1] == '\n')) s [p-1] = 0; if (p >= 2 && (s [p-2] == '\r' || s [p-2] == '\n')) s [p-2] = 0; *filename = s; } av_free (p_copy); return 1; error: av_free(p_copy); av_log(AVLOG_WARNING, "Could not parse %s", lineorig); return 0; } avfs-1.1.4/src/archutil.c0000644000175000001440000001076114032341001012130 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "archint.h" static void archnode_destroy(struct archnode *nod) { av_free(nod->linkname); av_unref_obj(nod->data); } struct archnode *av_arch_new_node(struct archive *arch, struct entry *ent, int isdir) { struct archnode *nod; nod = (struct archnode *) av_namespace_get(ent); if(nod != NULL) { av_unref_obj(nod); av_unref_obj(ent); } AV_NEW_OBJ(nod, archnode_destroy); av_default_stat(&nod->st); nod->linkname = NULL; nod->offset = 0; nod->realsize = 0; nod->data = NULL; nod->flags = 0; nod->numopen = 0; /* FIXME: This scheme will allocate the same device to a tar file inside a tarfile. While this is not fatal, 'find -xdev' would not do what is expected. */ nod->st.dev = arch->avfs->dev; nod->st.ino = av_new_ino(arch->avfs); nod->st.mode = 0644 | AV_IFREG; nod->st.uid = arch->st.uid; nod->st.gid = arch->st.gid; nod->st.mtime = arch->st.mtime; nod->st.atime = nod->st.mtime; nod->st.ctime = nod->st.mtime; if(!isdir) nod->st.nlink = 1; else { struct entry *parent; struct archnode *parnod; nod->st.nlink = 2; parent = av_namespace_parent(ent); if(parent != NULL) { parnod = (struct archnode *) av_namespace_get(parent); if(parnod != NULL) parnod->st.nlink ++; av_unref_obj(parent); } } av_namespace_set(ent, nod); av_ref_obj(ent); return nod; } void av_arch_del_node(struct entry *ent) { struct archnode *nod; nod = (struct archnode *) av_namespace_get(ent); av_namespace_set(ent, NULL); av_unref_obj(nod); av_unref_obj(ent); } struct archnode *av_arch_default_dir(struct archive *arch, struct entry *ent) { struct archnode *nod; avmode_t mode; nod = av_arch_new_node(arch, ent, 1); mode = (arch->st.mode & 0777) | AV_IFDIR; if (mode & 0400) mode |= 0100; if (mode & 0040) mode |= 0010; if (mode & 0004) mode |= 0001; nod->st.mode = mode; nod->flags |= ANOF_AUTODIR; return nod; } struct entry *av_arch_resolve(struct archive *arch, const char *path, int create, int flags) { struct entry *ent; char *s, *p; char *pathdup = av_strdup(path); p = pathdup; ent = av_namespace_subdir(arch->ns, NULL); while(1) { struct entry *next; struct archnode *nod; char c; for(;*p == '/'; p++); for(s = p; *s && *s != '/'; s++); c = *s; *s = '\0'; if(!*p) break; nod = (struct archnode *) av_namespace_get(ent); if(nod == NULL) { if(!create) { av_unref_obj(ent); ent = NULL; break; } av_arch_default_dir(arch, ent); av_namespace_setflags(ent, flags, 0); } else if(!AV_ISDIR(nod->st.mode)) { if(create) av_log(AVLOG_WARNING, "ARCH: cannot create %s: Not a directory", path); av_unref_obj(ent); ent = NULL; break; } next = av_namespace_lookup_all(arch->ns, ent, p); if(next != NULL) { av_unref_obj(ent); ent = next; } *s = c; p = s; } av_free(pathdup); return ent; } int av_arch_isroot(struct archive *arch, struct entry *ent) { int res; struct entry *root; root = av_namespace_subdir(arch->ns, NULL); if(root == ent) res = 1; else res = 0; av_unref_obj(root); return res; } struct entry *av_arch_create(struct archive *arch, const char *path, int flags) { struct archnode *nod; struct entry *ent; ent = av_arch_resolve(arch, path, 1, flags); if(ent == NULL) return NULL; if(av_arch_isroot(arch, ent)) { av_log(AVLOG_WARNING, "Empty filename"); av_unref_obj(ent); return NULL; } nod = (struct archnode *) av_namespace_get(ent); if(nod != NULL) { av_log(AVLOG_WARNING, "Entry for %s already exists", path); av_unref_obj(ent); return NULL; } av_namespace_setflags(ent, flags, 0); return ent; } avfs-1.1.4/src/alloc.c0000644000175000001440000000323414032341001011404 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #if 1 #include "avfs.h" #include #include static int malloctr; static AV_LOCK_DECL(mallock); void av_check_malloc() { int ctr; AV_LOCK(mallock); ctr = malloctr; AV_UNLOCK(mallock); if(ctr != 0) av_log(AVLOG_WARNING, "Unfreed memory remaining (%i)", ctr); else av_log(AVLOG_DEBUG, "No unfreed memory remaining"); } static void out_of_memory() { av_log(AVLOG_ERROR, "Out of memory"); fprintf(stderr, "Out of memory\n"); exit(127); } void *av_malloc(avsize_t nbyte) { void *p; AV_LOCK(mallock); malloctr ++; AV_UNLOCK(mallock); if(nbyte == 0) nbyte = 1; p = malloc(nbyte); if(p == NULL) out_of_memory(); return p; } void *av_calloc(avsize_t nbyte) { void *p; AV_LOCK(mallock); malloctr ++; AV_UNLOCK(mallock); if(nbyte == 0) nbyte = 1; p = calloc(nbyte, 1); if(p == NULL) out_of_memory(); return p; } void *av_realloc(void *ptr, avsize_t nbyte) { void *p; AV_LOCK(mallock); if(ptr == 0) malloctr ++; else if(nbyte == 0) malloctr --; AV_UNLOCK(mallock); if(ptr == NULL && nbyte == 0) nbyte = 1; p = realloc(ptr, nbyte); if(p == NULL) out_of_memory(); return p; } void av_free(void *ptr) { AV_LOCK(mallock); if(ptr != NULL) malloctr --; AV_UNLOCK(mallock); if(ptr != NULL) free(ptr); } #endif avfs-1.1.4/src/serialfile.c0000644000175000001440000002414214032341001012432 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #ifdef linux /* For pread()/pwrite() */ #define _XOPEN_SOURCE 500 #endif #include "serialfile.h" #include "cache.h" #include #include #include struct sfile { const struct sfilefuncs *func; void *data; int flags; void *conndata; char *localfile; avoff_t numbytes; int fd; int dirty; enum { SF_BEGIN, SF_READ, SF_FINI } state; }; static void sfile_init(struct sfile *fil) { fil->conndata = NULL; fil->localfile = NULL; fil->numbytes = 0; fil->fd = -1; fil->state = SF_BEGIN; fil->dirty = 0; } static void sfile_end(struct sfile *fil) { close(fil->fd); av_del_tmpfile(fil->localfile); av_unref_obj(fil->conndata); } static void sfile_reset(struct sfile *fil) { sfile_end(fil); sfile_init(fil); } static void sfile_reset_usecache(struct sfile *fil) { fil->flags &= ~SFILE_NOCACHE; sfile_reset(fil); } static void sfile_delete(struct sfile *fil) { sfile_end(fil); av_unref_obj(fil->data); } struct sfile *av_sfile_new(const struct sfilefuncs *func, void *data, int flags) { struct sfile *fil; AV_NEW_OBJ(fil, sfile_delete); fil->func = func; fil->data = data; fil->flags = flags; sfile_init(fil); return fil; } static int sfile_open_localfile(struct sfile *fil) { int res; int openfl; res = av_get_tmpfile(&fil->localfile); if(res < 0) return res; openfl = O_RDWR | O_CREAT | O_TRUNC; fil->fd = open(fil->localfile, openfl, 0600); if(fil->fd == -1) { av_log(AVLOG_ERROR, "Error opening file %s: %s", fil->localfile, strerror(errno)); return -EIO; } return 0; } static int sfile_startget(struct sfile *fil) { int res; if(!(fil->flags & SFILE_NOCACHE)) { res = sfile_open_localfile(fil); if(res < 0) return res; } res = fil->func->startget(fil->data, &fil->conndata); if(res < 0) return res; fil->state = SF_READ; return 0; } static avssize_t sfile_do_read(struct sfile *fil, char *buf, avssize_t nbyte) { avsize_t numbytes; numbytes = 0; while(nbyte > 0) { avssize_t res; res = fil->func->read(fil->conndata, buf, nbyte); if(res < 0) return res; if(res == 0) { av_unref_obj(fil->conndata); fil->conndata = NULL; fil->state = SF_FINI; break; } nbyte -= res; buf += res; numbytes += res; } return numbytes; } static avssize_t sfile_cached_pwrite(struct sfile *fil, const char *buf, avssize_t nbyte, avoff_t offset) { avssize_t res; res = pwrite(fil->fd, buf, nbyte, offset); if(res == -1 && (errno == ENOSPC || errno == EDQUOT)) { av_cache_diskfull(); res = pwrite(fil->fd, buf, nbyte, offset); } if(res == -1) { av_log(AVLOG_ERROR, "Error writing file %s: %s", fil->localfile, strerror(errno)); return -EIO; } if(res != nbyte) { av_log(AVLOG_ERROR, "Error writing file %s: short write", fil->localfile); return -EIO; } /* FIXME: Checking free space is expensive. This should be done in a more clever way */ if(offset + nbyte > fil->numbytes) av_cache_checkspace(); return res; } static avssize_t sfile_read(struct sfile *fil, char *buf, avssize_t nbyte) { avssize_t res; res = sfile_do_read(fil, buf, nbyte); if(res <= 0) return res; if(!(fil->flags & SFILE_NOCACHE)) res = sfile_cached_pwrite(fil, buf, res, fil->numbytes); if(res > 0) fil->numbytes += res; return res; } static int sfile_dummy_read(struct sfile *fil, avoff_t offset) { avssize_t res; //avsize_t nact; const int tmpbufsize = 8192; char tmpbuf[tmpbufsize]; //if((fil->flags & SFILE_NOCACHE) != 0) // nact = AV_MIN(tmpbufsize, offset - fil->numbytes); //else // nact = tmpbufsize; res = sfile_read(fil, tmpbuf, tmpbufsize); if(res < 0) return res; return 0; } static avssize_t sfile_cached_pread(struct sfile *fil, char *buf, avssize_t nbyte, avoff_t offset) { avssize_t res; if(nbyte == 0) return 0; res = pread(fil->fd, buf, nbyte, offset); if(res < 0) { av_log(AVLOG_ERROR, "Error reading file %s: %s", fil->localfile, strerror(errno)); return -EIO; } if(res != nbyte) { av_log(AVLOG_ERROR, "Error reading file %s: short read", fil->localfile); return -EIO; } return res; } static avssize_t sfile_finished_read(struct sfile *fil, char *buf, avsize_t nbyte, avoff_t offset) { avsize_t nact; if(offset >= fil->numbytes) return 0; nact = AV_MIN(nbyte, fil->numbytes - offset); return sfile_cached_pread(fil, buf, nact, offset); } static avssize_t sfile_pread(struct sfile *fil, char *buf, avsize_t nbyte, avoff_t offset) { int res; while(fil->state == SF_READ) { if(offset + nbyte <= fil->numbytes) return sfile_cached_pread(fil, buf, nbyte, offset); if(offset == fil->numbytes) return sfile_read(fil, buf, nbyte); res = sfile_dummy_read(fil, offset); if(res < 0) return res; } return sfile_finished_read(fil, buf, nbyte, offset); } static avssize_t sfile_pread_start(struct sfile *fil, char *buf, avsize_t nbyte, avoff_t offset) { int res; if((fil->flags & SFILE_NOCACHE) != 0 && offset < fil->numbytes) sfile_reset_usecache(fil); if(fil->state == SF_BEGIN) { res = sfile_startget(fil); if(res < 0) return res; } return sfile_pread(fil, buf, nbyte, offset); } static avssize_t sfile_pread_force(struct sfile *fil, char *buf, avsize_t nbyte, avoff_t offset) { avssize_t res; res = sfile_pread_start(fil, buf, nbyte, offset); if(res < 0) { if(res == -EAGAIN && fil->numbytes > 0) { sfile_reset(fil); res = sfile_pread_start(fil, buf, nbyte, offset); } if(res < 0) { if(res == -EAGAIN) res = -EIO; sfile_reset(fil); } } return res; } avssize_t av_sfile_pread(struct sfile *fil, char *buf, avsize_t nbyte, avoff_t offset) { if(nbyte == 0) return 0; return sfile_pread_force(fil, buf, nbyte, offset); } static int sfile_read_until(struct sfile *fil, avoff_t offset, int finish) { avssize_t res; if(finish && (fil->flags & SFILE_NOCACHE) != 0) sfile_reset_usecache(fil); else if(fil->state == SF_FINI) return 0; res = sfile_pread_force(fil, NULL, 0, offset); if(res < 0) return res; if(finish && fil->state != SF_FINI) { av_unref_obj(fil->conndata); fil->conndata = NULL; fil->state = SF_FINI; } return 0; } avoff_t av_sfile_size(struct sfile *fil) { avssize_t res; res = sfile_read_until(fil, AV_MAXOFF, 0); if(res < 0) return res; return fil->numbytes; } int av_sfile_startget(struct sfile *fil) { return sfile_read_until(fil, 0, 0); } int av_sfile_truncate(struct sfile *fil, avoff_t length) { int res; if(length == 0) { if(fil->state == SF_FINI && fil->numbytes == 0) return 0; sfile_reset_usecache(fil); res = sfile_open_localfile(fil); if(res < 0) return res; fil->state = SF_FINI; fil->dirty = 1; return 0; } res = sfile_read_until(fil, length, 1); if(res < 0) return res; if(fil->numbytes > length) { ftruncate(fil->fd, length); fil->numbytes = length; fil->dirty = 1; } return 0; } avssize_t av_sfile_pwrite(struct sfile *fil, const char *buf, avsize_t nbyte, avoff_t offset) { avssize_t res; avoff_t end; if(nbyte == 0) return 0; res = sfile_read_until(fil, AV_MAXOFF, 1); if(res < 0) return res; res = sfile_cached_pwrite(fil, buf, nbyte, offset); if(res < 0) { sfile_reset(fil); return res; } end = offset + nbyte; if(end > fil->numbytes) fil->numbytes = end; fil->dirty = 1; return res; } static int sfile_writeout(struct sfile *fil, void *conndata) { avssize_t res; const int tmpbufsize = 8192; char tmpbuf[tmpbufsize]; avoff_t offset; for(offset = 0; offset < fil->numbytes;) { avsize_t nact = AV_MIN(tmpbufsize, fil->numbytes - offset); res = sfile_cached_pread(fil, tmpbuf, nact, offset); if(res < 0) return res; res = fil->func->write(conndata, tmpbuf, nact); if(res < 0) return res; offset += res; } return 0; } int av_sfile_flush(struct sfile *fil) { int res; void *conndata; if(!fil->dirty) return 0; res = fil->func->startput(fil->data, &conndata); if(res == 0) { res = sfile_writeout(fil, conndata); if(res == 0) res = fil->func->endput(conndata); } av_unref_obj(conndata); if(res < 0) sfile_reset(fil); fil->dirty = 0; return res; } void *av_sfile_getdata(struct sfile *fil) { return fil->data; } avoff_t av_sfile_diskusage(struct sfile *fil) { int res; struct stat buf; if(fil->fd == -1) return 0; res = fstat(fil->fd, &buf); if(res == -1) { av_log(AVLOG_ERROR, "Error in fstat() for %s: %s", fil->localfile, strerror(errno)); return -EIO; } return buf.st_blocks * 512; } avfs-1.1.4/src/namespace.c0000644000175000001440000002331114032341001012244 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ /* namespace.c Provides functions for manipulating string-indexed tree-structured 'namespaces'. For examples of use see archive.c, remote.c, state.c. */ #include "namespace.h" #include "avfs.h" #include #define HASH_TABLE_MIN_SIZE 11 #define HASH_TABLE_MAX_SIZE 13845163 static AV_LOCK_DECL(namespace_lock); static pthread_once_t namespace_lock_initialized = PTHREAD_ONCE_INIT; static void namespace_init_lock() { AV_INIT_RECURSIVELOCK(namespace_lock); } #define list_entry(ptr, type, member) \ ((type *)((char *)(ptr)-(unsigned long)(&((type *)0)->member))) struct list_head { struct list_head *next; struct list_head *prev; }; struct entry { char *name; int flags; struct list_head subdir; struct list_head child; struct list_head hash; struct entry *parent; struct namespace *ns; void *data; }; struct namespace { struct list_head root; unsigned int hashsize; unsigned int numentries; struct list_head *hashtab; }; static void init_list_head(struct list_head *head) { head->next = head; head->prev = head; } static void list_del(struct list_head *entry) { struct list_head *next = entry->next; struct list_head *prev = entry->prev; prev->next = next; next->prev = prev; } static void list_add(struct list_head *entry, struct list_head *head) { struct list_head *next = head; struct list_head *prev = head->prev; entry->next = next; entry->prev = prev; prev->next = entry; next->prev = entry; } static unsigned int spaced_primes_closest (unsigned int num) { static const unsigned int primes[] = { 11, 19, 37, 73, 109, 163, 251, 367, 557, 823, 1237, 1861, 2777, 4177, 6247, 9371, 14057, 21089, 31627, 47431, 71143, 106721, 160073, 240101, 360163, 540217, 810343, 1215497, 1823231, 2734867, 4102283, 6153409, 9230113, 13845163 }; static const unsigned int nprimes = sizeof(primes) / sizeof(primes[0]); unsigned int i; for (i = 0; i < nprimes; i++) if (primes[i] > num) return primes[i]; return primes[nprimes - 1]; } static unsigned int namespace_hash(struct entry *parent, const char *name, unsigned int namelen) { unsigned int hash = (unsigned long) parent >> 2; for(; namelen; namelen--, name++) { hash = (hash << 4) | (hash >> 28); hash ^= (unsigned int) *name; } return hash; } static struct list_head *alloc_hash_table(unsigned int size) { struct list_head *hashtab; unsigned int i; hashtab = (struct list_head *) av_malloc(sizeof(*hashtab) * size); for(i = 0; i < size; i++) init_list_head(&hashtab[i]); return hashtab; } static void resize_hashtable(struct namespace *ns) { float nodes_per_list; unsigned int new_size; struct list_head *new_tab; unsigned int i; int maxlen = 0; nodes_per_list = (float) ns->numentries / (float) ns->hashsize; if ((nodes_per_list > 0.1 || ns->hashsize <= HASH_TABLE_MIN_SIZE) && (nodes_per_list < 3.0 || ns->hashsize >= HASH_TABLE_MAX_SIZE)) return; new_size = spaced_primes_closest(ns->numentries); new_tab = alloc_hash_table(new_size); for(i = 0; i < ns->hashsize; i++) { struct list_head *head = &ns->hashtab[i]; struct list_head *ptr; int len = 0; for(ptr = head->next; ptr != head;) { struct entry *ent = list_entry(ptr, struct entry, hash); unsigned int hash = namespace_hash(ent->parent, ent->name, strlen(ent->name)); ptr = ptr->next; list_add(&ent->hash, &new_tab[hash % new_size]); len ++; } if(len > maxlen) maxlen = len; } av_free(ns->hashtab); ns->hashtab = new_tab; ns->hashsize = new_size; } static void namespace_delete(struct namespace *ns) { av_free(ns->hashtab); } struct namespace *av_namespace_new() { struct namespace *ns; pthread_once(&namespace_lock_initialized, namespace_init_lock); AV_NEW_OBJ(ns, namespace_delete); init_list_head(&ns->root); ns->numentries = 0; ns->hashsize = HASH_TABLE_MIN_SIZE; ns->hashtab = alloc_hash_table(ns->hashsize); return ns; } /* remove the entry from internal list while holding the locked * so it cannot be looked up by a different thread */ static void free_entry_locked(struct entry *ent) { list_del(&ent->child); list_del(&ent->hash); ent->ns->numentries --; resize_hashtable(ent->ns); } /* this is the regular destructor called outside the lock */ static void free_entry(struct entry *ent) { av_free(ent->name); av_unref_obj(ent->parent); av_unref_obj(ent->ns); } static struct list_head *subdir_head(struct namespace *ns, struct entry *ent) { if(ent != NULL) return &ent->subdir; else return &ns->root; } static struct entry *lookup_name(struct namespace *ns, struct entry *parent, const char *name, unsigned int namelen) { struct entry *ent; struct list_head *ptr; unsigned int hash = namespace_hash(parent, name, namelen); struct list_head *hashlist = &ns->hashtab[hash % ns->hashsize]; for(ptr = hashlist->next; ptr != hashlist; ptr = ptr->next) { ent = list_entry(ptr, struct entry, hash); if(ent->parent == parent && strlen(ent->name) == namelen && strncmp(name, ent->name, namelen) == 0) { av_ref_obj(ent); return ent; } } AV_NEW_OBJ(ent, free_entry); ent->name = av_strndup(name, namelen); ent->flags = 0; /* set namespace lock since the entry will be in the hash without a reference. This prevents deleting the object in one thread while finding the pointer in another thread. */ av_obj_set_ref_lock(ent, &namespace_lock); /* activate destructor called while holding the lock */ av_obj_set_destr_locked(ent,(void (*)(void *)) free_entry_locked); init_list_head(&ent->subdir); list_add(&ent->child, subdir_head(ns, parent)); list_add(&ent->hash, hashlist); ent->ns = ns; av_ref_obj(ent->ns); ent->parent = parent; av_ref_obj(ent->parent); ns->numentries ++; resize_hashtable(ns); return ent; } struct entry *av_namespace_lookup(struct namespace *ns, struct entry *prev, const char *name) { struct entry *ent; AV_LOCK(namespace_lock); if(name == NULL) { ent = prev->parent; av_ref_obj(ent); } else ent = lookup_name(ns, prev, name, strlen(name)); AV_UNLOCK(namespace_lock); return ent; } struct entry *av_namespace_lookup_all(struct namespace *ns, struct entry *prev, const char *name) { if(name != NULL) { if(strcmp(name, ".") == 0) { av_ref_obj(prev); return prev; } if(strcmp(name, "..") == 0) name = NULL; } return av_namespace_lookup(ns, prev, name); } struct entry *av_namespace_resolve(struct namespace *ns, const char *path) { struct entry *ent; const char *s; AV_LOCK(namespace_lock); ent = NULL; while(*path) { struct entry *next; for(s = path; *s && *s != '/'; s++); next = lookup_name(ns, ent, path, s - path); av_unref_obj(ent); ent = next; for(path = s; *path == '/'; path++); } AV_UNLOCK(namespace_lock); return ent; } static char *getpath(struct entry *ent) { char *path; if(ent->parent == NULL) return av_strdup(ent->name); path = getpath(ent->parent); return av_stradd(path, "/", ent->name, NULL); } char *av_namespace_getpath(struct entry *ent) { char *path; AV_LOCK(namespace_lock); path = getpath(ent); AV_UNLOCK(namespace_lock); return path; } void av_namespace_setflags(struct entry *ent, int setflags, int resetflags) { AV_LOCK(namespace_lock); ent->flags = (ent->flags | setflags) & ~resetflags; AV_UNLOCK(namespace_lock); } void av_namespace_set(struct entry *ent, void *data) { AV_LOCK(namespace_lock); ent->data = data; AV_UNLOCK(namespace_lock); } void *av_namespace_get(struct entry *ent) { void *data; AV_LOCK(namespace_lock); data = ent->data; AV_UNLOCK(namespace_lock); return data; } char *av_namespace_name(struct entry *ent) { return av_strdup(ent->name); } static struct entry *current_entry(struct list_head *head, struct list_head *curr) { if(curr == head) return NULL; else return list_entry(curr, struct entry, child); } struct entry *av_namespace_next(struct entry *ent) { struct entry *rent; AV_LOCK(namespace_lock); rent = current_entry(subdir_head(ent->ns, ent->parent), ent->child.next); av_ref_obj(rent); AV_UNLOCK(namespace_lock); return rent; } struct entry *av_namespace_subdir(struct namespace *ns, struct entry *ent) { struct entry *rent; struct list_head *head; AV_LOCK(namespace_lock); head = subdir_head(ns, ent); rent = current_entry(head, head->next); av_ref_obj(rent); AV_UNLOCK(namespace_lock); return rent; } struct entry *av_namespace_parent(struct entry *ent) { struct entry *parent; AV_LOCK(namespace_lock); parent = ent->parent; av_ref_obj(parent); AV_UNLOCK(namespace_lock); return parent; } struct entry *av_namespace_nth(struct namespace *ns, struct entry *parent, unsigned int n) { struct list_head *ptr; struct list_head *head; struct entry *ent = NULL; AV_LOCK(namespace_lock); head = subdir_head(ns, parent); for(ptr = head->next; ptr != head; ptr = ptr->next) { if(n == 0) { ent = list_entry(ptr, struct entry, child); av_ref_obj(ent); break; } n--; } AV_UNLOCK(namespace_lock); return ent; } avfs-1.1.4/src/oper.c0000644000175000001440000002667114032341001011271 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000 Miklos Szeredi Copyright (C) 2006 Ralf Hoffmann (ralf@boomerangsworld.de) This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "oper.h" #include "operutil.h" #include "internal.h" #include static int check_file_access(vfile *vf, int access) { if((vf->flags & AVO_DIRECTORY) != 0) return -EBADF; access = (access + 1) & AVO_ACCMODE; if(((vf->flags + 1) & access) == 0) return -EBADF; return 0; } int av_file_open(vfile *vf, ventry *ve, int flags, avmode_t mode) { int res; struct avfs *avfs = ve->mnt->avfs; res = av_copy_vmount(ve->mnt, &vf->mnt); if(res < 0) return res; if((flags & AVO_EXCL) != 0 && (flags & AVO_CREAT) == 0) flags &= ~AVO_EXCL; if((flags & AVO_TRUNC) != 0 && !AV_ISWRITE(flags)) { if((flags & AVO_ACCMODE) == AVO_RDONLY) flags = (flags & ~AVO_ACCMODE) | AVO_RDWR; else flags = (flags & ~AVO_ACCMODE) | AVO_WRONLY; } AVFS_LOCK(avfs); res = avfs->open(ve, flags, (mode & 07777), &vf->data); AVFS_UNLOCK(avfs); if(res < 0) { av_free_vmount(vf->mnt); vf->mnt = NULL; return res; } vf->ptr = 0; vf->flags = flags; return 0; } int av_file_close(vfile *vf) { int res; struct avfs *avfs = vf->mnt->avfs; AVFS_LOCK(avfs); res = avfs->close(vf); AVFS_UNLOCK(avfs); av_free_vmount(vf->mnt); vf->mnt = NULL; return res; } avssize_t av_file_read(vfile *vf, char *buf, avsize_t nbyte) { int res; res = check_file_access(vf, AVO_RDONLY); if(res == 0) { struct avfs *avfs = vf->mnt->avfs; AVFS_LOCK(avfs); res = avfs->read(vf, buf, nbyte); AVFS_UNLOCK(avfs); } return res; } /* read, specifying offset into file */ avssize_t av_file_pread(vfile *vf, char *buf, avsize_t nbyte, avoff_t offset) { int res; res = check_file_access(vf, AVO_RDONLY); if(res == 0) { avoff_t sres; struct avfs *avfs = vf->mnt->avfs; AVFS_LOCK(avfs); sres = avfs->lseek(vf, offset, AVSEEK_SET); if(sres < 0) res = sres; else res = avfs->read(vf, buf, nbyte); AVFS_UNLOCK(avfs); } return res; } avssize_t av_file_write(vfile *vf, const char *buf, avsize_t nbyte) { int res; res = check_file_access(vf, AVO_WRONLY); if(res == 0) { struct avfs *avfs = vf->mnt->avfs; AVFS_LOCK(avfs); res = avfs->write(vf, buf, nbyte); AVFS_UNLOCK(avfs); } return res; } /* write, specifying offset into file */ avssize_t av_file_pwrite(vfile *vf, const char *buf, avsize_t nbyte, avoff_t offset) { int res; res = check_file_access(vf, AVO_WRONLY); if(res == 0) { avoff_t sres; struct avfs *avfs = vf->mnt->avfs; AVFS_LOCK(avfs); sres = avfs->lseek(vf, offset, AVSEEK_SET); if(sres < 0) res = sres; else res = avfs->write(vf, buf, nbyte); AVFS_UNLOCK(avfs); } return res; } int av_file_truncate(vfile *vf, avoff_t length) { int res; struct avfs *avfs = vf->mnt->avfs; if(length < 0) return -EINVAL; res = check_file_access(vf, AVO_WRONLY); if(res == 0) { AVFS_LOCK(avfs); res = avfs->truncate(vf, length); AVFS_UNLOCK(avfs); } return res; } int av_file_getattr(vfile *vf, struct avstat *buf, int attrmask) { int res; struct avfs *avfs = vf->mnt->avfs; AVFS_LOCK(avfs); res = avfs->getattr(vf, buf, attrmask); AVFS_UNLOCK(avfs); return res; } int av_file_setattr(vfile *vf, struct avstat *buf, int attrmask) { int res; struct avfs *avfs = vf->mnt->avfs; AVFS_LOCK(avfs); res = avfs->setattr(vf, buf, attrmask); AVFS_UNLOCK(avfs); return res; } avoff_t av_file_lseek(vfile *vf, avoff_t offset, int whence) { avoff_t res; struct avfs *avfs = vf->mnt->avfs; AVFS_LOCK(avfs); res = avfs->lseek(vf, offset, whence); AVFS_UNLOCK(avfs); return res; } static void file_destroy(vfile *vf) { if(vf->mnt != NULL) av_file_close(vf); AV_FREELOCK(vf->lock); } int av_open(ventry *ve, int flags, avmode_t mode, vfile **resp) { int res; vfile *vf; AV_NEW_OBJ(vf, file_destroy); AV_INITLOCK(vf->lock); res = av_file_open(vf, ve, flags, mode); if(res < 0) { AV_FREELOCK(vf->lock); av_unref_obj(vf); } else *resp = vf; return res; } /* You only need to call this if you need the return value of close. Otherwise it is enough to unreferece the vfile */ int av_close(vfile *vf) { int res = 0; if(vf != NULL) { res = av_file_close(vf); av_unref_obj(vf); } return res; } avssize_t av_read(vfile *vf, char *buf, avsize_t nbyte) { avssize_t res; AV_LOCK(vf->lock); res = av_file_read(vf, buf, nbyte); AV_UNLOCK(vf->lock); return res; } avssize_t av_pread(vfile *vf, char *buf, avsize_t nbyte, avoff_t offset) { avssize_t res; AV_LOCK(vf->lock); res = av_file_pread(vf, buf, nbyte, offset); AV_UNLOCK(vf->lock); return res; } avssize_t av_write(vfile *vf, const char *buf, avsize_t nbyte) { avssize_t res; AV_LOCK(vf->lock); res = av_file_write(vf, buf, nbyte); AV_UNLOCK(vf->lock); return res; } avssize_t av_pwrite(vfile *vf, const char *buf, avsize_t nbyte, avoff_t offset) { avssize_t res; AV_LOCK(vf->lock); res = av_file_pwrite(vf, buf, nbyte, offset); AV_UNLOCK(vf->lock); return res; } avoff_t av_lseek(vfile *vf, avoff_t offset, int whence) { avoff_t res; AV_LOCK(vf->lock); res = av_file_lseek(vf, offset, whence); AV_UNLOCK(vf->lock); return res; } int av_ftruncate(vfile *vf, avoff_t length) { int res; AV_LOCK(vf->lock); res = av_file_truncate(vf, length); AV_UNLOCK(vf->lock); return res; } int av_fgetattr(vfile *vf, struct avstat *buf, int attrmask) { int res; AV_LOCK(vf->lock); res = av_file_getattr(vf, buf, attrmask); AV_UNLOCK(vf->lock); return res; } int av_fsetattr(vfile *vf, struct avstat *buf, int attrmask) { int res; AV_LOCK(vf->lock); res = av_file_setattr(vf, buf, attrmask); AV_UNLOCK(vf->lock); return res; } int av_getattr(ventry *ve, struct avstat *buf, int attrmask, int flags) { int res; vfile vf; res = av_file_open(&vf, ve, AVO_NOPERM | flags, 0); if(res == 0) { res = av_file_getattr(&vf, buf, attrmask); av_file_close(&vf); } return res; } int av_access(ventry *ve, int amode) { int res; struct avfs *avfs = ve->mnt->avfs; AVFS_LOCK(avfs); res = avfs->access(ve, amode); AVFS_UNLOCK(avfs); return res; } static int count_components(const char *p) { int ctr; for (; *p == '/'; p++); for (ctr = 0; *p; ctr++) { for (; *p && *p != '/'; p++); for (; *p == '/'; p++); } return ctr; } static void strip_common(const char **sp, const char **tp) { const char *s = *sp; const char *t = *tp; do { for (; *s == '/'; s++); for (; *t == '/'; t++); *tp = t; *sp = s; for (; *s == *t && *s && *s != '/'; s++, t++); } while ((*s == *t && *s) || (!*s && *t == '/') || (*s == '/' && !*t)); } static void transform_symlink(const char *path, const char *linkdest, char **linkp) { const char *l = linkdest; char *newlink; char *s; int dotdots; int i; /* TODO: possible improvement: * absolute symlinks in archives (mount points in general) * could be interpreted with the mount point as root directory * do make this work the base path should be removed from the path var */ /* const char *b = base_path; */ if (linkp == NULL) return; *linkp = NULL; if (l[0] != '/' || path[0] != '/') return; /* strip_common(&path, &b); if (*b) return; */ strip_common(&l, &path); dotdots = count_components(path); if (!dotdots) return; dotdots--; newlink = malloc(dotdots * 3 + strlen(l) + 2); if (!newlink) { av_log(AVLOG_ERROR, "transform_symlink: memory allocation failed"); exit(1); } for (s = newlink, i = 0; i < dotdots; i++, s += 3) strcpy(s, "../"); if (l[0]) strcpy(s, l); else if (!dotdots) strcpy(s, "."); else s[0] = '\0'; *linkp = newlink; } int av_readlink(ventry *ve, char **bufp) { int res; struct avfs *avfs = ve->mnt->avfs; AVFS_LOCK(avfs); res = avfs->readlink(ve, bufp); AVFS_UNLOCK(avfs); if(res == 0) { if(*bufp[0] == '/' && av_get_symlink_rewrite() == 1) { char *rel_link = NULL; char *path = NULL; int res2; res2 = av_generate_path(ve, &path); if(res2 == 0) { transform_symlink(path, *bufp, &rel_link); if(rel_link != NULL) { free(*bufp); *bufp = rel_link; } av_free(path); } } } return res; } int av_unlink(ventry *ve) { int res; struct avfs *avfs = ve->mnt->avfs; AVFS_LOCK(avfs); res = avfs->unlink(ve); AVFS_UNLOCK(avfs); return res; } int av_rmdir(ventry *ve) { int res; struct avfs *avfs = ve->mnt->avfs; AVFS_LOCK(avfs); res = avfs->rmdir(ve); AVFS_UNLOCK(avfs); return res; } int av_mkdir(ventry *ve, avmode_t mode) { int res; struct avfs *avfs = ve->mnt->avfs; AVFS_LOCK(avfs); res = avfs->mkdir(ve, (mode & 07777)); AVFS_UNLOCK(avfs); return res; } int av_mknod(ventry *ve, avmode_t mode, avdev_t dev) { int res; struct avfs *avfs = ve->mnt->avfs; AVFS_LOCK(avfs); res = avfs->mknod(ve, mode, dev); AVFS_UNLOCK(avfs); return res; } int av_symlink(const char *path, ventry *newve) { int res; struct avfs *avfs = newve->mnt->avfs; AVFS_LOCK(avfs); res = avfs->symlink(path, newve); AVFS_UNLOCK(avfs); return res; } static int compare_mount(struct avmount *mnt1, struct avmount *mnt2) { int res; ventry tmpve; char *path1; char *path2; /* FIXME: checking should be done mount per mount, not with av_generate_path() */ tmpve.data = NULL; tmpve.mnt = mnt1; res = av_generate_path(&tmpve, &path1); if(res == 0) { tmpve.mnt = mnt2; res = av_generate_path(&tmpve, &path2); if(res == 0) { if(strcmp(path1, path2) != 0) res = -EXDEV; av_free(path2); } av_free(path1); } return res; } int av_rename(ventry *ve, ventry *newve) { int res; res = compare_mount(ve->mnt, newve->mnt); if(res == 0) { struct avfs *avfs = ve->mnt->avfs; AVFS_LOCK(avfs); res = avfs->rename(ve, newve); AVFS_UNLOCK(avfs); } return res; } int av_link(ventry *ve, ventry *newve) { int res; res = compare_mount(ve->mnt, newve->mnt); if(res == 0) { struct avfs *avfs = ve->mnt->avfs; AVFS_LOCK(avfs); res = avfs->link(ve, newve); AVFS_UNLOCK(avfs); } return res; } avfs-1.1.4/src/filtprog.h0000644000175000001440000000066114032341001012146 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" #include "serialfile.h" struct filtdata { char **prog; char **revprog; }; struct sfile *av_filtprog_new(vfile *vf, struct filtdata *fitdat); void av_filtprog_change(struct sfile *sf, vfile *newvf); avfs-1.1.4/src/Makefile.am0000644000175000001440000000216014032341001012177 00000000000000EXTRA_DIST = make_info AM_CPPFLAGS = -I$(top_srcdir)/include @ZLIB_INCLUDE@ @BZLIB_INCLUDE@ @CPPFLAGS@ -DBZ_NO_STDIO AM_CFLAGS = @CFLAGS@ noinst_LTLIBRARIES = libavfscore.la libavfscore_la_LDFLAGS = -module libavfscore_la_SOURCES = utils.c \ sysdeps.c \ tmpfile.c \ alloc.c \ parsels.c \ ugid.c \ parse.c \ prog.c \ runprog.c \ cache.c \ filebuf.c \ local.c \ default.c \ oper.c \ fdops.c \ virtual.c \ modload.c \ remote.c \ archive.c \ archutil.c \ namespace.c \ state.c \ serialfile.c \ filtprog.c \ filter.c \ filecache.c \ socket.c \ passwords.c \ zread.c \ exit.c \ realfile.c \ bzread.c if USE_LIBLZMA libavfscore_la_SOURCES += xzread.c endif if USE_LIBZSTD libavfscore_la_SOURCES += zstdread.c endif if USE_LIBLZIP libavfscore_la_SOURCES += lzipread.c endif noinst_HEADERS = \ archint.h \ filtprog.h \ local.h \ mod_static.h nodist_libavfscore_la_SOURCES = info.h BUILT_SOURCES = info.h info.h: rm -f info.h $(srcdir)/make_info $(moduledir) > info.h CLEANFILES = info.h avfs-1.1.4/src/archint.h0000644000175000001440000000110414032341001011741 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000-2001 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "archive.h" #define ARCHF_READY (1 << 0) struct archive { int flags; avmutex lock; struct namespace *ns; struct avstat st; unsigned int numread; vfile *basefile; struct avfs *avfs; }; struct archent { struct archive *arch; struct entry *ent; }; struct archnode *av_arch_default_dir(struct archive *arch, struct entry *ent); avfs-1.1.4/src/xzread.c0000644000175000001440000001614014032341001011607 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2010 Ralf Hoffmann This program can be distributed under the terms of the GNU GPL. See the file COPYING. based on bzread.c */ #include "config.h" #include "xzfile.h" #include "lzma.h" #include "oper.h" #include "exit.h" #include #include #define INBUFSIZE 16384 #define OUTBUFSIZE 32768 #define INITIAL_MEMLIMIT (100<<20) struct xzstreamcache { int id; lzma_stream *s; }; /* FIXME: the streamcache should be cleaned up after a short timeout because it uses a LOT of memory */ static struct xzstreamcache xzscache; static int xzread_nextid; static AV_LOCK_DECL(xzread_lock); struct xzcache { int id; avoff_t size; }; struct xzfile { lzma_stream *s; int iseof; int iserror; int id; /* The id of the last used xzcache */ vfile *infile; char inbuf[INBUFSIZE]; }; void xz_internal_error(int errorcode) { av_log(AVLOG_ERROR, "XZ: internal error %i", errorcode); } static avoff_t xz_total_in(lzma_stream *s) { return (avoff_t) s->total_in; } static avoff_t xz_total_out(lzma_stream *s) { return (avoff_t) s->total_out; } static void xz_delete_stream(lzma_stream *s) { if(s != NULL) { lzma_end(s); av_free(s); } } static int xz_new_stream(lzma_stream **resp) { int res; lzma_stream *s; lzma_stream tmp = LZMA_STREAM_INIT; AV_NEW(s); *s = tmp; /* TODO: choose good memory limit */ res = lzma_auto_decoder(s, INITIAL_MEMLIMIT, 0); if(res != LZMA_OK) { *resp = NULL; av_log(AVLOG_ERROR, "XZ: decompress init error: %i", res); return -EIO; } *resp = s; return 0; } static void xzfile_scache_delete() { AV_LOCK(xzread_lock); if(xzscache.id != 0) { xz_delete_stream(xzscache.s); xzscache.id = 0; } AV_UNLOCK(xzread_lock); } static void xzfile_scache_save(int id, lzma_stream *s) { static int regdestroy = 0; if(!regdestroy) { regdestroy = 1; av_add_exithandler(xzfile_scache_delete); } if(id == 0 || s == NULL) { xz_delete_stream(s); return; } if(xzscache.id != 0) xz_delete_stream(xzscache.s); xzscache.id = id; xzscache.s = s; } static int xzfile_reset(struct xzfile *fil) { /* FIXME: Is it a good idea to save the previous state or not? */ if (fil->iseof || fil->iserror) xz_delete_stream(fil->s); else xzfile_scache_save(fil->id, fil->s); fil->iseof = 0; fil->iserror = 0; return xz_new_stream(&fil->s); } static int xzfile_fill_inbuf(struct xzfile *fil) { avssize_t res; avoff_t inoff = xz_total_in(fil->s); res = av_pread(fil->infile, fil->inbuf, INBUFSIZE, inoff); if(res < 0) return res; fil->s->next_in = (uint8_t*)fil->inbuf; fil->s->avail_in = res; return 0; } static int xzfile_decompress(struct xzfile *fil, struct xzcache *zc) { int res; //unsigned char *start; if(fil->s->avail_in == 0) { res = xzfile_fill_inbuf(fil); if(res < 0) return res; if(fil->s->avail_in == 0) { /* still no byte available */ av_log(AVLOG_ERROR, "XZ: decompress error"); return -EIO; } } //start = (unsigned char*)( fil->s->next_out ); res = lzma_code(fil->s, LZMA_RUN); if(res == LZMA_STREAM_END) { fil->iseof = 1; AV_LOCK(xzread_lock); zc->size = xz_total_out(fil->s); AV_UNLOCK(xzread_lock); return 0; } /*TODO handle LZMA_MEMLIMIT_ERROR */ if(res != LZMA_OK) { av_log(AVLOG_ERROR, "XZ: decompress error: %i", res); return -EIO; } /*TODO what if avail_in is not 0? */ return 0; } static int xzfile_read(struct xzfile *fil, struct xzcache *zc, char *buf, avsize_t nbyte) { int res; fil->s->next_out = (uint8_t*)buf; fil->s->avail_out = nbyte; while(fil->s->avail_out != 0 && !fil->iseof) { res = xzfile_decompress(fil, zc); if(res < 0) return res; } return nbyte - fil->s->avail_out; } static int xzfile_skip_to(struct xzfile *fil, struct xzcache *zc, avoff_t offset) { int res; uint8_t outbuf[OUTBUFSIZE]; while(!fil->iseof) { avoff_t curroff = xz_total_out(fil->s); if(curroff == offset) break; /* FIXME: Maybe cache some data as well */ fil->s->next_out = outbuf; fil->s->avail_out = AV_MIN(OUTBUFSIZE, offset - curroff); res = xzfile_decompress(fil, zc); if(res < 0) return res; } return 0; } static avssize_t av_xzfile_do_pread(struct xzfile *fil, struct xzcache *zc, char *buf, avsize_t nbyte, avoff_t offset) { avssize_t res; avoff_t curroff; fil->id = zc->id; curroff = xz_total_out(fil->s); if(offset != curroff) { AV_LOCK(xzread_lock); if ( curroff > offset ) { res = xzfile_reset( fil ); } else { res = 0; } AV_UNLOCK(xzread_lock); if(res < 0) return res; res = xzfile_skip_to(fil, zc, offset); if(res < 0) return res; } res = xzfile_read(fil, zc, buf, nbyte); return res; } avssize_t av_xzfile_pread(struct xzfile *fil, struct xzcache *zc, char *buf, avsize_t nbyte, avoff_t offset) { avssize_t res; if(fil->iserror) return -EIO; res = av_xzfile_do_pread(fil, zc, buf, nbyte, offset); if(res < 0) fil->iserror = 1; return res; } int av_xzfile_size(struct xzfile *fil, struct xzcache *zc, avoff_t *sizep) { int res; avoff_t size; AV_LOCK(xzread_lock); size = zc->size; AV_UNLOCK(xzread_lock); if(size != -1 || fil == NULL) { *sizep = size; return 0; } fil->id = zc->id; AV_LOCK(xzread_lock); res = xzfile_reset( fil ); AV_UNLOCK(xzread_lock); if(res < 0) return res; res = xzfile_skip_to(fil, zc, AV_MAXOFF); if(res < 0) return res; AV_LOCK(xzread_lock); size = zc->size; AV_UNLOCK(xzread_lock); if(size == -1) { av_log(AVLOG_ERROR, "XZ: Internal error: could not find size"); return -EIO; } *sizep = size; return 0; } static void xzfile_destroy(struct xzfile *fil) { AV_LOCK(xzread_lock); xzfile_scache_save(fil->id, fil->s); AV_UNLOCK(xzread_lock); } struct xzfile *av_xzfile_new(vfile *vf) { int res; struct xzfile *fil; AV_NEW_OBJ(fil, xzfile_destroy); fil->iseof = 0; fil->iserror = 0; fil->infile = vf; fil->id = 0; res = xz_new_stream(&fil->s); if(res < 0) fil->iserror = 1; return fil; } static void xzcache_destroy(struct xzcache *zc) { } struct xzcache *av_xzcache_new() { struct xzcache *zc; AV_NEW_OBJ(zc, xzcache_destroy); zc->size = -1; AV_LOCK(xzread_lock); if(xzread_nextid == 0) xzread_nextid = 1; zc->id = xzread_nextid ++; AV_UNLOCK(xzread_lock); return zc; } avfs-1.1.4/src/local.h0000644000175000001440000000037014032341001011407 00000000000000/* AVFS: A Virtual File System Library Copyright (C) 2000 Miklos Szeredi This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #include "avfs.h" int av_init_module_local(); avfs-1.1.4/config.sub0000755000175000001440000010264414032341013011352 00000000000000#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2020 Free Software Foundation, Inc. timestamp='2020-11-07' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, see . # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that # program. This Exception is an additional permission under section 7 # of the GNU General Public License, version 3 ("GPLv3"). # Please send patches to . # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=$(echo "$0" | sed -e 's,.*/,,') usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS or ALIAS Canonicalize a configuration name. Options: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2020 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) echo "$timestamp" ; exit ;; --version | -v ) echo "$version" ; exit ;; --help | --h* | -h ) echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. break ;; -* ) echo "$me: invalid option $1$help" >&2 exit 1 ;; *local*) # First pass through any local machine types. echo "$1" exit ;; * ) break ;; esac done case $# in 0) echo "$me: missing argument$help" >&2 exit 1;; 1) ;; *) echo "$me: too many arguments$help" >&2 exit 1;; esac # Split fields of configuration type # shellcheck disable=SC2162 IFS="-" read field1 field2 field3 field4 <&2 exit 1 ;; *-*-*-*) basic_machine=$field1-$field2 basic_os=$field3-$field4 ;; *-*-*) # Ambiguous whether COMPANY is present, or skipped and KERNEL-OS is two # parts maybe_os=$field2-$field3 case $maybe_os in nto-qnx* | linux-* | uclinux-uclibc* \ | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* \ | netbsd*-eabi* | kopensolaris*-gnu* | cloudabi*-eabi* \ | storm-chaos* | os2-emx* | rtmk-nova*) basic_machine=$field1 basic_os=$maybe_os ;; android-linux) basic_machine=$field1-unknown basic_os=linux-android ;; *) basic_machine=$field1-$field2 basic_os=$field3 ;; esac ;; *-*) # A lone config we happen to match not fitting any pattern case $field1-$field2 in decstation-3100) basic_machine=mips-dec basic_os= ;; *-*) # Second component is usually, but not always the OS case $field2 in # Prevent following clause from handling this valid os sun*os*) basic_machine=$field1 basic_os=$field2 ;; # Manufacturers dec* | mips* | sequent* | encore* | pc533* | sgi* | sony* \ | att* | 7300* | 3300* | delta* | motorola* | sun[234]* \ | unicom* | ibm* | next | hp | isi* | apollo | altos* \ | convergent* | ncr* | news | 32* | 3600* | 3100* \ | hitachi* | c[123]* | convex* | sun | crds | omron* | dg \ | ultra | tti* | harris | dolphin | highlevel | gould \ | cbm | ns | masscomp | apple | axis | knuth | cray \ | microblaze* | sim | cisco \ | oki | wec | wrs | winbond) basic_machine=$field1-$field2 basic_os= ;; *) basic_machine=$field1 basic_os=$field2 ;; esac ;; esac ;; *) # Convert single-component short-hands not valid as part of # multi-component configurations. case $field1 in 386bsd) basic_machine=i386-pc basic_os=bsd ;; a29khif) basic_machine=a29k-amd basic_os=udi ;; adobe68k) basic_machine=m68010-adobe basic_os=scout ;; alliant) basic_machine=fx80-alliant basic_os= ;; altos | altos3068) basic_machine=m68k-altos basic_os= ;; am29k) basic_machine=a29k-none basic_os=bsd ;; amdahl) basic_machine=580-amdahl basic_os=sysv ;; amiga) basic_machine=m68k-unknown basic_os= ;; amigaos | amigados) basic_machine=m68k-unknown basic_os=amigaos ;; amigaunix | amix) basic_machine=m68k-unknown basic_os=sysv4 ;; apollo68) basic_machine=m68k-apollo basic_os=sysv ;; apollo68bsd) basic_machine=m68k-apollo basic_os=bsd ;; aros) basic_machine=i386-pc basic_os=aros ;; aux) basic_machine=m68k-apple basic_os=aux ;; balance) basic_machine=ns32k-sequent basic_os=dynix ;; blackfin) basic_machine=bfin-unknown basic_os=linux ;; cegcc) basic_machine=arm-unknown basic_os=cegcc ;; convex-c1) basic_machine=c1-convex basic_os=bsd ;; convex-c2) basic_machine=c2-convex basic_os=bsd ;; convex-c32) basic_machine=c32-convex basic_os=bsd ;; convex-c34) basic_machine=c34-convex basic_os=bsd ;; convex-c38) basic_machine=c38-convex basic_os=bsd ;; cray) basic_machine=j90-cray basic_os=unicos ;; crds | unos) basic_machine=m68k-crds basic_os= ;; da30) basic_machine=m68k-da30 basic_os= ;; decstation | pmax | pmin | dec3100 | decstatn) basic_machine=mips-dec basic_os= ;; delta88) basic_machine=m88k-motorola basic_os=sysv3 ;; dicos) basic_machine=i686-pc basic_os=dicos ;; djgpp) basic_machine=i586-pc basic_os=msdosdjgpp ;; ebmon29k) basic_machine=a29k-amd basic_os=ebmon ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson basic_os=ose ;; gmicro) basic_machine=tron-gmicro basic_os=sysv ;; go32) basic_machine=i386-pc basic_os=go32 ;; h8300hms) basic_machine=h8300-hitachi basic_os=hms ;; h8300xray) basic_machine=h8300-hitachi basic_os=xray ;; h8500hms) basic_machine=h8500-hitachi basic_os=hms ;; harris) basic_machine=m88k-harris basic_os=sysv3 ;; hp300 | hp300hpux) basic_machine=m68k-hp basic_os=hpux ;; hp300bsd) basic_machine=m68k-hp basic_os=bsd ;; hppaosf) basic_machine=hppa1.1-hp basic_os=osf ;; hppro) basic_machine=hppa1.1-hp basic_os=proelf ;; i386mach) basic_machine=i386-mach basic_os=mach ;; isi68 | isi) basic_machine=m68k-isi basic_os=sysv ;; m68knommu) basic_machine=m68k-unknown basic_os=linux ;; magnum | m3230) basic_machine=mips-mips basic_os=sysv ;; merlin) basic_machine=ns32k-utek basic_os=sysv ;; mingw64) basic_machine=x86_64-pc basic_os=mingw64 ;; mingw32) basic_machine=i686-pc basic_os=mingw32 ;; mingw32ce) basic_machine=arm-unknown basic_os=mingw32ce ;; monitor) basic_machine=m68k-rom68k basic_os=coff ;; morphos) basic_machine=powerpc-unknown basic_os=morphos ;; moxiebox) basic_machine=moxie-unknown basic_os=moxiebox ;; msdos) basic_machine=i386-pc basic_os=msdos ;; msys) basic_machine=i686-pc basic_os=msys ;; mvs) basic_machine=i370-ibm basic_os=mvs ;; nacl) basic_machine=le32-unknown basic_os=nacl ;; ncr3000) basic_machine=i486-ncr basic_os=sysv4 ;; netbsd386) basic_machine=i386-pc basic_os=netbsd ;; netwinder) basic_machine=armv4l-rebel basic_os=linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony basic_os=newsos ;; news1000) basic_machine=m68030-sony basic_os=newsos ;; necv70) basic_machine=v70-nec basic_os=sysv ;; nh3000) basic_machine=m68k-harris basic_os=cxux ;; nh[45]000) basic_machine=m88k-harris basic_os=cxux ;; nindy960) basic_machine=i960-intel basic_os=nindy ;; mon960) basic_machine=i960-intel basic_os=mon960 ;; nonstopux) basic_machine=mips-compaq basic_os=nonstopux ;; os400) basic_machine=powerpc-ibm basic_os=os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson basic_os=ose ;; os68k) basic_machine=m68k-none basic_os=os68k ;; paragon) basic_machine=i860-intel basic_os=osf ;; parisc) basic_machine=hppa-unknown basic_os=linux ;; psp) basic_machine=mipsallegrexel-sony basic_os=psp ;; pw32) basic_machine=i586-unknown basic_os=pw32 ;; rdos | rdos64) basic_machine=x86_64-pc basic_os=rdos ;; rdos32) basic_machine=i386-pc basic_os=rdos ;; rom68k) basic_machine=m68k-rom68k basic_os=coff ;; sa29200) basic_machine=a29k-amd basic_os=udi ;; sei) basic_machine=mips-sei basic_os=seiux ;; sequent) basic_machine=i386-sequent basic_os= ;; sps7) basic_machine=m68k-bull basic_os=sysv2 ;; st2000) basic_machine=m68k-tandem basic_os= ;; stratus) basic_machine=i860-stratus basic_os=sysv4 ;; sun2) basic_machine=m68000-sun basic_os= ;; sun2os3) basic_machine=m68000-sun basic_os=sunos3 ;; sun2os4) basic_machine=m68000-sun basic_os=sunos4 ;; sun3) basic_machine=m68k-sun basic_os= ;; sun3os3) basic_machine=m68k-sun basic_os=sunos3 ;; sun3os4) basic_machine=m68k-sun basic_os=sunos4 ;; sun4) basic_machine=sparc-sun basic_os= ;; sun4os3) basic_machine=sparc-sun basic_os=sunos3 ;; sun4os4) basic_machine=sparc-sun basic_os=sunos4 ;; sun4sol2) basic_machine=sparc-sun basic_os=solaris2 ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun basic_os= ;; sv1) basic_machine=sv1-cray basic_os=unicos ;; symmetry) basic_machine=i386-sequent basic_os=dynix ;; t3e) basic_machine=alphaev5-cray basic_os=unicos ;; t90) basic_machine=t90-cray basic_os=unicos ;; toad1) basic_machine=pdp10-xkl basic_os=tops20 ;; tpf) basic_machine=s390x-ibm basic_os=tpf ;; udi29k) basic_machine=a29k-amd basic_os=udi ;; ultra3) basic_machine=a29k-nyu basic_os=sym1 ;; v810 | necv810) basic_machine=v810-nec basic_os=none ;; vaxv) basic_machine=vax-dec basic_os=sysv ;; vms) basic_machine=vax-dec basic_os=vms ;; vsta) basic_machine=i386-pc basic_os=vsta ;; vxworks960) basic_machine=i960-wrs basic_os=vxworks ;; vxworks68) basic_machine=m68k-wrs basic_os=vxworks ;; vxworks29k) basic_machine=a29k-wrs basic_os=vxworks ;; xbox) basic_machine=i686-pc basic_os=mingw32 ;; ymp) basic_machine=ymp-cray basic_os=unicos ;; *) basic_machine=$1 basic_os= ;; esac ;; esac # Decode 1-component or ad-hoc basic machines case $basic_machine in # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) cpu=hppa1.1 vendor=winbond ;; op50n) cpu=hppa1.1 vendor=oki ;; op60c) cpu=hppa1.1 vendor=oki ;; ibm*) cpu=i370 vendor=ibm ;; orion105) cpu=clipper vendor=highlevel ;; mac | mpw | mac-mpw) cpu=m68k vendor=apple ;; pmac | pmac-mpw) cpu=powerpc vendor=apple ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) cpu=m68000 vendor=att ;; 3b*) cpu=we32k vendor=att ;; bluegene*) cpu=powerpc vendor=ibm basic_os=cnk ;; decsystem10* | dec10*) cpu=pdp10 vendor=dec basic_os=tops10 ;; decsystem20* | dec20*) cpu=pdp10 vendor=dec basic_os=tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) cpu=m68k vendor=motorola ;; dpx2*) cpu=m68k vendor=bull basic_os=sysv3 ;; encore | umax | mmax) cpu=ns32k vendor=encore ;; elxsi) cpu=elxsi vendor=elxsi basic_os=${basic_os:-bsd} ;; fx2800) cpu=i860 vendor=alliant ;; genix) cpu=ns32k vendor=ns ;; h3050r* | hiux*) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) cpu=m68000 vendor=hp ;; hp9k3[2-9][0-9]) cpu=m68k vendor=hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) cpu=hppa1.1 vendor=hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) cpu=hppa1.1 vendor=hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) cpu=hppa1.0 vendor=hp ;; i*86v32) cpu=$(echo "$1" | sed -e 's/86.*/86/') vendor=pc basic_os=sysv32 ;; i*86v4*) cpu=$(echo "$1" | sed -e 's/86.*/86/') vendor=pc basic_os=sysv4 ;; i*86v) cpu=$(echo "$1" | sed -e 's/86.*/86/') vendor=pc basic_os=sysv ;; i*86sol2) cpu=$(echo "$1" | sed -e 's/86.*/86/') vendor=pc basic_os=solaris2 ;; j90 | j90-cray) cpu=j90 vendor=cray basic_os=${basic_os:-unicos} ;; iris | iris4d) cpu=mips vendor=sgi case $basic_os in irix*) ;; *) basic_os=irix4 ;; esac ;; miniframe) cpu=m68000 vendor=convergent ;; *mint | mint[0-9]* | *MiNT | *MiNT[0-9]*) cpu=m68k vendor=atari basic_os=mint ;; news-3600 | risc-news) cpu=mips vendor=sony basic_os=newsos ;; next | m*-next) cpu=m68k vendor=next case $basic_os in openstep*) ;; nextstep*) ;; ns2*) basic_os=nextstep2 ;; *) basic_os=nextstep3 ;; esac ;; np1) cpu=np1 vendor=gould ;; op50n-* | op60c-*) cpu=hppa1.1 vendor=oki basic_os=proelf ;; pa-hitachi) cpu=hppa1.1 vendor=hitachi basic_os=hiuxwe2 ;; pbd) cpu=sparc vendor=tti ;; pbb) cpu=m68k vendor=tti ;; pc532) cpu=ns32k vendor=pc532 ;; pn) cpu=pn vendor=gould ;; power) cpu=power vendor=ibm ;; ps2) cpu=i386 vendor=ibm ;; rm[46]00) cpu=mips vendor=siemens ;; rtpc | rtpc-*) cpu=romp vendor=ibm ;; sde) cpu=mipsisa32 vendor=sde basic_os=${basic_os:-elf} ;; simso-wrs) cpu=sparclite vendor=wrs basic_os=vxworks ;; tower | tower-32) cpu=m68k vendor=ncr ;; vpp*|vx|vx-*) cpu=f301 vendor=fujitsu ;; w65) cpu=w65 vendor=wdc ;; w89k-*) cpu=hppa1.1 vendor=winbond basic_os=proelf ;; none) cpu=none vendor=none ;; leon|leon[3-9]) cpu=sparc vendor=$basic_machine ;; leon-*|leon[3-9]-*) cpu=sparc vendor=$(echo "$basic_machine" | sed 's/-.*//') ;; *-*) # shellcheck disable=SC2162 IFS="-" read cpu vendor <&2 exit 1 ;; esac ;; esac # Here we canonicalize certain aliases for manufacturers. case $vendor in digital*) vendor=dec ;; commodore*) vendor=cbm ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if test x$basic_os != x then # First recognize some ad-hoc caes, or perhaps split kernel-os, or else just # set os. case $basic_os in gnu/linux*) kernel=linux os=$(echo $basic_os | sed -e 's|gnu/linux|gnu|') ;; os2-emx) kernel=os2 os=$(echo $basic_os | sed -e 's|os2-emx|emx|') ;; nto-qnx*) kernel=nto os=$(echo $basic_os | sed -e 's|nto-qnx|qnx|') ;; *-*) # shellcheck disable=SC2162 IFS="-" read kernel os <&2 exit 1 ;; esac # As a final step for OS-related things, validate the OS-kernel combination # (given a valid OS), if there is a kernel. case $kernel-$os in linux-gnu* | linux-dietlibc* | linux-android* | linux-newlib* | linux-musl* | linux-uclibc* ) ;; uclinux-uclibc* ) ;; -dietlibc* | -newlib* | -musl* | -uclibc* ) # These are just libc implementations, not actual OSes, and thus # require a kernel. echo "Invalid configuration \`$1': libc \`$os' needs explicit kernel." 1>&2 exit 1 ;; kfreebsd*-gnu* | kopensolaris*-gnu*) ;; nto-qnx*) ;; os2-emx) ;; *-eabi* | *-gnueabi*) ;; -*) # Blank kernel with real OS is always fine. ;; *-*) echo "Invalid configuration \`$1': Kernel \`$kernel' not known to work with OS \`$os'." 1>&2 exit 1 ;; esac # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. case $vendor in unknown) case $cpu-$os in *-riscix*) vendor=acorn ;; *-sunos*) vendor=sun ;; *-cnk* | *-aix*) vendor=ibm ;; *-beos*) vendor=be ;; *-hpux*) vendor=hp ;; *-mpeix*) vendor=hp ;; *-hiux*) vendor=hitachi ;; *-unos*) vendor=crds ;; *-dgux*) vendor=dg ;; *-luna*) vendor=omron ;; *-genix*) vendor=ns ;; *-clix*) vendor=intergraph ;; *-mvs* | *-opened*) vendor=ibm ;; *-os400*) vendor=ibm ;; s390-* | s390x-*) vendor=ibm ;; *-ptx*) vendor=sequent ;; *-tpf*) vendor=ibm ;; *-vxsim* | *-vxworks* | *-windiss*) vendor=wrs ;; *-aux*) vendor=apple ;; *-hms*) vendor=hitachi ;; *-mpw* | *-macos*) vendor=apple ;; *-*mint | *-mint[0-9]* | *-*MiNT | *-MiNT[0-9]*) vendor=atari ;; *-vos*) vendor=stratus ;; esac ;; esac echo "$cpu-$vendor-${kernel:+$kernel-}$os" exit # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: avfs-1.1.4/doc/0000755000175000001440000000000014032341025010210 500000000000000avfs-1.1.4/doc/INSTALL.library0000644000175000001440000000135614032341001012623 00000000000000Introduction ------------ In contrast to using fuse avfs as a library requires support from the application. The advantage is that the library is much more portable and should compile on any system. How To Install -------------- To compile type ./configure --enable-library make To install, log in as root and type make install This will install the library in '/usr/lib' and the header files in '/usr/include'. It will also install some extfs handlers under '/usr/lib/avfs/extfs/'. If you want to install to some place other then '/usr/', then specify the '--prefix' argument to 'configure'. If you do not have root access you can still use avfs. You should pass '--prefix' a directory that you own (for example your home directory). avfs-1.1.4/doc/background0000644000175000001440000001553414032341001012174 00000000000000BACKGROUND Frederik Eaton (frederik@ugcs.caltech.edu) 2003/3/26 ORIGINS AVFS originated as a shared library which was intended to intercept shared library calls from an executable to glibc, overriding a basic set of the glibc filesystem-related functions to give transparent access to a number of "virtual" filesystem modules. Most of the modules are intended to provide access to files stored in various types of archives, but there are several which are used to access files remotely, via common protocols such as ssh or ftp, and several others which don't fall into either category. MC-VFS The design of avfs is based on that of mc-vfs, a library which was created to enable Midnight Commander to use virtual filesystem modules like the ones described above. MC-VFS consists of replacements for the basic file operations (namely open, close, read, write, opendir, readdir, closedir, telldir, seekdir, stat, lstat, fstat, chmod, chown, utime, readlink, symlink, link, unlink, rename, chdir, lseek, mknod). The functions provided by mc-vfs are designed to work as drop-in replacements for the corresponding glibc functions, making it easier to modify an existing application to use them. This design goes much farther than facilitating better graphical file browsers or more convenient utilities - by linking a file server such as NFS to mc-vfs, one can export an mc-vfs virtual filesystem through the kernel as a standard kernel filesystem, making it available to every user on the system. USERVFS Pavel Machek's uservfs (originally podfuk) was to my knowledge the first project to take advantage of this idea. Early versions of his program consisted of patches to NFS, but because of problems with kernel deadlock and the way NFS allocates filehandles (you'll have to ask him, I don't understand), he switched to Coda. Neither NFS nor Coda is ideal as the kernel side of a userland virtual file system - NFS because rpc.nfsd is single threaded and has a deadlock problem when used with virtual filesystems, Coda because, among other things, its protocol makes random access to files impossible. (Another project, Jeremy Fitzhardinge's userfs, solved these problems by providing its own kernel filesystem, but the kernel code for that was never brought up to date with newer kernels, and instead of using an API similar to mc-vfs, it had an interface closer to the kernel VFS interface which made it difficult to write new modules for it.) AVFS-PRELOAD The original version of AVFS, avfs-preload, took a different approach to serving userland filesystems. It was modeled after a program called zlibc, which is supposed to transparently compress and uncompress your files for you. Referred to as "the LD_PRELOAD hack", the method used by zlibc, and later avfs-preload, circumvented the kernel completely, avoiding the shortcomings of existing kernel filesystems and allowing users without root access to install and use the programs themselves. To use the original version of avfs, the user would simply set the LD_PRELOAD environment variable to point to the avfs shared library. Then, when he started an executable from that shell, the linker would load libavfs.so before glibc. Libavfs.so overrode a few key glibc functions with avfs' own virtual replacements, modifying the executable's view of the root filesystem to include avfs' virtual modules. Since nearly all programs which make system calls do so through glibc, the preload method was compatible with almost everything and worked quite well. Although the preload method is no longer preferred for a number of reasons, it is still possible to compile avfs to use it. PROBLEMS WITH THE PRELOAD METHOD Why did the preload method fall out of favor? There are two (??) main problems with it. First, for some reason newer versions of glibc (>2.1??) made certain key functions private so they couldn't be overridden by programs like avfs. Since these functions were used internally by many other public glibc functions, fixing avfs to work with the newer glibc would have meant overriding an impractical number of additional glibc calls. (Note: Solaris libc still works with avfs-preload, it is only Linux/glibc which has this problem) The second reason is that, for all the cleverness behind the original LD_PRELOAD hack, there are still some things that are impossible without a real kernel filesystem - the obvious one is making your filesystem visible from within the kernel, but there are other issues, such as keeping virtual file descriptors open over exec(). (because avfs-preload can't do this, it was never able to handle shell redirections such as "gzip < virtual_file"; you had to do "cat virtual_file | gzip" instead) XXX this paragraph is out of date and needs to be updated. AVFSCODA The current replacement for the preload method is similar to uservfs - called avfscoda, it exports a real kernel filesystem using Coda, reading commands from the kernel Coda module through the /dev/cfs0 character device. To use avfscoda you must start avfscoda, mount /dev/cfs0 on /overlay, and install a special kernel module redir.o which redirects failed lookups in your root filesystem to /overlay (so you can pretend that the virtual files you see are actually on your root filesystem together with the other files). Redir has been tested on 2.2.x and 2.4.x kernels, and is unlikely to become incompatible with future versions since it works by patching the system call table, an interface which tends to be fairly static. OTHER VFS LIBRARIES Because the code for libavfs - the modules and vfs infrastructure - comprise the bulk of the project, we can say that avfs is first and foremost a virtual filesystem library. So we should take the opportunity to mention some of its cousin vfs libraries here: mc-vfs Also see above. mc-vfs is a predecessor to avfs, and is currently used in mc and gmc. (?? is it being actively developed?) (?? which avfs modules other than extfs are inherited from mc-vfs?) gnome-vfs - foundation for nautilus (Gnome's new "second generation" file manager), but intended to be used by other gnome apps as well - extensible via shared library modules (like avfs) - unlike avfs, treats 'stackable' modules like 'tar' separately from root modules like 'ftp'; protocols such as ftp, http, smb are specified in URI's, while stackable tar, gzip are invoked with the familiar '#'. Example: "http://server/path/to/file.tar#tar/path/to/file.gz#gzip" in gnome-vfs would be "/#http:server|path|to|file.tar#utar/path/to/file.gz#ugz" in avfs - unlike avfs, gnome-vfs' API is not intended to be interchangeable with glibc's: - gnome-vfs refers to files with a pointer to GnomeVFSHandle, rather than using integer file descriptors; - gnome-vfs has extra functions implementing asynchronous I/O (by spawning helper threads or processes) - last I checked, gnome-vfs had very little documentation kio Something like a KDE version of gnome-vfs?? Was unable to find any documentation of it. avfs-1.1.4/doc/Makefile.in0000644000175000001440000003073014032341013012175 00000000000000# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = doc ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BZLIB_INCLUDE = @BZLIB_INCLUDE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAV = @DAV@ DAV_LS = @DAV_LS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FUSELIBS = @FUSELIBS@ GREP = @GREP@ HAVE_ZIPINFO = @HAVE_ZIPINFO@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ LIBZSTD_LIBS = @LIBZSTD_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NUMVERSION = @NUMVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ ZIP = @ZIP@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_INCLUDE = @ZLIB_INCLUDE@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = FORMAT \ INSTALL.library \ INSTALL.fuse \ api-overview \ background \ README.avfs-fuse all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu doc/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu doc/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: avfs-1.1.4/doc/INSTALL.fuse0000644000175000001440000000226514032341001012121 00000000000000The avfs fuse daemon is designed to work with 2.6 kernels only. The requirements are: 1) fuse support be compiled in the kernel or as a module CONFIG_FUSE_FS=m|y 2) the fuse package (>=2.4) be installed (see http://www.fuse.sf.net) Compiling and installing the avfs fuse daemon is easy! How To Install -------------- To compile type ./configure --enable-fuse make To install, log in as root and type make install This will install the following files in /usr/bin or $prefix/bin: /usr/bin -------- avfsd davpass ftppass mountavfs umountavfs Additional library files are installed under /usr/lib/avfs (or $prefix/lib/avfs). An avfs.h include file is installed into /usr/include (or $prefix/include) If you want to install to some place other then '/usr/', then specify the '--prefix' argument to 'configure'. If you do not have root access you can still use avfs. You should either pass '--prefix' a directory that you own (for example your home directory), or copy the files manually. Enabling AVFS ------------- mountavfs is used to load the userspace avfs program, and umountavfs is used to terminate it. These commands operate on a per user basis. No complicated system-wide setup. avfs-1.1.4/doc/Makefile.am0000644000175000001440000000015114032341001012153 00000000000000EXTRA_DIST = FORMAT \ INSTALL.library \ INSTALL.fuse \ api-overview \ background \ README.avfs-fuse avfs-1.1.4/doc/FORMAT0000644000175000001440000000415114032341001011036 00000000000000Here is the description of the virtual path format: The canonical form ================== [basepath]#handler[options][:parameters][/internalpath] 'basepath', if given is an ordinary file path (can be a regular file, or a directory, and can be a real or a virtual path). '#' is the character that prefixes the handler name and is defined by VDEV_SEP_CHAR. 'handler' is the name of the file handler (filter, remote file access or other processing unit). Handler names consist of only alphanumeric characters ([a-z0-9_]). Handler names are case sensitive, and should always be lower case. 'options' is an optional field containing "mount options". These options should not change the content of the virtual mount, only the permissions or mode of access. For example: '+' - read-write '=' - don't cache 'parameters' are part of the path, but before the mount root. 'internalpath' is the optional path within the handlers file structure. It is prefixed by '/'. Notes: The only special characters are '#' and '/'. If an ordinary (non virtual) file name contains a '#', then this file can be accessed normaly (i.e. existing files take precedence over virtual ones). If a virtual path contains '#' (even in the real path part) they must be represented by '##'. (This way a situation can arrise, where you can't access a virtual file, because a real file 'shadows' it. This is a case of tough luck ;) Examples (not all of these are implemented yet): /home/user/archive.tar.gz#ugz#utar/path/file /#ftp:host.dom.org/pub/README /#http:www.dom.org|some|where|index.html /#http:localhost:8000|~user|file file#gz-9 /#floppy:a/xyz The non-canonical virtual paths =============================== This is to make life easier for the user. dir/file.ext#[/extrapath] With this notation, the '#' is substituted with the handler(s) determined from the file's extension. Any parameters after the # are passed to the last expanded handler. Examples: file.gz# == file.gz#ugz archive.tar.gz#/dir == archive.tar.gz#ugz#utar/dir archive.tar.gz#+/dir == archive.tar.gz#ugz#utar+/dir avfs-1.1.4/doc/README.avfs-fuse0000644000175000001440000000713514032341001012706 00000000000000November 2005 May 2006 (updated) This version of AVFS includes support for fuse (Filesystems in userspace). AVFS can also be used as a (shared) library for programs with dedicated support. Fuse support consists of a single daemon file and startup script. In order to compile fuse support, the avfs library must be compiled. However, it does NOT have to be installed. The following steps should be followed prior to building the fuse daemon. SETUP: ------ Prior to using the fuse avfs daemon, fuse support MUST be compiled into your 2.6 version kernel. In addition, the fuse library >= 2.4 must be installed. Change to the cvs or snapshot download directory. You do NOT need to be root. You DO need to have write permissions to the download directory. NEW: Beginning with the 0.97pre versions, the configure command has a new option: --enable-fuse. Choosing this configure option will allow only the fuse daemon to be compiled and installed. user avfsdldir> ./autogen.sh user avfsdldir> ./configure --enable-fuse user avfsdldir> make Now, you need to become root and execute user avfsdldir> make install This will install the daemon and startup and shutdown scripts. IF THERE ARE ERRORS perhaps review the compile steps above and determine what the errors are and correct. Perhaps a library is missing? IMPLEMENTATION: --------------- AVFS can entirely be implemented by any user. To do so requires that: 1) fuse support is compiled into the kernel or is a kernel module and loaded 2) the fuse package is installed (http://fuse.sf.net) 3) the user create a directory called .avfs in his/her home directory (mkdir ~/.avfs). 4) the user run the program mountavfs mountavfs loads the avfsd daemon and mounts the virtual filesystem at ~/.avfs. Once done, the user will be able to access all kinds of com- pressed files via the pseudo-fs ~/.avfs. Testing the installation: ------------------------- 1) type mountavfs a message should appear that avfs is loaded. The README docs indicate that testing can be done as ls /#avfsstat. This will not work. Using this version of AVFS, try: ls ~/.avfs/#avfsstat Anytime the docs say /#avfsstat or filename#, always prepend ~/.avfs/, ex: ls ~/.avfs/myzipfile.zip# - or - cat ~/.avfs/README.gz# Using with ROX: --------------- Rox supports AVFS access, however, not with fuse. Trying to open a compressed file with Ctrl+O will result in an error since Rox still expects AVFS to use the preload method. To get around this, the user can create a run action for any type of compressed file as follows: rox $HOME/.avfs/$@# If you wish to use a Shell command within ROX, press BANG (!) and type similar to the above except a $PWD needs to be inserted before the $@ shell variable (don't know why, but with !, ROX does not expand $@ to a full pathname/filename). !rox $HOME/.avfs/$PWD/$@# Of course, $HOME can be replaced with ~ if desired. Thanks to Jonatan Liljedahl, rox developer, for the tip and workaround AND for alerting me that fuse CAN work with AVFS. Stopping AVFS: -------------- Make sure no files are being accessed via AVFS. Then: umountavfs or fusermount -u ~/.avfs This will unmount the virtual filesystem AND unload the avfsd daemon. The user can start AVFS anytime later. ***** CAUTION ***** This code is CVS. It may change, it may not work! As with all developmental code, the user is advised to exercise proper caution and backup protocols. ***** END CAUTION ***** More information can be obtained from: http://sourceforge.net/projects/avf http://sourceforge.net/projects/fuse or http://fuse.sourceforge.net http://rox.sourceforge.net Documentation by Peter Hyman pete4abw@comcast.net avfs-1.1.4/doc/api-overview0000644000175000001440000004204014032341001012462 00000000000000AVFS API Overview Frederik Eaton (frederik@ugcs.caltech.edu) 2003/3/26 Writing a module There are several different ways to write a new filesystem module for avfs. If you only need basic functionality and you don't care about efficiency, you might want to look at extfs. extfs allows you to implement simple filesystem modules as short, standalone scripts. It is documented in extfs/README.extfs. If extfs isn't good enough, then you can use the low-level C API, or one of the helper libraries built on top of it. There are currently four such libraries: 'filter', for modules which act on single files (see ubzip2.c); 'archive', for archive-style modules (see uar.c); 'remote' for things like ssh, rsh, and ftp (see rsh.c); and 'state' which exports a procfs-like "get/set" filesystem (see ftp_init_ctl in ftp.c). An example of a module built directly on the low-level API is 'volatile', in modules/volatile.c. The final source of information about each of the different interfaces is always the avfs source code. This document tries to give a high-level overview which should help make the code more understandable. The low-level interface Data structures Let's start with ventry and vfile. These are somewhat analogous to the Linux kernel's 'inode' and 'file' structures, respectively. struct ventry { void *data; struct avmount *mnt; }; struct vfile { void *data; struct avmount *mnt; int flags; int ptr; avmutex lock; }; A ventry just represents a path in the file system. You can convert from a path to a ventry using av_get_ventry (internal.h). In order to read or write to the corresponding file, one must obtain a vfile by "opening" the ventry with av_open (oper.h). This calls the 'open' method of the appropriate filesystem module. This method, along with many others, is stored as a function pointer in an object of type 'struct avfs'. 'struct avfs' is the data structure we use to define a module, something like the Linux kernel's super_operations, inode_operations, and file_operations put together: /* from src/avfs.h */ struct avfs { /* private */ struct vmodule *module; avmutex lock; avino_t inoctr; /* read-only: */ char *name; struct ext_info *exts; void *data; int version; int flags; avdev_t dev; void (*destroy) (struct avfs *avfs); int (*lookup) (ventry *ve, const char *name, void **retp); void (*putent) (ventry *ve); int (*copyent) (ventry *ve, void **retp); int (*getpath) (ventry *ve, char **retp); int (*access) (ventry *ve, int amode); int (*readlink)(ventry *ve, char **bufp); int (*symlink) (const char *path, ventry *newve); int (*unlink) (ventry *ve); int (*rmdir) (ventry *ve); int (*mknod) (ventry *ve, avmode_t mode, avdev_t dev); int (*mkdir) (ventry *ve, avmode_t mode); int (*rename) (ventry *ve, ventry *newve); int (*link) (ventry *ve, ventry *newve); int (*open) (ventry *ve, int flags, avmode_t mode, void **retp); int (*close) (vfile *vf); avssize_t (*read) (vfile *vf, char *buf, avsize_t nbyte); avssize_t (*write) (vfile *vf, const char *buf, avsize_t nbyte); int (*readdir) (vfile *vf, struct avdirent *buf); int (*getattr) (vfile *vf, struct avstat *buf, int attrmask); int (*setattr) (vfile *vf, struct avstat *buf, int attrmask); int (*truncate)(vfile *vf, avoff_t length); avoff_t (*lseek) (vfile *vf, avoff_t offset, int whence); }; Notice that each of the three structures has a "void *data" member, which is used to store filesystem-specific information. Functions in 'struct avfs' with a 'void **retp' parameter use 'retp' to return one of these pointers - for lookup(), copyent(), and getpath(), *retp will be used as the 'data' member of a new ventry; for open() it is put into a vfile.data. Most operations listed above have a corresponding wrapper function prefixed with "av_" in 'oper.h' (e.g. av_open for open, av_lseek for lseek); when accessing files from other modules, the module writer should always use these functions rather than trying to look up the method and call it directly. Exceptions are the entry management operations putent, copyent, getpath which can be accessed through av_copy_ventry, av_free_ventry, and av_generate_path respectively (in avfs.h), and the lookup operation which is called recursively by av_get_ventry (in internal.h). The Object System Avfs employs a simple system for garbage collection through reference counting. void *av_new_obj(avsize_t nbyte, void (*destr)(void *)); void av_ref_obj(void *obj); void av_unref_obj(void *obj); #define AV_NEW_OBJ(ptr, destr) \ ptr = av_new_obj(sizeof(*(ptr)), (void (*)(void *)) destr) av_new_obj creates a new object with the specified size and destructor, and with a reference count of 1. The returned pointer addresses a free region at least nbytes long. The reference count and destructor are stored immediately before this region in memory. av_ref_obj increments the reference counter associated with the given block; av_unref_obj decrements the reference counter and calls the destructor function when the count reaches 0. Examples of how these functions are used can be found throughout the code. The common task of allocating memory for a fixed-size data structure can be abbreviated by calling the AV_NEW_OBJ macro with the pointer to be assigned to and a destructor function; because of this, the function av_new_obj is almost never called directly. Of the data structures which have been introduced so far, only struct vfile and struct avfs are allocated as reference-counted objects; ventry and avmount are allocated and freed using av_* versions of malloc and free (see avfs.h). Because the avfs core is used in long-running processes such as avfscoda and avfs_server, care must be taken to avoid leaking memory in a module by forgetting to decrement a reference or free a pointer. Utility libraries Avfs uses a few internal utility libraries throughout the code. One example is a facility for organizing information into a named hierarchy, called Namespace Namespace is pretty straightforward. I'll skip over the details since they belong in a separate document (which doesn't exist as of this moment, but reading the code is easy). The two important data types are 'struct entry' and 'struct namespace', both defined opaquely in "namespace.h". An empty namespace is created with struct namespace *av_namespace_new(); 'struct entry' has a 'void *data' member which can be accessed with void av_namespace_set(struct entry *ent, void *data); void *av_namespace_get(struct entry *ent); To look up an entry, use struct entry *av_namespace_resolve(struct namespace *ns, const char *path); or struct entry *av_namespace_lookup(struct namespace *ns, struct entry *parent, const char *name); The first function looks up an absolute path, starting at the root of the namespace. The path components are separated with '/'. The second function looks up an child entry in the 'parent' entry. If 'name' is null, then it returns the parent of 'parent'. When a path or name doesn't exist in the namespace, both functions create a new entry and return that. As with most functions returning objects, these return an entry with an incremented reference count - you are responsible for decrementing the reference count when you are done with the returned entry. Nothing else inside namespace holds references to entries except an entry's own children, so when you unreference a childless entry it disappears. Cache This is another semi-important general-use facility in avfs which requires some explanation. It manages a cache of files in /tmp. Saying "manages" is a bit of a stretch, though, because all the responsibility for creating and deleting the files is placed on the user. The only thing that 'cache' does is maintain a list of objects. These are of the kind described above, typically created with AV_NEW_OBJ and carrying a virtual destructor located just before the object memory area. With each object is associated a disk usage number. Two things must hold for objects used in 'cache': they must be unreferenced with av_unref_obj after insertion into the cache (so that 'cache' holds the only reference to them), and the virtual destructor must delete some file on the same filesystem as /tmp, which is the same size as reported by the cache object. So even though the 'cache' module itself never worries about creating or deleting files, each object in its list represents a disk file, and the module can regulate disk usage indirectly by unreferencing (and causing the destruction of) these objects. The 'cache' module keeps track of the disk usage of its own objects in a global variable, and checks the amount of free space on the filesystem containing /tmp whenever the size of a cache object is changed or when other avfs modules call av_cache_diskfull(). Whenever the amount of free space drops below a certain level, or the space used by the cache objects grows above a certain level, 'cache' starts deleting objects from its list in least-recently-used order. (These levels are configurable through "#avfsstat/cache") Here is the API (from cache.h): struct cacheobj *av_cacheobj_new(void *obj, const char *name); void *av_cacheobj_get(struct cacheobj *cobj); void av_cacheobj_setsize(struct cacheobj *cobj, avoff_t diskusage); void av_cache_checkspace(); void av_cache_diskfull(); Note that the 'cacheobj' object returned by av_cacheobj_new is a standard avfs object; as per the convention, it is returned with a 1 reference count and should only be unreferenced when it is no longer needed. This will cause the stored "void* obj" to be deleted. See remote.c for an example usage - remnode holds a reference to a cacheobj (remnode.file); in rem_get_file, av_cacheobj_get is called to retrieve a remfile object. At this point the returned object will be null if it has been purged, in which case it must be recreated and reinserted into the cache. Higher-level filesystem libraries Here I'll touch briefly on four of the higher-level libraries, which can simplify implementation of some of the more common types of filesystems. State This is the simplest library. It is similar to procfs in linux. To use it, you create a namespace with av_state_new and populate that namespace with 'statefile' objects, one for each virtual file you want to export. Each 'statefile' object has a pair of 'get' and 'set' functions which are called when data is read and written, respectively, from the corresponding virtual file. int av_state_new(struct vmodule *module, const char *name, struct namespace **resp, struct avfs **avfsp); struct statefile { void *data; int (*get) (struct entry *ent, const char *param, char **resp); int (*set) (struct entry *ent, const char *param, const char *val); }; The 'ent' argument is the entry for the file in your original namespace. XXX what is param? 'val' is the value to set; 'resp' holds the value retrieved by get(). There is also a shortcut for creating files in /#avfsstat (from internal.h): void av_avfsstat_register(const char *path, struct statefile *func); Filter 'filter' lets you create modules which provide access to some translation of the data in a file. It is currently only used for decompression and compression in the ugzip, gz, ubzip2, bz2, and uz modules, but it could be used for simple decryption/encryption and other things. Create a module with the following function: int av_init_filt(struct vmodule *module, int version, const char *name, const char *prog[], const char *revprog[], struct ext_info *exts, struct avfs **resp); 'name' is the name of the module. The translation is carried out by an external command, which is specified in the 'prog' and 'revprog' arguments. 'revprog' is needed to allow writing to the virtual file, and should perform the reverse operation of 'prog'. See gz.c for an example invocation. (XXX: say more about filter implementation. filtprog, serialfile) Archive Used in extfs, uar, urar, utar, and uzip. Provides access to 'archive' formats; the result is a virtual directory hierarchy. I'll just give an overview here because I don't understand much of the structure of the code. For details, see e.g. uzip.c. To instantiate an archive module, use av_archive_init. This fills in most of a 'struct avfs', including all the methods. The avfs.data member points to a 'struct archparams', which you are supposed to initialize yourself. The methods of this structure define your module. They are called by the archive library's own 'struct avfs' methods. struct archparams { void *data; int flags; int (*parse) (void *data, ventry *ent, struct archive *arch); int (*open) (ventry *ve, struct archfile *fil); int (*close) (struct archfile *fil); avssize_t (*read) (vfile *vf, char *buf, avsize_t nbyte); void (*release) (struct archive *arch, struct archnode *nod); }; The open, close, read, and release methods are optional. Only the parse method is required. 'parse' is called when an archive is first used and creates a list of all of the file entries in the archive. These are stored internally in a 'namespace' object in 'struct archive'. New entries are added by obtaining a 'struct entry' with av_arch_create() or av_arch_resolve() (archive.h, archutil.c) and then associating with it a node of type 'struct archnode' with av_arch_new_node(). Among other things, the 'archnode' data structure holds basic stat flags and permissions for the file, the byte offset of the file data within the archive, and a 'void* data' member which can be used to point to a module-specific data structure. This should be filled in by 'parse'. 'void *data' is the struct archparams.data member (for your own use); 'ventry *ent' is the location of the archive to be parsed; and 'arch' is the (opaque) main archive data structure, which is needed by av_arch_create et al. 'read' reads data from a file. The vfile.data member is an archfile: struct archfile { vfile *basefile; struct archive *arch; struct archnode *nod; struct entry *ent; /* Only for readdir */ struct entry *curr; int currn; void *data; }; If the file is stored contiguously starting at its offset in the archive, then av_arch_read(), the default value for archparams.read, will suffice. The archive library can figure out what to do since the file offset has already been stored in the archnode by 'parse'. But if the file is compressed (see uzip.c) or sparse (see utar.c), then it will need special handling in your module, and you must define a custom 'read' method. 'open' and 'close' can be defined if you need to allocate resources or special data structures in preparation for reading a file. 'open' is called with an archfile after all its fields but 'data' have been filled in, at the very end of the open sequence; 'close' is called at the beginning of the close sequence before anything has been deallocated. Examples can be found in uzip.c. 'release' is called when an archive is no longer being used. It should be defined if the 'parse' method allocated resources which need to be freed. Remote The remote library is used by the ssh (rsh.c), rsh, ftp, dav, and floppy modules. It differs from 'archive' in that the directory tree is read one directory at a time (rather than all at once), and files are read completely if at all (rather than allowing random access). A remote module is defined with the following structure: struct remote { void *data; char *name; int flags; int (*list) (struct remote *rem, struct remdirlist *dl); int (*get) (struct remote *rem, struct remgetparam *gp); int (*wait) (struct remote *rem, void *data, avoff_t end); void (*destroy) (struct remote *rem); }; This should be passed to av_remote_init, which will give you a 'struct avfs*': int av_remote_init(struct vmodule *module, struct remote *rem, struct avfs **resp); As always, remote.data is for your own use. 'name' is the name of your module. XXX define 'flags'. The rest of the fields are methods: list: obtain a directory listing. It should call av_remote_add to add all the entries of dl->hostpath.path on dl->hostpath.host to the remdirlist object. get: start transferring a file. Your implementation should start copying a remote file to a temporary file (possibly with av_get_tmpfile) and return the name in gp->localname. You should point gp->data to an object which will let you find out how much has been transferred (so you can implement remote.wait). In addition, this object will be unreferenced when the file is no longer needed, so its destructor should delete the temporary file. wait: block until a certain amount of data has been read. The 'void *data' parameter is from gp->data in remote.get. This function should return 1 if the data is ready, 0 if EOF was reached, and -error if there was an error. destroy: do cleanup. Should call av_free(rem), possibly after freeing module-specific data pointed to by rem.data. THE END avfs-1.1.4/aclocal.m40000644000175000001440000132671514032341011011235 00000000000000# generated automatically by aclocal 1.16.3 -*- Autoconf -*- # Copyright (C) 1996-2020 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_ifndef([AC_CONFIG_MACRO_DIRS], [m4_defun([_AM_CONFIG_MACRO_DIRS], [])m4_defun([AC_CONFIG_MACRO_DIRS], [_AM_CONFIG_MACRO_DIRS($@)])]) m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, [m4_warning([this file was generated for autoconf 2.69. You have another version of autoconf. It may work, but is not guaranteed to. If you have problems, you may need to regenerate the build system entirely. To do so, use the procedure documented by the package, typically 'autoreconf'.])]) # libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- # # Copyright (C) 1996-2001, 2003-2015 Free Software Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 2014 Free Software Foundation, Inc. # This is free software; see the source for copying conditions. There is NO # warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # GNU Libtool is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of of the License, or # (at your option) any later version. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program or library that is built # using GNU Libtool, you may include this file under the same # distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see . ]) # serial 58 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.62])dnl We use AC_PATH_PROGS_FEATURE_CHECK AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl AC_BEFORE([$0], [LT_LANG])dnl AC_BEFORE([$0], [LT_OUTPUT])dnl AC_BEFORE([$0], [LTDL_INIT])dnl m4_require([_LT_CHECK_BUILDDIR])dnl dnl Autoconf doesn't catch unexpanded LT_ macros by default: m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 dnl unless we require an AC_DEFUNed macro: AC_REQUIRE([LTOPTIONS_VERSION])dnl AC_REQUIRE([LTSUGAR_VERSION])dnl AC_REQUIRE([LTVERSION_VERSION])dnl AC_REQUIRE([LTOBSOLETE_VERSION])dnl m4_require([_LT_PROG_LTMAIN])dnl _LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) dnl Parse OPTIONS _LT_SET_OPTIONS([$0], [$1]) # This can be used to rebuild libtool when needed LIBTOOL_DEPS=$ltmain # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' AC_SUBST(LIBTOOL)dnl _LT_SETUP # Only expand once: m4_define([LT_INIT]) ])# LT_INIT # Old names: AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PROG_LIBTOOL], []) dnl AC_DEFUN([AM_PROG_LIBTOOL], []) # _LT_PREPARE_CC_BASENAME # ----------------------- m4_defun([_LT_PREPARE_CC_BASENAME], [ # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. func_cc_basename () { for cc_temp in @S|@*""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` } ])# _LT_PREPARE_CC_BASENAME # _LT_CC_BASENAME(CC) # ------------------- # It would be clearer to call AC_REQUIREs from _LT_PREPARE_CC_BASENAME, # but that macro is also expanded into generated libtool script, which # arranges for $SED and $ECHO to be set by different means. m4_defun([_LT_CC_BASENAME], [m4_require([_LT_PREPARE_CC_BASENAME])dnl AC_REQUIRE([_LT_DECL_SED])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl func_cc_basename $1 cc_basename=$func_cc_basename_result ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after 'm4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl _LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl dnl _LT_DECL([], [host_alias], [0], [The host system])dnl _LT_DECL([], [host], [0])dnl _LT_DECL([], [host_os], [0])dnl dnl _LT_DECL([], [build_alias], [0], [The build system])dnl _LT_DECL([], [build], [0])dnl _LT_DECL([], [build_os], [0])dnl dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl dnl AC_REQUIRE([AC_PROG_LN_S])dnl test -z "$LN_S" && LN_S="ln -s" _LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl dnl AC_REQUIRE([LT_CMD_MAX_LEN])dnl _LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl _LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl m4_require([_LT_CMD_RELOAD])dnl m4_require([_LT_CHECK_MAGIC_METHOD])dnl m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl m4_require([_LT_CMD_OLD_ARCHIVE])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_WITH_SYSROOT])dnl m4_require([_LT_CMD_TRUNCATE])dnl _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # Global variables: ofile=libtool can_build_shared=yes # All known linkers require a '.a' archive for static linking (except MSVC, # which needs '.lib'). libext=a with_gnu_ld=$lt_cv_prog_gnu_ld old_CC=$CC old_CFLAGS=$CFLAGS # Set sane defaults for various variables test -z "$CC" && CC=cc test -z "$LTCC" && LTCC=$CC test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS test -z "$LD" && LD=ld test -z "$ac_objext" && ac_objext=o _LT_CC_BASENAME([$compiler]) # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then _LT_PATH_MAGIC fi ;; esac # Use C for the default configuration in the libtool script LT_SUPPORTED_TAG([CC]) _LT_LANG_C_CONFIG _LT_LANG_DEFAULT_CONFIG _LT_CONFIG_COMMANDS ])# _LT_SETUP # _LT_PREPARE_SED_QUOTE_VARS # -------------------------- # Define a few sed substitution that help us do robust quoting. m4_defun([_LT_PREPARE_SED_QUOTE_VARS], [# Backslashify metacharacters that are still active within # double-quoted strings. sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\([["`\\]]\)/\\\1/g' # Sed substitution to delay expansion of an escaped shell variable in a # double_quote_subst'ed string. delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' # Sed substitution to delay expansion of an escaped single quote. delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' # Sed substitution to avoid accidental globbing in evaled expressions no_glob_subst='s/\*/\\\*/g' ]) # _LT_PROG_LTMAIN # --------------- # Note that this code is called both from 'configure', and 'config.status' # now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, # 'config.status' has no value for ac_aux_dir unless we are using Automake, # so we pass a copy along to make sure it has a sensible value anyway. m4_defun([_LT_PROG_LTMAIN], [m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl _LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) ltmain=$ac_aux_dir/ltmain.sh ])# _LT_PROG_LTMAIN # So that we can recreate a full libtool script including additional # tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS # in macros and then make a single call at the end using the 'libtool' # label. # _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) # ---------------------------------------- # Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL_INIT], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_INIT], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_INIT]) # _LT_CONFIG_LIBTOOL([COMMANDS]) # ------------------------------ # Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. m4_define([_LT_CONFIG_LIBTOOL], [m4_ifval([$1], [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], [$1 ])])]) # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) # _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) # ----------------------------------------------------- m4_defun([_LT_CONFIG_SAVE_COMMANDS], [_LT_CONFIG_LIBTOOL([$1]) _LT_CONFIG_LIBTOOL_INIT([$2]) ]) # _LT_FORMAT_COMMENT([COMMENT]) # ----------------------------- # Add leading comment marks to the start of each line, and a trailing # full-stop to the whole comment if one is not present already. m4_define([_LT_FORMAT_COMMENT], [m4_ifval([$1], [ m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) )]) # _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) # ------------------------------------------------------------------- # CONFIGNAME is the name given to the value in the libtool script. # VARNAME is the (base) name used in the configure script. # VALUE may be 0, 1 or 2 for a computed quote escaped value based on # VARNAME. Any other value will be used directly. m4_define([_LT_DECL], [lt_if_append_uniq([lt_decl_varnames], [$2], [, ], [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], [m4_ifval([$1], [$1], [$2])]) lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) m4_ifval([$4], [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) lt_dict_add_subkey([lt_decl_dict], [$2], [tagged?], [m4_ifval([$5], [yes], [no])])]) ]) # _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) # -------------------------------------------------------- m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) # lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_tag_varnames], [_lt_decl_filter([tagged?], [yes], $@)]) # _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) # --------------------------------------------------------- m4_define([_lt_decl_filter], [m4_case([$#], [0], [m4_fatal([$0: too few arguments: $#])], [1], [m4_fatal([$0: too few arguments: $#: $1])], [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], [lt_dict_filter([lt_decl_dict], $@)])[]dnl ]) # lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) # -------------------------------------------------- m4_define([lt_decl_quote_varnames], [_lt_decl_filter([value], [1], $@)]) # lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_dquote_varnames], [_lt_decl_filter([value], [2], $@)]) # lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) # --------------------------------------------------- m4_define([lt_decl_varnames_tagged], [m4_assert([$# <= 2])dnl _$0(m4_quote(m4_default([$1], [[, ]])), m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) m4_define([_lt_decl_varnames_tagged], [m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) # lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) # ------------------------------------------------ m4_define([lt_decl_all_varnames], [_$0(m4_quote(m4_default([$1], [[, ]])), m4_if([$2], [], m4_quote(lt_decl_varnames), m4_quote(m4_shift($@))))[]dnl ]) m4_define([_lt_decl_all_varnames], [lt_join($@, lt_decl_varnames_tagged([$1], lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl ]) # _LT_CONFIG_STATUS_DECLARE([VARNAME]) # ------------------------------------ # Quote a variable value, and forward it to 'config.status' so that its # declaration there will have the same value as in 'configure'. VARNAME # must have a single quote delimited value for this to work. m4_define([_LT_CONFIG_STATUS_DECLARE], [$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) # _LT_CONFIG_STATUS_DECLARATIONS # ------------------------------ # We delimit libtool config variables with single quotes, so when # we write them to config.status, we have to be sure to quote all # embedded single quotes properly. In configure, this macro expands # each variable declared with _LT_DECL (and _LT_TAGDECL) into: # # ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], [m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAGS # ---------------- # Output comment and list of tags supported by the script m4_defun([_LT_LIBTOOL_TAGS], [_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl available_tags='_LT_TAGS'dnl ]) # _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) # ----------------------------------- # Extract the dictionary values for VARNAME (optionally with TAG) and # expand to a commented shell variable setting: # # # Some comment about what VAR is for. # visible_name=$lt_internal_name m4_define([_LT_LIBTOOL_DECLARE], [_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [description])))[]dnl m4_pushdef([_libtool_name], m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), [0], [_libtool_name=[$]$1], [1], [_libtool_name=$lt_[]$1], [2], [_libtool_name=$lt_[]$1], [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl ]) # _LT_LIBTOOL_CONFIG_VARS # ----------------------- # Produce commented declarations of non-tagged libtool config variables # suitable for insertion in the LIBTOOL CONFIG section of the 'libtool' # script. Tagged libtool config variables (even for the LIBTOOL CONFIG # section) are produced by _LT_LIBTOOL_TAG_VARS. m4_defun([_LT_LIBTOOL_CONFIG_VARS], [m4_foreach([_lt_var], m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) # _LT_LIBTOOL_TAG_VARS(TAG) # ------------------------- m4_define([_LT_LIBTOOL_TAG_VARS], [m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) # _LT_TAGVAR(VARNAME, [TAGNAME]) # ------------------------------ m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) # _LT_CONFIG_COMMANDS # ------------------- # Send accumulated output to $CONFIG_STATUS. Thanks to the lists of # variables for single and double quote escaping we saved from calls # to _LT_DECL, we can put quote escaped variables declarations # into 'config.status', and then the shell code to quote escape them in # for loops in 'config.status'. Finally, any additional code accumulated # from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. m4_defun([_LT_CONFIG_COMMANDS], [AC_PROVIDE_IFELSE([LT_OUTPUT], dnl If the libtool generation code has been placed in $CONFIG_LT, dnl instead of duplicating it all over again into config.status, dnl then we will have config.status run $CONFIG_LT later, so it dnl needs to know what name is stored there: [AC_CONFIG_COMMANDS([libtool], [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], dnl If the libtool generation code is destined for config.status, dnl expand the accumulated commands and init code now: [AC_CONFIG_COMMANDS([libtool], [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) ])#_LT_CONFIG_COMMANDS # Initialize. m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], [ # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' _LT_CONFIG_STATUS_DECLARATIONS LTCC='$LTCC' LTCFLAGS='$LTCFLAGS' compiler='$compiler_DEFAULT' # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF \$[]1 _LTECHO_EOF' } # Quote evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_quote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done # Double-quote double-evaled strings. for var in lt_decl_all_varnames([[ \ ]], lt_decl_dquote_varnames); do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[[\\\\\\\`\\"\\\$]]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ## exclude from sc_prohibit_nested_quotes ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done _LT_OUTPUT_LIBTOOL_INIT ]) # _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) # ------------------------------------ # Generate a child script FILE with all initialization necessary to # reuse the environment learned by the parent script, and make the # file executable. If COMMENT is supplied, it is inserted after the # '#!' sequence but before initialization text begins. After this # macro, additional text can be appended to FILE to form the body of # the child script. The macro ends with non-zero status if the # file could not be fully written (such as if the disk is full). m4_ifdef([AS_INIT_GENERATED], [m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], [m4_defun([_LT_GENERATED_FILE_INIT], [m4_require([AS_PREPARE])]dnl [m4_pushdef([AS_MESSAGE_LOG_FD])]dnl [lt_write_fail=0 cat >$1 <<_ASEOF || lt_write_fail=1 #! $SHELL # Generated by $as_me. $2 SHELL=\${CONFIG_SHELL-$SHELL} export SHELL _ASEOF cat >>$1 <<\_ASEOF || lt_write_fail=1 AS_SHELL_SANITIZE _AS_PREPARE exec AS_MESSAGE_FD>&1 _ASEOF test 0 = "$lt_write_fail" && chmod +x $1[]dnl m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT # LT_OUTPUT # --------- # This macro allows early generation of the libtool script (before # AC_OUTPUT is called), incase it is used in configure for compilation # tests. AC_DEFUN([LT_OUTPUT], [: ${CONFIG_LT=./config.lt} AC_MSG_NOTICE([creating $CONFIG_LT]) _LT_GENERATED_FILE_INIT(["$CONFIG_LT"], [# Run this file to recreate a libtool stub with the current configuration.]) cat >>"$CONFIG_LT" <<\_LTEOF lt_cl_silent=false exec AS_MESSAGE_LOG_FD>>config.log { echo AS_BOX([Running $as_me.]) } >&AS_MESSAGE_LOG_FD lt_cl_help="\ '$as_me' creates a local libtool stub from the current configuration, for use in further configure time tests before the real libtool is generated. Usage: $[0] [[OPTIONS]] -h, --help print this help, then exit -V, --version print version number, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files Report bugs to ." lt_cl_version="\ m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) configured by $[0], generated by m4_PACKAGE_STRING. Copyright (C) 2011 Free Software Foundation, Inc. This config.lt script is free software; the Free Software Foundation gives unlimited permision to copy, distribute and modify it." while test 0 != $[#] do case $[1] in --version | --v* | -V ) echo "$lt_cl_version"; exit 0 ;; --help | --h* | -h ) echo "$lt_cl_help"; exit 0 ;; --debug | --d* | -d ) debug=: ;; --quiet | --q* | --silent | --s* | -q ) lt_cl_silent=: ;; -*) AC_MSG_ERROR([unrecognized option: $[1] Try '$[0] --help' for more information.]) ;; *) AC_MSG_ERROR([unrecognized argument: $[1] Try '$[0] --help' for more information.]) ;; esac shift done if $lt_cl_silent; then exec AS_MESSAGE_FD>/dev/null fi _LTEOF cat >>"$CONFIG_LT" <<_LTEOF _LT_OUTPUT_LIBTOOL_COMMANDS_INIT _LTEOF cat >>"$CONFIG_LT" <<\_LTEOF AC_MSG_NOTICE([creating $ofile]) _LT_OUTPUT_LIBTOOL_COMMANDS AS_EXIT(0) _LTEOF chmod +x "$CONFIG_LT" # configure is writing to config.log, but config.lt does its own redirection, # appending to config.log, which fails on DOS, as config.log is still kept # open by configure. Here we exec the FD to /dev/null, effectively closing # config.log, so it can be properly (re)opened and appended to by config.lt. lt_cl_success=: test yes = "$silent" && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options that allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}"; then setopt NO_GLOB_SUBST fi cfgfile=${ofile}T trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # Generated automatically by $as_me ($PACKAGE) $VERSION # NOTE: Changes made to this file will be lost: look at ltmain.sh. # Provide generalized library-building support services. # Written by Gordon Matzigkeit, 1996 _LT_COPYING _LT_LIBTOOL_TAGS # Configured defaults for sys_lib_dlsearch_path munging. : \${LT_SYS_LIBRARY_PATH="$configure_time_lt_sys_library_path"} # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF cat <<'_LT_EOF' >> "$cfgfile" # ### BEGIN FUNCTIONS SHARED WITH CONFIGURE _LT_PREPARE_MUNGE_PATH_LIST _LT_PREPARE_CC_BASENAME # ### END FUNCTIONS SHARED WITH CONFIGURE _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test set != "${COLLECT_NAMES+set}"; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [Go], [_LT_LANG(GO)], [Java], [_LT_LANG(GCJ)], [Fortran 77], [_LT_LANG(F77)], [Fortran], [_LT_LANG(FC)], [Windows Resource], [_LT_LANG(RC)], [m4_ifdef([_LT_LANG_]$1[_CONFIG], [_LT_LANG($1)], [m4_fatal([$0: unsupported language: "$1"])])])dnl ])# LT_LANG # _LT_LANG(LANGNAME) # ------------------ m4_defun([_LT_LANG], [m4_ifdef([_LT_LANG_]$1[_enabled], [], [LT_SUPPORTED_TAG([$1])dnl m4_append([_LT_TAGS], [$1 ])dnl m4_define([_LT_LANG_]$1[_enabled], [])dnl _LT_LANG_$1_CONFIG($1)])dnl ])# _LT_LANG m4_ifndef([AC_PROG_GO], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_GO. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_GO], [AC_LANG_PUSH(Go)dnl AC_ARG_VAR([GOC], [Go compiler command])dnl AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl _AC_ARG_VAR_LDFLAGS()dnl AC_CHECK_TOOL(GOC, gccgo) if test -z "$GOC"; then if test -n "$ac_tool_prefix"; then AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo]) fi fi if test -z "$GOC"; then AC_CHECK_PROG(GOC, gccgo, gccgo, false) fi ])#m4_defun ])#m4_ifndef # _LT_LANG_DEFAULT_CONFIG # ----------------------- m4_defun([_LT_LANG_DEFAULT_CONFIG], [AC_PROVIDE_IFELSE([AC_PROG_CXX], [LT_LANG(CXX)], [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) AC_PROVIDE_IFELSE([AC_PROG_F77], [LT_LANG(F77)], [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) AC_PROVIDE_IFELSE([AC_PROG_FC], [LT_LANG(FC)], [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal dnl pulling things in needlessly. AC_PROVIDE_IFELSE([AC_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], [LT_LANG(GCJ)], [AC_PROVIDE_IFELSE([LT_PROG_GCJ], [LT_LANG(GCJ)], [m4_ifdef([AC_PROG_GCJ], [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([A][M_PROG_GCJ], [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) m4_ifdef([LT_PROG_GCJ], [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) AC_PROVIDE_IFELSE([AC_PROG_GO], [LT_LANG(GO)], [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])]) AC_PROVIDE_IFELSE([LT_PROG_RC], [LT_LANG(RC)], [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) ])# _LT_LANG_DEFAULT_CONFIG # Obsolete macros: AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_CXX], []) dnl AC_DEFUN([AC_LIBTOOL_F77], []) dnl AC_DEFUN([AC_LIBTOOL_FC], []) dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) dnl AC_DEFUN([AC_LIBTOOL_RC], []) # _LT_TAG_COMPILER # ---------------- m4_defun([_LT_TAG_COMPILER], [AC_REQUIRE([AC_PROG_CC])dnl _LT_DECL([LTCC], [CC], [1], [A C compiler])dnl _LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl _LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl _LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl # If no C compiler was specified, use CC. LTCC=${LTCC-"$CC"} # If no C compiler flags were specified, use CFLAGS. LTCFLAGS=${LTCFLAGS-"$CFLAGS"} # Allow CC to be a program name with arguments. compiler=$CC ])# _LT_TAG_COMPILER # _LT_COMPILER_BOILERPLATE # ------------------------ # Check for compiler boilerplate output or warnings with # the simple compiler test code. m4_defun([_LT_COMPILER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_compile_test_code" >conftest.$ac_ext eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_compiler_boilerplate=`cat conftest.err` $RM conftest* ])# _LT_COMPILER_BOILERPLATE # _LT_LINKER_BOILERPLATE # ---------------------- # Check for linker boilerplate output or warnings with # the simple link test code. m4_defun([_LT_LINKER_BOILERPLATE], [m4_require([_LT_DECL_SED])dnl ac_outfile=conftest.$ac_objext echo "$lt_simple_link_test_code" >conftest.$ac_ext eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err _lt_linker_boilerplate=`cat conftest.err` $RM -r conftest* ])# _LT_LINKER_BOILERPLATE # _LT_REQUIRED_DARWIN_CHECKS # ------------------------- m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ case $host_os in rhapsody* | darwin*) AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) AC_CHECK_TOOL([LIPO], [lipo], [:]) AC_CHECK_TOOL([OTOOL], [otool], [:]) AC_CHECK_TOOL([OTOOL64], [otool64], [:]) _LT_DECL([], [DSYMUTIL], [1], [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) _LT_DECL([], [NMEDIT], [1], [Tool to change global to local symbols on Mac OS X]) _LT_DECL([], [LIPO], [1], [Tool to manipulate fat objects and archives on Mac OS X]) _LT_DECL([], [OTOOL], [1], [ldd/readelf like tool for Mach-O binaries on Mac OS X]) _LT_DECL([], [OTOOL64], [1], [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], [lt_cv_apple_cc_single_mod=no if test -z "$LT_MULTI_MODULE"; then # By default we will add the -single_module flag. You can override # by either setting the environment variable LT_MULTI_MODULE # non-empty at configure time, or by adding -multi_module to the # link flags. rm -rf libconftest.dylib* echo "int foo(void){return 1;}" > conftest.c echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ -dynamiclib -Wl,-single_module conftest.c 2>conftest.err _lt_result=$? # If there is a non-empty error log, and "single_module" # appears in it, assume the flag caused a linker warning if test -s conftest.err && $GREP single_module conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD # Otherwise, if the output was created with a 0 exit code from # the compiler, it worked. elif test -f libconftest.dylib && test 0 = "$_lt_result"; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS=$save_LDFLAGS ]) AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], [lt_cv_ld_force_load=no cat > conftest.c << _LT_EOF int forced_loaded() { return 2;} _LT_EOF echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD cat > conftest.c << _LT_EOF int main() { return 0;} _LT_EOF echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err _lt_result=$? if test -s conftest.err && $GREP force_load conftest.err; then cat conftest.err >&AS_MESSAGE_LOG_FD elif test -f conftest && test 0 = "$_lt_result" && $GREP forced_load conftest >/dev/null 2>&1; then lt_cv_ld_force_load=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -f conftest.err libconftest.a conftest conftest.c rm -rf conftest.dSYM ]) case $host_os in rhapsody* | darwin1.[[012]]) _lt_dar_allow_undefined='$wl-undefined ${wl}suppress' ;; darwin1.*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; darwin*) # darwin 5.x on # if running on 10.5 or later, the deployment target defaults # to the OS version, if on x86, and 10.4, the deployment # target defaults to 10.4. Don't you love it? case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; 10.[[012]][[,.]]*) _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; 10.*) _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; esac ;; esac if test yes = "$lt_cv_apple_cc_single_mod"; then _lt_dar_single_mod='$single_module' fi if test yes = "$lt_cv_ld_exported_symbols_list"; then _lt_dar_export_syms=' $wl-exported_symbols_list,$output_objdir/$libname-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/$libname-symbols.expsym $lib' fi if test : != "$DSYMUTIL" && test no = "$lt_cv_ld_force_load"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; esac ]) # _LT_DARWIN_LINKER_FEATURES([TAG]) # --------------------------------- # Checks for linker and compiler features on darwin m4_defun([_LT_DARWIN_LINKER_FEATURES], [ m4_require([_LT_REQUIRED_DARWIN_CHECKS]) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported if test yes = "$lt_cv_ld_force_load"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience $wl-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes], [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes]) else _LT_TAGVAR(whole_archive_flag_spec, $1)='' fi _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=$_lt_dar_allow_undefined case $cc_basename in ifort*|nagfor*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test yes = "$_lt_dar_can_shared"; then output_verbose_link_cmd=func_echo_all _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dsymutil" _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod$_lt_dar_export_syms$_lt_dsymutil" _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags$_lt_dar_export_syms$_lt_dsymutil" m4_if([$1], [CXX], [ if test yes != "$lt_cv_apple_cc_single_mod"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dsymutil" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's|^|_|' < \$export_symbols > \$output_objdir/\$libname-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \$lib-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$lib-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring$_lt_dar_export_syms$_lt_dsymutil" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([TAGNAME]) # ---------------------------------- # Links a minimal program and checks the executable # for the system default hardcoded library path. In most cases, # this is /usr/lib:/lib, but when the MPI compilers are used # the location of the communication and MPI libs are included too. # If we don't find anything, use the default library path according # to the aix ld manual. # Store the results from the different compilers for each TAGNAME. # Allow to override them for all tags through lt_cv_aix_libpath. m4_defun([_LT_SYS_MODULE_PATH_AIX], [m4_require([_LT_DECL_SED])dnl if test set = "${lt_cv_aix_libpath+set}"; then aix_libpath=$lt_cv_aix_libpath else AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ lt_aix_libpath_sed='[ /Import File Strings/,/^$/ { /^0/ { s/^0 *\([^ ]*\) *$/\1/ p } }]' _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` # Check for a 64-bit object if we didn't find anything. if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` fi],[]) if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=/usr/lib:/lib fi ]) aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) fi ])# _LT_SYS_MODULE_PATH_AIX # _LT_SHELL_INIT(ARG) # ------------------- m4_define([_LT_SHELL_INIT], [m4_divert_text([M4SH-INIT], [$1 ])])# _LT_SHELL_INIT # _LT_PROG_ECHO_BACKSLASH # ----------------------- # Find how we can fake an echo command that does not interpret backslash. # In particular, with Autoconf 2.60 or later we add some code to the start # of the generated configure script that will find a shell with a builtin # printf (that we can use as an echo command). m4_defun([_LT_PROG_ECHO_BACKSLASH], [ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO AC_MSG_CHECKING([how to print strings]) # Test print first, because it will be a builtin if present. if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='print -r --' elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then ECHO='printf %s\n' else # Use this function as a fallback that always works. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $[]1 _LTECHO_EOF' } ECHO='func_fallback_echo' fi # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } case $ECHO in printf*) AC_MSG_RESULT([printf]) ;; print*) AC_MSG_RESULT([print -r]) ;; *) AC_MSG_RESULT([cat]) ;; esac m4_ifdef([_AS_DETECT_SUGGESTED], [_AS_DETECT_SUGGESTED([ test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO PATH=/empty FPATH=/empty; export PATH FPATH test "X`printf %s $ECHO`" = "X$ECHO" \ || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) _LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) _LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) ])# _LT_PROG_ECHO_BACKSLASH # _LT_WITH_SYSROOT # ---------------- AC_DEFUN([_LT_WITH_SYSROOT], [AC_MSG_CHECKING([for sysroot]) AC_ARG_WITH([sysroot], [AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@], [Search for dependent libraries within DIR (or the compiler's sysroot if not specified).])], [], [with_sysroot=no]) dnl lt_sysroot will always be passed unquoted. We quote it here dnl in case the user passed a directory name. lt_sysroot= case $with_sysroot in #( yes) if test yes = "$GCC"; then lt_sysroot=`$CC --print-sysroot 2>/dev/null` fi ;; #( /*) lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` ;; #( no|'') ;; #( *) AC_MSG_RESULT([$with_sysroot]) AC_MSG_ERROR([The sysroot must be an absolute path.]) ;; esac AC_MSG_RESULT([${lt_sysroot:-no}]) _LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl [dependent libraries, and where our libraries should be installed.])]) # _LT_ENABLE_LOCK # --------------- m4_defun([_LT_ENABLE_LOCK], [AC_ARG_ENABLE([libtool-lock], [AS_HELP_STRING([--disable-libtool-lock], [avoid locking (might break parallel builds)])]) test no = "$enable_libtool_lock" || enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out what ABI is being produced by ac_compile, and set mode # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE=32 ;; *ELF-64*) HPUX_IA64_MODE=64 ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test yes = "$lt_cv_prog_gnu_ld"; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; mips64*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then emul=elf case `/usr/bin/file conftest.$ac_objext` in *32-bit*) emul="${emul}32" ;; *64-bit*) emul="${emul}64" ;; esac case `/usr/bin/file conftest.$ac_objext` in *MSB*) emul="${emul}btsmip" ;; *LSB*) emul="${emul}ltsmip" ;; esac case `/usr/bin/file conftest.$ac_objext` in *N32*) emul="${emul}n32" ;; esac LD="${LD-ld} -m $emul" fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. Note that the listed cases only cover the # situations where additional linker options are needed (such as when # doing 32-bit compilation for a host where ld defaults to 64-bit, or # vice versa); the common cases where no linker options are needed do # not appear in the list. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) case `/usr/bin/file conftest.o` in *x86-64*) LD="${LD-ld} -m elf32_x86_64" ;; *) LD="${LD-ld} -m elf_i386" ;; esac ;; powerpc64le-*linux*) LD="${LD-ld} -m elf32lppclinux" ;; powerpc64-*linux*) LD="${LD-ld} -m elf32ppclinux" ;; s390x-*linux*) LD="${LD-ld} -m elf_s390" ;; sparc64-*linux*) LD="${LD-ld} -m elf32_sparc" ;; esac ;; *64-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_x86_64_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_x86_64" ;; powerpcle-*linux*) LD="${LD-ld} -m elf64lppc" ;; powerpc-*linux*) LD="${LD-ld} -m elf64ppc" ;; s390*-*linux*|s390*-*tpf*) LD="${LD-ld} -m elf64_s390" ;; sparc*-*linux*) LD="${LD-ld} -m elf64_sparc" ;; esac ;; esac fi rm -rf conftest* ;; *-*-sco3.2v5*) # On SCO OpenServer 5, we need -belf to get full-featured binaries. SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS -belf" AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, [AC_LANG_PUSH(C) AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) AC_LANG_POP]) if test yes != "$lt_cv_cc_needs_belf"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS=$SAVE_CFLAGS fi ;; *-*solaris*) # Find out what ABI is being produced by ac_compile, and set linker # options accordingly. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-solaris*|x86_64-*-solaris*) LD="${LD-ld} -m elf_x86_64" ;; sparc*-*-solaris*) LD="${LD-ld} -m elf64_sparc" ;; esac # GNU ld 2.21 introduced _sol2 emulations. Use them if available. if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then LD=${LD-ld}_sol2 fi ;; *) if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then LD="${LD-ld} -64" fi ;; esac ;; esac fi rm -rf conftest* ;; esac need_locks=$enable_libtool_lock ])# _LT_ENABLE_LOCK # _LT_PROG_AR # ----------- m4_defun([_LT_PROG_AR], [AC_CHECK_TOOLS(AR, [ar], false) : ${AR=ar} : ${AR_FLAGS=cru} _LT_DECL([], [AR], [1], [The archiver]) _LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], [lt_cv_ar_at_file=no AC_COMPILE_IFELSE([AC_LANG_PROGRAM], [echo conftest.$ac_objext > conftest.lst lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' AC_TRY_EVAL([lt_ar_try]) if test 0 -eq "$ac_status"; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test 0 -ne "$ac_status"; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test no = "$lt_cv_ar_at_file"; then archiver_list_spec= else archiver_list_spec=$lt_cv_ar_at_file fi _LT_DECL([], [archiver_list_spec], [1], [How to feed a file listing to the archiver]) ])# _LT_PROG_AR # _LT_CMD_OLD_ARCHIVE # ------------------- m4_defun([_LT_CMD_OLD_ARCHIVE], [_LT_PROG_AR AC_CHECK_TOOL(STRIP, strip, :) test -z "$STRIP" && STRIP=: _LT_DECL([], [STRIP], [1], [A symbol stripping program]) AC_CHECK_TOOL(RANLIB, ranlib, :) test -z "$RANLIB" && RANLIB=: _LT_DECL([], [RANLIB], [1], [Commands used to install an old-style archive]) # Determine commands to create old-style static archives. old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' old_postinstall_cmds='chmod 644 $oldlib' old_postuninstall_cmds= if test -n "$RANLIB"; then case $host_os in bitrig* | openbsd*) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib" ;; *) old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib" ;; esac old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib" fi case $host_os in darwin*) lock_old_archive_extraction=yes ;; *) lock_old_archive_extraction=no ;; esac _LT_DECL([], [old_postinstall_cmds], [2]) _LT_DECL([], [old_postuninstall_cmds], [2]) _LT_TAGDECL([], [old_archive_cmds], [2], [Commands used to build an old-style archive]) _LT_DECL([], [lock_old_archive_extraction], [0], [Whether to use a lock for old archive extraction]) ])# _LT_CMD_OLD_ARCHIVE # _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------------------- # Check whether the given compiler option works AC_DEFUN([_LT_COMPILER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="$3" ## exclude from sc_useless_quotes_in_assignment # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. # The option is referenced via a variable to avoid confusing sed. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>conftest.err) ac_status=$? cat conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s "$ac_outfile"; then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings other than the usual output. $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi fi $RM conftest* ]) if test yes = "[$]$2"; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 if diff conftest.exp conftest.er2 >/dev/null; then $2=yes fi else $2=yes fi fi $RM -r conftest* LDFLAGS=$save_LDFLAGS ]) if test yes = "[$]$2"; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring=ABCD case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; mint*) # On MiNT this can take a long time and run out of memory. lt_cv_sys_max_cmd_len=8192; ;; amigaos*) # On AmigaOS with pdksh, this test takes hours, literally. # So we just punt and use a minimum line length of 8192. lt_cv_sys_max_cmd_len=8192; ;; bitrig* | darwin* | dragonfly* | freebsd* | netbsd* | openbsd*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; os2*) # The test takes a long time on OS/2. lt_cv_sys_max_cmd_len=8192 ;; osf*) # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not # nice to cause kernel panics so lets avoid the loop below. # First set a reasonable default. lt_cv_sys_max_cmd_len=16384 # if test -x /sbin/sysconfig; then case `/sbin/sysconfig -q proc exec_disable_arg_limit` in *1*) lt_cv_sys_max_cmd_len=-1 ;; esac fi ;; sco3.2v5*) lt_cv_sys_max_cmd_len=102400 ;; sysv5* | sco5v6* | sysv4.2uw2*) kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` if test -n "$kargmax"; then lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` else lt_cv_sys_max_cmd_len=32768 fi ;; *) lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` if test -n "$lt_cv_sys_max_cmd_len" && \ test undefined != "$lt_cv_sys_max_cmd_len"; then lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` else # Make teststring a little bigger before we do anything with it. # a 1K string should be a reasonable start. for i in 1 2 3 4 5 6 7 8; do teststring=$teststring$teststring done SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} # If test is not a shell built-in, we'll probably end up computing a # maximum length that is only half of the actual maximum length, but # we can't tell. while { test X`env echo "$teststring$teststring" 2>/dev/null` \ = "X$teststring$teststring"; } >/dev/null 2>&1 && test 17 != "$i" # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n "$lt_cv_sys_max_cmd_len"; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes = "$cross_compiling"; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $LINENO "configure" #include "confdefs.h" #if HAVE_DLFCN_H #include #endif #include #ifdef RTLD_GLOBAL # define LT_DLGLOBAL RTLD_GLOBAL #else # ifdef DL_GLOBAL # define LT_DLGLOBAL DL_GLOBAL # else # define LT_DLGLOBAL 0 # endif #endif /* We may have to define LT_DLLAZY_OR_NOW in the command line if we find out it does not work in some platform. */ #ifndef LT_DLLAZY_OR_NOW # ifdef RTLD_LAZY # define LT_DLLAZY_OR_NOW RTLD_LAZY # else # ifdef DL_LAZY # define LT_DLLAZY_OR_NOW DL_LAZY # else # ifdef RTLD_NOW # define LT_DLLAZY_OR_NOW RTLD_NOW # else # ifdef DL_NOW # define LT_DLLAZY_OR_NOW DL_NOW # else # define LT_DLLAZY_OR_NOW 0 # endif # endif # endif # endif #endif /* When -fvisibility=hidden is used, assume the code has been annotated correspondingly for the symbols needed. */ #if defined __GNUC__ && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) int fnord () __attribute__((visibility("default"))); #endif int fnord () { return 42; } int main () { void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); int status = $lt_dlunknown; if (self) { if (dlsym (self,"fnord")) status = $lt_dlno_uscore; else { if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; else puts (dlerror ()); } /* dlclose (self); */ } else puts (dlerror ()); return status; }] _LT_EOF if AC_TRY_EVAL(ac_link) && test -s "conftest$ac_exeext" 2>/dev/null; then (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null lt_status=$? case x$lt_status in x$lt_dlno_uscore) $1 ;; x$lt_dlneed_uscore) $2 ;; x$lt_dlunknown|x*) $3 ;; esac else : # compilation failed $3 fi fi rm -fr conftest* ])# _LT_TRY_DLOPEN_SELF # LT_SYS_DLOPEN_SELF # ------------------ AC_DEFUN([LT_SYS_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test yes != "$enable_dlopen"; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen=load_add_on lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen=LoadLibrary lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen=dlopen lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl],[ lt_cv_dlopen=dyld lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; tpf*) # Don't try to run any link tests for TPF. We know it's impossible # because TPF is a cross-compiler, and we know how we open DSOs. lt_cv_dlopen=dlopen lt_cv_dlopen_libs= lt_cv_dlopen_self=no ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen=shl_load], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen=shl_load lt_cv_dlopen_libs=-ldld], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen=dlopen], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-ldl], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen=dlopen lt_cv_dlopen_libs=-lsvld], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen=dld_link lt_cv_dlopen_libs=-ldld]) ]) ]) ]) ]) ]) ;; esac if test no = "$lt_cv_dlopen"; then enable_dlopen=no else enable_dlopen=yes fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS=$CPPFLAGS test yes = "$ac_cv_header_dlfcn_h" && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS=$LDFLAGS wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS=$LIBS LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test yes = "$lt_cv_dlopen_self"; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS=$save_CPPFLAGS LDFLAGS=$save_LDFLAGS LIBS=$save_LIBS ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$lt_compile" 2>out/conftest.err) ac_status=$? cat out/conftest.err >&AS_MESSAGE_LOG_FD echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD if (exit $ac_status) && test -s out/conftest2.$ac_objext then # The compiler can only warn and ignore the option if not recognized # So say no if there are warnings $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes fi fi chmod u+w . 2>&AS_MESSAGE_LOG_FD $RM conftest* # SGI C++ compiler will create directory out/ii_files/ for # template instantiation test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files $RM out/* && rmdir out cd .. $RM -r conftest $RM conftest* ]) _LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], [Does compiler simultaneously support -c and -o options?]) ])# _LT_COMPILER_C_O # _LT_COMPILER_FILE_LOCKS([TAGNAME]) # ---------------------------------- # Check to see if we can do hard links to lock some files if needed m4_defun([_LT_COMPILER_FILE_LOCKS], [m4_require([_LT_ENABLE_LOCK])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_COMPILER_C_O([$1]) hard_links=nottested if test no = "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" && test no != "$need_locks"; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test no = "$hard_links"; then AC_MSG_WARN(['$CC' does not support '-c -o', so 'make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED([LT_OBJDIR], "$lt_cv_objdir/", [Define to the sub-directory where libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test yes = "$_LT_TAGVAR(hardcode_automatic, $1)"; then # We can hardcode non-existent directories. if test no != "$_LT_TAGVAR(hardcode_direct, $1)" && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test no != "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" && test no != "$_LT_TAGVAR(hardcode_minus_L, $1)"; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test relink = "$_LT_TAGVAR(hardcode_action, $1)" || test yes = "$_LT_TAGVAR(inherit_rpath, $1)"; then # Fast installation is not supported enable_fast_install=no elif test yes = "$shlibpath_overrides_runpath" || test no = "$enable_shared"; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP"; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_PREPARE_MUNGE_PATH_LIST # --------------------------- # Make sure func_munge_path_list() is defined correctly. m4_defun([_LT_PREPARE_MUNGE_PATH_LIST], [[# func_munge_path_list VARIABLE PATH # ----------------------------------- # VARIABLE is name of variable containing _space_ separated list of # directories to be munged by the contents of PATH, which is string # having a format: # "DIR[:DIR]:" # string "DIR[ DIR]" will be prepended to VARIABLE # ":DIR[:DIR]" # string "DIR[ DIR]" will be appended to VARIABLE # "DIRP[:DIRP]::[DIRA:]DIRA" # string "DIRP[ DIRP]" will be prepended to VARIABLE and string # "DIRA[ DIRA]" will be appended to VARIABLE # "DIR[:DIR]" # VARIABLE will be replaced by "DIR[ DIR]" func_munge_path_list () { case x@S|@2 in x) ;; *:) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'` \@S|@@S|@1\" ;; x:*) eval @S|@1=\"\@S|@@S|@1 `$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; *::*) eval @S|@1=\"\@S|@@S|@1\ `$ECHO @S|@2 | $SED -e 's/.*:://' -e 's/:/ /g'`\" eval @S|@1=\"`$ECHO @S|@2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \@S|@@S|@1\" ;; *) eval @S|@1=\"`$ECHO @S|@2 | $SED 's/:/ /g'`\" ;; esac } ]])# _LT_PREPARE_PATH_LIST # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl m4_require([_LT_PREPARE_MUNGE_PATH_LIST])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test yes = "$GCC"; then case $host_os in darwin*) lt_awk_arg='/^libraries:/,/LR/' ;; *) lt_awk_arg='/^libraries:/' ;; esac case $host_os in mingw* | cegcc*) lt_sed_strip_eq='s|=\([[A-Za-z]]:\)|\1|g' ;; *) lt_sed_strip_eq='s|=/|/|g' ;; esac lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` case $lt_search_path_spec in *\;*) # if the path contains ";" then we assume it to be the separator # otherwise default to the standard path separator (i.e. ":") - it is # assumed that no part of a normal pathname contains ";" but that should # okay in the real world where ";" in dirpaths is itself problematic. lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` ;; *) lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` ;; esac # Ok, now we have the path, separated by spaces, we can step through it # and add multilib dir if necessary... lt_tmp_lt_search_path_spec= lt_multi_os_dir=/`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` # ...but if some path component already ends with the multilib dir we assume # that all is fine and trust -print-search-dirs as is (GCC 4.2? or newer). case "$lt_multi_os_dir; $lt_search_path_spec " in "/; "* | "/.; "* | "/./; "* | *"$lt_multi_os_dir "* | *"$lt_multi_os_dir/ "*) lt_multi_os_dir= ;; esac for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path$lt_multi_os_dir" elif test -n "$lt_multi_os_dir"; then test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS = " "; FS = "/|\n";} { lt_foo = ""; lt_count = 0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo = "/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # AWK program above erroneously prepends '/' to C:/dos/paths # for these hosts. case $host_os in mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ $SED 's|/\([[A-Za-z]]:\)|\1|g'` ;; esac sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` else sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" fi]) library_names_spec= libname_spec='lib$name' soname_spec= shrext_cmds=.so postinstall_cmds= postuninstall_cmds= finish_cmds= finish_eval= shlibpath_var= shlibpath_overrides_runpath=unknown version_type=none dynamic_linker="$host_os ld.so" sys_lib_dlsearch_path_spec="/lib /usr/lib" need_lib_prefix=unknown hardcode_into_libs=no # when you set need_version to no, make sure it does not cause -set_version # flags to be left without arguments need_version=unknown AC_ARG_VAR([LT_SYS_LIBRARY_PATH], [User-defined run-time library search path.]) case $host_os in aix3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname.a' shlibpath_var=LIBPATH # AIX 3 has no versioning support, so we append a major version to the name. soname_spec='$libname$release$shared_ext$major' ;; aix[[4-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no hardcode_into_libs=yes if test ia64 = "$host_cpu"; then # AIX 5 supports IA64 library_names_spec='$libname$release$shared_ext$major $libname$release$shared_ext$versuffix $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line '#! .'. This would cause the generated library to # depend on '.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | $CC -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # Using Import Files as archive members, it is possible to support # filename-based versioning of shared library archives on AIX. While # this would work for both with and without runtime linking, it will # prevent static linking of such archives. So we do filename-based # shared library versioning with .so extension only, which is used # when both runtime linking and shared linking is enabled. # Unfortunately, runtime linking may impact performance, so we do # not want this to be the default eventually. Also, we use the # versioned .so libs for executables only if there is the -brtl # linker flag in LDFLAGS as well, or --with-aix-soname=svr4 only. # To allow for filename-based versioning support, we need to create # libNAME.so.V as an archive file, containing: # *) an Import File, referring to the versioned filename of the # archive as well as the shared archive member, telling the # bitwidth (32 or 64) of that shared object, and providing the # list of exported symbols of that shared object, eventually # decorated with the 'weak' keyword # *) the shared object with the F_LOADONLY flag set, to really avoid # it being seen by the linker. # At run time we better use the real file rather than another symlink, # but for link time we create the symlink libNAME.so -> libNAME.so.V case $with_aix_soname,$aix_use_runtimelinking in # AIX (on Power*) has no versioning support, so currently we cannot hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. aix,yes) # traditional libtool dynamic_linker='AIX unversionable lib.so' # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; aix,no) # traditional AIX only dynamic_linker='AIX lib.a[(]lib.so.V[)]' # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' ;; svr4,*) # full svr4 only dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,yes) # both, prefer svr4 dynamic_linker="AIX lib.so.V[(]$shared_archive_member_spec.o[)], lib.a[(]lib.so.V[)]" library_names_spec='$libname$release$shared_ext$major $libname$shared_ext' # unpreferred sharedlib libNAME.a needs extra handling postinstall_cmds='test -n "$linkname" || linkname="$realname"~func_stripname "" ".so" "$linkname"~$install_shared_prog "$dir/$func_stripname_result.$libext" "$destdir/$func_stripname_result.$libext"~test -z "$tstripme" || test -z "$striplib" || $striplib "$destdir/$func_stripname_result.$libext"' postuninstall_cmds='for n in $library_names $old_library; do :; done~func_stripname "" ".so" "$n"~test "$func_stripname_result" = "$n" || func_append rmfiles " $odir/$func_stripname_result.$libext"' # We do not specify a path in Import Files, so LIBPATH fires. shlibpath_overrides_runpath=yes ;; *,no) # both, prefer aix dynamic_linker="AIX lib.a[(]lib.so.V[)], lib.so.V[(]$shared_archive_member_spec.o[)]" library_names_spec='$libname$release.a $libname.a' soname_spec='$libname$release$shared_ext$major' # unpreferred sharedlib libNAME.so.V and symlink libNAME.so need extra handling postinstall_cmds='test -z "$dlname" || $install_shared_prog $dir/$dlname $destdir/$dlname~test -z "$tstripme" || test -z "$striplib" || $striplib $destdir/$dlname~test -n "$linkname" || linkname=$realname~func_stripname "" ".a" "$linkname"~(cd "$destdir" && $LN_S -f $dlname $func_stripname_result.so)' postuninstall_cmds='test -z "$dlname" || func_append rmfiles " $odir/$dlname"~for n in $old_library $library_names; do :; done~func_stripname "" ".a" "$n"~func_append rmfiles " $odir/$func_stripname_result.so"' ;; esac shlibpath_var=LIBPATH fi ;; amigaos*) case $host_cpu in powerpc) # Since July 2007 AmigaOS4 officially supports .so libraries. # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' ;; m68k) library_names_spec='$libname.ixlibrary $libname.a' # Create ${libname}_ixlibrary.a entries in /sys/libs. finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='$libname$shared_ext' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # correct to gnu/linux during the next big refactor need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" # the default ld.so.conf also contains /usr/contrib/lib and # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow # libtool to hard-code these into programs ;; cygwin* | mingw* | pw32* | cegcc*) version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no case $GCC,$cc_basename in yes,*) # gcc library_names_spec='$libname.dll.a' # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes case $host_os in cygwin*) # Cygwin DLLs use 'cyg' prefix rather than 'lib' soname_spec='`echo $libname | sed -e 's/^lib/cyg/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) ;; mingw* | cegcc*) # MinGW DLLs use traditional 'lib' prefix soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; pw32*) # pw32 DLLs use 'pw' prefix rather than 'lib' library_names_spec='`echo $libname | sed -e 's/^lib/pw/'``echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' ;; esac dynamic_linker='Win32 ld.exe' ;; *,cl*) # Native MSVC libname_spec='$name' soname_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext' library_names_spec='$libname.dll.lib' case $build_os in mingw*) sys_lib_search_path_spec= lt_save_ifs=$IFS IFS=';' for lt_path in $LIB do IFS=$lt_save_ifs # Let DOS variable expansion print the short 8.3 style file name. lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" done IFS=$lt_save_ifs # Convert to MSYS style. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` ;; cygwin*) # Convert to unix form, then to dos form, then back to unix form # but this time dos style (no spaces!) so that the unix form looks # like /cygdrive/c/PROGRA~1:/cygdr... sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` ;; *) sys_lib_search_path_spec=$LIB if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then # It is most probably a Windows format PATH. sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` else sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` fi # FIXME: find the short name or the path components, as spaces are # common. (e.g. "Program Files" -> "PROGRA~1") ;; esac # DLL is installed to $(libdir)/../bin by postinstall_cmds postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; echo \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' shlibpath_overrides_runpath=yes dynamic_linker='Win32 link.exe' ;; *) # Assume MSVC wrapper library_names_spec='$libname`echo $release | $SED -e 's/[[.]]/-/g'`$versuffix$shared_ext $libname.lib' dynamic_linker='Win32 ld.exe' ;; esac # FIXME: first we should search . and the directory the executable is in shlibpath_var=PATH ;; darwin* | rhapsody*) dynamic_linker="$host_os dyld" version_type=darwin need_lib_prefix=no need_version=no library_names_spec='$libname$release$major$shared_ext $libname$shared_ext' soname_spec='$libname$release$major$shared_ext' shlibpath_overrides_runpath=yes shlibpath_var=DYLD_LIBRARY_PATH shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' m4_if([$1], [],[ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' ;; dgux*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; freebsd* | dragonfly*) # DragonFly does not have aout. When/if they implement a new # versioning mechanism, adjust this. if test -x /usr/bin/objformat; then objformat=`/usr/bin/objformat` else case $host_os in freebsd[[23]].*) objformat=aout ;; *) objformat=elf ;; esac fi version_type=freebsd-$objformat case $version_type in freebsd-elf*) library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; haiku*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no dynamic_linker="$host_os runtime_loader" library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LIBRARY_PATH shlibpath_overrides_runpath=no sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' hardcode_into_libs=yes ;; hpux9* | hpux10* | hpux11*) # Give a soname corresponding to the major version so that dld.sl refuses to # link against other versions. version_type=sunos need_lib_prefix=no need_version=no case $host_cpu in ia64*) shrext_cmds='.so' hardcode_into_libs=yes dynamic_linker="$host_os dld.so" shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' if test 32 = "$HPUX_IA64_MODE"; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" sys_lib_dlsearch_path_spec=/usr/lib/hpux32 else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" sys_lib_dlsearch_path_spec=/usr/lib/hpux64 fi ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # or fails outright, so override atomically: install_override_mode=555 ;; interix[[3-9]]*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; irix5* | irix6* | nonstopux*) case $host_os in nonstopux*) version_type=nonstopux ;; *) if test yes = "$lt_cv_prog_gnu_ld"; then version_type=linux # correct to gnu/linux during the next big refactor else version_type=irix fi ;; esac need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$release$shared_ext $libname$shared_ext' case $host_os in irix5* | nonstopux*) libsuff= shlibsuff= ;; *) case $LD in # libtool.m4 will add one of these switches to LD *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= libmagic=32-bit;; *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 libmagic=N32;; *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 libmagic=64-bit;; *) libsuff= shlibsuff= libmagic=never-match;; esac ;; esac shlibpath_var=LD_LIBRARY${shlibsuff}_PATH shlibpath_overrides_runpath=no sys_lib_search_path_spec="/usr/lib$libsuff /lib$libsuff /usr/local/lib$libsuff" sys_lib_dlsearch_path_spec="/usr/lib$libsuff /lib$libsuff" hardcode_into_libs=yes ;; # No shared lib support for Linux oldld, aout, or coff. linux*oldld* | linux*aout* | linux*coff*) dynamic_linker=no ;; linux*android*) version_type=none # Android doesn't support versioned libraries. need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext' soname_spec='$libname$release$shared_ext' finish_cmds= shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes dynamic_linker='Android linker' # Don't embed -rpath directories since the linker doesn't support them. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no # Some binutils ld are patched to set DT_RUNPATH AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], [lt_cv_shlibpath_overrides_runpath=no save_LDFLAGS=$LDFLAGS save_libdir=$libdir eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], [lt_cv_shlibpath_overrides_runpath=yes])]) LDFLAGS=$save_LDFLAGS libdir=$save_libdir ]) shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath # This implies no fast_install, which is unacceptable. # Some rework will be needed to allow for fast_install # before this can be enabled. hardcode_into_libs=yes # Ideally, we could use ldconfig to report *all* directores which are # searched for libraries, however this is still not possible. Aside from not # being certain /sbin/ldconfig is available, command # 'ldconfig -N -X -v | grep ^/' on 64bit Fedora does not report /usr/lib64, # even though it is searched at run-time. Try to do the best guess by # appending ld.so.conf contents (and includes) to the search path. if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" fi # We used to test for /lib/ld.so.1 and disable shared libraries on # powerpc, because MkLinux only supported shared libraries with the # GNU dynamic linker. Since this was broken with cross compilers, # most powerpc-linux boxes support dynamic linking these days and # people can always --disable-shared, the test was removed, and we # assume the GNU/Linux dynamic linker is in use. dynamic_linker='GNU/Linux ld.so' ;; netbsd*) version_type=sunos need_lib_prefix=no need_version=no if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' dynamic_linker='NetBSD (a.out) ld.so' else library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' dynamic_linker='NetBSD ld.elf_so' fi shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; newsos6) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; *nto* | *qnx*) version_type=qnx need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes dynamic_linker='ldqnx.so' ;; openbsd* | bitrig*) version_type=sunos sys_lib_dlsearch_path_spec=/usr/lib need_lib_prefix=no if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then need_version=no else need_version=yes fi library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes ;; os2*) libname_spec='$name' version_type=windows shrext_cmds=.dll need_version=no need_lib_prefix=no # OS/2 can only load a DLL with a base name of 8 characters or less. soname_spec='`test -n "$os2dllname" && libname="$os2dllname"; v=$($ECHO $release$versuffix | tr -d .-); n=$($ECHO $libname | cut -b -$((8 - ${#v})) | tr . _); $ECHO $n$v`$shared_ext' library_names_spec='${libname}_dll.$libext' dynamic_linker='OS/2 ld.exe' shlibpath_var=BEGINLIBPATH sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec postinstall_cmds='base_file=`basename \$file`~ dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\$base_file'\''i; $ECHO \$dlname'\''`~ dldir=$destdir/`dirname \$dlpath`~ test -d \$dldir || mkdir -p \$dldir~ $install_prog $dir/$dlname \$dldir/$dlname~ chmod a+x \$dldir/$dlname~ if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; fi' postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; $ECHO \$dlname'\''`~ dlpath=$dir/\$dldll~ $RM \$dlpath' ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='$libname$release$shared_ext$major' library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes # ldd complains unless libraries are executable postinstall_cmds='chmod +x $lib' ;; sunos4*) version_type=sunos library_names_spec='$libname$release$shared_ext$versuffix $libname$shared_ext$versuffix' finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes if test yes = "$with_gnu_ld"; then need_lib_prefix=no fi need_version=yes ;; sysv4 | sysv4.3*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH case $host_vendor in sni) shlibpath_overrides_runpath=no need_lib_prefix=no runpath_var=LD_RUN_PATH ;; siemens) need_lib_prefix=no ;; motorola) need_lib_prefix=no need_version=no shlibpath_overrides_runpath=no sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' ;; esac ;; sysv4*MP*) if test -d /usr/nec; then version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$shared_ext.$versuffix $libname$shared_ext.$major $libname$shared_ext' soname_spec='$libname$shared_ext.$major' shlibpath_var=LD_LIBRARY_PATH fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) version_type=sco need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test yes = "$with_gnu_ld"; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # correct to gnu/linux during the next big refactor need_lib_prefix=no need_version=no library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; uts4*) version_type=linux # correct to gnu/linux during the next big refactor library_names_spec='$libname$release$shared_ext$versuffix $libname$release$shared_ext$major $libname$shared_ext' soname_spec='$libname$release$shared_ext$major' shlibpath_var=LD_LIBRARY_PATH ;; *) dynamic_linker=no ;; esac AC_MSG_RESULT([$dynamic_linker]) test no = "$dynamic_linker" && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test yes = "$GCC"; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test set = "${lt_cv_sys_lib_search_path_spec+set}"; then sys_lib_search_path_spec=$lt_cv_sys_lib_search_path_spec fi if test set = "${lt_cv_sys_lib_dlsearch_path_spec+set}"; then sys_lib_dlsearch_path_spec=$lt_cv_sys_lib_dlsearch_path_spec fi # remember unaugmented sys_lib_dlsearch_path content for libtool script decls... configure_time_dlsearch_path=$sys_lib_dlsearch_path_spec # ... but it needs LT_SYS_LIBRARY_PATH munging for other configure-time code func_munge_path_list sys_lib_dlsearch_path_spec "$LT_SYS_LIBRARY_PATH" # to be used as default LT_SYS_LIBRARY_PATH value in generated libtool configure_time_lt_sys_library_path=$LT_SYS_LIBRARY_PATH _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [install_override_mode], [1], [Permission mode override for installation of shared libraries]) _LT_DECL([], [postinstall_cmds], [2], [Command to use after installation of a shared archive]) _LT_DECL([], [postuninstall_cmds], [2], [Command to use after uninstallation of a shared archive]) _LT_DECL([], [finish_cmds], [2], [Commands used to finish a libtool library installation in a directory]) _LT_DECL([], [finish_eval], [1], [[As "finish_cmds", except a single script fragment to be evaled but not shown]]) _LT_DECL([], [hardcode_into_libs], [0], [Whether we should hardcode library paths into libraries]) _LT_DECL([], [sys_lib_search_path_spec], [2], [Compile-time system search path for libraries]) _LT_DECL([sys_lib_dlsearch_path_spec], [configure_time_dlsearch_path], [2], [Detected run-time system search path for libraries]) _LT_DECL([], [configure_time_lt_sys_library_path], [2], [Explicit LT_SYS_LIBRARY_PATH set during ./configure time]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program that can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD=$MAGIC_CMD # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD=$MAGIC_CMD lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$1"; then lt_cv_path_MAGIC_CMD=$ac_dir/"$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD=$lt_cv_path_MAGIC_CMD if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS=$lt_save_ifs MAGIC_CMD=$lt_save_MAGIC_CMD ;; esac]) MAGIC_CMD=$lt_cv_path_MAGIC_CMD if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program that can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PROG_ECHO_BACKSLASH])dnl AC_ARG_WITH([gnu-ld], [AS_HELP_STRING([--with-gnu-ld], [assume the C compiler uses GNU ld @<:@default=no@:>@])], [test no = "$withval" || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test yes = "$GCC"; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return, which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD=$ac_prog ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test yes = "$with_gnu_ld"; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD=$ac_dir/$ac_prog # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 conftest.i cat conftest.i conftest.i >conftest2.i : ${lt_DD:=$DD} AC_PATH_PROGS_FEATURE_CHECK([lt_DD], [dd], [if "$ac_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && ac_cv_path_lt_DD="$ac_path_lt_DD" ac_path_lt_DD_found=: fi]) rm -f conftest.i conftest2.i conftest.out]) ])# _LT_PATH_DD # _LT_CMD_TRUNCATE # ---------------- # find command to truncate a binary pipe m4_defun([_LT_CMD_TRUNCATE], [m4_require([_LT_PATH_DD]) AC_CACHE_CHECK([how to truncate binary pipes], [lt_cv_truncate_bin], [printf 0123456789abcdef0123456789abcdef >conftest.i cat conftest.i conftest.i >conftest2.i lt_cv_truncate_bin= if "$ac_cv_path_lt_DD" bs=32 count=1 conftest.out 2>/dev/null; then cmp -s conftest.i conftest.out \ && lt_cv_truncate_bin="$ac_cv_path_lt_DD bs=4096 count=1" fi rm -f conftest.i conftest2.i conftest.out test -z "$lt_cv_truncate_bin" && lt_cv_truncate_bin="$SED -e 4q"]) _LT_DECL([lt_truncate_bin], [lt_cv_truncate_bin], [1], [Command to truncate a binary pipe]) ])# _LT_CMD_TRUNCATE # _LT_CHECK_MAGIC_METHOD # ---------------------- # how to check for library dependencies # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_MAGIC_METHOD], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) AC_CACHE_CHECK([how to recognize dependent libraries], lt_cv_deplibs_check_method, [lt_cv_file_magic_cmd='$MAGIC_CMD' lt_cv_file_magic_test_file= lt_cv_deplibs_check_method='unknown' # Need to set the preceding variable on all platforms that support # interlibrary dependencies. # 'none' -- dependencies not supported. # 'unknown' -- same as none, but documents that we really don't know. # 'pass_all' -- all dependencies passed with no checks. # 'test_compile' -- check by making test program. # 'file_magic [[regex]]' -- check by looking for files in library path # that responds to the $file_magic_cmd with a given extended regex. # If you have 'file' or equivalent on your system and you're not sure # whether 'pass_all' will *always* work, you probably want this one. case $host_os in aix[[4-9]]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[[45]]*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. if ( file / ) >/dev/null 2>&1; then lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' else # Keep this pattern in sync with the one in func_win32_libid. lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' lt_cv_file_magic_cmd='$OBJDUMP -f' fi ;; cegcc*) # use the weaker test based on 'objdump'. See mingw*. lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' lt_cv_file_magic_cmd='$OBJDUMP -f' ;; darwin* | rhapsody*) lt_cv_deplibs_check_method=pass_all ;; freebsd* | dragonfly*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then case $host_cpu in i*86 ) # Not sure whether the presence of OpenBSD here was a mistake. # Let's accept both of them until this is cleared up. lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` ;; esac else lt_cv_deplibs_check_method=pass_all fi ;; haiku*) lt_cv_deplibs_check_method=pass_all ;; hpux10.20* | hpux11*) lt_cv_file_magic_cmd=/usr/bin/file case $host_cpu in ia64*) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so ;; hppa*64*) [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl ;; *) lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' lt_cv_file_magic_test_file=/usr/lib/libc.sl ;; esac ;; interix[[3-9]]*) # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' ;; irix5* | irix6* | nonstopux*) case $LD in *-32|*"-32 ") libmagic=32-bit;; *-n32|*"-n32 ") libmagic=N32;; *-64|*"-64 ") libmagic=64-bit;; *) libmagic=never-match;; esac lt_cv_deplibs_check_method=pass_all ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) lt_cv_deplibs_check_method=pass_all ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' fi ;; newos6*) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' lt_cv_file_magic_cmd=/usr/bin/file lt_cv_file_magic_test_file=/usr/lib/libnls.so ;; *nto* | *qnx*) lt_cv_deplibs_check_method=pass_all ;; openbsd* | bitrig*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; os2*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_glob= want_nocaseglob=no if test "$build" = "$host"; then case $host_os in mingw* | pw32*) if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then want_nocaseglob=yes else file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` fi ;; esac fi file_magic_cmd=$lt_cv_file_magic_cmd deplibs_check_method=$lt_cv_deplibs_check_method test -z "$deplibs_check_method" && deplibs_check_method=unknown _LT_DECL([], [deplibs_check_method], [1], [Method to check whether dependent libraries are shared objects]) _LT_DECL([], [file_magic_cmd], [1], [Command to use when deplibs_check_method = "file_magic"]) _LT_DECL([], [file_magic_glob], [1], [How to find potential files when deplibs_check_method = "file_magic"]) _LT_DECL([], [want_nocaseglob], [1], [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) ])# _LT_CHECK_MAGIC_METHOD # LT_PATH_NM # ---------- # find the pathname to a BSD- or MS-compatible name lister AC_DEFUN([LT_PATH_NM], [AC_REQUIRE([AC_PROG_CC])dnl AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, [if test -n "$NM"; then # Let the user override the test. lt_cv_path_NM=$NM else lt_nm_to_check=${ac_tool_prefix}nm if test -n "$ac_tool_prefix" && test "$build" = "$host"; then lt_nm_to_check="$lt_nm_to_check nm" fi for lt_tmp_nm in $lt_nm_to_check; do lt_save_ifs=$IFS; IFS=$PATH_SEPARATOR for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do IFS=$lt_save_ifs test -z "$ac_dir" && ac_dir=. tmp_nm=$ac_dir/$lt_tmp_nm if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext"; then # Check to see if the nm accepts a BSD-compat flag. # Adding the 'sed 1q' prevents false positives on HP-UX, which says: # nm: unknown option "B" ignored # Tru64's nm complains that /dev/null is an invalid object file # MSYS converts /dev/null to NUL, MinGW nm treats NUL as empty case $build_os in mingw*) lt_bad_file=conftest.nm/nofile ;; *) lt_bad_file=/dev/null ;; esac case `"$tmp_nm" -B $lt_bad_file 2>&1 | sed '1q'` in *$lt_bad_file* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break 2 ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break 2 ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS=$lt_save_ifs done : ${lt_cv_path_NM=no} fi]) if test no != "$lt_cv_path_NM"; then NM=$lt_cv_path_NM else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols -headers /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols -headers" ;; *) DUMPBIN=: ;; esac fi AC_SUBST([DUMPBIN]) if test : != "$DUMPBIN"; then NM=$DUMPBIN fi fi test -z "$NM" && NM=nm AC_SUBST([NM]) _LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], [lt_cv_nm_interface="BSD nm" echo "int some_variable = 0;" > conftest.$ac_ext (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) (eval "$ac_compile" 2>conftest.err) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) cat conftest.err >&AS_MESSAGE_LOG_FD (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) cat conftest.out >&AS_MESSAGE_LOG_FD if $GREP 'External.*some_variable' conftest.out > /dev/null; then lt_cv_nm_interface="MS dumpbin" fi rm -f conftest*]) ])# LT_PATH_NM # Old names: AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_PROG_NM], []) dnl AC_DEFUN([AC_PROG_NM], []) # _LT_CHECK_SHAREDLIB_FROM_LINKLIB # -------------------------------- # how to determine the name of the shared library # associated with a specific link library. # -- PORTME fill in with the dynamic library characteristics m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], [m4_require([_LT_DECL_EGREP]) m4_require([_LT_DECL_OBJDUMP]) m4_require([_LT_DECL_DLLTOOL]) AC_CACHE_CHECK([how to associate runtime and link libraries], lt_cv_sharedlib_from_linklib_cmd, [lt_cv_sharedlib_from_linklib_cmd='unknown' case $host_os in cygwin* | mingw* | pw32* | cegcc*) # two different shell functions defined in ltmain.sh; # decide which one to use based on capabilities of $DLLTOOL case `$DLLTOOL --help 2>&1` in *--identify-strict*) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib ;; *) lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback ;; esac ;; *) # fallback: assume linklib IS sharedlib lt_cv_sharedlib_from_linklib_cmd=$ECHO ;; esac ]) sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO _LT_DECL([], [sharedlib_from_linklib_cmd], [1], [Command to associate shared and link libraries]) ])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB # _LT_PATH_MANIFEST_TOOL # ---------------------- # locate the manifest tool m4_defun([_LT_PATH_MANIFEST_TOOL], [AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], [lt_cv_path_mainfest_tool=no echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out cat conftest.err >&AS_MESSAGE_LOG_FD if $GREP 'Manifest Tool' conftest.out > /dev/null; then lt_cv_path_mainfest_tool=yes fi rm -f conftest*]) if test yes != "$lt_cv_path_mainfest_tool"; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # _LT_DLL_DEF_P([FILE]) # --------------------- # True iff FILE is a Windows DLL '.def' file. # Keep in sync with func_dll_def_p in the libtool script AC_DEFUN([_LT_DLL_DEF_P], [dnl test DEF = "`$SED -n dnl -e '\''s/^[[ ]]*//'\'' dnl Strip leading whitespace -e '\''/^\(;.*\)*$/d'\'' dnl Delete empty lines and comments -e '\''s/^\(EXPORTS\|LIBRARY\)\([[ ]].*\)*$/DEF/p'\'' dnl -e q dnl Only consider the first "real" line $1`" dnl ])# _LT_DLL_DEF_P # LT_LIB_M # -------- # check for math library AC_DEFUN([LT_LIB_M], [AC_REQUIRE([AC_CANONICAL_HOST])dnl LIBM= case $host in *-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) # These system don't have libm, or don't need it ;; *-ncr-sysv4.3*) AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM=-lmw) AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") ;; *) AC_CHECK_LIB(m, cos, LIBM=-lm) ;; esac AC_SUBST([LIBM]) ])# LT_LIB_M # Old name: AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_CHECK_LIBM], []) # _LT_COMPILER_NO_RTTI([TAGNAME]) # ------------------------------- m4_defun([_LT_COMPILER_NO_RTTI], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= if test yes = "$GCC"; then case $cc_basename in nvcc*) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; *) _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; esac _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], lt_cv_prog_compiler_rtti_exceptions, [-fno-rtti -fno-exceptions], [], [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) fi _LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], [Compiler flag to turn off builtin functions]) ])# _LT_COMPILER_NO_RTTI # _LT_CMD_GLOBAL_SYMBOLS # ---------------------- m4_defun([_LT_CMD_GLOBAL_SYMBOLS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([LT_PATH_NM])dnl AC_REQUIRE([LT_PATH_LD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_TAG_COMPILER])dnl # Check for command to grab the raw symbol name followed by C symbol from nm. AC_MSG_CHECKING([command to parse $NM output from $compiler object]) AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], [ # These are sane defaults that work on at least a few old systems. # [They come from Ultrix. What could be older than Ultrix?!! ;)] # Character class describing NM global symbol codes. symcode='[[BCDEGRST]]' # Regexp to match symbols that can be accessed directly from C. sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' # Define system-specific variables. case $host_os in aix*) symcode='[[BCDT]]' ;; cygwin* | mingw* | pw32* | cegcc*) symcode='[[ABCDGISTW]]' ;; hpux*) if test ia64 = "$host_cpu"; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Gets list of data symbols to import. lt_cv_sys_global_symbol_to_import="sed -n -e 's/^I .* \(.*\)$/\1/p'" # Adjust the below global symbol transforms to fixup imported variables. lt_cdecl_hook=" -e 's/^I .* \(.*\)$/extern __declspec(dllimport) char \1;/p'" lt_c_name_hook=" -e 's/^I .* \(.*\)$/ {\"\1\", (void *) 0},/p'" lt_c_name_lib_hook="\ -e 's/^I .* \(lib.*\)$/ {\"\1\", (void *) 0},/p'\ -e 's/^I .* \(.*\)$/ {\"lib\1\", (void *) 0},/p'" else # Disable hooks by default. lt_cv_sys_global_symbol_to_import= lt_cdecl_hook= lt_c_name_hook= lt_c_name_lib_hook= fi # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n"\ $lt_cdecl_hook\ " -e 's/^T .* \(.*\)$/extern int \1();/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n"\ $lt_c_name_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/p'" # Transform an extracted symbol line into symbol name with lib prefix and # symbol address. lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n"\ $lt_c_name_lib_hook\ " -e 's/^: \(.*\) .*$/ {\"\1\", (void *) 0},/p'"\ " -e 's/^$symcode$symcode* .* \(lib.*\)$/ {\"\1\", (void *) \&\1},/p'"\ " -e 's/^$symcode$symcode* .* \(.*\)$/ {\"lib\1\", (void *) \&\1},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function, # D for any global variable and I for any imported variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " /^ *Symbol name *: /{split(\$ 0,sn,\":\"); si=substr(sn[2],2)};"\ " /^ *Type *: code/{print \"T\",si,substr(si,length(prfx))};"\ " /^ *Type *: data/{print \"I\",si,substr(si,length(prfx))};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=\"D\"}; \$ 0~/\(\).*\|/{f=\"T\"};"\ " {split(\$ 0,a,/\||\r/); split(a[2],s)};"\ " s[1]~/^[@?]/{print f,s[1],s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print f,t[1],substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" # Check to see that the pipe works correctly. pipe_works=no rm -f conftest* cat > conftest.$ac_ext <<_LT_EOF #ifdef __cplusplus extern "C" { #endif char nm_test_var; void nm_test_func(void); void nm_test_func(void){} #ifdef __cplusplus } #endif int main(){nm_test_var='a';nm_test_func();return(0);} _LT_EOF if AC_TRY_EVAL(ac_compile); then # Now try to grab the symbols. nlist=conftest.nm if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then # Try sorting and uniquifying the output. if sort "$nlist" | uniq > "$nlist"T; then mv -f "$nlist"T "$nlist" else rm -f "$nlist"T fi # Make sure that we snagged all the symbols we need. if $GREP ' nm_test_var$' "$nlist" >/dev/null; then if $GREP ' nm_test_func$' "$nlist" >/dev/null; then cat <<_LT_EOF > conftest.$ac_ext /* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ #if defined _WIN32 || defined __CYGWIN__ || defined _WIN32_WCE /* DATA imports from DLLs on WIN32 can't be const, because runtime relocations are performed -- see ld's documentation on pseudo-relocs. */ # define LT@&t@_DLSYM_CONST #elif defined __osf__ /* This system does not cope well with relocations in const data. */ # define LT@&t@_DLSYM_CONST #else # define LT@&t@_DLSYM_CONST const #endif #ifdef __cplusplus extern "C" { #endif _LT_EOF # Now generate the symbol file. eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' cat <<_LT_EOF >> conftest.$ac_ext /* The mapping between symbol names and symbols. */ LT@&t@_DLSYM_CONST struct { const char *name; void *address; } lt__PROGRAM__LTX_preloaded_symbols[[]] = { { "@PROGRAM@", (void *) 0 }, _LT_EOF $SED "s/^$symcode$symcode* .* \(.*\)$/ {\"\1\", (void *) \&\1},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_globsym_save_LIBS=$LIBS lt_globsym_save_CFLAGS=$CFLAGS LIBS=conftstm.$ac_objext CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" if AC_TRY_EVAL(ac_link) && test -s conftest$ac_exeext; then pipe_works=yes fi LIBS=$lt_globsym_save_LIBS CFLAGS=$lt_globsym_save_CFLAGS else echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD fi else echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD fi else echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD cat conftest.$ac_ext >&5 fi rm -rf conftest* conftst* # Do not use the global_symbol_pipe unless it works. if test yes = "$pipe_works"; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # Response file support. if test "$lt_cv_nm_interface" = "MS dumpbin"; then nm_file_list_spec='@' elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then nm_file_list_spec='@' fi _LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], [Take the output of nm and produce a listing of raw symbols and C names]) _LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], [Transform the output of nm in a proper C declaration]) _LT_DECL([global_symbol_to_import], [lt_cv_sys_global_symbol_to_import], [1], [Transform the output of nm into a list of symbols to manually relocate]) _LT_DECL([global_symbol_to_c_name_address], [lt_cv_sys_global_symbol_to_c_name_address], [1], [Transform the output of nm in a C name address pair]) _LT_DECL([global_symbol_to_c_name_address_lib_prefix], [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], [Transform the output of nm in a C name address pair when lib prefix is needed]) _LT_DECL([nm_interface], [lt_cv_nm_interface], [1], [The name lister interface]) _LT_DECL([], [nm_file_list_spec], [1], [Specify filename containing input files for $NM]) ]) # _LT_CMD_GLOBAL_SYMBOLS # _LT_COMPILER_PIC([TAGNAME]) # --------------------------- m4_defun([_LT_COMPILER_PIC], [m4_require([_LT_TAG_COMPILER])dnl _LT_TAGVAR(lt_prog_compiler_wl, $1)= _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)= m4_if([$1], [CXX], [ # C++ specific cases for pic, static, wl, etc. if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac else case $host_os in aix[[4-9]]*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; dgux*) case $cc_basename in ec++*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; ghcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; freebsd* | dragonfly*) # FreeBSD uses GNU C++ ;; hpux9* | hpux10* | hpux11*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' if test ia64 != "$host_cpu"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64, which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL 8.0, 9.0 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; esac ;; esac ;; lynxos*) ;; m88k*) ;; mvs*) case $cc_basename in cxx*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' ;; *) ;; esac ;; netbsd*) ;; *qnx* | *nto*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' ;; RCC*) # Rational C++ 2.4.1 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; cxx*) # Digital/Compaq C++ _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; *) ;; esac ;; psos*) ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' ;; *) ;; esac ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; lcc*) # Lucid _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' ;; *) ;; esac ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' ;; *) ;; esac ;; vxworks*) ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ], [ if test yes = "$GCC"; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the '-m68020' flag to GCC prevents building anything better, # like '-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; haiku*) # PIC is the default for Haiku. # The "-static" flag exists, but is broken. _LT_TAGVAR(lt_prog_compiler_static, $1)= ;; hpux*) # PIC is the default for 64-bit PA HP-UX, but not for 32-bit # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag # sets the default TLS model and affects inlining. case $host_cpu in hppa*64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac ;; interix[[3-9]]*) # Interix 3.x gcc -fpic/-fPIC options generate broken code. # Instead, we relocate shared libraries at runtime. ;; msdosdjgpp*) # Just because we use GCC doesn't mean we suddenly get shared libraries # on systems that don't support them. _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no enable_shared=no ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic fi ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; esac case $cc_basename in nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)" fi ;; esac else # PORTME Check for flag to pass linker flags through the system compiler. case $host_os in aix*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' if test ia64 = "$host_cpu"; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' case $cc_basename in nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) case $host_os in os2*) _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-static' ;; esac ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='$wl-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in # old Intel for x86_64, which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; nagfor*) # NAG Fortran compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group compilers (*not* the Pentium gcc compiler, # which looks to be a dead project) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; ccc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All Alpha code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xl* | bgxl* | bgf* | mpixl*) # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ Ceres\ Fortran* | *Sun*Fortran*\ [[1-7]].* | *Sun*Fortran*\ 8.[[0-3]]*) # Sun Fortran 8.3 passes all unrecognized flags to the linker _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='' ;; *Sun\ F* | *Sun*Fortran*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' ;; *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' ;; *Intel*\ [[CF]]*Compiler*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; *Portland\ Group*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; esac ;; esac ;; newsos6) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *nto* | *qnx*) # QNX uses GNU C++, but need to define -shared option too, otherwise # it will coredump. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' ;; osf3* | osf4* | osf5*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # All OSF/1 code is PIC. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; rdos*) _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; solaris*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' case $cc_basename in f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; *) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; esac ;; sunos4*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4 | sysv4.2uw2* | sysv4.3*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; unicos*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; uts4*) _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; *) _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no ;; esac fi ]) case $host_os in # For platforms that do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_CACHE_CHECK([for $compiler option to produce PIC], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) _LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) # # Check to make sure the PIC flag actually works. # if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in "" | " "*) ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; esac], [_LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) fi _LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], [Additional compiler flags for building library objects]) _LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], [How to pass a linker flag through the compiler]) # # Check to make sure the static flag actually works. # wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" _LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), $lt_tmp_static_flag, [], [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) _LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], [Compiler flag to prevent dynamic linking]) ])# _LT_COMPILER_PIC # _LT_LINKER_SHLIBS([TAGNAME]) # ---------------------------- # See if the linker supports building shared libraries. m4_defun([_LT_LINKER_SHLIBS], [AC_REQUIRE([LT_PATH_LD])dnl AC_REQUIRE([LT_PATH_NM])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) m4_if([$1], [CXX], [ _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] case $host_os in aix[[4-9]]*) # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)=$ltdll_cmds ;; cygwin* | mingw* | cegcc*) case $cc_basename in cl*) _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] ;; esac ;; *) _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' ;; esac ], [ runpath_var= _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_cmds, $1)= _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(old_archive_from_new_cmds, $1)= _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= _LT_TAGVAR(thread_safe_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= # include_expsyms should be a list of space-separated symbols to be *always* # included in the symbol list _LT_TAGVAR(include_expsyms, $1)= # exclude_expsyms can be an extended regexp of symbols to exclude # it will be wrapped by ' (' and ')$', so one must not match beginning or # end of line. Example: 'a|bc|.*d.*' will exclude the symbols 'a' and 'bc', # as well as any symbol that contains 'd'. _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out # platforms (ab)use it in PIC code, but their linkers get confused if # the symbol is explicitly referenced. Since portable code cannot # rely on this symbol name, it's probably fine to never include it in # preloaded symbol tables. # Exclude shared library initialization/finalization symbols. dnl Note also adjust exclude_expsyms for C++ above. extract_expsyms_cmds= case $host_os in cygwin* | mingw* | pw32* | cegcc*) # FIXME: the MSVC++ port hasn't been tested in a loooong time # When not using gcc, we currently assume that we are using # Microsoft Visual C++. if test yes != "$GCC"; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd* | bitrig*) with_gnu_ld=no ;; esac _LT_TAGVAR(ld_shlibs, $1)=yes # On some targets, GNU ld is compatible enough with the native linker # that we're better off using the native interface for both. lt_use_gnu_ld_interface=no if test yes = "$with_gnu_ld"; then case $host_os in aix*) # The AIX port of GNU ld has always aspired to compatibility # with the native linker. However, as the warning in the GNU ld # block says, versions before 2.19.5* couldn't really create working # shared libraries, regardless of the interface used. case `$LD -v 2>&1` in *\ \(GNU\ Binutils\)\ 2.19.5*) ;; *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; *) lt_use_gnu_ld_interface=yes ;; esac ;; *) lt_use_gnu_ld_interface=yes ;; esac fi if test yes = "$lt_use_gnu_ld_interface"; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='$wl' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v | $SED -e 's/([^)]\+)\s\+//' 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test ia64 != "$host_cpu"; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.19, is reported *** to be unable to reliably create shared libraries on AIX. *** Therefore, libtool is disabling shared libraries support. If you *** really care for shared libraries, you may want to install binutils *** 2.20 or above, or modify your PATH so that a non-GNU linker is found. *** You will then need to restart the configuration process. _LT_EOF fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; cygwin* | mingw* | pw32* | cegcc*) # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test linux-dietlibc = "$host_os"; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test no = "$tmp_diet" then tmp_addflag=' $pic_flag' tmp_sharedflag='-shared' case $cc_basename,$host_cpu in pgcc*) # Portland Group C compiler _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag' ;; pgf77* | pgf90* | pgf95* | pgfortran*) # Portland Group f77 and f90 compilers _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' tmp_addflag=' $pic_flag -Mnomain' ;; ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 tmp_addflag=' -i_dynamic' ;; efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 tmp_addflag=' -i_dynamic -nofor_main' ;; ifc* | ifort*) # Intel Fortran compiler tmp_addflag=' -nofor_main' ;; lf95*) # Lahey Fortran 8.1 _LT_TAGVAR(whole_archive_flag_spec, $1)= tmp_sharedflag='--shared' ;; nagfor*) # NAGFOR 5.3 tmp_sharedflag='-Wl,-shared' ;; xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) tmp_sharedflag='-qmkshrobj' tmp_addflag= ;; nvcc*) # Cuda Compiler Driver 2.2 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes ;; esac case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C 5.9 _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes tmp_sharedflag='-G' ;; *Sun\ F*) # Sun Fortran 8.3 tmp_sharedflag='-G' ;; esac _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi case $cc_basename in tcc*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='-rdynamic' ;; xlf* | bgf* | bgxlf* | mpixlf*) # IBM XL Fortran 10.1 on PPC cannot create shared libs itself _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' fi ;; esac else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' wlarc= else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' fi ;; solaris*) if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: The releases 2.8.* of the GNU linker cannot reliably *** create shared libraries on Solaris systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.9.1 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) case `$LD -v 2>&1` in *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: Releases of the GNU linker prior to 2.16.91.0.3 cannot *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac if test no = "$_LT_TAGVAR(ld_shlibs, $1)"; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test yes = "$GCC" && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to GNU nm, but means don't demangle to AIX nm. # Without the "-l" option, or with the "-B" option, AIX nm treats # weak defined symbols like other global defined symbols, whereas # GNU nm marks them as "W". # While the 'weak' keyword is ignored in the Export File, we need # it in the Import File for the 'aix-soname' feature, so we have # to replace the "-B" option with "-P" for AIX nm. if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { if (\$ 2 == "W") { print \$ 3 " weak" } else { print \$ 3 } } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='`func_echo_all $NM | $SED -e '\''s/B\([[^B]]*\)$/P\1/'\''` -PCpgl $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) && ([substr](\$ 1,1,1) != ".")) { if ((\$ 2 == "W") || (\$ 2 == "V") || (\$ 2 == "Z")) { print \$ 1 " weak" } else { print \$ 1 } } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test x-brtl = "x$ld_flag" || test x-Wl,-brtl = "x$ld_flag"); then aix_use_runtimelinking=yes break fi done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # traditional, no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GCC"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag="$shared_flag "'$wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. case $cc_basename in cl*) # Native MSVC _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*' _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # Assume MSVC wrapper _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' # The linker will automatically build a .lib file if we build a DLL. _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' # FIXME: Should let the user specify the lib program. _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor # support. Future versions do this automatically, but an explicit c++rt0.o # does not break anything, and helps significantly (at the cost of a little # extra space). freebsd2.2*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # Unfortunately, older versions of FreeBSD 2 do not have this feature. freebsd2.*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; # FreeBSD 3 and greater uses gcc -shared to do shared libraries. freebsd* | dragonfly*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; hpux9*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; hpux10*) if test yes,no = "$GCC,$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes fi ;; hpux11*) if test yes,no = "$GCC,$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags' ;; esac else case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' ;; *) m4_if($1, [], [ # Older versions of the 11.00 compiler do not understand -b yet # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) _LT_LINKER_OPTION([if $CC understands -b], _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], [_LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) ;; esac fi if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' # Try to use the -exported_symbol ld option, if it does not # work, assume that -exports_file does not work either and # implicitly export all symbols. # This should be the same for all languages, so no per-tag cache variable. AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], [lt_cv_irix_exported_symbol], [save_LDFLAGS=$LDFLAGS LDFLAGS="$LDFLAGS -shared $wl-exported_symbol ${wl}foo $wl-update_registry $wl/dev/null" AC_LINK_IFELSE( [AC_LANG_SOURCE( [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], [C++], [[int foo (void) { return 0; }]], [Fortran 77], [[ subroutine foo end]], [Fortran], [[ subroutine foo end]])])], [lt_cv_irix_exported_symbol=yes], [lt_cv_irix_exported_symbol=no]) LDFLAGS=$save_LDFLAGS]) if test yes = "$lt_cv_irix_exported_symbol"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations $wl-exports_file $wl$export_symbols -o $lib' fi else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -exports_file $export_symbols -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes _LT_TAGVAR(link_all_deplibs, $1)=yes ;; linux*) case $cc_basename in tcc*) # Fabrice Bellard et al's Tiny C Compiler _LT_TAGVAR(ld_shlibs, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out else _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; newsos6) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *nto* | *qnx*) ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags $wl-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; osf3*) if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; osf4* | osf5*) # as osf3* with the addition of -msym flag if test yes = "$GCC"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $pic_flag $libobjs $deplibs $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' else _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $wl-input $wl$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~$RM $lib.exp' # Both c and cxx compiler support -rpath directly _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' fi _LT_TAGVAR(archive_cmds_need_lc, $1)='no' _LT_TAGVAR(hardcode_libdir_separator, $1)=: ;; solaris*) _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' if test yes = "$GCC"; then wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $wl-z ${wl}text $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag $wl-z ${wl}text $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' else case `$CC -V 2>&1` in *"Compilers 5.0"*) wlarc='' _LT_TAGVAR(archive_cmds, $1)='$LD -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $LD -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' ;; *) wlarc='$wl' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h $soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' ;; esac fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. GCC discards it without '$wl', # but is careful enough not to reorder. # Supported since Solaris 2.6 (maybe 2.5.1?) if test yes = "$GCC"; then _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test sequent = "$host_vendor"; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' if test yes = "$GCC"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test sni = "$host_vendor"; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test yes,yes = "$GCC,$enable_shared"; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_CACHE_CHECK([whether -lc should be explicitly linked in], [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), [$RM conftest* echo "$lt_simple_compile_test_code" > conftest.$ac_ext if AC_TRY_EVAL(ac_compile) 2>conftest.err; then soname=conftest lib=conftest libobjs=conftest.$ac_objext deplibs= wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) compiler_flags=-v linker_flags=-v verstring= output_objdir=. libname=conftest lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) _LT_TAGVAR(allow_undefined_flag, $1)= if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) then lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no else lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes fi _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag else cat conftest.err 1>&5 fi $RM conftest* ]) _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) ;; esac fi ;; esac _LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], [Whether or not to add -lc for building shared libraries]) _LT_TAGDECL([allow_libtool_libs_with_static_runtimes], [enable_shared_with_static_runtimes], [0], [Whether or not to disallow shared libs when runtime libs are static]) _LT_TAGDECL([], [export_dynamic_flag_spec], [1], [Compiler flag to allow reflexive dlopens]) _LT_TAGDECL([], [whole_archive_flag_spec], [1], [Compiler flag to generate shared objects directly from archives]) _LT_TAGDECL([], [compiler_needs_object], [1], [Whether the compiler copes with passing no objects directly]) _LT_TAGDECL([], [old_archive_from_new_cmds], [2], [Create an old-style archive from a shared archive]) _LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], [Create a temporary old-style archive to link instead of a shared archive]) _LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) _LT_TAGDECL([], [archive_expsym_cmds], [2]) _LT_TAGDECL([], [module_cmds], [2], [Commands used to build a loadable module if different from building a shared archive.]) _LT_TAGDECL([], [module_expsym_cmds], [2]) _LT_TAGDECL([], [with_gnu_ld], [1], [Whether we are building with GNU ld or not]) _LT_TAGDECL([], [allow_undefined_flag], [1], [Flag that allows shared libraries with undefined symbols to be built]) _LT_TAGDECL([], [no_undefined_flag], [1], [Flag that enforces no undefined symbols]) _LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], [Flag to hardcode $libdir into a binary during linking. This must work even if $libdir does not exist]) _LT_TAGDECL([], [hardcode_libdir_separator], [1], [Whether we need a single "-rpath" flag with a separated argument]) _LT_TAGDECL([], [hardcode_direct], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_direct_absolute], [0], [Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes DIR into the resulting binary and the resulting library dependency is "absolute", i.e impossible to change by setting $shlibpath_var if the library is relocated]) _LT_TAGDECL([], [hardcode_minus_L], [0], [Set to "yes" if using the -LDIR flag during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_shlibpath_var], [0], [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into the resulting binary]) _LT_TAGDECL([], [hardcode_automatic], [0], [Set to "yes" if building a shared library automatically hardcodes DIR into the library and all subsequent libraries and executables linked against it]) _LT_TAGDECL([], [inherit_rpath], [0], [Set to yes if linker adds runtime paths of dependent libraries to runtime path list]) _LT_TAGDECL([], [link_all_deplibs], [0], [Whether libtool must link a program against all its dependency libraries]) _LT_TAGDECL([], [always_export_symbols], [0], [Set to "yes" if exported symbols are required]) _LT_TAGDECL([], [export_symbols_cmds], [2], [The commands to list exported symbols]) _LT_TAGDECL([], [exclude_expsyms], [1], [Symbols that should not be listed in the preloaded symbols]) _LT_TAGDECL([], [include_expsyms], [1], [Symbols that must always be exported]) _LT_TAGDECL([], [prelink_cmds], [2], [Commands necessary for linking programs (against libraries) with templates]) _LT_TAGDECL([], [postlink_cmds], [2], [Commands necessary for finishing linking programs]) _LT_TAGDECL([], [file_list_spec], [1], [Specify filename containing input files]) dnl FIXME: Not yet implemented dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], dnl [Compiler flag to generate thread safe objects]) ])# _LT_LINKER_SHLIBS # _LT_LANG_C_CONFIG([TAG]) # ------------------------ # Ensure that the configuration variables for a C compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_C_CONFIG], [m4_require([_LT_DECL_EGREP])dnl lt_save_CC=$CC AC_LANG_PUSH(C) # Source file extension for C test sources. ac_ext=c # Object file extension for compiled C test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(){return(0);}' _LT_TAG_COMPILER # Save the default compiler, since it gets overwritten when the other # tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. compiler_DEFAULT=$CC # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) LT_SYS_DLOPEN_SELF _LT_CMD_STRIPLIB # Report what library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC=$lt_save_CC ])# _LT_LANG_C_CONFIG # _LT_LANG_CXX_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a C++ compiler are suitably # defined. These variables are subsequently used by _LT_CONFIG to write # the compiler configuration to 'libtool'. m4_defun([_LT_LANG_CXX_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_PATH_MANIFEST_TOOL])dnl if test -n "$CXX" && ( test no != "$CXX" && ( (test g++ = "$CXX" && `g++ -v >/dev/null 2>&1` ) || (test g++ != "$CXX"))); then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi AC_LANG_PUSH(C++) _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(compiler_needs_object, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for C++ test sources. ac_ext=cpp # Object file extension for compiled C++ test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the CXX compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_caught_CXX_error"; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_LD=$LD lt_save_GCC=$GCC GCC=$GXX lt_save_with_gnu_ld=$with_gnu_ld lt_save_path_LD=$lt_cv_path_LD if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx else $as_unset lt_cv_prog_gnu_ld fi if test -n "${lt_cv_path_LDCXX+set}"; then lt_cv_path_LD=$lt_cv_path_LDCXX else $as_unset lt_cv_path_LD fi test -z "${LDCXX+set}" || LD=$LDCXX CC=${CXX-"c++"} CFLAGS=$CXXFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then # We don't want -fno-exception when compiling C++ code, so set the # no_builtin_flag separately if test yes = "$GXX"; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test yes = "$GXX"; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test yes = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # If archive_cmds runs LD, not CC, wlarc should be empty # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to # investigate it a little bit more. (MM) wlarc='$wl' # ancient GNU ld didn't support --whole-archive et. al. if eval "`$CC -print-prog-name=ld` --help 2>&1" | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else with_gnu_ld=no wlarc= # A generic and very simple default shared library creation # command for GNU C++ for the case where it uses the native # linker, instead of GNU ld. If possible, this setting should # overridden to take advantage of the native linker features on # the platform it is being used on. _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' fi # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else GXX=no with_gnu_ld=no wlarc= fi # PORTME: fill in a description of your system's C++ link characteristics AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) _LT_TAGVAR(ld_shlibs, $1)=yes case $host_os in aix3*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aix[[4-9]]*) if test ia64 = "$host_cpu"; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag= else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # have runtime linking enabled, and use it for executables. # For shared libraries, we enable/disable runtime linking # depending on the kind of the shared library created - # when "with_aix_soname,aix_use_runtimelinking" is: # "aix,no" lib.a(lib.so.V) shared, rtl:no, for executables # "aix,yes" lib.so shared, rtl:yes, for executables # lib.a static archive # "both,no" lib.so.V(shr.o) shared, rtl:yes # lib.a(lib.so.V) shared, rtl:no, for executables # "both,yes" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a(lib.so.V) shared, rtl:no # "svr4,*" lib.so.V(shr.o) shared, rtl:yes, for executables # lib.a static archive case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done if test svr4,no = "$with_aix_soname,$aix_use_runtimelinking"; then # With aix-soname=svr4, we create the lib.so.V shared archives only, # so we don't have lib.a shared libs to link our executables. # We have to force runtime linking in this case. aix_use_runtimelinking=yes LDFLAGS="$LDFLAGS -Wl,-brtl" fi ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='$wl-f,' case $with_aix_soname,$aix_use_runtimelinking in aix,*) ;; # no import file svr4,* | *,yes) # use import file # The Import File defines what to hardcode. _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no ;; esac if test yes = "$GXX"; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`$CC -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test yes = "$aix_use_runtimelinking"; then shared_flag=$shared_flag' $wl-G' fi # Need to ensure runtime linking is disabled for the traditional # shared library, or the linker may eventually find shared libraries # /with/ Import File - we do not want to mix them. shared_flag_aix='-shared' shared_flag_svr4='-shared $wl-G' else # not using gcc if test ia64 = "$host_cpu"; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test yes = "$aix_use_runtimelinking"; then shared_flag='$wl-G' else shared_flag='$wl-bM:SRE' fi shared_flag_aix='$wl-bM:SRE' shared_flag_svr4='$wl-G' fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test aix,yes = "$with_aix_soname,$aix_use_runtimelinking"; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. # The "-G" linker flag allows undefined symbols. _LT_TAGVAR(no_undefined_flag, $1)='-bernotok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs $wl'$no_entry_flag' $compiler_flags `if test -n "$allow_undefined_flag"; then func_echo_all "$wl$allow_undefined_flag"; else :; fi` $wl'$exp_sym_flag:\$export_symbols' '$shared_flag else if test ia64 = "$host_cpu"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\$wl$no_entry_flag"' $compiler_flags $wl$allow_undefined_flag '"\$wl$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$1]) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-blibpath:$libdir:'"$aix_libpath" # Warning - without using the other run time loading flags, # -berok will link without error, but may produce a broken library. _LT_TAGVAR(no_undefined_flag, $1)=' $wl-bernotok' _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-berok' if test yes = "$with_gnu_ld"; then # We only use this code for GNU lds that support --whole-archive. _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' else # Exported symbols can be pulled into shared objects from archives _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' fi _LT_TAGVAR(archive_cmds_need_lc, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$RM -r $output_objdir/$realname.d~$MKDIR $output_objdir/$realname.d' # -brtl affects multiple linker settings, -berok does not and is overridden later compiler_flags_filtered='`func_echo_all "$compiler_flags " | $SED -e "s%-brtl\\([[, ]]\\)%-berok\\1%g"`' if test svr4 != "$with_aix_soname"; then # This is similar to how AIX traditionally builds its shared # libraries. Need -bnortl late, we may have -brtl in LDFLAGS. _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_aix' -o $output_objdir/$realname.d/$soname $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$realname.d/$soname' fi if test aix != "$with_aix_soname"; then _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$CC '$shared_flag_svr4' -o $output_objdir/$realname.d/$shared_archive_member_spec.o $libobjs $deplibs $wl-bnoentry '$compiler_flags_filtered'$wl-bE:$export_symbols$allow_undefined_flag~$STRIP -e $output_objdir/$realname.d/$shared_archive_member_spec.o~( func_echo_all "#! $soname($shared_archive_member_spec.o)"; if test shr_64 = "$shared_archive_member_spec"; then func_echo_all "# 64"; else func_echo_all "# 32"; fi; cat $export_symbols ) > $output_objdir/$realname.d/$shared_archive_member_spec.imp~$AR $AR_FLAGS $output_objdir/$soname $output_objdir/$realname.d/$shared_archive_member_spec.o $output_objdir/$realname.d/$shared_archive_member_spec.imp' else # used by -dlpreopen to get the symbols _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$MV $output_objdir/$realname.d/$soname $output_objdir' fi _LT_TAGVAR(archive_expsym_cmds, $1)="$_LT_TAGVAR(archive_expsym_cmds, $1)"'~$RM -r $output_objdir/$realname.d' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach says some releases of gcc # support --undefined. This deserves some investigation. FIXME _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; chorus*) case $cc_basename in *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; cygwin* | mingw* | pw32* | cegcc*) case $GXX,$cc_basename in ,cl* | no,cl*) # Native MSVC # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(file_list_spec, $1)='@' # Tell ltmain to make .lib files, not .a files. libext=lib # Tell ltmain to make .dll files, not .so files. shrext_cmds=.dll # FIXME: Setting linknames here is a bad hack. _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp "$export_symbols" "$output_objdir/$soname.def"; echo "$tool_output_objdir$soname.def" > "$output_objdir/$soname.exp"; else $SED -e '\''s/^/-link -EXPORT:/'\'' < $export_symbols > $output_objdir/$soname.exp; fi~ $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ linknames=' # The linker will not automatically build a static lib if we build a DLL. # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes # Don't use ranlib _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ lt_tool_outputfile="@TOOL_OUTPUT@"~ case $lt_outputfile in *.exe|*.EXE) ;; *) lt_outputfile=$lt_outputfile.exe lt_tool_outputfile=$lt_tool_outputfile.exe ;; esac~ func_to_tool_file "$lt_outputfile"~ if test : != "$MANIFEST_TOOL" && test -f "$lt_outputfile.manifest"; then $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; $RM "$lt_outputfile.manifest"; fi' ;; *) # g++ # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, # as there is no search path for DLLs. _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-all-symbols' _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' # If the export-symbols file already is a .def file, use it as # is; otherwise, prepend EXPORTS... _LT_TAGVAR(archive_expsym_cmds, $1)='if _LT_DLL_DEF_P([$export_symbols]); then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname $wl--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported shrext_cmds=.dll _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ emxexp $libobjs | $SED /"_DLL_InitTerm"/d >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(archive_expsym_cmds, $1)='$ECHO "LIBRARY ${soname%$shared_ext} INITINSTANCE TERMINSTANCE" > $output_objdir/$libname.def~ $ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~ $ECHO "DATA MULTIPLE NONSHARED" >> $output_objdir/$libname.def~ $ECHO EXPORTS >> $output_objdir/$libname.def~ prefix_cmds="$SED"~ if test EXPORTS = "`$SED 1q $export_symbols`"; then prefix_cmds="$prefix_cmds -e 1d"; fi~ prefix_cmds="$prefix_cmds -e \"s/^\(.*\)$/_\1/g\""~ cat $export_symbols | $prefix_cmds >> $output_objdir/$libname.def~ $CC -Zdll -Zcrtdll -o $output_objdir/$soname $libobjs $deplibs $compiler_flags $output_objdir/$libname.def~ emximp -o $lib $output_objdir/$libname.def' _LT_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/${libname}_dll.a $output_objdir/$libname.def' _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; freebsd2.*) # C++ shared libraries reported to be fairly broken before # switch to ELF _LT_TAGVAR(ld_shlibs, $1)=no ;; freebsd-elf*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; freebsd* | dragonfly*) # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF # conventions _LT_TAGVAR(ld_shlibs, $1)=yes ;; haiku*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(link_all_deplibs, $1)=yes ;; hpux9*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag $wl+b $wl$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test "x$output_objdir/$soname" = "x$lib" || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test no = "$with_gnu_ld"; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl+b $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC $wl+h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag $wl+h $wl$soname $wl+b $wl$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac fi else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s|^|_|" $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags $wl-h,$soname $wl--retain-symbols-file,$output_objdir/$soname.expsym $wl--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; irix5* | irix6*) case $cc_basename in CC*) # SGI C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' # Archives containing C++ object files must be created using # "CC -ar", where "CC" is the IRIX C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' ;; *) if test yes = "$GXX"; then if test no = "$with_gnu_ld"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' else _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` -o $lib' fi fi _LT_TAGVAR(link_all_deplibs, $1)=yes ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(inherit_rpath, $1)=yes ;; linux* | k*bsd*-gnu | kopensolaris*-gnu | gnu*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib $wl-retain-symbols-file,$export_symbols; mv \$templib $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' # Archives containing C++ object files must be created using # "CC -Bstatic", where "CC" is the KAI C++ compiler. _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; icpc* | ecpc* ) # Intel C++ with_gnu_ld=yes # version 8.0 and above of icpc choke on multiply defined symbols # if we add $predep_objects and $postdep_objects, however 7.1 and # earlier do not add the objects themselves. case `$CC -V 2>&1` in *"Version 7."*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 8.0 or newer tmp_idyn= case $host_cpu in ia64*) tmp_idyn=' -i_dynamic';; esac _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive$convenience $wl--no-whole-archive' ;; pgCC* | pgcpp*) # Portland Group C++ compiler case `$CC -V` in *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ $RANLIB $oldlib' _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ rm -rf $tpldir~ $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; *) # Version 6 and above use weak symbols _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname $wl-retain-symbols-file $wl$export_symbols -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl--rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' ;; cxx*) # Compaq C++ _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname -o $lib $wl-retain-symbols-file $wl$export_symbols' runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' ;; xl* | mpixl* | bgxl*) # IBM XL 8.0 on PPC, with GNU ld _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl--export-dynamic' _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname -o $lib' if test yes = "$supports_anon_versioning"; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags $wl-soname $wl$soname $wl-version-script $wl$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file $wl$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` $wl--no-whole-archive' _LT_TAGVAR(compiler_needs_object, $1)=yes # Not sure whether something based on # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 # would be better. output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; esac ;; esac ;; lynxos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; m88k*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; mvs*) case $cc_basename in cxx*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; netbsd*) if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' wlarc= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no fi # Workaround some broken pre-1.5 toolchains output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' ;; *nto* | *qnx*) _LT_TAGVAR(ld_shlibs, $1)=yes ;; openbsd* | bitrig*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-E' _LT_TAGVAR(whole_archive_flag_spec, $1)=$wlarc'--whole-archive$convenience '$wlarc'--no-whole-archive' fi output_verbose_link_cmd=func_echo_all else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; osf3* | osf4* | osf5*) case $cc_basename in KCC*) # Kuck and Associates, Inc. (KAI) C++ Compiler # KCC will only create a shared library if the output file # ends with ".so" (or ".sl" for HP-UX), so rename the library # to its proper name (with version) after linking. _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\$tempext\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Archives containing C++ object files must be created using # the KAI C++ compiler. case $host in osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; esac ;; RCC*) # Rational C++ 2.4.1 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; cxx*) case $host in osf3*) _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $soname `test -n "$verstring" && func_echo_all "$wl-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' ;; *) _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ echo "-hidden">> $lib.exp~ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname $wl-input $wl$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry $output_objdir/so_locations -o $lib~ $RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' ;; esac _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list= ; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(allow_undefined_flag, $1)=' $wl-expect_unresolved $wl\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-msym $wl-soname $wl$soname `test -n "$verstring" && func_echo_all "$wl-set_version $wl$verstring"` $wl-update_registry $wl$output_objdir/so_locations -o $lib' ;; esac _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-rpath $wl$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; psos*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; sunos4*) case $cc_basename in CC*) # Sun C++ 4.x # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; lcc*) # Lucid # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # Sun C++ 4.2, 5.x and Centerline C++ _LT_TAGVAR(archive_cmds_need_lc,$1)=yes _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G$allow_undefined_flag -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G$allow_undefined_flag $wl-M $wl$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) # The compiler driver will combine and reorder linker options, # but understands '-z linker_flag'. # Supported since Solaris 2.6 (maybe 2.5.1?) _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes output_verbose_link_cmd='func_echo_all' # Archives containing C++ object files must be created using # "CC -xar", where "CC" is the Sun C++ compiler. This is # necessary to make sure instantiated templates are included # in the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' ;; gcx*) # Green Hills C++ Compiler _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' # The C++ compiler must be used to create the archive. _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' ;; *) # GNU C++ compiler with Solaris linker if test yes,no = "$GXX,$with_gnu_ld"; then _LT_TAGVAR(no_undefined_flag, $1)=' $wl-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' else # g++ 2.7 appears to require '-G' NOT '-shared' on this # platform. _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags $wl-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib $wl-M $wl$lib.exp $wl-h $wl$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R $wl$libdir' case $host_os in solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; *) _LT_TAGVAR(whole_archive_flag_spec, $1)='$wl-z ${wl}allextract$convenience $wl-z ${wl}defaultextract' ;; esac fi ;; esac ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We CANNOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='$wl-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='$wl-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='$wl-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='$wl-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ '"$_LT_TAGVAR(old_archive_cmds, $1)" _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ '"$_LT_TAGVAR(reload_cmds, $1)" ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $wl-Bexport:$export_symbols $wl-h,$soname -o $lib $libobjs $deplibs $compiler_flags' ;; esac ;; tandem*) case $cc_basename in NCC*) # NonStop-UX NCC 3.20 # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; vxworks*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test no = "$_LT_TAGVAR(ld_shlibs, $1)" && can_build_shared=no _LT_TAGVAR(GCC, $1)=$GXX _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS LDCXX=$LD LD=$lt_save_LD GCC=$lt_save_GCC with_gnu_ld=$lt_save_with_gnu_ld lt_cv_path_LDCXX=$lt_cv_path_LD lt_cv_path_LD=$lt_save_path_LD lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld fi # test yes != "$_lt_caught_CXX_error" AC_LANG_POP ])# _LT_LANG_CXX_CONFIG # _LT_FUNC_STRIPNAME_CNF # ---------------------- # func_stripname_cnf prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # # This function is identical to the (non-XSI) version of func_stripname, # except this one can be used by m4 code that may be executed by configure, # rather than the libtool script. m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl AC_REQUIRE([_LT_DECL_SED]) AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) func_stripname_cnf () { case @S|@2 in .*) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%\\\\@S|@2\$%%"`;; *) func_stripname_result=`$ECHO "@S|@3" | $SED "s%^@S|@1%%; s%@S|@2\$%%"`;; esac } # func_stripname_cnf ])# _LT_FUNC_STRIPNAME_CNF # _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) # --------------------------------- # Figure out "hidden" library dependencies from verbose # compiler output when linking a shared library. # Parse the compiler output and extract the necessary # objects, libraries and library flags. m4_defun([_LT_SYS_HIDDEN_LIBDEPS], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl # Dependencies to place before and after the object being linked: _LT_TAGVAR(predep_objects, $1)= _LT_TAGVAR(postdep_objects, $1)= _LT_TAGVAR(predeps, $1)= _LT_TAGVAR(postdeps, $1)= _LT_TAGVAR(compiler_lib_search_path, $1)= dnl we can't use the lt_simple_compile_test_code here, dnl because it contains code intended for an executable, dnl not a library. It's possible we should let each dnl tag define a new lt_????_link_test_code variable, dnl but it's only used here... m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF int a; void foo (void) { a = 0; } _LT_EOF ], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF class Foo { public: Foo (void) { a = 0; } private: int a; }; _LT_EOF ], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer*4 a a=0 return end _LT_EOF ], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF subroutine foo implicit none integer a a=0 return end _LT_EOF ], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF public class foo { private int a; public void bar (void) { a = 0; } }; _LT_EOF ], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF package foo func foo() { } _LT_EOF ]) _lt_libdeps_save_CFLAGS=$CFLAGS case "$CC $CFLAGS " in #( *\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; *\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; *\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;; esac dnl Parse the compiler output and extract the necessary dnl objects, libraries and library flags. if AC_TRY_EVAL(ac_compile); then # Parse the compiler output and extract the necessary # objects, libraries and library flags. # Sentinel used to keep track of whether or not we are before # the conftest object file. pre_test_object_deps_done=no for p in `eval "$output_verbose_link_cmd"`; do case $prev$p in -L* | -R* | -l*) # Some compilers place space between "-{L,R}" and the path. # Remove the space. if test x-L = "$p" || test x-R = "$p"; then prev=$p continue fi # Expand the sysroot to ease extracting the directories later. if test -z "$prev"; then case $p in -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; esac fi case $p in =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; esac if test no = "$pre_test_object_deps_done"; then case $prev in -L | -R) # Internal compiler library paths should come after those # provided the user. The postdeps already come after the # user supplied libs so there is no need to process them. if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then _LT_TAGVAR(compiler_lib_search_path, $1)=$prev$p else _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} $prev$p" fi ;; # The "-l" case would never come before the object being # linked, so don't bother handling this case. esac else if test -z "$_LT_TAGVAR(postdeps, $1)"; then _LT_TAGVAR(postdeps, $1)=$prev$p else _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} $prev$p" fi fi prev= ;; *.lto.$objext) ;; # Ignore GCC LTO objects *.$objext) # This assumes that the test object file only shows up # once in the compiler output. if test "$p" = "conftest.$objext"; then pre_test_object_deps_done=yes continue fi if test no = "$pre_test_object_deps_done"; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)=$p else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)=$p else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext CFLAGS=$_lt_libdeps_save_CFLAGS # PORTME: override above test on systems where it is broken m4_if([$1], [CXX], [case $host_os in interix[[3-9]]*) # Interix 3.5 installs completely hosed .la files for C++, so rather than # hack all around it, let's just trust "g++" to DTRT. _LT_TAGVAR(predep_objects,$1)= _LT_TAGVAR(postdep_objects,$1)= _LT_TAGVAR(postdeps,$1)= ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | $SED -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_LANG_F77_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for a Fortran 77 compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_F77_CONFIG], [AC_LANG_PUSH(Fortran 77) if test -z "$F77" || test no = "$F77"; then _lt_disable_F77=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for f77 test sources. ac_ext=f # Object file extension for compiled f77 test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the F77 compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_F77"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${F77-"f77"} CFLAGS=$FFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) GCC=$G77 if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$G77 _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_F77" AC_LANG_POP ])# _LT_LANG_F77_CONFIG # _LT_LANG_FC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for a Fortran compiler are # suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_FC_CONFIG], [AC_LANG_PUSH(Fortran) if test -z "$FC" || test no = "$FC"; then _lt_disable_FC=yes fi _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(allow_undefined_flag, $1)= _LT_TAGVAR(always_export_symbols, $1)=no _LT_TAGVAR(archive_expsym_cmds, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(hardcode_libdir_separator, $1)= _LT_TAGVAR(hardcode_minus_L, $1)=no _LT_TAGVAR(hardcode_automatic, $1)=no _LT_TAGVAR(inherit_rpath, $1)=no _LT_TAGVAR(module_cmds, $1)= _LT_TAGVAR(module_expsym_cmds, $1)= _LT_TAGVAR(link_all_deplibs, $1)=unknown _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds _LT_TAGVAR(no_undefined_flag, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no # Source file extension for fc test sources. ac_ext=${ac_fc_srcext-f} # Object file extension for compiled fc test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # No sense in running all these tests if we already determined that # the FC compiler isn't working. Some variables (like enable_shared) # are currently assumed to apply to all compilers on this platform, # and will be corrupted by setting them based on a non-working compiler. if test yes != "$_lt_disable_FC"; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_GCC=$GCC lt_save_CFLAGS=$CFLAGS CC=${FC-"f95"} CFLAGS=$FCFLAGS compiler=$CC GCC=$ac_cv_fc_compiler_gnu _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) if test -n "$compiler"; then AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test no = "$can_build_shared" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test yes = "$enable_shared" && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test ia64 != "$host_cpu"; then case $enable_shared,$with_aix_soname,$aix_use_runtimelinking in yes,aix,yes) ;; # shared object as lib.so file only yes,svr4,*) ;; # shared object as lib.so archive member only yes,*) enable_static=no ;; # shared object in lib.a archive as well esac fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test yes = "$enable_shared" || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)=$ac_cv_fc_compiler_gnu _LT_TAGVAR(LD, $1)=$LD ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test yes != "$_lt_disable_FC" AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GCJ-"gcj"} CFLAGS=$GCJFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # GCJ did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GCJ_CONFIG # _LT_LANG_GO_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Go compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_GO_CONFIG], [AC_REQUIRE([LT_PROG_GO])dnl AC_LANG_SAVE # Source file extension for Go test sources. ac_ext=go # Object file extension for compiled Go test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="package main; func main() { }" # Code to be used in simple link tests lt_simple_link_test_code='package main; func main() { }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC=yes CC=${GOC-"gccgo"} CFLAGS=$GOFLAGS compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_TAGVAR(LD, $1)=$LD _LT_CC_BASENAME([$compiler]) # Go did not exist at the time GCC didn't implicitly link libc in. _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds _LT_TAGVAR(reload_flag, $1)=$reload_flag _LT_TAGVAR(reload_cmds, $1)=$reload_cmds if test -n "$compiler"; then _LT_COMPILER_NO_RTTI($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi AC_LANG_RESTORE GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_GO_CONFIG # _LT_LANG_RC_CONFIG([TAG]) # ------------------------- # Ensure that the configuration variables for the Windows resource compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to 'libtool'. m4_defun([_LT_LANG_RC_CONFIG], [AC_REQUIRE([LT_PROG_RC])dnl AC_LANG_SAVE # Source file extension for RC test sources. ac_ext=rc # Object file extension for compiled RC test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' # Code to be used in simple link tests lt_simple_link_test_code=$lt_simple_compile_test_code # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_CFLAGS=$CFLAGS lt_save_GCC=$GCC GCC= CC=${RC-"windres"} CFLAGS= compiler=$CC _LT_TAGVAR(compiler, $1)=$CC _LT_CC_BASENAME([$compiler]) _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes if test -n "$compiler"; then : _LT_CONFIG($1) fi GCC=$lt_save_GCC AC_LANG_RESTORE CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS ])# _LT_LANG_RC_CONFIG # LT_PROG_GCJ # ----------- AC_DEFUN([LT_PROG_GCJ], [m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], [AC_CHECK_TOOL(GCJ, gcj,) test set = "${GCJFLAGS+set}" || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_GO # ---------- AC_DEFUN([LT_PROG_GO], [AC_CHECK_TOOL(GOC, gccgo,) ]) # LT_PROG_RC # ---------- AC_DEFUN([LT_PROG_RC], [AC_CHECK_TOOL(RC, windres,) ]) # Old name: AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_RC], []) # _LT_DECL_EGREP # -------------- # If we don't have a new enough Autoconf to choose the best grep # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_EGREP], [AC_REQUIRE([AC_PROG_EGREP])dnl AC_REQUIRE([AC_PROG_FGREP])dnl test -z "$GREP" && GREP=grep _LT_DECL([], [GREP], [1], [A grep program that handles long lines]) _LT_DECL([], [EGREP], [1], [An ERE matcher]) _LT_DECL([], [FGREP], [1], [A literal string matcher]) dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too AC_SUBST([GREP]) ]) # _LT_DECL_OBJDUMP # -------------- # If we don't have a new enough Autoconf to choose the best objdump # available, choose the one first in the user's PATH. m4_defun([_LT_DECL_OBJDUMP], [AC_CHECK_TOOL(OBJDUMP, objdump, false) test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) AC_SUBST([OBJDUMP]) ]) # _LT_DECL_DLLTOOL # ---------------- # Ensure DLLTOOL variable is set. m4_defun([_LT_DECL_DLLTOOL], [AC_CHECK_TOOL(DLLTOOL, dlltool, false) test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program]) AC_SUBST([DLLTOOL]) ]) # _LT_DECL_SED # ------------ # Check for a fully-functional sed program, that truncates # as few characters as possible. Prefer GNU sed if found. m4_defun([_LT_DECL_SED], [AC_PROG_SED test -z "$SED" && SED=sed Xsed="$SED -e 1s/^X//" _LT_DECL([], [SED], [1], [A sed program that does not truncate output]) _LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], [Sed that helps us avoid accidentally triggering echo(1) options like -n]) ])# _LT_DECL_SED m4_ifndef([AC_PROG_SED], [ # NOTE: This macro has been submitted for inclusion into # # GNU Autoconf as AC_PROG_SED. When it is available in # # a released version of Autoconf we should remove this # # macro and use it instead. # m4_defun([AC_PROG_SED], [AC_MSG_CHECKING([for a sed that does not truncate output]) AC_CACHE_VAL(lt_cv_path_SED, [# Loop through the user's path and test for sed and gsed. # Then use that list of sed's as ones to test for truncation. as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for lt_ac_prog in sed gsed; do for ac_exec_ext in '' $ac_executable_extensions; do if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" fi done done done IFS=$as_save_IFS lt_ac_max=0 lt_ac_count=0 # Add /usr/xpg4/bin/sed as it is typically found on Solaris # along with /bin/sed that truncates output. for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do test ! -f "$lt_ac_sed" && continue cat /dev/null > conftest.in lt_ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >conftest.in # Check for GNU sed and select it if it is found. if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then lt_cv_path_SED=$lt_ac_sed break fi while true; do cat conftest.in conftest.in >conftest.tmp mv conftest.tmp conftest.in cp conftest.in conftest.nl echo >>conftest.nl $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break cmp -s conftest.out conftest.nl || break # 10000 chars as input seems more than enough test 10 -lt "$lt_ac_count" && break lt_ac_count=`expr $lt_ac_count + 1` if test "$lt_ac_count" -gt "$lt_ac_max"; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine what file name conversion functions should be used by # func_to_host_file (and, implicitly, by func_to_host_path). These are needed # for certain cross-compile configurations and native mingw. m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl AC_MSG_CHECKING([how to convert $build file names to $host format]) AC_CACHE_VAL(lt_cv_to_host_file_cmd, [case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 ;; esac ;; *-*-cygwin* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin ;; *-*-cygwin* ) lt_cv_to_host_file_cmd=func_convert_file_noop ;; * ) # otherwise, assume *nix lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin ;; esac ;; * ) # unhandled hosts (and "normal" native builds) lt_cv_to_host_file_cmd=func_convert_file_noop ;; esac ]) to_host_file_cmd=$lt_cv_to_host_file_cmd AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) _LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], [0], [convert $build file names to $host format])dnl AC_MSG_CHECKING([how to convert $build file names to toolchain format]) AC_CACHE_VAL(lt_cv_to_tool_file_cmd, [#assume ordinary cross tools, or native build. lt_cv_to_tool_file_cmd=func_convert_file_noop case $host in *-*-mingw* ) case $build in *-*-mingw* ) # actually msys lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 ;; esac ;; esac ]) to_tool_file_cmd=$lt_cv_to_tool_file_cmd AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) _LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], [0], [convert $build files to toolchain format])dnl ])# _LT_PATH_CONVERSION_FUNCTIONS # Helper functions for option handling. -*- Autoconf -*- # # Copyright (C) 2004-2005, 2007-2009, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 8 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option '$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl 'shared' nor 'disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) _LT_UNLESS_OPTIONS([LT_INIT], [aix-soname=aix aix-soname=both aix-soname=svr4], [_LT_WITH_AIX_SONAME([aix])]) ]) ])# _LT_SET_OPTIONS # _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) # ----------------------------------------- m4_define([_LT_MANGLE_DEFUN], [[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) # LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) # ----------------------------------------------- m4_define([LT_OPTION_DEFINE], [m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl ])# LT_OPTION_DEFINE # dlopen # ------ LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes ]) AU_DEFUN([AC_LIBTOOL_DLOPEN], [_LT_SET_OPTION([LT_INIT], [dlopen]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'dlopen' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) # win32-dll # --------- # Declare package support for building win32 dll's. LT_OPTION_DEFINE([LT_INIT], [win32-dll], [enable_win32_dll=yes case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) AC_CHECK_TOOL(AS, as, false) AC_CHECK_TOOL(DLLTOOL, dlltool, false) AC_CHECK_TOOL(OBJDUMP, objdump, false) ;; esac test -z "$AS" && AS=as _LT_DECL([], [AS], [1], [Assembler program])dnl test -z "$DLLTOOL" && DLLTOOL=dlltool _LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl test -z "$OBJDUMP" && OBJDUMP=objdump _LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl ])# win32-dll AU_DEFUN([AC_LIBTOOL_WIN32_DLL], [AC_REQUIRE([AC_CANONICAL_HOST])dnl _LT_SET_OPTION([LT_INIT], [win32-dll]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'win32-dll' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) # _LT_ENABLE_SHARED([DEFAULT]) # ---------------------------- # implement the --enable-shared flag, and supports the 'shared' and # 'disable-shared' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_SHARED], [m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([shared], [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_shared=yes ;; no) enable_shared=no ;; *) enable_shared=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_shared=yes fi done IFS=$lt_save_ifs ;; esac], [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) _LT_DECL([build_libtool_libs], [enable_shared], [0], [Whether or not to build shared libraries]) ])# _LT_ENABLE_SHARED LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) # Old names: AC_DEFUN([AC_ENABLE_SHARED], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) ]) AC_DEFUN([AC_DISABLE_SHARED], [_LT_SET_OPTION([LT_INIT], [disable-shared]) ]) AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_SHARED], []) dnl AC_DEFUN([AM_DISABLE_SHARED], []) # _LT_ENABLE_STATIC([DEFAULT]) # ---------------------------- # implement the --enable-static flag, and support the 'static' and # 'disable-static' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_STATIC], [m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([static], [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_static=yes ;; no) enable_static=no ;; *) enable_static=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_static=yes fi done IFS=$lt_save_ifs ;; esac], [enable_static=]_LT_ENABLE_STATIC_DEFAULT) _LT_DECL([build_old_libs], [enable_static], [0], [Whether or not to build static libraries]) ])# _LT_ENABLE_STATIC LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) # Old names: AC_DEFUN([AC_ENABLE_STATIC], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) ]) AC_DEFUN([AC_DISABLE_STATIC], [_LT_SET_OPTION([LT_INIT], [disable-static]) ]) AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AM_ENABLE_STATIC], []) dnl AC_DEFUN([AM_DISABLE_STATIC], []) # _LT_ENABLE_FAST_INSTALL([DEFAULT]) # ---------------------------------- # implement the --enable-fast-install flag, and support the 'fast-install' # and 'disable-fast-install' LT_INIT options. # DEFAULT is either 'yes' or 'no'. If omitted, it defaults to 'yes'. m4_define([_LT_ENABLE_FAST_INSTALL], [m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl AC_ARG_ENABLE([fast-install], [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], [p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for pkg in $enableval; do IFS=$lt_save_ifs if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS=$lt_save_ifs ;; esac], [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) _LT_DECL([fast_install], [enable_fast_install], [0], [Whether or not to optimize for fast installation])dnl ])# _LT_ENABLE_FAST_INSTALL LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) # Old names: AU_DEFUN([AC_ENABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'fast-install' option into LT_INIT's first parameter.]) ]) AU_DEFUN([AC_DISABLE_FAST_INSTALL], [_LT_SET_OPTION([LT_INIT], [disable-fast-install]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'disable-fast-install' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) # _LT_WITH_AIX_SONAME([DEFAULT]) # ---------------------------------- # implement the --with-aix-soname flag, and support the `aix-soname=aix' # and `aix-soname=both' and `aix-soname=svr4' LT_INIT options. DEFAULT # is either `aix', `both' or `svr4'. If omitted, it defaults to `aix'. m4_define([_LT_WITH_AIX_SONAME], [m4_define([_LT_WITH_AIX_SONAME_DEFAULT], [m4_if($1, svr4, svr4, m4_if($1, both, both, aix))])dnl shared_archive_member_spec= case $host,$enable_shared in power*-*-aix[[5-9]]*,yes) AC_MSG_CHECKING([which variant of shared library versioning to provide]) AC_ARG_WITH([aix-soname], [AS_HELP_STRING([--with-aix-soname=aix|svr4|both], [shared library versioning (aka "SONAME") variant to provide on AIX, @<:@default=]_LT_WITH_AIX_SONAME_DEFAULT[@:>@.])], [case $withval in aix|svr4|both) ;; *) AC_MSG_ERROR([Unknown argument to --with-aix-soname]) ;; esac lt_cv_with_aix_soname=$with_aix_soname], [AC_CACHE_VAL([lt_cv_with_aix_soname], [lt_cv_with_aix_soname=]_LT_WITH_AIX_SONAME_DEFAULT) with_aix_soname=$lt_cv_with_aix_soname]) AC_MSG_RESULT([$with_aix_soname]) if test aix != "$with_aix_soname"; then # For the AIX way of multilib, we name the shared archive member # based on the bitwidth used, traditionally 'shr.o' or 'shr_64.o', # and 'shr.imp' or 'shr_64.imp', respectively, for the Import File. # Even when GNU compilers ignore OBJECT_MODE but need '-maix64' flag, # the AIX toolchain works better with OBJECT_MODE set (default 32). if test 64 = "${OBJECT_MODE-32}"; then shared_archive_member_spec=shr_64 else shared_archive_member_spec=shr fi fi ;; *) with_aix_soname=aix ;; esac _LT_DECL([], [shared_archive_member_spec], [0], [Shared archive member basename, for filename based shared library versioning on AIX])dnl ])# _LT_WITH_AIX_SONAME LT_OPTION_DEFINE([LT_INIT], [aix-soname=aix], [_LT_WITH_AIX_SONAME([aix])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=both], [_LT_WITH_AIX_SONAME([both])]) LT_OPTION_DEFINE([LT_INIT], [aix-soname=svr4], [_LT_WITH_AIX_SONAME([svr4])]) # _LT_WITH_PIC([MODE]) # -------------------- # implement the --with-pic flag, and support the 'pic-only' and 'no-pic' # LT_INIT options. # MODE is either 'yes' or 'no'. If omitted, it defaults to 'both'. m4_define([_LT_WITH_PIC], [AC_ARG_WITH([pic], [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], [lt_p=${PACKAGE-default} case $withval in yes|no) pic_mode=$withval ;; *) pic_mode=default # Look at the argument we got. We use all the common list separators. lt_save_ifs=$IFS; IFS=$IFS$PATH_SEPARATOR, for lt_pkg in $withval; do IFS=$lt_save_ifs if test "X$lt_pkg" = "X$lt_p"; then pic_mode=yes fi done IFS=$lt_save_ifs ;; esac], [pic_mode=m4_default([$1], [default])]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the 'pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) m4_define([_LTDL_MODE], []) LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], [m4_define([_LTDL_MODE], [nonrecursive])]) LT_OPTION_DEFINE([LTDL_INIT], [recursive], [m4_define([_LTDL_MODE], [recursive])]) LT_OPTION_DEFINE([LTDL_INIT], [subproject], [m4_define([_LTDL_MODE], [subproject])]) m4_define([_LTDL_TYPE], []) LT_OPTION_DEFINE([LTDL_INIT], [installable], [m4_define([_LTDL_TYPE], [installable])]) LT_OPTION_DEFINE([LTDL_INIT], [convenience], [m4_define([_LTDL_TYPE], [convenience])]) # ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007-2008, 2011-2015 Free Software # Foundation, Inc. # Written by Gary V. Vaughan, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 6 ltsugar.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) # lt_join(SEP, ARG1, [ARG2...]) # ----------------------------- # Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their # associated separator. # Needed until we can rely on m4_join from Autoconf 2.62, since all earlier # versions in m4sugar had bugs. m4_define([lt_join], [m4_if([$#], [1], [], [$#], [2], [[$2]], [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) m4_define([_lt_join], [m4_if([$#$2], [2], [], [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) # lt_car(LIST) # lt_cdr(LIST) # ------------ # Manipulate m4 lists. # These macros are necessary as long as will still need to support # Autoconf-2.59, which quotes differently. m4_define([lt_car], [[$1]]) m4_define([lt_cdr], [m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], [$#], 1, [], [m4_dquote(m4_shift($@))])]) m4_define([lt_unquote], $1) # lt_append(MACRO-NAME, STRING, [SEPARATOR]) # ------------------------------------------ # Redefine MACRO-NAME to hold its former content plus 'SEPARATOR''STRING'. # Note that neither SEPARATOR nor STRING are expanded; they are appended # to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). # No SEPARATOR is output if MACRO-NAME was previously undefined (different # than defined and empty). # # This macro is needed until we can rely on Autoconf 2.62, since earlier # versions of m4sugar mistakenly expanded SEPARATOR but not STRING. m4_define([lt_append], [m4_define([$1], m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) # lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) # ---------------------------------------------------------- # Produce a SEP delimited list of all paired combinations of elements of # PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list # has the form PREFIXmINFIXSUFFIXn. # Needed until we can rely on m4_combine added in Autoconf 2.62. m4_define([lt_combine], [m4_if(m4_eval([$# > 3]), [1], [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl [[m4_foreach([_Lt_prefix], [$2], [m4_foreach([_Lt_suffix], ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) # lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) # ----------------------------------------------------------------------- # Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited # by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. m4_define([lt_if_append_uniq], [m4_ifdef([$1], [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], [lt_append([$1], [$2], [$3])$4], [$5])], [lt_append([$1], [$2], [$3])$4])]) # lt_dict_add(DICT, KEY, VALUE) # ----------------------------- m4_define([lt_dict_add], [m4_define([$1($2)], [$3])]) # lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) # -------------------------------------------- m4_define([lt_dict_add_subkey], [m4_define([$1($2:$3)], [$4])]) # lt_dict_fetch(DICT, KEY, [SUBKEY]) # ---------------------------------- m4_define([lt_dict_fetch], [m4_ifval([$3], m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) # lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) # ----------------------------------------------------------------- m4_define([lt_if_dict_fetch], [m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], [$5], [$6])]) # lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) # -------------------------------------------------------------- m4_define([lt_dict_filter], [m4_if([$5], [], [], [lt_join(m4_quote(m4_default([$4], [[, ]])), lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl ]) # ltversion.m4 -- version numbers -*- Autoconf -*- # # Copyright (C) 2004, 2011-2015 Free Software Foundation, Inc. # Written by Scott James Remnant, 2004 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # @configure_input@ # serial 4179 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.6]) m4_define([LT_PACKAGE_REVISION], [2.4.6]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.6' macro_revision='2.4.6' _LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) _LT_DECL(, macro_revision, 0) ]) # lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- # # Copyright (C) 2004-2005, 2007, 2009, 2011-2015 Free Software # Foundation, Inc. # Written by Scott James Remnant, 2004. # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. # serial 5 lt~obsolete.m4 # These exist entirely to fool aclocal when bootstrapping libtool. # # In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN), # which have later been changed to m4_define as they aren't part of the # exported API, or moved to Autoconf or Automake where they belong. # # The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN # in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us # using a macro with the same name in our local m4/libtool.m4 it'll # pull the old libtool.m4 in (it doesn't see our shiny new m4_define # and doesn't know about Autoconf macros at all.) # # So we provide this file, which has a silly filename so it's always # included after everything else. This provides aclocal with the # AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything # because those macros already exist, or will be overwritten later. # We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. # # Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. # Yes, that means every name once taken will need to remain here until # we give up compatibility with versions before 1.7, at which point # we need to keep only those names which we still refer to. # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) # Copyright (C) 2002-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.16' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.16.3], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AM_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.16.3])dnl m4_ifndef([AC_AUTOCONF_VERSION], [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl _AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to # '$srcdir', '$srcdir/..', or '$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is '.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl # Expand $ac_aux_dir to an absolute path. am_aux_dir=`cd "$ac_aux_dir" && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ([2.52])dnl m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl m4_define([_AM_COND_VALUE_$1], [$2])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl m4_if([$1], [CC], [depcc="$CC" am_compiler_list=], [$1], [CXX], [depcc="$CXX" am_compiler_list=], [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'], [$1], [UPC], [depcc="$UPC" am_compiler_list=], [$1], [GCJ], [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named 'D' -- because '-MD' means "put the output # in D". rm -rf conftest.dir mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi am__universal=false m4_case([$1], [CC], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac], [CXX], [case " $depcc " in #( *\ -arch\ *\ -arch\ *) am__universal=true ;; esac]) for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using ": > sub/conftst$i.h" creates only sub/conftst1.h with # Solaris 10 /bin/sh. echo '/* dummy */' > sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf # We check with '-c' and '-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle '-M -o', and we need to detect this. Also, some Intel # versions had trouble with output in subdirs. am__obj=sub/conftest.${OBJEXT-o} am__minus_obj="-o $am__obj" case $depmode in gcc) # This depmode causes a compiler race in universal mode. test "$am__universal" = false || continue ;; nosideeffect) # After this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested. if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; msvc7 | msvc7msys | msvisualcpp | msvcmsys) # This compiler won't grok '-c -o', but also, the minuso test has # not run yet. These depmodes are late enough in the game, and # so weak that their functioning should not be impacted. am__obj=conftest.${OBJEXT-o} am__minus_obj= ;; none) break ;; esac if depmode=$depmode \ source=sub/conftest.c object=$am__obj \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep $am__obj sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES. AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE([dependency-tracking], [dnl AS_HELP_STRING( [--enable-dependency-tracking], [do not reject slow dependency extractors]) AS_HELP_STRING( [--disable-dependency-tracking], [speeds up one-time build])]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' am__nodep='_no' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl AC_SUBST([am__nodep])dnl _AM_SUBST_NOTMAKE([am__nodep])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Older Autoconf quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. # TODO: see whether this extra hack can be removed once we start # requiring Autoconf 2.70 or later. AS_CASE([$CONFIG_FILES], [*\'*], [eval set x "$CONFIG_FILES"], [*], [set x $CONFIG_FILES]) shift # Used to flag and report bootstrapping failures. am_rc=0 for am_mf do # Strip MF so we end up with the name of the file. am_mf=`AS_ECHO(["$am_mf"]) | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile which includes # dependency-tracking related rules and includes. # Grep'ing the whole file directly is not great: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. sed -n 's,^am--depfiles:.*,X,p' "$am_mf" | grep X >/dev/null 2>&1 \ || continue am_dirpart=`AS_DIRNAME(["$am_mf"])` am_filepart=`AS_BASENAME(["$am_mf"])` AM_RUN_LOG([cd "$am_dirpart" \ && sed -e '/# am--include-marker/d' "$am_filepart" \ | $MAKE -f - am--depfiles]) || am_rc=$? done if test $am_rc -ne 0; then AC_MSG_FAILURE([Something went wrong bootstrapping makefile fragments for automatic dependency tracking. If GNU make was not used, consider re-running the configure script with MAKE="gmake" (or whatever is necessary). You can also try re-running configure with the '--disable-dependency-tracking' option to at least be able to build the package (albeit without support for automatic dependency tracking).]) fi AS_UNSET([am_dirpart]) AS_UNSET([am_filepart]) AS_UNSET([am_mf]) AS_UNSET([am_rc]) rm -f conftest-deps.mk } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking is enabled. # This creates each '.Po' and '.Plo' makefile fragment that we'll need in # order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" MAKE="${MAKE-make}"])]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. dnl Redefine AC_PROG_CC to automatically invoke _AM_PROG_CC_C_O. m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC]) [_AM_PROG_CC_C_O ]) # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.65])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [AC_DIAGNOSE([obsolete], [$0: two- and three-arguments forms are deprecated.]) m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if( m4_ifset([AC_PACKAGE_NAME], [ok]):m4_ifset([AC_PACKAGE_VERSION], [ok]), [ok:ok],, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) AM_MISSING_PROG([AUTOCONF], [autoconf]) AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) AM_MISSING_PROG([AUTOHEADER], [autoheader]) AM_MISSING_PROG([MAKEINFO], [makeinfo]) AC_REQUIRE([AM_PROG_INSTALL_SH])dnl AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl # For better backward compatibility. To be removed once Automake 1.9.x # dies out for good. For more background, see: # # AC_SUBST([mkdir_p], ['$(MKDIR_P)']) # We need awk for the "check" target (and possibly the TAP driver). The # system "awk" is bad on some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES([CC])], [m4_define([AC_PROG_CC], m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES([CXX])], [m4_define([AC_PROG_CXX], m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES([OBJC])], [m4_define([AC_PROG_OBJC], m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], [_AM_DEPENDENCIES([OBJCXX])], [m4_define([AC_PROG_OBJCXX], m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])dnl ]) AC_REQUIRE([AM_SILENT_RULES])dnl dnl The testsuite driver may need to know about EXEEXT, so add the dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl # POSIX will say in a future version that running "rm -f" with no argument # is OK; and we want to be able to make that assumption in our Makefile # recipes. So use an aggressive probe to check that the usage we want is # actually supported "in the wild" to an acceptable degree. # See automake bug#10828. # To make any issue more visible, cause the running configure to be aborted # by default if the 'rm' program in use doesn't match our expectations; the # user can still override this though. if rm -f && rm -fr && rm -rf; then : OK; else cat >&2 <<'END' Oops! Your 'rm' program seems unable to run without file operands specified on the command line, even when the '-f' option is present. This is contrary to the behaviour of most rm programs out there, and not conforming with the upcoming POSIX standard: Please tell bug-automake@gnu.org about your system, including the value of your $PATH and any error possibly output before this message. This can help us improve future automake versions. END if test x"$ACCEPT_INFERIOR_RM_PROGRAM" = x"yes"; then echo 'Configuration will proceed anyway, since you have set the' >&2 echo 'ACCEPT_INFERIOR_RM_PROGRAM variable to "yes"' >&2 echo >&2 else cat >&2 <<'END' Aborting the configuration process, to ensure you take notice of the issue. You can download and install GNU coreutils to get an 'rm' implementation that behaves properly: . If you want to complete the configuration process using your problematic 'rm' anyway, export the environment variable ACCEPT_INFERIOR_RM_PROGRAM to "yes", and re-run configure. END AC_MSG_ERROR([Your 'rm' program is bad, sorry.]) fi fi dnl The trailing newline in this macro's definition is deliberate, for dnl backward compatibility and to allow trailing 'dnl'-style comments dnl after the AM_INIT_AUTOMAKE invocation. See automake bug#16841. ]) dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_arg=$1 _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $_am_arg | $_am_arg:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl if test x"${install_sh+set}" != xset; then case $am_aux_dir in *\ * | *\ *) install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; *) install_sh="\${SHELL} $am_aux_dir/install-sh" esac fi AC_SUBST([install_sh])]) # Copyright (C) 2003-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MAKE_INCLUDE() # ----------------- # Check whether make has an 'include' directive that can support all # the idioms we need for our automatic dependency tracking code. AC_DEFUN([AM_MAKE_INCLUDE], [AC_MSG_CHECKING([whether ${MAKE-make} supports the include directive]) cat > confinc.mk << 'END' am__doit: @echo this is the am__doit target >confinc.out .PHONY: am__doit END am__include="#" am__quote= # BSD make does it like this. echo '.include "confinc.mk" # ignored' > confmf.BSD # Other make implementations (GNU, Solaris 10, AIX) do it like this. echo 'include confinc.mk # ignored' > confmf.GNU _am_result=no for s in GNU BSD; do AM_RUN_LOG([${MAKE-make} -f confmf.$s && cat confinc.out]) AS_CASE([$?:`cat confinc.out 2>/dev/null`], ['0:this is the am__doit target'], [AS_CASE([$s], [BSD], [am__include='.include' am__quote='"'], [am__include='include' am__quote=''])]) if test "$am__include" != "#"; then _am_result="yes ($s style)" break fi done rm -f confinc.* confmf.* AC_MSG_RESULT([${_am_result}]) AC_SUBST([am__include])]) AC_SUBST([am__quote])]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it is modern enough. # If it is, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl if test x"${MISSING+set}" != xset; then MISSING="\${SHELL} '$am_aux_dir/missing'" fi # Use eval to expand $SHELL if eval "$MISSING --is-lightweight"; then am_missing_run="$MISSING " else am_missing_run= AC_MSG_WARN(['missing' script is too old or missing]) fi ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # -------------------- # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), [1])]) # _AM_SET_OPTIONS(OPTIONS) # ------------------------ # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Copyright (C) 1999-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_CC_C_O # --------------- # Like AC_PROG_CC_C_O, but changed for automake. We rewrite AC_PROG_CC # to automatically call this. AC_DEFUN([_AM_PROG_CC_C_O], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([compile])dnl AC_LANG_PUSH([C])dnl AC_CACHE_CHECK( [whether $CC understands -c and -o together], [am_cv_prog_cc_c_o], [AC_LANG_CONFTEST([AC_LANG_PROGRAM([])]) # Make sure it works both with $CC and with simple cc. # Following AC_PROG_CC_C_O, we do the test twice because some # compilers refuse to overwrite an existing .o file with -o, # though they will create one. am_cv_prog_cc_c_o=yes for am_i in 1 2; do if AM_RUN_LOG([$CC -c conftest.$ac_ext -o conftest2.$ac_objext]) \ && test -f conftest2.$ac_objext; then : OK else am_cv_prog_cc_c_o=no break fi done rm -f core conftest* unset am_i]) if test "$am_cv_prog_cc_c_o" != yes; then # Losing compiler, so override with the script. # FIXME: It is wrong to rewrite CC. # But if we don't then we get into trouble of one sort or another. # A longer-term fix would be to have automake use am__CC in this case, # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" CC="$am_aux_dir/compile $CC" fi AC_LANG_POP([C])]) # For backward compatibility. AC_DEFUN_ONCE([AM_PROG_CC_C_O], [AC_REQUIRE([AC_PROG_CC])]) # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_RUN_LOG(COMMAND) # ------------------- # Run COMMAND, save the exit status in ac_status, and log it. # (This has been adapted from Autoconf's _AC_RUN_LOG macro.) AC_DEFUN([AM_RUN_LOG], [{ echo "$as_me:$LINENO: $1" >&AS_MESSAGE_LOG_FD ($1) >&AS_MESSAGE_LOG_FD 2>&AS_MESSAGE_LOG_FD ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD (exit $ac_status); }]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; esac # Do 'set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( am_has_slept=no for am_try in 1 2; do echo "timestamp, slept: $am_has_slept" > conftest.file set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi if test "$[2]" = conftest.file || test $am_try -eq 2; then break fi # Just in case. sleep 1 am_has_slept=yes done test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT([yes]) # If we didn't sleep, we still need to ensure time stamps of config.status and # generated files are strictly newer. am_sleep_pid= if grep 'slept: no' conftest.file >/dev/null 2>&1; then ( sleep 1 ) & am_sleep_pid=$! fi AC_CONFIG_COMMANDS_PRE( [AC_MSG_CHECKING([that generated files are newer than configure]) if test -n "$am_sleep_pid"; then # Hide warnings about reused PIDs. wait $am_sleep_pid 2>/dev/null fi AC_MSG_RESULT([done])]) rm -f conftest.file ]) # Copyright (C) 2009-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_SILENT_RULES([DEFAULT]) # -------------------------- # Enable less verbose build rules; with the default set to DEFAULT # ("yes" being less verbose, "no" or empty being verbose). AC_DEFUN([AM_SILENT_RULES], [AC_ARG_ENABLE([silent-rules], [dnl AS_HELP_STRING( [--enable-silent-rules], [less verbose build output (undo: "make V=1")]) AS_HELP_STRING( [--disable-silent-rules], [verbose build output (undo: "make V=0")])dnl ]) case $enable_silent_rules in @%:@ ((( yes) AM_DEFAULT_VERBOSITY=0;; no) AM_DEFAULT_VERBOSITY=1;; *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);; esac dnl dnl A few 'make' implementations (e.g., NonStop OS and NextStep) dnl do not support nested variable expansions. dnl See automake bug#9928 and bug#10237. am_make=${MAKE-make} AC_CACHE_CHECK([whether $am_make supports nested variables], [am_cv_make_support_nested_variables], [if AS_ECHO([['TRUE=$(BAR$(V)) BAR0=false BAR1=true V=1 am__doit: @$(TRUE) .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then am_cv_make_support_nested_variables=yes else am_cv_make_support_nested_variables=no fi]) if test $am_cv_make_support_nested_variables = yes; then dnl Using '$V' instead of '$(V)' breaks IRIX make. AM_V='$(V)' AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)' else AM_V=$AM_DEFAULT_VERBOSITY AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY fi AC_SUBST([AM_V])dnl AM_SUBST_NOTMAKE([AM_V])dnl AC_SUBST([AM_DEFAULT_V])dnl AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl AC_SUBST([AM_DEFAULT_VERBOSITY])dnl AM_BACKSLASH='\' AC_SUBST([AM_BACKSLASH])dnl _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl ]) # Copyright (C) 2001-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor 'install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in "make install-strip", and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using 'strip' when the user # run "make install-strip". However 'strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the 'STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004-2020 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of 'v7', 'ustar', or 'pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar # AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) # We'll loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar], [# The POSIX 1988 'ustar' format is defined with fixed-size fields. # There is notably a 21 bits limit for the UID and the GID. In fact, # the 'pax' utility can hang on bigger UID/GID (see automake bug#8343 # and bug#13588). am_max_uid=2097151 # 2^21 - 1 am_max_gid=$am_max_uid # The $UID and $GID variables are not portable, so we need to resort # to the POSIX-mandated id(1) utility. Errors in the 'id' calls # below are definitely unexpected, so allow the users to see them # (that is, avoid stderr redirection). am_uid=`id -u || echo unknown` am_gid=`id -g || echo unknown` AC_MSG_CHECKING([whether UID '$am_uid' is supported by ustar format]) if test $am_uid -le $am_max_uid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi AC_MSG_CHECKING([whether GID '$am_gid' is supported by ustar format]) if test $am_gid -le $am_max_gid; then AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) _am_tools=none fi], [pax], [], [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Go ahead even if we have the value already cached. We do so because we # need to set the values for the 'am__tar' and 'am__untar' variables. _am_tools=${am_cv_prog_tar_$1-$_am_tools} for _am_tool in $_am_tools; do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works. rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([macros/extfs.m4]) m4_include([macros/ld-versionscript.m4]) m4_include([macros/pkg.m4]) avfs-1.1.4/extfs/0000755000175000001440000000000014032341025010574 500000000000000avfs-1.1.4/extfs/uzoo.in0000644000175000001440000000262214032341001012034 00000000000000#! /bin/sh # # Zoo file system # # Source of zoo can be found at # ftp://ftp.ibiblio.org/pub/Linux/utils/compress/ ZOO=zoo # Stupid zoo won't work if the archive name has no .zoo extension, so we # have to make a symlink with a "better" name. Also, zoo can create # directories even if printing files to stdout, so it's safer to confine # it to a temporary directory. mklink () { TMPDIR=`mktemp -d ${MC_TMPDIR:-/tmp}/mctmpdir-uzoo.XXXXXX` || exit 1 trap 'cd /; rm -rf "$TMPDIR"' 0 1 2 3 5 13 15 ARCHIVE="$TMPDIR/tmp.zoo" ln -sf "$1" "$ARCHIVE" cd "$TMPDIR" || exit 1 } mczoofs_list () { mklink "$1" $ZOO lq "$ARCHIVE" | @AWK@ -v uid=$(id -ru) ' /^[^\ ]/ { next } { if (NF < 8) next if ($8 ~ /^\^/) $8=substr($8, 2) if ($6 > 50) $6=$6 + 1900 else $6=$6 + 2000 split($7, a, ":") if ($8 ~ /\/$/) printf "drwxr-xr-x 1 %-8d %-8d %8d %s %2d %4d %02d:%02d %s\n", uid, 0, $1, $5, $4, $6, a[1], a[2], $8 else printf "-rw-r--r-- 1 %-8d %-8d %8d %s %2d %4d %02d:%02d %s\n", uid, 0, $1, $5, $4, $6, a[1], a[2], $8 }' 2>/dev/null exit 0 } mczoofs_copyout () { mklink "$1" # zoo only accepts name without directory as file to extract base=`echo "$2" | sed 's,.*/,,'` $ZOO xpq: "$ARCHIVE" "$base" > "$3" cd / exit 0 } umask 077 cmd="$1" shift case "$cmd" in list) mczoofs_list "$@" ;; copyout) mczoofs_copyout "$@" ;; *) exit 1 ;; esac exit 0 avfs-1.1.4/extfs/uc1541.in0000644000175000001440000000311214032341001011755 00000000000000#! /bin/sh # # UC1541 Virtual filesystem executive v0.1 # This is for accessing disk image files for the Commodore VIC20/C64/C128 # It requires the utility c1541 that comes bundled with Vice, the emulator # for the VIC20, C64, C128 and other computers made by Commodore. # Copyright (C) 2008 Jacques Pelletier # May be distributed under the terms of the GNU Public License # # # Define your awk AWK=@AWK@ # Define which archiver you are using with appropriate options C1541="c1541" # There are no time stamps in the disk image, so a bogus timestamp is displayed mc_c1541_fs_list() { $C1541 "$1" -list | gawk -v uid=$(id -ru) ' BEGIN { FS = "\"" } /No LINES!/ { next } /BLOCKS FREE/ { next } $1 == 0 { next } { printf "-rw-r--r-- 1 %-8d %-8d %8d Jan 01 1980 00:00 %s\n", uid, 0, $1 * 256, $2 }' 2>/dev/null } # Command: copyout archivename storedfilename extractto # -read image 1541name [fsname] mc_c1541_fs_copyout() { $C1541 "$1" -read "$2" 2> /dev/null mv "$2" "$3" } # FIXME mc can't do chown of the file inside the archive # Command: copyin archivename storedfilename sourcefile # -write image fsname [1541name] mc_c1541_fs_copyin() { mv "$3" "$2" $C1541 "$1" -write "$2" 2> /dev/null } # Command: rm archivename storedfilename # -delete image files mc_c1541_fs_rm() { $C1541 "$1" -delete "$2" 2> /dev/null } # The main routine umask 077 cmd="$1" shift case "$cmd" in list) mc_c1541_fs_list "$@" ;; copyout) mc_c1541_fs_copyout "$@" ;; # copyin) mc_c1541_fs_copyin "$@" ;; rm) mc_c1541_fs_rm "$@" ;; *) exit 1 ;; esac exit 0 avfs-1.1.4/extfs/uace.in0000644000175000001440000000220314032341001011750 00000000000000#! /bin/sh # # ACE Virtual filesystem executive v0.1 # Works with unace v2.5 # Copyright (C) 2008 Jacques Pelletier # May be distributed under the terms of the GNU Public License # # # Define your awk AWK=@AWK@ # Define which archiver you are using with appropriate options ACE_LIST="unace l" ACE_GET="unace x" # ACE_PUT="unace ?" not available # The 'list' command executive # Unace: DD.MM.YY HH.MM packed size ratio file # ls: mc_ace_fs_list() { $ACE_LIST "$1" | gawk -v uid=$(id -ru) ' BEGIN { Month="JanFebMarAprMayJunJulAugSepOctNovDec" } /%/ { split($1,date,".") if (date[3] > 50) date[3]=date[3] + 1900 else date[3]=date[3] + 2000 printf "-rw-r--r-- 1 %-8d %-8d %8d %s %2d %4d %s %s\n", uid, 0, $3, substr(Month,3*(date[2]-1)+1,3),date[1],date[3], $2, $6 }' 2>/dev/null exit 0 } # Command: copyout archivename storedfilename extractto mc_ace_fs_copyout() { $ACE_GET "$1" "$2" > /dev/null 2>&1 mv "$2" "$3" } # The main routine umask 077 cmd="$1" shift case "$cmd" in list) mc_ace_fs_list "$@" ;; copyout) mc_ace_fs_copyout "$@" ;; *) exit 1 ;; esac exit 0 avfs-1.1.4/extfs/bpp0000755000175000001440000000226714032341001011224 00000000000000#! /bin/sh # # Written by Marco Ciampa 2000 # (a simple cut & paste from rpm vfs) # (C) 1996 The Free Software Foundation. # # Package of a new italian distribution: Bad Penguin # http://www.badpenguin.org/ # override any locale for dates unset LC_ALL LC_TIME=C export LC_TIME mcbppfs_list () { FILEPREF="-r--r--r-- 1 root root " FIEXPREF="-r-xr-xr-x 1 root root " DATE=`date +"%b %d %H:%M"` set x `ls -l "$1"` size=$6 echo "$FILEPREF $size $DATE CONTENTS.tar.gz" echo "$FIEXPREF 35 $DATE INSTALL" echo "$FIEXPREF 35 $DATE UPGRADE" } mcbppfs_copyout () { case "$2" in CONTENTS.tar.gz) cat "$1" > "$3"; exit 0;; INSTALL) echo "# Run this to install this package" > "$3"; exit 0;; UPGRADE) echo "# Run this to upgrade this package" > "$3"; exit 0;; esac } mcbppfs_run () { case "$2" in INSTALL) echo "Installing \"$1\""; package-setup --install "$1"; exit 0;; UPGRADE) echo "Upgrading \"$1\""; package-setup --update "$1"; exit 0;; esac } umask 077 case "$1" in list) mcbppfs_list "$2"; exit 0;; copyout) mcbppfs_copyout "$2" "$3" "$4"; exit 0;; run) mcbppfs_run "$2" "$3"; exit 1;; esac exit 1 avfs-1.1.4/extfs/trpm0000755000175000001440000002162614032341001011425 00000000000000#! /bin/sh # # Browse contents of an installed RPM package. # This filesystem works on the entries of the "rpms" filesystem. # # Written by Erik Troan (ewt@redhat.com) 1996 # Jakub Jelinek (jj@sunsite.mff.cuni.cz) 1996 # Tomasz K³oczko (kloczek@rudy.mif.pg.gda.pl) 1997 # minor changes by Wojtek Pilorz (wpilorz@bdk.lublin.pl) 1997 # minor changes by Michele Marziani (marziani@fe.infn.it) 1997 # slight changes to put rpm to Trpm by Balazs Nagy (julian7@kva.hu) 1998 # locale bugfix by Michal Svec (rebel@penguin.cz) 2000 # patch for listing files with correct file size by Tanmoy Bhattacharya (tanmoy@mindspring.com) 2007 # minor changes by Ralf Hoffmann (ralf@boomerangsworld.de) 2007 # # (C) 1996 The Free Software Foundation. # # # override any locale for dates unset LC_ALL LC_TIME=C export LC_TIME if rpm --nosignature --version >/dev/null 2>&1; then RPM="rpm --nosignature" else RPM="rpm" fi mcrpmfs_list () { # set MCFASTRPM_DFLT to 1 for faster rpm files handling by default, to 0 for # slower handling MCFASTRPM_DFLT=0 if test -z "$MCFASTRPM"; then MCFASTRPM=$MCFASTRPM_DFLT fi FILEPREF="-r--r--r-- 1 root root " DESC=`$RPM -qi -- "$1"` if [ $? -ne 0 ]; then echo "$DESC" >&2 exit 255 fi DATE=`$RPM -q --qf "%{BUILDTIME:date}" -- "$1" | cut -c 5-11,21-24` HEADERSIZE=`echo "$DESC" | wc -c` f="$1" getsize() { $RPM -q --qf "$1" "$f" | wc -c } writewithsize() { tempvar="%{$3`echo "$1" | sed -e "s/-/}-%{/g"`}\n" size="`getsize "$tempvar"`" echo "$FILEPREF $size $DATE $2/$1" } echo "-r--r--r-- 1 root root $HEADERSIZE $DATE HEADER" echo "-r-xr-xr-x 1 root root 40 $DATE UNINSTALL" echo "dr-xr-xr-x 3 root root 0 $DATE INFO" writewithsize NAME-VERSION-RELEASE INFO writewithsize GROUP INFO writewithsize BUILDHOST INFO writewithsize SOURCERPM INFO if test "$MCFASTRPM" = 0 ; then test "`$RPM -q --qf \"%{DISTRIBUTION}\" \"$f\"`" = "(none)" || writewithsize DISTRIBUTION INFO test "`$RPM -q --qf \"%{VENDOR}\" \"$f\"`" = "(none)" || writewithsize VENDOR INFO test "`$RPM -q --qf \"%{DESCRIPTION}\" \"$f\"`" = "(none)" || writewithsize DESCRIPTION INFO test "`$RPM -q --qf \"%{SUMMARY}\" \"$f\"`" = "(none)" || writewithsize SUMMARY INFO if test "`$RPM -q --qf \"%{RPMTAG_PREIN}%{RPMTAG_POSTIN}%{RPMTAG_PREUN}%{RPMTAG_POSTUN}%{VERIFYSCRIPT}\" \"$f\"`" != "(none)(none)(none)(none)(none)"; then echo "dr-xr-xr-x 1 root root 0 $DATE INFO/SCRIPTS" test "`$RPM -q --qf \"%{RPMTAG_PREIN}\" \"$f\"`" = '(none)' || writewithsize PREIN INFO/SCRIPTS RPMTAG_ test "`$RPM -q --qf \"%{RPMTAG_POSTIN}\" \"$f\"`" = '(none)' || writewithsize POSTIN INFO/SCRIPTS RPMTAG_ test "`$RPM -q --qf \"%{RPMTAG_PREUN}\" \"$f\"`" = '(none)' || writewithsize PREUN INFO/SCRIPTS RPMTAG_ test "`$RPM -q --qf \"%{RPMTAG_POSTUN}\" \"$f\"`" = '(none)' || writewithsize POSTUN INFO/SCRIPTS RPMTAG_ test "`$RPM -q --qf \"%{VERIFYSCRIPT}\" \"$f\"`" = '(none)' || writewithsize VERIFYSCRIPT INFO/SCRIPTS size="`$RPM -q --scripts "$f"|wc -c`" echo "$FILEPREF $size $DATE INFO/SCRIPTS/ALL" fi else writewithsize DISTRIBUTION INFO writewithsize VENDOR INFO writewithsize DESCRIPTION INFO writewithsize SUMMARY INFO echo "dr-xr-xr-x 1 root root 0 $DATE INFO/SCRIPTS" writewithsize PREIN INFO/SCRIPTS RPMTAG_ writewithsize POSTIN INFO/SCRIPTS RPMTAG_ writewithsize PREUN INFO/SCRIPTS RPMTAG_ writewithsize POSTUN INFO/SCRIPTS RPMTAG_ writewithsize VERIFYSCRIPT INFO/SCRIPTS RPMTAG_ size="`$RPM -q --scripts "$f"|wc -c`" echo "$FILEPREF $size $DATE INFO/SCRIPTS/ALL" fi if test "$MCFASTRPM" = 0 ; then test "`$RPM -q --qf \"%{PACKAGER}\" \"$f\"`" = "(none)" || writewithsize PACKAGER INFO test "`$RPM -q --qf \"%{URL}\" \"$f\"`" = "(none)" || writewithsize URL INFO test "`$RPM -q --qf \"%{SERIAL}\" \"$f\"`" = "(none)" || writewithsize SERIAL INFO test "`$RPM -q --qf \"%{COPYRIGHT}\" \"$f\"`" = "(none)" || writewithsize COPYRIGHT INFO test "`$RPM -q --qf \"%{LICENSE}\" \"$f\"`" = "(none)" || writewithsize LICENSE INFO else writewithsize PACKAGER INFO writewithsize URL INFO writewithsize SERIAL INFO writewithsize COPYRIGHT INFO writewithsize LICENSE INFO fi size="`getsize "%{BUILDTIME:date}\n"`" echo "$FILEPREF $size $DATE INFO/BUILDTIME" writewithsize RPMVERSION INFO writewithsize OS INFO size="`getsize "%{SIZE} bytes\n"`" echo "$FILEPREF $size $DATE INFO/SIZE" if test "$MCFASTRPM" != 0 ; then size="`getsize "[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]\n"`" $RPM -q --qf "[%{REQUIRENAME}\n]" "$f" | grep "(none)" > /dev/null || echo "$FILEPREF $size $DATE INFO/REQUIRENAME" size="`getsize "[%{OBSOLETENAME} %|OBSOLETEFLAGS?{%{OBSOLETEFLAGS:depflags} %{OBSOLETEVERSION}}:{}|\n]\n"`" $RPM -q --qf "[%{OBSOLETES}\n]" "$f" | grep "(none)" > /dev/null || echo "$FILEPREF $size $DATE INFO/OBSOLETES" size="`getsize "[%{PROVIDES}\n]\n"`" $RPM -q --qf "[%{PROVIDES}\n]" "$f" | grep "(none)" > /dev/null || echo "$FILEPREF $size $DATE INFO/PROVIDES" size="`getsize "[* %{CHANGELOGTIME:date} %{CHANGELOGNAME}\n%{CHANGELOGTEXT}\n\n]\n"`" test "`$RPM -q --qf \"%{CHANGELOGTEXT}\" \"$f\"`" = "(none)" || echo "$FILEPREF $size $DATE INFO/CHANGELOG" else size="`getsize "[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]\n"`" echo "$FILEPREF $size $DATE INFO/REQUIRENAME" size="`getsize "[%{OBSOLETENAME} %|OBSOLETEFLAGS?{%{OBSOLETEFLAGS:depflags} %{OBSOLETEVERSION}}:{}|\n]\n"`" echo "$FILEPREF $size $DATE INFO/OBSOLETES" size="`getsize "[%{PROVIDES}\n]\n"`" echo "$FILEPREF $size $DATE INFO/PROVIDES" size="`getsize "[* %{CHANGELOGTIME:date} %{CHANGELOGNAME}\n%{CHANGELOGTEXT}\n\n]\n"`" echo "$FILEPREF $size $DATE INFO/CHANGELOG" fi $RPM -qlv -- "$1" | grep '^[A-Za-z0-9-]' } mcrpmfs_copyout () { $RPM -qi -- "$1" >/dev/null 2>&1 || exit 255 case "$2" in HEADER) $RPM -qi -- "$1" > "$3"; exit 0;; UNINSTALL) echo "# Run this to uninstall this RPM package" > "$3"; exit 0;; INFO/NAME-VERSION-RELEASE) $RPM -q --qf "%{NAME}-%{VERSION}-%{RELEASE}\n" -- "$1" > "$3"; exit 0;; INFO/RELEASE) $RPM -q --qf "%{RELEASE}\n" -- "$1" > "$3"; exit 0;; INFO/GROUP) $RPM -q --qf "%{GROUP}\n" -- "$1" > "$3"; exit 0;; INFO/DISTRIBUTION) $RPM -q --qf "%{DISTRIBUTION}\n" -- "$1" > "$3"; exit 0;; INFO/VENDOR) $RPM -q --qf "%{VENDOR}\n" -- "$1" > "$3"; exit 0;; INFO/BUILDHOST) $RPM -q --qf "%{BUILDHOST}\n" -- "$1" > "$3"; exit 0;; INFO/SOURCERPM) $RPM -q --qf "%{SOURCERPM}\n" -- "$1" > "$3"; exit 0;; INFO/DESCRIPTION) $RPM -q --qf "%{DESCRIPTION}\n" -- "$1" > "$3"; exit 0;; INFO/PACKAGER) $RPM -q --qf "%{PACKAGER}\n" -- "$1" > "$3"; exit 0;; INFO/URL) $RPM -q --qf "%{URL}\n" -- "$1" > "$3"; exit 0;; INFO/BUILDTIME) $RPM -q --qf "%{BUILDTIME:date}\n" -- "$1" > "$3"; exit 0;; INFO/SERIAL) $RPM -q --qf "%{SERIAL}\n" -- "$1" > "$3"; exit 0;; INFO/COPYRIGHT) $RPM -q --qf "%{COPYRIGHT}\n" -- "$1" > "$3"; exit 0;; INFO/LICENSE) $RPM -q --qf "%{LICENSE}\n" -- "$1" > "$3"; exit 0;; INFO/RPMVERSION) $RPM -q --qf "%{RPMVERSION}\n" -- "$1" > "$3"; exit 0;; INFO/REQUIRENAME) $RPM -q --qf "[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]\n" -- "$1" > "$3"; exit 0;; INFO/OBSOLETES) $RPM -q --qf "[%{OBSOLETENAME} %|OBSOLETEFLAGS?{%{OBSOLETEFLAGS:depflags} %{OBSOLETEVERSION}}:{}|\n]\n" -- "$1" > "$3"; exit 0;; INFO/PROVIDES) $RPM -q --qf "[%{PROVIDES}\n]\n" -- "$1" > "$3"; exit 0;; INFO/SCRIPTS/PREIN) $RPM -q --qf "%{RPMTAG_PREIN}\n" -- "$1" > "$3"; exit 0;; INFO/SCRIPTS/POSTIN) $RPM -q --qf "%{RPMTAG_POSTIN}\n" -- "$1" > "$3"; exit 0;; INFO/SCRIPTS/PREUN) $RPM -q --qf "%{RPMTAG_PREUN}\n" -- "$1" > "$3"; exit 0;; INFO/SCRIPTS/POSTUN) $RPM -q --qf "%{RPMTAG_POSTUN}\n" -- "$1" > "$3"; exit 0;; INFO/SCRIPTS/VERIFYSCRIPT) $RPM -q --qf "%{VERIFYSCRIPT}\n" -- "$1" > "$3"; exit 0;; INFO/SCRIPTS/ALL) $RPM -q --scripts -- "$1" > "$3"; exit 0;; INFO/SUMMARY) $RPM -q --qf "%{SUMMARY}\n" -- "$1" > "$3"; exit 0;; INFO/OS) $RPM -q --qf "%{OS}\n" -- "$1" > "$3"; exit 0;; INFO/CHANGELOG) $RPM -q --qf "[* %{CHANGELOGTIME:date} %{CHANGELOGNAME}\n%{CHANGELOGTEXT}\n\n]\n" -- "$1" > "$3"; exit 0;; INFO/SIZE) $RPM -q --qf "%{SIZE} bytes\n" -- "$1" > "$3"; exit 0;; *) cp "/$2" "$3" esac } mcrpmfs_run () { $RPM -qi -- "$1" >/dev/null 2>&1 || exit 255 case "$2" in UNINSTALL) echo "Uninstalling $1"; rpm -e -- "$1"; exit 0;; esac } name=`head -n 1 "$2" | sed 's/.*\///;s/\.trpm$//'` case "$1" in list) mcrpmfs_list "$name"; exit 0;; copyout) mcrpmfs_copyout "$name" "$3" "$4"; exit 0;; run) mcrpmfs_run "$name" "$3"; exit 1;; esac exit 1 avfs-1.1.4/extfs/ulha.in0000644000175000001440000001160514032341001011772 00000000000000#! /bin/sh # # LHa Virtual filesystem executive v0.1 # Copyright (C) 1996, 1997 Joseph M. Hinkle # May be distributed under the terms of the GNU Public License # # # Code for mc_lha_fs_run() suggested by: # Jan 97 Zdenek Kabelac # Tested with mc 3.5.18 and gawk 3.0.0 on Linux 2.0.0 # Tested with lha v1.01 and lharc v1.02 # Information and sources for other forms of lha/lzh appreciated # Additional changes for file names with spaces by # 2006-01-17 Ralf Hoffmann # Nota bene: # There are several compression utilities which produce *.lha files. # LHArc and LHa in exist several versions, and their listing output varies. # Another variable is the architecture on which the compressed file was made. # This program attempts to sort out the variables known to me, but it is likely # to display an empty panel if it encounters a mystery. # In that case it will be useful to execute this file from the command line: # ./lha list Mystery.lha # to examine the output directly on the console. The output string must be # precisely in the format described in the README in this directory. # Caveat emptor. # Learn Latin. export LC_ALL=C # Define your awk AWK=@AWK@ # Define which archiver you are using with appropriate options LHA_LIST="lha lq" LHA_GET="lha pq" LHA_PUT="lha aq" # The 'list' command executive mc_lha_fs_list() { # List the contents of the archive and sort it out $LHA_LIST "$1" | $AWK -v uid=`id -nu` -v gid=`id -ng` ' # Print the line this way if there is no permission string $1 ~ /^\[.*\]/ { # Get the filename, everything from seventh field to the end filename = gensub("^[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* (.*)$","\\1","g"); # Strip a leading '/' if present in a filepath if (filename ~ /^\//) { filename = substr(filename,2) } # Invent a generic permission $1 = (filename ~ /\/$/) ? "drwxr-xr-x":"-rwxr--r--"; # Print it if (length(filename) > 0) { printf "%s 1 %-8s %-8s %-8d %s %s %s %s\n", $1, uid, gid, $2, $4, $5, $6, filename; } # Get the next line of the list next; } # Do it this way for a defined permission $1 !~ /^\[.*\]/ { # If the permissions and UID run together if ($1 ~ /\//) { # Get the filename, everything from seventh field to the end filename = gensub("^[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* (.*)$","\\1","g"); $8 = $7; $7 = $6; $6 = $5; $5 = $4; $3 = $2; # Test whether permission is 9 or 10 characters # it wont always work if UID is not numerical if (substr($1,10,1) ~ /[-tTx]/) { $2 = substr($1,11); $1 = substr($1,1,10); } else { $2 = substr($1,10); $1 = substr($1,1,9); } } else { # Get the filename, everything from eighth field to the end filename = gensub("^[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* *[^ ]* (.*)$","\\1","g"); } # Strip a leading '/' if present in a filepath if (filename ~ /^\//) { filename = substr(filename,2) } # If the permission string is missing a type if (length($1) == 9) { if (filename ~ /\/$/) $1 = ("d" $1); else $1 = ("-" $1); } # UID:GID might not be the same as on your system so print numbers # Well, that is the intent. At the moment mc is translating them. split($2, id, "/"); printf "%s 1 %-8d %-8d %-8d %s %s %s %s\n", $1, id[1], id[2], $3, $5, $6, $7, filename; # Get the next line of the list next; } ' } # The 'copyout' command executive to copy displayed files to a destination mc_lha_fs_copyout() { $LHA_GET "$1" "$2" > "$3" } # The 'copyin' command executive to add something to the archive mc_lha_fs_copyin () { NAME2=`basename "$2"`; DIR2=${2%$NAME2} NAME3=`basename "$3"`; DIR3=${3%$NAME3} cd "${DIR3}" ONE2=${2%%/*} [ -n "${ONE2}" ] || exit 1 [ -e "${ONE2}" ] && exit 1 [ -e "${DIR2}" ] || mkdir -p "${DIR2}" ln "$3" "$2" || exit 1 $LHA_PUT "$1" "$2" rm -r "${ONE2}" } # The 'run' command executive to run a command from within an archive mc_lha_fs_run() { TMPDIR=`mktemp -d "${MC_TMPDIR:-/tmp}/mctmpdir-ulha.XXXXXX"` || exit 1 trap 'rm -rf "$TMPDIR"; exit 0' 1 2 3 4 15 TMPCMD=$TMPDIR/run $LHA_GET "$1" "$2" > $TMPCMD chmod a+x "$TMPCMD" "$TMPCMD" rm -rf "$TMPDIR" } # The main routine umask 077 cmd="$1" shift case "$cmd" in list) mc_lha_fs_list "$@" ;; copyout) mc_lha_fs_copyout "$@" ;; copyin) mc_lha_fs_copyin "$@" ;; run) mc_lha_fs_run "$@" ;; *) exit 1 ;; esac exit 0 avfs-1.1.4/extfs/deb.in0000644000175000001440000001201414032341001011566 00000000000000#! @PERL@ # # Written by Fernando Alegre 1996 # # Applied patch by Dimitri Maziuk 1997 # (to handle new tar format) # # Modified by Fernando Alegre 1997 # (to handle both new and old tar formats) # # Modified by Patrik Rak 1998 # (add by Michael Bramer Debian-mc-maintainer ) # (to allow access to package control files) # # Modified by Martin Bialasinski 1999 # (deal with change in tar format) # # # Copyright (C) 1997 Free Software Foundation # sub quote { $_ = shift(@_); s/([^\w\/.+-])/\\$1/g; return($_); } sub mcdebfs_list { # # CAVEAT: Hard links are listed as if they were symlinks # Empty directories do not appear at all # local($archivename)=@_; local $qarchivename = quote($archivename); chop($date=`LC_ALL=C date "+%b %d %Y %H:%M"`); chop($info_size=`dpkg -I $qarchivename | wc -c`); $install_size=length($pressinstall); print "dr-xr-xr-x 1 root root 0 $date CONTENTS\n"; # from Patrik Rak print "dr-xr-xr-x 1 root root 0 $date DEBIAN\n"; print "-r--r--r-- 1 root root $info_size $date INFO\n"; print "-r-xr--r-- 1 root root $install_size $date INSTALL\n"; if ( open(PIPEIN, "dpkg-deb -c $qarchivename |") ) { while() { split; $perm=$_[0]; $owgr=$_[1]; $size=$_[2]; if($_[3] =~ /^\d\d\d\d\-/) { # New tar format ($year,$mon,$day) = split(/-/,$_[3]); $month = ("Gee","Jan","Feb","Mar","Apr","May","Jun", "Jul","Aug","Sep","Oct","Nov","Dec")[$mon] || "Gee"; $time=$_[4]; $pathindex=5; } else { $month=$_[3]; $day=$_[4]; $time=$_[5]; $year=$_[6]; $pathindex=7; } $path=$_[$pathindex++]; $arrow=$_[$pathindex++]; $link=$_[$pathindex++]; $link2=$_[$pathindex++]; $owgr=~s!/! !; next if $path=~m!/$!; if($arrow eq 'link') { # report hard links as soft links $arrow='->'; $link="/$link2"; substr($perm, 0, 1) = "l"; } if($arrow ne '') { $arrow=' ' . $arrow; $link= ' ' . $link; } print "$perm 1 $owgr $size $month $day $year $time CONTENTS/$path$arrow$link\n"; } } # begin from Patrik Rak if ( open(PIPEIN, "dpkg-deb -I $qarchivename |") ) { while() { split; $size=$_[0]; last if $size =~ /:/; next if $size !~ /\d+/; if($_[4] eq '*') { $perm='-r-xr-xr-x'; $name=$_[5]; } else { $perm='-r--r--r--'; $name=$_[4]; } print "$perm 1 root root $size $date DEBIAN/$name\n"; } } # end from Patrik Rak } sub mcdebfs_copyout { local($archive,$filename,$destfile)=@_; local $qarchive = quote($archive); local $qfilename = quote($filename); local $qdestfile = quote($destfile); if($filename eq "INFO") { system("dpkg-deb -I $qarchive > $qdestfile"); # begin from Patrik Rak } elsif($filename =~ /^DEBIAN/) { $qfilename=~s!^DEBIAN/!!; system("dpkg-deb -I $qarchive $qfilename > $qdestfile"); # end from Patrik Rak } elsif($filename eq "INSTALL") { if ( open(FILEOUT,">$destfile") ) { print FILEOUT $pressinstall; close FILEOUT; system("chmod a+x $qdestfile"); } } else { # files can be prepended with ./ or not, depending on the version of tar $qfilename=~s!^CONTENTS/!!; system("dpkg-deb --fsys-tarfile $qarchive | tar xOf - $qfilename ./$qfilename > $qdestfile 2>/dev/null"); } } sub mcdebfs_run { local($archive,$filename)=@_; local $qarchive = quote($archive); if($filename eq "INSTALL") { print "Installing $archive\n"; system("dpkg -i $qarchive"); } else { use File::Temp qw(mkdtemp); my $template = "/tmp/mcdebfs.run.XXXXXX"; $template="$ENV{MC_TMPDIR}/mcdebfs.XXXXXX" if ($ENV{MC_TMPDIR}); $tmpdir = mkdtemp($template); $tmpcmd="$tmpdir/run"; &mcdebfs_copyout($archive, $filename, $tmpcmd); system("chmod u+x $tmpcmd"); system($tmpcmd); unlink($tmpcmd); rmdir($tmpdir); } } $pressinstall=< April 2000 # (to allow spaces in filenames) # # It's assumed that lslR was generated in C locale. LC_ALL=C export LC_ALL=C AWK=@AWK@ mclslRfs_list () { case "$1" in *.bz2) MYCAT="bzip2 -dc";; *.gz) MYCAT="gzip -dc";; *.z) MYCAT="gzip -dc";; *.Z) MYCAT="gzip -dc";; *) MYCAT="cat";; esac $MYCAT "$1" | $AWK ' BEGIN { dir=""; # Pattern to match 8 first fields. rx = "[^ ]+[ ]+"; rx = "^" rx rx rx rx rx rx rx rx; } /^total\ [0-9]*$/ { next } /^$/ { next } /^[^ ].*:$/ { if ($0 ~ /^\//) dir=substr($0, 2); else dir=$0; if (dir ~ /\/:$/) sub(/:$/, "", dir); else sub(/:$/, "/", dir); next; } ( $9 != "" ) { # gensub() is not portable. name=$0 sub(rx, "", name) # Cannot assign to $9, or spaces in the filename would be reduced. attr=substr($0, 1, length($0)-length(name)) printf "%s%s%s\n", attr, dir, name }' } case "$1" in list) mclslRfs_list "$2"; exit 0;; esac exit 1 avfs-1.1.4/extfs/uextrar.in0000644000175000001440000000632514032341001012536 00000000000000#! /bin/sh # # Written by andrey joukov # (C) 1996 2:5020/337.13@fidonet.org # Updated by christian.gennerat@alcatel.fr 1999 # Andrew V. Samoilov 2000 # Updated by ralf@boomerangsworld.de 2015 # beta version 2.0 # # rar and unrar can be found on http://www.rarlabs.com/ RAR=rar UNRAR=$RAR # Prefer unrar (freeware). Try to find unrar in $PATH. save_IFS="$IFS"; IFS=: for dir in $PATH; do IFS="$save_IFS" test -z "$dir" && dir=. if test -x "$dir/unrar" -a -f "$dir/unrar"; then UNRAR="$dir/unrar" break fi done mcrarfs_list () { $UNRAR v -c- "$1" | @AWK@ -v uid=$(id -ru) ' BEGIN { flag=0; date="JanFebMarAprMayJunJulAugSepOctNovDec"; rarv5=0; } /^RAR 5/ { if (flag == 0) { rarv5 = 1; } } /^UNRAR 5/ { if (flag == 0) { rarv5 = 1; } } /^-------/ { flag++; if (flag > 1) exit 0; next } { if (flag == 0) next if ( rarv5 == 1 ) { split($5, a, "-") if (a[3] < 50) a[3] = 2000 + a[3] else a[3] = 1900 + a[3] if (match($0,"[0-9][0-9]:[0-9][0-9] *[0-9A-F]{8} ")) { str = substr($0, RSTART + RLENGTH); str = substr(str, 0, length(str) - 1); } else str = ""; printf "%s 1 %-8d %-8d %8d %3s %2d %4d %s %s\n", $1, uid, 0, $2, substr(date, (a[2]-1)*3+1, 3), a[1], a[3], $6, str } else { if ( !/ [0-9][0-9]:[0-9][0-9] /) str = $0 # there is no time spec in this line else { if (str ~ /^\^/) str=substr(str, 2) split($4, a, "-") if (a[3] < 50) a[3] = 2000 + a[3] else a[3] = 1900 + a[3] if (index($6, "D") != 0) $6="drwxr-xr-x" else if (index($6, ".") != 0) $6="-rw-r--r--" printf "%s 1 %-8d %-8d %8d %3s %2d %4d %s %s\n", $6, uid, 0, $1, substr(date, (a[2]-1)*3+1, 3), a[1], a[3], $5, str } } }' } mcrarfs_copyin () { # copyin by christian.gennerat@alcatel.fr # preserve pwd. It is clean, but is it necessary? pwd=`pwd` # Create a directory and copy in it the tmp file with the good name mkdir "$3.dir" || exit 1 cd "$3.dir" di="${2%/*}" # if file is to be written upper in the archive tree, make fake dir if test x"$di" != x"${2##*/}" ; then mkdir -p "$di" || exit 1 fi cp -fp "$3" "$3.dir/$2" $RAR a "$1" "$2" >/dev/null cd "$pwd" rm -rf "$3.dir" } mcrarfs_copyout () { $UNRAR p -c- -inul "$1" "$2" > "$3" } mcrarfs_mkdir () { # preserve pwd. It is clean, but is it necessary? pwd=`pwd` # Create a directory and create in it a tmp directory with the good name dir=`mktemp -d "${MC_TMPDIR:-/tmp}/mctmpdir-urar.XXXXXX"` || exit 1 cd "$dir" mkdir -p "$2" || exit 1 # rar cannot create an empty directory touch "$2"/.rarfs $RAR a -r "$1" "$2" >/dev/null $RAR d "$1" "$2/.rarfs" >/dev/null cd "$pwd" rm -rf "$dir" } mcrarfs_rm () { $RAR d "$1" "$2" >/dev/null } umask 077 cmd="$1" shift case "$cmd" in list) mcrarfs_list "$@" | sort -k 10 ;; # rar lists directories # after files, so sort names # to prevent duplication rm) mcrarfs_rm "$@" ;; rmdir) mcrarfs_rm "$@" ;; mkdir) mcrarfs_mkdir "$@" ;; copyin) mcrarfs_copyin "$@" ;; copyout) mcrarfs_copyout "$@" ;; *) exit 1 ;; esac exit 0 avfs-1.1.4/extfs/uha.in0000644000175000001440000000171214032341001011614 00000000000000#! /bin/sh # # It is the uhafs Valery Kornienkov vlk@st.simbirsk.su 2:5051/30@fidonet # ver 0.1 Thu Apr 6 12:05:08 2000 # # Tested with HA 0.999. Source of ha can be found at # ftp://ftp.ibiblio.org/pub/Linux/utils/compress/ HA=ha mchafs_list () { $HA lf "$1" 2>/dev/null | @AWK@ -v uid=$(id -ru) ' /^===========/ {next} { if ($5="%" && $8~/DIR|ASC|HSC|CPY/) { split($6, a, "-") split($7, t, ":") filename=$1 filesize=$2 getline if ($2=="(none)") $2="" path=$2 getline if ($1~/^d.*/) next printf "%s %s %-8d %-8d %8d %s-%s-%s %s:%s %s%s\n",\ $1,1,0,0,filesize,a[3],a[2],a[1],t[1],t[2],path,filename } }' } mchafs_copyout () { TMPDIR=`mktemp -d "${MC_TMPDIR:-/tmp}/mctmpdir-uha.XXXXXX"` || exit 1 cd "$TMPDIR" $HA xyq "$1" "$2" >/dev/null cat "$2" > "$3" cd / rm -rf "$TMPDIR" } cmd="$1" shift case "$cmd" in list) mchafs_list "$@" ;; copyout) mchafs_copyout "$@" ;; *) exit 1 ;; esac exit 0 avfs-1.1.4/extfs/ucpio0000755000175000001440000000223214032341001011552 00000000000000#! /bin/sh # # Written by Stas Maximov 1998 SVR4 (UnixWare) # stmax@u213.srcc.msu.su # (C) 1996 The Free Software Foundation. # # uni_cat () # $1 is the archive name { case "$1" in *.cpio.Z) compress -dc "$1" ;; *.cpio.gz) gzip -dc "$1" ;; *) cat "$1" ;; esac } mccpiofs_list () # $1 is the archive name { uni_cat "$1" | cpio -itv | /usr/bin/awk ' { if (substr($9,length($9),1) == ",") { tmp = substr($9, 1, length($9)-1); $9 = $8; $8 = tmp } else if (substr($10,length($10),1) == ",") { tmp = substr($10, 1, length($10)-1); $10 = $9 $9 = tmp } print $0 }' } mccpiofs_copyout () # $1 is the archive name # $2 is a name of a file within the archive # $3 is a name of a file within the system (to add from or extract to) { TMPDIR=/tmp/mctmpdir.$$ # FIXME: TMP RACE: when mkdir fails, we go there, anyway mkdir $TMPDIR uni_cat "$1" | (cd $TMPDIR; cpio -iumd "$2"; mv "$2" "$3") 2>/dev/null rm -rf $TMPDIR } # # main # umask 077 case "$1" in list) mccpiofs_list $2 exit 0 ;; copyout) mccpiofs_copyout $2 $3 $4 exit 0 ;; esac exit 1 avfs-1.1.4/extfs/ftplist0000755000175000001440000000442314032341001012124 00000000000000#! /bin/sh # This fs implements a simple database of your favourite ftp servers. # The `archive' is a text file containing a list of ftp URL's one per line # like this (followed optionaly by name under which the link will be # shown - shouldn't contain spaces inside) # ## ftp://sunsite.unc.edu/pub/Linux sunsite ## ftp://tsx-11.mit.edu/pub/linux tsx-11 ## ftp://ftp.cvut.cz/pub/linux cvut ## ftp://jj@jfch.vc.cvut.cz:21/ my_machine # # You should refer only to directories, not to particular files. # The file has to use `ftplist' extension (if you don't like it, change # it in mc.ext resp. $HOME/.mc/ext). So the file name should match # regex ^.*ftplist$ # # If you add "#define WANT_PARSE" to main.c you will be able to hit return # on the filenames in order to connect to the ftp servers. # mcftplistfs_list () { { ls -l $1; cat $1; } | gawk -v uid=$(id -ru) ' /^[\ \ ]*(#.*)?$/ { next } { if (NF > 8) { a[1]=$6 a[2]=$7 a[3]=$8 next } if ($1 ~ /^(ftp|http|ssh):\/\//) { if ($1 ~ /\/$/) { a[4]=substr($1, index($1,":")+3, length($1) - index($1,":")-3) } else { a[4]=substr($1, index($1,":")+3) } if ($1 ~ /^http:/) { i = split($1, b, "/") a[5]=b[1] for (j=2; j <= i; j++) a[5] = sprintf("%s|%s",a[5],b[j]) } else a[5]=sprintf("%s%s/",substr($1,1,index($1,":")),a[4]); if (NF >= 2) a[4]=$2 else { i=split(a[4], b, "/") a[4]=b[1] for (j = 2; j <= i; j++) a[4]=sprintf("%s_%s", a[4], b[j]) } printf "lrwxrwxrwx 1 %-8d %-8d %8d %s %2d %5s %s -> /#%s\n", uid, 0, length(a[5]), a[1], a[2], a[3], a[4], a[5] } }' 2>/dev/null } mcftplistfs_run () { if [ -n "$MC_CONTROL_FILE" ] then cat $1 | gawk -v name=$2 ' /^[\ \ ]*(#.*)?$/ { next } { if ($1 ~ /^ftp:\/\//) { if ($1 ~ /\/$/) { a[4]=substr($1, 7, length($1) - 7) a[5]=$1 } else { a[4]=substr($1, 7) a[5]=sprintf("%s/", $1) } if (NF >= 2) a[4]=$2 else { i=split(a[4], b, "/") a[4]=b[1] for (j = 2; j <= i; j++) a[4]=sprintf("%s_%s", a[4], b[j]) } if (a[4] ~ name) printf "cd %s\n", a[5] } }' 2>/dev/null > $MC_CONTROL_FILE fi } export LC_ALL=C case "$1" in list) mcftplistfs_list $2; exit 0;; run) mcftplistfs_run $2 $3; exit 0;; esac exit 1 avfs-1.1.4/extfs/uxpk.in0000644000175000001440000000510214032341001012023 00000000000000#! /bin/sh # # Written by Ralf Hoffmann # uxpk 0.9.0 # # (C) 2006 Ralf Hoffmann # May be distributed under the terms of the GNU General # Public License V2 or higher # # XPK handler (http://www.jormas.com/~vesuri/xpk) # # Note: copyout uses xUp to uncompress the file. It requires # a temp directory to store a copy of the original file # because xUp replaces it with the uncompressed version # xType would be much better but unfortunatly doesn't work # correctly for some files # # The draft of XPK states that it's possible to use archives # but the current implementation only works on files. Since extfs # represents a virtual directory I output two entries plus a stat # file. The two entries are of the same content but one has a fixed # name (CONTENT) and the other uses the file name itself. XPKCAT=xType XPKDIR=xDir XPKUNCOMPRESS=xUp AWK=@AWK@ extfs_xpk_list () { if test -f "$1"; then t=$(ls -l "$1" | $AWK '{print $6, $7, $8}') name=$(basename "$1") $XPKDIR "$1" | $AWK -v time="$t" -v name="$name" \ '{ if ( FNR == 3 && NF >= 5 ) { "id -nu" | getline uid; "id -ng" | getline gid; printf "-r-------- 1 %-8s %-8s %-8d %s %s\n", uid, gid, $1, time, name; printf "-r-------- 1 %-8s %-8s %-8d %s %s\n", uid, gid, $1, time, "CONTENT"; printf "-r-------- 1 %-8s %-8s %-8d %s %s\n", uid, gid, 0, time, "STAT"; } }' fi } extfs_xpk_copyout () { name=$(basename "$1") if test "$2" = "$name" -o "$2" = "CONTENT"; then # This can be used if xType works correctly again # $XPKCAT "$1" > "$3" TMPDIR=`mktemp -u "${MC_TMPDIR:-/tmp}/extfstmpdir-uxpk.XXXXXX"` || exit 1 trap 'if test -n "$TMPDIR"; then rm -rf "$TMPDIR"; fi; exit 0' 1 2 3 4 15 mkdir -m 0700 "$TMPDIR" || exit 1 cp "$1" "$TMPDIR" cd "$TMPDIR" && $XPKUNCOMPRESS "$name" >/dev/null && cat "$name" > "$3" rm -rf "$TMPDIR" trap 1 2 3 4 15 elif test "$2" = "STAT"; then $XPKDIR "$1" > "$3" fi } # override any locale for dates LC_ALL=C export LC_ALL umask 077 case "$1" in list) extfs_xpk_list "$2" ;; copyout) shift extfs_xpk_copyout "$@" ;; *) echo "extfs_xpk: unknown command: \"$1\"." 1>&2 exit 1 ;; esac exit 0 avfs-1.1.4/extfs/uimg0000644000175000001440000001310114032341001011366 00000000000000#!/bin/bash # This is a parser for DOS/Atari disk images in Midnight Commander. You # need the GPL mtools program (version >= 3.9.9) written by Emmet P. Gray, # Viktor Dukhovni, Alain Knaff and David Niemi. # Author: Guus Jansman # Limitations: # - Only the 1st primary harddisk partition and floppy images can be read # - File attributes are not preserved. # - Filenames containing non-ascii characters may cause problems (check mtools info). # Alternative programs (not supported by this script): # + Mounting a loop device (one has to have proper rights though). # + XMess's imgtool (less powerfull). # + Gilles Vollant's extract (DOS program, less powerful) # + bximage (disk image creation, part of Bochs) # Settings: SIZE=1.44m # Only needed for creating a disk image TEMPRCFILE=/tmp/mctmpfile-uimg.$USER.${RANDOM} LISTIMG="mdir -/ -a -f" ATTRIBIMG="mattrib" ADDIMG="mcopy -pm -D o" DELETEIMG="mdel" EXTRACTIMG="mcopy" MKDIRIMG="mmd" RMDIRIMG="mrd" TESTIMG="minfo" CREATEIMG="mformat -C" CONFIGIMG="mtoolstest" case "$SIZE" in 160*) CREATEIMG="$CREATEIMG -f 160" # 12/40/1/8 ;; 180*) CREATEIMG="$CREATEIMG -f 180" # 12/40/1/9 ;; 320*) CREATEIMG="$CREATEIMG -f 320" # 12/40/2/8 ;; 360*) CREATEIMG="$CREATEIMG -f 360" # 12/40/2/9 ;; 720*) CREATEIMG="$CREATEIMG -f 720" # 12/80/2/9 ;; 800*) CREATEIMG="$CREATEIMG -t 80 -h 2 -n 10" # 12/80/2/10 ;; 1.2*) CREATEIMG="$CREATEIMG -f 1200" # 12/80/2/15 ;; 1.4*) CREATEIMG="$CREATEIMG -f 1440" # 12/80/2/18 ;; 2.8*) CREATEIMG="$CREATEIMG -f 2880" # 12/80/2/36 ;; *) CREATEIMG="$CREATEIMG -f 1440" # 12/80/2/18 ;; esac drives="ABCDEFGHIJKLMNOPQRSTUVWXYZ" createmtoolsrc () { # Find a free drive letter useddrives="`$CONFIGIMG | grep -e '^drive [A-Z]:.*' | sed -e 's/drive \(.\):.*/\1/'`" for (( drivenum=2 ; drivenum != 25 ; drivenum++ )) ; do DRIVE=${drives:drivenum:1} if [[ $useddrives == ${useddrives/$DRIVE/1} ]]; then break; # Found a free drive letter fi done if [[ drivenum == 25 ]]; then exit 1; # Could not find a free drive letter fi DRIVE="${DRIVE}:" # Create temporary settings file rm -f $TEMPRCFILE ; touch $TEMPRCFILE echo MTOOLS_LOWER_CASE=0 >> $TEMPRCFILE echo MTOOLS_TWENTY_FOUR_HOUR_CLOCK=1 >> $TEMPRCFILE echo "drive $DRIVE" >> $TEMPRCFILE echo " file=\"$1\"" >> $TEMPRCFILE echo " mformat_only" >> $TEMPRCFILE if [[ -e "$1" && "`wc -c "$1" | sed -e 's/[ ]*\([^ ]*\).*$/\1/'`" -gt "4194304" ]]; then echo " partition=1" >> $TEMPRCFILE fi # Set environment variable export MTOOLSRC=$TEMPRCFILE } deletemtoolsrc () { rm -f $TEMPRCFILE } mcimgfs_list () { createmtoolsrc "$1" $LISTIMG $DRIVE/ | gawk -v uid=${UID-0} ' BEGIN { direntry=0; date="JanFebMarAprMayJunJulAugSepOctNovDec" } /^Directory for / { direntry=1 } /[ ]*[0-9][0-9]* file/ { direntry=0 ; next } /^$/ { next } /^\./ { next } // { if (direntry == 0) next } { if (index($0, "Directory for ") == 1) { curdir=substr($0, 18) } else { tm=substr($0, 36, 5) year=substr($0, 24, 4) month=substr(date, (substr($0, 29, 2)-1)*3 + 1, 3) day=substr($0, 32, 2) if (length($0) > 43) { str=substr($0, 43) } else { str=substr($0, 1, 8) while (substr(str, length(str), 1) == " ") { str=substr(str, 1, length(str) - 1) } if (substr($0, 10, 3) != " ") { str=(str "." $2) } } if (length(curdir) != 0) { str=(curdir "/" str) } if (substr($0, 14, 5) == "") { perm="drwxr-xr-x" sz=0 } else { perm="-rw-r--r--" sz=substr($0, 14, 9) } printf "%s 1 %-8d %-8d %8d %3s %2d %4d %s %s\n", perm, uid, 0, sz, month, day, year, tm, str } }' deletemtoolsrc } mcimgfs_copyin () { createmtoolsrc "$1" $ADDIMG "$3" "$DRIVE/$2" >/dev/null deletemtoolsrc } mcimgfs_copyout () { createmtoolsrc "$1" $EXTRACTIMG "$DRIVE/$2" - > "$3" 2>/dev/null deletemtoolsrc } mcimgfs_rm () { createmtoolsrc "$1" $ATTRIBIMG -r "$DRIVE/$2" >/dev/null $DELETEIMG "$DRIVE/$2" >/dev/null deletemtoolsrc "$1" } mcimgfs_mkdir () { createmtoolsrc "$1" $MKDIRIMG "$DRIVE/$2" >/dev/null 2>/dev/null deletemtoolsrc } mcimgfs_rmdir () { createmtoolsrc "$1" $RMDIRIMG "$DRIVE/$2" >/dev/null 2>/dev/null deletemtoolsrc } mcimgfs_test () { createmtoolsrc "$1" if $TESTIMG $DRIVE >/dev/null 2>&1; then echo "OK" else echo "UNKNOWN" fi deletemtoolsrc } mcimgfs_create () { createmtoolsrc "$1" $CREATEIMG $DRIVE >/dev/null deletemtoolsrc } umask 077 cmd="$1" shift case "$cmd" in list) mcimgfs_list "$@" ;; rm) mcimgfs_rm "$@" ;; copyin) mcimgfs_copyin "$@" ;; copyout) mcimgfs_copyout "$@" ;; mkdir) mcimgfs_mkdir "$@" ;; rmdir) mcimgfs_rmdir "$@" ;; # test) mcimgfs_test "$@" ;; # Not supported by MC extfs # create) mcimgfs_create "$@" ;; # Not supported by MC extfs *) exit 1 ;; esac exit 0 avfs-1.1.4/extfs/apt.in0000644000175000001440000002276714032341001011640 00000000000000#! @PERL@ # # 1999 (c) Piotr Roszatycki # This software is under GNU license # last modification: 1999-12-08 # # apt sub quote { $_ = shift(@_); s/([^\w\/.+-])/\\$1/g; return($_); } sub bt { my ($dt) = @_; my (@time); @time = localtime($dt); $bt = sprintf "%02d-%02d-%d %02d:%02d", $time[4] + 1, $time[3], $time[5] + 1900, $time[2], $time[1]; return $bt; } sub ft { my ($f) = @_; return "d" if -d $f; return "l" if -l $f; return "p" if -p $f; return "S" if -S $f; return "b" if -b $f; return "c" if -c $f; return "-"; } sub fm { my ($n) = @_; my ($m); if( $n & 0400 ) { $m .= "r"; } else { $m .= "-"; } if( $n & 0200 ) { $m .= "w"; } else { $m .= "-"; } if( $n & 04000 ) { $m .= "s"; } elsif( $n & 0100 ) { $m .= "x"; } else { $m .= "-"; } if( $n & 0040 ) { $m .= "r"; } else { $m .= "-"; } if( $n & 0020 ) { $m .= "w"; } else { $m .= "-"; } if( $n & 02000 ) { $m .= "s"; } elsif( $n & 0010 ) { $m .= "x"; } else { $m .= "-"; } if( $n & 0004 ) { $m .= "r"; } else { $m .= "-"; } if( $n & 0002 ) { $m .= "w"; } else { $m .= "-"; } if( $n & 01000 ) { $m .= "t"; } elsif( $n & 0001 ) { $m .= "x"; } else { $m .= "-"; } return $m; } sub ls { my ($file,$path,$mode) = @_; if (-f $file) { my @stat = stat(_); # mode, nlink, uid, gid, size, mtime, filename printf "%s %d %d %d %d %s %s\n", $mode || ft($file).fm($stat[2] & 07777), $stat[3], $stat[4], $stat[5], $stat[7], bt($stat[9]), $path; } } $DATE=bt(time()); sub list { my ($pkg, $fn, $dn, $sz, $bt); my($check,$stats,$config); chop($check = `apt-get -q check 2>/dev/null`); chop($available = `apt-cache dumpavail 2>/dev/null`); chop($stats = `apt-cache stats 2>/dev/null`); chop($config = `apt-config dump 2>&1`); $sz = length($check); print "-r--r--r-- 1 root root $sz $DATE CHECK\n"; $sz = length($available); print "-r--r--r-- 1 root root $sz $DATE AVAILABLE\n"; $sz = length($stats); print "-r--r--r-- 1 root root $sz $DATE STATS\n"; $sz = length($config); print "-r--r--r-- 1 root root $sz $DATE CONFIG\n"; $sz = length($pressupdate); print "-r-xr--r-- 1 root root $sz $DATE UPDATE\n"; $sz = length($pressupgrade); print "-r-xr--r-- 1 root root $sz $DATE UPGRADE\n"; print "-r-xr--r-- 1 root root $sz $DATE DIST-UPGRADE\n"; ls("/etc/apt/sources.list","sources.list"); ls('/etc/apt/apt.conf','apt.conf') if (-f '/etc/apt/apt.conf'); print "drwxr-xr-x 1 root root 0 $DATE all\n"; if ( open(PIPEIN, "find /var/cache/apt/archives -type f |") ) { while() { chop; next if /\/lock$/; my $file = $_; s%/var/cache/apt/archives/%CACHE/%; ls($file, $_); } close PIPEIN; } my %sects = (); my %debd = (); my %deba = (); open STAT, "/var/lib/dpkg/status" or exit 1; while( ) { chop; if( /^([\w-]*): (.*)/ ) { $pkg = $2 if( lc($1) eq 'package' ); $debd{$pkg}{lc($1)} = $2; } } close STAT; foreach $pkg (sort keys %debd) { next if $debd{$pkg}{status} =~ /not-installed/; $fn = $debd{$pkg}{package}. "_". $debd{$pkg}{version}; $dn = $debd{$pkg}{section}; if( ! $dn ) { $dn = "unknown"; } elsif( $dn =~ /^(non-us)$/i ) { $dn .= "/main"; } elsif( $dn !~ /\// ) { $dn = "main/". $dn; } unless( $sects{$dn} ) { my $sub = $dn; while( $sub =~ s!^(.*)/[^/]*$!$1! ) { unless( $sects{$sub} ) { print "drwxr-xr-x 1 root root 0 $DATE $sub/\n"; $sects{$sub} = 1; } } print "drwxr-xr-x 1 root root 0 $DATE $dn/\n"; $sects{$dn} = 1; } $sz = $debd{$pkg}{'status'} =~ /config-files/ ? 0 : $debd{$pkg}{'installed-size'} * 1024; @stat = stat("/var/lib/dpkg/info/".$debd{$pkg}{package}.".list"); $bt = bt($stat[9]); print "-rw-r--r-- 1 root root $sz $bt $dn/$fn.debd\n"; print "lrwxrwxrwx 1 root root $sz $bt all/$fn.debd -> ../$dn/$fn.debd\n"; } open STAT, "apt-cache dumpavail |" or exit 1; while( ) { chop; if( /^([\w-]*): (.*)/ ) { $pkg = $2 if( lc($1) eq 'package' ); $deba{$pkg}{lc($1)} = $2; } } close STAT; foreach $pkg (sort keys %deba) { next if $deba{$pkg}{version} eq $debd{$pkg}{version}; $fn = $deba{$pkg}{package}. "_". $deba{$pkg}{version}; $dn = $deba{$pkg}{section}; if( ! $dn ) { $dn = "unknown"; } elsif( $dn =~ /^(non-us)$/i ) { $dn .= "/main"; } elsif( $dn !~ /\// ) { $dn = "main/". $dn; } unless( $sects{$dn} ) { my $sub = $dn; while( $sub =~ s!^(.*)/[^/]*$!$1! ) { unless( $sects{$sub} ) { print "drwxr-xr-x 1 root root 0 $DATE $sub/\n"; $sects{$sub} = 1; } } print "drwxr-xr-x 1 root root 0 $DATE $dn/\n"; $sects{$dn} = 1; } $sz = $deba{$pkg}{'status'} =~ /config-files/ ? 0 : $deba{$pkg}{'installed-size'} * 1024; print "-rw-r--r-- 1 root root $sz $DATE $dn/$fn.deba\n"; print "lrwxrwxrwx 1 root root $sz $DATE all/$fn.deba -> ../$dn/$fn.deba\n"; } } sub copyout { my($archive,$filename) = @_; my $qarchive = quote($archive); my $qfilename = quote($filename); if( $archive eq 'CHECK' ) { system("apt-get -q check > $qfilename"); } elsif( $archive eq 'AVAILABLE' ) { system("apt-cache dumpavail > $qfilename"); } elsif( $archive eq 'STATS' ) { system("apt-cache stats > $qfilename"); } elsif( $archive eq 'CONFIG' ) { system("(apt-config dump 2>&1) > $qfilename"); } elsif( $archive eq 'UPDATE' ) { open O, ">$filename"; print O $pressupdate; close O; } elsif( $archive eq 'UPGRADE' || $archive eq 'DIST-UPGRADE' ) { open O, ">$filename"; print O $pressupgrade; close O; } elsif( $archive eq 'apt.conf' ) { system("cp /etc/apt/apt.conf $qfilename"); } elsif( $archive eq 'sources.list' ) { system("cp /etc/apt/sources.list $qfilename"); } elsif( $archive =~ /^CACHE\// ) { $archive =~ s%^CACHE/%/var/cache/apt/archives/%; system("cp $qarchive $qfilename"); } else { open O, ">$filename"; print O $archive, "\n"; close O; } } sub copyin { my($archive,$filename) = @_; my $qarchive = quote($archive); my $qfilename = quote($filename); if( $archive =~ /\.deb$/ ) { system("dpkg -i $qfilename>/dev/null"); } elsif( $archive eq 'apt.conf' ) { system("cp $qfilename /etc/apt/apt.conf"); } elsif( $archive eq 'sources.list' ) { system("cp $qfilename /etc/apt/sources.list"); } elsif( $archive =~ /^CACHE\// ) { $qarchive =~ s%^CACHE/%/var/cache/apt/archives/%; system("cp $qfilename $qarchive"); } else { die "extfs: cannot create regular file \`$archive\': Permission denied\n"; } } sub run { my($archive,$filename) = @_; if( $archive eq 'UPDATE' ) { system("apt-get update"); } elsif( $archive eq 'UPGRADE' ) { system("apt-get upgrade -u"); } elsif( $archive eq 'DIST-UPGRADE' ) { system("apt-get dist-upgrade -u"); } else { die "extfs: $archive: command not found\n"; } } sub rm { my($archive) = @_; my $qarchive = quote($archive); if( $archive =~ /^CACHE\// ) { $qarchive =~ s%^CACHE/%/var/cache/apt/archives/%; system("rm -f $qarchive"); } elsif( $archive eq 'apt.conf' ) { system("rm -f /etc/apt/apt.conf"); } elsif( $archive eq 'sources.list' ) { system("rm -f /etc/apt/sources.list"); } elsif( $archive =~ /\.debd?$/ ) { # uncommented and changed to use dpkg - alpha my $qname = $qarchive; $qname =~ s%.*/%%g; $qname =~ s%_.*%%g; system("dpkg --remove $qname >/dev/null"); die("extfs: $archive: Operation not permitted\n") if $? != 0; } else { die "extfs: $archive: Operation not permitted\n"; } } $pressupdate=<, 2002 # # Extfs to handle patches in context and unified diff format. # Known issues: When name of file to patch is modified during editing, # hunk is duplicated on copyin. It is unavoidable. use bytes; use strict; use POSIX; use File::Temp 'tempfile'; # standard binaries my $bzip = 'bzip2'; my $gzip = 'gzip'; my $fileutil = 'file'; # date parsing requires Date::Parse from TimeDate module my $parsedates = eval 'require Date::Parse'; # regular expressions my $unified_header=qr/^--- .*\n\+\+\+ .*\n@@ .* @@.*\n$/; my $unified_extract=qr/^--- ([^\s]+).*\n\+\+\+ ([^\s]+)\s*([^\t\n]*)/; my $unified_contents=qr/^([+\-\\ \n]|@@ .* @@)/; my $context_header=qr/^\*\*\* .*\n--- .*\n\*{15}\n$/; my $context_extract=qr/^\*\*\* ([^\s]+).*\n--- ([^\s]+)\s*([^\t\n]*)/; my $context_contents=qr/^([!+\-\\ \n]|-{3} .* -{4}|\*{3} .* \*{4}|\*{15})/; my $ls_extract_id=qr/^[^\s]+\s+[^\s]+\s+([^\s]+)\s+([^\s]+)/; my $basename=qr|^(.*/)*([^/]+)$|; sub patchfs_canonicalize_path ($) { my ($fname) = @_; $fname =~ s,/+,/,g; $fname =~ s,(^|/)(?:\.?\./)+,$1,; return $fname; } # output unix date in a mc-readable format sub timef { my @time=localtime($_[0]); return sprintf '%02d-%02d-%02d %02d:%02d', $time[4]+1, $time[3], $time[5]+1900, $time[2], $time[1]; } # parse given string as a date and return unix time sub datetime { # in case of problems fall back to 0 in unix time # note: str2time interprets some wrong values (eg. " ") as 'today' if ($parsedates && defined (my $t=str2time($_[0]))) { return timef($t); } return timef(time); } # print message on stderr and exit sub error { print STDERR $_[0], "\n"; exit 1; } # (compressed) input sub myin { my ($qfname)=(quotemeta $_[0]); $_=`$fileutil $qfname`; if (/bzip/) { return "$bzip -dc $qfname"; } elsif (/gzip/) { return "$gzip -dc $qfname"; } else { return "cat $qfname"; } } # (compressed) output sub myout { my ($qfname,$append)=(quotemeta $_[0],$_[1]); my ($sep) = $append ? '>>' : '>'; $_=`$fileutil $qfname`; if (/bzip/) { return "$bzip -c $sep $qfname"; } elsif (/gzip/) { return "$gzip -c $sep $qfname"; } else { return "cat $sep $qfname"; } } # select diff filename conforming with rules found in diff.info sub diff_filename { my ($fsrc,$fdst)= @_; $fsrc = patchfs_canonicalize_path ($fsrc); $fdst = patchfs_canonicalize_path ($fdst); if (!$fdst && !$fsrc) { error 'Index: not yet implemented'; } elsif (!$fsrc || $fsrc eq '/dev/null') { return ($fdst,'PATCH-CREATE/'); } elsif (!$fdst || $fdst eq '/dev/null') { return ($fsrc,'PATCH-REMOVE/'); } elsif (($fdst eq '/dev/null') && ($fsrc eq '/dev/null')) { error 'Malformed diff'; } else { # fewest path name components if ($fdst=~s|/|/|g < $fsrc=~s|/|/|g) { return ($fdst,''); } elsif ($fdst=~s|/|/|g > $fsrc=~s|/|/|g) { return ($fsrc,''); } else { # shorter base name if (($fdst=~/$basename/,length $2) < ($fsrc=~/$basename/,length $2)) { return ($fdst,''); } elsif (($fdst=~/$basename/,length $2) > ($fsrc=~/$basename/,length $2)) { return ($fsrc,''); } else { # shortest names if (length $fdst < length $fsrc) { return ($fdst,''); } else { return ($fsrc,''); } } } } } # parse unified or context header sub parse_header { my ($unified,$context,$buf)=@_; if ($unified) { error "Can't parse unified diff header" unless ((($$buf.=).=)=~/$unified_header/); return $$buf=~/$unified_extract/; } elsif ($context) { error "Can't parse context diff header" unless ((($$buf.=).=)=~/$context_header/); return $$buf=~/$context_extract/; } } # list files affected by patch sub list { my ($archive)=(quotemeta $_[0]); my ($state,$pos,$len,$time); my ($f,$fsrc,$fdst,$prefix); my ($unified,$context)=(0,0); # use uid and gid from file my ($uid,$gid)=(`ls -l $archive`=~/$ls_extract_id/); import Date::Parse if ($parsedates); # state==1 means diff contents, state==0 means comments $state=0; $len=0; $f=''; while () { # recognize diff type if (!$unified && !$context) { $unified=1 if (/^--- /); $context=1 if (/^\*\*\* /); if (!$unified && !$context) { $len+=length; next; } } if (($unified && /^--- /) || ($context && /^\*\*\* [^\*]*$/)) { # start of new file if ($state==1) { printf "-rw-r--r-- 1 %s %s %d %s %s%s\n", $uid, $gid, $len, datetime($time), $prefix, $f if $f; $len=0; } $state=1; ($fsrc,$fdst,$time)=parse_header($unified,$context,\$_); ($f,$prefix)=diff_filename($fsrc,$fdst); $f=$f.".diff"; } elsif ($state==1 && (($unified && !/$unified_contents/) || ($context && !/$context_contents/))) { # start of comments, end of diff contents printf "-rw-r--r-- 1 %s %s %d %s %s%s\n", $uid, $gid, $len, datetime($time), $prefix, $f if $f; $state=$len=0; } $len+=length; } printf "-rw-r--r-- 1 %s %s %d %s %s%s\n", $uid, $gid, $len, datetime($time), $prefix, $f if ($f && $state==1); } # extract diff from patch sub copyout { my ($file,$out)=@_; my ($fsrc,$fdst,$found,$state,$buf); my ($unified,$context)=(0,0); $file=~s/^(PATCH-(CREATE|REMOVE)\/)?(.*)\.diff$/$3/; $file = patchfs_canonicalize_path ($file); # state==1 means diff contents, state==0 mens comments $state=0; $found=0; $buf=''; while () { # recognize diff type if (!$unified && !$context) { $unified=1 if (/^--- /); $context=1 if (/^\*\*\* /); if (!$unified && !$context) { $buf.=$_; next; } } if (($unified && /^--- /) || ($context && /^\*\*\* [^\*]*$/)) { last if ($state==1 && $found); $state=1; ($fsrc,$fdst,)=parse_header($unified,$context,\$_); $fsrc = patchfs_canonicalize_path ($fsrc); $fdst = patchfs_canonicalize_path ($fdst); $found=1 if (($fsrc eq $file) || ($fdst eq $file)); } elsif ($state==1 && (($unified && !/$unified_contents/) || ($context && !/$context_contents/))) { # start of comments, end of diff contents last if ($found); $state=0; $buf=''; } $buf.=$_ if ($found || $state==0) } if ($found) { open O, "> $out"; print O $buf; close O; } } # remove diff(s) from patch sub rm { my ($archive)=(shift); my ($fsrc,$fdst,$found,$state,$buf); my ($tmp,$tmpname)=tempfile(); my ($unified,$context)=(0,0); @_=map {scalar(s/^(PATCH-(CREATE|REMOVE)\/)?(.*)\.diff$/$3/,$_)} @_; # state==1 means diff contents, state==0 mens comments $state=0; $found=0; $buf=''; while () { # recognize diff type if (!$unified && !$context) { $unified=1 if (/^--- /); $context=1 if (/^\*\*\* /); if (!$unified && !$context) { $buf.=$_; next; } } if (($unified && /^--- /) || ($context && /^\*\*\* [^\*]*$/)) { $state=1; ($fsrc,$fdst,)=parse_header($unified,$context,\$_); # remove listed files foreach (@_) { if (($fsrc eq $_) || ($fdst eq $_)) { $found=1; last; } } if (!$found) { print $tmp $buf; $buf=''; } } elsif ($state==1 && (($unified && !/$unified_contents/) || ($context && !/$context_contents/))) { # start of comments, end of diff contents $found=0; $state=0; $buf=''; } if ($state==0) { $buf.=$_; } elsif (!$found) { print $tmp $_; } } print $tmp $buf if (!$found); close $tmp; close I; # replace archive with temporary file system('cat '.quotemeta($tmpname).'|'.myout($archive,0))==0 or error "Can't write to archive"; system 'rm -f '.quotemeta($tmpname); } # append diff to archive sub copyin { my ($archive,$name,$src)=(@_); my ($fsrc,$fdst,$f,@files); my ($unified,$context)=(0,0); # build filelist open I, myin($src).'|'; while () { # recognize diff type if (!$unified && !$context) { $unified=1 if (/^--- /); $context=1 if (/^\*\*\* /); } if (($unified && /^--- /) || ($context && /^\*\*\* [^\*]*$/)) { ($fsrc,$fdst,)=parse_header($unified,$context,\$_); ($f,)=diff_filename($fsrc,$fdst); push(@files,$f); } } close I; # remove overwrited files open I, myin($archive).'|'; rm ($archive, map($_.'.diff',@files)); close I; my $cmd1=myin($src); my $cmd2=myout($archive,1); system("$cmd1 | $cmd2")==0 or error "Can't write to archive"; } if ($ARGV[0] eq 'list') { open I, myin($ARGV[1]).'|'; list $ARGV[1]; exit 0; } elsif ($ARGV[0] eq 'copyout') { open I, myin($ARGV[1])."|"; copyout ($ARGV[2], $ARGV[3]); exit 0; } elsif ($ARGV[0] eq 'rm') { open I, myin($ARGV[1])."|"; rm ($ARGV[1], $ARGV[2]); exit 0; } elsif ($ARGV[0] eq 'rmdir') { exit 0; } elsif ($ARGV[0] eq 'mkdir') { exit 0; } elsif ($ARGV[0] eq 'copyin') { copyin ($ARGV[1], $ARGV[2], $ARGV[3]); exit 0; } exit 1; avfs-1.1.4/extfs/rpm0000755000175000001440000002260614032341001011240 00000000000000#! /bin/sh # # Written by Erik Troan (ewt@redhat.com) 1996 # Jakub Jelinek (jj@sunsite.mff.cuni.cz) 1996,2004 # Tomasz K³oczko (kloczek@rudy.mif.pg.gda.pl) 1997 # minor changes by Wojtek Pilorz (wpilorz@bdk.lublin.pl) 1997 # minor changes by Michele Marziani (marziani@fe.infn.it) 1997 # bug files by Marc Merlin (marcsoft@merlins.org) 1998 # locale bugfix by Michal Svec (rebel@penguin.cz) 2000 # Whitespace(s) & single quote(s) in filename workaround # by Andrew V. Samoilov 2004 # https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=64007 # patch for listing files with correct file size by Tanmoy Bhattacharya (tanmoy@mindspring.com) 2007 # minor changes by Ralf Hoffmann (ralf@boomerangsworld.de) 2007 # # (C) 1996-2004 The Free Software Foundation. # # override any locale for dates unset LC_ALL LC_TIME=C export LC_TIME if rpm --nosignature --version >/dev/null 2>&1; then RPM="rpm --nosignature" else RPM="rpm" fi RPM2CPIO="rpm2cpio" SED="sed" # Surround the whole filename with single quotes and handle specially # \', ' and \ at the end of the string. SEDCMD="s/\\(\\\\\\?\\)'/'\\1\\1\\\\''/g;s/\\\\\$/'\\\\\\\\'/;s/^/'/;s/\$/'/" mcrpmfs_list () { # set MCFASTRPM_DFLT to 1 for faster rpm files handling by default, to 0 for # slower handling MCFASTRPM_DFLT=0 if test -z "$MCFASTRPM"; then MCFASTRPM=$MCFASTRPM_DFLT fi f="`echo "$1" | $SED "$SEDCMD"`" FILEPREF="-r--r--r-- 1 root root " DESC=`$RPM -qip "$f" 2>/dev/null` || { echo "$FILEPREF 0 "`date +"%b %d %H:%M"`" ERROR" exit 1 } getsize() { $RPM -qp --qf "$1" "$f" | wc -c } writewithsize() { tempvar="%{$3`echo "$1" | sed -e "s/-/}-%{/g"`}\n" size="`getsize "$tempvar"`" echo "$FILEPREF $size $DATE $2/$1" } DATE=`$RPM -qp --qf "%{BUILDTIME:date}\n" "$f" | cut -c 5-11,21-24` HEADERSIZE=`echo "$DESC" | wc -c` echo "-r--r--r-- 1 root root $HEADERSIZE $DATE HEADER" echo "-r-xr-xr-x 1 root root 39 $DATE INSTALL" echo "-r-xr-xr-x 1 root root 39 $DATE UPGRADE" echo "dr-xr-xr-x 3 root root 0 $DATE INFO" writewithsize NAME-VERSION-RELEASE INFO writewithsize GROUP INFO writewithsize BUILDHOST INFO writewithsize SOURCERPM INFO if test "$MCFASTRPM" = 0 ; then test "`$RPM -qp --qf \"%{DISTRIBUTION}\" \"$f\"`" = "(none)" || writewithsize DISTRIBUTION INFO test "`$RPM -qp --qf \"%{VENDOR}\" \"$f\"`" = "(none)" || writewithsize VENDOR INFO test "`$RPM -qp --qf \"%{DESCRIPTION}\" \"$f\"`" = "(none)" || writewithsize DESCRIPTION INFO test "`$RPM -qp --qf \"%{SUMMARY}\" \"$f\"`" = "(none)" || writewithsize SUMMARY INFO if test "`$RPM -qp --qf \"%{RPMTAG_PREIN}%{RPMTAG_POSTIN}%{RPMTAG_PREUN}%{RPMTAG_POSTUN}%{VERIFYSCRIPT}\" \"$f\"`" != "(none)(none)(none)(none)(none)"; then echo "dr-xr-xr-x 1 root root 0 $DATE INFO/SCRIPTS" test "`$RPM -qp --qf \"%{RPMTAG_PREIN}\" \"$f\"`" = '(none)' || writewithsize PREIN INFO/SCRIPTS RPMTAG_ test "`$RPM -qp --qf \"%{RPMTAG_POSTIN}\" \"$f\"`" = '(none)' || writewithsize POSTIN INFO/SCRIPTS RPMTAG_ test "`$RPM -qp --qf \"%{RPMTAG_PREUN}\" \"$f\"`" = '(none)' || writewithsize PREUN INFO/SCRIPTS RPMTAG_ test "`$RPM -qp --qf \"%{RPMTAG_POSTUN}\" \"$f\"`" = '(none)' || writewithsize POSTUN INFO/SCRIPTS RPMTAG_ test "`$RPM -qp --qf \"%{VERIFYSCRIPT}\" \"$f\"`" = '(none)' || writewithsize VERIFYSCRIPT INFO/SCRIPTS size="`$RPM -qp --scripts "$f"|wc -c`" echo "$FILEPREF $size $DATE INFO/SCRIPTS/ALL" fi else writewithsize DISTRIBUTION INFO writewithsize VENDOR INFO writewithsize DESCRIPTION INFO writewithsize SUMMARY INFO echo "dr-xr-xr-x 1 root root 0 $DATE INFO/SCRIPTS" writewithsize PREIN INFO/SCRIPTS RPMTAG_ writewithsize POSTIN INFO/SCRIPTS RPMTAG_ writewithsize PREUN INFO/SCRIPTS RPMTAG_ writewithsize POSTUN INFO/SCRIPTS RPMTAG_ writewithsize VERIFYSCRIPT INFO/SCRIPTS RPMTAG_ size="`$RPM -qp --scripts "$f"|wc -c`" echo "$FILEPREF $size $DATE INFO/SCRIPTS/ALL" fi if test "$MCFASTRPM" = 0 ; then test "`$RPM -qp --qf \"%{PACKAGER}\" \"$f\"`" = "(none)" || writewithsize PACKAGER INFO test "`$RPM -qp --qf \"%{URL}\" \"$f\"`" = "(none)" || writewithsize URL INFO test "`$RPM -qp --qf \"%{SERIAL}\" \"$f\"`" = "(none)" || writewithsize SERIAL INFO test "`$RPM -qp --qf \"%{COPYRIGHT}\" \"$f\"`" = "(none)" || writewithsize COPYRIGHT INFO test "`$RPM -qp --qf \"%{LICENSE}\" \"$f\"`" = "(none)" || writewithsize LICENSE INFO else writewithsize PACKAGER INFO writewithsize URL INFO writewithsize SERIAL INFO writewithsize COPYRIGHT INFO writewithsize LICENSE INFO fi size="`getsize "%{BUILDTIME:date}\n"`" echo "$FILEPREF $size $DATE INFO/BUILDTIME" writewithsize RPMVERSION INFO writewithsize OS INFO size="`getsize "%{SIZE} bytes\n"`" echo "$FILEPREF $size $DATE INFO/SIZE" if test "$MCFASTRPM" != 0 ; then size="`getsize "[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]\n"`" $RPM -qp --qf "[%{REQUIRENAME}\n]" "$f" | grep "(none)" > /dev/null || echo "$FILEPREF $size $DATE INFO/REQUIRENAME" size="`getsize "[%{OBSOLETENAME} %|OBSOLETEFLAGS?{%{OBSOLETEFLAGS:depflags} %{OBSOLETEVERSION}}:{}|\n]\n"`" $RPM -qp --qf "[%{OBSOLETES}\n]" "$f" | grep "(none)" > /dev/null || echo "$FILEPREF $size $DATE INFO/OBSOLETES" size="`getsize "[%{PROVIDES}\n]\n"`" $RPM -qp --qf "[%{PROVIDES}\n]" "$f" | grep "(none)" > /dev/null || echo "$FILEPREF $size $DATE INFO/PROVIDES" size="`getsize "[* %{CHANGELOGTIME:date} %{CHANGELOGNAME}\n%{CHANGELOGTEXT}\n\n]\n"`" test "`$RPM -qp --qf \"%{CHANGELOGTEXT}\" \"$f\"`" = "(none)" || echo "$FILEPREF $size $DATE INFO/CHANGELOG" else size="`getsize "[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]\n"`" echo "$FILEPREF $size $DATE INFO/REQUIRENAME" size="`getsize "[%{OBSOLETENAME} %|OBSOLETEFLAGS?{%{OBSOLETEFLAGS:depflags} %{OBSOLETEVERSION}}:{}|\n]\n"`" echo "$FILEPREF $size $DATE INFO/OBSOLETES" size="`getsize "[%{PROVIDES}\n]\n"`" echo "$FILEPREF $size $DATE INFO/PROVIDES" size="`getsize "[* %{CHANGELOGTIME:date} %{CHANGELOGNAME}\n%{CHANGELOGTEXT}\n\n]\n"`" echo "$FILEPREF $size $DATE INFO/CHANGELOG" fi size="`eval $RPM2CPIO "$f" | wc -c`" echo "$FILEPREF $size $DATE CONTENTS.cpio" } mcrpmfs_copyout () { f="`echo "$1" | $SED "$SEDCMD"`" case "$2" in HEADER) $RPM -qip "$f" > "$3"; exit 0;; INSTALL) echo "# Run this to install this RPM package" > "$3"; exit 0;; UPGRADE) echo "# Run this to upgrade this RPM package" > "$3"; exit 0;; ERROR) $RPM -qip "$f" > /dev/null 2> "$3"; exit 0;; INFO/NAME-VERSION-RELEASE) $RPM -qp --qf "%{NAME}-%{VERSION}-%{RELEASE}\n" "$f" > "$3"; exit 0;; INFO/RELEASE) $RPM -qp --qf "%{RELEASE}\n" "$f" > "$3"; exit 0;; INFO/GROUP) $RPM -qp --qf "%{GROUP}\n" "$f" > "$3"; exit 0;; INFO/DISTRIBUTION) $RPM -qp --qf "%{DISTRIBUTION}\n" "$f" > "$3"; exit 0;; INFO/VENDOR) $RPM -qp --qf "%{VENDOR}\n" "$f" > "$3"; exit 0;; INFO/BUILDHOST) $RPM -qp --qf "%{BUILDHOST}\n" "$f" > "$3"; exit 0;; INFO/SOURCERPM) $RPM -qp --qf "%{SOURCERPM}\n" "$f" > "$3"; exit 0;; INFO/DESCRIPTION) $RPM -qp --qf "%{DESCRIPTION}\n" "$f" > "$3"; exit 0;; INFO/PACKAGER) $RPM -qp --qf "%{PACKAGER}\n" "$f" > "$3"; exit 0;; INFO/URL) $RPM -qp --qf "%{URL}\n" "$f" >"$3"; exit 0;; INFO/BUILDTIME) $RPM -qp --qf "%{BUILDTIME:date}\n" "$f" >"$3"; exit 0;; INFO/SERIAL) $RPM -qp --qf "%{SERIAL}\n" "$f" >"$3"; exit 0;; INFO/COPYRIGHT) $RPM -qp --qf "%{COPYRIGHT}\n" "$f" >"$3"; exit 0;; INFO/LICENSE) $RPM -qp --qf "%{LICENSE}\n" "$f" >"$3"; exit 0;; INFO/RPMVERSION) $RPM -qp --qf "%{RPMVERSION}\n" "$f" >"$3"; exit 0;; INFO/REQUIRENAME) $RPM -qp --qf "[%{REQUIRENAME} %{REQUIREFLAGS:depflags} %{REQUIREVERSION}\n]\n" "$f" >"$3"; exit 0;; INFO/PROVIDES) $RPM -qp --qf "[%{PROVIDES}\n]\n" "$f" >"$3"; exit 0;; INFO/SCRIPTS/PREIN) $RPM -qp --qf "%{RPMTAG_PREIN}\n" "$f" >"$3"; exit 0;; INFO/SCRIPTS/POSTIN) $RPM -qp --qf "%{RPMTAG_POSTIN}\n" "$f" >"$3"; exit 0;; INFO/SCRIPTS/PREUN) $RPM -qp --qf "%{RPMTAG_PREUN}\n" "$f" >"$3"; exit 0;; INFO/SCRIPTS/POSTUN) $RPM -qp --qf "%{RPMTAG_POSTUN}\n" "$f" >"$3"; exit 0;; INFO/SCRIPTS/VERIFYSCRIPT) $RPM -qp --qf "%{VERIFYSCRIPT}\n" "$f" >"$3"; exit 0;; INFO/SCRIPTS/ALL) $RPM -qp --scripts "$f" > "$3"; exit 0;; INFO/SUMMARY) $RPM -qp --qf "%{SUMMARY}\n" "$f" > "$3"; exit 0;; INFO/OS) $RPM -qp --qf "%{OS}\n" "$f" > "$3"; exit 0;; INFO/CHANGELOG) $RPM -qp --qf "[* %{CHANGELOGTIME:date} %{CHANGELOGNAME}\n%{CHANGELOGTEXT}\n\n]\n" "$f" > "$3"; exit 0;; INFO/SIZE) $RPM -qp --qf "%{SIZE} bytes\n" "$f" > "$3"; exit 0;; INFO/OBSOLETES) $RPM -qp --qf "[%{OBSOLETENAME} %|OBSOLETEFLAGS?{%{OBSOLETEFLAGS:depflags} %{OBSOLETEVERSION}}:{}|\n]\n" "$f" > "$3"; exit 0;; CONTENTS.cpio) $RPM2CPIO "$1" > "$3"; exit 0;; *) ;; esac } mcrpmfs_run () { f="`echo "$1" | $SED "$SEDCMD"`" case "$2" in INSTALL) echo "Installing \"\"$f\"\""; $RPM -ivh "$f"; exit 0;; UPGRADE) echo "Upgrading \"\"$f\"\""; $RPM -Uvh "$f"; exit 0;; esac } umask 077 case "$1" in list) mcrpmfs_list "$2"; exit 0;; copyout) mcrpmfs_copyout "$2" "$3" "$4"; exit 0;; run) mcrpmfs_run "$2" "$3"; exit 1;; esac exit 1 avfs-1.1.4/extfs/upp.in0000644000175000001440000000175114032341001011646 00000000000000#! /bin/sh # # Written by Ralf Hoffmann # upp 0.9.0 # # (C) 2007 Ralf Hoffmann # May be distributed under the terms of the GNU General # Public License V2 or higher # # Powerpacker handler # # requires ppunpack (ftp://de.aminet.net/pub/aminet/misc/unix/) # PPUNPACK=ppunpack AWK=@AWK@ extfs_pp_list () { if test -f "$1"; then t=$(ls -l "$1" | $AWK '{print $6, $7, $8}') name=$(basename "$1" | sed 's/\(.*\)\.pp/\1/') echo "-r-------- 1 $(id -nu) $(id -ng) 0 $t $name" fi } extfs_pp_copyout () { name=$(basename "$1" | sed 's/\(.*\)\.pp/\1/') if test "$2" = "$name"; then $PPUNPACK "$1" "$3" fi } # override any locale for dates LC_ALL=C export LC_ALL umask 077 case "$1" in list) extfs_pp_list "$2" ;; copyout) shift extfs_pp_copyout "$@" ;; *) echo "extfs_pp: unknown command: \"$1\"." 1>&2 exit 1 ;; esac exit 0 avfs-1.1.4/extfs/uadf0000644000175000001440000000366214032341001011357 00000000000000#! /bin/sh # Description: # This is a parser for Amiga ADF disk images in Midnight Commander. You # need the GPL unADF program (part of ADFlib >= 0.7.9b) written by Laurent # Clevy and Dan Sutherland. # Author: Guus Jansman # Limitations: # Some files seem to have a description. These are not handled (yet). # Files can only be added as root (under Linux only so disabled now). # File attributes are not preserved. # Alternative programs (not supported by this script): # AdfOpus (win32, Dan Sutherland and Gary Harris) # readdisk (part of UAE) # Settings: UNADF="unadf" mcadffs_list () { $UNADF -lr "$1" 2>/dev/null | gawk -v uid=$(id -ru) ' BEGIN { date="JanFebMarAprMayJunJulAugSepOctNovDec" } /^$/ { next } /^unADF/ { next } /^compsum/ { next } /^Device/ { next } /^Volume/ { next } /^Warning/ { next } { slashpos=index($0, "/") str=substr($0, slashpos+18) if (substr(str, length(str)) == "/") { perm="drwxr-xr-x" str=substr(str, 1, length(str)-1) sz=0 } else { perm="-rw-r--r--" sz=substr($0, 1, slashpos-5) } tm=substr($0, slashpos+8, 5) dt=substr($0, slashpos-4, 10) split(dt, a, "/") printf "%s 1 %-8d %-8d %8d %3s %2d %4d %s %s\n", perm, uid, 0, sz, substr(date, (a[2]-1)*3+1, 3), a[3], a[1], tm, str }' } mcadffs_copyout () { $UNADF -p "$1" "$2" > "$3" 2>/dev/null } mcadffs_test () { if $UNADF -l "$1" >/dev/null 2>&1; then echo "OK" else echo "UNKNOWN" fi } umask 077 cmd=$1 shift case "$cmd" in list) mcadffs_list "$@" ;; copyout) mcadffs_copyout "$@" ;; # copyin) mcadffs_copyin "$@" ;; # Can only be performed as root # rm) mcadffs_rm "$@" ;; # Can only be performed as root # test) mcadffs_test "$@" ;; # Not supported by MC extfs *) exit 1 ;; esac exit 0 avfs-1.1.4/extfs/uzip.in0000644000175000001440000003110214032341001012022 00000000000000#! @PERL@ -w # # zip file archive Virtual File System for Midnight Commander # Version 1.4.0 (2001-08-07). # # (C) 2000-2001 Oskar Liljeblad . # use POSIX; use File::Basename; use strict; # # Configuration options # # Location of the zip program my $app_zip = "@ZIP@"; # Location of the unzip program my $app_unzip = "@UNZIP@"; # Set this to 1 if zipinfo (unzip -Z) is to be used (recommended), otherwise 0. my $op_has_zipinfo = @HAVE_ZIPINFO@; # Command used to list archives (zipinfo mode) my $cmd_list_zi = "$app_unzip -Z -l -T"; # Command used to list archives (non-zipinfo mode) my $cmd_list_nzi = "$app_unzip -qq -v"; # Command used to add a file to the archive my $cmd_add = "$app_zip -g"; # Command used to add a link file to the archive (unused) my $cmd_addlink = "$app_zip -g -y"; # Command used to delete a file from the archive my $cmd_delete = "$app_zip -d"; # Command used to extract a file to standard out my $cmd_extract = "$app_unzip -p"; # # Main code # die "uzip: missing command and/or archive arguments\n" if ($#ARGV < 1); # Initialization of some global variables my $cmd = shift; my %known = ( './' => 1 ); my %pending = (); my $oldpwd = POSIX::getcwd(); my $archive = shift; my $aarchive = absolutize($archive, $oldpwd); my $cmd_list = ($op_has_zipinfo ? $cmd_list_zi : $cmd_list_nzi); my ($qarchive, $aqarchive) = map (quotemeta, $archive, $aarchive); if ($cmd eq 'list') { &mczipfs_list(@ARGV); } if ($cmd eq 'rm') { &mczipfs_rm(@ARGV); } if ($cmd eq 'rmdir') { &mczipfs_rmdir(@ARGV); } if ($cmd eq 'mkdir') { &mczipfs_mkdir(@ARGV); } if ($cmd eq 'copyin') { &mczipfs_copyin(@ARGV); } if ($cmd eq 'copyout') { &mczipfs_copyout(@ARGV); } if ($cmd eq 'run') { &mczipfs_run(@ARGV); } #if ($cmd eq 'mklink') { &mczipfs_mklink(@ARGV); } # Not supported by MC extfs #if ($cmd eq 'linkout') { &mczipfs_linkout(@ARGV); } # Not supported by MC extfs exit 1; # Remove a file from the archive. sub mczipfs_rm { my ($qfile) = map { &zipquotemeta($_) } @_; &checkargs(1, 'archive file', @_); &safesystem("$cmd_delete $qarchive $qfile >/dev/null"); exit; } # Remove an empty directory from the archive. # The only difference from mczipfs_rm is that we append an # additional slash to the directory name to remove. I am not # sure this is absolutely necessary, but it doesn't hurt. sub mczipfs_rmdir { my ($qfile) = map { &zipquotemeta($_) } @_; &checkargs(1, 'archive directory', @_); &safesystem("$cmd_delete $qarchive $qfile/ >/dev/null", 12); exit; } # Extract a file from the archive. # Note that we don't need to check if the file is a link, # because mc apparently doesn't call copyout for symbolic links. sub mczipfs_copyout { my ($qafile, $qfsfile) = map { &zipquotemeta($_) } @_; &checkargs(1, 'archive file', @_); &checkargs(2, 'local file', @_); &safesystem("$cmd_extract $qarchive $qafile > $qfsfile", 11); exit; } # Add a file to the archive. # This is done by making a temporary directory, in which # we create a symlink the original file (with a new name). # Zip is then run to include the real file in the archive, # with the name of the symbolic link. # Here we also doesn't need to check for symbolic links, # because the mc extfs doesn't allow adding of symbolic # links. sub mczipfs_copyin { my ($afile, $fsfile) = @_; &checkargs(1, 'archive file', @_); &checkargs(2, 'local file', @_); my ($qafile) = quotemeta $afile; $fsfile = &absolutize($fsfile, $oldpwd); my $adir = File::Basename::dirname($afile); my $tmpdir = &mktmpdir(); chdir $tmpdir || &croak("chdir $tmpdir failed"); &mkdirs($adir, 0700); symlink ($fsfile, $afile) || &croak("link $afile failed"); &safesystem("$cmd_add $aqarchive $qafile >/dev/null"); unlink $afile || &croak("unlink $afile failed"); &rmdirs($adir); chdir $oldpwd || &croak("chdir $oldpwd failed"); rmdir $tmpdir || &croak("rmdir $tmpdir failed"); exit; } # Add an empty directory the the archive. # This is similar to mczipfs_copyin, except that we don't need # to use symlinks. sub mczipfs_mkdir { my ($dir) = @_; &checkargs(1, 'directory', @_); my ($qdir) = quotemeta $dir; my $tmpdir = &mktmpdir(); chdir $tmpdir || &croak("chdir $tmpdir failed"); &mkdirs($dir, 0700); &safesystem("$cmd_add $aqarchive $qdir >/dev/null"); &rmdirs($dir); chdir $oldpwd || &croak("chdir $oldpwd failed"); rmdir $tmpdir || &croak("rmdir $tmpdir failed"); exit; } # Add a link to the archive. This operation is not used yet, # because it is not supported by the MC extfs. sub mczipfs_mklink { my ($linkdest, $afile) = @_; &checkargs(1, 'link destination', @_); &checkargs(2, 'archive file', @_); my ($qafile) = quotemeta $afile; my $adir = File::Basename::dirname($afile); my $tmpdir = &mktmpdir(); chdir $tmpdir || &croak("chdir $tmpdir failed"); &mkdirs($adir, 0700); symlink ($linkdest, $afile) || &croak("link $afile failed"); &safesystem("$cmd_addlink $aqarchive $qafile >/dev/null"); unlink $afile || &croak("unlink $afile failed"); &rmdirs($adir); chdir $oldpwd || &croak("chdir $oldpwd failed"); rmdir $tmpdir || &croak("rmdir $tmpdir failed"); exit; } # This operation is not used yet, because it is not # supported by the MC extfs. sub mczipfs_linkout { my ($afile, $fsfile) = @_; &checkargs(1, 'archive file', @_); &checkargs(2, 'local file', @_); my ($qafile) = map { &zipquotemeta($_) } $afile; my $linkdest = &get_link_destination($afile); symlink ($linkdest, $fsfile) || &croak("link $fsfile failed"); exit; } # Use unzip to find the link destination of a certain file in the # archive. sub get_link_destination { my ($afile) = @_; my ($qafile) = map { &zipquotemeta($_) } $afile; my $linkdest = safeticks("$cmd_extract $qarchive $qafile"); &croak ("extract failed", "link destination of $afile not found") if (!defined $linkdest || $linkdest eq ''); return $linkdest; } # List files in the archive. # Because mc currently doesn't allow a file's parent directory # to be listed after the file itself, we need to do some # rearranging of the output. Most of this is done in # checked_print_file. sub mczipfs_list { open (PIPE, "$cmd_list $qarchive |") || &croak("$app_unzip failed"); if ($op_has_zipinfo) { while () { chomp; next if /^Archive:/; next if /^\d+ file/; next if /^Empty zipfile\.$/; my @match = /^(.{10}) +([\d.]+) +([a-z\d]+) +(\d+) +([^ ]{2}) +(\d+) +([^ ]{4}) +(\d{4})(\d\d)(\d\d)\.(\d\d)(\d\d)(\d\d) +(.*)$/; next if ($#match != 13); &checked_print_file(@match); } } else { while () { chomp; my @match = /^ *(\d+) +([^ ]+) +(\d+) +(-?\d+\%) +(\d?\d)-(\d?\d)-(\d\d) (\d?\d):(\d\d) +([0-9a-f]+) +(.*)$/; next if ($#match != 10); my @rmatch = ('', '', 'unknown', $match[0], '', $match[2], $match[1], $match[6] + ($match[6] < 70 ? 2000 : 1900), $match[4], $match[5], $match[7], $match[8], "00", $match[10]); &checked_print_file(@rmatch); } } if (!close (PIPE)) { &croak("$app_unzip failed") if ($! != 0); &croak("$app_unzip failed", 'non-zero exit status ('.($? >> 8).')') } foreach my $key (sort keys %pending) { foreach my $file (@{ $pending{$key} }) { &print_file(@{ $file }); } } exit; } # Execute a file in the archive, by first extracting it to a # temporary directory. The name of the extracted file will be # the same as the name of it in the archive. sub mczipfs_run { my ($afile) = @_; &checkargs(1, 'archive file', @_); my $qafile = &zipquotemeta($afile); my $tmpdir = &mktmpdir(); my $tmpfile = File::Basename::basename($afile); chdir $tmpdir || &croak("chdir $tmpdir failed"); &safesystem("$cmd_extract $aqarchive $qafile > $tmpfile"); chmod 0700, $tmpfile; &safesystem("./$tmpfile"); unlink $tmpfile || &croak("rm $tmpfile failed"); chdir $oldpwd || &croak("chdir $oldpwd failed"); rmdir $tmpdir || &croak("rmdir $tmpdir failed"); exit; } # This is called prior to printing the listing of a file. # A check is done to see if the parent directory of the file has already # been printed or not. If it hasn't, we must cache it (in %pending) and # print it later once the parent directory has been listed. When all # files have been processed, there may still be some that haven't been # printed because their parent directories weren't listed at all. These # files are dealt with in mczipfs_list. sub checked_print_file { my @waiting = ([ @_ ]); while ($#waiting != -1) { my $item = shift @waiting; my $filename = ${$item}[13]; my $dirname = File::Basename::dirname($filename) . '/'; if (exists $known{$dirname}) { &print_file(@{$item}); if ($filename =~ /\/$/) { $known{$filename} = 1; if (exists $pending{$filename}) { push @waiting, @{ $pending{$filename} }; delete $pending{$filename}; } } } else { push @{$pending{$dirname}}, $item; } } } # Print the mc extfs listing of a file from a set of parsed fields. # If the file is a link, we extract it from the zip archive and # include the output as the link destination. Because this output # is not newline terminated, we must execute unzip once for each # link file encountered. sub print_file { my ($perms,$zipver,$platform,$realsize,$format,$cmpsize,$comp,$year,$mon,$day,$hours,$mins,$secs,$filename) = @_; $mon = (qw/Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec/)[$mon-1]; if ($platform ne 'unx') { $perms = ($filename =~ /\/$/ ? 'drwxr-xr-x' : '-rw-r--r--'); } printf "%-10s 1 %-8d %-8d %8d %s %s %s %s:%s %s", $perms, $<, $(, $realsize, $mon, $day, $year, $hours, $mins, $filename; if ($platform eq 'unx' && $perms =~ /^l/) { my $linkdest = &get_link_destination($filename); print " -> $linkdest"; } print "\n"; } # Die with a reasonable error message. sub croak { my ($command, $desc) = @_; die "uzip ($cmd): $command - $desc\n" if (defined $desc); die "uzip ($cmd): $command - $!\n"; } # Make a set of directories, like the command `mkdir -p'. # This subroutine has been tailored for this script, and # because of that, it ignored the directory name '.'. sub mkdirs { my ($dirs, $mode) = @_; $dirs = &cleandirs($dirs); return if ($dirs eq '.'); my $newpos = -1; while (($newpos = index($dirs, '/', $newpos+1)) != -1) { my $dir = substr($dirs, 0, $newpos); mkdir ($dir, $mode) || &croak("mkdir $dir failed"); } mkdir ($dirs, $mode) || &croak("mkdir $dirs failed"); } # Remove a set of directories, failing if the directories # contain other files. # This subroutine has been tailored for this script, and # because of that, it ignored the directory name '.'. sub rmdirs { my ($dirs) = @_; $dirs = &cleandirs($dirs); return if ($dirs eq '.'); rmdir $dirs || &croak("rmdir $dirs failed"); my $newpos = length($dirs); while (($newpos = rindex($dirs, '/', $newpos-1)) != -1) { my $dir = substr($dirs, 0, $newpos); rmdir $dir || &croak("rmdir $dir failed"); } } # Return a semi-canonical directory name. sub cleandirs { my ($dir) = @_; $dir =~ s:/+:/:g; $dir =~ s:/*$::; return $dir; } # Make a temporary directory with mode 0700. sub mktmpdir { use File::Temp qw(mkdtemp); my $template = "/tmp/mcuzipfs.XXXXXX"; $template="$ENV{MC_TMPDIR}/mcuzipfs.XXXXXX" if ($ENV{MC_TMPDIR}); return mkdtemp($template); } # Make a filename absolute and return it. sub absolutize { my ($file, $pwd) = @_; return "$pwd/$file" if ($file !~ /^\//); return $file; } # Like the system built-in function, but with error checking. # The other argument is an exit status to allow. sub safesystem { my ($command, @allowrc) = @_; my ($desc) = ($command =~ /^([^ ]*) */); $desc = File::Basename::basename($desc); system $command; my $rc = $?; &croak("`$desc' failed") if (($rc & 0xFF) != 0); if ($rc != 0) { $rc = $rc >> 8; foreach my $arc (@allowrc) { return if ($rc == $arc); } &croak("`$desc' failed", "non-zero exit status ($rc)"); } } # Like backticks built-in, but with error checking. sub safeticks { my ($command, @allowrc) = @_; my ($desc) = ($command =~ /^([^ ]*) /); $desc = File::Basename::basename($desc); my $out = `$command`; my $rc = $?; &croak("`$desc' failed") if (($rc & 0xFF) != 0); if ($rc != 0) { $rc = $rc >> 8; foreach my $arc (@allowrc) { return if ($rc == $arc); } &croak("`$desc' failed", "non-zero exit status ($rc)"); } return $out; } # Make sure enough arguments are supplied, or die. sub checkargs { my $count = shift; my $desc = shift; &croak('missing argument', $desc) if ($count-1 > $#_); } # Quote zip wildcard metacharacters. Unfortunately Info-ZIP zip and unzip # on unix interpret some wildcards in filenames, despite the fact that # the shell already does this. Thus this function. sub zipquotemeta { my ($name) = @_; my $out = ''; for (my $c = 0; $c < length $name; $c++) { my $ch = substr($name, $c, 1); $out .= '\\' if (index('*?[]\\', $ch) != -1); $out .= $ch; } return quotemeta($out); } avfs-1.1.4/extfs/Makefile.in0000644000175000001440000005071514032341013012566 00000000000000# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = extfs ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = a apt audio deb deba debd dpkg hp48 iso9660 lslR \ mailfs patchfs rpms u7z uace uar uarj uc1541 uha ulha upp \ uextrar uxdms uxpk uzip uzoo CONFIG_CLEAN_VPATH_FILES = am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' am__uninstall_files_from_dir = { \ test -z "$$files" \ || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \ || { echo " ( cd '$$dir' && rm -f" $$files ")"; \ $(am__cd) "$$dir" && rm -f $$files; }; \ } am__installdirs = "$(DESTDIR)$(extfsscriptsdir)" \ "$(DESTDIR)$(extfsdatadir)" SCRIPTS = $(extfsscripts_SCRIPTS) AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = SOURCES = DIST_SOURCES = am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac DATA = $(extfsdata_DATA) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/a.in \ $(srcdir)/apt.in $(srcdir)/audio.in $(srcdir)/deb.in \ $(srcdir)/deba.in $(srcdir)/debd.in $(srcdir)/dpkg.in \ $(srcdir)/hp48.in $(srcdir)/iso9660.in $(srcdir)/lslR.in \ $(srcdir)/mailfs.in $(srcdir)/patchfs.in $(srcdir)/rpms.in \ $(srcdir)/u7z.in $(srcdir)/uace.in $(srcdir)/uar.in \ $(srcdir)/uarj.in $(srcdir)/uc1541.in $(srcdir)/uextrar.in \ $(srcdir)/uha.in $(srcdir)/ulha.in $(srcdir)/upp.in \ $(srcdir)/uxdms.in $(srcdir)/uxpk.in $(srcdir)/uzip.in \ $(srcdir)/uzoo.in README DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BZLIB_INCLUDE = @BZLIB_INCLUDE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAV = @DAV@ DAV_LS = @DAV_LS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FUSELIBS = @FUSELIBS@ GREP = @GREP@ HAVE_ZIPINFO = @HAVE_ZIPINFO@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ LIBZSTD_LIBS = @LIBZSTD_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NUMVERSION = @NUMVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ ZIP = @ZIP@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_INCLUDE = @ZLIB_INCLUDE@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTFS_CONST = \ bpp \ ftplist \ rpm \ trpm \ uadf \ uarc \ ucab \ ucpio \ udar \ uimg EXTFS_IN = \ a \ apt \ audio \ deb \ deba \ debd \ dpkg \ hp48 \ iso9660 \ lslR \ mailfs \ patchfs \ rpms \ u7z \ uace \ uar \ uarj \ uc1541 \ uha \ ulha \ upp \ uextrar \ uxdms \ uxpk \ uzip \ uzoo extfsscriptsdir = @moduledir@/extfs extfsscripts_SCRIPTS = $(EXTFS_IN) $(EXTFS_CONST) extfsdatadir = @moduledir@/extfs extfsdata_DATA = extfs.ini README EXTRA_DIST = $(extfsdata_DATA) $(EXTFS_CONST) all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu extfs/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu extfs/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): a: $(top_builddir)/config.status $(srcdir)/a.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ apt: $(top_builddir)/config.status $(srcdir)/apt.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ audio: $(top_builddir)/config.status $(srcdir)/audio.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ deb: $(top_builddir)/config.status $(srcdir)/deb.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ deba: $(top_builddir)/config.status $(srcdir)/deba.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ debd: $(top_builddir)/config.status $(srcdir)/debd.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ dpkg: $(top_builddir)/config.status $(srcdir)/dpkg.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ hp48: $(top_builddir)/config.status $(srcdir)/hp48.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ iso9660: $(top_builddir)/config.status $(srcdir)/iso9660.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ lslR: $(top_builddir)/config.status $(srcdir)/lslR.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ mailfs: $(top_builddir)/config.status $(srcdir)/mailfs.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ patchfs: $(top_builddir)/config.status $(srcdir)/patchfs.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ rpms: $(top_builddir)/config.status $(srcdir)/rpms.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ u7z: $(top_builddir)/config.status $(srcdir)/u7z.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ uace: $(top_builddir)/config.status $(srcdir)/uace.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ uar: $(top_builddir)/config.status $(srcdir)/uar.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ uarj: $(top_builddir)/config.status $(srcdir)/uarj.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ uc1541: $(top_builddir)/config.status $(srcdir)/uc1541.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ uha: $(top_builddir)/config.status $(srcdir)/uha.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ ulha: $(top_builddir)/config.status $(srcdir)/ulha.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ upp: $(top_builddir)/config.status $(srcdir)/upp.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ uextrar: $(top_builddir)/config.status $(srcdir)/uextrar.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ uxdms: $(top_builddir)/config.status $(srcdir)/uxdms.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ uxpk: $(top_builddir)/config.status $(srcdir)/uxpk.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ uzip: $(top_builddir)/config.status $(srcdir)/uzip.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ uzoo: $(top_builddir)/config.status $(srcdir)/uzoo.in cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ install-extfsscriptsSCRIPTS: $(extfsscripts_SCRIPTS) @$(NORMAL_INSTALL) @list='$(extfsscripts_SCRIPTS)'; test -n "$(extfsscriptsdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(extfsscriptsdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(extfsscriptsdir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n' \ -e 'h;s|.*|.|' \ -e 'p;x;s,.*/,,;$(transform)' | sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1; } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) { files[d] = files[d] " " $$1; \ if (++n[d] == $(am__install_max)) { \ print "f", d, files[d]; n[d] = 0; files[d] = "" } } \ else { print "f", d "/" $$4, $$1 } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_SCRIPT) $$files '$(DESTDIR)$(extfsscriptsdir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(extfsscriptsdir)$$dir" || exit $$?; \ } \ ; done uninstall-extfsscriptsSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(extfsscripts_SCRIPTS)'; test -n "$(extfsscriptsdir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(extfsscriptsdir)'; $(am__uninstall_files_from_dir) mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-extfsdataDATA: $(extfsdata_DATA) @$(NORMAL_INSTALL) @list='$(extfsdata_DATA)'; test -n "$(extfsdatadir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(extfsdatadir)'"; \ $(MKDIR_P) "$(DESTDIR)$(extfsdatadir)" || exit 1; \ fi; \ for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; \ done | $(am__base_list) | \ while read files; do \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(extfsdatadir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(extfsdatadir)" || exit $$?; \ done uninstall-extfsdataDATA: @$(NORMAL_UNINSTALL) @list='$(extfsdata_DATA)'; test -n "$(extfsdatadir)" || list=; \ files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ dir='$(DESTDIR)$(extfsdatadir)'; $(am__uninstall_files_from_dir) tags TAGS: ctags CTAGS: cscope cscopelist: distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(SCRIPTS) $(DATA) installdirs: for dir in "$(DESTDIR)$(extfsscriptsdir)" "$(DESTDIR)$(extfsdatadir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-extfsdataDATA install-extfsscriptsSCRIPTS install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-extfsdataDATA uninstall-extfsscriptsSCRIPTS .MAKE: install-am install-strip .PHONY: all all-am check check-am clean clean-generic clean-libtool \ cscopelist-am ctags-am distclean distclean-generic \ distclean-libtool distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am \ install-extfsdataDATA install-extfsscriptsSCRIPTS install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags-am uninstall uninstall-am uninstall-extfsdataDATA \ uninstall-extfsscriptsSCRIPTS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: avfs-1.1.4/extfs/uar.in0000644000175000001440000000172314032341001011630 00000000000000#!/bin/sh # # Written by Alex Kuchma # Alex Tkachenko # Updated by Vitezslav Samel # # (C) 1997, 1998 The Free Software Foundation. # # XAR=ar mcarfs_list () { $XAR tv "$1" | sed 's,^,-,;s, , 1 ,;s,/, ,' } mcarfs_copyout () { $XAR p "$1" "$2" > "$3" } mcarfs_copyin () { TMPDIR=`mktemp -d "${MC_TMPDIR:-/tmp}/mctmpdir-uar.XXXXXX"` || exit 1 name=`basename "$2"` (cd "$TMPDIR" && cp -fp "$3" "$name" && $XAR r "$1" "$name") rm -rf "$TMPDIR" } mcarfs_rm () { $XAR d "$1" "$2" } # override any locale for dates LC_ALL=C export LC_ALL umask 077 case "$1" in list) mcarfs_list "$2" ;; copyout) shift; mcarfs_copyout "$@" ;; copyin) shift; mcarfs_copyin "$@" ;; rm) shift; mcarfs_rm "$@" ;; mkdir|rmdir) echo "mcarfs: ar archives cannot contain directories." 1>&2 exit 1;; *) echo "mcarfs: unknown command: \"$1\"." 1>&2 exit 1;; esac exit 0 avfs-1.1.4/extfs/dpkg.in0000644000175000001440000002143714032341001011772 00000000000000#! @PERL@ # # 1999 (c) Piotr Roszatycki # This software is under GNU license # last modification: 1999-12-08 # # dpkg sub quote { $_ = shift(@_); s/([^\w\/.+-])/\\$1/g; return($_); } sub bt { my ($dt) = @_; my (@time); @time = localtime($dt); $bt = sprintf "%02d-%02d-%d %02d:%02d", $time[4] + 1, $time[3], $time[5] + 1900, $time[2], $time[1]; return $bt; } sub ft { my ($f) = @_; return "d" if -d $f; return "l" if -l $f; return "p" if -p $f; return "S" if -S $f; return "b" if -b $f; return "c" if -c $f; return "-"; } sub fm { my ($n) = @_; my ($m); if( $n & 0400 ) { $m .= "r"; } else { $m .= "-"; } if( $n & 0200 ) { $m .= "w"; } else { $m .= "-"; } if( $n & 04000 ) { $m .= "s"; } elsif( $n & 0100 ) { $m .= "x"; } else { $m .= "-"; } if( $n & 0040 ) { $m .= "r"; } else { $m .= "-"; } if( $n & 0020 ) { $m .= "w"; } else { $m .= "-"; } if( $n & 02000 ) { $m .= "s"; } elsif( $n & 0010 ) { $m .= "x"; } else { $m .= "-"; } if( $n & 0004 ) { $m .= "r"; } else { $m .= "-"; } if( $n & 0002 ) { $m .= "w"; } else { $m .= "-"; } if( $n & 01000 ) { $m .= "t"; } elsif( $n & 0001 ) { $m .= "x"; } else { $m .= "-"; } return $m; } sub ls { my ($file,$path,$mode) = @_; if (-f $file) { my @stat = stat(_); # mode, nlink, uid, gid, size, mtime, filename printf "%s %d %d %d %d %s %s\n", $mode || ft($file).fm($stat[2] & 07777), $stat[3], $stat[4], $stat[5], $stat[7], bt($stat[9]), $path; } } $DATE=bt(time()); sub list { my ($pkg, $fn, $dn, $sz, $bt); my %debs = (); my %sects = (); my($diversions,$architecture); chop($diversions = `dpkg-divert --list 2>/dev/null`); chop($architecture = `dpkg-architecture 2>/dev/null`); chop($list = `dpkg -l '*' 2>/dev/null`); chop($getselections = `dpkg --get-selections 2>/dev/null`); chop($audit = `dpkg --audit 2>/dev/null`); $sz = length($diversions); print "-r--r--r-- 1 root root $sz $DATE DIVERSIONS\n"; $sz = length($architecture); print "-r--r--r-- 1 root root $sz $DATE ARCHITECTURE\n"; $sz = length($list); print "-r--r--r-- 1 root root $sz $DATE LIST\n"; $sz = length($getselections); print "-r--r--r-- 1 root root $sz $DATE GET-SELECTIONS\n"; $sz = length($audit); print "-r--r--r-- 1 root root $sz $DATE AUDIT\n"; $sz = length($pressconfigure); print "-r-xr--r-- 1 root root $sz $DATE CONFIGURE\n"; $sz = length($pressremove); print "-r-xr--r-- 1 root root $sz $DATE REMOVE\n"; $sz = length($pressclearavail); print "-r-xr--r-- 1 root root $sz $DATE CLEAR-AVAIL\n"; $sz = length($pressforgetoldunavail); print "-r-xr--r-- 1 root root $sz $DATE FORGET-OLD-UNAVAIL\n"; ls("/var/lib/dpkg/status","STATUS","-r--r--r--"); # ls("/var/lib/dpkg/available","AVAILABLE","-r--r--r--"); print "drwxr-xr-x 1 root root 0 $DATE all\n"; open STAT, "/var/lib/dpkg/status" or exit 1; while( ) { chop; if( /^([\w-]*): (.*)/ ) { $pkg = $2 if( lc($1) eq 'package' ); $debs{$pkg}{lc($1)} = $2; } } close STAT; foreach $pkg (sort keys %debs) { next if $debs{$pkg}{status} =~ /not-installed/; $fn = $debs{$pkg}{package}. "_". $debs{$pkg}{version}; $dn = $debs{$pkg}{section}; if( ! $dn ) { $dn = "unknown"; } elsif( $dn =~ /^(non-us)$/i ) { $dn .= "/main"; } elsif( $dn !~ /\// ) { $dn = "main/". $dn; } unless( $sects{$dn} ) { my $sub = $dn; while( $sub =~ s!^(.*)/[^/]*$!$1! ) { unless( $sects{$sub} ) { print "drwxr-xr-x 1 root root 0 $DATE $sub/\n"; $sects{$sub} = 1; } } print "drwxr-xr-x 1 root root 0 $DATE $dn/\n"; $sects{$dn} = 1; } $sz = $debs{$pkg}{'status'} =~ /config-files/ ? 0 : $debs{$pkg}{'installed-size'} * 1024; @stat = stat("/var/lib/dpkg/info/".$debs{$pkg}{package}.".list"); $bt = bt($stat[9]); print "-rw-r--r-- 1 root root $sz $bt $dn/$fn.debd\n"; print "lrwxrwxrwx 1 root root $sz $bt all/$fn.debd -> ../$dn/$fn.debd\n"; } } sub copyout { my($archive,$filename) = @_; my $qfilename = quote($filename); if( $archive eq 'DIVERSIONS' ) { system("dpkg-divert --list > $qfilename 2>/dev/null"); } elsif( $archive eq 'ARCHITECTURE' ) { system("dpkg-architecture > $qfilename 2>/dev/null"); } elsif( $archive eq 'LIST' ) { system("dpkg -l '*' > $qfilename 2>/dev/null"); } elsif( $archive eq 'AUDIT' ) { system("dpkg --audit > $qfilename 2>/dev/null"); } elsif( $archive eq 'GET-SELECTIONS' ) { system("dpkg --get-selections > $qfilename 2>/dev/null"); } elsif( $archive eq 'STATUS' ) { system("cp /var/lib/dpkg/status $qfilename"); } elsif( $archive eq 'AVAILABLE' ) { system("cp /var/lib/dpkg/available $qfilename"); } elsif( $archive eq 'CONFIGURE' ) { open O, ">$filename"; print O $pressconfigure; close O; } elsif( $archive eq 'REMOVE' ) { open O, ">$filename"; print O $pressremove; close O; } elsif( $archive eq 'CLEAR-AVAIL' ) { open O, ">$filename"; print O $pressclearavail; close O; } elsif( $archive eq 'FORGET-OLD-UNAVAIL' ) { open O, ">$filename"; print O $pressforgetoldunavail; close O; } else { open O, ">$filename"; print O $archive, "\n"; close O; } } # too noisy but less dangerouse sub copyin { my($archive,$filename) = @_; my $qfilename = quote($filename); if( $archive =~ /\.deb$/ ) { system("dpkg -i $qfilename>/dev/null"); } else { die "extfs: cannot create regular file \`$archive\': Permission denied\n"; } } sub run { my($archive,$filename) = @_; if( $archive eq 'CONFIGURE' ) { system("dpkg --pending --configure"); } elsif( $archive eq 'REMOVE' ) { system("dpkg --pending --remove"); } elsif( $archive eq 'CLEAR-AVAIL' ) { system("dpkg --clear-avail"); } elsif( $archive eq 'FORGET-OLD-UNAVAIL' ) { system("dpkg --forget-old-unavail"); } else { die "extfs: $filename: command not found\n"; } } # Disabled - too dangerous and too noisy sub rm_disabled { my($archive) = @_; if( $archive =~ /\.debd?$/ ) { my $qname = quote($archive); $qname =~ s%.*/%%g; $qname =~ s%_.*%%g; system("if dpkg -s $qname | grep ^Status | grep -qs config-files; \ then dpkg --purge $qname>/dev/null; \ else dpkg --remove $qname>/dev/null; fi"); die("extfs: $archive: Operation not permitted\n") if $? != 0; } else { die "extfs: $archive: Operation not permitted\n"; } } $pressconfigure=< # I use this script like example # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA SEVENZ=`which 7za` mc7zfs_list () { $SEVENZ l "$1" 2> /dev/null | @AWK@ -v uid=$(id -ru) ' BEGIN { flag=0; arr_of_month="JanFebMarAprMayJunJulAugSepOctNovDec" } /^-------/ { flag++; if (flag > 1) exit 0; next } { if (flag == 0) next year=substr($1, 1, 4) month=substr($1, 6, 2) day=substr($1, 9, 2) month_name=substr(arr_of_month, (month-1)*3+1, 3) time=substr($2, 1, 5) if (index($3, "D") != 0) attr="drwxr-xr-x" else if (index($3, ".") != 0) attr="-rw-r--r--" size=$4 $0=substr($0, 54) if (NF > 1) name=$0 else name=$1 gsub(/\\/, "/", name) printf "%s 1 %-8d %-8d %8d %3s %2d %4d %s %s\n", attr, uid, 0, size, month_name, day, year, time, name }' } mc7zfs_copyin () { # preserve pwd. pwd=`pwd` # Create a directory and copy in it the tmp file with the random name dir="$3".dir mkdir "$dir" || exit 1 cd "$dir" mv "$1" . arname=`basename "$1"` di="${2%/*}" # if file is to be written upper in the archive tree, make fake dir if test "$di" != "${2##*/}" ; then # echo asdsad 1>&2 mkdir -p "$di" || exit 1 fi # pwd > /tmp/cdir # echo "$arname $2" > /tmp/ters cp -fp "$3" "$dir/$2" # cp -f "$1" "$3.dir" $SEVENZ a "$arname" "$2" -w >/dev/null 2> /dev/null mv "$arname" "$1" cd $pwd rm -rf "$3.dir" } mc7zfs_copyout () { TMPDIR=`mktemp -u "${MC_TMPDIR:-/tmp}/mctmpdir-u7z.XXXXXX"` || exit 1 trap 'rm -rf "$TMPDIR"; exit 0' 1 2 3 4 15 mkdir -m 0700 "$TMPDIR" || exit 1 # echo "$1 $2 $3" > hers # p7zip 0.91 don't understand filename in subdir without "./" # but in top dir it understand only without "./" FLIST=`$SEVENZ l "$1" 2> /dev/null` echo "$FLIST" | grep -q "[.][/]" > /dev/null 2>&1 && EXFNAME=*./"$2" || EXFNAME="$2" EXFN=`basename "$2"` $SEVENZ e -r- "$1" "$EXFNAME" -o"$TMPDIR" > /dev/null 2> /dev/null cat "$TMPDIR"/"$EXFN" > "$3" rm -rf "$TMPDIR" } umask 077 cmd="$1" shift case "$cmd" in list) mc7zfs_list "$@" ;; copyin) mc7zfs_copyin "$@" ;; copyout) mc7zfs_copyout "$@" ;; *) exit 1 ;; esac exit 0 avfs-1.1.4/extfs/extfs.ini0000644000175000001440000000225214032341001012341 00000000000000# Each external VFS type must be registered here if you want to use it u7z .7z # Popular pc archivers # uzip .zip .jar uzoo .zoo ulha .lha .lhz uextrar uha # For arj usage you need special patch to unarj uarj .arj # ar is used for static libraries # uar .a # cpio archiver (unix) ucpio .cpio # Packages from popular Linux distributions rpm .rpm deb # .deb # Only works on Debian systems while 'ar' works on all # a: - mtools filesystem. I probably broke this one # a: # For browsing lslR listings (found on many ftp sites) lslR # Simple fs for list of popular ftp sites ftplist .ftplist # Hewlet packard calculator hp48: # Breaks patches into chunks patchfs .patch .diff # Represents a mailbox as a directory mailfs # Lists the rpms on the system rpms: trpm .trpm # dpkg frontent dpkg: debd # apt frontend apt: deba # Simple filesystem for audio cdroms. Use /dev/cdrom#audio (or /#audio). audio # Package of Bad Penguin (an Italian GNU/Linux distribution) bpp # ISO image iso9660 uace # c64 disk images uc1541 # dar archive udar .dar # amiga disk images uadf .adf uarc ucab uimg # amiga power packer upp .pp # amiga dms archives uxdms .dms # amiga xpk archives uxpk avfs-1.1.4/extfs/audio.in0000644000175000001440000000245114032341001012141 00000000000000#! /bin/sh # # Written by Pavel Machek # CDDB support by Adam Byrtek # # (C) 2000 The Free Software Foundation. # set -e CDDB_SERVER="http://freedb.freedb.org" CDDB_HANDSHAKE="hello=user+localhost+mc+1.0&proto=1" CDDB_TIMEOUT=20 # in seconds audiofs_list() { DATE=`date +"%b %d %H:%M"` echo "-r--r--r-- 1 0 0 0 $DATE CDDB" cdparanoia -Q -d "$1" 2>&1 | grep '^[ 0-9][ 0-9][ 0-9]\.' | while read A B C do A=`echo "$A" | sed -e 's/\.//' -e 's/^\(.\)$/0\1/'` SIZE=`expr 44 + $B \* 2352` echo "-r--r--r-- 1 0 0 $SIZE $DATE track-${A}.wav" done } audiofs_copyout() { if [ x"$2" = x"CDDB" ]; then DISCID=`cd-discid "$1" | tr " " "+"` if [ -z "$DISCID" ]; then exit 1 fi RESPONSE=`wget -q -T $CDDB_TIMEOUT -O - "$CDDB_SERVER/~cddb/cddb.cgi?cmd=cddb+query+$DISCID&$CDDB_HANDSHAKE" | tee "$3" | @AWK@ '/^200/ { print $2,$3; }'` wget -q -T $CDDB_TIMEOUT -O - "$CDDB_SERVER/~cddb/cddb.cgi?cmd=cddb+read+$RESPONSE&$CDDB_HANDSHAKE" | grep -v "^#" >> "$3" else TRACK=`echo "$2" | sed 's/track-0*//' | sed 's/\.wav//'` cdparanoia -q -d "$1" "$TRACK" "$3" >/dev/null fi } if [ ! -b "$2" ] then BASE="/dev/cdrom" else BASE="$2" fi case "$1" in list) audiofs_list "$BASE"; exit 0;; copyout) audiofs_copyout "$BASE" "$3" "$4"; exit 0;; esac exit 1 avfs-1.1.4/extfs/deba.in0000644000175000001440000000577314032341001011745 00000000000000#! @PERL@ # # 1999 (c) Piotr Roszatycki # This software is under GNU license # last modification: 1999-12-08 # # deba sub quote { $_ = shift(@_); s/([^\w\/.+-])/\\$1/g; return($_); } sub list { my($qarchive)=@_; $qarchive = quote($qarchive); chop($date=`LC_ALL=C date "+%m-%d-%Y %H:%M"`); chop($info_size=`apt-cache show $qarchive | wc -c`); $install_size=length($pressinstall); $upgrade_size=length($pressupgrade); print "-r--r--r-- 1 root root $info_size $date INFO\n"; chop($debd = `dpkg -s $qarchive | grep -i ^Version | sed 's/^version: //i'`); chop($deba = `apt-cache show $qarchive | grep -i ^Version | sed 's/^version: //i'`); if( ! $debd ) { print "-r-xr--r-- 1 root root $install_size $date INSTALL\n"; } elsif( $debd ne $deba ) { print "-r-xr--r-- 1 root root $upgrade_size $date UPGRADE\n"; } } sub copyout { my($archive,$filename,$destfile)=@_; my $qarchive = quote($archive); my $qdestfile = quote($destfile); if($filename eq "INFO") { system("apt-cache show $qarchive > $qdestfile"); } elsif($filename eq "INSTALL") { if ( open(FILEOUT, "> $destfile") ) { print FILEOUT $pressinstall; close FILEOUT; system("chmod a+x $qdestfile"); } } elsif($filename eq "UPGRADE") { if ( open(FILEOUT, ">, $destfile") ) { print FILEOUT $pressupgrade; close FILEOUT; system("chmod a+x $qdestfile"); } } else { die "extfs: $filename: No such file or directory\n"; } } sub run { my($archive,$filename)=@_; my $qarchive = quote($archive); if($filename eq "INSTALL") { system("apt-get install $qarchive"); } elsif($filename eq "UPGRADE") { system("apt-get install $qarchive"); } else { die "extfs: $filename: Permission denied\n"; } } $pressinstall=< # uxdms 0.9.0 # # (C) 2007 Ralf Hoffmann # May be distributed under the terms of the GNU General # Public License V2 or higher # # requires xdms (http://zakalwe.fi/~shd/foss/xdms/) # XDMS=xdms AWK=@AWK@ extfs_xdms_list () { if test -f "$1"; then t=$(ls -l "$1" | $AWK '{print $6, $7, $8}') name=$(basename "$1" | sed 's/\(.*\)\.dms/\1/') adfname="$name.adf" adfsize=$($XDMS f "$1" 2>/dev/null | $AWK 'BEGIN { sum = 0 } /^[ ]*[0-9]+/ { sum += $3 } END { print sum }') statsize=$($XDMS f "$1" 2>/dev/null | wc -c) echo "-rw-r--r-- 1 $(id -nu) $(id -ng) $adfsize $t $adfname" echo "-rw-r--r-- 1 $(id -nu) $(id -ng) $statsize $t STAT" fi } extfs_xdms_copyout () { name=$(basename "$1" | sed 's/\(.*\)\.dms/\1/') adfname="$name.adf" if test "$2" = "$adfname"; then $XDMS -q u "$1" +"$3" elif test "$2" = "STAT"; then $XDMS f "$1" > "$3" 2>/dev/null fi } # override any locale for dates LC_ALL=C export LC_ALL umask 077 case "$1" in list) extfs_xdms_list "$2" ;; copyout) shift extfs_xdms_copyout "$@" ;; *) echo "extfs_xdms: unknown command: \"$1\"." 1>&2 exit 1 ;; esac exit 0 avfs-1.1.4/extfs/ucab0000644000175000001440000000355214032341001011350 00000000000000#!/bin/sh # This is a parser for Microsoft cabinet files in Midnight Commander. You need # the GPL cabextract program (version >= 1.1) written by Stuart Caie. # Author: Guus Jansman # Limitations: # The archive file can not be changed. # File attributes are not preserved. # Alternative programs (not supported by this script): # cablinux (Linux, Rien, seems buggy and no compression) # 7-Zip (win32, list/unpack only) # p7zip # MultiArc MsCab 0.61 (win32, plug-in for Total Commander) # extract (dos, on Windows CD, list/unpack only) # extrac32 (win32, on Windows CD, list/unpack only) # Settings: UNCAB="cabextract" mccabfs_list () { $UNCAB -l "$1" | gawk -v uid=$(id -ru) ' BEGIN { hyphens=0; date="JanFebMarAprMayJunJulAugSepOctNovDec" } /^----/ { hyphens++; next } /^$/ { next } /^All/ { hyphens = 2; next } // { if (hyphens != 1) next } { str=substr($0, 35) gsub(/\\/, "/", str) if (substr(str, length(str)) == "/") { # cabextract does not distinguish between empty directories and empty files yet # so this will never be executed. Hopefully next cabextract version... perm="drwxr-xr-x" str=substr(str, 1, length(str)-1) } else { perm="-rw-r--r--" } split($3, a, ".") tm=substr($4,1,5) printf "%s 1 %-8d %-8d %8d %3s %2d %4d %s %s\n", perm, uid, 0, $1, substr(date, (a[2]-1)*3+1, 3), a[1], a[3], tm, str }' } mccabfs_copyout () { $UNCAB -F "$2" -p "$1" >"$3" 2>/dev/null } mccabfs_test () { if $UNCAB -l -q "$1" >/dev/null 2>&1; then echo "OK" else echo "UNKNOWN" fi } umask 077 cmd="$1" shift case "$cmd" in list) mccabfs_list "$@" ;; copyout) mccabfs_copyout "$@" ;; # test) mccabfs_test "$@" ;; # Not supported by MC extfs *) exit 1 ;; esac exit 0 avfs-1.1.4/extfs/debd.in0000644000175000001440000002436614032341001011747 00000000000000#! @PERL@ # # 1999 (c) Piotr Roszatycki # This software is under GNU license # last modification: 1999-12-08 # # debd sub quote { $_ = shift(@_); s/([^\w\/.+-])/\\$1/g; return($_); } sub bt { my ($dt) = @_; my (@time); @time = localtime($dt); $bt = sprintf "%02d-%02d-%d %02d:%02d", $time[4] + 1, $time[3], $time[5] + 1900, $time[2], $time[1]; return $bt; } sub ft { my ($f) = @_; return "d" if -d $f; return "l" if -l $f; return "p" if -p $f; return "S" if -S $f; return "b" if -b $f; return "c" if -c $f; return "-"; } sub fm { my ($n) = @_; my ($m); if( $n & 0400 ) { $m .= "r"; } else { $m .= "-"; } if( $n & 0200 ) { $m .= "w"; } else { $m .= "-"; } if( $n & 04000 ) { $m .= "s"; } elsif( $n & 0100 ) { $m .= "x"; } else { $m .= "-"; } if( $n & 0040 ) { $m .= "r"; } else { $m .= "-"; } if( $n & 0020 ) { $m .= "w"; } else { $m .= "-"; } if( $n & 02000 ) { $m .= "s"; } elsif( $n & 0010 ) { $m .= "x"; } else { $m .= "-"; } if( $n & 0004 ) { $m .= "r"; } else { $m .= "-"; } if( $n & 0002 ) { $m .= "w"; } else { $m .= "-"; } if( $n & 01000 ) { $m .= "t"; } elsif( $n & 0001 ) { $m .= "x"; } else { $m .= "-"; } return $m; } sub ls { my ($file) = @_; my @stat = stat($file); # mode, nlink, uid, gid, size, mtime, filename printf "%s%s %d %d %d %d %s CONTENTS%s\n", ft($file), fm($stat[2] & 07777), $stat[3], $stat[4], $stat[5], $stat[7], bt($stat[9]), $file; } sub list { my($archive)=@_; my $qarchive = quote($archive); chop($date=`LC_ALL=C date "+%m-%d-%Y %H:%M"`); chop($info_size=`dpkg -s $qarchive | wc -c`); $repack_size=length($pressrepack); $reinstall_size=length($pressreinstall); $remove_size=length($pressremove); $purge_size=length($presspurge); $reconfigure_size=length($pressreconfigure); $reinstall_size=length($pressreinstall); $select_size=length($pressselect); $unselect_size=length($pressunselect); print "dr-xr-xr-x 1 root root 0 $date CONTENTS\n"; print "dr-xr-xr-x 1 root root 0 $date DEBIAN\n"; print "-r--r--r-- 1 root root $info_size $date INFO\n"; print "-r-xr--r-- 1 root root $purge_size $date DPKG-PURGE\n"; chop($status = `dpkg -s $qarchive | grep ^Status`); if( $status =~ /deinstall/ ) { print "-r-xr--r-- 1 root root $select_size $date DPKG-SELECT\n"; } elsif( $status =~ /install/ ) { print "-r-xr--r-- 1 root root $unselect_size $date DPKG-UNSELECT\n"; } if( $status !~ /config-files/ ) { if ( -x "/usr/bin/dpkg-repack" ) { print "-r-xr--r-- 1 root root $repack_size $date DPKG-REPACK\n"; } print "-r-xr--r-- 1 root root $remove_size $date DPKG-REMOVE\n"; if ( -x "/usr/bin/apt-get" ) { print "-r-xr--r-- 1 root root $remove_size $date APT-REMOVE\n"; print "-r-xr--r-- 1 root root $reinstall_size $date APT-REINSTALL\n"; print "-r-xr--r-- 1 root root $purge_size $date APT-PURGE\n"; } } if( -x "/usr/bin/dpkg-reconfigure" && -x "/var/lib/dpkg/info/$archive.config" ) { print "-r-xr--r-- 1 root root $reconfigure_size $date DPKG-RECONFIGURE\n"; } if ( open(PIPEIN, "LANG=C ls -l /var/lib/dpkg/info/$qarchive.* |") ) { while() { chop; next if /\.list$/; s%/var/lib/dpkg/info/$archive.%DEBIAN/%; print $_, "\n"; } close PIPEIN; } if ( open(LIST, "/var/lib/dpkg/info/$archive.list") ) { while() { chop; ls($_); } close LIST; } } sub copyout { my($archive,$filename,$destfile)=@_; my $qarchive = quote($archive); my $qfilename = quote($filename); my $qdestfile = quote($destfile); if($filename eq "INFO") { system("dpkg -s $qarchive > $qdestfile"); } elsif($filename eq "DPKG-REPACK") { if ( open(FILEOUT,">$destfile") ) { print FILEOUT $pressrepack; close FILEOUT; system("chmod a+x $qdestfile"); } } elsif($filename =~ /^DEBIAN/) { $qfilename=~s!^DEBIAN/!!; system("cat /var/lib/dpkg/info/$qarchive.$qfilename > $qdestfile"); } elsif($filename eq "DPKG-REMOVE" || $filename eq "APT-REMOVE") { if ( open(FILEOUT,">$destfile") ) { print FILEOUT $pressremove; close FILEOUT; system("chmod a+x $qdestfile"); } } elsif($filename eq "DPKG-PURGE" || $filename eq "APT-PURGE") { if ( open(FILEOUT,">$destfile") ) { print FILEOUT $presspurge; close FILEOUT; system("chmod a+x $qdestfile"); } } elsif($filename eq "DPKG-RECONFIGURE") { if ( open(FILEOUT,">$destfile") ) { print FILEOUT $pressreconfigure; close FILEOUT; system("chmod a+x $qdestfile"); } } elsif($filename eq "APT-REINSTALL") { if ( open(FILEOUT,">$destfile") ) { print FILEOUT $pressreinstall; close FILEOUT; system("chmod a+x $destfile"); } } elsif($filename eq "DPKG-SELECT") { if ( open(FILEOUT,">$destfile") ) { print FILEOUT $pressselect; close FILEOUT; system("chmod a+x $destfile"); } } elsif($filename eq "DPKG-UNSELECT") { if ( open(FILEOUT,">$destfile") ) { print FILEOUT $pressunselect; close FILEOUT; system("chmod a+x $qdestfile"); } } else { $qfilename=~s!^CONTENTS!!; system("cat $qfilename > $qdestfile"); } } sub run { my($archive,$filename)=@_; my $qarchive = quote($archive); my $qfilename = quote($filename); if($filename eq "DPKG-REMOVE") { system("dpkg --remove $qarchive"); } elsif($filename eq "APT-REMOVE") { system("apt-get remove $qarchive"); } elsif($filename eq "DPKG-PURGE") { system("dpkg --purge $qarchive"); } elsif($filename eq "APT-PURGE") { system("apt-get --purge remove $qarchive"); } elsif($filename eq "DPKG-REPACK") { system("dpkg-repack $qarchive"); } elsif($filename eq "DPKG-SELECT") { system("echo $aqrchive install | dpkg --set-selections"); } elsif($filename eq "DPKG-UNSELECT") { system("echo $qarchive deinstall | dpkg --set-selections"); } elsif($filename eq "APT-REINSTALL") { system("apt-get -u --reinstall install $qarchive"); } elsif($filename eq "DPKG-RECONFIGURE") { system("dpkg-reconfigure $qarchive"); } elsif($filename=~/^DEBIAN/) { $qfilename=~s!^DEBIAN!!; system("/var/lib/dpkg/info/$qarchive.$qfilename"); } else { $qfilename=~s!^CONTENTS!!; system($qfilename); } } $pressrepack=<, Feb 1998 # # This script makes it possible to view and copy files to/from a hp48 # (tested with a HP48G and the emulator x48) # # To use the hp48 external filesystem: # - read the relevant parts of your HP48 manual # - install kermit # - connect the HP48 to your computer or start x48 # - below change the line which reflects the serial device you use # - configure your HP48 ( - i/o - iopar): # port: wire # baud: 9600 # transfer format: binary (fast transfers) or # ascii (editable on the pc) # - start the server on the HP48: - i/o - srvr - serve # or the shortcut - # - on MC's commandline enter "cd hp48:" # # Make sure you have kermit installed and that it's using the right serial # device by changing /dev/ttyXX on the next line AWK=@AWK@ KERMIT="kermit -l /dev/ttyS1 -b 9600" hp48_cmd() { $KERMIT -C "SET EXIT WARNING OFF,REMOTE $1,QUIT" } hp48_cd() { (echo SET EXIT WARNING OFF;echo REMOTE HOST HOME for HP48_DIR in `echo "$1" | tr '/' ' '`;do if [ "x$HP48_DIR" != "x." ];then echo REMOTE HOST "$HP48_DIR"; fi done echo QUIT)| $KERMIT -B >/dev/null } hp48_retdir() { echo "$1" } hp48_retsize() { printf "%d" "$2" 2>/dev/null } hp48_parser() { HP48_DIRS= read -r INPUT while [ "x$INPUT" != "xEOF" ] do case `echo "$INPUT" | $AWK '{if (int($2)) if ($3 == "Directory") print "dir";else print "file"}'` in dir) HP48_DIRS="$HP48_DIRS `hp48_retdir \"$INPUT\"`" printf "drwxr-xr-x 1 %-8d %-8d %8d %s %s\n" 0 0 `hp48_retsize "$INPUT"` "`date +\"%b %d %Y %k:%M\"`" "$HP48_CDIR/`hp48_retdir \"$INPUT\"`";; file) printf "-rw-r--r-- 1 %-8d %-8d %8d %s %s\n" 0 0 `hp48_retsize "$INPUT"` "`date +\"%b %d %Y %k:%M\"`" "$HP48_CDIR/`hp48_retdir \"$INPUT\"`";; esac read -r INPUT done for HP48_DIR in $HP48_DIRS; do HP48_PDIR="$HP48_CDIR" HP48_CDIR="$HP48_CDIR/$HP48_DIR"; hp48_cmd "HOST $HP48_DIR" >/dev/null hp48_list HP48_CDIR="$HP48_PDIR"; hp48_cmd "HOST UPDIR" >/dev/null done } hp48_list() { { hp48_cmd "DIRECTORY"; echo; echo EOF; } | hp48_parser } # override any locale for dates LC_ALL=C export LC_ALL case "$1" in list) HP48_CDIR= hp48_cmd "HOST HOME" >/dev/null hp48_list exit 0;; copyout) cd "`dirname "$4"`" hp48_cd "`dirname "$3"`" $KERMIT -B -g "`basename "$3"`" -a "$4" >/dev/null exit 0;; copyin) cd "`dirname "$4"`" hp48_cd "`dirname "$3"`" $KERMIT -B -s "$4" -a "`basename "$3"`" >/dev/null exit 0;; esac exit 1 avfs-1.1.4/extfs/mailfs.in0000644000175000001440000000655214032341001012321 00000000000000#! @PERL@ -w use bytes; # MC extfs for (possibly compressed) Berkeley style mailbox files # Peter Daum (Jan 1998, mc-4.1.24) $zcat="zcat"; # gunzip to stdout $bzcat="bzip2 -dc"; # bunzip2 to stdout $file="file"; # "file" command $TZ='GMT'; # default timezone (for Date module) if (eval "require Date::Manip") { import Date::Manip; $parse_date= sub { return UnixDate($_[0], "%l"); # "ls -l" format } } elsif (eval "require Date::Parse") { import Date::Parse; $parse_date= sub { local $_ =localtime(str2time($_[0],$TZ)); s/^... (.+) (\d\d:\d\d):\d\d (\d\d\d\d)$/$1 $3 $2/; return $_; } } else { # use "light" version $parse_date= sub { # assumes something like: Mon, 5 Jan 1998 16:08:19 +0200 (GMT+0200) # if you have mails with another date format, add it here if (/(\d\d?) ([A-Z][a-z][a-z]) (\d\d\d\d) (\d\d?:\d\d)/) { return "$2 $1 $3 $4"; } # Y2K bug. # Date: Mon, 27 Mar 100 16:30:47 +0000 (GMT) if (/(\d\d?) ([A-Z][a-z][a-z]) (1?\d\d) (\d\d?:\d\d)/) { $correct_year = 1900 + $3; if ($correct_year < 1970) { $correct_year += 100; } return "$2 $1 $correct_year $4"; } # AOLMail(SM). # Date: Sat Jul 01 10:06:06 2000 if (/([A-Z][a-z][a-z]) (\d\d?) (\d\d?:\d\d)(:\d\d)? (\d\d\d\d)/) { return "$1 $2 $5 $3"; } # Fallback return localtime(time); } } sub process_header { while () { $size+=length; s/\r$//; last if /^$/; die "unexpected EOF\n" if eof; if (/^Date:\s(.*)$/) { $date=&$parse_date($1); } elsif (/^Subject:\s(.*)$/) { $subj=lc($1); $subj=~ s/^(re:\s?)+//gi; # no leading Re: $subj=~ tr/a-zA-Z0-9//cd; # strip all "special" characters } elsif (/^From:\s.*?(\w+)\@/) { $from=$1; } elsif (/^To:\s.*?(\w+)\@/) { $to=lc($1); } } } sub print_dir_line { $from=$to if ($from eq $user); # otherwise, it would look pretty boring $date=localtime(time) if (!defined $date); printf "-r-------- 1 $< $< %d %s %3.3d_%.25s\n", $size, $date, $msg_nr, "${from}_${subj}"; } sub mailfs_list { my $blank = 1; $user=$ENV{USER}||getlogin||getpwuid($<) || "nobody"; while() { s/\r$//; if($blank && /^From /) { # Start of header print_dir_line unless (!$msg_nr); $size=length; $msg_nr++; ($from,$to,$subj,$date)=("none","none","none", "01-01-80"); process_header; $line=$blank=0; } else { $size+=length; $line++; $blank= /^$/; } } print_dir_line unless (!$msg_nr); exit 0; } sub mailfs_copyout { my($source,$dest)=@_; exit 1 unless (open STDOUT, ">$dest"); ($nr)= ($source =~ /^(\d+)/); # extract message number from "filename" my $blank = 1; while() { s/\r$//; if($blank && /^From /) { $msg_nr++; exit(0) if ($msg_nr > $nr); $blank= 0; } else { $blank= /^$/; } print if ($msg_nr == $nr); } } # main { exit 1 unless ($#ARGV >= 1); $msg_nr=0; $cmd=shift; $mbox_name=shift; my $mbox_qname = quotemeta ($mbox_name); $_=`$file $mbox_qname`; if (/gzip/) { exit 1 unless (open IN, "$zcat $mbox_qname|"); } elsif (/bzip/) { exit 1 unless (open IN, "$bzcat $mbox_qname|"); } else { exit 1 unless (open IN, "<$mbox_name"); } umask 077; if($cmd eq "list") { &mailfs_list; exit 0; } elsif($cmd eq "copyout") { &mailfs_copyout(@ARGV); exit 0; } exit 1; avfs-1.1.4/extfs/README0000644000175000001440000001577114032341001011401 00000000000000 Writing scripts for Midnight Commander's external vfs IMPORTANT NOTE: There may be some bugs left in extfs. Enjoy. Starting with version 3.1, the Midnight Commander comes with so called extfs, which is one of the virtual filesystems. This system makes it possible to create new virtual filesystems for the GNU MC very easily. Such work has two basic steps: 1. Editing $(libdir)/extfs/extfs.ini. 2. Creating a shell script/program to handle requests. (Note: $(libdir) should be substituted for actual libdir path stored when configured or compiled, like /usr/local/lib/mc or /usr/lib/mc). The first one is very easy: You assign a vfs suffix. For example, if you have .zip file, and would like to see what's inside it, path will be /anypath/my.zip#uzip/some_path/... Then you add a line extfs.ini file containing just that extension. If your vfs does not require a file to work on, add ':' to the of name. In this example, .zip is suffix, but I call vfs 'uzip'. Why? Well, what this vfs essentially does is UNzip. UN is too long, so I choosed U. Note that sometime in the future, a filesystem like zip may exist: It will take whole tree and create .zip file from it. So /usr:zip will be zipfile containing whole /usr tree. The second one may require some knowledge of shell/c programming: You have to create a program (with executable permissions), "prefix", in $(libdir)/extfs (in our example $(libdir)/extfs/uzip). * Commands that should be implemented by your shell script ---------------------------------------------------------- $libdir/extfs/prefix command [arguments] * Command: list archivename This command should list the complete archive content in the following format (a little modified ls -l listing): AAAAAAA NNN OOOOOOOO GGGGGGGG SSSSSSSS DATETIME [PATH/]FILENAME [-> [PATH/]FILENAME[/]]] where (things in [] are optional): AAAAAAA is the permission string like in ls -l NNN is the number of links OOOOOOOO is the owner (either UID or name) GGGGGGGG is the group (either GID or name) SSSSSSSS is the file size FILENAME is the filename PATH is the path from the archive's root without the leading slash (/) DATETIME has one of the following formats: Mon DD hh:mm, Mon DD YYYY, Mon DD YYYY hh:mm, MM-DD-YY hh:mm where Mon is a three digit english month name, DD day 1-31, MM month 01-12, YY two digit year, YYYY four digit year, hh hour and mm minute. If the -> [PATH/]FILENAME part is present, it means: If permissions start with an l (ell), then it is the name that symlink points to. (If this PATH starts with a MC vfs prefix, then it is a symlink somewhere to the other virtual filesystem (if you want to specify path from the local root, use local:/path_name instead of /path_name, since /path_name means from root of the archive listed). If permissions do not start with l, but number of links is greater than one, then it says that this file should be a hardlinked with the other file. * Command: copyout archivename storedfilename extractto This should extract from archive archivename the file called storedfilename (possibly with path if not located in archive's root [this is wrong. current extfs strips paths! -- pavel@ucw.cz]) to file extractto. * Command: copyin archivename storedfilename sourcefile This should add to the archivename the sourcefile with the name storedfilename inside the archive. Important note: archivename in the above examples may not have the extension you are expecting to have, like it may happen that archivename will be something like /tmp/f43513254 or just anything. Some archivers do not like it, so you'll have to find some workaround. * Command: run archivename storedfilename This should execute some appropriate command, for instance, in the 'deb' module, 'run a.deb INSTALL' installs the archive with dpkg. --------------------------------------------------------- Don't forget to mark this file executable (chmod 755 ThisFile, for example) For skeleton structure of executable, look at some of filesystems similar to yours. --------------------------------------------------------- In constructing these routines, errors will be made, and mc will not display a malformed printing line. That can lead the programmer down many false trails in search of the bug. Since this routine is an executable shell script it can be run from the command line independently of mc, and its output will show on the console or can be redirected to a file. * Putting it to use ---------------------------------------------------------- The file .mc.ext in a home directory, and in mc's user directory (commonly /usr/local/lib/mc), contains instructions for operations on files depending on filename extensions. It is well documented in other files in this distribution, so here are just a few notes specifically on use of the Virtual File System you just built. There are entries in .mc.ext defining a few operations that can be done on a file from an mc panel. Typically they are annotated with a hash mark and a file extension like this: # zip There must be a way to find the file by extension, so the next line does that. In essence it says "identify the string ".zip" or (|) ".ZIP" at the end ($) of a filename": regex/\.(zip|ZIP)$ The operations themselves follow that. They must be indented by at least a space, and a tab works as well. In particular, the Open operation will now use your new virtual file system by cd'ing to it like this: Open=%cd zip:%d/%p This is the line used when a file is highlighted in a panel and the user presses or . The contents of the archive should show just as if they were in a real directory, and can be manipulated as such. The rest of the entry pertains to use of the F3 View key: View=%view{ascii} unzip -v %f And perhaps an optional icon for X: Icon=zip.xpm And perhaps an operation to extract the contents of the file, called from a menu selection: Extract=unzip %f '*' This is just an example. The current entry for .zip files has a menu selection of 'Unzip' which could be used in place of 'Extract'. What goes here depends on what items you have in, or add to, the menu system, and that's another subject. The sum of this is the .mc.ext entry: # zip regex/\.(zip|ZIP)$ Open=%cd zip:%d/%p View=%view{ascii} unzip -v %f Icon=zip.xpm Extract=unzip %f '*' Add an entry like this to the .mc.ext file in a user's home directory, If you want others to have it, add it to the mc.ext file in the mc system directory, often /usr/local/lib/mc/mc.ext. Notice this file is not prepended with a dot. Once all this is done, and things are in their proper places, exit mc if you were using it, and restart it so it picks up the new information. That's all there is to it. The hardest part is making a listing function that sorts the output of a system listing command and turns it into a form that mc can use. Currently awk (or gawk) is used because nearly all systems have it. If another scripting language is available, like perl, that could also be used. (update: perl is used in several of the scripts now) avfs-1.1.4/extfs/Makefile.am0000644000175000001440000000111314032341001012536 00000000000000EXTFS_CONST = \ bpp \ ftplist \ rpm \ trpm \ uadf \ uarc \ ucab \ ucpio \ udar \ uimg EXTFS_IN = \ a \ apt \ audio \ deb \ deba \ debd \ dpkg \ hp48 \ iso9660 \ lslR \ mailfs \ patchfs \ rpms \ u7z \ uace \ uar \ uarj \ uc1541 \ uha \ ulha \ upp \ uextrar \ uxdms \ uxpk \ uzip \ uzoo extfsscriptsdir = @moduledir@/extfs extfsscripts_SCRIPTS = $(EXTFS_IN) $(EXTFS_CONST) extfsdatadir = @moduledir@/extfs extfsdata_DATA = extfs.ini README EXTRA_DIST = $(extfsdata_DATA) $(EXTFS_CONST) avfs-1.1.4/extfs/rpms.in0000644000175000001440000000273614032341001012027 00000000000000#! @PERL@ # # Written by Balazs Nagy (julian7@kva.hu) 1998 # locale bugfix by Michal Svec (rebel@penguin.cz) 2000 # (C) 1998 The Free Software Foundation. # # # override any locale for dates delete $ENV{"LC_ALL"}; $ENV{"LC_TIME"}="C"; #print $ENV{"LC_ALL"}; #exit 0; sub gd { my ($dt) = @_; $dt =~ tr/ //s; $dt =~ s/^\w+ (\w+) (\d+) (\d+:\d+):\d+ .+\n?$/$1 $2 $3/; return $dt; } $DATE=gd(`date`); sub list { my (@rpms, %files, $i, $fn, $dn, $sz, $bt); # @rpms = `rpm -qa --qf "\%{NAME}-\%{VERSION}-\%{RELEASE}:\%{GROUP}:\%{SIZE}:\%{BUILDTIME:date}\n"`; @rpms = `rpm -qa --qf "\%{NAME}-\%{VERSION}:\%{GROUP}:\%{SIZE}:\%{BUILDTIME:date}\n"`; print @trpms; %files = (); %sizes = (); %dates = (); for $i (@rpms) { if ($i =~ /^([^:]+):([^:]+):([^:]+):(.+)$/) { ($fn, $dn, $sz, $bt) = ($1, $2, $3, $4); $dn =~ s/ /_/g; if (defined $files{$dn}) { push(@{$files{$dn}}, $fn); } else { @{$files{$dn}} = ($fn); } $sizes{$fn} = $sz; $dates{$fn} = gd($bt); } } for $i (sort keys %files) { print "dr-xr-xr-x 1 root root 0 $DATE $i/\n"; for $fn (sort @{$files{$i}}) { print "-r--r--r-- 1 root root $sizes{$fn} $dates{$fn} $i/$fn.trpm\n"; } } } #open O, ">>/tmp/tt"; #print O "RPMS: "; #for $i (@ARGV) { # print O "$i "; #} #print O "\n"; #close O; if ($ARGV[0] eq "list") { list(); exit(0); } elsif ($ARGV[0] eq "copyout") { open O, ">$ARGV[3]"; print O $ARGV[2], "\n"; close O; exit(0); } exit(1); avfs-1.1.4/extfs/a.in0000644000175000001440000000617714032341001011271 00000000000000#! @PERL@ -w # # External filesystem for mc, using mtools # Written Ludek Brukner , 1997 # Much improved by Tom Perkins <968794022@noid.net>, 2000 # # WARNING - This software is ALPHA - Absolutely NO WARRANTY # # These mtools components must be in PATH for this to work sub quote { $_ = shift(@_); s/([^\w\/.+-])/\\$1/g; return($_); } $mmd = "mmd"; $mrd = "mrd"; $mdel = "mdel"; $mdir = "mdir -a"; $mcopy = "mcopy -noQ"; $0 =~ s|.*/||; $qdisk = quote($0); $ENV{MTOOLS_DATE_STRING} = "mm-dd-yyyy"; $ENV{MTOOLS_TWENTY_FOUR_HOUR_CLOCK} = "1"; SWITCH: for ( $ARGV[0] ) { /list/ && do { @dirs = get_dirs(""); while ($dir = shift(@dirs)) { push @dirs, get_dirs("$dir/"); } exit 0; }; /mkdir/ && do { shift; shift; exit 1 if scalar(@ARGV) != 1; $qname = quote($ARGV[0]); system("$mmd $qdisk:/$qname >/dev/null"); exit 0; }; /rmdir/ && do { shift; shift; exit 1 if scalar(@ARGV) != 1; $qname = quote($ARGV[0]); system("$mrd $qdisk:/$qname >/dev/null"); exit 0; }; /rm/ && do { shift; shift; exit 1 if scalar(@ARGV) != 1; $qname = quote($ARGV[0]); system("$mdel $qdisk:/$qname >/dev/null"); exit 0; }; /copyout/ && do { shift; shift; exit 1 if scalar(@ARGV) != 2; ( $qsrc, $qdest ) = @ARGV; $qsrc = quote($qsrc); $qdest = quote($qdest); system("$mcopy $qdisk:/$qsrc $qdest >/dev/null"); exit 0; }; /copyin/ && do { shift; shift; exit 1 if scalar(@ARGV) != 2; ( $qdest, $qsrc ) = @ARGV; $qsrc = quote($qsrc); $qdest = quote($qdest); system("$mcopy $qsrc $qdisk:/$qdest >/dev/null"); exit 0; }; /.*/ && do { # an unfamiliar command exit 1; }; } sub get_dirs { my ($path, $name, $size, $date, $time, $longname, @lst, @rv); $path = shift(@_); my $qpath = quote($path); @rv = (); open(FILE,"$mdir $qdisk:/$qpath |"); while ( ) { chomp(); /^ / && next; # ignore `non-file' lines m{^Directory for $0:/}i && next; # ignore `non-file' lines /^$/ && next; # ignore empty lines /^\.\.?/ && next; # ignore `.' and `..' $name = substr($_,0,12); $name =~ s/^([^ ]*) +([^ ]+)[ \t]*$/$1.$2/; $name =~ s/[ .]+$//; $_ = substr($_,12); s/^[ ]+//; ($size,$date,$time,$longname) = split(/[ \t]+/, $_, 4); defined $time || next; # process "am" and "pm". Should not be needed if # MTOOLS_TWENTY_FOUR_HOUR_CLOCK is respected. @lst = split(/([:ap])/, $time); $lst[0] += 12 if (defined $lst[3] && $lst[3] eq "p"); $time = sprintf("%02d:%02d", $lst[0], $lst[2]); @lst = split(/-/, $date); $lst[2] %= 100 if ($lst[2] > 100); $date = sprintf ("%02d-%02d-%02d", @lst); $name = $path . lc(($longname) ? $longname : $name); if ($size =~ /DIR/) { printf("drwxr-xr-x 1 %-8d %-8d %8d %s %s %s\n", 0, 0, 0, $date, $time, $name); push @rv, $name; } else { printf("-rw-r--r-- 1 %-8d %-8d %8d %s %s %s\n", 0, 0, $size, $date, $time, $name); } } close(FILE); return @rv; } 1; avfs-1.1.4/extfs/uarj.in0000644000175000001440000000317014032341001012000 00000000000000#! /bin/sh # # Written by Viatcheslav Odintsov (2:5020/181) # (C) 2002 ARJ Software Russia. # # This is an updated parser for ARJ archives in Midnight Commander. You need # full ARJ rather than UNARJ. Open-source ARJ v 3.10 for Unix platforms can # be obtained here: # # - http://www.sourceforge.net/projects/arj/ # - http://arj.sourceforge.net/ ARJ="arj -+ -ja1" mcarjfs_list () { $ARJ v "$1" | @AWK@ -v uuid=$(id -ru) ' { if (($0 ~ /^[0-9]+\) .*/)||($0 ~ /^------------ ---------- ---------- -----/)){ if (filestr ~ /^[0-9]+\) .*/) { printf "%s 1 %-8d %-8d %8d %02d-%02d-%02d %02d:%02d %s%s\n", perm, uid, gid, size, date[2], date[3], date[1], time[1], time[2], file, symfile perm="" file="" symfile="" filestr="" } } if ($0 ~ /^[0-9]+\) .*/) { filestr=$0 sub(/^[0-9]*\) /, "") file=$0 uid=uuid gid=0 } if ($0 ~ /^.* [0-9]+[\t ]+[0-9]+ [0-9]\.[0-9][0-9][0-9] [0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9].*/) { size=$3 split($6, date, "-") split($7, time, ":") if ($8 ~ /^[rwx-]/) {perm=$8;} else {perm="-rw-r--r--"} } if ($0 ~ /^[\t ]+SymLink -> .*/) { symfile = " -> "$3 perm="l"substr(perm, 2) } if ($0 ~ /^[\t ]+Owner: UID [0-9]+\, GID [0-9]+/) { uid=$3 gid=$5 owner=1 } }' } mcarjfs_copyout () { $ARJ e -y "$1" "$2" -jw"$3" >/dev/null 2>/dev/null } umask 077 cmd="$1" shift case "$cmd" in list) mcarjfs_list "$@" ;; copyout) mcarjfs_copyout "$@" ;; *) exit 1 ;; esac exit 0 avfs-1.1.4/extfs/iso9660.in0000644000175000001440000000422514032341001012160 00000000000000#! /bin/sh # ISO9660 VFS for MC by Michael Shigorin , # modifications by Grigory Milev # and Kachalov Anton April 2003 # based on lslR by Tomas Novak April 2000 # -- look there for additional parsing comments if needed # tested to comply with isoinfo 2.0's output test_iso () { CHARSET=`locale charmap 2>/dev/null` if test -z "$CHARSET"; then CHARSET=`locale 2>/dev/null | grep LC_CTYPE | sed -n -e 's/.*\.\(.*\)"$/\1/p'` fi if test -n "$CHARSET"; then CHARSET=`echo "$CHARSET" | tr '[A-Z]' '[a-z]' | sed -e 's/^iso-/iso/'` isoinfo -j $CHARSET -i /dev/null 2>&1 | @AWK@ "/Iconv not yet supported|Unknown charset/" >/dev/null && CHARSET= fi if test -n "$CHARSET"; then JOLIET_OPT="-j $CHARSET -J" else JOLIET_OPT="-J" fi ISOINFO="isoinfo -R" isoinfo -d -i "$1" | @AWK@ "/UCS level 1|NO Joliet/" > /dev/null || ISOINFO="$ISOINFO $JOLIET_OPT" } mcisofs_list () { # left as a reminder to implement compressed image support =) case "$1" in *.lzma) MYCAT="lzma -dc";; *.xz) MYCAT="xz -dc";; *.bz2) MYCAT="bzip2 -dc";; *.gz) MYCAT="gzip -dc";; *.z) MYCAT="gzip -dc";; *.Z) MYCAT="gzip -dc";; *) MYCAT="cat";; esac $ISOINFO -l -i "$1" | @AWK@ ' BEGIN { dir=""; # Pattern to match 8 first fields. rx = "[^ ]+[ ]+"; rx = "^" rx rx rx rx rx rx rx rx; irx = "^\\[ *-?[0-9]* *[0-9]+\\] +"; } /^$/ { next } /^d---------/ { next } /^Directory listing of [^ ].*$/ { dir=substr($0, 23); next; } { $11 != "" } { name=$0 sub(rx, "", name) attr=substr($0, 1, length($0)-length(name)) # strip inodes and extra dir entries; fix perms sub(irx, "", name) sub("^---------- 0 0 0", "-r--r--r-- 1 root root", attr) sub(" $", "", name) ## sub(";[0-9]+$", "", name) ## would break copyout # skip . and .. if (name ~ /^\.\.?/) next; printf "%s%s%s\n", attr, dir, name }' } mcisofs_copyout () { $ISOINFO -i "$1" -x "/$2" > "$3" } LC_ALL=C cmd="$1" shift case "$cmd" in list) test_iso "$@"; mcisofs_list "$@"; exit 0;; copyout) test_iso "$@"; mcisofs_copyout "$@"; exit 0;; esac exit 1 avfs-1.1.4/extfs/uarc0000644000175000001440000000232314032341001011363 00000000000000#!/bin/sh # This is a parser for ARC archive files in Midnight Commander. You need # the GPL nomarch program (version >= 1.3) written by Russell Marks. # Author: Guus Jansman # Alternative programs (not supported by this script): # arc (Howard Chu) # Settings: UNARC="nomarch" mcarcfs_list () { $UNARC -lv "$1" | gawk -v uid=$(id -ru) ' BEGIN { date="JanFebMarAprMayJunJulAugSepOctNovDec" } { split(substr($0, 14), t) str=substr($0, 1, 13) while (length(str) != 0 && substr(str, length(str), 1) == " ") { str=substr(str, 1, length(str) - 1) } split(t[5], a, "-") perm="-rw-r--r--" printf "%s 1 %-8d %-8d %8d %3s %2d %4d %s %s\n", perm, uid, 0, t[4], substr(date, (a[2]-1)*3+1, 3), a[3], a[1], t[6], str }' } mcarcfs_copyout () { $UNARC -p "$1" "$2" > "$3" 2>/dev/null } mcarcfs_test () { if $UNARC -t "$1" >/dev/null 2>&1; then echo "OK" else echo "UNKNOWN" fi } umask 077 cmd="$1" shift case "$cmd" in list) mcarcfs_list "$@" ;; copyout) mcarcfs_copyout "$@" ;; # test) mcarcfs_test "$@" ;; # Not supported by MC extfs *) exit 1 ;; esac exit 0 avfs-1.1.4/extfs/udar0000644000175000001440000000575614032341001011401 00000000000000#! /bin/sh # # Written by Guus Jansman # BSD type of licence (or Public Domain, GPL or closed source, basically # whatever you want). The license type may be changed according to your # wishes. # # This is a parser for Dar archives in Midnight Commander. You need # the GPL dar program (version >= 2.3.0) written by Denis Corbin. # Limitations: # - The archive files can not be changed # - Symbolic and hard links are not handled properly # - Block and character special files are not handled # - Files not stored in (differential) backups are not handled # Changes # 2010-09-27 Ralf Hoffmann # - hard links (h) and special dar file type (e) are handled # as regular files DAR=dar_static # dar expects the basename (without number and extension) BASENAME="`echo "$2" | sed -e 's/\.[0-9]*\.[Dd][Aa][Rr]$//'`" mcdarfs_list () { $DAR -l "$BASENAME" -N -Q -as -ay 2>/dev/null | gawk -v uuid=$(id -ru) ' BEGIN { flag=0 } /^-------/ { flag++; if (flag > 1) exit 0; next } /^$/ { next } { if (flag == 0) next line=$0 split(line, record, " ") # Do not display removed files if (record[1] == "[" && record[2] == "REMOVED") { next } # We want "line" to start with permutation # TODO: better algorithm while (length(record[1]) != 10 || match(substr(record[1], 2, 1), "[r-]") == 0) { # line without real contents if (length(line) == 0) { next } line=substr(line, length(record[1])+1) while (length(line) != 0 && substr(line, 1, 1) != " ") { line=substr(line, 2) } split(line, record, " ") } perm=record[1] # Block and character special files not supported # Change [bc] to [bcl] if symbolic links should not show up either if (match(substr(perm, 1, 1), "[bc]") != 0) { next } # change h and e types into regulat types if (match(substr(perm, 1, 1), "[he]") != 0) { perm = "-" substr( perm, 2 ); } uid=record[2] if (match(uid, "^[0-9]*$") != 0) { uid=sprintf("%-8d", uid) } gid=record[3] if (match(gid, "^[0-9]*$") != 0) { gid=sprintf("%-8d", gid) } size=record[4] month=record[6] day=record[7] time=substr(record[8], 1, 5) year=record[9] name=substr(line, index(line, sprintf("%s:", time))+14) # TODO: find symbolic link target (probably the link has to be extracted) printf "%s 1 %s %s %8d %3s %02d %04d %s %s\n", perm, uid, gid, size, month, day, year, time, name }' } mcdarfs_copyout () { # Dummy directory necessary since dar cannot output to stdout or named file mkdir "$3.dir.tmp" chmod 700 "$3.dir.tmp" if [ ! -d "$3.dir.tmp" ]; then exit 1; fi $DAR -x "$BASENAME" -N -O -Q -wa -g "$2" -R "$3.dir.tmp" >/dev/null if [ -e "$3.dir.tmp/$2" ]; then mv "$3.dir.tmp/$2" "$3" rm -rf "$3.dir.tmp" else rm -rf "$3.dir.tmp" exit 1 fi } umask 077 cmd="$1" shift case "$cmd" in list) mcdarfs_list "$@" ;; copyout) mcdarfs_copyout "$@" ;; *) exit 1 ;; esac exit 0 avfs-1.1.4/configure.ac0000644000175000001440000003375214032341001011655 00000000000000dnl Process this file with autoconf to produce a configure script. define(AVFS_MAJOR,[1]) define(AVFS_MINOR,[1]) define(AVFS_PATCH,[4]) define(AVFS_COMMENT,[]) define(AVFS_VERSION,AVFS_MAJOR[.]AVFS_MINOR[.]AVFS_PATCH[]AVFS_COMMENT) define(AVFS_NUMVERSION,m4_eval(AVFS_MAJOR*100+AVFS_MINOR*10+AVFS_PATCH)) AC_PREREQ([2.50]) AC_INIT([avfs], AVFS_VERSION) AC_CONFIG_SRCDIR([include/avfs.h]) AM_INIT_AUTOMAKE AC_CONFIG_HEADER(include/config.h:config.h.in) AC_PREFIX_DEFAULT(/usr) AC_CONFIG_MACRO_DIR([macros]) dnl Check if on the same host if reconfiguring AC_CANONICAL_HOST AC_MSG_CHECKING([if configuration is valid]) AC_CACHE_VAL(szm_cv_host_system, [szm_cv_host_system=$host]) if test "$host" = "$szm_cv_host_system"; then validstring="valid" else validstring="invalid" fi AC_MSG_RESULT([$validstring]) if test "$validstring" = invalid; then AC_MSG_ERROR([type 'make realclean' before running configure]) fi VERSION=AVFS_VERSION AC_SUBST(VERSION) NUMVERSION=AVFS_NUMVERSION AC_SUBST(NUMVERSION) os=`uname -s` kernver=`uname -r | sed -n 's/\([[0-9]]\+\)\.\([[0-9]]\+\)\..*/\1\2/p'` if test -z "$kernver"; then kernver="0" fi AC_MSG_CHECKING([whether to build shared library and/or fuse daemon]) dnl here come the default values shared=yes if test "$os" = "Linux"; then fuse=yes fi AC_ARG_ENABLE([library], AC_HELP_STRING([--enable-library],[Compile avfs as a shared or static library]), [if test "$enableval" = yes; then shared=yes; else shared=no; fi]) AC_ARG_ENABLE([fuse], AC_HELP_STRING([--enable-fuse],[Compile avfsd for fuse]), [if test "$enableval" = yes; then fuse=yes; else fuse=no; fi]) shared_build=no fuse_build=no build_result= if test "$shared" = yes; then shared_build=yes if test -z "$build_result"; then build_result=shared else build_result="$build_result shared" fi fi if test "$fuse" = yes; then fuse_build=yes if test -z "$build_result"; then build_result=fuse else build_result="$build_result fuse" fi fi AC_MSG_RESULT([$build_result]) AC_MSG_CHECKING([whether debugging is enabled]) AC_ARG_ENABLE(debug, [ --enable-debug Compile in debug information --disable-debug Do not compile in debug information], [if test "$enableval" = yes; then debugmode=yes; else debugmode=no; fi], debugmode=yes) AC_MSG_RESULT([$debugmode]) AC_MSG_CHECKING([whether building the dav module is enabled]) AC_ARG_ENABLE(dav, [ --enable-dav Compile the dav module (requires libneon)], [if test "$enableval" = yes; then dav=yes; else dav=no; fi], dav=yes) AC_MSG_RESULT([$dav]) AC_ARG_WITH(system-zlib, AC_HELP_STRING([--with-system-zlib],[Use system zlib instead of builtin]), [if test "$withval" = yes; then use_system_zlib=yes; else use_system_zlib=no; fi], [use_system_zlib=no]) AM_CONDITIONAL(USE_SYSTEM_ZLIB,[test x$use_system_zlib = xyes]) if test x$use_system_zlib = xyes; then AC_DEFINE(USE_SYSTEM_ZLIB, 1, [Define if you want to use system zlib library]) LIBZ=-lz ZLIB_INCLUDE= else LIBZ=../zlib/libzlib.la ZLIB_INCLUDE='-I$(top_srcdir)/zlib' fi AC_SUBST(LIBZ) AC_SUBST(ZLIB_INCLUDE) AC_ARG_WITH(system-bzlib, AC_HELP_STRING([--with-system-bzlib],[Use system bzlib instead of builtin]), [if test "$withval" = yes; then use_system_bzlib=yes; else use_system_bzlib=no; fi], [use_system_bzlib=no]) AM_CONDITIONAL(USE_SYSTEM_BZLIB,[test x$use_system_bzlib = xyes]) if test x$use_system_bzlib = xyes; then AC_DEFINE(USE_SYSTEM_BZLIB, 1, [Define if you want to use system bzlib library]) LIBBZ2=-lbz2 BZLIB_INCLUDE= else LIBBZ2=../bzlib/libbz.la BZLIB_INCLUDE='-I$(top_srcdir)/bzlib' fi AC_SUBST(LIBBZ2) AC_SUBST(BZLIB_INCLUDE) AC_ARG_WITH(pkgconfigdir, AC_HELP_STRING([--with-pkgconfigdir=DIR],[pkgconfig file in DIR @<:@LIBDIR/pkgconfig@:>@]), [pkgconfigdir=$withval], [pkgconfigdir='${libdir}/pkgconfig']) AC_SUBST(pkgconfigdir) dnl Checks for programs. cflags="$CFLAGS" AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LIBTOOL PKG_PROG_PKG_CONFIG AC_SYS_LARGEFILE fob_set=no if test "x$ac_cv_sys_file_offset_bits" != x -a "$ac_cv_sys_file_offset_bits" != no; then CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits" fob_set=yes fi if test "x$ac_cv_sys_large_files" != x -a "$ac_cv_sys_large_files" != no; then CPPFLAGS="$CPPFLAGS -D_LARGE_FILES=$ac_cv_sys_large_files" fi if test "$enable_largefile" != no -a "$fob_set" != "yes" -a "$fuse_build" = "yes"; then dnl FIXME this is kind of a hack to force the flag _FILE_OFFSET_BITS dnl if large file support was requested but the macro decided not to dnl use it (for example if arch doesn't need it) dnl This is currently required because fuse refuses to work without it CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64" fob_set=yes fi if test -z "$cflags"; then if test "$GCC" = yes; then if test "$debugmode" = yes; then CFLAGS="-Wall -g" else CFLAGS="-Wall -O3" fi ZLIB_CFLAGS="-Wall -O3" else if test "$debugmode" = yes; then CFLAGS="-g" else CFLAGS="-O" fi ZLIB_CFLAGS="-O" fi fi AC_SUBST(ZLIB_CFLAGS) CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS -D_GNU_SOURCE" if test -z "$LD"; then AC_CHECK_PROG(LD, ld, [ld -r], [$CC -Wl,-r -nostdlib]) else LD="$LD -r" AC_SUBST(LD) fi AC_CHECK_FUNCS(vsnprintf strncasecmp strcasecmp mkdtemp) AC_CHECK_FUNCS(getpwuid_r getpwnam_r getgrgid_r getgrnam_r) AC_CHECK_FUNCS(atoll) AC_HEADER_MAJOR dnl For zlib AC_CHECK_HEADERS(unistd.h) AC_CHECK_HEADERS(sys/statvfs.h) AC_CACHE_CHECK([for d_type in struct dirent], my_cv_struct_d_type, [AC_TRY_COMPILE([#include #include ], [struct dirent d; d.d_type;], my_cv_struct_d_type=yes, my_cv_struct_d_type=no)]) if test $my_cv_struct_d_type = yes; then AC_DEFINE(HAVE_D_TYPE, 1, [Define if your struct direntry has d_type]) fi AC_CACHE_CHECK([for d_off in struct dirent], my_cv_struct_d_off, [AC_TRY_COMPILE([#include #include ], [struct dirent d; d.d_off;], my_cv_struct_d_off=yes, my_cv_struct_d_off=no)]) if test $my_cv_struct_d_off = yes; then AC_DEFINE(HAVE_D_OFF, 1, [Define if your struct direntry has d_off]) fi AC_SEARCH_LIBS(nanosleep, posix4) AC_SEARCH_LIBS(gethostbyname, nsl) AC_SEARCH_LIBS(socket, socket inet) neon_found=no if test "$dav" = yes; then PKG_CHECK_EXISTS([neon],[ PKG_CHECK_MODULES([LIBNEON],[neon >= 0.27.0], [neon_found=yes],[neon_found=no]) ]) if test "$neon_found" = "yes"; then AC_DEFINE(HAVE_LIBNEON, 1, [Define to 1 if your system has libneon installed]) CPPFLAGS="$CPPFLAGS $LIBNEON_CFLAGS" LIBS="$LIBS $LIBNEON_LIBS" DAV=dav.c DAV_LS=dav_ls.c else DAV= DAV_LS= fi else DAV= DAV_LS= LIBDAV= fi AM_CONDITIONAL(BUILD_DAVSUPPORT, test x$neon_found = xyes) AC_SUBST(DAV) AC_SUBST(DAV_LS) AC_SUBST(LIBDAV) AC_CHECK_LIB(dl, dlopen) AC_CHECK_LIB(pthread, pthread_create) if test -z "`echo "$LIBS"|grep pthread`"; then LIBS="$LIBS -pthread" fi moduledir='${libdir}/avfs' AC_SUBST(moduledir) install_scriptcomps= MC_EXTFS_CHECKS install_fuse=no dnl ================================================================ dnl == Now comes the stuff for fuse == dnl ================================================================ run_fuse_test=yes AC_ARG_ENABLE([fuse-test], AC_HELP_STRING([--disable-fuse-test],[Disable test for fuse version]), [if test "$enableval" = yes; then run_fuse_test=yes; else run_fuse_test=no; fi]) if test $fuse_build = yes; then if test $run_fuse_test = yes; then AC_MSG_CHECKING([whether fuse is new enough]) pkg-config --atleast-version=2.6.0 fuse >/dev/null 2>/dev/null if test $? != 0; then dnl too old fuse or no fuse or no pkg-config dnl in any case disable fuse_build AC_MSG_RESULT([no]) fuse_build=no else AC_MSG_RESULT([yes]) fi fi fi if test $fuse_build = yes; then fuse_pkg_found=no PKG_CHECK_EXISTS([fuse],[ PKG_CHECK_MODULES([LIBFUSE],[fuse], [fuse_pkg_found=yes]) ]) if test "$fuse_pkg_found" = "yes" -o "$run_fuse_test" = "no"; then AC_DEFINE(HAVE_LIBFUSE, 1, [Define to 1 if your system has libfuse installed]) CPPFLAGS="$CPPFLAGS $LIBFUSE_CFLAGS" FUSELIBS="$LIBFUSE_LIBS" AC_SUBST(FUSELIBS) install_fuse=yes install_scriptcomps="$install_scriptcomps mountavfs umountavfs" else fuse_build=no fi dnl AC_CHECK_LIB(fuse, fuse_main,[fuse_found=yes],[fuse_found=false]) dnl if test x$fuse_found == xyes; then dnl FUSELIBS="-lfuse" dnl AC_SUBST(FUSELIBS) dnl install_fuse=yes dnl install_scriptcomps="$install_scriptcomps mountavfs umountavfs" dnl else dnl fuse_build=no dnl fi fi dnl ================================================================ dnl == check for liblzma == dnl ================================================================ have_liblzma=no use_liblzma=no AC_ARG_WITH(xz,AC_HELP_STRING([--with-xz],[use xz (default is YES, force to always enable)]), ac_cv_use_xz=$withval, ac_cv_use_xz=yes) if test "$ac_cv_use_xz" = "yes" -o "$ac_cv_use_xz" = "force"; then PKG_CHECK_EXISTS([liblzma],[ PKG_CHECK_MODULES([LIBLZMA],[liblzma], [have_liblzma=yes]) ]) dnl AC_MSG_CHECKING(for liblzma) if test "$have_liblzma" = "yes" -o "$ac_cv_use_xz" = "force"; then AC_DEFINE(HAVE_LIBLZMA, 1, [Define to 1 if your system has liblzma installed]) CPPFLAGS="$CPPFLAGS $LIBLZMA_CFLAGS" LIBS="$LIBS $LIBLZMA_LIBS" use_liblzma=yes fi dnl AC_MSG_RESULT($have_liblzma) fi dnl ================================================================ dnl == check for libzstd == dnl ================================================================ have_libzstd=no use_libzstd=no AC_ARG_WITH(zstd,AC_HELP_STRING([--with-zstd],[use zstd (default is YES)]), ac_cv_use_zstd=$withval, ac_cv_use_zstd=yes) if test "$ac_cv_use_zstd" = "yes"; then PKG_CHECK_EXISTS([libzstd],[ PKG_CHECK_MODULES([LIBZSTD],[libzstd], [have_libzstd=yes]) ]) dnl AC_MSG_CHECKING(for libzstd) if test "$have_libzstd" = "yes"; then AC_DEFINE(HAVE_LIBZSTD, 1, [Define to 1 if your system has libzstd installed]) CPPFLAGS="$CPPFLAGS $LIBZSTD_CFLAGS" LIBS="$LIBS $LIBZSTD_LIBS" use_libzstd=yes fi dnl AC_MSG_RESULT($have_libzstd) fi dnl ================================================================ dnl == check for liblzip == dnl ================================================================ use_liblzip=no AC_ARG_WITH(lzip,AC_HELP_STRING([--with-lzip],[use lzip (default is YES)]), ac_cv_use_lzip=$withval, ac_cv_use_lzip=yes) if test "$ac_cv_use_lzip" = "yes"; then AC_CHECK_HEADERS(lzlib.h, [AC_CHECK_LIB(lz, LZ_decompress_open, [LIBS="$LIBS -llz" AC_DEFINE(HAVE_LIBLZIP, 1, [Define to 1 if your system has liblzip installed]) use_liblzip=yes])]) fi AM_CONDITIONAL(USE_LIBLZMA, test x$use_liblzma = xyes) AM_CONDITIONAL(USE_LIBZSTD, test x$use_libzstd = xyes) AM_CONDITIONAL(USE_LIBLZIP, test x$use_liblzip = xyes) AM_CONDITIONAL(INSTALL_FUSE, test x$install_fuse = xyes) dnl ================================================================ dnl == Now comes the stuff that is only for shared == dnl ================================================================ if test $shared_build = yes; then install_scriptcomps="$install_scriptcomps avfs-config" fi AM_CONDITIONAL(BUILD_SHARED, test x$shared_build = xyes) dnl Test whether linker supports symbol versioning CHECK_LD_VERSIONSCRIPT AC_SUBST(install_scriptcomps) AC_SUBST(shared_build) AC_CONFIG_FILES([pkgconfig/avfs.pc]) AC_OUTPUT([ Makefile src/Makefile modules/Makefile zlib/Makefile bzlib/Makefile lib/Makefile include/Makefile extfs/Makefile scripts/Makefile test/Makefile spec/Makefile macros/Makefile patch/Makefile doc/Makefile fuse/Makefile pkgconfig/Makefile scripts/avfs-config extfs/a extfs/apt extfs/audio extfs/deb extfs/deba extfs/debd extfs/dpkg extfs/hp48 extfs/iso9660 extfs/lslR extfs/mailfs extfs/patchfs extfs/rpms extfs/u7z extfs/uace extfs/uar extfs/uarj extfs/uc1541 extfs/uha extfs/ulha extfs/upp extfs/uextrar extfs/uxdms extfs/uxpk extfs/uzip extfs/uzoo include/version.h ], [chmod +x scripts/avfs-config]) echo "" echo "Configuration details:" if test "$shared_build" = "yes"; then echo " Building library : yes" else echo " Building library : no" fi if test "$fuse_build" = "yes"; then echo " Building avfsd for fuse : yes" else echo " Building avfsd for fuse : no" fi echo "" if test "x$use_system_zlib" = "xyes"; then echo " Use zlib : system (not recommended, slower random access)" else echo " Use zlib : internal (recommended, faster random access)" fi if test "x$use_system_bzlib" = "xyes"; then echo " Use bzlib : system (not recommended, slower random access)" else echo " Use bzlib : internal (recommended, faster random access)" fi if test "x$use_liblzma" = "xyes"; then echo " Use liblzma : yes" else echo " Use liblzma : no" fi if test "x$use_libzstd" = "xyes"; then echo " Use libzstd : yes" else echo " Use libzstd : no" fi if test "x$dav" = "xyes" -a "x$neon_found" = "xyes"; then echo " WebDAV support : yes" else echo " WebDAV support : no" fi if test "x$use_liblzip" = "xyes"; then echo " Use liblzip : yes" else echo " Use liblzip : no" fi echo "" echo " Installation prefix : $prefix" echo "" avfs-1.1.4/depcomp0000755000175000001440000005602014032341013010740 00000000000000#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2018-03-07.03; # UTC # Copyright (C) 1999-2020 Free Software Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try '$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by 'PROGRAMS ARGS'. object Object file output by 'PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputting dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac # Get the directory component of the given path, and save it in the # global variables '$dir'. Note that this directory component will # be either empty or ending with a '/' character. This is deliberate. set_dir_from () { case $1 in */*) dir=`echo "$1" | sed -e 's|/[^/]*$|/|'`;; *) dir=;; esac } # Get the suffix-stripped basename of the given path, and save it the # global variable '$base'. set_base_from () { base=`echo "$1" | sed -e 's|^.*/||' -e 's/\.[^.]*$//'` } # If no dependency file was actually created by the compiler invocation, # we still have to create a dummy depfile, to avoid errors with the # Makefile "include basename.Plo" scheme. make_dummy_depfile () { echo "#dummy" > "$depfile" } # Factor out some common post-processing of the generated depfile. # Requires the auxiliary global variable '$tmpdepfile' to be set. aix_post_process_depfile () { # If the compiler actually managed to produce a dependency file, # post-process it. if test -f "$tmpdepfile"; then # Each line is of the form 'foo.o: dependency.h'. # Do two passes, one to just change these to # $object: dependency.h # and one to simply output # dependency.h: # which is needed to avoid the deleted-header problem. { sed -e "s,^.*\.[$lower]*:,$object:," < "$tmpdepfile" sed -e "s,^.*\.[$lower]*:[$tab ]*,," -e 's,$,:,' < "$tmpdepfile" } > "$depfile" rm -f "$tmpdepfile" else make_dummy_depfile fi } # A tabulation character. tab=' ' # A newline character. nl=' ' # Character ranges might be problematic outside the C locale. # These definitions help. upper=ABCDEFGHIJKLMNOPQRSTUVWXYZ lower=abcdefghijklmnopqrstuvwxyz digits=0123456789 alpha=${upper}${lower} if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Avoid interferences from the environment. gccflag= dashmflag= # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi cygpath_u="cygpath -u -f -" if test "$depmode" = msvcmsys; then # This is just like msvisualcpp but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvisualcpp fi if test "$depmode" = msvc7msys; then # This is just like msvc7 but w/o cygpath translation. # Just convert the backslash-escaped backslashes to single forward # slashes to satisfy depend.m4 cygpath_u='sed s,\\\\,/,g' depmode=msvc7 fi if test "$depmode" = xlc; then # IBM C/C++ Compilers xlc/xlC can output gcc-like dependency information. gccflag=-qmakedep=gcc,-MF depmode=gcc fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## Note that this doesn't just cater to obsosete pre-3.x GCC compilers. ## but also to in-use compilers like IMB xlc/xlC and the HP C compiler. ## (see the conditional assignment to $gccflag above). ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). Also, it might not be ## supported by the other compilers which use the 'gcc' depmode. ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The second -e expression handles DOS-style file names with drive # letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the "deleted header file" problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. ## Some versions of gcc put a space before the ':'. On the theory ## that the space means something, we add a space to the output as ## well. hp depmode also adds that space, but also prefixes the VPATH ## to the object. Take care to not repeat it in the output. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e "s|.*$object$||" -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like '#:fec' to the end of the # dependency line. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' \ | tr "$nl" ' ' >> "$depfile" echo >> "$depfile" # The second pass generates a dummy entry for each header file. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" ;; xlc) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts '$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.u tmpdepfile2=$base.u tmpdepfile3=$dir.libs/$base.u "$@" -Wc,-M else tmpdepfile1=$dir$base.u tmpdepfile2=$dir$base.u tmpdepfile3=$dir$base.u "$@" -M fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done aix_post_process_depfile ;; tcc) # tcc (Tiny C Compiler) understand '-MD -MF file' since version 0.9.26 # FIXME: That version still under development at the moment of writing. # Make that this statement remains true also for stable, released # versions. # It will wrap lines (doesn't matter whether long or short) with a # trailing '\', as in: # # foo.o : \ # foo.c \ # foo.h \ # # It will put a trailing '\' even on the last line, and will use leading # spaces rather than leading tabs (at least since its commit 0394caf7 # "Emit spaces for -MD"). "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each non-empty line is of the form 'foo.o : \' or ' dep.h \'. # We have to change lines of the first kind to '$object: \'. sed -e "s|.*:|$object :|" < "$tmpdepfile" > "$depfile" # And for each line of the second kind, we have to emit a 'dep.h:' # dummy dependency, to avoid the deleted-header problem. sed -n -e 's|^ *\(.*\) *\\$|\1:|p' < "$tmpdepfile" >> "$depfile" rm -f "$tmpdepfile" ;; ## The order of this option in the case statement is important, since the ## shell code in configure will try each of these formats in the order ## listed in this file. A plain '-MD' option would be understood by many ## compilers, so we must ensure this comes after the gcc and icc options. pgcc) # Portland's C compiler understands '-MD'. # Will always output deps to 'file.d' where file is the root name of the # source file under compilation, even if file resides in a subdirectory. # The object file name does not affect the name of the '.d' file. # pgcc 10.2 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using '\' : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... set_dir_from "$object" # Use the source, not the object, to determine the base name, since # that's sadly what pgcc will do too. set_base_from "$source" tmpdepfile=$base.d # For projects that build the same source file twice into different object # files, the pgcc approach of using the *source* file root name can cause # problems in parallel builds. Use a locking strategy to avoid stomping on # the same $tmpdepfile. lockdir=$base.d-lock trap " echo '$0: caught signal, cleaning up...' >&2 rmdir '$lockdir' exit 1 " 1 2 13 15 numtries=100 i=$numtries while test $i -gt 0; do # mkdir is a portable test-and-set. if mkdir "$lockdir" 2>/dev/null; then # This process acquired the lock. "$@" -MD stat=$? # Release the lock. rmdir "$lockdir" break else # If the lock is being held by a different process, wait # until the winning process is done or we timeout. while test -d "$lockdir" && test $i -gt 0; do sleep 1 i=`expr $i - 1` done fi i=`expr $i - 1` done trap - 1 2 13 15 if test $i -le 0; then echo "$0: failed to acquire lock after $numtries attempts" >&2 echo "$0: check lockdir '$lockdir'" >&2 exit 1 fi if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[$lower]*:,$object:," "$tmpdepfile" > "$depfile" # Add 'dependent.h:' lines. sed -ne '2,${ s/^ *// s/ \\*$// s/$/:/ p }' "$tmpdepfile" >> "$depfile" else make_dummy_depfile fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. 'cc -MD -o foo.o ...' puts the dependencies into 'foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in 'foo.d' instead, so we check for that too. # Subdirectories are respected. set_dir_from "$object" set_base_from "$object" if test "$libtool" = yes; then # Libtool generates 2 separate objects for the 2 libraries. These # two compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir$base.o.d # libtool 1.5 tmpdepfile2=$dir.libs/$base.o.d # Likewise. tmpdepfile3=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d "$@" -MD fi stat=$? if test $stat -ne 0; then rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" do test -f "$tmpdepfile" && break done # Same post-processing that is required for AIX mode. aix_post_process_depfile ;; msvc7) if test "$libtool" = yes; then showIncludes=-Wc,-showIncludes else showIncludes=-showIncludes fi "$@" $showIncludes > "$tmpdepfile" stat=$? grep -v '^Note: including file: ' "$tmpdepfile" if test $stat -ne 0; then rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" # The first sed program below extracts the file names and escapes # backslashes for cygpath. The second sed program outputs the file # name when reading, but also accumulates all include files in the # hold buffer in order to output them again at the end. This only # works with sed implementations that can handle large buffers. sed < "$tmpdepfile" -n ' /^Note: including file: *\(.*\)/ { s//\1/ s/\\/\\\\/g p }' | $cygpath_u | sort -u | sed -n ' s/ /\\ /g s/\(.*\)/'"$tab"'\1 \\/p s/.\(.*\) \\/\1:/ H $ { s/.*/'"$tab"'/ G p }' >> "$depfile" echo >> "$depfile" # make sure the fragment doesn't end with a backslash rm -f "$tmpdepfile" ;; msvc7msys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for ':' # in the target name. This is to cope with DOS-style filenames: # a dependency such as 'c:/foo/bar' could be seen as target 'c' otherwise. "$@" $dashmflag | sed "s|^[$tab ]*[^:$tab ][^:][^:]*:[$tab ]*|$object: |" > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this sed invocation # correctly. Breaking it into two sed invocations is a workaround. tr ' ' "$nl" < "$tmpdepfile" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # X makedepend shift cleared=no eat=no for arg do case $cleared in no) set ""; shift cleared=yes ;; esac if test $eat = yes; then eat=no continue fi case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -arch) eat=yes ;; -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix=`echo "$object" | sed 's/^.*\././'` touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" # makedepend may prepend the VPATH from the source file name to the object. # No need to regex-escape $object, excess matching of '.' is harmless. sed "s|^.*\($object *:\)|\1|" "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process the last invocation # correctly. Breaking it into two sed invocations is a workaround. sed '1,2d' "$tmpdepfile" \ | tr ' ' "$nl" \ | sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' \ | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi # Remove '-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E \ | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test "X$1" != 'X--mode=compile'; do shift done shift fi IFS=" " for arg do case "$arg" in -o) shift ;; $object) shift ;; "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E 2>/dev/null | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::'"$tab"'\1 \\:p' >> "$depfile" echo "$tab" >> "$depfile" sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; msvcmsys) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: avfs-1.1.4/README0000644000175000001440000002177114032341001010245 00000000000000What Is AVFS ------------ AVFS is a system, which enables all programs to look inside archived or compressed files, or access remote files without recompiling the programs or changing the kernel. At the moment it supports floppies, tar and gzip files, zip, bzip2, ar and rar files, ftp sessions, http, webdav, rsh/rcp, ssh/scp. Quite a few other handlers are implemented with the Midnight Commander's external FS. AVFS is (C) under the GNU GPL (see the file COPYING). The shared library is (C) under the GNU LGPL (see the file COPYING.LIB). AVFS comes with ABSOLUTELY NO WARRANTY, for details see the file COPYING. Where Is The Latest Version --------------------------- Check out the page http://www.inf.bme.hu/~mszeredi/avfs/ or http://sourceforge.net/projects/avf Forms of AVFS ------------- AVFS can now be installed in four different ways. These are: - Fuse With fuse support, systems with 2.6 kernels are able to use avfs. The requirements are 1) fuse support be compiled into the kernel or fuse modules loaded. 2) the fuse package and library >= 2.4 be installed. - Library AVFS can be used as a shared library for programs written to utilize AVFS. This is a pure userspace library so it should work on any POSIX system. Using AVFS is very similar in all cases. Differences will be indicated. The installation method is different. For installation instructions see the files 'INSTALL.fuse' and 'INSTALL.library' respectively all located in the doc/ directory. Using AVFS ---------- These instructions are not for the fuse installation. Please see the file README.avfs-fuse for details on how these commands are applied. It is quite simple, you just do everything with the virtual files, as you would do with real files. Here are some examples: Listing a tar archive: ls -l avfs-0.9.1.tgz#/ ls -l avfs-0.9.1.tgz#/avfs-0.9.1/ Obtaining information about avfs itself: cat /#avfsstat/copyright - prints copyright information and version cat /#avfsstat/modules - lists available handlers cat /#avfsstat/version - prints version information 'cd' into an archive: cd avfs-0.9.1.tgz#/ less avfs-0.9.1/README Some more examples: (these are all shell commands, but of course you could use any program: file manager, browser, editor, etc.) Unpacking an archive: cp -a tarfile.tgz#/dir . cp -a zipfile.zip#/* . Creating an archive: mkdir tarfile.tgz#+ cp -a dir tarfile.tgz#+/ Note: The efficiency of this method is not yet the same as the 'normal' archive creation method, but it should not be more than 2 times slower. If something doesn't work, then check the section 'Common Problems'. Format of an AVFS Path ---------------------- (For a full explanation of the format see the file FORMAT) As you've seen, the '#' magic character makes a virtual file or directory from an ordinary file. Actually this is just a shorthand for the full specification of an AVFS path: 'tarfile.tgz#' is the same as 'tarfile.tgz#ugz#utar' Note, the short version will only work if the file-extension is recognized (most are), but you can always tell exactly what should be done with the file by using the second method. There are handlers which do not have a "base" file. The following handlers are like this: floppy, ftp, rsh, ssh, http, dav, avfsstat, volatile, rpms, ucftp. Examples /#floppy:a - a: drive /#a - a: drive (alias for /#floppy:a) /#rsh:otherhost/foo/bar - /foo/bar on 'otherhost' /#ssh:user@host/dir - /dir on 'host', login as 'user' /#ftp:ftp.funet.fi/pub/Linux - anonymous ftp /#ftp:user@host.domain.org/home/xyz/file - ftp with username 'user' /#ftp_ctl:user@host.domain.org/password - write the password to this file (ftppass is a nice utility for this) /#http:www.inf.bme.hu|~mszeredi|avfs| - homepage of AVFS /#http:ftp:||ftp.funet.fi|pub|Linux - use HTTP to get an ftp URL (useful if you use a HTTP-only proxy) /#dav:http:host.domain.org/home/ - WebDAV The environment variable 'http_proxy' is used to set the default value of the proxy server. You can also set it's value by writing to the file /#avfsstat/http_proxy The following "handlers" are available now: name of handler type of operation notes --------------- ----------------- ----- #a first floppy drive alias for #floppy:a #avfsstat meta information builtin #bz2 bzip2 uses bzip2 #dav webdav builtin #dav_ctl control dav sessions #floppy floppy uses mtools (mdir, mcopy, ...) #ftp ftp builtin #ftp_ctl control ftp sessions #gz gzip uses gzip #iso9660 CD/DVD filesystem no need to use mount -t iso9660! #local local filesysem only for internal use #rsh rsh/rcp only works if rsh needs no password #ssh ssh/scp only works if ssh needs no password #uar un-ar builtin #ubz2 bunzip2 builtin #ubzip2 bunzip2 uses bzip2 #ucftp ftp builtin (write support, no file cache) #ucftp_ctl control ftp sessions #ugz gunzip builtin (1) #ugzip gunzip uses gzip #ulzip unlzip builtin #urar unrar builtin list + uses rar to extract #utar untar builtin #uxz unxz/unlzma builtin #uxze unxz/unlzma uses xz #uz uncompress uses gzip #uzip unzip builtin #uzstd uzstd builtin #uzstde uzstd uses zstd #volatile 'memory fs' mainly for testing (1) With the '-s' option (blala.gz#-s) the gunzip module will use the size stored at the end of the gzip file. This will make some operations on a .gz file much faster, but it isn't usable for huge (>=4GByte) files, since the size is stored in 32 bits :(. The following handlers are available through Midnight Commanders 'extfs'. These were not written by me, and could contain security holes. Nonetheless some of them are quite useful. For documentation on these, see the files in /usr/lib/avfs/extfs. name of handler type of operation --------------- ----------------- #deb debian packages #ftplist ? #hp48 ? #lslR directory tree listings #mailfs ? #patchfs browse patch files #rpm rpm packages #rpms List of installed rpms #trpm Useful inside #rpms #ucpio cpio archives #ulha lha archives #uzoo zoo archives Writing new modules ------------------- You want to write a handler module for XY? Great! Please contact me, and I can give you some advice regarding this. Credits ------- David Hanak (dhanak@inf.bme.hu) has contibuted the "rar" and the "archive" modules, and lots of ideas to AVFS. The VFS in Midnight Commander, written by Jakub Jelinek and Miguel de Icaza , has greatly helped me write this library, and will probably continue to do so in the future. Pavel Machek, who is the current maintainer of Midnight VFS, and who has contributed lots of ideas and the alien module (which unfortunately I did not have time to get into shape) to AVFS. The 'avfscoda' solution grew out of Pavels 'podfuk'. Most of it has been changed, but the original idea is from Pavel. Justin Mason contributed the dav module. Koblinger Egmont has written the "recursive profile" scripts, set up the mailing list, and also sent me many good ideas. The zip and gzip file handler is based on the zlib compression and decompression library, written by Jean-loup Gailly and Mark Adler. The bzip2 handler uses the libbzip2 library written by Julian R Seward. The tar file handler is based on the GNU tar source, originally written by John Gilmore. People, who sent me ideas or bug-reports: Jan Niehusmann Demon of the Known Universe Duncan Pierce Scott F. Johnston Larry Riedel The Future ---------- I hope AVFS will grow up to be a standard virtual file library, for which people can write handler modules (or plugins, if you like) for whatever they want. If you think AVFS is a good idea, and you have any comments or suggestions, please send me an email about them. Have fun, Miklos Szeredi avfs-1.1.4/missing0000755000175000001440000001533614032341013010767 00000000000000#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2018-03-07.03; # UTC # Copyright (C) 1996-2020 Free Software Foundation, Inc. # Originally written by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try '$0 --help' for more information" exit 1 fi case $1 in --is-lightweight) # Used by our autoconf macros to check whether the available missing # script is modern enough. exit 0 ;; --run) # Back-compat with the calling convention used by older automake. shift ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due to PROGRAM being missing or too old. Options: -h, --help display this help and exit -v, --version output version information and exit Supported PROGRAM values: aclocal autoconf autoheader autom4te automake makeinfo bison yacc flex lex help2man Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and 'g' are ignored when checking the name. Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: unknown '$1' option" echo 1>&2 "Try '$0 --help' for more information" exit 1 ;; esac # Run the given program, remember its exit status. "$@"; st=$? # If it succeeded, we are done. test $st -eq 0 && exit 0 # Also exit now if we it failed (or wasn't found), and '--version' was # passed; such an option is passed most likely to detect whether the # program is present and works. case $2 in --version|--help) exit $st;; esac # Exit code 63 means version mismatch. This often happens when the user # tries to use an ancient version of a tool on a file that requires a # minimum version. if test $st -eq 63; then msg="probably too old" elif test $st -eq 127; then # Program was missing. msg="missing on your system" else # Program was found and executed, but failed. Give up. exit $st fi perl_URL=https://www.perl.org/ flex_URL=https://github.com/westes/flex gnu_software_URL=https://www.gnu.org/software program_details () { case $1 in aclocal|automake) echo "The '$1' program is part of the GNU Automake package:" echo "<$gnu_software_URL/automake>" echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/autoconf>" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; autoconf|autom4te|autoheader) echo "The '$1' program is part of the GNU Autoconf package:" echo "<$gnu_software_URL/autoconf/>" echo "It also requires GNU m4 and Perl in order to run:" echo "<$gnu_software_URL/m4/>" echo "<$perl_URL>" ;; esac } give_advice () { # Normalize program name to check for. normalized_program=`echo "$1" | sed ' s/^gnu-//; t s/^gnu//; t s/^g//; t'` printf '%s\n' "'$1' is $msg." configure_deps="'configure.ac' or m4 files included by 'configure.ac'" case $normalized_program in autoconf*) echo "You should only need it if you modified 'configure.ac'," echo "or m4 files included by it." program_details 'autoconf' ;; autoheader*) echo "You should only need it if you modified 'acconfig.h' or" echo "$configure_deps." program_details 'autoheader' ;; automake*) echo "You should only need it if you modified 'Makefile.am' or" echo "$configure_deps." program_details 'automake' ;; aclocal*) echo "You should only need it if you modified 'acinclude.m4' or" echo "$configure_deps." program_details 'aclocal' ;; autom4te*) echo "You might have modified some maintainer files that require" echo "the 'autom4te' program to be rebuilt." program_details 'autom4te' ;; bison*|yacc*) echo "You should only need it if you modified a '.y' file." echo "You may want to install the GNU Bison package:" echo "<$gnu_software_URL/bison/>" ;; lex*|flex*) echo "You should only need it if you modified a '.l' file." echo "You may want to install the Fast Lexical Analyzer package:" echo "<$flex_URL>" ;; help2man*) echo "You should only need it if you modified a dependency" \ "of a man page." echo "You may want to install the GNU Help2man package:" echo "<$gnu_software_URL/help2man/>" ;; makeinfo*) echo "You should only need it if you modified a '.texi' file, or" echo "any other file indirectly affecting the aspect of the manual." echo "You might want to install the Texinfo package:" echo "<$gnu_software_URL/texinfo/>" echo "The spurious makeinfo call might also be the consequence of" echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might" echo "want to install GNU make:" echo "<$gnu_software_URL/make/>" ;; *) echo "You might have modified some files without having the proper" echo "tools for further handling them. Check the 'README' file, it" echo "often tells you about the needed prerequisites for installing" echo "this package. You may also peek at any GNU archive site, in" echo "case some other package contains this missing '$1' program." ;; esac } give_advice "$1" | sed -e '1s/^/WARNING: /' \ -e '2,$s/^/ /' >&2 # Propagate the correct exit status (expected to be 127 for a program # not found, 63 for a program that failed due to version mismatch). exit $st # Local variables: # eval: (add-hook 'before-save-hook 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC0" # time-stamp-end: "; # UTC" # End: avfs-1.1.4/Makefile.am0000644000175000001440000000066214032341001011415 00000000000000## Process this file with automake to produce Makefile.in AUTOMAKE_OPTIONS = dist-bzip2 ACLOCAL_AMFLAGS = -I macros SUBDIRS = \ src \ modules \ zlib \ bzlib \ lib \ include \ test \ scripts \ spec \ patch \ macros \ extfs \ doc \ fuse \ pkgconfig EXTRA_DIST = \ glassfs/Makefile \ glassfs/glassfs.c \ glassfs/redir2.c \ glassfs/redir2mount.c avfs-1.1.4/glassfs/0000755000175000001440000000000014032341025011105 500000000000000avfs-1.1.4/glassfs/glassfs.c0000644000175000001440000005711214032341001012633 00000000000000#include #include #include #include #include #include #include #include /* some random number */ #define GLASSFS_MAGIC 0x28476c61 #define FUSE_MAGIC 0x65735546 #define AVFS_MAGIC_CHAR '#' #define OVERLAY_DIR "/overlay" #define OVERLAY_DIR_LEN 8 struct base_entry { struct dentry *dentry; struct vfsmount *mnt; int is_avfs; }; /* Rules for storing underlying filesystem data: * * inode->u.generic_ip: contains a kmalloced base_entry struct * sb->s_fs_info: contains the underlying superblock */ static struct super_operations glassfs_ops; static struct inode_operations glassfs_file_inode_operations; static struct file_operations glassfs_file_operations; static struct file_operations glassfs_dir_operations; static struct inode_operations glassfs_dir_inode_operations; static struct inode_operations glassfs_symlink_inode_operations; static struct dentry_operations glassfs_dentry_operations; static struct inode *glassfs_alloc_inode(struct super_block *sb) { struct base_entry *be; struct inode * inode = new_inode(sb); if (!inode) return NULL; be = kmalloc(sizeof(struct base_entry), GFP_KERNEL); if (!be) { iput(inode); return NULL; } inode->u.generic_ip = be; be->mnt = NULL; be->dentry = NULL; return inode; } static void glassfs_fill_inode(struct inode *inode, int mode, dev_t dev, struct dentry *ndentry, struct vfsmount *nmnt, int is_avfs) { struct base_entry *be = inode->u.generic_ip; be->dentry = dget(ndentry); be->mnt = mntget(nmnt); be->is_avfs = is_avfs; inode->i_mode = mode; inode->i_rdev = dev; switch (mode & S_IFMT) { default: inode->i_op = &glassfs_file_inode_operations; inode->i_fop = &glassfs_file_operations; break; case S_IFDIR: inode->i_op = &glassfs_dir_inode_operations; inode->i_fop = &glassfs_dir_operations; break; case S_IFLNK: inode->i_op = &glassfs_symlink_inode_operations; inode->i_fop = &glassfs_file_operations; break; } } static void change_list(struct list_head *oldlist, struct list_head *newlist) { struct list_head *prev = oldlist->prev; struct list_head *next = oldlist->next; prev->next = newlist; next->prev = newlist; } static void exchange_lists(struct list_head *list1, struct list_head *list2) { change_list(list1, list2); change_list(list2, list1); } static void exchange_files(struct file *file1, struct file *file2) { struct file tmp; exchange_lists(&file1->f_list, &file2->f_list); exchange_lists(&file1->f_ep_links, &file2->f_ep_links); tmp = *file1; *file1 = *file2; *file2 = tmp; } static int glassfs_open(struct inode *inode, struct file *file) { struct base_entry *be = inode->u.generic_ip; struct vfsmount *nmnt = mntget(be->mnt); struct dentry *ndentry = dget(be->dentry); struct file *nfile; //printk("glassfs_open %.*s\n", ndentry->d_name.len, ndentry->d_name.name); nfile = dentry_open(ndentry, nmnt, file->f_flags); if (IS_ERR(nfile)) return PTR_ERR(nfile); exchange_files(file, nfile); fput(nfile); return 0; } static int glassfs_open_dir(struct inode *inode, struct file *file) { struct base_entry *be = inode->u.generic_ip; struct file *nfile; //printk("glassfs_open_dir\n") nfile = dentry_open(dget(be->dentry), mntget(be->mnt), file->f_flags); if (IS_ERR(nfile)) return PTR_ERR(nfile); file->private_data = nfile; return 0; } static int glassfs_release(struct inode *inode, struct file *file) { struct file *nfile = file->private_data; return filp_close(nfile, current->files); } static int glassfs_readdir(struct file *file, void *buf, filldir_t filler) { struct file *nfile = file->private_data; return vfs_readdir(nfile, filler, buf); } static loff_t glassfs_llseek(struct file *file, loff_t offset, int origin) { struct file *nfile = file->private_data; loff_t (*fn)(struct file *, loff_t, int); fn = default_llseek; if (nfile->f_op && nfile->f_op->llseek) fn = nfile->f_op->llseek; return fn(nfile, offset, origin); } static int glassfs_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) { int err; struct file *nfile = file->private_data; err = security_file_ioctl(nfile, cmd, arg); if (err) return err; err = -ENOTTY; if (nfile->f_op && nfile->f_op->ioctl) err = nfile->f_op->ioctl(nfile->f_dentry->d_inode, nfile, cmd, arg); return err; } static int glassfs_fsync(struct file *file, struct dentry *dentry, int datasync) { int err; struct file *nfile = file->private_data; struct address_space *mapping = nfile->f_mapping; if (!nfile->f_op || !nfile->f_op->fsync) return -EINVAL; down(&mapping->host->i_sem); err = nfile->f_op->fsync(nfile, nfile->f_dentry, datasync); up(&mapping->host->i_sem); return err; } static int glassfs_flush(struct file *file) { //printk("glassfs_flush\n"); struct file *nfile = file->private_data; if (nfile->f_op && nfile->f_op->flush) return nfile->f_op->flush(nfile); else return 0; } static int is_avfs(const unsigned char *name, unsigned int len) { for (; len--; name++) if (*name == (unsigned char) AVFS_MAGIC_CHAR) return 1; return 0; } static char * my_d_path( struct dentry *dentry, struct vfsmount *vfsmnt, struct dentry *root, struct vfsmount *rootmnt, char *buffer, int buflen) { char * end = buffer+buflen; char * retval; int namelen; *--end = '\0'; buflen--; if (!IS_ROOT(dentry) && d_unhashed(dentry)) { buflen -= 10; end -= 10; if (buflen < 0) goto Elong; memcpy(end, " (deleted)", 10); } if (buflen < 1) goto Elong; /* Get '/' right */ retval = end-1; *retval = '/'; for (;;) { struct dentry * parent; if (dentry == root && vfsmnt == rootmnt) break; if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) { /* Global root? */ spin_lock(&vfsmount_lock); if (vfsmnt->mnt_parent == vfsmnt) { spin_unlock(&vfsmount_lock); goto global_root; } dentry = vfsmnt->mnt_mountpoint; vfsmnt = vfsmnt->mnt_parent; spin_unlock(&vfsmount_lock); continue; } parent = dentry->d_parent; prefetch(parent); namelen = dentry->d_name.len; buflen -= namelen + 1; if (buflen < 0) goto Elong; end -= namelen; memcpy(end, dentry->d_name.name, namelen); *--end = '/'; retval = end; dentry = parent; } return retval; global_root: namelen = dentry->d_name.len; buflen -= namelen; if (buflen < 0) goto Elong; retval -= namelen-1; /* hit the slash */ memcpy(retval, dentry->d_name.name, namelen); return retval; Elong: return ERR_PTR(-ENAMETOOLONG); } static int lookup_avfs(struct dentry *dentry, struct nameidata *nd, struct vfsmount *nmnt, struct base_entry *be) { int err; char *page; char *path; err = -ENOMEM; page = (char *) __get_free_page(GFP_KERNEL); if (page) { struct nameidata avfsnd; unsigned int offset = PAGE_SIZE - dentry->d_name.len - 2; spin_lock(&dcache_lock); path = my_d_path(nd->dentry,nd->mnt, nd->mnt->mnt_sb->s_root, nd->mnt, page, offset); spin_unlock(&dcache_lock); err = -ENAMETOOLONG; if (!IS_ERR(path) && page + OVERLAY_DIR_LEN < path) { unsigned int pathlen = strlen(path); path[pathlen] = '/'; memcpy(path + pathlen + 1, dentry->d_name.name, dentry->d_name.len); path[1 + pathlen + dentry->d_name.len] = '\0'; path -= OVERLAY_DIR_LEN; memcpy(path, OVERLAY_DIR, OVERLAY_DIR_LEN); //printk("lookup_avfs: '%s'\n", path); avfsnd.last_type = LAST_ROOT; avfsnd.flags = 0; avfsnd.mnt = mntget(nmnt); avfsnd.dentry = dget(nmnt->mnt_sb->s_root); err = path_walk(path, &avfsnd); if (!err) { if (avfsnd.dentry->d_sb->s_magic != FUSE_MAGIC) { printk("glassfs: not an AVFS inode\n"); path_release(&avfsnd); err = -ENOENT; } else { be->mnt = avfsnd.mnt; be->dentry = avfsnd.dentry; } } } free_page((unsigned long) page); } return err; } static inline int is_create(struct nameidata *nd) { if (!nd) return 1; if ((nd->flags & LOOKUP_CREATE) && !(nd->flags & LOOKUP_CONTINUE)) return 1; return 0; } static struct dentry *glassfs_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) { struct base_entry *be = dir->u.generic_ip; struct dentry *ndentry; struct vfsmount *nmnt; struct inode *inode = NULL; int curravfs = be->is_avfs; // printk("glassfs_lookup\n"); down(&be->dentry->d_inode->i_sem); ndentry = lookup_hash(&dentry->d_name, be->dentry); up(&be->dentry->d_inode->i_sem); if (IS_ERR(ndentry)) return ndentry; nmnt = mntget(be->mnt); if (!is_create(nd) && !ndentry->d_inode && !curravfs && is_avfs(dentry->d_name.name, dentry->d_name.len)) { struct base_entry avfsbe; int err; int total_link_count_save = current->total_link_count; err = lookup_avfs(dentry, nd, nmnt, &avfsbe); current->total_link_count = total_link_count_save; if (!err) { if (avfsbe.dentry->d_inode) { dput(ndentry); mntput(nmnt); ndentry = avfsbe.dentry; nmnt = avfsbe.mnt; curravfs = 1; } else { dput(avfsbe.dentry); mntput(avfsbe.mnt); } } } if (ndentry->d_inode) { struct inode *ninode = ndentry->d_inode; inode = glassfs_alloc_inode(dir->i_sb); if (!inode) { dput(ndentry); mntput(nmnt); return ERR_PTR(-ENOMEM); } glassfs_fill_inode(inode, ninode->i_mode, ninode->i_rdev, ndentry, nmnt, curravfs); } dentry->d_op = &glassfs_dentry_operations; dput(ndentry); mntput(nmnt); return d_splice_alias(inode, dentry); } static int glassfs_permission(struct inode *inode, int mask, struct nameidata *nd) { struct base_entry *be = inode->u.generic_ip; struct inode *ninode = be->dentry->d_inode; // printk("glassfs_permission\n"); /* Exec needs i_mode to contain the correct permission bits */ inode->i_mode = ninode->i_mode; return permission(ninode, mask, NULL); } static int glassfs_create(struct inode *dir, struct dentry *dentry, int mode, struct nameidata *nd) { int err; struct base_entry *be = dir->u.generic_ip; struct inode *ndir = be->dentry->d_inode; struct dentry *ndentry; struct inode *inode = glassfs_alloc_inode(dir->i_sb); if (!inode) return -ENOMEM; // printk("glassfs_create\n"); down(&ndir->i_sem); ndentry = lookup_hash(&dentry->d_name, be->dentry); if (IS_ERR(ndentry)) { err = PTR_ERR(ndentry); ndentry = NULL; } else err = vfs_create(ndir, ndentry, mode, NULL); up(&ndir->i_sem); if (!err && ndentry->d_inode) { struct inode *ninode = ndentry->d_inode; glassfs_fill_inode(inode, ninode->i_mode, ninode->i_rdev, ndentry, be->mnt, be->is_avfs); d_instantiate(dentry, inode); } else iput(inode); dput(ndentry); return err; } static int glassfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) { int err; struct base_entry *be = dir->u.generic_ip; struct inode *ndir = be->dentry->d_inode; struct dentry *ndentry; struct inode *inode = glassfs_alloc_inode(dir->i_sb); if (!inode) return -ENOMEM; // printk("glassfs_mkdir\n"); down(&ndir->i_sem); ndentry = lookup_hash(&dentry->d_name, be->dentry); if (IS_ERR(ndentry)) { err = PTR_ERR(ndentry); ndentry = NULL; } else err = vfs_mkdir(ndir, ndentry, mode); up(&ndir->i_sem); if (!err && ndentry->d_inode) { struct inode *ninode = ndentry->d_inode; glassfs_fill_inode(inode, ninode->i_mode, ninode->i_rdev, ndentry, be->mnt, be->is_avfs); d_instantiate(dentry, inode); } else iput(inode); dput(ndentry); return err; } static int glassfs_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry) { int err; struct base_entry *be = dir->u.generic_ip; struct base_entry *old_be = old_dentry->d_inode->u.generic_ip; struct inode *ndir = be->dentry->d_inode; struct dentry *new_ndentry; struct inode *inode; if (be->mnt != old_be->mnt) return -EXDEV; inode = glassfs_alloc_inode(dir->i_sb); if (!inode) return -ENOMEM; // printk("glassfs_link\n"); down(&ndir->i_sem); new_ndentry = lookup_hash(&new_dentry->d_name, be->dentry); if (IS_ERR(new_ndentry)) { err = PTR_ERR(new_ndentry); new_ndentry = NULL; } else err = vfs_link(old_be->dentry, ndir, new_ndentry); up(&ndir->i_sem); if (!err && new_ndentry->d_inode) { struct inode *ninode = new_ndentry->d_inode; glassfs_fill_inode(inode, ninode->i_mode, ninode->i_rdev, new_ndentry, be->mnt, be->is_avfs); d_instantiate(new_dentry, inode); } else iput(inode); dput(new_ndentry); return err; } static int glassfs_symlink(struct inode *dir, struct dentry *dentry, const char *oldname) { int err; struct base_entry *be = dir->u.generic_ip; struct inode *ndir = be->dentry->d_inode; struct dentry *ndentry; struct inode *inode = glassfs_alloc_inode(dir->i_sb); if (!inode) return -ENOMEM; // printk("glassfs_symlink\n"); down(&ndir->i_sem); ndentry = lookup_hash(&dentry->d_name, be->dentry); if (IS_ERR(ndentry)) { err = PTR_ERR(ndentry); ndentry = NULL; } else err = vfs_symlink(ndir, ndentry, oldname); up(&ndir->i_sem); if (!err && ndentry->d_inode) { struct inode *ninode = ndentry->d_inode; glassfs_fill_inode(inode, ninode->i_mode, ninode->i_rdev, ndentry, be->mnt, be->is_avfs); d_instantiate(dentry, inode); } else iput(inode); dput(ndentry); return err; } static int glassfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) { int err; struct base_entry *be = dir->u.generic_ip; struct inode *ndir = be->dentry->d_inode; struct dentry *ndentry; struct inode *inode = glassfs_alloc_inode(dir->i_sb); if (!inode) return -ENOMEM; // printk("glassfs_mknod\n"); down(&ndir->i_sem); ndentry = lookup_hash(&dentry->d_name, be->dentry); if (IS_ERR(ndentry)) { err = PTR_ERR(ndentry); ndentry = NULL; } else err = vfs_mknod(ndir, ndentry, mode, dev); up(&ndir->i_sem); if (!err && ndentry->d_inode) { struct inode *ninode = ndentry->d_inode; glassfs_fill_inode(inode, ninode->i_mode, ninode->i_rdev, ndentry, be->mnt, be->is_avfs); d_instantiate(dentry, inode); } else iput(inode); dput(ndentry); return err; } static int glassfs_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry) { int err; struct base_entry *old_be = old_dir->u.generic_ip; struct base_entry *new_be = new_dir->u.generic_ip; struct inode *old_ndir = old_be->dentry->d_inode; struct inode *new_ndir = new_be->dentry->d_inode; struct dentry *old_ndentry = NULL; struct dentry *new_ndentry = NULL; struct dentry *trap; if (old_be->mnt != new_be->mnt) return -EXDEV; trap = lock_rename(new_be->dentry, old_be->dentry); old_ndentry = lookup_hash(&old_dentry->d_name, old_be->dentry); if (IS_ERR(old_ndentry)) { err = PTR_ERR(old_ndentry); old_ndentry = NULL; goto out; } if (old_ndentry == trap) { err = -EINVAL; goto out; } if (!old_ndentry->d_inode) { err = -ENOENT; goto out; } new_ndentry = lookup_hash(&new_dentry->d_name, new_be->dentry); if (IS_ERR(new_ndentry)) { err = PTR_ERR(new_ndentry); new_ndentry = NULL; goto out; } if (new_ndentry == trap) { err = -ENOTEMPTY; goto out; } err = vfs_rename(old_ndir, old_ndentry, new_ndir, new_ndentry); out: unlock_rename(new_be->dentry, old_be->dentry); dput(new_ndentry); dput(old_ndentry); return err; } static int glassfs_unlink(struct inode *dir, struct dentry *dentry) { int err; struct base_entry *dir_be = dir->u.generic_ip; struct inode *ndir = dir_be->dentry->d_inode; struct base_entry *be = dentry->d_inode->u.generic_ip; // printk("glassfs_unlink\n"); down(&ndir->i_sem); err = vfs_unlink(ndir, be->dentry); up(&ndir->i_sem); if (!err) dentry->d_inode->i_nlink = 0; return err; } static int glassfs_rmdir(struct inode *dir, struct dentry *dentry) { int err; struct base_entry *dir_be = dir->u.generic_ip; struct inode *ndir = dir_be->dentry->d_inode; struct base_entry *be = dentry->d_inode->u.generic_ip; // printk("glassfs_rmdir\n"); down(&ndir->i_sem); err = vfs_rmdir(ndir, be->dentry); up(&ndir->i_sem); if (!err) dentry->d_inode->i_nlink = 0; return err; } static int glassfs_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) { struct base_entry *be = dentry->d_inode->u.generic_ip; //printk("glassfs_getattr (is avfs: %i)\n", be->is_avfs); return vfs_getattr(be->mnt, be->dentry, stat); } static int glassfs_setattr(struct dentry *dentry, struct iattr *attr) { int err; struct base_entry *be = dentry->d_inode->u.generic_ip; struct inode *ninode = be->dentry->d_inode; if (IS_RDONLY(ninode)) return -EROFS; if (IS_IMMUTABLE(ninode) || IS_APPEND(ninode)) return -EPERM; down(&ninode->i_sem); err = notify_change(be->dentry, attr); up(&ninode->i_sem); return err; } static int glassfs_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags) { int err; struct base_entry *be = dentry->d_inode->u.generic_ip; struct dentry *ndentry = be->dentry; struct inode *ninode = ndentry->d_inode; err = -EOPNOTSUPP; if (ninode->i_op && ninode->i_op->setxattr) { down(&ninode->i_sem); err = security_inode_setxattr(ndentry, (char *) name, (void *) value, size, flags); if (!err) { err = ninode->i_op->setxattr(ndentry, name, value, size, flags); if (!err) security_inode_post_setxattr(ndentry, (char *) name, (void *) value, size, flags); } up(&ninode->i_sem); } return err; } static ssize_t glassfs_getxattr(struct dentry *dentry, const char *name, void *value, size_t size) { ssize_t err; struct base_entry *be = dentry->d_inode->u.generic_ip; struct dentry *ndentry = be->dentry; struct inode *ninode = ndentry->d_inode; err = -EOPNOTSUPP; if (ninode->i_op && ninode->i_op->getxattr) { err = security_inode_getxattr(ndentry, (char *) name); if (!err) err = ninode->i_op->getxattr(ndentry, name, value, size); } return err; } static ssize_t glassfs_listxattr(struct dentry *dentry, char *list, size_t size) { ssize_t err; struct base_entry *be = dentry->d_inode->u.generic_ip; struct dentry *ndentry = be->dentry; struct inode *ninode = ndentry->d_inode; err = -EOPNOTSUPP; if (ninode->i_op && ninode->i_op->listxattr) { err = security_inode_listxattr(ndentry); if (!err) err = ninode->i_op->listxattr(ndentry, list, size); } return err; } static int glassfs_removexattr(struct dentry *dentry, const char *name) { int err; struct base_entry *be = dentry->d_inode->u.generic_ip; struct dentry *ndentry = be->dentry; struct inode *ninode = ndentry->d_inode; err = -EOPNOTSUPP; if (ninode->i_op && ninode->i_op->removexattr) { err = security_inode_removexattr(ndentry, (char *) name); if (!err) { /* strange: the security... usually is within the locked region */ down(&ninode->i_sem); err = ninode->i_op->removexattr(ndentry, name); up(&ninode->i_sem); } } return err; } static int glassfs_statfs(struct super_block *sb, struct kstatfs *buf) { struct super_block *nsb = sb->s_fs_info; // printk("glassfs_statfs\n"); return vfs_statfs(nsb, buf); } static int glassfs_dentry_revalidate(struct dentry *dentry, struct nameidata *nd) { struct base_entry *be; //printk("glassfs_dentry_revalidate %.*s\n", dentry->d_name.len, dentry->d_name.name); if (!dentry->d_inode) return 0; be = dentry->d_inode->u.generic_ip; if (d_unhashed(be->dentry)) return 0; if (be->dentry->d_op && be->dentry->d_op->d_revalidate) return be->dentry->d_op->d_revalidate(be->dentry, NULL); return 1; } static int glassfs_readlink (struct dentry *dentry, char __user *buf, int buflen) { int err; struct base_entry *be = dentry->d_inode->u.generic_ip; struct dentry *ndentry = be->dentry; struct inode *ninode = ndentry->d_inode; err = -EINVAL; if (ninode->i_op && ninode->i_op->readlink) { err = security_inode_readlink(ndentry); if (!err) { update_atime(ninode); err = ninode->i_op->readlink(ndentry, buf, buflen); } } return err; } static int glassfs_follow_link(struct dentry *dentry, struct nameidata *nd) { int err = 0; struct base_entry *be = dentry->d_inode->u.generic_ip; struct dentry *ndentry = be->dentry; struct inode *ninode = ndentry->d_inode; if (ninode->i_op && ninode->i_op->follow_link) { err = security_inode_follow_link(ndentry, nd); if (!err) { update_atime(ninode); err = ninode->i_op->follow_link(ndentry, nd); } } return err; } static void glassfs_clear_inode(struct inode *inode) { struct base_entry *be = inode->u.generic_ip; //printk("glassfs_clear_inode\n"); dput(be->dentry); mntput(be->mnt); kfree(be); } static struct dentry_operations glassfs_dentry_operations = { .d_revalidate = glassfs_dentry_revalidate, }; static struct file_operations glassfs_dir_operations = { .llseek = glassfs_llseek, .read = generic_read_dir, /* Every FS does this */ .readdir = glassfs_readdir, .ioctl = glassfs_ioctl, .open = glassfs_open_dir, .flush = glassfs_flush, .release = glassfs_release, .fsync = glassfs_fsync, }; static struct file_operations glassfs_file_operations = { .open = glassfs_open, }; static struct inode_operations glassfs_dir_inode_operations = { .create = glassfs_create, .lookup = glassfs_lookup, .link = glassfs_link, .unlink = glassfs_unlink, .symlink = glassfs_symlink, .mkdir = glassfs_mkdir, .rmdir = glassfs_rmdir, .mknod = glassfs_mknod, .rename = glassfs_rename, .permission = glassfs_permission, .getattr = glassfs_getattr, .setattr = glassfs_setattr, .setxattr = glassfs_setxattr, .getxattr = glassfs_getxattr, .listxattr = glassfs_listxattr, .removexattr = glassfs_removexattr, }; static struct inode_operations glassfs_file_inode_operations = { .permission = glassfs_permission, .getattr = glassfs_getattr, .setattr = glassfs_setattr, .setxattr = glassfs_setxattr, .getxattr = glassfs_getxattr, .listxattr = glassfs_listxattr, .removexattr = glassfs_removexattr, }; static struct inode_operations glassfs_symlink_inode_operations = { .readlink = glassfs_readlink, .follow_link = glassfs_follow_link, .permission = glassfs_permission, .getattr = glassfs_getattr, .setattr = glassfs_setattr, .setxattr = glassfs_setxattr, .getxattr = glassfs_getxattr, .listxattr = glassfs_listxattr, .removexattr = glassfs_removexattr, }; static struct super_operations glassfs_ops = { .statfs = glassfs_statfs, .clear_inode = glassfs_clear_inode, }; static int glassfs_fill_super(struct super_block * sb, void * data, int silent) { struct inode * inode; struct dentry * root; struct super_block *nsb; struct dentry * nroot; struct vfsmount *nmnt; inode = glassfs_alloc_inode(sb); if (!inode) return -ENOMEM; read_lock(¤t->fs->lock); nroot = current->fs->root; nmnt = current->fs->rootmnt; glassfs_fill_inode(inode, S_IFDIR | 0755, 0, nroot, nmnt, 0); read_unlock(¤t->fs->lock); nsb = nmnt->mnt_sb; sb->s_blocksize = nsb->s_blocksize; sb->s_blocksize_bits = nsb->s_blocksize_bits; sb->s_magic = GLASSFS_MAGIC; sb->s_op = &glassfs_ops; root = d_alloc_root(inode); if (!root) { iput(inode); return -ENOMEM; } sb->s_fs_info = nsb; root->d_op = &glassfs_dentry_operations; sb->s_root = root; return 0; } static struct super_block *glassfs_get_sb(struct file_system_type *fs_type, int flags, const char *dev_name, void *data) { // printk("glassfs_get_sb\n"); return get_sb_nodev(fs_type, flags, data, glassfs_fill_super); } static struct file_system_type glassfs_fs_type = { .owner = THIS_MODULE, .name = "glassfs", .get_sb = glassfs_get_sb, .kill_sb = kill_anon_super, }; static int __init init_glassfs_fs(void) { return register_filesystem(&glassfs_fs_type); } static void __exit exit_glassfs_fs(void) { unregister_filesystem(&glassfs_fs_type); } module_init(init_glassfs_fs) module_exit(exit_glassfs_fs) MODULE_LICENSE("GPL"); /* * Local Variables: * indent-tabs-mode: t * c-basic-offset: 8 * End: */ avfs-1.1.4/glassfs/redir2mount.c0000644000175000001440000000144314032341001013437 00000000000000#include #include #include #include int main(int argc, char *argv[]) { int res; FILE *fp; if(argc != 3) { fprintf(stderr, "usage: %s from to\n", argv[0]); exit(1); } fp = fopen("/proc/fs/redir2/mount_pid", "w"); if(fp == NULL) { perror("opening /proc/fs/redir2/mount_pid"); exit(1); } fprintf(fp, "%u", getpid()); fclose(fp); if (argv[1][0] == '-') { res = umount2(argv[2], 0); if (res == -1) { perror("umount failed"); exit(1); } } else { res = mount(argv[1], argv[2], "none", MS_BIND, NULL); if(res == -1) { perror("mount failed"); exit(1); } } return 0; } avfs-1.1.4/glassfs/redir2.c0000644000175000001440000002502114032341001012352 00000000000000#include #include #include #include #include #include #include #include #define REDIR2_VERSION "0.0" #define AVFS_MAGIC_CHAR '#' #define OVERLAY_DIR "/overlay" #define OVERLAY_DIR_LEN 8 #define FUSE_MAGIC 0x65735546 static struct dentry *(*orig_lookup)(struct inode *, struct dentry *, struct nameidata *); static struct dentry *(**orig_lookup_ptr)(struct inode *, struct dentry *, struct nameidata *); static struct vfsmount *orig_mount; static struct semaphore redir2_sem; static int mount_pid = -1; static int lookup_pid = -1; static LIST_HEAD(redir2_mounts); static struct proc_dir_entry *redir2_proc_dir; struct redir2_mount { struct list_head list; struct vfsmount *mnt; }; static struct super_operations redir2_dummy_super_operations; static struct super_block redir2_dummy_sb = { .s_op = &redir2_dummy_super_operations, }; static int is_avfs(const unsigned char *name, unsigned int len) { for (; len--; name++) if (*name == AVFS_MAGIC_CHAR) return 1; return 0; } static char * my_d_path( struct dentry *dentry, struct vfsmount *vfsmnt, struct dentry *root, struct vfsmount *rootmnt, char *buffer, int buflen) { char * end = buffer+buflen; char * retval; int namelen; *--end = '\0'; buflen--; if (!IS_ROOT(dentry) && d_unhashed(dentry)) return ERR_PTR(-ENOENT); if (buflen < 1) goto Elong; /* Get '/' right */ retval = end-1; *retval = '/'; for (;;) { struct dentry * parent; if (dentry == root && vfsmnt == rootmnt) break; if (dentry == vfsmnt->mnt_root || IS_ROOT(dentry)) { /* Global root? */ spin_lock(&vfsmount_lock); if (vfsmnt->mnt_parent == vfsmnt) { spin_unlock(&vfsmount_lock); goto global_root; } dentry = vfsmnt->mnt_mountpoint; vfsmnt = vfsmnt->mnt_parent; spin_unlock(&vfsmount_lock); continue; } parent = dentry->d_parent; prefetch(parent); namelen = dentry->d_name.len; buflen -= namelen + 1; if (buflen < 0) goto Elong; end -= namelen; memcpy(end, dentry->d_name.name, namelen); *--end = '/'; retval = end; dentry = parent; } return retval; global_root: namelen = dentry->d_name.len; buflen -= namelen; if (buflen < 0) goto Elong; retval -= namelen-1; /* hit the slash */ memcpy(retval, dentry->d_name.name, namelen); return retval; Elong: return ERR_PTR(-ENAMETOOLONG); } static int redir2_permission(struct inode *inode, int mask, struct nameidata *nd) { return -ENOENT; } static int redir2_getattr(struct vfsmount *mnt, struct dentry *entry, struct kstat *stat) { return -ENOENT; } static struct dentry *redir2_dummy_lookup(struct inode *dir, struct dentry *entry, struct nameidata *nd) { return ERR_PTR(-ENOENT); } static struct inode_operations redir2_inode_operations = { .permission = redir2_permission, .getattr = redir2_getattr, .lookup = redir2_dummy_lookup, }; static int mount_avfs(struct dentry *dentry, struct vfsmount *mnt, char *path, int mode) { struct inode *inode; struct redir2_mount *newmnt; newmnt = kmalloc(sizeof(struct redir2_mount), GFP_KERNEL); if (!newmnt) return -ENOMEM; inode = new_inode(&redir2_dummy_sb); if (!inode) { kfree(newmnt); return -ENOMEM; } inode->i_mode = mode; inode->i_op = &redir2_inode_operations; d_instantiate(dentry, inode); char *argv[] = { "/usr/local/bin/redir2mount", path, path + OVERLAY_DIR_LEN, NULL }; char *envp[] = { NULL }; int ret; ret = call_usermodehelper(argv[0], argv, envp, 1); printk("mount ret: %i\n", ret); if (ret) { kfree(newmnt); return -EINVAL; } newmnt->mnt = lookup_mnt(mnt, dentry); if (!newmnt->mnt) { printk("not mounted\n"); kfree(newmnt); return -EINVAL; } __module_get(THIS_MODULE); list_add(&newmnt->list, &redir2_mounts); printk("new mount: %p\n", newmnt->mnt); return 0; } static int exists_avfs(char *path, int *modep) { int err; struct nameidata avfsnd; printk("lookup_avfs: '%s'\n", path); avfsnd.last_type = LAST_ROOT; avfsnd.flags = 0; avfsnd.mnt = mntget(orig_mount); avfsnd.dentry = dget(orig_mount->mnt_sb->s_root); err = path_walk(path, &avfsnd); if (err) return 0; if(!avfsnd.dentry->d_inode) { path_release(&avfsnd); return 0; } *modep = avfsnd.dentry->d_inode->i_mode; path_release(&avfsnd); return 1; } static int lookup_avfs(struct dentry *dentry, struct vfsmount *mnt) { char *page; char *path; int err; err = -ENOMEM; page = (char *) __get_free_page(GFP_KERNEL); if (page) { spin_lock(&dcache_lock); path = my_d_path(dentry, mnt, mnt->mnt_sb->s_root, mnt, page, PAGE_SIZE); spin_unlock(&dcache_lock); err = -ENAMETOOLONG; if (!IS_ERR(path) && page + OVERLAY_DIR_LEN < path) { int mode; path -= OVERLAY_DIR_LEN; memcpy(path, OVERLAY_DIR, OVERLAY_DIR_LEN); if (exists_avfs(path, &mode)) err = mount_avfs(dentry, mnt, path, mode); else err = -ENOENT; } free_page((unsigned long) page); } return err; } static int redir2_dentry_revalidate(struct dentry *dentry, struct nameidata *nd) { //printk("redir2_dentry_revalidate\n"); if (dentry->d_flags & DCACHE_AUTOFS_PENDING) { if (current->pid == mount_pid) return 1; printk("redir2_dentry_revalidate: still pending\n"); down(&redir2_sem); printk("redir2_dentry_revalidate: OK\n"); up(&redir2_sem); } if (dentry->d_flags & DCACHE_AUTOFS_PENDING) BUG(); if (!dentry->d_inode || d_unhashed(dentry)) return 0; return 1; } static int redir2_dentry_delete(struct dentry *dentry) { printk("redir2_dentry_delete %p '%.*s'\n", dentry, dentry->d_name.len, dentry->d_name.name); module_put(THIS_MODULE); return 1; } static struct dentry_operations redir2_dentry_operations = { .d_revalidate = redir2_dentry_revalidate, .d_delete = redir2_dentry_delete, }; static inline int is_create(struct nameidata *nd) { if (!nd) return 1; if ((nd->flags & LOOKUP_CREATE) && !(nd->flags & LOOKUP_CONTINUE)) return 1; return 0; } static int lookup_maybeavfs(struct inode *dir, struct dentry *dentry, struct nameidata *nd) { int err; if (!try_module_get(THIS_MODULE)) return -EBUSY; down(&redir2_sem); lookup_pid = current->pid; printk("redir2_dentry_add %p '%.*s'\n", dentry, dentry->d_name.len, dentry->d_name.name); mount_pid = -1; dentry->d_op = &redir2_dentry_operations; dentry->d_flags |= DCACHE_AUTOFS_PENDING; d_add(dentry, NULL); up(&dir->i_sem); err = lookup_avfs(dentry, nd->mnt); if (err) d_drop(dentry); dentry->d_flags &= ~DCACHE_AUTOFS_PENDING; lookup_pid = -1; up(&redir2_sem); down(&dir->i_sem); return err; } static struct dentry *redir2_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd) { int err; //printk("lookup %.*s\n", dentry->d_name.len, dentry->d_name.name); if (current->pid == lookup_pid || is_create(nd) || !is_avfs(dentry->d_name.name, dentry->d_name.len)) return orig_lookup(dir, dentry, nd); err = lookup_maybeavfs(dir, dentry, nd); if (err) return ERR_PTR(err); return NULL; } static void redir2_release_mount(struct redir2_mount *mnt) { printk("releasing mount: %p\n", mnt->mnt); mntput(mnt->mnt); list_del(&mnt->list); kfree(mnt); module_put(THIS_MODULE); } static int umount_avfs(struct redir2_mount *mnt, char *path) { char *argv[] = { "/usr/local/bin/redir2mount", "-", path, NULL }; char *envp[] = { NULL }; int ret; redir2_release_mount(mnt); printk("umount\n"); ret = call_usermodehelper(argv[0], argv, envp, 1); printk("umount ret: %i\n", ret); if (ret) return -EINVAL; return 0; } static void redir2_try_umount(struct redir2_mount *mnt) { char *page; char *path; struct dentry *dentry; struct vfsmount *pmnt; page = (char *) __get_free_page(GFP_KERNEL); if (!page) return; spin_lock(&vfsmount_lock); if (mnt->mnt->mnt_parent == mnt->mnt) { /* Already unmounted */ spin_unlock(&vfsmount_lock); redir2_release_mount(mnt); free_page((unsigned long) page); return; } pmnt = mntget(mnt->mnt->mnt_parent); dentry = dget(mnt->mnt->mnt_mountpoint); spin_unlock(&vfsmount_lock); spin_lock(&dcache_lock); path = my_d_path(dentry, pmnt, pmnt->mnt_sb->s_root, pmnt, page, PAGE_SIZE); spin_unlock(&dcache_lock); if (!IS_ERR(path)) umount_avfs(mnt, path); free_page((unsigned long) page); dput(dentry); mntput(pmnt); } static int redir2_flush(struct file *file, const char __user *buffer, unsigned long count, void *data) { struct redir2_mount *mnt; struct redir2_mount *next; printk("redir2_flush (%i)\n", current->pid); down(&redir2_sem); list_for_each_entry_safe (mnt, next, &redir2_mounts, list) { int cnt = atomic_read(&mnt->mnt->mnt_count); printk("mount %p has count %u\n", mnt->mnt, cnt); if (cnt <= 2) { redir2_try_umount(mnt); // break; } } up(&redir2_sem); return count; } static int mount_pid_write(struct file *file, const char __user *buffer, unsigned long count, void *data) { char buf[32]; if(count > sizeof(buf)) return -EINVAL; if(copy_from_user(buf, buffer, count)) return -EFAULT; mount_pid = simple_strtol(buf, NULL, 10); return count; } static void redir2_init_proc(void) { redir2_proc_dir = proc_mkdir("redir2", proc_root_fs); if (redir2_proc_dir) { struct proc_dir_entry *e; redir2_proc_dir->owner = THIS_MODULE; e = create_proc_entry("mount_pid", S_IFREG | 0200, redir2_proc_dir); if (e) { e->owner = THIS_MODULE; e->write_proc = mount_pid_write; } e = create_proc_entry("flush", S_IFREG | 0200, redir2_proc_dir); if (e) { e->owner = THIS_MODULE; e->write_proc = redir2_flush; } } } static int __init init_redir2(void) { printk(KERN_INFO "redir2 init (version %s)\n", REDIR2_VERSION); sema_init(&redir2_sem, 1); redir2_init_proc(); read_lock(¤t->fs->lock); orig_mount = mntget(current->fs->rootmnt); orig_lookup_ptr = ¤t->fs->root->d_inode->i_op->lookup; orig_lookup = *orig_lookup_ptr; *orig_lookup_ptr = redir2_lookup; read_unlock(¤t->fs->lock); /* FIXME: This is a bit too brutal approach */ printk("shrinking dcache...\n"); shrink_dcache_sb(orig_mount->mnt_sb); printk("done\n"); return 0; } static void __exit exit_redir2(void) { printk(KERN_INFO "redir2 cleanup\n"); if (orig_lookup_ptr) *orig_lookup_ptr = orig_lookup; mntput(orig_mount); if (redir2_proc_dir) { remove_proc_entry("mount_pid", redir2_proc_dir); remove_proc_entry("flush", redir2_proc_dir); remove_proc_entry("redir2", proc_root_fs); } } module_init(init_redir2) module_exit(exit_redir2) MODULE_LICENSE("GPL"); /* * Local Variables: * indent-tabs-mode: t * c-basic-offset: 8 * End: */ avfs-1.1.4/glassfs/Makefile0000644000175000001440000000053314032341001012460 00000000000000#CC=gcc #CFLAGS=-Wall -W obj-m := glassfs.o redir2.o #KERNDIR := /store/linux/uml/linux-2.6.4 #EXTRA := ARCH=um ifeq ($(KERNELDIR),) KERNDIR := $(shell cd /lib/modules/`uname -r`/build; /bin/pwd) else KERNDIR := ${KERNELDIR} endif all: $(MAKE) -C $(KERNDIR) SUBDIRS=$(PWD) $(EXTRA) modules clean: rm -f *~ rm -f *.o *.ko *.mod.c .*.cmd avfs-1.1.4/fuse/0000755000175000001440000000000014032341025010405 500000000000000avfs-1.1.4/fuse/avfsd.c0000644000175000001440000001336214032341001011573 00000000000000/* FUSE: Filesystem in Userspace Copyright (C) 2001 Miklos Szeredi Copyright (C) 2009-2010 Ralf Hoffmann (ralf@boomerangsworld.de) This program can be distributed under the terms of the GNU GPL. See the file COPYING. */ #define FUSE_USE_VERSION 26 #include #include #include #include #include #include #include #include #include #include struct fuse *fuse; static pthread_mutex_t avfsd_mutexlock = PTHREAD_MUTEX_INITIALIZER; static int avfsd_getattr(const char *path, struct stat *stbuf) { int res; res = virt_lstat(path, stbuf); if (res == -1) return -errno; return 0; } static int avfsd_readlink(const char *path, char *buf, size_t size) { int res; res = virt_readlink(path, buf, size - 1); if (res == -1) return -errno; buf[res] = '\0'; return 0; } static int avfsd_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi) { DIR *dp; struct dirent *de; (void) offset; (void) fi; dp = virt_opendir(path); if (dp == NULL) return -errno; while((de = virt_readdir(dp)) != NULL) { struct stat st; memset(&st, 0, sizeof(st)); st.st_ino = de->d_ino; st.st_mode = de->d_type << 12; if (filler(buf, de->d_name, &st, 0)) break; } virt_closedir(dp); return 0; } static int avfsd_mknod(const char *path, mode_t mode, dev_t rdev) { int res; res = virt_mknod(path, mode, rdev); if (res == -1) return -errno; return 0; } static int avfsd_mkdir(const char *path, mode_t mode) { int res; res = virt_mkdir(path, mode); if (res == -1) return -errno; return 0; } static int avfsd_unlink(const char *path) { int res; res = virt_unlink(path); if (res == -1) return -errno; return 0; } static int avfsd_rmdir(const char *path) { int res; res = virt_rmdir(path); if (res == -1) return -errno; return 0; } static int avfsd_symlink(const char *from, const char *to) { int res; res = virt_symlink(from, to); if (res == -1) return -errno; return 0; } static int avfsd_rename(const char *from, const char *to) { int res; res = virt_rename(from, to); if (res == -1) return -errno; return 0; } static int avfsd_link(const char *from, const char *to) { int res; res = virt_link(from, to); if (res == -1) return -errno; return 0; } static int avfsd_chmod(const char *path, mode_t mode) { int res; res = virt_chmod(path, mode); if (res == -1) return -errno; return 0; } static int avfsd_chown(const char *path, uid_t uid, gid_t gid) { int res; res = virt_lchown(path, uid, gid); if (res == -1) return -errno; return 0; } static int avfsd_truncate(const char *path, off_t size) { int res; res = virt_truncate(path, size); if (res == -1) return -errno; return 0; } static int avfsd_utime(const char *path, struct utimbuf *buf) { int res; res = virt_utime(path, buf); if (res == -1) return -errno; return 0; } static int avfsd_open(const char *path, struct fuse_file_info *fi) { int res; res = virt_open(path, fi->flags, 0); if (res == -1) return -errno; fi->fh = res; return 0; } static int avfsd_read(const char *path, char *buf, size_t size, off_t offset, struct fuse_file_info *fi) { int res; (void) path; pthread_mutex_lock( &avfsd_mutexlock ); if (virt_lseek(fi->fh, offset, SEEK_SET) == -1) { pthread_mutex_unlock( &avfsd_mutexlock ); return -errno; } res = virt_read(fi->fh, buf, size); pthread_mutex_unlock( &avfsd_mutexlock ); if (res == -1) return -errno; return res; } static int avfsd_write(const char *path, const char *buf, size_t size, off_t offset, struct fuse_file_info *fi) { int res; (void) path; pthread_mutex_lock( &avfsd_mutexlock ); if (virt_lseek(fi->fh, offset, SEEK_SET) == -1) { pthread_mutex_unlock( &avfsd_mutexlock ); return -errno; } res = virt_write(fi->fh, buf, size); pthread_mutex_unlock( &avfsd_mutexlock ); if (res == -1) return -errno; return res; } static int avfsd_release(const char *path, struct fuse_file_info *fi) { (void) path; pthread_mutex_lock( &avfsd_mutexlock ); virt_close(fi->fh); pthread_mutex_unlock( &avfsd_mutexlock ); return 0; } static int avfsd_access(const char *path, int mask) { int res; res = virt_access(path, mask); if (res == -1) return -errno; return 0; } static int avfsd_create(const char *path, mode_t mode, struct fuse_file_info *fi) { int res; /* open will handle the O_CREAT flag */ res = virt_open(path, fi->flags | O_CREAT | O_TRUNC, mode); if (res == -1) return -errno; fi->fh = res; return 0; } static struct fuse_operations avfsd_oper = { getattr: avfsd_getattr, readlink: avfsd_readlink, readdir: avfsd_readdir, mknod: avfsd_mknod, mkdir: avfsd_mkdir, symlink: avfsd_symlink, unlink: avfsd_unlink, rmdir: avfsd_rmdir, rename: avfsd_rename, link: avfsd_link, chmod: avfsd_chmod, chown: avfsd_chown, truncate: avfsd_truncate, utime: avfsd_utime, open: avfsd_open, read: avfsd_read, write: avfsd_write, release: avfsd_release, access: avfsd_access, create: avfsd_create, }; int main(int argc, char *argv[]) { fuse_main(argc, argv, &avfsd_oper, NULL); return 0; } avfs-1.1.4/fuse/Makefile.in0000644000175000001440000005024714032341013012377 00000000000000# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ @INSTALL_FUSE_TRUE@bin_PROGRAMS = avfsd$(EXEEXT) subdir = fuse ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(bindir)" PROGRAMS = $(bin_PROGRAMS) am__avfsd_SOURCES_DIST = avfsd.c @INSTALL_FUSE_TRUE@am_avfsd_OBJECTS = avfsd.$(OBJEXT) avfsd_OBJECTS = $(am_avfsd_OBJECTS) @INSTALL_FUSE_TRUE@avfsd_DEPENDENCIES = ../lib/libavfs_static.la AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = avfsd_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(avfsd_LDFLAGS) $(LDFLAGS) -o $@ AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/avfsd.Po am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(avfsd_SOURCES) DIST_SOURCES = $(am__avfsd_SOURCES_DIST) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BZLIB_INCLUDE = @BZLIB_INCLUDE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAV = @DAV@ DAV_LS = @DAV_LS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FUSELIBS = @FUSELIBS@ GREP = @GREP@ HAVE_ZIPINFO = @HAVE_ZIPINFO@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ LIBZSTD_LIBS = @LIBZSTD_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NUMVERSION = @NUMVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ ZIP = @ZIP@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_INCLUDE = @ZLIB_INCLUDE@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @INSTALL_FUSE_TRUE@AM_CFLAGS = -I$(top_srcdir)/include @CFLAGS@ @CPPFLAGS@ @INSTALL_FUSE_TRUE@avfsd_LDFLAGS = @LDFLAGS@ @LIBS@ @FUSELIBS@ @INSTALL_FUSE_TRUE@avfsd_LDADD = ../lib/libavfs_static.la @INSTALL_FUSE_TRUE@avfsd_SOURCES = avfsd.c all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu fuse/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu fuse/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(bindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(bindir)" || exit 1; \ fi; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p \ || test -f $$p1 \ ; then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' \ -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(bindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(bindir)$$dir" || exit $$?; \ } \ ; done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(bindir)" && rm -f $$files clean-binPROGRAMS: @list='$(bin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list avfsd$(EXEEXT): $(avfsd_OBJECTS) $(avfsd_DEPENDENCIES) $(EXTRA_avfsd_DEPENDENCIES) @rm -f avfsd$(EXEEXT) $(AM_V_CCLD)$(avfsd_LINK) $(avfsd_OBJECTS) $(avfsd_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avfsd.Po@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/avfsd.Po -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-binPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/avfsd.Po -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \ ctags ctags-am distclean distclean-compile distclean-generic \ distclean-libtool distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am uninstall-binPROGRAMS .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: avfs-1.1.4/fuse/Makefile.am0000644000175000001440000000032214032341001012350 00000000000000if INSTALL_FUSE bin_PROGRAMS = avfsd AM_CFLAGS = -I$(top_srcdir)/include @CFLAGS@ @CPPFLAGS@ avfsd_LDFLAGS = @LDFLAGS@ @LIBS@ @FUSELIBS@ avfsd_LDADD = ../lib/libavfs_static.la avfsd_SOURCES = avfsd.c endif avfs-1.1.4/bzlib/0000755000175000001440000000000014032341025010545 500000000000000avfs-1.1.4/bzlib/bzlib_private.h0000644000175000001440000003261214032341001013470 00000000000000/* IMPORTANT NOTE: This is not the original bzip2 distribution. The modifications are copyright (C) 2001 Miklos Szeredi The modified software can be distributed under the same licence as the original software (see bellow). */ /*-------------------------------------------------------------*/ /*--- Private header file for the library. ---*/ /*--- bzlib_private.h ---*/ /*-------------------------------------------------------------*/ /* ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.8 of 13 July 2019 Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ */ #ifndef _BZLIB_PRIVATE_H #define _BZLIB_PRIVATE_H #include #ifndef BZ_NO_STDIO #include #include #include #endif #include "bzlib.h" /*-- General stuff. --*/ #define BZ_VERSION "1.0.8, 13-Jul-2019" typedef char Char; typedef unsigned char Bool; typedef unsigned char UChar; typedef int Int32; typedef unsigned int UInt32; typedef short Int16; typedef unsigned short UInt16; #define True ((Bool)1) #define False ((Bool)0) #ifndef __GNUC__ #define __inline__ /* */ #endif #ifndef BZ_NO_STDIO extern void BZ2_bz__AssertH__fail ( int errcode ); #define AssertH(cond,errcode) \ { if (!(cond)) BZ2_bz__AssertH__fail ( errcode ); } #if BZ_DEBUG #define AssertD(cond,msg) \ { if (!(cond)) { \ fprintf ( stderr, \ "\n\nlibbzip2(debug build): internal error\n\t%s\n", msg );\ exit(1); \ }} #else #define AssertD(cond,msg) /* */ #endif #define VPrintf0(zf) \ fprintf(stderr,zf) #define VPrintf1(zf,za1) \ fprintf(stderr,zf,za1) #define VPrintf2(zf,za1,za2) \ fprintf(stderr,zf,za1,za2) #define VPrintf3(zf,za1,za2,za3) \ fprintf(stderr,zf,za1,za2,za3) #define VPrintf4(zf,za1,za2,za3,za4) \ fprintf(stderr,zf,za1,za2,za3,za4) #define VPrintf5(zf,za1,za2,za3,za4,za5) \ fprintf(stderr,zf,za1,za2,za3,za4,za5) #else extern void bz_internal_error ( int errcode ); #define AssertH(cond,errcode) \ { if (!(cond)) bz_internal_error ( errcode ); } #define AssertD(cond,msg) do { } while (0) #define VPrintf0(zf) do { } while (0) #define VPrintf1(zf,za1) do { } while (0) #define VPrintf2(zf,za1,za2) do { } while (0) #define VPrintf3(zf,za1,za2,za3) do { } while (0) #define VPrintf4(zf,za1,za2,za3,za4) do { } while (0) #define VPrintf5(zf,za1,za2,za3,za4,za5) do { } while (0) #endif #define BZALLOC(nnn) (strm->bzalloc)(strm->opaque,(nnn),1) #define BZFREE(ppp) (strm->bzfree)(strm->opaque,(ppp)) /*-- Header bytes. --*/ #define BZ_HDR_B 0x42 /* 'B' */ #define BZ_HDR_Z 0x5a /* 'Z' */ #define BZ_HDR_h 0x68 /* 'h' */ #define BZ_HDR_0 0x30 /* '0' */ /*-- Constants for the back end. --*/ #define BZ_MAX_ALPHA_SIZE 258 #define BZ_MAX_CODE_LEN 23 #define BZ_RUNA 0 #define BZ_RUNB 1 #define BZ_N_GROUPS 6 #define BZ_G_SIZE 50 #define BZ_N_ITERS 4 #define BZ_MAX_SELECTORS (2 + (900000 / BZ_G_SIZE)) /*-- Stuff for randomising repetitive blocks. --*/ extern Int32 BZ2_rNums[512]; #define BZ_RAND_DECLS \ Int32 rNToGo; \ Int32 rTPos \ #define BZ_RAND_INIT_MASK \ s->rNToGo = 0; \ s->rTPos = 0 \ #define BZ_RAND_MASK ((s->rNToGo == 1) ? 1 : 0) #define BZ_RAND_UPD_MASK \ if (s->rNToGo == 0) { \ s->rNToGo = BZ2_rNums[s->rTPos]; \ s->rTPos++; \ if (s->rTPos == 512) s->rTPos = 0; \ } \ s->rNToGo--; /*-- Stuff for doing CRCs. --*/ extern UInt32 BZ2_crc32Table[256]; #define BZ_INITIALISE_CRC(crcVar) \ { \ crcVar = 0xffffffffL; \ } #define BZ_FINALISE_CRC(crcVar) \ { \ crcVar = ~(crcVar); \ } #define BZ_UPDATE_CRC(crcVar,cha) \ { \ crcVar = (crcVar << 8) ^ \ BZ2_crc32Table[(crcVar >> 24) ^ \ ((UChar)cha)]; \ } /*-- States and modes for compression. --*/ #define BZ_M_IDLE 1 #define BZ_M_RUNNING 2 #define BZ_M_FLUSHING 3 #define BZ_M_FINISHING 4 #define BZ_S_OUTPUT 1 #define BZ_S_INPUT 2 #define BZ_N_RADIX 2 #define BZ_N_QSORT 12 #define BZ_N_SHELL 18 #define BZ_N_OVERSHOOT (BZ_N_RADIX + BZ_N_QSORT + BZ_N_SHELL + 2) /*-- Structure holding all the compression-side stuff. --*/ typedef struct { /* pointer back to the struct bz_stream */ bz_stream* strm; /* mode this stream is in, and whether inputting */ /* or outputting data */ Int32 mode; Int32 state; /* remembers avail_in when flush/finish requested */ UInt32 avail_in_expect; /* for doing the block sorting */ UInt32* arr1; UInt32* arr2; UInt32* ftab; Int32 origPtr; /* aliases for arr1 and arr2 */ UInt32* ptr; UChar* block; UInt16* mtfv; UChar* zbits; /* for deciding when to use the fallback sorting algorithm */ Int32 workFactor; /* run-length-encoding of the input */ UInt32 state_in_ch; Int32 state_in_len; BZ_RAND_DECLS; /* input and output limits and current posns */ Int32 nblock; Int32 nblockMAX; Int32 numZ; Int32 state_out_pos; /* map of bytes used in block */ Int32 nInUse; Bool inUse[256]; UChar unseqToSeq[256]; /* the buffer for bit stream creation */ UInt32 bsBuff; Int32 bsLive; /* block and combined CRCs */ UInt32 blockCRC; UInt32 combinedCRC; /* misc administratium */ Int32 verbosity; Int32 blockNo; Int32 blockSize100k; /* stuff for coding the MTF values */ Int32 nMTF; Int32 mtfFreq [BZ_MAX_ALPHA_SIZE]; UChar selector [BZ_MAX_SELECTORS]; UChar selectorMtf[BZ_MAX_SELECTORS]; UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; Int32 code [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; Int32 rfreq [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; /* second dimension: only 3 needed; 4 makes index calculations faster */ UInt32 len_pack[BZ_MAX_ALPHA_SIZE][4]; } EState; /*-- externs for compression. --*/ extern void BZ2_blockSort ( EState* ); extern void BZ2_compressBlock ( EState*, Bool ); extern void BZ2_bsInitWrite ( EState* ); extern void BZ2_hbAssignCodes ( Int32*, UChar*, Int32, Int32, Int32 ); extern void BZ2_hbMakeCodeLengths ( UChar*, Int32*, Int32, Int32 ); /*-- states for decompression. --*/ #define BZ_X_IDLE 1 #define BZ_X_OUTPUT 2 #define BZ_X_MAGIC_1 10 #define BZ_X_MAGIC_2 11 #define BZ_X_MAGIC_3 12 #define BZ_X_MAGIC_4 13 #define BZ_X_BLKHDR_1 14 #define BZ_X_BLKHDR_2 15 #define BZ_X_BLKHDR_3 16 #define BZ_X_BLKHDR_4 17 #define BZ_X_BLKHDR_5 18 #define BZ_X_BLKHDR_6 19 #define BZ_X_BCRC_1 20 #define BZ_X_BCRC_2 21 #define BZ_X_BCRC_3 22 #define BZ_X_BCRC_4 23 #define BZ_X_RANDBIT 24 #define BZ_X_ORIGPTR_1 25 #define BZ_X_ORIGPTR_2 26 #define BZ_X_ORIGPTR_3 27 #define BZ_X_MAPPING_1 28 #define BZ_X_MAPPING_2 29 #define BZ_X_SELECTOR_1 30 #define BZ_X_SELECTOR_2 31 #define BZ_X_SELECTOR_3 32 #define BZ_X_CODING_1 33 #define BZ_X_CODING_2 34 #define BZ_X_CODING_3 35 #define BZ_X_MTF_1 36 #define BZ_X_MTF_2 37 #define BZ_X_MTF_3 38 #define BZ_X_MTF_4 39 #define BZ_X_MTF_5 40 #define BZ_X_MTF_6 41 #define BZ_X_ENDHDR_2 42 #define BZ_X_ENDHDR_3 43 #define BZ_X_ENDHDR_4 44 #define BZ_X_ENDHDR_5 45 #define BZ_X_ENDHDR_6 46 #define BZ_X_CCRC_1 47 #define BZ_X_CCRC_2 48 #define BZ_X_CCRC_3 49 #define BZ_X_CCRC_4 50 /*-- Constants for the fast MTF decoder. --*/ #define MTFA_SIZE 4096 #define MTFL_SIZE 16 /*-- Structure holding all the decompression-side stuff. --*/ typedef struct { /* pointer back to the struct bz_stream */ bz_stream* strm; /* state indicator for this stream */ Int32 state; /* for doing the final run-length decoding */ UChar state_out_ch; Int32 state_out_len; Bool blockRandomised; BZ_RAND_DECLS; /* the buffer for bit stream reading */ UInt32 bsBuff; Int32 bsLive; /* misc administratium */ Int32 blockSize100k; Bool smallDecompress; Int32 currBlockNo; Int32 verbosity; /* for undoing the Burrows-Wheeler transform */ Int32 origPtr; UInt32 tPos; Int32 k0; Int32 unzftab[256]; Int32 nblock_used; Int32 cftab[257]; Int32 cftabCopy[257]; /* for undoing the Burrows-Wheeler transform (FAST) */ UInt32 *tt; /* for undoing the Burrows-Wheeler transform (SMALL) */ UInt16 *ll16; UChar *ll4; /* stored and calculated CRCs */ UInt32 storedBlockCRC; UInt32 storedCombinedCRC; UInt32 calculatedBlockCRC; UInt32 calculatedCombinedCRC; /* map of bytes used in block */ Int32 nInUse; Bool inUse[256]; Bool inUse16[16]; UChar seqToUnseq[256]; /* for decoding the MTF values */ UChar mtfa [MTFA_SIZE]; Int32 mtfbase[256 / MTFL_SIZE]; UChar selector [BZ_MAX_SELECTORS]; UChar selectorMtf[BZ_MAX_SELECTORS]; UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; Int32 limit [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; Int32 base [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; Int32 perm [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; Int32 minLens[BZ_N_GROUPS]; /* block end handler */ void (*blockEndHandler) (void *, bz_stream *, unsigned int, unsigned int, unsigned int, unsigned int); void * blockEndHandlerData; /* save area for scalars in the main decompress code */ Int32 save_i; Int32 save_j; Int32 save_t; Int32 save_alphaSize; Int32 save_nGroups; Int32 save_nSelectors; Int32 save_EOB; Int32 save_groupNo; Int32 save_groupPos; Int32 save_nextSym; Int32 save_nblockMAX; Int32 save_nblock; Int32 save_es; Int32 save_N; Int32 save_curr; Int32 save_zt; Int32 save_zn; Int32 save_zvec; Int32 save_zj; Int32 save_gSel; Int32 save_gMinlen; Int32* save_gLimit; Int32* save_gBase; Int32* save_gPerm; } DState; /*-- Macros for decompression. --*/ #define BZ_GET_FAST(cccc) \ /* c_tPos is unsigned, hence test < 0 is pointless. */ \ if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \ s->tPos = s->tt[s->tPos]; \ cccc = (UChar)(s->tPos & 0xff); \ s->tPos >>= 8; #define BZ_GET_FAST_C(cccc) \ /* c_tPos is unsigned, hence test < 0 is pointless. */ \ if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return True; \ c_tPos = c_tt[c_tPos]; \ cccc = (UChar)(c_tPos & 0xff); \ c_tPos >>= 8; #define SET_LL4(i,n) \ { if (((i) & 0x1) == 0) \ s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0xf0) | (n); else \ s->ll4[(i) >> 1] = (s->ll4[(i) >> 1] & 0x0f) | ((n) << 4); \ } #define GET_LL4(i) \ ((((UInt32)(s->ll4[(i) >> 1])) >> (((i) << 2) & 0x4)) & 0xF) #define SET_LL(i,n) \ { s->ll16[i] = (UInt16)(n & 0x0000ffff); \ SET_LL4(i, n >> 16); \ } #define GET_LL(i) \ (((UInt32)s->ll16[i]) | (GET_LL4(i) << 16)) #define BZ_GET_SMALL(cccc) \ /* c_tPos is unsigned, hence test < 0 is pointless. */ \ if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \ cccc = BZ2_indexIntoF ( s->tPos, s->cftab ); \ s->tPos = GET_LL(s->tPos); /*-- externs for decompression. --*/ extern Int32 BZ2_indexIntoF ( Int32, Int32* ); extern Int32 BZ2_decompress ( DState* ); extern void BZ2_hbCreateDecodeTables ( Int32*, Int32*, Int32*, UChar*, Int32, Int32, Int32 ); #endif /*-- BZ_NO_STDIO seems to make NULL disappear on some platforms. --*/ #ifdef BZ_NO_STDIO #ifndef NULL #define NULL 0 #endif #endif /*-------------------------------------------------------------*/ /*--- end bzlib_private.h ---*/ /*-------------------------------------------------------------*/ avfs-1.1.4/bzlib/crctable.c0000644000175000001440000001131514032341001012403 00000000000000 /*-------------------------------------------------------------*/ /*--- Table for doing CRCs ---*/ /*--- crctable.c ---*/ /*-------------------------------------------------------------*/ /* ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.8 of 13 July 2019 Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ */ #include "bzlib_private.h" /*-- I think this is an implementation of the AUTODIN-II, Ethernet & FDDI 32-bit CRC standard. Vaguely derived from code by Rob Warnock, in Section 51 of the comp.compression FAQ. --*/ UInt32 BZ2_crc32Table[256] = { /*-- Ugly, innit? --*/ 0x00000000L, 0x04c11db7L, 0x09823b6eL, 0x0d4326d9L, 0x130476dcL, 0x17c56b6bL, 0x1a864db2L, 0x1e475005L, 0x2608edb8L, 0x22c9f00fL, 0x2f8ad6d6L, 0x2b4bcb61L, 0x350c9b64L, 0x31cd86d3L, 0x3c8ea00aL, 0x384fbdbdL, 0x4c11db70L, 0x48d0c6c7L, 0x4593e01eL, 0x4152fda9L, 0x5f15adacL, 0x5bd4b01bL, 0x569796c2L, 0x52568b75L, 0x6a1936c8L, 0x6ed82b7fL, 0x639b0da6L, 0x675a1011L, 0x791d4014L, 0x7ddc5da3L, 0x709f7b7aL, 0x745e66cdL, 0x9823b6e0L, 0x9ce2ab57L, 0x91a18d8eL, 0x95609039L, 0x8b27c03cL, 0x8fe6dd8bL, 0x82a5fb52L, 0x8664e6e5L, 0xbe2b5b58L, 0xbaea46efL, 0xb7a96036L, 0xb3687d81L, 0xad2f2d84L, 0xa9ee3033L, 0xa4ad16eaL, 0xa06c0b5dL, 0xd4326d90L, 0xd0f37027L, 0xddb056feL, 0xd9714b49L, 0xc7361b4cL, 0xc3f706fbL, 0xceb42022L, 0xca753d95L, 0xf23a8028L, 0xf6fb9d9fL, 0xfbb8bb46L, 0xff79a6f1L, 0xe13ef6f4L, 0xe5ffeb43L, 0xe8bccd9aL, 0xec7dd02dL, 0x34867077L, 0x30476dc0L, 0x3d044b19L, 0x39c556aeL, 0x278206abL, 0x23431b1cL, 0x2e003dc5L, 0x2ac12072L, 0x128e9dcfL, 0x164f8078L, 0x1b0ca6a1L, 0x1fcdbb16L, 0x018aeb13L, 0x054bf6a4L, 0x0808d07dL, 0x0cc9cdcaL, 0x7897ab07L, 0x7c56b6b0L, 0x71159069L, 0x75d48ddeL, 0x6b93dddbL, 0x6f52c06cL, 0x6211e6b5L, 0x66d0fb02L, 0x5e9f46bfL, 0x5a5e5b08L, 0x571d7dd1L, 0x53dc6066L, 0x4d9b3063L, 0x495a2dd4L, 0x44190b0dL, 0x40d816baL, 0xaca5c697L, 0xa864db20L, 0xa527fdf9L, 0xa1e6e04eL, 0xbfa1b04bL, 0xbb60adfcL, 0xb6238b25L, 0xb2e29692L, 0x8aad2b2fL, 0x8e6c3698L, 0x832f1041L, 0x87ee0df6L, 0x99a95df3L, 0x9d684044L, 0x902b669dL, 0x94ea7b2aL, 0xe0b41de7L, 0xe4750050L, 0xe9362689L, 0xedf73b3eL, 0xf3b06b3bL, 0xf771768cL, 0xfa325055L, 0xfef34de2L, 0xc6bcf05fL, 0xc27dede8L, 0xcf3ecb31L, 0xcbffd686L, 0xd5b88683L, 0xd1799b34L, 0xdc3abdedL, 0xd8fba05aL, 0x690ce0eeL, 0x6dcdfd59L, 0x608edb80L, 0x644fc637L, 0x7a089632L, 0x7ec98b85L, 0x738aad5cL, 0x774bb0ebL, 0x4f040d56L, 0x4bc510e1L, 0x46863638L, 0x42472b8fL, 0x5c007b8aL, 0x58c1663dL, 0x558240e4L, 0x51435d53L, 0x251d3b9eL, 0x21dc2629L, 0x2c9f00f0L, 0x285e1d47L, 0x36194d42L, 0x32d850f5L, 0x3f9b762cL, 0x3b5a6b9bL, 0x0315d626L, 0x07d4cb91L, 0x0a97ed48L, 0x0e56f0ffL, 0x1011a0faL, 0x14d0bd4dL, 0x19939b94L, 0x1d528623L, 0xf12f560eL, 0xf5ee4bb9L, 0xf8ad6d60L, 0xfc6c70d7L, 0xe22b20d2L, 0xe6ea3d65L, 0xeba91bbcL, 0xef68060bL, 0xd727bbb6L, 0xd3e6a601L, 0xdea580d8L, 0xda649d6fL, 0xc423cd6aL, 0xc0e2d0ddL, 0xcda1f604L, 0xc960ebb3L, 0xbd3e8d7eL, 0xb9ff90c9L, 0xb4bcb610L, 0xb07daba7L, 0xae3afba2L, 0xaafbe615L, 0xa7b8c0ccL, 0xa379dd7bL, 0x9b3660c6L, 0x9ff77d71L, 0x92b45ba8L, 0x9675461fL, 0x8832161aL, 0x8cf30badL, 0x81b02d74L, 0x857130c3L, 0x5d8a9099L, 0x594b8d2eL, 0x5408abf7L, 0x50c9b640L, 0x4e8ee645L, 0x4a4ffbf2L, 0x470cdd2bL, 0x43cdc09cL, 0x7b827d21L, 0x7f436096L, 0x7200464fL, 0x76c15bf8L, 0x68860bfdL, 0x6c47164aL, 0x61043093L, 0x65c52d24L, 0x119b4be9L, 0x155a565eL, 0x18197087L, 0x1cd86d30L, 0x029f3d35L, 0x065e2082L, 0x0b1d065bL, 0x0fdc1becL, 0x3793a651L, 0x3352bbe6L, 0x3e119d3fL, 0x3ad08088L, 0x2497d08dL, 0x2056cd3aL, 0x2d15ebe3L, 0x29d4f654L, 0xc5a92679L, 0xc1683bceL, 0xcc2b1d17L, 0xc8ea00a0L, 0xd6ad50a5L, 0xd26c4d12L, 0xdf2f6bcbL, 0xdbee767cL, 0xe3a1cbc1L, 0xe760d676L, 0xea23f0afL, 0xeee2ed18L, 0xf0a5bd1dL, 0xf464a0aaL, 0xf9278673L, 0xfde69bc4L, 0x89b8fd09L, 0x8d79e0beL, 0x803ac667L, 0x84fbdbd0L, 0x9abc8bd5L, 0x9e7d9662L, 0x933eb0bbL, 0x97ffad0cL, 0xafb010b1L, 0xab710d06L, 0xa6322bdfL, 0xa2f33668L, 0xbcb4666dL, 0xb8757bdaL, 0xb5365d03L, 0xb1f740b4L }; /*-------------------------------------------------------------*/ /*--- end crctable.c ---*/ /*-------------------------------------------------------------*/ avfs-1.1.4/bzlib/blocksort.c0000644000175000001440000007377114032341001012644 00000000000000 /*-------------------------------------------------------------*/ /*--- Block sorting machinery ---*/ /*--- blocksort.c ---*/ /*-------------------------------------------------------------*/ /* ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.8 of 13 July 2019 Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ */ #include "bzlib_private.h" /*---------------------------------------------*/ /*--- Fallback O(N log(N)^2) sorting ---*/ /*--- algorithm, for repetitive blocks ---*/ /*---------------------------------------------*/ /*---------------------------------------------*/ static __inline__ void fallbackSimpleSort ( UInt32* fmap, UInt32* eclass, Int32 lo, Int32 hi ) { Int32 i, j, tmp; UInt32 ec_tmp; if (lo == hi) return; if (hi - lo > 3) { for ( i = hi-4; i >= lo; i-- ) { tmp = fmap[i]; ec_tmp = eclass[tmp]; for ( j = i+4; j <= hi && ec_tmp > eclass[fmap[j]]; j += 4 ) fmap[j-4] = fmap[j]; fmap[j-4] = tmp; } } for ( i = hi-1; i >= lo; i-- ) { tmp = fmap[i]; ec_tmp = eclass[tmp]; for ( j = i+1; j <= hi && ec_tmp > eclass[fmap[j]]; j++ ) fmap[j-1] = fmap[j]; fmap[j-1] = tmp; } } /*---------------------------------------------*/ #define fswap(zz1, zz2) \ { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; } #define fvswap(zzp1, zzp2, zzn) \ { \ Int32 yyp1 = (zzp1); \ Int32 yyp2 = (zzp2); \ Int32 yyn = (zzn); \ while (yyn > 0) { \ fswap(fmap[yyp1], fmap[yyp2]); \ yyp1++; yyp2++; yyn--; \ } \ } #define fmin(a,b) ((a) < (b)) ? (a) : (b) #define fpush(lz,hz) { stackLo[sp] = lz; \ stackHi[sp] = hz; \ sp++; } #define fpop(lz,hz) { sp--; \ lz = stackLo[sp]; \ hz = stackHi[sp]; } #define FALLBACK_QSORT_SMALL_THRESH 10 #define FALLBACK_QSORT_STACK_SIZE 100 static void fallbackQSort3 ( UInt32* fmap, UInt32* eclass, Int32 loSt, Int32 hiSt ) { Int32 unLo, unHi, ltLo, gtHi, n, m; Int32 sp, lo, hi; UInt32 med, r, r3; Int32 stackLo[FALLBACK_QSORT_STACK_SIZE]; Int32 stackHi[FALLBACK_QSORT_STACK_SIZE]; r = 0; sp = 0; fpush ( loSt, hiSt ); while (sp > 0) { AssertH ( sp < FALLBACK_QSORT_STACK_SIZE - 1, 1004 ); fpop ( lo, hi ); if (hi - lo < FALLBACK_QSORT_SMALL_THRESH) { fallbackSimpleSort ( fmap, eclass, lo, hi ); continue; } /* Random partitioning. Median of 3 sometimes fails to avoid bad cases. Median of 9 seems to help but looks rather expensive. This too seems to work but is cheaper. Guidance for the magic constants 7621 and 32768 is taken from Sedgewick's algorithms book, chapter 35. */ r = ((r * 7621) + 1) % 32768; r3 = r % 3; if (r3 == 0) med = eclass[fmap[lo]]; else if (r3 == 1) med = eclass[fmap[(lo+hi)>>1]]; else med = eclass[fmap[hi]]; unLo = ltLo = lo; unHi = gtHi = hi; while (1) { while (1) { if (unLo > unHi) break; n = (Int32)eclass[fmap[unLo]] - (Int32)med; if (n == 0) { fswap(fmap[unLo], fmap[ltLo]); ltLo++; unLo++; continue; }; if (n > 0) break; unLo++; } while (1) { if (unLo > unHi) break; n = (Int32)eclass[fmap[unHi]] - (Int32)med; if (n == 0) { fswap(fmap[unHi], fmap[gtHi]); gtHi--; unHi--; continue; }; if (n < 0) break; unHi--; } if (unLo > unHi) break; fswap(fmap[unLo], fmap[unHi]); unLo++; unHi--; } AssertD ( unHi == unLo-1, "fallbackQSort3(2)" ); if (gtHi < ltLo) continue; n = fmin(ltLo-lo, unLo-ltLo); fvswap(lo, unLo-n, n); m = fmin(hi-gtHi, gtHi-unHi); fvswap(unLo, hi-m+1, m); n = lo + unLo - ltLo - 1; m = hi - (gtHi - unHi) + 1; if (n - lo > hi - m) { fpush ( lo, n ); fpush ( m, hi ); } else { fpush ( m, hi ); fpush ( lo, n ); } } } #undef fmin #undef fpush #undef fpop #undef fswap #undef fvswap #undef FALLBACK_QSORT_SMALL_THRESH #undef FALLBACK_QSORT_STACK_SIZE /*---------------------------------------------*/ /* Pre: nblock > 0 eclass exists for [0 .. nblock-1] ((UChar*)eclass) [0 .. nblock-1] holds block ptr exists for [0 .. nblock-1] Post: ((UChar*)eclass) [0 .. nblock-1] holds block All other areas of eclass destroyed fmap [0 .. nblock-1] holds sorted order bhtab [ 0 .. 2+(nblock/32) ] destroyed */ #define SET_BH(zz) bhtab[(zz) >> 5] |= ((UInt32)1 << ((zz) & 31)) #define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~((UInt32)1 << ((zz) & 31)) #define ISSET_BH(zz) (bhtab[(zz) >> 5] & ((UInt32)1 << ((zz) & 31))) #define WORD_BH(zz) bhtab[(zz) >> 5] #define UNALIGNED_BH(zz) ((zz) & 0x01f) static void fallbackSort ( UInt32* fmap, UInt32* eclass, UInt32* bhtab, Int32 nblock, Int32 verb ) { Int32 ftab[257]; Int32 ftabCopy[256]; Int32 H, i, j, k, l, r, cc, cc1; Int32 nNotDone; Int32 nBhtab; UChar* eclass8 = (UChar*)eclass; /*-- Initial 1-char radix sort to generate initial fmap and initial BH bits. --*/ if (verb >= 4) VPrintf0 ( " bucket sorting ...\n" ); for (i = 0; i < 257; i++) ftab[i] = 0; for (i = 0; i < nblock; i++) ftab[eclass8[i]]++; for (i = 0; i < 256; i++) ftabCopy[i] = ftab[i]; for (i = 1; i < 257; i++) ftab[i] += ftab[i-1]; for (i = 0; i < nblock; i++) { j = eclass8[i]; k = ftab[j] - 1; ftab[j] = k; fmap[k] = i; } nBhtab = 2 + (nblock / 32); for (i = 0; i < nBhtab; i++) bhtab[i] = 0; for (i = 0; i < 256; i++) SET_BH(ftab[i]); /*-- Inductively refine the buckets. Kind-of an "exponential radix sort" (!), inspired by the Manber-Myers suffix array construction algorithm. --*/ /*-- set sentinel bits for block-end detection --*/ for (i = 0; i < 32; i++) { SET_BH(nblock + 2*i); CLEAR_BH(nblock + 2*i + 1); } /*-- the log(N) loop --*/ H = 1; while (1) { if (verb >= 4) VPrintf1 ( " depth %6d has ", H ); j = 0; for (i = 0; i < nblock; i++) { if (ISSET_BH(i)) j = i; k = fmap[i] - H; if (k < 0) k += nblock; eclass[k] = j; } nNotDone = 0; r = -1; while (1) { /*-- find the next non-singleton bucket --*/ k = r + 1; while (ISSET_BH(k) && UNALIGNED_BH(k)) k++; if (ISSET_BH(k)) { while (WORD_BH(k) == 0xffffffff) k += 32; while (ISSET_BH(k)) k++; } l = k - 1; if (l >= nblock) break; while (!ISSET_BH(k) && UNALIGNED_BH(k)) k++; if (!ISSET_BH(k)) { while (WORD_BH(k) == 0x00000000) k += 32; while (!ISSET_BH(k)) k++; } r = k - 1; if (r >= nblock) break; /*-- now [l, r] bracket current bucket --*/ if (r > l) { nNotDone += (r - l + 1); fallbackQSort3 ( fmap, eclass, l, r ); /*-- scan bucket and generate header bits-- */ cc = -1; for (i = l; i <= r; i++) { cc1 = eclass[fmap[i]]; if (cc != cc1) { SET_BH(i); cc = cc1; }; } } } if (verb >= 4) VPrintf1 ( "%6d unresolved strings\n", nNotDone ); H *= 2; if (H > nblock || nNotDone == 0) break; } /*-- Reconstruct the original block in eclass8 [0 .. nblock-1], since the previous phase destroyed it. --*/ if (verb >= 4) VPrintf0 ( " reconstructing block ...\n" ); j = 0; for (i = 0; i < nblock; i++) { while (ftabCopy[j] == 0) j++; ftabCopy[j]--; eclass8[fmap[i]] = (UChar)j; } AssertH ( j < 256, 1005 ); } #undef SET_BH #undef CLEAR_BH #undef ISSET_BH #undef WORD_BH #undef UNALIGNED_BH /*---------------------------------------------*/ /*--- The main, O(N^2 log(N)) sorting ---*/ /*--- algorithm. Faster for "normal" ---*/ /*--- non-repetitive blocks. ---*/ /*---------------------------------------------*/ /*---------------------------------------------*/ static __inline__ Bool mainGtU ( UInt32 i1, UInt32 i2, UChar* block, UInt16* quadrant, UInt32 nblock, Int32* budget ) { Int32 k; UChar c1, c2; UInt16 s1, s2; AssertD ( i1 != i2, "mainGtU" ); /* 1 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 2 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 3 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 4 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 5 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 6 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 7 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 8 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 9 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 10 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 11 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; /* 12 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); i1++; i2++; k = nblock + 8; do { /* 1 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); s1 = quadrant[i1]; s2 = quadrant[i2]; if (s1 != s2) return (s1 > s2); i1++; i2++; /* 2 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); s1 = quadrant[i1]; s2 = quadrant[i2]; if (s1 != s2) return (s1 > s2); i1++; i2++; /* 3 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); s1 = quadrant[i1]; s2 = quadrant[i2]; if (s1 != s2) return (s1 > s2); i1++; i2++; /* 4 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); s1 = quadrant[i1]; s2 = quadrant[i2]; if (s1 != s2) return (s1 > s2); i1++; i2++; /* 5 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); s1 = quadrant[i1]; s2 = quadrant[i2]; if (s1 != s2) return (s1 > s2); i1++; i2++; /* 6 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); s1 = quadrant[i1]; s2 = quadrant[i2]; if (s1 != s2) return (s1 > s2); i1++; i2++; /* 7 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); s1 = quadrant[i1]; s2 = quadrant[i2]; if (s1 != s2) return (s1 > s2); i1++; i2++; /* 8 */ c1 = block[i1]; c2 = block[i2]; if (c1 != c2) return (c1 > c2); s1 = quadrant[i1]; s2 = quadrant[i2]; if (s1 != s2) return (s1 > s2); i1++; i2++; if (i1 >= nblock) i1 -= nblock; if (i2 >= nblock) i2 -= nblock; k -= 8; (*budget)--; } while (k >= 0); return False; } /*---------------------------------------------*/ /*-- Knuth's increments seem to work better than Incerpi-Sedgewick here. Possibly because the number of elems to sort is usually small, typically <= 20. --*/ static Int32 incs[14] = { 1, 4, 13, 40, 121, 364, 1093, 3280, 9841, 29524, 88573, 265720, 797161, 2391484 }; static void mainSimpleSort ( UInt32* ptr, UChar* block, UInt16* quadrant, Int32 nblock, Int32 lo, Int32 hi, Int32 d, Int32* budget ) { Int32 i, j, h, bigN, hp; UInt32 v; bigN = hi - lo + 1; if (bigN < 2) return; hp = 0; while (incs[hp] < bigN) hp++; hp--; for (; hp >= 0; hp--) { h = incs[hp]; i = lo + h; while (True) { /*-- copy 1 --*/ if (i > hi) break; v = ptr[i]; j = i; while ( mainGtU ( ptr[j-h]+d, v+d, block, quadrant, nblock, budget ) ) { ptr[j] = ptr[j-h]; j = j - h; if (j <= (lo + h - 1)) break; } ptr[j] = v; i++; /*-- copy 2 --*/ if (i > hi) break; v = ptr[i]; j = i; while ( mainGtU ( ptr[j-h]+d, v+d, block, quadrant, nblock, budget ) ) { ptr[j] = ptr[j-h]; j = j - h; if (j <= (lo + h - 1)) break; } ptr[j] = v; i++; /*-- copy 3 --*/ if (i > hi) break; v = ptr[i]; j = i; while ( mainGtU ( ptr[j-h]+d, v+d, block, quadrant, nblock, budget ) ) { ptr[j] = ptr[j-h]; j = j - h; if (j <= (lo + h - 1)) break; } ptr[j] = v; i++; if (*budget < 0) return; } } } /*---------------------------------------------*/ /*-- The following is an implementation of an elegant 3-way quicksort for strings, described in a paper "Fast Algorithms for Sorting and Searching Strings", by Robert Sedgewick and Jon L. Bentley. --*/ #define mswap(zz1, zz2) \ { Int32 zztmp = zz1; zz1 = zz2; zz2 = zztmp; } #define mvswap(zzp1, zzp2, zzn) \ { \ Int32 yyp1 = (zzp1); \ Int32 yyp2 = (zzp2); \ Int32 yyn = (zzn); \ while (yyn > 0) { \ mswap(ptr[yyp1], ptr[yyp2]); \ yyp1++; yyp2++; yyn--; \ } \ } static __inline__ UChar mmed3 ( UChar a, UChar b, UChar c ) { UChar t; if (a > b) { t = a; a = b; b = t; }; if (b > c) { b = c; if (a > b) b = a; } return b; } #define mmin(a,b) ((a) < (b)) ? (a) : (b) #define mpush(lz,hz,dz) { stackLo[sp] = lz; \ stackHi[sp] = hz; \ stackD [sp] = dz; \ sp++; } #define mpop(lz,hz,dz) { sp--; \ lz = stackLo[sp]; \ hz = stackHi[sp]; \ dz = stackD [sp]; } #define mnextsize(az) (nextHi[az]-nextLo[az]) #define mnextswap(az,bz) \ { Int32 tz; \ tz = nextLo[az]; nextLo[az] = nextLo[bz]; nextLo[bz] = tz; \ tz = nextHi[az]; nextHi[az] = nextHi[bz]; nextHi[bz] = tz; \ tz = nextD [az]; nextD [az] = nextD [bz]; nextD [bz] = tz; } #define MAIN_QSORT_SMALL_THRESH 20 #define MAIN_QSORT_DEPTH_THRESH (BZ_N_RADIX + BZ_N_QSORT) #define MAIN_QSORT_STACK_SIZE 100 static void mainQSort3 ( UInt32* ptr, UChar* block, UInt16* quadrant, Int32 nblock, Int32 loSt, Int32 hiSt, Int32 dSt, Int32* budget ) { Int32 unLo, unHi, ltLo, gtHi, n, m, med; Int32 sp, lo, hi, d; Int32 stackLo[MAIN_QSORT_STACK_SIZE]; Int32 stackHi[MAIN_QSORT_STACK_SIZE]; Int32 stackD [MAIN_QSORT_STACK_SIZE]; Int32 nextLo[3]; Int32 nextHi[3]; Int32 nextD [3]; sp = 0; mpush ( loSt, hiSt, dSt ); while (sp > 0) { AssertH ( sp < MAIN_QSORT_STACK_SIZE - 2, 1001 ); mpop ( lo, hi, d ); if (hi - lo < MAIN_QSORT_SMALL_THRESH || d > MAIN_QSORT_DEPTH_THRESH) { mainSimpleSort ( ptr, block, quadrant, nblock, lo, hi, d, budget ); if (*budget < 0) return; continue; } med = (Int32) mmed3 ( block[ptr[ lo ]+d], block[ptr[ hi ]+d], block[ptr[ (lo+hi)>>1 ]+d] ); unLo = ltLo = lo; unHi = gtHi = hi; while (True) { while (True) { if (unLo > unHi) break; n = ((Int32)block[ptr[unLo]+d]) - med; if (n == 0) { mswap(ptr[unLo], ptr[ltLo]); ltLo++; unLo++; continue; }; if (n > 0) break; unLo++; } while (True) { if (unLo > unHi) break; n = ((Int32)block[ptr[unHi]+d]) - med; if (n == 0) { mswap(ptr[unHi], ptr[gtHi]); gtHi--; unHi--; continue; }; if (n < 0) break; unHi--; } if (unLo > unHi) break; mswap(ptr[unLo], ptr[unHi]); unLo++; unHi--; } AssertD ( unHi == unLo-1, "mainQSort3(2)" ); if (gtHi < ltLo) { mpush(lo, hi, d+1 ); continue; } n = mmin(ltLo-lo, unLo-ltLo); mvswap(lo, unLo-n, n); m = mmin(hi-gtHi, gtHi-unHi); mvswap(unLo, hi-m+1, m); n = lo + unLo - ltLo - 1; m = hi - (gtHi - unHi) + 1; nextLo[0] = lo; nextHi[0] = n; nextD[0] = d; nextLo[1] = m; nextHi[1] = hi; nextD[1] = d; nextLo[2] = n+1; nextHi[2] = m-1; nextD[2] = d+1; if (mnextsize(0) < mnextsize(1)) mnextswap(0,1); if (mnextsize(1) < mnextsize(2)) mnextswap(1,2); if (mnextsize(0) < mnextsize(1)) mnextswap(0,1); AssertD (mnextsize(0) >= mnextsize(1), "mainQSort3(8)" ); AssertD (mnextsize(1) >= mnextsize(2), "mainQSort3(9)" ); mpush (nextLo[0], nextHi[0], nextD[0]); mpush (nextLo[1], nextHi[1], nextD[1]); mpush (nextLo[2], nextHi[2], nextD[2]); } } #undef mswap #undef mvswap #undef mpush #undef mpop #undef mmin #undef mnextsize #undef mnextswap #undef MAIN_QSORT_SMALL_THRESH #undef MAIN_QSORT_DEPTH_THRESH #undef MAIN_QSORT_STACK_SIZE /*---------------------------------------------*/ /* Pre: nblock > N_OVERSHOOT block32 exists for [0 .. nblock-1 +N_OVERSHOOT] ((UChar*)block32) [0 .. nblock-1] holds block ptr exists for [0 .. nblock-1] Post: ((UChar*)block32) [0 .. nblock-1] holds block All other areas of block32 destroyed ftab [0 .. 65536 ] destroyed ptr [0 .. nblock-1] holds sorted order if (*budget < 0), sorting was abandoned */ #define BIGFREQ(b) (ftab[((b)+1) << 8] - ftab[(b) << 8]) #define SETMASK (1 << 21) #define CLEARMASK (~(SETMASK)) static void mainSort ( UInt32* ptr, UChar* block, UInt16* quadrant, UInt32* ftab, Int32 nblock, Int32 verb, Int32* budget ) { Int32 i, j, k, ss, sb; Int32 runningOrder[256]; Bool bigDone[256]; Int32 copyStart[256]; Int32 copyEnd [256]; UChar c1; Int32 numQSorted; UInt16 s; if (verb >= 4) VPrintf0 ( " main sort initialise ...\n" ); /*-- set up the 2-byte frequency table --*/ for (i = 65536; i >= 0; i--) ftab[i] = 0; j = block[0] << 8; i = nblock-1; for (; i >= 3; i -= 4) { quadrant[i] = 0; j = (j >> 8) | ( ((UInt16)block[i]) << 8); ftab[j]++; quadrant[i-1] = 0; j = (j >> 8) | ( ((UInt16)block[i-1]) << 8); ftab[j]++; quadrant[i-2] = 0; j = (j >> 8) | ( ((UInt16)block[i-2]) << 8); ftab[j]++; quadrant[i-3] = 0; j = (j >> 8) | ( ((UInt16)block[i-3]) << 8); ftab[j]++; } for (; i >= 0; i--) { quadrant[i] = 0; j = (j >> 8) | ( ((UInt16)block[i]) << 8); ftab[j]++; } /*-- (emphasises close relationship of block & quadrant) --*/ for (i = 0; i < BZ_N_OVERSHOOT; i++) { block [nblock+i] = block[i]; quadrant[nblock+i] = 0; } if (verb >= 4) VPrintf0 ( " bucket sorting ...\n" ); /*-- Complete the initial radix sort --*/ for (i = 1; i <= 65536; i++) ftab[i] += ftab[i-1]; s = block[0] << 8; i = nblock-1; for (; i >= 3; i -= 4) { s = (s >> 8) | (block[i] << 8); j = ftab[s] -1; ftab[s] = j; ptr[j] = i; s = (s >> 8) | (block[i-1] << 8); j = ftab[s] -1; ftab[s] = j; ptr[j] = i-1; s = (s >> 8) | (block[i-2] << 8); j = ftab[s] -1; ftab[s] = j; ptr[j] = i-2; s = (s >> 8) | (block[i-3] << 8); j = ftab[s] -1; ftab[s] = j; ptr[j] = i-3; } for (; i >= 0; i--) { s = (s >> 8) | (block[i] << 8); j = ftab[s] -1; ftab[s] = j; ptr[j] = i; } /*-- Now ftab contains the first loc of every small bucket. Calculate the running order, from smallest to largest big bucket. --*/ for (i = 0; i <= 255; i++) { bigDone [i] = False; runningOrder[i] = i; } { Int32 vv; Int32 h = 1; do h = 3 * h + 1; while (h <= 256); do { h = h / 3; for (i = h; i <= 255; i++) { vv = runningOrder[i]; j = i; while ( BIGFREQ(runningOrder[j-h]) > BIGFREQ(vv) ) { runningOrder[j] = runningOrder[j-h]; j = j - h; if (j <= (h - 1)) goto zero; } zero: runningOrder[j] = vv; } } while (h != 1); } /*-- The main sorting loop. --*/ numQSorted = 0; for (i = 0; i <= 255; i++) { /*-- Process big buckets, starting with the least full. Basically this is a 3-step process in which we call mainQSort3 to sort the small buckets [ss, j], but also make a big effort to avoid the calls if we can. --*/ ss = runningOrder[i]; /*-- Step 1: Complete the big bucket [ss] by quicksorting any unsorted small buckets [ss, j], for j != ss. Hopefully previous pointer-scanning phases have already completed many of the small buckets [ss, j], so we don't have to sort them at all. --*/ for (j = 0; j <= 255; j++) { if (j != ss) { sb = (ss << 8) + j; if ( ! (ftab[sb] & SETMASK) ) { Int32 lo = ftab[sb] & CLEARMASK; Int32 hi = (ftab[sb+1] & CLEARMASK) - 1; if (hi > lo) { if (verb >= 4) VPrintf4 ( " qsort [0x%x, 0x%x] " "done %d this %d\n", ss, j, numQSorted, hi - lo + 1 ); mainQSort3 ( ptr, block, quadrant, nblock, lo, hi, BZ_N_RADIX, budget ); numQSorted += (hi - lo + 1); if (*budget < 0) return; } } ftab[sb] |= SETMASK; } } AssertH ( !bigDone[ss], 1006 ); /*-- Step 2: Now scan this big bucket [ss] so as to synthesise the sorted order for small buckets [t, ss] for all t, including, magically, the bucket [ss,ss] too. This will avoid doing Real Work in subsequent Step 1's. --*/ { for (j = 0; j <= 255; j++) { copyStart[j] = ftab[(j << 8) + ss] & CLEARMASK; copyEnd [j] = (ftab[(j << 8) + ss + 1] & CLEARMASK) - 1; } for (j = ftab[ss << 8] & CLEARMASK; j < copyStart[ss]; j++) { k = ptr[j]-1; if (k < 0) k += nblock; c1 = block[k]; if (!bigDone[c1]) ptr[ copyStart[c1]++ ] = k; } for (j = (ftab[(ss+1) << 8] & CLEARMASK) - 1; j > copyEnd[ss]; j--) { k = ptr[j]-1; if (k < 0) k += nblock; c1 = block[k]; if (!bigDone[c1]) ptr[ copyEnd[c1]-- ] = k; } } AssertH ( (copyStart[ss]-1 == copyEnd[ss]) || /* Extremely rare case missing in bzip2-1.0.0 and 1.0.1. Necessity for this case is demonstrated by compressing a sequence of approximately 48.5 million of character 251; 1.0.0/1.0.1 will then die here. */ (copyStart[ss] == 0 && copyEnd[ss] == nblock-1), 1007 ) for (j = 0; j <= 255; j++) ftab[(j << 8) + ss] |= SETMASK; /*-- Step 3: The [ss] big bucket is now done. Record this fact, and update the quadrant descriptors. Remember to update quadrants in the overshoot area too, if necessary. The "if (i < 255)" test merely skips this updating for the last bucket processed, since updating for the last bucket is pointless. The quadrant array provides a way to incrementally cache sort orderings, as they appear, so as to make subsequent comparisons in fullGtU() complete faster. For repetitive blocks this makes a big difference (but not big enough to be able to avoid the fallback sorting mechanism, exponential radix sort). The precise meaning is: at all times: for 0 <= i < nblock and 0 <= j <= nblock if block[i] != block[j], then the relative values of quadrant[i] and quadrant[j] are meaningless. else { if quadrant[i] < quadrant[j] then the string starting at i lexicographically precedes the string starting at j else if quadrant[i] > quadrant[j] then the string starting at j lexicographically precedes the string starting at i else the relative ordering of the strings starting at i and j has not yet been determined. } --*/ bigDone[ss] = True; if (i < 255) { Int32 bbStart = ftab[ss << 8] & CLEARMASK; Int32 bbSize = (ftab[(ss+1) << 8] & CLEARMASK) - bbStart; Int32 shifts = 0; while ((bbSize >> shifts) > 65534) shifts++; for (j = bbSize-1; j >= 0; j--) { Int32 a2update = ptr[bbStart + j]; UInt16 qVal = (UInt16)(j >> shifts); quadrant[a2update] = qVal; if (a2update < BZ_N_OVERSHOOT) quadrant[a2update + nblock] = qVal; } AssertH ( ((bbSize-1) >> shifts) <= 65535, 1002 ); } } if (verb >= 4) VPrintf3 ( " %d pointers, %d sorted, %d scanned\n", nblock, numQSorted, nblock - numQSorted ); } #undef BIGFREQ #undef SETMASK #undef CLEARMASK /*---------------------------------------------*/ /* Pre: nblock > 0 arr2 exists for [0 .. nblock-1 +N_OVERSHOOT] ((UChar*)arr2) [0 .. nblock-1] holds block arr1 exists for [0 .. nblock-1] Post: ((UChar*)arr2) [0 .. nblock-1] holds block All other areas of block destroyed ftab [ 0 .. 65536 ] destroyed arr1 [0 .. nblock-1] holds sorted order */ void BZ2_blockSort ( EState* s ) { UInt32* ptr = s->ptr; UChar* block = s->block; UInt32* ftab = s->ftab; Int32 nblock = s->nblock; Int32 verb = s->verbosity; Int32 wfact = s->workFactor; UInt16* quadrant; Int32 budget; Int32 budgetInit; Int32 i; if (nblock < 10000) { fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb ); } else { /* Calculate the location for quadrant, remembering to get the alignment right. Assumes that &(block[0]) is at least 2-byte aligned -- this should be ok since block is really the first section of arr2. */ i = nblock+BZ_N_OVERSHOOT; if (i & 1) i++; quadrant = (UInt16*)(&(block[i])); /* (wfact-1) / 3 puts the default-factor-30 transition point at very roughly the same place as with v0.1 and v0.9.0. Not that it particularly matters any more, since the resulting compressed stream is now the same regardless of whether or not we use the main sort or fallback sort. */ if (wfact < 1 ) wfact = 1; if (wfact > 100) wfact = 100; budgetInit = nblock * ((wfact-1) / 3); budget = budgetInit; mainSort ( ptr, block, quadrant, ftab, nblock, verb, &budget ); if (verb >= 3) VPrintf3 ( " %d work, %d block, ratio %5.2f\n", budgetInit - budget, nblock, (float)(budgetInit - budget) / (float)(nblock==0 ? 1 : nblock) ); if (budget < 0) { if (verb >= 2) VPrintf0 ( " too repetitive; using fallback" " sorting algorithm\n" ); fallbackSort ( s->arr1, s->arr2, ftab, nblock, verb ); } } s->origPtr = -1; for (i = 0; i < s->nblock; i++) if (ptr[i] == 0) { s->origPtr = i; break; }; AssertH( s->origPtr != -1, 1003 ); } /*-------------------------------------------------------------*/ /*--- end blocksort.c ---*/ /*-------------------------------------------------------------*/ avfs-1.1.4/bzlib/randtable.c0000644000175000001440000000741714032341001012570 00000000000000 /*-------------------------------------------------------------*/ /*--- Table for randomising repetitive blocks ---*/ /*--- randtable.c ---*/ /*-------------------------------------------------------------*/ /* ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.8 of 13 July 2019 Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ */ #include "bzlib_private.h" /*---------------------------------------------*/ Int32 BZ2_rNums[512] = { 619, 720, 127, 481, 931, 816, 813, 233, 566, 247, 985, 724, 205, 454, 863, 491, 741, 242, 949, 214, 733, 859, 335, 708, 621, 574, 73, 654, 730, 472, 419, 436, 278, 496, 867, 210, 399, 680, 480, 51, 878, 465, 811, 169, 869, 675, 611, 697, 867, 561, 862, 687, 507, 283, 482, 129, 807, 591, 733, 623, 150, 238, 59, 379, 684, 877, 625, 169, 643, 105, 170, 607, 520, 932, 727, 476, 693, 425, 174, 647, 73, 122, 335, 530, 442, 853, 695, 249, 445, 515, 909, 545, 703, 919, 874, 474, 882, 500, 594, 612, 641, 801, 220, 162, 819, 984, 589, 513, 495, 799, 161, 604, 958, 533, 221, 400, 386, 867, 600, 782, 382, 596, 414, 171, 516, 375, 682, 485, 911, 276, 98, 553, 163, 354, 666, 933, 424, 341, 533, 870, 227, 730, 475, 186, 263, 647, 537, 686, 600, 224, 469, 68, 770, 919, 190, 373, 294, 822, 808, 206, 184, 943, 795, 384, 383, 461, 404, 758, 839, 887, 715, 67, 618, 276, 204, 918, 873, 777, 604, 560, 951, 160, 578, 722, 79, 804, 96, 409, 713, 940, 652, 934, 970, 447, 318, 353, 859, 672, 112, 785, 645, 863, 803, 350, 139, 93, 354, 99, 820, 908, 609, 772, 154, 274, 580, 184, 79, 626, 630, 742, 653, 282, 762, 623, 680, 81, 927, 626, 789, 125, 411, 521, 938, 300, 821, 78, 343, 175, 128, 250, 170, 774, 972, 275, 999, 639, 495, 78, 352, 126, 857, 956, 358, 619, 580, 124, 737, 594, 701, 612, 669, 112, 134, 694, 363, 992, 809, 743, 168, 974, 944, 375, 748, 52, 600, 747, 642, 182, 862, 81, 344, 805, 988, 739, 511, 655, 814, 334, 249, 515, 897, 955, 664, 981, 649, 113, 974, 459, 893, 228, 433, 837, 553, 268, 926, 240, 102, 654, 459, 51, 686, 754, 806, 760, 493, 403, 415, 394, 687, 700, 946, 670, 656, 610, 738, 392, 760, 799, 887, 653, 978, 321, 576, 617, 626, 502, 894, 679, 243, 440, 680, 879, 194, 572, 640, 724, 926, 56, 204, 700, 707, 151, 457, 449, 797, 195, 791, 558, 945, 679, 297, 59, 87, 824, 713, 663, 412, 693, 342, 606, 134, 108, 571, 364, 631, 212, 174, 643, 304, 329, 343, 97, 430, 751, 497, 314, 983, 374, 822, 928, 140, 206, 73, 263, 980, 736, 876, 478, 430, 305, 170, 514, 364, 692, 829, 82, 855, 953, 676, 246, 369, 970, 294, 750, 807, 827, 150, 790, 288, 923, 804, 378, 215, 828, 592, 281, 565, 555, 710, 82, 896, 831, 547, 261, 524, 462, 293, 465, 502, 56, 661, 821, 976, 991, 658, 869, 905, 758, 745, 193, 768, 550, 608, 933, 378, 286, 215, 979, 792, 961, 61, 688, 793, 644, 986, 403, 106, 366, 905, 644, 372, 567, 466, 434, 645, 210, 389, 550, 919, 135, 780, 773, 635, 389, 707, 100, 626, 958, 165, 504, 920, 176, 193, 713, 857, 265, 203, 50, 668, 108, 645, 990, 626, 197, 510, 357, 358, 850, 858, 364, 936, 638 }; /*-------------------------------------------------------------*/ /*--- end randtable.c ---*/ /*-------------------------------------------------------------*/ avfs-1.1.4/bzlib/bzconf.h0000644000175000001440000000735214032341001012120 00000000000000/* IMPORTANT NOTE: This is not the original bzip2 distribution. This file is copyright (C) 2005 Ralf Hoffmann (ralf@boomerangsworld.de) The modified software can be distributed under the same licence as the original software (see bellow). */ /*-------------------------------------------------------------*/ /*--- Library top-level functions. ---*/ /*--- bzlib.c ---*/ /*-------------------------------------------------------------*/ /*-- This file is a part of bzip2 and/or libbzip2, a program and library for lossless, block-sorting data compression. Copyright (C) 1996-2000 Julian R Seward. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. 3. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. 4. The name of the author may not be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. Julian Seward, Cambridge, UK. jseward@acm.org bzip2/libbzip2 version 1.0 of 21 March 2000 This program is based on (at least) the work of: Mike Burrows David Wheeler Peter Fenwick Alistair Moffat Radford Neal Ian H. Witten Robert Sedgewick Jon L. Bentley For more information on these sources, see the manual. --*/ #ifndef BZCONF_H #define BZCONF_H #define BZ_PREFIX 1 #ifdef BZ_PREFIX # define BZ2_blockSort ABZ_BZ2_blockSort # define BZ2_hbAssignCodes ABZ_BZ2_hbAssignCodes # define BZ2_hbCreateDecodeTables ABZ_BZ2_hbCreateDecodeTables # define BZ2_hbMakeCodeLengths ABZ_BZ2_hbMakeCodeLengths # define BZ2_bsInitWrite ABZ_BZ2_bsInitWrite # define BZ2_compressBlock ABZ_BZ2_compressBlock # define BZ2_decompress ABZ_BZ2_decompress # define BZ2_bzBuffToBuffCompress ABZ_BZ2_bzBuffToBuffCompress # define BZ2_bzBuffToBuffDecompress ABZ_BZ2_bzBuffToBuffDecompress # define BZ2_bzCompress ABZ_BZ2_bzCompress # define BZ2_bzCompressEnd ABZ_BZ2_bzCompressEnd # define BZ2_bzCompressInit ABZ_BZ2_bzCompressInit # define BZ2_bzDecompress ABZ_BZ2_bzDecompress # define BZ2_bzDecompressEnd ABZ_BZ2_bzDecompressEnd # define BZ2_bzDecompressInit ABZ_BZ2_bzDecompressInit # define BZ2_bzRestoreBlockEnd ABZ_BZ2_bzRestoreBlockEnd # define BZ2_bzSetBlockEndHandler ABZ_BZ2_bzSetBlockEndHandler # define BZ2_bzlibVersion ABZ_BZ2_bzlibVersion # define BZ2_indexIntoF ABZ_BZ2_indexIntoF # define BZ2_crc32Table ABZ_BZ2_crc32Table # define BZ2_rNums ABZ_BZ2_rNums #endif #endif avfs-1.1.4/bzlib/bzlib.c0000644000175000001440000013422614032341001011735 00000000000000/* IMPORTANT NOTE: This is not the original bzip2 distribution. The modifications are copyright (C) 2001 Miklos Szeredi The modified software can be distributed under the same licence as the original software (see bellow). */ /*-------------------------------------------------------------*/ /*--- Library top-level functions. ---*/ /*--- bzlib.c ---*/ /*-------------------------------------------------------------*/ /* ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.8 of 13 July 2019 Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ */ /* CHANGES 0.9.0 -- original version. 0.9.0a/b -- no changes in this file. 0.9.0c -- made zero-length BZ_FLUSH work correctly in bzCompress(). fixed bzWrite/bzRead to ignore zero-length requests. fixed bzread to correctly handle read requests after EOF. wrong parameter order in call to bzDecompressInit in bzBuffToBuffDecompress. Fixed. */ #include "bzlib_private.h" /*---------------------------------------------------*/ /*--- Compression stuff ---*/ /*---------------------------------------------------*/ /*---------------------------------------------------*/ #ifndef BZ_NO_STDIO void BZ2_bz__AssertH__fail ( int errcode ) { fprintf(stderr, "\n\nbzip2/libbzip2: internal error number %d.\n" "This is a bug in bzip2/libbzip2, %s.\n" "Please report it to: bzip2-devel@sourceware.org. If this happened\n" "when you were using some program which uses libbzip2 as a\n" "component, you should also report this bug to the author(s)\n" "of that program. Please make an effort to report this bug;\n" "timely and accurate bug reports eventually lead to higher\n" "quality software. Thanks.\n\n", errcode, BZ2_bzlibVersion() ); if (errcode == 1007) { fprintf(stderr, "\n*** A special note about internal error number 1007 ***\n" "\n" "Experience suggests that a common cause of i.e. 1007\n" "is unreliable memory or other hardware. The 1007 assertion\n" "just happens to cross-check the results of huge numbers of\n" "memory reads/writes, and so acts (unintendedly) as a stress\n" "test of your memory system.\n" "\n" "I suggest the following: try compressing the file again,\n" "possibly monitoring progress in detail with the -vv flag.\n" "\n" "* If the error cannot be reproduced, and/or happens at different\n" " points in compression, you may have a flaky memory system.\n" " Try a memory-test program. I have used Memtest86\n" " (www.memtest86.com). At the time of writing it is free (GPLd).\n" " Memtest86 tests memory much more thorougly than your BIOSs\n" " power-on test, and may find failures that the BIOS doesn't.\n" "\n" "* If the error can be repeatably reproduced, this is a bug in\n" " bzip2, and I would very much like to hear about it. Please\n" " let me know, and, ideally, save a copy of the file causing the\n" " problem -- without which I will be unable to investigate it.\n" "\n" ); } exit(3); } #endif /*---------------------------------------------------*/ static int bz_config_ok ( void ) { if (sizeof(int) != 4) return 0; if (sizeof(short) != 2) return 0; if (sizeof(char) != 1) return 0; return 1; } /*---------------------------------------------------*/ static void* default_bzalloc ( void* opaque, Int32 items, Int32 size ) { void* v = malloc ( items * size ); return v; } static void default_bzfree ( void* opaque, void* addr ) { if (addr != NULL) free ( addr ); } /*---------------------------------------------------*/ static void prepare_new_block ( EState* s ) { Int32 i; s->nblock = 0; s->numZ = 0; s->state_out_pos = 0; BZ_INITIALISE_CRC ( s->blockCRC ); for (i = 0; i < 256; i++) s->inUse[i] = False; s->blockNo++; } /*---------------------------------------------------*/ static void init_RL ( EState* s ) { s->state_in_ch = 256; s->state_in_len = 0; } static Bool isempty_RL ( EState* s ) { if (s->state_in_ch < 256 && s->state_in_len > 0) return False; else return True; } /*---------------------------------------------------*/ int BZ_API(BZ2_bzCompressInit) ( bz_stream* strm, int blockSize100k, int verbosity, int workFactor ) { Int32 n; EState* s; if (!bz_config_ok()) return BZ_CONFIG_ERROR; if (strm == NULL || blockSize100k < 1 || blockSize100k > 9 || workFactor < 0 || workFactor > 250) return BZ_PARAM_ERROR; if (workFactor == 0) workFactor = 30; if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc; if (strm->bzfree == NULL) strm->bzfree = default_bzfree; s = BZALLOC( sizeof(EState) ); if (s == NULL) return BZ_MEM_ERROR; s->strm = strm; s->arr1 = NULL; s->arr2 = NULL; s->ftab = NULL; n = 100000 * blockSize100k; s->arr1 = BZALLOC( n * sizeof(UInt32) ); s->arr2 = BZALLOC( (n+BZ_N_OVERSHOOT) * sizeof(UInt32) ); s->ftab = BZALLOC( 65537 * sizeof(UInt32) ); if (s->arr1 == NULL || s->arr2 == NULL || s->ftab == NULL) { if (s->arr1 != NULL) BZFREE(s->arr1); if (s->arr2 != NULL) BZFREE(s->arr2); if (s->ftab != NULL) BZFREE(s->ftab); if (s != NULL) BZFREE(s); return BZ_MEM_ERROR; } s->blockNo = 0; s->state = BZ_S_INPUT; s->mode = BZ_M_RUNNING; s->combinedCRC = 0; s->blockSize100k = blockSize100k; s->nblockMAX = 100000 * blockSize100k - 19; s->verbosity = verbosity; s->workFactor = workFactor; s->block = (UChar*)s->arr2; s->mtfv = (UInt16*)s->arr1; s->zbits = NULL; s->ptr = (UInt32*)s->arr1; strm->state = s; strm->total_in_lo32 = 0; strm->total_in_hi32 = 0; strm->total_out_lo32 = 0; strm->total_out_hi32 = 0; init_RL ( s ); prepare_new_block ( s ); return BZ_OK; } /*---------------------------------------------------*/ static void add_pair_to_block ( EState* s ) { Int32 i; UChar ch = (UChar)(s->state_in_ch); for (i = 0; i < s->state_in_len; i++) { BZ_UPDATE_CRC( s->blockCRC, ch ); } s->inUse[s->state_in_ch] = True; switch (s->state_in_len) { case 1: s->block[s->nblock] = (UChar)ch; s->nblock++; break; case 2: s->block[s->nblock] = (UChar)ch; s->nblock++; s->block[s->nblock] = (UChar)ch; s->nblock++; break; case 3: s->block[s->nblock] = (UChar)ch; s->nblock++; s->block[s->nblock] = (UChar)ch; s->nblock++; s->block[s->nblock] = (UChar)ch; s->nblock++; break; default: s->inUse[s->state_in_len-4] = True; s->block[s->nblock] = (UChar)ch; s->nblock++; s->block[s->nblock] = (UChar)ch; s->nblock++; s->block[s->nblock] = (UChar)ch; s->nblock++; s->block[s->nblock] = (UChar)ch; s->nblock++; s->block[s->nblock] = ((UChar)(s->state_in_len-4)); s->nblock++; break; } } /*---------------------------------------------------*/ static void flush_RL ( EState* s ) { if (s->state_in_ch < 256) add_pair_to_block ( s ); init_RL ( s ); } /*---------------------------------------------------*/ #define ADD_CHAR_TO_BLOCK(zs,zchh0) \ { \ UInt32 zchh = (UInt32)(zchh0); \ /*-- fast track the common case --*/ \ if (zchh != zs->state_in_ch && \ zs->state_in_len == 1) { \ UChar ch = (UChar)(zs->state_in_ch); \ BZ_UPDATE_CRC( zs->blockCRC, ch ); \ zs->inUse[zs->state_in_ch] = True; \ zs->block[zs->nblock] = (UChar)ch; \ zs->nblock++; \ zs->state_in_ch = zchh; \ } \ else \ /*-- general, uncommon cases --*/ \ if (zchh != zs->state_in_ch || \ zs->state_in_len == 255) { \ if (zs->state_in_ch < 256) \ add_pair_to_block ( zs ); \ zs->state_in_ch = zchh; \ zs->state_in_len = 1; \ } else { \ zs->state_in_len++; \ } \ } /*---------------------------------------------------*/ static Bool copy_input_until_stop ( EState* s ) { Bool progress_in = False; if (s->mode == BZ_M_RUNNING) { /*-- fast track the common case --*/ while (True) { /*-- block full? --*/ if (s->nblock >= s->nblockMAX) break; /*-- no input? --*/ if (s->strm->avail_in == 0) break; progress_in = True; ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); s->strm->next_in++; s->strm->avail_in--; s->strm->total_in_lo32++; if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++; } } else { /*-- general, uncommon case --*/ while (True) { /*-- block full? --*/ if (s->nblock >= s->nblockMAX) break; /*-- no input? --*/ if (s->strm->avail_in == 0) break; /*-- flush/finish end? --*/ if (s->avail_in_expect == 0) break; progress_in = True; ADD_CHAR_TO_BLOCK ( s, (UInt32)(*((UChar*)(s->strm->next_in))) ); s->strm->next_in++; s->strm->avail_in--; s->strm->total_in_lo32++; if (s->strm->total_in_lo32 == 0) s->strm->total_in_hi32++; s->avail_in_expect--; } } return progress_in; } /*---------------------------------------------------*/ static Bool copy_output_until_stop ( EState* s ) { Bool progress_out = False; while (True) { /*-- no output space? --*/ if (s->strm->avail_out == 0) break; /*-- block done? --*/ if (s->state_out_pos >= s->numZ) break; progress_out = True; *(s->strm->next_out) = s->zbits[s->state_out_pos]; s->state_out_pos++; s->strm->avail_out--; s->strm->next_out++; s->strm->total_out_lo32++; if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; } return progress_out; } /*---------------------------------------------------*/ static Bool handle_compress ( bz_stream* strm ) { Bool progress_in = False; Bool progress_out = False; EState* s = strm->state; while (True) { if (s->state == BZ_S_OUTPUT) { progress_out |= copy_output_until_stop ( s ); if (s->state_out_pos < s->numZ) break; if (s->mode == BZ_M_FINISHING && s->avail_in_expect == 0 && isempty_RL(s)) break; prepare_new_block ( s ); s->state = BZ_S_INPUT; if (s->mode == BZ_M_FLUSHING && s->avail_in_expect == 0 && isempty_RL(s)) break; } if (s->state == BZ_S_INPUT) { progress_in |= copy_input_until_stop ( s ); if (s->mode != BZ_M_RUNNING && s->avail_in_expect == 0) { flush_RL ( s ); BZ2_compressBlock ( s, (Bool)(s->mode == BZ_M_FINISHING) ); s->state = BZ_S_OUTPUT; } else if (s->nblock >= s->nblockMAX) { BZ2_compressBlock ( s, False ); s->state = BZ_S_OUTPUT; } else if (s->strm->avail_in == 0) { break; } } } return progress_in || progress_out; } /*---------------------------------------------------*/ int BZ_API(BZ2_bzCompress) ( bz_stream *strm, int action ) { Bool progress; EState* s; if (strm == NULL) return BZ_PARAM_ERROR; s = strm->state; if (s == NULL) return BZ_PARAM_ERROR; if (s->strm != strm) return BZ_PARAM_ERROR; preswitch: switch (s->mode) { case BZ_M_IDLE: return BZ_SEQUENCE_ERROR; case BZ_M_RUNNING: if (action == BZ_RUN) { progress = handle_compress ( strm ); return progress ? BZ_RUN_OK : BZ_PARAM_ERROR; } else if (action == BZ_FLUSH) { s->avail_in_expect = strm->avail_in; s->mode = BZ_M_FLUSHING; goto preswitch; } else if (action == BZ_FINISH) { s->avail_in_expect = strm->avail_in; s->mode = BZ_M_FINISHING; goto preswitch; } else return BZ_PARAM_ERROR; case BZ_M_FLUSHING: if (action != BZ_FLUSH) return BZ_SEQUENCE_ERROR; if (s->avail_in_expect != s->strm->avail_in) return BZ_SEQUENCE_ERROR; progress = handle_compress ( strm ); if (s->avail_in_expect > 0 || !isempty_RL(s) || s->state_out_pos < s->numZ) return BZ_FLUSH_OK; s->mode = BZ_M_RUNNING; return BZ_RUN_OK; case BZ_M_FINISHING: if (action != BZ_FINISH) return BZ_SEQUENCE_ERROR; if (s->avail_in_expect != s->strm->avail_in) return BZ_SEQUENCE_ERROR; progress = handle_compress ( strm ); if (!progress) return BZ_SEQUENCE_ERROR; if (s->avail_in_expect > 0 || !isempty_RL(s) || s->state_out_pos < s->numZ) return BZ_FINISH_OK; s->mode = BZ_M_IDLE; return BZ_STREAM_END; } return BZ_OK; /*--not reached--*/ } /*---------------------------------------------------*/ int BZ_API(BZ2_bzCompressEnd) ( bz_stream *strm ) { EState* s; if (strm == NULL) return BZ_PARAM_ERROR; s = strm->state; if (s == NULL) return BZ_PARAM_ERROR; if (s->strm != strm) return BZ_PARAM_ERROR; if (s->arr1 != NULL) BZFREE(s->arr1); if (s->arr2 != NULL) BZFREE(s->arr2); if (s->ftab != NULL) BZFREE(s->ftab); BZFREE(strm->state); strm->state = NULL; return BZ_OK; } /*---------------------------------------------------*/ /*--- Decompression stuff ---*/ /*---------------------------------------------------*/ /*---------------------------------------------------*/ int BZ_API(BZ2_bzDecompressInit) ( bz_stream* strm, int verbosity, int small ) { DState* s; if (!bz_config_ok()) return BZ_CONFIG_ERROR; if (strm == NULL) return BZ_PARAM_ERROR; if (small != 0 && small != 1) return BZ_PARAM_ERROR; if (verbosity < 0 || verbosity > 4) return BZ_PARAM_ERROR; if (strm->bzalloc == NULL) strm->bzalloc = default_bzalloc; if (strm->bzfree == NULL) strm->bzfree = default_bzfree; s = BZALLOC( sizeof(DState) ); if (s == NULL) return BZ_MEM_ERROR; s->strm = strm; strm->state = s; s->state = BZ_X_MAGIC_1; s->bsLive = 0; s->bsBuff = 0; s->calculatedCombinedCRC = 0; strm->total_in_lo32 = 0; strm->total_in_hi32 = 0; strm->total_out_lo32 = 0; strm->total_out_hi32 = 0; s->smallDecompress = (Bool)small; s->ll4 = NULL; s->ll16 = NULL; s->tt = NULL; s->currBlockNo = 0; s->verbosity = verbosity; s->blockEndHandler = NULL; s->blockEndHandlerData = NULL; return BZ_OK; } void BZ_API(BZ2_bzSetBlockEndHandler) ( bz_stream *strm, void (*func) (void *data, bz_stream *strm, unsigned int bitsrem, unsigned int bits, unsigned int crc, unsigned int blocksize), void *data ) { DState* s; s = strm->state; s->blockEndHandler = func; s->blockEndHandlerData = data; } void BZ_API(BZ2_bzRestoreBlockEnd) ( bz_stream *strm, unsigned int bitsrem, unsigned int crc ) { DState* s; AssertH((bitsrem >= 0 && bitsrem < 8), 2828); s = strm->state; s->bsBuff = 'B' >> (8 - bitsrem); s->bsLive = bitsrem; s->calculatedCombinedCRC = crc; } /*---------------------------------------------------*/ /* Return True iff data corruption is discovered. Returns False if there is no problem. */ static Bool unRLE_obuf_to_output_FAST ( DState* s ) { UChar k1; if (s->blockRandomised) { while (True) { /* try to finish existing run */ while (True) { if (s->strm->avail_out == 0) return False; if (s->state_out_len == 0) break; *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); s->state_out_len--; s->strm->next_out++; s->strm->avail_out--; s->strm->total_out_lo32++; if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; } /* can a new run be started? */ if (s->nblock_used == s->save_nblock+1) return False; /* Only caused by corrupt data stream? */ if (s->nblock_used > s->save_nblock+1) return True; s->state_out_len = 1; s->state_out_ch = s->k0; BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; s->state_out_len = 2; BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; s->state_out_len = 3; BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; BZ_GET_FAST(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; s->state_out_len = ((Int32)k1) + 4; BZ_GET_FAST(s->k0); BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; s->nblock_used++; } } else { /* restore */ UInt32 c_calculatedBlockCRC = s->calculatedBlockCRC; UChar c_state_out_ch = s->state_out_ch; Int32 c_state_out_len = s->state_out_len; Int32 c_nblock_used = s->nblock_used; Int32 c_k0 = s->k0; UInt32* c_tt = s->tt; UInt32 c_tPos = s->tPos; char* cs_next_out = s->strm->next_out; unsigned int cs_avail_out = s->strm->avail_out; Int32 ro_blockSize100k = s->blockSize100k; /* end restore */ UInt32 avail_out_INIT = cs_avail_out; Int32 s_save_nblockPP = s->save_nblock+1; unsigned int total_out_lo32_old; while (True) { /* try to finish existing run */ if (c_state_out_len > 0) { while (True) { if (cs_avail_out == 0) goto return_notr; if (c_state_out_len == 1) break; *( (UChar*)(cs_next_out) ) = c_state_out_ch; BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch ); c_state_out_len--; cs_next_out++; cs_avail_out--; } s_state_out_len_eq_one: { if (cs_avail_out == 0) { c_state_out_len = 1; goto return_notr; }; *( (UChar*)(cs_next_out) ) = c_state_out_ch; BZ_UPDATE_CRC ( c_calculatedBlockCRC, c_state_out_ch ); cs_next_out++; cs_avail_out--; } } /* Only caused by corrupt data stream? */ if (c_nblock_used > s_save_nblockPP) return True; /* can a new run be started? */ if (c_nblock_used == s_save_nblockPP) { c_state_out_len = 0; goto return_notr; }; c_state_out_ch = c_k0; BZ_GET_FAST_C(k1); c_nblock_used++; if (k1 != c_k0) { c_k0 = k1; goto s_state_out_len_eq_one; }; if (c_nblock_used == s_save_nblockPP) goto s_state_out_len_eq_one; c_state_out_len = 2; BZ_GET_FAST_C(k1); c_nblock_used++; if (c_nblock_used == s_save_nblockPP) continue; if (k1 != c_k0) { c_k0 = k1; continue; }; c_state_out_len = 3; BZ_GET_FAST_C(k1); c_nblock_used++; if (c_nblock_used == s_save_nblockPP) continue; if (k1 != c_k0) { c_k0 = k1; continue; }; BZ_GET_FAST_C(k1); c_nblock_used++; c_state_out_len = ((Int32)k1) + 4; BZ_GET_FAST_C(c_k0); c_nblock_used++; } return_notr: total_out_lo32_old = s->strm->total_out_lo32; s->strm->total_out_lo32 += (avail_out_INIT - cs_avail_out); if (s->strm->total_out_lo32 < total_out_lo32_old) s->strm->total_out_hi32++; /* save */ s->calculatedBlockCRC = c_calculatedBlockCRC; s->state_out_ch = c_state_out_ch; s->state_out_len = c_state_out_len; s->nblock_used = c_nblock_used; s->k0 = c_k0; s->tt = c_tt; s->tPos = c_tPos; s->strm->next_out = cs_next_out; s->strm->avail_out = cs_avail_out; /* end save */ } return False; } /*---------------------------------------------------*/ __inline__ Int32 BZ2_indexIntoF ( Int32 indx, Int32 *cftab ) { Int32 nb, na, mid; nb = 0; na = 256; do { mid = (nb + na) >> 1; if (indx >= cftab[mid]) nb = mid; else na = mid; } while (na - nb != 1); return nb; } /*---------------------------------------------------*/ /* Return True iff data corruption is discovered. Returns False if there is no problem. */ static Bool unRLE_obuf_to_output_SMALL ( DState* s ) { UChar k1; if (s->blockRandomised) { while (True) { /* try to finish existing run */ while (True) { if (s->strm->avail_out == 0) return False; if (s->state_out_len == 0) break; *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); s->state_out_len--; s->strm->next_out++; s->strm->avail_out--; s->strm->total_out_lo32++; if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; } /* can a new run be started? */ if (s->nblock_used == s->save_nblock+1) return False; /* Only caused by corrupt data stream? */ if (s->nblock_used > s->save_nblock+1) return True; s->state_out_len = 1; s->state_out_ch = s->k0; BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; s->state_out_len = 2; BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; s->state_out_len = 3; BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; BZ_GET_SMALL(k1); BZ_RAND_UPD_MASK; k1 ^= BZ_RAND_MASK; s->nblock_used++; s->state_out_len = ((Int32)k1) + 4; BZ_GET_SMALL(s->k0); BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; s->nblock_used++; } } else { while (True) { /* try to finish existing run */ while (True) { if (s->strm->avail_out == 0) return False; if (s->state_out_len == 0) break; *( (UChar*)(s->strm->next_out) ) = s->state_out_ch; BZ_UPDATE_CRC ( s->calculatedBlockCRC, s->state_out_ch ); s->state_out_len--; s->strm->next_out++; s->strm->avail_out--; s->strm->total_out_lo32++; if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; } /* can a new run be started? */ if (s->nblock_used == s->save_nblock+1) return False; /* Only caused by corrupt data stream? */ if (s->nblock_used > s->save_nblock+1) return True; s->state_out_len = 1; s->state_out_ch = s->k0; BZ_GET_SMALL(k1); s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; s->state_out_len = 2; BZ_GET_SMALL(k1); s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; s->state_out_len = 3; BZ_GET_SMALL(k1); s->nblock_used++; if (s->nblock_used == s->save_nblock+1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; BZ_GET_SMALL(k1); s->nblock_used++; s->state_out_len = ((Int32)k1) + 4; BZ_GET_SMALL(s->k0); s->nblock_used++; } } } /*---------------------------------------------------*/ int BZ_API(BZ2_bzDecompress) ( bz_stream *strm ) { Bool corrupt; DState* s; if (strm == NULL) return BZ_PARAM_ERROR; s = strm->state; if (s == NULL) return BZ_PARAM_ERROR; if (s->strm != strm) return BZ_PARAM_ERROR; while (True) { if (s->state == BZ_X_IDLE) return BZ_SEQUENCE_ERROR; if (s->state == BZ_X_OUTPUT) { if (s->smallDecompress) corrupt = unRLE_obuf_to_output_SMALL ( s ); else corrupt = unRLE_obuf_to_output_FAST ( s ); if (corrupt) return BZ_DATA_ERROR; if (s->nblock_used == s->save_nblock+1 && s->state_out_len == 0) { BZ_FINALISE_CRC ( s->calculatedBlockCRC ); if (s->verbosity >= 3) { VPrintf2 ( " {0x%08x, 0x%08x}", s->storedBlockCRC, s->calculatedBlockCRC ); } if (s->verbosity >= 2) VPrintf0 ( "]" ); if (s->calculatedBlockCRC != s->storedBlockCRC) return BZ_DATA_ERROR; s->calculatedCombinedCRC = (s->calculatedCombinedCRC << 1) | (s->calculatedCombinedCRC >> 31); s->calculatedCombinedCRC ^= s->calculatedBlockCRC; if(s->blockEndHandler != NULL) s->blockEndHandler(s->blockEndHandlerData, strm, s->bsLive, s->bsBuff, s->calculatedCombinedCRC, s->blockSize100k); s->state = BZ_X_BLKHDR_1; } else { return BZ_OK; } } if (s->state >= BZ_X_MAGIC_1) { Int32 r = BZ2_decompress ( s ); if (r == BZ_STREAM_END) { if (s->verbosity >= 3) VPrintf2 ( "\n combined CRCs: stored = 0x%08x, computed = 0x%08x", s->storedCombinedCRC, s->calculatedCombinedCRC ); if (s->calculatedCombinedCRC != s->storedCombinedCRC) return BZ_DATA_ERROR; return r; } if (s->state != BZ_X_OUTPUT) return r; } } AssertH ( 0, 6001 ); return 0; /*NOTREACHED*/ } /*---------------------------------------------------*/ int BZ_API(BZ2_bzDecompressEnd) ( bz_stream *strm ) { DState* s; if (strm == NULL) return BZ_PARAM_ERROR; s = strm->state; if (s == NULL) return BZ_PARAM_ERROR; if (s->strm != strm) return BZ_PARAM_ERROR; if (s->tt != NULL) BZFREE(s->tt); if (s->ll16 != NULL) BZFREE(s->ll16); if (s->ll4 != NULL) BZFREE(s->ll4); BZFREE(strm->state); strm->state = NULL; return BZ_OK; } #ifndef BZ_NO_STDIO /*---------------------------------------------------*/ /*--- File I/O stuff ---*/ /*---------------------------------------------------*/ #define BZ_SETERR(eee) \ { \ if (bzerror != NULL) *bzerror = eee; \ if (bzf != NULL) bzf->lastErr = eee; \ } typedef struct { FILE* handle; Char buf[BZ_MAX_UNUSED]; Int32 bufN; Bool writing; bz_stream strm; Int32 lastErr; Bool initialisedOk; } bzFile; /*---------------------------------------------*/ static Bool myfeof ( FILE* f ) { Int32 c = fgetc ( f ); if (c == EOF) return True; ungetc ( c, f ); return False; } /*---------------------------------------------------*/ BZFILE* BZ_API(BZ2_bzWriteOpen) ( int* bzerror, FILE* f, int blockSize100k, int verbosity, int workFactor ) { Int32 ret; bzFile* bzf = NULL; BZ_SETERR(BZ_OK); if (f == NULL || (blockSize100k < 1 || blockSize100k > 9) || (workFactor < 0 || workFactor > 250) || (verbosity < 0 || verbosity > 4)) { BZ_SETERR(BZ_PARAM_ERROR); return NULL; }; if (ferror(f)) { BZ_SETERR(BZ_IO_ERROR); return NULL; }; bzf = malloc ( sizeof(bzFile) ); if (bzf == NULL) { BZ_SETERR(BZ_MEM_ERROR); return NULL; }; BZ_SETERR(BZ_OK); bzf->initialisedOk = False; bzf->bufN = 0; bzf->handle = f; bzf->writing = True; bzf->strm.bzalloc = NULL; bzf->strm.bzfree = NULL; bzf->strm.opaque = NULL; if (workFactor == 0) workFactor = 30; ret = BZ2_bzCompressInit ( &(bzf->strm), blockSize100k, verbosity, workFactor ); if (ret != BZ_OK) { BZ_SETERR(ret); free(bzf); return NULL; }; bzf->strm.avail_in = 0; bzf->initialisedOk = True; return bzf; } /*---------------------------------------------------*/ void BZ_API(BZ2_bzWrite) ( int* bzerror, BZFILE* b, void* buf, int len ) { Int32 n, n2, ret; bzFile* bzf = (bzFile*)b; BZ_SETERR(BZ_OK); if (bzf == NULL || buf == NULL || len < 0) { BZ_SETERR(BZ_PARAM_ERROR); return; }; if (!(bzf->writing)) { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; if (ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return; }; if (len == 0) { BZ_SETERR(BZ_OK); return; }; bzf->strm.avail_in = len; bzf->strm.next_in = buf; while (True) { bzf->strm.avail_out = BZ_MAX_UNUSED; bzf->strm.next_out = bzf->buf; ret = BZ2_bzCompress ( &(bzf->strm), BZ_RUN ); if (ret != BZ_RUN_OK) { BZ_SETERR(ret); return; }; if (bzf->strm.avail_out < BZ_MAX_UNUSED) { n = BZ_MAX_UNUSED - bzf->strm.avail_out; n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), n, bzf->handle ); if (n != n2 || ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return; }; } if (bzf->strm.avail_in == 0) { BZ_SETERR(BZ_OK); return; }; } } /*---------------------------------------------------*/ void BZ_API(BZ2_bzWriteClose) ( int* bzerror, BZFILE* b, int abandon, unsigned int* nbytes_in, unsigned int* nbytes_out ) { BZ2_bzWriteClose64 ( bzerror, b, abandon, nbytes_in, NULL, nbytes_out, NULL ); } void BZ_API(BZ2_bzWriteClose64) ( int* bzerror, BZFILE* b, int abandon, unsigned int* nbytes_in_lo32, unsigned int* nbytes_in_hi32, unsigned int* nbytes_out_lo32, unsigned int* nbytes_out_hi32 ) { Int32 n, n2, ret; bzFile* bzf = (bzFile*)b; if (bzf == NULL) { BZ_SETERR(BZ_OK); return; }; if (!(bzf->writing)) { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; if (ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return; }; if (nbytes_in_lo32 != NULL) *nbytes_in_lo32 = 0; if (nbytes_in_hi32 != NULL) *nbytes_in_hi32 = 0; if (nbytes_out_lo32 != NULL) *nbytes_out_lo32 = 0; if (nbytes_out_hi32 != NULL) *nbytes_out_hi32 = 0; if ((!abandon) && bzf->lastErr == BZ_OK) { while (True) { bzf->strm.avail_out = BZ_MAX_UNUSED; bzf->strm.next_out = bzf->buf; ret = BZ2_bzCompress ( &(bzf->strm), BZ_FINISH ); if (ret != BZ_FINISH_OK && ret != BZ_STREAM_END) { BZ_SETERR(ret); return; }; if (bzf->strm.avail_out < BZ_MAX_UNUSED) { n = BZ_MAX_UNUSED - bzf->strm.avail_out; n2 = fwrite ( (void*)(bzf->buf), sizeof(UChar), n, bzf->handle ); if (n != n2 || ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return; }; } if (ret == BZ_STREAM_END) break; } } if ( !abandon && !ferror ( bzf->handle ) ) { fflush ( bzf->handle ); if (ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return; }; } if (nbytes_in_lo32 != NULL) *nbytes_in_lo32 = bzf->strm.total_in_lo32; if (nbytes_in_hi32 != NULL) *nbytes_in_hi32 = bzf->strm.total_in_hi32; if (nbytes_out_lo32 != NULL) *nbytes_out_lo32 = bzf->strm.total_out_lo32; if (nbytes_out_hi32 != NULL) *nbytes_out_hi32 = bzf->strm.total_out_hi32; BZ_SETERR(BZ_OK); BZ2_bzCompressEnd ( &(bzf->strm) ); free ( bzf ); } /*---------------------------------------------------*/ BZFILE* BZ_API(BZ2_bzReadOpen) ( int* bzerror, FILE* f, int verbosity, int small, void* unused, int nUnused ) { bzFile* bzf = NULL; int ret; BZ_SETERR(BZ_OK); if (f == NULL || (small != 0 && small != 1) || (verbosity < 0 || verbosity > 4) || (unused == NULL && nUnused != 0) || (unused != NULL && (nUnused < 0 || nUnused > BZ_MAX_UNUSED))) { BZ_SETERR(BZ_PARAM_ERROR); return NULL; }; if (ferror(f)) { BZ_SETERR(BZ_IO_ERROR); return NULL; }; bzf = malloc ( sizeof(bzFile) ); if (bzf == NULL) { BZ_SETERR(BZ_MEM_ERROR); return NULL; }; BZ_SETERR(BZ_OK); bzf->initialisedOk = False; bzf->handle = f; bzf->bufN = 0; bzf->writing = False; bzf->strm.bzalloc = NULL; bzf->strm.bzfree = NULL; bzf->strm.opaque = NULL; while (nUnused > 0) { bzf->buf[bzf->bufN] = *((UChar*)(unused)); bzf->bufN++; unused = ((void*)( 1 + ((UChar*)(unused)) )); nUnused--; } ret = BZ2_bzDecompressInit ( &(bzf->strm), verbosity, small ); if (ret != BZ_OK) { BZ_SETERR(ret); free(bzf); return NULL; }; bzf->strm.avail_in = bzf->bufN; bzf->strm.next_in = bzf->buf; bzf->initialisedOk = True; return bzf; } /*---------------------------------------------------*/ void BZ_API(BZ2_bzReadClose) ( int *bzerror, BZFILE *b ) { bzFile* bzf = (bzFile*)b; BZ_SETERR(BZ_OK); if (bzf == NULL) { BZ_SETERR(BZ_OK); return; }; if (bzf->writing) { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; if (bzf->initialisedOk) (void)BZ2_bzDecompressEnd ( &(bzf->strm) ); free ( bzf ); } /*---------------------------------------------------*/ int BZ_API(BZ2_bzRead) ( int* bzerror, BZFILE* b, void* buf, int len ) { Int32 n, ret; bzFile* bzf = (bzFile*)b; BZ_SETERR(BZ_OK); if (bzf == NULL || buf == NULL || len < 0) { BZ_SETERR(BZ_PARAM_ERROR); return 0; }; if (bzf->writing) { BZ_SETERR(BZ_SEQUENCE_ERROR); return 0; }; if (len == 0) { BZ_SETERR(BZ_OK); return 0; }; bzf->strm.avail_out = len; bzf->strm.next_out = buf; while (True) { if (ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return 0; }; if (bzf->strm.avail_in == 0 && !myfeof(bzf->handle)) { n = fread ( bzf->buf, sizeof(UChar), BZ_MAX_UNUSED, bzf->handle ); if (ferror(bzf->handle)) { BZ_SETERR(BZ_IO_ERROR); return 0; }; bzf->bufN = n; bzf->strm.avail_in = bzf->bufN; bzf->strm.next_in = bzf->buf; } ret = BZ2_bzDecompress ( &(bzf->strm) ); if (ret != BZ_OK && ret != BZ_STREAM_END) { BZ_SETERR(ret); return 0; }; if (ret == BZ_OK && myfeof(bzf->handle) && bzf->strm.avail_in == 0 && bzf->strm.avail_out > 0) { BZ_SETERR(BZ_UNEXPECTED_EOF); return 0; }; if (ret == BZ_STREAM_END) { BZ_SETERR(BZ_STREAM_END); return len - bzf->strm.avail_out; }; if (bzf->strm.avail_out == 0) { BZ_SETERR(BZ_OK); return len; }; } return 0; /*not reached*/ } /*---------------------------------------------------*/ void BZ_API(BZ2_bzReadGetUnused) ( int* bzerror, BZFILE* b, void** unused, int* nUnused ) { bzFile* bzf = (bzFile*)b; if (bzf == NULL) { BZ_SETERR(BZ_PARAM_ERROR); return; }; if (bzf->lastErr != BZ_STREAM_END) { BZ_SETERR(BZ_SEQUENCE_ERROR); return; }; if (unused == NULL || nUnused == NULL) { BZ_SETERR(BZ_PARAM_ERROR); return; }; BZ_SETERR(BZ_OK); *nUnused = bzf->strm.avail_in; *unused = bzf->strm.next_in; } #endif /*---------------------------------------------------*/ /*--- Misc convenience stuff ---*/ /*---------------------------------------------------*/ /*---------------------------------------------------*/ int BZ_API(BZ2_bzBuffToBuffCompress) ( char* dest, unsigned int* destLen, char* source, unsigned int sourceLen, int blockSize100k, int verbosity, int workFactor ) { bz_stream strm; int ret; if (dest == NULL || destLen == NULL || source == NULL || blockSize100k < 1 || blockSize100k > 9 || verbosity < 0 || verbosity > 4 || workFactor < 0 || workFactor > 250) return BZ_PARAM_ERROR; if (workFactor == 0) workFactor = 30; strm.bzalloc = NULL; strm.bzfree = NULL; strm.opaque = NULL; ret = BZ2_bzCompressInit ( &strm, blockSize100k, verbosity, workFactor ); if (ret != BZ_OK) return ret; strm.next_in = source; strm.next_out = dest; strm.avail_in = sourceLen; strm.avail_out = *destLen; ret = BZ2_bzCompress ( &strm, BZ_FINISH ); if (ret == BZ_FINISH_OK) goto output_overflow; if (ret != BZ_STREAM_END) goto errhandler; /* normal termination */ *destLen -= strm.avail_out; BZ2_bzCompressEnd ( &strm ); return BZ_OK; output_overflow: BZ2_bzCompressEnd ( &strm ); return BZ_OUTBUFF_FULL; errhandler: BZ2_bzCompressEnd ( &strm ); return ret; } /*---------------------------------------------------*/ int BZ_API(BZ2_bzBuffToBuffDecompress) ( char* dest, unsigned int* destLen, char* source, unsigned int sourceLen, int small, int verbosity ) { bz_stream strm; int ret; if (dest == NULL || destLen == NULL || source == NULL || (small != 0 && small != 1) || verbosity < 0 || verbosity > 4) return BZ_PARAM_ERROR; strm.bzalloc = NULL; strm.bzfree = NULL; strm.opaque = NULL; ret = BZ2_bzDecompressInit ( &strm, verbosity, small ); if (ret != BZ_OK) return ret; strm.next_in = source; strm.next_out = dest; strm.avail_in = sourceLen; strm.avail_out = *destLen; ret = BZ2_bzDecompress ( &strm ); if (ret == BZ_OK) goto output_overflow_or_eof; if (ret != BZ_STREAM_END) goto errhandler; /* normal termination */ *destLen -= strm.avail_out; BZ2_bzDecompressEnd ( &strm ); return BZ_OK; output_overflow_or_eof: if (strm.avail_out > 0) { BZ2_bzDecompressEnd ( &strm ); return BZ_UNEXPECTED_EOF; } else { BZ2_bzDecompressEnd ( &strm ); return BZ_OUTBUFF_FULL; }; errhandler: BZ2_bzDecompressEnd ( &strm ); return ret; } /*---------------------------------------------------*/ /*-- Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp) to support better zlib compatibility. This code is not _officially_ part of libbzip2 (yet); I haven't tested it, documented it, or considered the threading-safeness of it. If this code breaks, please contact both Yoshioka and me. --*/ /*---------------------------------------------------*/ /*---------------------------------------------------*/ /*-- return version like "0.9.5d, 4-Sept-1999". --*/ const char * BZ_API(BZ2_bzlibVersion)(void) { return BZ_VERSION; } #ifndef BZ_NO_STDIO /*---------------------------------------------------*/ #if defined(_WIN32) || defined(OS2) || defined(MSDOS) # include # include # define SET_BINARY_MODE(file) setmode(fileno(file),O_BINARY) #else # define SET_BINARY_MODE(file) #endif static BZFILE * bzopen_or_bzdopen ( const char *path, /* no use when bzdopen */ int fd, /* no use when bzdopen */ const char *mode, int open_mode) /* bzopen: 0, bzdopen:1 */ { int bzerr; char unused[BZ_MAX_UNUSED]; int blockSize100k = 9; int writing = 0; char mode2[10] = ""; FILE *fp = NULL; BZFILE *bzfp = NULL; int verbosity = 0; int workFactor = 30; int smallMode = 0; int nUnused = 0; if (mode == NULL) return NULL; while (*mode) { switch (*mode) { case 'r': writing = 0; break; case 'w': writing = 1; break; case 's': smallMode = 1; break; default: if (isdigit((int)(*mode))) { blockSize100k = *mode-BZ_HDR_0; } } mode++; } strcat(mode2, writing ? "w" : "r" ); strcat(mode2,"b"); /* binary mode */ if (open_mode==0) { if (path==NULL || strcmp(path,"")==0) { fp = (writing ? stdout : stdin); SET_BINARY_MODE(fp); } else { fp = fopen(path,mode2); } } else { #ifdef BZ_STRICT_ANSI fp = NULL; #else fp = fdopen(fd,mode2); #endif } if (fp == NULL) return NULL; if (writing) { /* Guard against total chaos and anarchy -- JRS */ if (blockSize100k < 1) blockSize100k = 1; if (blockSize100k > 9) blockSize100k = 9; bzfp = BZ2_bzWriteOpen(&bzerr,fp,blockSize100k, verbosity,workFactor); } else { bzfp = BZ2_bzReadOpen(&bzerr,fp,verbosity,smallMode, unused,nUnused); } if (bzfp == NULL) { if (fp != stdin && fp != stdout) fclose(fp); return NULL; } return bzfp; } /*---------------------------------------------------*/ /*-- open file for read or write. ex) bzopen("file","w9") case path="" or NULL => use stdin or stdout. --*/ BZFILE * BZ_API(BZ2_bzopen) ( const char *path, const char *mode ) { return bzopen_or_bzdopen(path,-1,mode,/*bzopen*/0); } /*---------------------------------------------------*/ BZFILE * BZ_API(BZ2_bzdopen) ( int fd, const char *mode ) { return bzopen_or_bzdopen(NULL,fd,mode,/*bzdopen*/1); } /*---------------------------------------------------*/ int BZ_API(BZ2_bzread) (BZFILE* b, void* buf, int len ) { int bzerr, nread; if (((bzFile*)b)->lastErr == BZ_STREAM_END) return 0; nread = BZ2_bzRead(&bzerr,b,buf,len); if (bzerr == BZ_OK || bzerr == BZ_STREAM_END) { return nread; } else { return -1; } } /*---------------------------------------------------*/ int BZ_API(BZ2_bzwrite) (BZFILE* b, void* buf, int len ) { int bzerr; BZ2_bzWrite(&bzerr,b,buf,len); if(bzerr == BZ_OK){ return len; }else{ return -1; } } /*---------------------------------------------------*/ int BZ_API(BZ2_bzflush) (BZFILE *b) { /* do nothing now... */ return 0; } /*---------------------------------------------------*/ void BZ_API(BZ2_bzclose) (BZFILE* b) { int bzerr; FILE *fp; if (b==NULL) {return;} fp = ((bzFile *)b)->handle; if(((bzFile*)b)->writing){ BZ2_bzWriteClose(&bzerr,b,0,NULL,NULL); if(bzerr != BZ_OK){ BZ2_bzWriteClose(NULL,b,1,NULL,NULL); } }else{ BZ2_bzReadClose(&bzerr,b); } if(fp!=stdin && fp!=stdout){ fclose(fp); } } /*---------------------------------------------------*/ /*-- return last error code --*/ static const char *bzerrorstrings[] = { "OK" ,"SEQUENCE_ERROR" ,"PARAM_ERROR" ,"MEM_ERROR" ,"DATA_ERROR" ,"DATA_ERROR_MAGIC" ,"IO_ERROR" ,"UNEXPECTED_EOF" ,"OUTBUFF_FULL" ,"CONFIG_ERROR" ,"???" /* for future */ ,"???" /* for future */ ,"???" /* for future */ ,"???" /* for future */ ,"???" /* for future */ ,"???" /* for future */ }; const char * BZ_API(BZ2_bzerror) (BZFILE *b, int *errnum) { int err = ((bzFile *)b)->lastErr; if(err>0) err = 0; *errnum = err; return bzerrorstrings[err*-1]; } #endif /*-------------------------------------------------------------*/ /*--- end bzlib.c ---*/ /*-------------------------------------------------------------*/ avfs-1.1.4/bzlib/compress.c0000644000175000001440000005012414032341001012460 00000000000000 /*-------------------------------------------------------------*/ /*--- Compression machinery (not incl block sorting) ---*/ /*--- compress.c ---*/ /*-------------------------------------------------------------*/ /* ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.8 of 13 July 2019 Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ */ /* CHANGES 0.9.0 -- original version. 0.9.0a/b -- no changes in this file. 0.9.0c -- changed setting of nGroups in sendMTFValues() so as to do a bit better on small files */ #include "bzlib_private.h" /*---------------------------------------------------*/ /*--- Bit stream I/O ---*/ /*---------------------------------------------------*/ /*---------------------------------------------------*/ void BZ2_bsInitWrite ( EState* s ) { s->bsLive = 0; s->bsBuff = 0; } /*---------------------------------------------------*/ static void bsFinishWrite ( EState* s ) { while (s->bsLive > 0) { s->zbits[s->numZ] = (UChar)(s->bsBuff >> 24); s->numZ++; s->bsBuff <<= 8; s->bsLive -= 8; } } /*---------------------------------------------------*/ #define bsNEEDW(nz) \ { \ while (s->bsLive >= 8) { \ s->zbits[s->numZ] \ = (UChar)(s->bsBuff >> 24); \ s->numZ++; \ s->bsBuff <<= 8; \ s->bsLive -= 8; \ } \ } /*---------------------------------------------------*/ static __inline__ void bsW ( EState* s, Int32 n, UInt32 v ) { bsNEEDW ( n ); s->bsBuff |= (v << (32 - s->bsLive - n)); s->bsLive += n; } /*---------------------------------------------------*/ static void bsPutUInt32 ( EState* s, UInt32 u ) { bsW ( s, 8, (u >> 24) & 0xffL ); bsW ( s, 8, (u >> 16) & 0xffL ); bsW ( s, 8, (u >> 8) & 0xffL ); bsW ( s, 8, u & 0xffL ); } /*---------------------------------------------------*/ static void bsPutUChar ( EState* s, UChar c ) { bsW( s, 8, (UInt32)c ); } /*---------------------------------------------------*/ /*--- The back end proper ---*/ /*---------------------------------------------------*/ /*---------------------------------------------------*/ static void makeMaps_e ( EState* s ) { Int32 i; s->nInUse = 0; for (i = 0; i < 256; i++) if (s->inUse[i]) { s->unseqToSeq[i] = s->nInUse; s->nInUse++; } } /*---------------------------------------------------*/ static void generateMTFValues ( EState* s ) { UChar yy[256]; Int32 i, j; Int32 zPend; Int32 wr; Int32 EOB; /* After sorting (eg, here), s->arr1 [ 0 .. s->nblock-1 ] holds sorted order, and ((UChar*)s->arr2) [ 0 .. s->nblock-1 ] holds the original block data. The first thing to do is generate the MTF values, and put them in ((UInt16*)s->arr1) [ 0 .. s->nblock-1 ]. Because there are strictly fewer or equal MTF values than block values, ptr values in this area are overwritten with MTF values only when they are no longer needed. The final compressed bitstream is generated into the area starting at (UChar*) (&((UChar*)s->arr2)[s->nblock]) These storage aliases are set up in bzCompressInit(), except for the last one, which is arranged in compressBlock(). */ UInt32* ptr = s->ptr; UChar* block = s->block; UInt16* mtfv = s->mtfv; makeMaps_e ( s ); EOB = s->nInUse+1; for (i = 0; i <= EOB; i++) s->mtfFreq[i] = 0; wr = 0; zPend = 0; for (i = 0; i < s->nInUse; i++) yy[i] = (UChar) i; for (i = 0; i < s->nblock; i++) { UChar ll_i; AssertD ( wr <= i, "generateMTFValues(1)" ); j = ptr[i]-1; if (j < 0) j += s->nblock; ll_i = s->unseqToSeq[block[j]]; AssertD ( ll_i < s->nInUse, "generateMTFValues(2a)" ); if (yy[0] == ll_i) { zPend++; } else { if (zPend > 0) { zPend--; while (True) { if (zPend & 1) { mtfv[wr] = BZ_RUNB; wr++; s->mtfFreq[BZ_RUNB]++; } else { mtfv[wr] = BZ_RUNA; wr++; s->mtfFreq[BZ_RUNA]++; } if (zPend < 2) break; zPend = (zPend - 2) / 2; }; zPend = 0; } { register UChar rtmp; register UChar* ryy_j; register UChar rll_i; rtmp = yy[1]; yy[1] = yy[0]; ryy_j = &(yy[1]); rll_i = ll_i; while ( rll_i != rtmp ) { register UChar rtmp2; ryy_j++; rtmp2 = rtmp; rtmp = *ryy_j; *ryy_j = rtmp2; }; yy[0] = rtmp; j = ryy_j - &(yy[0]); mtfv[wr] = j+1; wr++; s->mtfFreq[j+1]++; } } } if (zPend > 0) { zPend--; while (True) { if (zPend & 1) { mtfv[wr] = BZ_RUNB; wr++; s->mtfFreq[BZ_RUNB]++; } else { mtfv[wr] = BZ_RUNA; wr++; s->mtfFreq[BZ_RUNA]++; } if (zPend < 2) break; zPend = (zPend - 2) / 2; }; zPend = 0; } mtfv[wr] = EOB; wr++; s->mtfFreq[EOB]++; s->nMTF = wr; } /*---------------------------------------------------*/ #define BZ_LESSER_ICOST 0 #define BZ_GREATER_ICOST 15 static void sendMTFValues ( EState* s ) { Int32 v, t, i, j, gs, ge, totc, bt, bc, iter; Int32 nSelectors, alphaSize, minLen, maxLen, selCtr; Int32 nGroups, nBytes; /*-- UChar len [BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; is a global since the decoder also needs it. Int32 code[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; Int32 rfreq[BZ_N_GROUPS][BZ_MAX_ALPHA_SIZE]; are also globals only used in this proc. Made global to keep stack frame size small. --*/ UInt16 cost[BZ_N_GROUPS]; Int32 fave[BZ_N_GROUPS]; UInt16* mtfv = s->mtfv; if (s->verbosity >= 3) VPrintf3( " %d in block, %d after MTF & 1-2 coding, " "%d+2 syms in use\n", s->nblock, s->nMTF, s->nInUse ); alphaSize = s->nInUse+2; for (t = 0; t < BZ_N_GROUPS; t++) for (v = 0; v < alphaSize; v++) s->len[t][v] = BZ_GREATER_ICOST; /*--- Decide how many coding tables to use ---*/ AssertH ( s->nMTF > 0, 3001 ); if (s->nMTF < 200) nGroups = 2; else if (s->nMTF < 600) nGroups = 3; else if (s->nMTF < 1200) nGroups = 4; else if (s->nMTF < 2400) nGroups = 5; else nGroups = 6; /*--- Generate an initial set of coding tables ---*/ { Int32 nPart, remF, tFreq, aFreq; nPart = nGroups; remF = s->nMTF; gs = 0; while (nPart > 0) { tFreq = remF / nPart; ge = gs-1; aFreq = 0; while (aFreq < tFreq && ge < alphaSize-1) { ge++; aFreq += s->mtfFreq[ge]; } if (ge > gs && nPart != nGroups && nPart != 1 && ((nGroups-nPart) % 2 == 1)) { aFreq -= s->mtfFreq[ge]; ge--; } if (s->verbosity >= 3) VPrintf5( " initial group %d, [%d .. %d], " "has %d syms (%4.1f%%)\n", nPart, gs, ge, aFreq, (100.0 * (float)aFreq) / (float)(s->nMTF) ); for (v = 0; v < alphaSize; v++) if (v >= gs && v <= ge) s->len[nPart-1][v] = BZ_LESSER_ICOST; else s->len[nPart-1][v] = BZ_GREATER_ICOST; nPart--; gs = ge+1; remF -= aFreq; } } /*--- Iterate up to BZ_N_ITERS times to improve the tables. ---*/ for (iter = 0; iter < BZ_N_ITERS; iter++) { for (t = 0; t < nGroups; t++) fave[t] = 0; for (t = 0; t < nGroups; t++) for (v = 0; v < alphaSize; v++) s->rfreq[t][v] = 0; /*--- Set up an auxiliary length table which is used to fast-track the common case (nGroups == 6). ---*/ if (nGroups == 6) { for (v = 0; v < alphaSize; v++) { s->len_pack[v][0] = (s->len[1][v] << 16) | s->len[0][v]; s->len_pack[v][1] = (s->len[3][v] << 16) | s->len[2][v]; s->len_pack[v][2] = (s->len[5][v] << 16) | s->len[4][v]; } } nSelectors = 0; totc = 0; gs = 0; while (True) { /*--- Set group start & end marks. --*/ if (gs >= s->nMTF) break; ge = gs + BZ_G_SIZE - 1; if (ge >= s->nMTF) ge = s->nMTF-1; /*-- Calculate the cost of this group as coded by each of the coding tables. --*/ for (t = 0; t < nGroups; t++) cost[t] = 0; if (nGroups == 6 && 50 == ge-gs+1) { /*--- fast track the common case ---*/ register UInt32 cost01, cost23, cost45; register UInt16 icv; cost01 = cost23 = cost45 = 0; # define BZ_ITER(nn) \ icv = mtfv[gs+(nn)]; \ cost01 += s->len_pack[icv][0]; \ cost23 += s->len_pack[icv][1]; \ cost45 += s->len_pack[icv][2]; \ BZ_ITER(0); BZ_ITER(1); BZ_ITER(2); BZ_ITER(3); BZ_ITER(4); BZ_ITER(5); BZ_ITER(6); BZ_ITER(7); BZ_ITER(8); BZ_ITER(9); BZ_ITER(10); BZ_ITER(11); BZ_ITER(12); BZ_ITER(13); BZ_ITER(14); BZ_ITER(15); BZ_ITER(16); BZ_ITER(17); BZ_ITER(18); BZ_ITER(19); BZ_ITER(20); BZ_ITER(21); BZ_ITER(22); BZ_ITER(23); BZ_ITER(24); BZ_ITER(25); BZ_ITER(26); BZ_ITER(27); BZ_ITER(28); BZ_ITER(29); BZ_ITER(30); BZ_ITER(31); BZ_ITER(32); BZ_ITER(33); BZ_ITER(34); BZ_ITER(35); BZ_ITER(36); BZ_ITER(37); BZ_ITER(38); BZ_ITER(39); BZ_ITER(40); BZ_ITER(41); BZ_ITER(42); BZ_ITER(43); BZ_ITER(44); BZ_ITER(45); BZ_ITER(46); BZ_ITER(47); BZ_ITER(48); BZ_ITER(49); # undef BZ_ITER cost[0] = cost01 & 0xffff; cost[1] = cost01 >> 16; cost[2] = cost23 & 0xffff; cost[3] = cost23 >> 16; cost[4] = cost45 & 0xffff; cost[5] = cost45 >> 16; } else { /*--- slow version which correctly handles all situations ---*/ for (i = gs; i <= ge; i++) { UInt16 icv = mtfv[i]; for (t = 0; t < nGroups; t++) cost[t] += s->len[t][icv]; } } /*-- Find the coding table which is best for this group, and record its identity in the selector table. --*/ bc = 999999999; bt = -1; for (t = 0; t < nGroups; t++) if (cost[t] < bc) { bc = cost[t]; bt = t; }; totc += bc; fave[bt]++; s->selector[nSelectors] = bt; nSelectors++; /*-- Increment the symbol frequencies for the selected table. --*/ if (nGroups == 6 && 50 == ge-gs+1) { /*--- fast track the common case ---*/ # define BZ_ITUR(nn) s->rfreq[bt][ mtfv[gs+(nn)] ]++ BZ_ITUR(0); BZ_ITUR(1); BZ_ITUR(2); BZ_ITUR(3); BZ_ITUR(4); BZ_ITUR(5); BZ_ITUR(6); BZ_ITUR(7); BZ_ITUR(8); BZ_ITUR(9); BZ_ITUR(10); BZ_ITUR(11); BZ_ITUR(12); BZ_ITUR(13); BZ_ITUR(14); BZ_ITUR(15); BZ_ITUR(16); BZ_ITUR(17); BZ_ITUR(18); BZ_ITUR(19); BZ_ITUR(20); BZ_ITUR(21); BZ_ITUR(22); BZ_ITUR(23); BZ_ITUR(24); BZ_ITUR(25); BZ_ITUR(26); BZ_ITUR(27); BZ_ITUR(28); BZ_ITUR(29); BZ_ITUR(30); BZ_ITUR(31); BZ_ITUR(32); BZ_ITUR(33); BZ_ITUR(34); BZ_ITUR(35); BZ_ITUR(36); BZ_ITUR(37); BZ_ITUR(38); BZ_ITUR(39); BZ_ITUR(40); BZ_ITUR(41); BZ_ITUR(42); BZ_ITUR(43); BZ_ITUR(44); BZ_ITUR(45); BZ_ITUR(46); BZ_ITUR(47); BZ_ITUR(48); BZ_ITUR(49); # undef BZ_ITUR } else { /*--- slow version which correctly handles all situations ---*/ for (i = gs; i <= ge; i++) s->rfreq[bt][ mtfv[i] ]++; } gs = ge+1; } if (s->verbosity >= 3) { VPrintf2 ( " pass %d: size is %d, grp uses are ", iter+1, totc/8 ); for (t = 0; t < nGroups; t++) VPrintf1 ( "%d ", fave[t] ); VPrintf0 ( "\n" ); } /*-- Recompute the tables based on the accumulated frequencies. --*/ /* maxLen was changed from 20 to 17 in bzip2-1.0.3. See comment in huffman.c for details. */ for (t = 0; t < nGroups; t++) BZ2_hbMakeCodeLengths ( &(s->len[t][0]), &(s->rfreq[t][0]), alphaSize, 17 /*20*/ ); } AssertH( nGroups < 8, 3002 ); AssertH( nSelectors < 32768 && nSelectors <= BZ_MAX_SELECTORS, 3003 ); /*--- Compute MTF values for the selectors. ---*/ { UChar pos[BZ_N_GROUPS], ll_i, tmp2, tmp; for (i = 0; i < nGroups; i++) pos[i] = i; for (i = 0; i < nSelectors; i++) { ll_i = s->selector[i]; j = 0; tmp = pos[j]; while ( ll_i != tmp ) { j++; tmp2 = tmp; tmp = pos[j]; pos[j] = tmp2; }; pos[0] = tmp; s->selectorMtf[i] = j; } }; /*--- Assign actual codes for the tables. --*/ for (t = 0; t < nGroups; t++) { minLen = 32; maxLen = 0; for (i = 0; i < alphaSize; i++) { if (s->len[t][i] > maxLen) maxLen = s->len[t][i]; if (s->len[t][i] < minLen) minLen = s->len[t][i]; } AssertH ( !(maxLen > 17 /*20*/ ), 3004 ); AssertH ( !(minLen < 1), 3005 ); BZ2_hbAssignCodes ( &(s->code[t][0]), &(s->len[t][0]), minLen, maxLen, alphaSize ); } /*--- Transmit the mapping table. ---*/ { Bool inUse16[16]; for (i = 0; i < 16; i++) { inUse16[i] = False; for (j = 0; j < 16; j++) if (s->inUse[i * 16 + j]) inUse16[i] = True; } nBytes = s->numZ; for (i = 0; i < 16; i++) if (inUse16[i]) bsW(s,1,1); else bsW(s,1,0); for (i = 0; i < 16; i++) if (inUse16[i]) for (j = 0; j < 16; j++) { if (s->inUse[i * 16 + j]) bsW(s,1,1); else bsW(s,1,0); } if (s->verbosity >= 3) VPrintf1( " bytes: mapping %d, ", s->numZ-nBytes ); } /*--- Now the selectors. ---*/ nBytes = s->numZ; bsW ( s, 3, nGroups ); bsW ( s, 15, nSelectors ); for (i = 0; i < nSelectors; i++) { for (j = 0; j < s->selectorMtf[i]; j++) bsW(s,1,1); bsW(s,1,0); } if (s->verbosity >= 3) VPrintf1( "selectors %d, ", s->numZ-nBytes ); /*--- Now the coding tables. ---*/ nBytes = s->numZ; for (t = 0; t < nGroups; t++) { Int32 curr = s->len[t][0]; bsW ( s, 5, curr ); for (i = 0; i < alphaSize; i++) { while (curr < s->len[t][i]) { bsW(s,2,2); curr++; /* 10 */ }; while (curr > s->len[t][i]) { bsW(s,2,3); curr--; /* 11 */ }; bsW ( s, 1, 0 ); } } if (s->verbosity >= 3) VPrintf1 ( "code lengths %d, ", s->numZ-nBytes ); /*--- And finally, the block data proper ---*/ nBytes = s->numZ; selCtr = 0; gs = 0; while (True) { if (gs >= s->nMTF) break; ge = gs + BZ_G_SIZE - 1; if (ge >= s->nMTF) ge = s->nMTF-1; AssertH ( s->selector[selCtr] < nGroups, 3006 ); if (nGroups == 6 && 50 == ge-gs+1) { /*--- fast track the common case ---*/ UInt16 mtfv_i; UChar* s_len_sel_selCtr = &(s->len[s->selector[selCtr]][0]); Int32* s_code_sel_selCtr = &(s->code[s->selector[selCtr]][0]); # define BZ_ITAH(nn) \ mtfv_i = mtfv[gs+(nn)]; \ bsW ( s, \ s_len_sel_selCtr[mtfv_i], \ s_code_sel_selCtr[mtfv_i] ) BZ_ITAH(0); BZ_ITAH(1); BZ_ITAH(2); BZ_ITAH(3); BZ_ITAH(4); BZ_ITAH(5); BZ_ITAH(6); BZ_ITAH(7); BZ_ITAH(8); BZ_ITAH(9); BZ_ITAH(10); BZ_ITAH(11); BZ_ITAH(12); BZ_ITAH(13); BZ_ITAH(14); BZ_ITAH(15); BZ_ITAH(16); BZ_ITAH(17); BZ_ITAH(18); BZ_ITAH(19); BZ_ITAH(20); BZ_ITAH(21); BZ_ITAH(22); BZ_ITAH(23); BZ_ITAH(24); BZ_ITAH(25); BZ_ITAH(26); BZ_ITAH(27); BZ_ITAH(28); BZ_ITAH(29); BZ_ITAH(30); BZ_ITAH(31); BZ_ITAH(32); BZ_ITAH(33); BZ_ITAH(34); BZ_ITAH(35); BZ_ITAH(36); BZ_ITAH(37); BZ_ITAH(38); BZ_ITAH(39); BZ_ITAH(40); BZ_ITAH(41); BZ_ITAH(42); BZ_ITAH(43); BZ_ITAH(44); BZ_ITAH(45); BZ_ITAH(46); BZ_ITAH(47); BZ_ITAH(48); BZ_ITAH(49); # undef BZ_ITAH } else { /*--- slow version which correctly handles all situations ---*/ for (i = gs; i <= ge; i++) { bsW ( s, s->len [s->selector[selCtr]] [mtfv[i]], s->code [s->selector[selCtr]] [mtfv[i]] ); } } gs = ge+1; selCtr++; } AssertH( selCtr == nSelectors, 3007 ); if (s->verbosity >= 3) VPrintf1( "codes %d\n", s->numZ-nBytes ); (void)nBytes; } /*---------------------------------------------------*/ void BZ2_compressBlock ( EState* s, Bool is_last_block ) { if (s->nblock > 0) { BZ_FINALISE_CRC ( s->blockCRC ); s->combinedCRC = (s->combinedCRC << 1) | (s->combinedCRC >> 31); s->combinedCRC ^= s->blockCRC; if (s->blockNo > 1) s->numZ = 0; if (s->verbosity >= 2) VPrintf4( " block %d: crc = 0x%08x, " "combined CRC = 0x%08x, size = %d\n", s->blockNo, s->blockCRC, s->combinedCRC, s->nblock ); BZ2_blockSort ( s ); } s->zbits = (UChar*) (&((UChar*)s->arr2)[s->nblock]); /*-- If this is the first block, create the stream header. --*/ if (s->blockNo == 1) { BZ2_bsInitWrite ( s ); bsPutUChar ( s, BZ_HDR_B ); bsPutUChar ( s, BZ_HDR_Z ); bsPutUChar ( s, BZ_HDR_h ); bsPutUChar ( s, (UChar)(BZ_HDR_0 + s->blockSize100k) ); } if (s->nblock > 0) { bsPutUChar ( s, 0x31 ); bsPutUChar ( s, 0x41 ); bsPutUChar ( s, 0x59 ); bsPutUChar ( s, 0x26 ); bsPutUChar ( s, 0x53 ); bsPutUChar ( s, 0x59 ); /*-- Now the block's CRC, so it is in a known place. --*/ bsPutUInt32 ( s, s->blockCRC ); /*-- Now a single bit indicating (non-)randomisation. As of version 0.9.5, we use a better sorting algorithm which makes randomisation unnecessary. So always set the randomised bit to 'no'. Of course, the decoder still needs to be able to handle randomised blocks so as to maintain backwards compatibility with older versions of bzip2. --*/ bsW(s,1,0); bsW ( s, 24, s->origPtr ); generateMTFValues ( s ); sendMTFValues ( s ); } /*-- If this is the last block, add the stream trailer. --*/ if (is_last_block) { bsPutUChar ( s, 0x17 ); bsPutUChar ( s, 0x72 ); bsPutUChar ( s, 0x45 ); bsPutUChar ( s, 0x38 ); bsPutUChar ( s, 0x50 ); bsPutUChar ( s, 0x90 ); bsPutUInt32 ( s, s->combinedCRC ); if (s->verbosity >= 2) VPrintf1( " final combined CRC = 0x%08x\n ", s->combinedCRC ); bsFinishWrite ( s ); } } /*-------------------------------------------------------------*/ /*--- end compress.c ---*/ /*-------------------------------------------------------------*/ avfs-1.1.4/bzlib/huffman.c0000644000175000001440000001551214032341001012253 00000000000000 /*-------------------------------------------------------------*/ /*--- Huffman coding low-level stuff ---*/ /*--- huffman.c ---*/ /*-------------------------------------------------------------*/ /* ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.8 of 13 July 2019 Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ */ #include "bzlib_private.h" /*---------------------------------------------------*/ #define WEIGHTOF(zz0) ((zz0) & 0xffffff00) #define DEPTHOF(zz1) ((zz1) & 0x000000ff) #define MYMAX(zz2,zz3) ((zz2) > (zz3) ? (zz2) : (zz3)) #define ADDWEIGHTS(zw1,zw2) \ (WEIGHTOF(zw1)+WEIGHTOF(zw2)) | \ (1 + MYMAX(DEPTHOF(zw1),DEPTHOF(zw2))) #define UPHEAP(z) \ { \ Int32 zz, tmp; \ zz = z; tmp = heap[zz]; \ while (weight[tmp] < weight[heap[zz >> 1]]) { \ heap[zz] = heap[zz >> 1]; \ zz >>= 1; \ } \ heap[zz] = tmp; \ } #define DOWNHEAP(z) \ { \ Int32 zz, yy, tmp; \ zz = z; tmp = heap[zz]; \ while (True) { \ yy = zz << 1; \ if (yy > nHeap) break; \ if (yy < nHeap && \ weight[heap[yy+1]] < weight[heap[yy]]) \ yy++; \ if (weight[tmp] < weight[heap[yy]]) break; \ heap[zz] = heap[yy]; \ zz = yy; \ } \ heap[zz] = tmp; \ } /*---------------------------------------------------*/ void BZ2_hbMakeCodeLengths ( UChar *len, Int32 *freq, Int32 alphaSize, Int32 maxLen ) { /*-- Nodes and heap entries run from 1. Entry 0 for both the heap and nodes is a sentinel. --*/ Int32 nNodes, nHeap, n1, n2, i, j, k; Bool tooLong; Int32 heap [ BZ_MAX_ALPHA_SIZE + 2 ]; Int32 weight [ BZ_MAX_ALPHA_SIZE * 2 ]; Int32 parent [ BZ_MAX_ALPHA_SIZE * 2 ]; for (i = 0; i < alphaSize; i++) weight[i+1] = (freq[i] == 0 ? 1 : freq[i]) << 8; while (True) { nNodes = alphaSize; nHeap = 0; heap[0] = 0; weight[0] = 0; parent[0] = -2; for (i = 1; i <= alphaSize; i++) { parent[i] = -1; nHeap++; heap[nHeap] = i; UPHEAP(nHeap); } AssertH( nHeap < (BZ_MAX_ALPHA_SIZE+2), 2001 ); while (nHeap > 1) { n1 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1); n2 = heap[1]; heap[1] = heap[nHeap]; nHeap--; DOWNHEAP(1); nNodes++; parent[n1] = parent[n2] = nNodes; weight[nNodes] = ADDWEIGHTS(weight[n1], weight[n2]); parent[nNodes] = -1; nHeap++; heap[nHeap] = nNodes; UPHEAP(nHeap); } AssertH( nNodes < (BZ_MAX_ALPHA_SIZE * 2), 2002 ); tooLong = False; for (i = 1; i <= alphaSize; i++) { j = 0; k = i; while (parent[k] >= 0) { k = parent[k]; j++; } len[i-1] = j; if (j > maxLen) tooLong = True; } if (! tooLong) break; /* 17 Oct 04: keep-going condition for the following loop used to be 'i < alphaSize', which missed the last element, theoretically leading to the possibility of the compressor looping. However, this count-scaling step is only needed if one of the generated Huffman code words is longer than maxLen, which up to and including version 1.0.2 was 20 bits, which is extremely unlikely. In version 1.0.3 maxLen was changed to 17 bits, which has minimal effect on compression ratio, but does mean this scaling step is used from time to time, enough to verify that it works. This means that bzip2-1.0.3 and later will only produce Huffman codes with a maximum length of 17 bits. However, in order to preserve backwards compatibility with bitstreams produced by versions pre-1.0.3, the decompressor must still handle lengths of up to 20. */ for (i = 1; i <= alphaSize; i++) { j = weight[i] >> 8; j = 1 + (j / 2); weight[i] = j << 8; } } } /*---------------------------------------------------*/ void BZ2_hbAssignCodes ( Int32 *code, UChar *length, Int32 minLen, Int32 maxLen, Int32 alphaSize ) { Int32 n, vec, i; vec = 0; for (n = minLen; n <= maxLen; n++) { for (i = 0; i < alphaSize; i++) if (length[i] == n) { code[i] = vec; vec++; }; vec <<= 1; } } /*---------------------------------------------------*/ void BZ2_hbCreateDecodeTables ( Int32 *limit, Int32 *base, Int32 *perm, UChar *length, Int32 minLen, Int32 maxLen, Int32 alphaSize ) { Int32 pp, i, j, vec; pp = 0; for (i = minLen; i <= maxLen; i++) for (j = 0; j < alphaSize; j++) if (length[j] == i) { perm[pp] = j; pp++; }; for (i = 0; i < BZ_MAX_CODE_LEN; i++) base[i] = 0; for (i = 0; i < alphaSize; i++) base[length[i]+1]++; for (i = 1; i < BZ_MAX_CODE_LEN; i++) base[i] += base[i-1]; for (i = 0; i < BZ_MAX_CODE_LEN; i++) limit[i] = 0; vec = 0; for (i = minLen; i <= maxLen; i++) { vec += (base[i+1] - base[i]); limit[i] = vec-1; vec <<= 1; } for (i = minLen + 1; i <= maxLen; i++) base[i] = ((limit[i-1] + 1) << 1) - base[i]; } /*-------------------------------------------------------------*/ /*--- end huffman.c ---*/ /*-------------------------------------------------------------*/ avfs-1.1.4/bzlib/Makefile.in0000644000175000001440000006602214032341013012535 00000000000000# Makefile.in generated by automake 1.16.3 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2020 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ am__is_gnu_make = { \ if test -z '$(MAKELEVEL)'; then \ false; \ elif test -n '$(MAKE_HOST)'; then \ true; \ elif test -n '$(MAKE_VERSION)' && test -n '$(CURDIR)'; then \ true; \ else \ false; \ fi; \ } am__make_running_with_option = \ case $${target_option-} in \ ?) ;; \ *) echo "am__make_running_with_option: internal error: invalid" \ "target option '$${target_option-}' specified" >&2; \ exit 1;; \ esac; \ has_opt=no; \ sane_makeflags=$$MAKEFLAGS; \ if $(am__is_gnu_make); then \ sane_makeflags=$$MFLAGS; \ else \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ bs=\\; \ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ esac; \ fi; \ skip_next=no; \ strip_trailopt () \ { \ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ }; \ for flg in $$sane_makeflags; do \ test $$skip_next = yes && { skip_next=no; continue; }; \ case $$flg in \ *=*|--*) continue;; \ -*I) strip_trailopt 'I'; skip_next=yes;; \ -*I?*) strip_trailopt 'I';; \ -*O) strip_trailopt 'O'; skip_next=yes;; \ -*O?*) strip_trailopt 'O';; \ -*l) strip_trailopt 'l'; skip_next=yes;; \ -*l?*) strip_trailopt 'l';; \ -[dEDm]) skip_next=yes;; \ -[JT]) skip_next=yes;; \ esac; \ case $$flg in \ *$$target_option*) has_opt=yes; break;; \ esac; \ done; \ test $$has_opt = yes am__make_dryrun = (target_option=n; $(am__make_running_with_option)) am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ subdir = bzlib ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/pkg.m4 $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) DIST_COMMON = $(srcdir)/Makefile.am $(noinst_HEADERS) \ $(am__DIST_COMMON) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libbz_la_LIBADD = am_libbz_la_OBJECTS = libbz_la-blocksort.lo libbz_la-huffman.lo \ libbz_la-crctable.lo libbz_la-randtable.lo \ libbz_la-compress.lo libbz_la-decompress.lo libbz_la-bzlib.lo libbz_la_OBJECTS = $(am_libbz_la_OBJECTS) AM_V_lt = $(am__v_lt_@AM_V@) am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@) am__v_lt_0 = --silent am__v_lt_1 = libbz_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libbz_la_CFLAGS) \ $(CFLAGS) $(libbz_la_LDFLAGS) $(LDFLAGS) -o $@ @USE_SYSTEM_BZLIB_FALSE@am_libbz_la_rpath = AM_V_P = $(am__v_P_@AM_V@) am__v_P_ = $(am__v_P_@AM_DEFAULT_V@) am__v_P_0 = false am__v_P_1 = : AM_V_GEN = $(am__v_GEN_@AM_V@) am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@) am__v_GEN_0 = @echo " GEN " $@; am__v_GEN_1 = AM_V_at = $(am__v_at_@AM_V@) am__v_at_ = $(am__v_at_@AM_DEFAULT_V@) am__v_at_0 = @ am__v_at_1 = DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/include depcomp = $(SHELL) $(top_srcdir)/depcomp am__maybe_remake_depfiles = depfiles am__depfiles_remade = ./$(DEPDIR)/libbz_la-blocksort.Plo \ ./$(DEPDIR)/libbz_la-bzlib.Plo \ ./$(DEPDIR)/libbz_la-compress.Plo \ ./$(DEPDIR)/libbz_la-crctable.Plo \ ./$(DEPDIR)/libbz_la-decompress.Plo \ ./$(DEPDIR)/libbz_la-huffman.Plo \ ./$(DEPDIR)/libbz_la-randtable.Plo am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_@AM_V@) am__v_CC_ = $(am__v_CC_@AM_DEFAULT_V@) am__v_CC_0 = @echo " CC " $@; am__v_CC_1 = CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_@AM_V@) am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@) am__v_CCLD_0 = @echo " CCLD " $@; am__v_CCLD_1 = SOURCES = $(libbz_la_SOURCES) DIST_SOURCES = $(libbz_la_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac HEADERS = $(noinst_HEADERS) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) # Read a list of newline-separated strings from the standard input, # and print each of them once, without duplicates. Input order is # *not* preserved. am__uniquify_input = $(AWK) '\ BEGIN { nonempty = 0; } \ { items[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in items) print i; }; } \ ' # Make sure the list of sources is unique. This is necessary because, # e.g., the same source file might be shared among _SOURCES variables # for different programs/libraries. am__define_uniq_tagged_files = \ list='$(am__tagged_files)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | $(am__uniquify_input)` ETAGS = etags CTAGS = ctags am__DIST_COMMON = $(srcdir)/Makefile.in $(top_srcdir)/depcomp DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ BZLIB_INCLUDE = @BZLIB_INCLUDE@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DAV = @DAV@ DAV_LS = @DAV_LS@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ FUSELIBS = @FUSELIBS@ GREP = @GREP@ HAVE_ZIPINFO = @HAVE_ZIPINFO@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBNEON_CFLAGS = @LIBNEON_CFLAGS@ LIBNEON_LIBS = @LIBNEON_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIBZSTD_CFLAGS = @LIBZSTD_CFLAGS@ LIBZSTD_LIBS = @LIBZSTD_LIBS@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ LT_SYS_LIBRARY_PATH = @LT_SYS_LIBRARY_PATH@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NM = @NM@ NMEDIT = @NMEDIT@ NUMVERSION = @NUMVERSION@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ ZIP = @ZIP@ ZLIB_CFLAGS = @ZLIB_CFLAGS@ ZLIB_INCLUDE = @ZLIB_INCLUDE@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ pkgconfigdir = @pkgconfigdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ cppflags = -I$(top_srcdir)/include @CPPFLAGS@ -DBZ_NO_STDIO @USE_SYSTEM_BZLIB_FALSE@noinst_LTLIBRARIES = libbz.la libbz_la_LDFLAGS = -module libbz_la_CFLAGS = @ZLIB_CFLAGS@ $(cppflags) libbz_la_SOURCES = blocksort.c \ huffman.c \ crctable.c \ randtable.c \ compress.c \ decompress.c \ bzlib.c noinst_HEADERS = \ bzlib.h \ bzlib_private.h \ bzconf.h all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu bzlib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu bzlib/Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstLTLIBRARIES: -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) @list='$(noinst_LTLIBRARIES)'; \ locs=`for p in $$list; do echo $$p; done | \ sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \ sort -u`; \ test -z "$$locs" || { \ echo rm -f $${locs}; \ rm -f $${locs}; \ } libbz.la: $(libbz_la_OBJECTS) $(libbz_la_DEPENDENCIES) $(EXTRA_libbz_la_DEPENDENCIES) $(AM_V_CCLD)$(libbz_la_LINK) $(am_libbz_la_rpath) $(libbz_la_OBJECTS) $(libbz_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbz_la-blocksort.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbz_la-bzlib.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbz_la-compress.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbz_la-crctable.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbz_la-decompress.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbz_la-huffman.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbz_la-randtable.Plo@am__quote@ # am--include-marker $(am__depfiles_remade): @$(MKDIR_P) $(@D) @echo '# dummy' >$@-t && $(am__mv) $@-t $@ am--depfiles: $(am__depfiles_remade) .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $< libbz_la-blocksort.lo: blocksort.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbz_la_CFLAGS) $(CFLAGS) -MT libbz_la-blocksort.lo -MD -MP -MF $(DEPDIR)/libbz_la-blocksort.Tpo -c -o libbz_la-blocksort.lo `test -f 'blocksort.c' || echo '$(srcdir)/'`blocksort.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libbz_la-blocksort.Tpo $(DEPDIR)/libbz_la-blocksort.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='blocksort.c' object='libbz_la-blocksort.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbz_la_CFLAGS) $(CFLAGS) -c -o libbz_la-blocksort.lo `test -f 'blocksort.c' || echo '$(srcdir)/'`blocksort.c libbz_la-huffman.lo: huffman.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbz_la_CFLAGS) $(CFLAGS) -MT libbz_la-huffman.lo -MD -MP -MF $(DEPDIR)/libbz_la-huffman.Tpo -c -o libbz_la-huffman.lo `test -f 'huffman.c' || echo '$(srcdir)/'`huffman.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libbz_la-huffman.Tpo $(DEPDIR)/libbz_la-huffman.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='huffman.c' object='libbz_la-huffman.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbz_la_CFLAGS) $(CFLAGS) -c -o libbz_la-huffman.lo `test -f 'huffman.c' || echo '$(srcdir)/'`huffman.c libbz_la-crctable.lo: crctable.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbz_la_CFLAGS) $(CFLAGS) -MT libbz_la-crctable.lo -MD -MP -MF $(DEPDIR)/libbz_la-crctable.Tpo -c -o libbz_la-crctable.lo `test -f 'crctable.c' || echo '$(srcdir)/'`crctable.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libbz_la-crctable.Tpo $(DEPDIR)/libbz_la-crctable.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='crctable.c' object='libbz_la-crctable.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbz_la_CFLAGS) $(CFLAGS) -c -o libbz_la-crctable.lo `test -f 'crctable.c' || echo '$(srcdir)/'`crctable.c libbz_la-randtable.lo: randtable.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbz_la_CFLAGS) $(CFLAGS) -MT libbz_la-randtable.lo -MD -MP -MF $(DEPDIR)/libbz_la-randtable.Tpo -c -o libbz_la-randtable.lo `test -f 'randtable.c' || echo '$(srcdir)/'`randtable.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libbz_la-randtable.Tpo $(DEPDIR)/libbz_la-randtable.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='randtable.c' object='libbz_la-randtable.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbz_la_CFLAGS) $(CFLAGS) -c -o libbz_la-randtable.lo `test -f 'randtable.c' || echo '$(srcdir)/'`randtable.c libbz_la-compress.lo: compress.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbz_la_CFLAGS) $(CFLAGS) -MT libbz_la-compress.lo -MD -MP -MF $(DEPDIR)/libbz_la-compress.Tpo -c -o libbz_la-compress.lo `test -f 'compress.c' || echo '$(srcdir)/'`compress.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libbz_la-compress.Tpo $(DEPDIR)/libbz_la-compress.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='compress.c' object='libbz_la-compress.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbz_la_CFLAGS) $(CFLAGS) -c -o libbz_la-compress.lo `test -f 'compress.c' || echo '$(srcdir)/'`compress.c libbz_la-decompress.lo: decompress.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbz_la_CFLAGS) $(CFLAGS) -MT libbz_la-decompress.lo -MD -MP -MF $(DEPDIR)/libbz_la-decompress.Tpo -c -o libbz_la-decompress.lo `test -f 'decompress.c' || echo '$(srcdir)/'`decompress.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libbz_la-decompress.Tpo $(DEPDIR)/libbz_la-decompress.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='decompress.c' object='libbz_la-decompress.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbz_la_CFLAGS) $(CFLAGS) -c -o libbz_la-decompress.lo `test -f 'decompress.c' || echo '$(srcdir)/'`decompress.c libbz_la-bzlib.lo: bzlib.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbz_la_CFLAGS) $(CFLAGS) -MT libbz_la-bzlib.lo -MD -MP -MF $(DEPDIR)/libbz_la-bzlib.Tpo -c -o libbz_la-bzlib.lo `test -f 'bzlib.c' || echo '$(srcdir)/'`bzlib.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libbz_la-bzlib.Tpo $(DEPDIR)/libbz_la-bzlib.Plo @AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='bzlib.c' object='libbz_la-bzlib.lo' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(libbz_la_CFLAGS) $(CFLAGS) -c -o libbz_la-bzlib.lo `test -f 'bzlib.c' || echo '$(srcdir)/'`bzlib.c mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(am__tagged_files) $(am__define_uniq_tagged_files); mkid -fID $$unique tags: tags-am TAGS: tags tags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) set x; \ here=`pwd`; \ $(am__define_uniq_tagged_files); \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: ctags-am CTAGS: ctags ctags-am: $(TAGS_DEPENDENCIES) $(am__tagged_files) $(am__define_uniq_tagged_files); \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" cscopelist: cscopelist-am cscopelist-am: $(am__tagged_files) list='$(am__tagged_files)'; \ case "$(srcdir)" in \ [\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \ *) sdir=$(subdir)/$(srcdir) ;; \ esac; \ for i in $$list; do \ if test -f "$$i"; then \ echo "$(subdir)/$$i"; \ else \ echo "$$sdir/$$i"; \ fi; \ done >> $(top_builddir)/cscope.files distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(BUILT_SOURCES) $(MAKE) $(AM_MAKEFLAGS) distdir-am distdir-am: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(LTLIBRARIES) $(HEADERS) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: if test -z '$(STRIP)'; then \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ install; \ else \ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \ fi mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \ mostlyclean-am distclean: distclean-am -rm -f ./$(DEPDIR)/libbz_la-blocksort.Plo -rm -f ./$(DEPDIR)/libbz_la-bzlib.Plo -rm -f ./$(DEPDIR)/libbz_la-compress.Plo -rm -f ./$(DEPDIR)/libbz_la-crctable.Plo -rm -f ./$(DEPDIR)/libbz_la-decompress.Plo -rm -f ./$(DEPDIR)/libbz_la-huffman.Plo -rm -f ./$(DEPDIR)/libbz_la-randtable.Plo -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -f ./$(DEPDIR)/libbz_la-blocksort.Plo -rm -f ./$(DEPDIR)/libbz_la-bzlib.Plo -rm -f ./$(DEPDIR)/libbz_la-compress.Plo -rm -f ./$(DEPDIR)/libbz_la-crctable.Plo -rm -f ./$(DEPDIR)/libbz_la-decompress.Plo -rm -f ./$(DEPDIR)/libbz_la-huffman.Plo -rm -f ./$(DEPDIR)/libbz_la-randtable.Plo -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am am--depfiles check check-am clean \ clean-generic clean-libtool clean-noinstLTLIBRARIES \ cscopelist-am ctags ctags-am distclean distclean-compile \ distclean-generic distclean-libtool distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags tags-am uninstall uninstall-am .PRECIOUS: Makefile # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: avfs-1.1.4/bzlib/bzlib.h0000644000175000001440000001540514032341001011737 00000000000000/* IMPORTANT NOTE: This is not the original bzip2 distribution. The modifications are copyright (C) 2001 Miklos Szeredi The modified software can be distributed under the same licence as the original software (see bellow). */ /*-------------------------------------------------------------*/ /*--- Public header file for the library. ---*/ /*--- bzlib.h ---*/ /*-------------------------------------------------------------*/ /* ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.8 of 13 July 2019 Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ */ #ifndef _BZLIB_H #define _BZLIB_H #include "bzconf.h" #ifdef __cplusplus extern "C" { #endif #define BZ_RUN 0 #define BZ_FLUSH 1 #define BZ_FINISH 2 #define BZ_OK 0 #define BZ_RUN_OK 1 #define BZ_FLUSH_OK 2 #define BZ_FINISH_OK 3 #define BZ_STREAM_END 4 #define BZ_SEQUENCE_ERROR (-1) #define BZ_PARAM_ERROR (-2) #define BZ_MEM_ERROR (-3) #define BZ_DATA_ERROR (-4) #define BZ_DATA_ERROR_MAGIC (-5) #define BZ_IO_ERROR (-6) #define BZ_UNEXPECTED_EOF (-7) #define BZ_OUTBUFF_FULL (-8) #define BZ_CONFIG_ERROR (-9) typedef struct { char *next_in; unsigned int avail_in; unsigned int total_in_lo32; unsigned int total_in_hi32; char *next_out; unsigned int avail_out; unsigned int total_out_lo32; unsigned int total_out_hi32; void *state; void *(*bzalloc)(void *,int,int); void (*bzfree)(void *,void *); void *opaque; } bz_stream; #ifndef BZ_IMPORT #define BZ_EXPORT #endif #ifndef BZ_NO_STDIO /* Need a definitition for FILE */ #include #endif #ifdef _WIN32 # include # ifdef small /* windows.h define small to char */ # undef small # endif # ifdef BZ_EXPORT # define BZ_API(func) WINAPI func # define BZ_EXTERN extern # else /* import windows dll dynamically */ # define BZ_API(func) (WINAPI * func) # define BZ_EXTERN # endif #else # define BZ_API(func) func # define BZ_EXTERN extern #endif /*-- Core (low-level) library functions --*/ BZ_EXTERN int BZ_API(BZ2_bzCompressInit) ( bz_stream* strm, int blockSize100k, int verbosity, int workFactor ); BZ_EXTERN int BZ_API(BZ2_bzCompress) ( bz_stream* strm, int action ); BZ_EXTERN int BZ_API(BZ2_bzCompressEnd) ( bz_stream* strm ); BZ_EXTERN int BZ_API(BZ2_bzDecompressInit) ( bz_stream *strm, int verbosity, int small ); BZ_EXTERN int BZ_API(BZ2_bzDecompress) ( bz_stream* strm ); BZ_EXTERN int BZ_API(BZ2_bzDecompressEnd) ( bz_stream *strm ); BZ_EXTERN void BZ_API(BZ2_bzSetBlockEndHandler) ( bz_stream *strm, void (*func) (void *data, bz_stream *strm, unsigned int bitsrem, unsigned int bits, unsigned int crc, unsigned int blocksize), void *data ); BZ_EXTERN void BZ_API(BZ2_bzRestoreBlockEnd) ( bz_stream *strm, unsigned int bitsrem, unsigned int crc ); /*-- High(er) level library functions --*/ #ifndef BZ_NO_STDIO #define BZ_MAX_UNUSED 5000 typedef void BZFILE; BZ_EXTERN BZFILE* BZ_API(BZ2_bzReadOpen) ( int* bzerror, FILE* f, int verbosity, int small, void* unused, int nUnused ); BZ_EXTERN void BZ_API(BZ2_bzReadClose) ( int* bzerror, BZFILE* b ); BZ_EXTERN void BZ_API(BZ2_bzReadGetUnused) ( int* bzerror, BZFILE* b, void** unused, int* nUnused ); BZ_EXTERN int BZ_API(BZ2_bzRead) ( int* bzerror, BZFILE* b, void* buf, int len ); BZ_EXTERN BZFILE* BZ_API(BZ2_bzWriteOpen) ( int* bzerror, FILE* f, int blockSize100k, int verbosity, int workFactor ); BZ_EXTERN void BZ_API(BZ2_bzWrite) ( int* bzerror, BZFILE* b, void* buf, int len ); BZ_EXTERN void BZ_API(BZ2_bzWriteClose) ( int* bzerror, BZFILE* b, int abandon, unsigned int* nbytes_in, unsigned int* nbytes_out ); BZ_EXTERN void BZ_API(BZ2_bzWriteClose64) ( int* bzerror, BZFILE* b, int abandon, unsigned int* nbytes_in_lo32, unsigned int* nbytes_in_hi32, unsigned int* nbytes_out_lo32, unsigned int* nbytes_out_hi32 ); #endif /*-- Utility functions --*/ BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffCompress) ( char* dest, unsigned int* destLen, char* source, unsigned int sourceLen, int blockSize100k, int verbosity, int workFactor ); BZ_EXTERN int BZ_API(BZ2_bzBuffToBuffDecompress) ( char* dest, unsigned int* destLen, char* source, unsigned int sourceLen, int small, int verbosity ); /*-- Code contributed by Yoshioka Tsuneo (tsuneo@rr.iij4u.or.jp) to support better zlib compatibility. This code is not _officially_ part of libbzip2 (yet); I haven't tested it, documented it, or considered the threading-safeness of it. If this code breaks, please contact both Yoshioka and me. --*/ BZ_EXTERN const char * BZ_API(BZ2_bzlibVersion) ( void ); #ifndef BZ_NO_STDIO BZ_EXTERN BZFILE * BZ_API(BZ2_bzopen) ( const char *path, const char *mode ); BZ_EXTERN BZFILE * BZ_API(BZ2_bzdopen) ( int fd, const char *mode ); BZ_EXTERN int BZ_API(BZ2_bzread) ( BZFILE* b, void* buf, int len ); BZ_EXTERN int BZ_API(BZ2_bzwrite) ( BZFILE* b, void* buf, int len ); BZ_EXTERN int BZ_API(BZ2_bzflush) ( BZFILE* b ); BZ_EXTERN void BZ_API(BZ2_bzclose) ( BZFILE* b ); BZ_EXTERN const char * BZ_API(BZ2_bzerror) ( BZFILE *b, int *errnum ); #endif #ifdef __cplusplus } #endif #endif /*-------------------------------------------------------------*/ /*--- end bzlib.h ---*/ /*-------------------------------------------------------------*/ avfs-1.1.4/bzlib/Makefile.am0000644000175000001440000000056714032341001012523 00000000000000cppflags = -I$(top_srcdir)/include @CPPFLAGS@ -DBZ_NO_STDIO if !USE_SYSTEM_BZLIB noinst_LTLIBRARIES = libbz.la endif libbz_la_LDFLAGS = -module libbz_la_CFLAGS = @ZLIB_CFLAGS@ $(cppflags) libbz_la_SOURCES = blocksort.c \ huffman.c \ crctable.c \ randtable.c \ compress.c \ decompress.c \ bzlib.c noinst_HEADERS = \ bzlib.h \ bzlib_private.h \ bzconf.h avfs-1.1.4/bzlib/decompress.c0000644000175000001440000005141214032341001012772 00000000000000 /*-------------------------------------------------------------*/ /*--- Decompression machinery ---*/ /*--- decompress.c ---*/ /*-------------------------------------------------------------*/ /* ------------------------------------------------------------------ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. bzip2/libbzip2 version 1.0.8 of 13 July 2019 Copyright (C) 1996-2019 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. This program is released under the terms of the license contained in the file LICENSE. ------------------------------------------------------------------ */ #include "bzlib_private.h" /*---------------------------------------------------*/ static void makeMaps_d ( DState* s ) { Int32 i; s->nInUse = 0; for (i = 0; i < 256; i++) if (s->inUse[i]) { s->seqToUnseq[s->nInUse] = i; s->nInUse++; } } /*---------------------------------------------------*/ #define RETURN(rrr) \ { retVal = rrr; goto save_state_and_return; }; #define GET_BITS(lll,vvv,nnn) \ case lll: s->state = lll; \ while (True) { \ if (s->bsLive >= nnn) { \ UInt32 v; \ v = (s->bsBuff >> \ (s->bsLive-nnn)) & ((1 << nnn)-1); \ s->bsLive -= nnn; \ vvv = v; \ break; \ } \ if (s->strm->avail_in == 0) RETURN(BZ_OK); \ s->bsBuff \ = (s->bsBuff << 8) | \ ((UInt32) \ (*((UChar*)(s->strm->next_in)))); \ s->bsLive += 8; \ s->strm->next_in++; \ s->strm->avail_in--; \ s->strm->total_in_lo32++; \ if (s->strm->total_in_lo32 == 0) \ s->strm->total_in_hi32++; \ } #define GET_UCHAR(lll,uuu) \ GET_BITS(lll,uuu,8) #define GET_BIT(lll,uuu) \ GET_BITS(lll,uuu,1) /*---------------------------------------------------*/ #define GET_MTF_VAL(label1,label2,lval) \ { \ if (groupPos == 0) { \ groupNo++; \ if (groupNo >= nSelectors) \ RETURN(BZ_DATA_ERROR); \ groupPos = BZ_G_SIZE; \ gSel = s->selector[groupNo]; \ gMinlen = s->minLens[gSel]; \ gLimit = &(s->limit[gSel][0]); \ gPerm = &(s->perm[gSel][0]); \ gBase = &(s->base[gSel][0]); \ } \ groupPos--; \ zn = gMinlen; \ GET_BITS(label1, zvec, zn); \ while (1) { \ if (zn > 20 /* the longest code */) \ RETURN(BZ_DATA_ERROR); \ if (zvec <= gLimit[zn]) break; \ zn++; \ GET_BIT(label2, zj); \ zvec = (zvec << 1) | zj; \ }; \ if (zvec - gBase[zn] < 0 \ || zvec - gBase[zn] >= BZ_MAX_ALPHA_SIZE) \ RETURN(BZ_DATA_ERROR); \ lval = gPerm[zvec - gBase[zn]]; \ } /*---------------------------------------------------*/ Int32 BZ2_decompress ( DState* s ) { UChar uc; Int32 retVal; Int32 minLen, maxLen; bz_stream* strm = s->strm; /* stuff that needs to be saved/restored */ Int32 i; Int32 j; Int32 t; Int32 alphaSize; Int32 nGroups; Int32 nSelectors; Int32 EOB; Int32 groupNo; Int32 groupPos; Int32 nextSym; Int32 nblockMAX; Int32 nblock; Int32 es; Int32 N; Int32 curr; Int32 zt; Int32 zn; Int32 zvec; Int32 zj; Int32 gSel; Int32 gMinlen; Int32* gLimit; Int32* gBase; Int32* gPerm; if (s->state == BZ_X_MAGIC_1) { /*initialise the save area*/ s->save_i = 0; s->save_j = 0; s->save_t = 0; s->save_alphaSize = 0; s->save_nGroups = 0; s->save_nSelectors = 0; s->save_EOB = 0; s->save_groupNo = 0; s->save_groupPos = 0; s->save_nextSym = 0; s->save_nblockMAX = 0; s->save_nblock = 0; s->save_es = 0; s->save_N = 0; s->save_curr = 0; s->save_zt = 0; s->save_zn = 0; s->save_zvec = 0; s->save_zj = 0; s->save_gSel = 0; s->save_gMinlen = 0; s->save_gLimit = NULL; s->save_gBase = NULL; s->save_gPerm = NULL; } /*restore from the save area*/ i = s->save_i; j = s->save_j; t = s->save_t; alphaSize = s->save_alphaSize; nGroups = s->save_nGroups; nSelectors = s->save_nSelectors; EOB = s->save_EOB; groupNo = s->save_groupNo; groupPos = s->save_groupPos; nextSym = s->save_nextSym; nblockMAX = s->save_nblockMAX; nblock = s->save_nblock; es = s->save_es; N = s->save_N; curr = s->save_curr; zt = s->save_zt; zn = s->save_zn; zvec = s->save_zvec; zj = s->save_zj; gSel = s->save_gSel; gMinlen = s->save_gMinlen; gLimit = s->save_gLimit; gBase = s->save_gBase; gPerm = s->save_gPerm; retVal = BZ_OK; switch (s->state) { GET_UCHAR(BZ_X_MAGIC_1, uc); if (uc != BZ_HDR_B) RETURN(BZ_DATA_ERROR_MAGIC); GET_UCHAR(BZ_X_MAGIC_2, uc); if (uc != BZ_HDR_Z) RETURN(BZ_DATA_ERROR_MAGIC); GET_UCHAR(BZ_X_MAGIC_3, uc) if (uc != BZ_HDR_h) RETURN(BZ_DATA_ERROR_MAGIC); GET_BITS(BZ_X_MAGIC_4, s->blockSize100k, 8) if (s->blockSize100k < (BZ_HDR_0 + 1) || s->blockSize100k > (BZ_HDR_0 + 9)) RETURN(BZ_DATA_ERROR_MAGIC); s->blockSize100k -= BZ_HDR_0; if (s->smallDecompress) { s->ll16 = BZALLOC( s->blockSize100k * 100000 * sizeof(UInt16) ); s->ll4 = BZALLOC( ((1 + s->blockSize100k * 100000) >> 1) * sizeof(UChar) ); if (s->ll16 == NULL || s->ll4 == NULL) RETURN(BZ_MEM_ERROR); } else { s->tt = BZALLOC( s->blockSize100k * 100000 * sizeof(Int32) ); if (s->tt == NULL) RETURN(BZ_MEM_ERROR); } GET_UCHAR(BZ_X_BLKHDR_1, uc); if (uc == 0x17) goto endhdr_2; if (uc != 0x31) RETURN(BZ_DATA_ERROR); GET_UCHAR(BZ_X_BLKHDR_2, uc); if (uc != 0x41) RETURN(BZ_DATA_ERROR); GET_UCHAR(BZ_X_BLKHDR_3, uc); if (uc != 0x59) RETURN(BZ_DATA_ERROR); GET_UCHAR(BZ_X_BLKHDR_4, uc); if (uc != 0x26) RETURN(BZ_DATA_ERROR); GET_UCHAR(BZ_X_BLKHDR_5, uc); if (uc != 0x53) RETURN(BZ_DATA_ERROR); GET_UCHAR(BZ_X_BLKHDR_6, uc); if (uc != 0x59) RETURN(BZ_DATA_ERROR); s->currBlockNo++; if (s->verbosity >= 2) VPrintf1 ( "\n [%d: huff+mtf ", s->currBlockNo ); s->storedBlockCRC = 0; GET_UCHAR(BZ_X_BCRC_1, uc); s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); GET_UCHAR(BZ_X_BCRC_2, uc); s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); GET_UCHAR(BZ_X_BCRC_3, uc); s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); GET_UCHAR(BZ_X_BCRC_4, uc); s->storedBlockCRC = (s->storedBlockCRC << 8) | ((UInt32)uc); GET_BITS(BZ_X_RANDBIT, s->blockRandomised, 1); s->origPtr = 0; GET_UCHAR(BZ_X_ORIGPTR_1, uc); s->origPtr = (s->origPtr << 8) | ((Int32)uc); GET_UCHAR(BZ_X_ORIGPTR_2, uc); s->origPtr = (s->origPtr << 8) | ((Int32)uc); GET_UCHAR(BZ_X_ORIGPTR_3, uc); s->origPtr = (s->origPtr << 8) | ((Int32)uc); if (s->origPtr < 0) RETURN(BZ_DATA_ERROR); if (s->origPtr > 10 + 100000*s->blockSize100k) RETURN(BZ_DATA_ERROR); /*--- Receive the mapping table ---*/ for (i = 0; i < 16; i++) { GET_BIT(BZ_X_MAPPING_1, uc); if (uc == 1) s->inUse16[i] = True; else s->inUse16[i] = False; } for (i = 0; i < 256; i++) s->inUse[i] = False; for (i = 0; i < 16; i++) if (s->inUse16[i]) for (j = 0; j < 16; j++) { GET_BIT(BZ_X_MAPPING_2, uc); if (uc == 1) s->inUse[i * 16 + j] = True; } makeMaps_d ( s ); if (s->nInUse == 0) RETURN(BZ_DATA_ERROR); alphaSize = s->nInUse+2; /*--- Now the selectors ---*/ GET_BITS(BZ_X_SELECTOR_1, nGroups, 3); if (nGroups < 2 || nGroups > BZ_N_GROUPS) RETURN(BZ_DATA_ERROR); GET_BITS(BZ_X_SELECTOR_2, nSelectors, 15); if (nSelectors < 1) RETURN(BZ_DATA_ERROR); for (i = 0; i < nSelectors; i++) { j = 0; while (True) { GET_BIT(BZ_X_SELECTOR_3, uc); if (uc == 0) break; j++; if (j >= nGroups) RETURN(BZ_DATA_ERROR); } /* Having more than BZ_MAX_SELECTORS doesn't make much sense since they will never be used, but some implementations might "round up" the number of selectors, so just ignore those. */ if (i < BZ_MAX_SELECTORS) s->selectorMtf[i] = j; } if (nSelectors > BZ_MAX_SELECTORS) nSelectors = BZ_MAX_SELECTORS; /*--- Undo the MTF values for the selectors. ---*/ { UChar pos[BZ_N_GROUPS], tmp, v; for (v = 0; v < nGroups; v++) pos[v] = v; for (i = 0; i < nSelectors; i++) { v = s->selectorMtf[i]; tmp = pos[v]; while (v > 0) { pos[v] = pos[v-1]; v--; } pos[0] = tmp; s->selector[i] = tmp; } } /*--- Now the coding tables ---*/ for (t = 0; t < nGroups; t++) { GET_BITS(BZ_X_CODING_1, curr, 5); for (i = 0; i < alphaSize; i++) { while (True) { if (curr < 1 || curr > 20) RETURN(BZ_DATA_ERROR); GET_BIT(BZ_X_CODING_2, uc); if (uc == 0) break; GET_BIT(BZ_X_CODING_3, uc); if (uc == 0) curr++; else curr--; } s->len[t][i] = curr; } } /*--- Create the Huffman decoding tables ---*/ for (t = 0; t < nGroups; t++) { minLen = 32; maxLen = 0; for (i = 0; i < alphaSize; i++) { if (s->len[t][i] > maxLen) maxLen = s->len[t][i]; if (s->len[t][i] < minLen) minLen = s->len[t][i]; } BZ2_hbCreateDecodeTables ( &(s->limit[t][0]), &(s->base[t][0]), &(s->perm[t][0]), &(s->len[t][0]), minLen, maxLen, alphaSize ); s->minLens[t] = minLen; } /*--- Now the MTF values ---*/ EOB = s->nInUse+1; nblockMAX = 100000 * s->blockSize100k; groupNo = -1; groupPos = 0; for (i = 0; i <= 255; i++) s->unzftab[i] = 0; /*-- MTF init --*/ { Int32 ii, jj, kk; kk = MTFA_SIZE-1; for (ii = 256 / MTFL_SIZE - 1; ii >= 0; ii--) { for (jj = MTFL_SIZE-1; jj >= 0; jj--) { s->mtfa[kk] = (UChar)(ii * MTFL_SIZE + jj); kk--; } s->mtfbase[ii] = kk + 1; } } /*-- end MTF init --*/ nblock = 0; GET_MTF_VAL(BZ_X_MTF_1, BZ_X_MTF_2, nextSym); while (True) { if (nextSym == EOB) break; if (nextSym == BZ_RUNA || nextSym == BZ_RUNB) { es = -1; N = 1; do { /* Check that N doesn't get too big, so that es doesn't go negative. The maximum value that can be RUNA/RUNB encoded is equal to the block size (post the initial RLE), viz, 900k, so bounding N at 2 million should guard against overflow without rejecting any legitimate inputs. */ if (N >= 2*1024*1024) RETURN(BZ_DATA_ERROR); if (nextSym == BZ_RUNA) es = es + (0+1) * N; else if (nextSym == BZ_RUNB) es = es + (1+1) * N; N = N * 2; GET_MTF_VAL(BZ_X_MTF_3, BZ_X_MTF_4, nextSym); } while (nextSym == BZ_RUNA || nextSym == BZ_RUNB); es++; uc = s->seqToUnseq[ s->mtfa[s->mtfbase[0]] ]; s->unzftab[uc] += es; if (s->smallDecompress) while (es > 0) { if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); s->ll16[nblock] = (UInt16)uc; nblock++; es--; } else while (es > 0) { if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); s->tt[nblock] = (UInt32)uc; nblock++; es--; }; continue; } else { if (nblock >= nblockMAX) RETURN(BZ_DATA_ERROR); /*-- uc = MTF ( nextSym-1 ) --*/ { Int32 ii, jj, kk, pp, lno, off; UInt32 nn; nn = (UInt32)(nextSym - 1); if (nn < MTFL_SIZE) { /* avoid general-case expense */ pp = s->mtfbase[0]; uc = s->mtfa[pp+nn]; while (nn > 3) { Int32 z = pp+nn; s->mtfa[(z) ] = s->mtfa[(z)-1]; s->mtfa[(z)-1] = s->mtfa[(z)-2]; s->mtfa[(z)-2] = s->mtfa[(z)-3]; s->mtfa[(z)-3] = s->mtfa[(z)-4]; nn -= 4; } while (nn > 0) { s->mtfa[(pp+nn)] = s->mtfa[(pp+nn)-1]; nn--; }; s->mtfa[pp] = uc; } else { /* general case */ lno = nn / MTFL_SIZE; off = nn % MTFL_SIZE; pp = s->mtfbase[lno] + off; uc = s->mtfa[pp]; while (pp > s->mtfbase[lno]) { s->mtfa[pp] = s->mtfa[pp-1]; pp--; }; s->mtfbase[lno]++; while (lno > 0) { s->mtfbase[lno]--; s->mtfa[s->mtfbase[lno]] = s->mtfa[s->mtfbase[lno-1] + MTFL_SIZE - 1]; lno--; } s->mtfbase[0]--; s->mtfa[s->mtfbase[0]] = uc; if (s->mtfbase[0] == 0) { kk = MTFA_SIZE-1; for (ii = 256 / MTFL_SIZE-1; ii >= 0; ii--) { for (jj = MTFL_SIZE-1; jj >= 0; jj--) { s->mtfa[kk] = s->mtfa[s->mtfbase[ii] + jj]; kk--; } s->mtfbase[ii] = kk + 1; } } } } /*-- end uc = MTF ( nextSym-1 ) --*/ s->unzftab[s->seqToUnseq[uc]]++; if (s->smallDecompress) s->ll16[nblock] = (UInt16)(s->seqToUnseq[uc]); else s->tt[nblock] = (UInt32)(s->seqToUnseq[uc]); nblock++; GET_MTF_VAL(BZ_X_MTF_5, BZ_X_MTF_6, nextSym); continue; } } /* Now we know what nblock is, we can do a better sanity check on s->origPtr. */ if (s->origPtr < 0 || s->origPtr >= nblock) RETURN(BZ_DATA_ERROR); /*-- Set up cftab to facilitate generation of T^(-1) --*/ /* Check: unzftab entries in range. */ for (i = 0; i <= 255; i++) { if (s->unzftab[i] < 0 || s->unzftab[i] > nblock) RETURN(BZ_DATA_ERROR); } /* Actually generate cftab. */ s->cftab[0] = 0; for (i = 1; i <= 256; i++) s->cftab[i] = s->unzftab[i-1]; for (i = 1; i <= 256; i++) s->cftab[i] += s->cftab[i-1]; /* Check: cftab entries in range. */ for (i = 0; i <= 256; i++) { if (s->cftab[i] < 0 || s->cftab[i] > nblock) { /* s->cftab[i] can legitimately be == nblock */ RETURN(BZ_DATA_ERROR); } } /* Check: cftab entries non-descending. */ for (i = 1; i <= 256; i++) { if (s->cftab[i-1] > s->cftab[i]) { RETURN(BZ_DATA_ERROR); } } s->state_out_len = 0; s->state_out_ch = 0; BZ_INITIALISE_CRC ( s->calculatedBlockCRC ); s->state = BZ_X_OUTPUT; if (s->verbosity >= 2) VPrintf0 ( "rt+rld" ); if (s->smallDecompress) { /*-- Make a copy of cftab, used in generation of T --*/ for (i = 0; i <= 256; i++) s->cftabCopy[i] = s->cftab[i]; /*-- compute the T vector --*/ for (i = 0; i < nblock; i++) { uc = (UChar)(s->ll16[i]); SET_LL(i, s->cftabCopy[uc]); s->cftabCopy[uc]++; } /*-- Compute T^(-1) by pointer reversal on T --*/ i = s->origPtr; j = GET_LL(i); do { Int32 tmp = GET_LL(j); SET_LL(j, i); i = j; j = tmp; } while (i != s->origPtr); s->tPos = s->origPtr; s->nblock_used = 0; if (s->blockRandomised) { BZ_RAND_INIT_MASK; BZ_GET_SMALL(s->k0); s->nblock_used++; BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; } else { BZ_GET_SMALL(s->k0); s->nblock_used++; } } else { /*-- compute the T^(-1) vector --*/ for (i = 0; i < nblock; i++) { uc = (UChar)(s->tt[i] & 0xff); s->tt[s->cftab[uc]] |= (i << 8); s->cftab[uc]++; } s->tPos = s->tt[s->origPtr] >> 8; s->nblock_used = 0; if (s->blockRandomised) { BZ_RAND_INIT_MASK; BZ_GET_FAST(s->k0); s->nblock_used++; BZ_RAND_UPD_MASK; s->k0 ^= BZ_RAND_MASK; } else { BZ_GET_FAST(s->k0); s->nblock_used++; } } RETURN(BZ_OK); endhdr_2: GET_UCHAR(BZ_X_ENDHDR_2, uc); if (uc != 0x72) RETURN(BZ_DATA_ERROR); GET_UCHAR(BZ_X_ENDHDR_3, uc); if (uc != 0x45) RETURN(BZ_DATA_ERROR); GET_UCHAR(BZ_X_ENDHDR_4, uc); if (uc != 0x38) RETURN(BZ_DATA_ERROR); GET_UCHAR(BZ_X_ENDHDR_5, uc); if (uc != 0x50) RETURN(BZ_DATA_ERROR); GET_UCHAR(BZ_X_ENDHDR_6, uc); if (uc != 0x90) RETURN(BZ_DATA_ERROR); s->storedCombinedCRC = 0; GET_UCHAR(BZ_X_CCRC_1, uc); s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); GET_UCHAR(BZ_X_CCRC_2, uc); s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); GET_UCHAR(BZ_X_CCRC_3, uc); s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); GET_UCHAR(BZ_X_CCRC_4, uc); s->storedCombinedCRC = (s->storedCombinedCRC << 8) | ((UInt32)uc); s->state = BZ_X_IDLE; RETURN(BZ_STREAM_END); default: AssertH ( False, 4001 ); } AssertH ( False, 4002 ); save_state_and_return: s->save_i = i; s->save_j = j; s->save_t = t; s->save_alphaSize = alphaSize; s->save_nGroups = nGroups; s->save_nSelectors = nSelectors; s->save_EOB = EOB; s->save_groupNo = groupNo; s->save_groupPos = groupPos; s->save_nextSym = nextSym; s->save_nblockMAX = nblockMAX; s->save_nblock = nblock; s->save_es = es; s->save_N = N; s->save_curr = curr; s->save_zt = zt; s->save_zn = zn; s->save_zvec = zvec; s->save_zj = zj; s->save_gSel = gSel; s->save_gMinlen = gMinlen; s->save_gLimit = gLimit; s->save_gBase = gBase; s->save_gPerm = gPerm; return retVal; } /*-------------------------------------------------------------*/ /*--- end decompress.c ---*/ /*-------------------------------------------------------------*/