avfs-1.0.5/0000755000175000017500000000000013102441322012232 5ustar michaelmichaelavfs-1.0.5/config.h.in0000644000175000017500000001274013102441263014265 0ustar michaelmichael/* config.h.in. Generated from configure.ac by autoheader. */ /* Define if building universal (internal helper macro) */ #undef AC_APPLE_UNIVERSAL_BUILD /* Define to enable OpenSSL support */ #undef ENABLE_SSL /* Define to 1 if you have the `acl' function. */ #undef HAVE_ACL /* Define to 1 if you have the header file. */ #undef HAVE_ARPA_INET_H /* Define to 1 if you have the `atoll' function. */ #undef HAVE_ATOLL /* Define to 1 if you have the `creat64' function. */ #undef HAVE_CREAT64 /* 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 if you have expat */ #undef HAVE_EXPAT /* Define to 1 if you have the `getdents64' function. */ #undef HAVE_GETDENTS64 /* 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 liblzma installed */ #undef HAVE_LIBLZMA /* Define to 1 if you have the `pthread' library (-lpthread). */ #undef HAVE_LIBPTHREAD /* Define if you have libxml */ #undef HAVE_LIBXML /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the `lseek64' function. */ #undef HAVE_LSEEK64 /* 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 `open64' function. */ #undef HAVE_OPEN64 /* Define to 1 if you have the header file. */ #undef HAVE_REGEX_H /* Define to 1 if you have the `stat64' function. */ #undef HAVE_STAT64 /* Define to 1 if you have the header file. */ #undef HAVE_STDARG_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_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_SELECT_H /* 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_TIME_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 in which 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 /* Define to be the neon version string */ #undef NEON_VERSION /* Define to be major number of neon version */ #undef NEON_VERSION_MAJOR /* Define to be minor number of neon version */ #undef NEON_VERSION_MINOR /* 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 /* Support WebDAV locking through the library */ #undef USE_DAV_LOCKS /* 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 /* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most significant byte first (like Motorola and SPARC, unlike Intel). */ #if defined AC_APPLE_UNIVERSAL_BUILD # if defined __BIG_ENDIAN__ # define WORDS_BIGENDIAN 1 # endif #else # ifndef WORDS_BIGENDIAN # undef WORDS_BIGENDIAN # endif #endif /* 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 /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif avfs-1.0.5/zlib/0000755000175000017500000000000013102441322013172 5ustar michaelmichaelavfs-1.0.5/zlib/inffast.c0000644000175000017500000001321713102441254015000 0ustar michaelmichael/* 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.0.5/zlib/zconf.h0000644000175000017500000002267313102441254014500 0ustar michaelmichael/* 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.0.5/zlib/inflate.c0000644000175000017500000002656113102441254014776 0ustar michaelmichael/* 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.0.5/zlib/infcodes.c0000644000175000017500000002623613102441254015145 0ustar michaelmichael/* 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.0.5/zlib/infcodes.h0000644000175000017500000000172013102441254015141 0ustar michaelmichael/* 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.0.5/zlib/inftrees.c0000644000175000017500000003724413102441254015173 0ustar michaelmichael/* 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.0.5/zlib/Makefile.am0000644000175000017500000000074713102441254015242 0ustar michaelmichaelAM_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.0.5/zlib/infblock.c0000644000175000017500000003751613102441254015145 0ustar michaelmichael/* 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.0.5/zlib/deflate.c0000644000175000017500000013761213102441254014760 0ustar michaelmichael/* 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.0.5/zlib/zutil.c0000644000175000017500000001224113102441254014511 0ustar michaelmichael/* 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.0.5/zlib/infutil.c0000644000175000017500000000371713102441254015024 0ustar michaelmichael/* 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.0.5/zlib/trees.h0000644000175000017500000002037413102441254014477 0ustar michaelmichael/* 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.0.5/zlib/inffast.h0000644000175000017500000000075013102441254015003 0ustar michaelmichael/* 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.0.5/zlib/infblock.h0000644000175000017500000000267313102441254015146 0ustar michaelmichael/* 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.0.5/zlib/infutil.h0000644000175000017500000000713713102441254015031 0ustar michaelmichael/* 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.0.5/zlib/deflate.h0000644000175000017500000002661213102441254014762 0ustar michaelmichael/* 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.0.5/zlib/zutil.h0000644000175000017500000001275113102441254014524 0ustar michaelmichael/* 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.0.5/zlib/inffixed.h0000644000175000017500000002134013102441254015143 0ustar michaelmichael/* 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.0.5/zlib/inftrees.h0000644000175000017500000000507013102441254015170 0ustar michaelmichael/* 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.0.5/zlib/zlib.h0000644000175000017500000012072513102441254014316 0ustar michaelmichael/* 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.0.5/zlib/adler32.c0000644000175000017500000000242013102441254014574 0ustar michaelmichael/* 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.0.5/zlib/trees.c0000644000175000017500000012531113102441254014467 0ustar michaelmichael/* 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.0.5/zlib/Makefile.in0000644000175000017500000004665713102441265015267 0ustar michaelmichael# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp $(noinst_HEADERS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/neon-ssl.m4 \ $(top_srcdir)/macros/neon-xml-parser.m4 \ $(top_srcdir)/macros/neon.m4 $(top_srcdir)/macros/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) 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__depfiles_maybe = depfiles 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 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@ EMACS = @EMACS@ 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@ KERNINCLUDE = @KERNINCLUDE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEONLIBS = @NEONLIBS@ NEONOBJS = @NEONOBJS@ NEON_BUILD_BUNDLED = @NEON_BUILD_BUNDLED@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ NEON_OBJEXT = @NEON_OBJEXT@ NEON_TARGET = @NEON_TARGET@ 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@ PRELOAD_LIBS = @PRELOAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ XML_CONFIG = @XML_CONFIG@ 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@ avfscoda_build = @avfscoda_build@ 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@ initstyle = @initstyle@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ kmoduledir = @kmoduledir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ preload_build = @preload_build@ profiledir = @profiledir@ program_transform_name = @program_transform_name@ psdir = @psdir@ rcdir = @rcdir@ rcscriptdir = @rcscriptdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ start_levels = @start_levels@ start_prio = @start_prio@ stop_levels = @stop_levels@ stop_prio = @stop_prio@ 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 .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(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@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crc32.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/deflate.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/infblock.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/infcodes.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inffast.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inflate.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/inftrees.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/infutil.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/trees.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zutil.Plo@am__quote@ .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 $< .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 `$(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: $(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 -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-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 -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am 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 # 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.0.5/zlib/crc32.c0000644000175000017500000001555713102441254014273 0ustar michaelmichael/* 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.0.5/aclocal.m40000644000175000017500000124514113102441262014105 0ustar michaelmichael# generated automatically by aclocal 1.13.4 -*- Autoconf -*- # Copyright (C) 1996-2013 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, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is free software; the Free Software Foundation gives # unlimited permission to copy and/or distribute it, with or without # modifications, as long as this notice is preserved. m4_define([_LT_COPYING], [dnl # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. ]) # serial 57 LT_INIT # LT_PREREQ(VERSION) # ------------------ # Complain and exit if this libtool version is less that VERSION. m4_defun([LT_PREREQ], [m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, [m4_default([$3], [m4_fatal([Libtool version $1 or higher is required], 63)])], [$2])]) # _LT_CHECK_BUILDDIR # ------------------ # Complain if the absolute build directory name contains unusual characters m4_defun([_LT_CHECK_BUILDDIR], [case `pwd` in *\ * | *\ *) AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; esac ]) # LT_INIT([OPTIONS]) # ------------------ AC_DEFUN([LT_INIT], [AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT AC_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_CC_BASENAME(CC) # ------------------- # Calculate cc_basename. Skip known compiler wrappers and cross-prefix. m4_defun([_LT_CC_BASENAME], [for cc_temp in $1""; do case $cc_temp in compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` ]) # _LT_FILEUTILS_DEFAULTS # ---------------------- # It is okay to use these file commands and assume they have been set # sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. m4_defun([_LT_FILEUTILS_DEFAULTS], [: ${CP="cp -f"} : ${MV="mv -f"} : ${RM="rm -f"} ])# _LT_FILEUTILS_DEFAULTS # _LT_SETUP # --------- m4_defun([_LT_SETUP], [AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl 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 _LT_CONFIG_LIBTOOL_INIT([ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi ]) if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi _LT_CHECK_OBJDIR m4_require([_LT_TAG_COMPILER])dnl case $host_os in aix3*) # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi ;; esac # 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\\"\\\`\\\\\\"" ;; *) 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\\"\\\`\\\\\\"" ;; *) 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 $lt_write_fail = 0 && 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 "$silent" = yes && lt_config_lt_args="$lt_config_lt_args --quiet" exec AS_MESSAGE_LOG_FD>/dev/null $SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false exec AS_MESSAGE_LOG_FD>>config.log $lt_cl_success || AS_EXIT(1) ])# LT_OUTPUT # _LT_CONFIG(TAG) # --------------- # If TAG is the built-in tag, create an initial libtool script with a # default configuration from the untagged config vars. Otherwise add code # to config.status for appending the configuration named by TAG from the # matching tagged config vars. m4_defun([_LT_CONFIG], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl _LT_CONFIG_SAVE_COMMANDS([ m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl m4_if(_LT_TAG, [C], [ # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # _LT_COPYING _LT_LIBTOOL_TAGS # ### BEGIN LIBTOOL CONFIG _LT_LIBTOOL_CONFIG_VARS _LT_LIBTOOL_TAG_VARS # ### END LIBTOOL CONFIG _LT_EOF case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac _LT_PROG_LTMAIN # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) _LT_PROG_REPLACE_SHELLFNS mv -f "$cfgfile" "$ofile" || (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") chmod +x "$ofile" ], [cat <<_LT_EOF >> "$ofile" dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded dnl in a comment (ie after a #). # ### BEGIN LIBTOOL TAG CONFIG: $1 _LT_LIBTOOL_TAG_VARS(_LT_TAG) # ### END LIBTOOL TAG CONFIG: $1 _LT_EOF ])dnl /m4_if ], [m4_if([$1], [], [ PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile'], []) ])dnl /_LT_CONFIG_SAVE_COMMANDS ])# _LT_CONFIG # LT_SUPPORTED_TAG(TAG) # --------------------- # Trace this macro to discover what tags are supported by the libtool # --tag option, using: # autoconf --trace 'LT_SUPPORTED_TAG:$1' AC_DEFUN([LT_SUPPORTED_TAG], []) # C support is built-in for now m4_define([_LT_LANG_C_enabled], []) m4_define([_LT_TAGS], []) # LT_LANG(LANG) # ------------- # Enable libtool support for the given language if not already enabled. AC_DEFUN([LT_LANG], [AC_BEFORE([$0], [LT_OUTPUT])dnl m4_case([$1], [C], [_LT_LANG(C)], [C++], [_LT_LANG(CXX)], [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 $_lt_result -eq 0; then lt_cv_apple_cc_single_mod=yes else cat conftest.err >&AS_MESSAGE_LOG_FD fi rm -rf libconftest.dylib* rm -f conftest.* fi]) AC_CACHE_CHECK([for -exported_symbols_list linker flag], [lt_cv_ld_exported_symbols_list], [lt_cv_ld_exported_symbols_list=no save_LDFLAGS=$LDFLAGS echo "_main" > conftest.sym LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], [lt_cv_ld_exported_symbols_list=yes], [lt_cv_ld_exported_symbols_list=no]) LDFLAGS="$save_LDFLAGS" ]) 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 $_lt_result -eq 0 && $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 "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; 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 "$lt_cv_ld_force_load" = "yes"; 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*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; 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 "$lt_cv_apple_cc_single_mod" != "yes"; then _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" fi ],[]) else _LT_TAGVAR(ld_shlibs, $1)=no fi ]) # _LT_SYS_MODULE_PATH_AIX([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 "${lt_cv_aix_libpath+set}" = 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 which will find a shell with a builtin # printf (which 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], [ --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 "$GCC" = yes; 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 in which 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 "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then if test "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; 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 x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if AC_TRY_EVAL(ac_compile); then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-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 "$ac_status" -eq 0; then # Ensure the archiver fails upon bogus file names. rm -f conftest.$ac_objext libconftest.a AC_TRY_EVAL([lt_ar_try]) if test "$ac_status" -ne 0; then lt_cv_ar_at_file=@ fi fi rm -f conftest.* libconftest.a ]) ]) if test "x$lt_cv_ar_at_file" = xno; 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 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" # 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 x"[$]$2" = xyes; then m4_if([$5], , :, [$5]) else m4_if([$6], , :, [$6]) fi ])# _LT_COMPILER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) # _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, # [ACTION-SUCCESS], [ACTION-FAILURE]) # ---------------------------------------------------- # Check whether the given linker option works AC_DEFUN([_LT_LINKER_OPTION], [m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_SED])dnl AC_CACHE_CHECK([$1], [$2], [$2=no save_LDFLAGS="$LDFLAGS" LDFLAGS="$LDFLAGS $3" echo "$lt_simple_link_test_code" > conftest.$ac_ext if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then # The linker can only warn and ignore the option if not recognized # So say no if there are warnings if test -s conftest.err; then # Append any errors to the config.log. cat conftest.err 1>&AS_MESSAGE_LOG_FD $ECHO "$_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 x"[$]$2" = xyes; then m4_if([$4], , :, [$4]) else m4_if([$5], , :, [$5]) fi ])# _LT_LINKER_OPTION # Old name: AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) # LT_CMD_MAX_LEN #--------------- AC_DEFUN([LT_CMD_MAX_LEN], [AC_REQUIRE([AC_CANONICAL_HOST])dnl # find the maximum length of command line arguments AC_MSG_CHECKING([the maximum length of command line arguments]) AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl i=0 teststring="ABCD" case $build_os in msdosdjgpp*) # On DJGPP, this test can blow up pretty badly due to problems in libc # (any single argument exceeding 2000 bytes causes a buffer overrun # during glob expansion). Even if it were fixed, the result of this # check would be larger than it should be. lt_cv_sys_max_cmd_len=12288; # 12K is about right ;; gnu*) # Under GNU Hurd, this test is not required because there is # no limit to the length of command line arguments. # Libtool will interpret -1 as no limit whatsoever lt_cv_sys_max_cmd_len=-1; ;; cygwin* | mingw* | cegcc*) # On Win9x/ME, this test blows up -- it succeeds, but takes # about 5 minutes as the teststring grows exponentially. # Worse, since 9x/ME are not pre-emptively multitasking, # you end up with a "frozen" computer, even though with patience # the test eventually succeeds (with a max line length of 256k). # Instead, let's just punt: use the minimum linelength reported by # all of the supported platforms: 8192 (on NT/2K/XP). lt_cv_sys_max_cmd_len=8192; ;; 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; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; 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"; 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 $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac ]) if test -n $lt_cv_sys_max_cmd_len ; then AC_MSG_RESULT($lt_cv_sys_max_cmd_len) else AC_MSG_RESULT(none) fi max_cmd_len=$lt_cv_sys_max_cmd_len _LT_DECL([], [max_cmd_len], [0], [What is the maximum length of a command?]) ])# LT_CMD_MAX_LEN # Old name: AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) # _LT_HEADER_DLFCN # ---------------- m4_defun([_LT_HEADER_DLFCN], [AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl ])# _LT_HEADER_DLFCN # _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, # ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) # ---------------------------------------------------------------- m4_defun([_LT_TRY_DLOPEN_SELF], [m4_require([_LT_HEADER_DLFCN])dnl if test "$cross_compiling" = yes; then : [$4] else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_LT_EOF [#line $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 -fvisbility=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 "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | cegcc*) lt_cv_dlopen="LoadLibrary" lt_cv_dlopen_libs= ;; cygwin*) lt_cv_dlopen="dlopen" lt_cv_dlopen_libs= ;; darwin*) # if libdl is installed we need to link against it AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ lt_cv_dlopen="dyld" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ]) ;; *) AC_CHECK_FUNC([shl_load], [lt_cv_dlopen="shl_load"], [AC_CHECK_LIB([dld], [shl_load], [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], [AC_CHECK_FUNC([dlopen], [lt_cv_dlopen="dlopen"], [AC_CHECK_LIB([dl], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], [AC_CHECK_LIB([svld], [dlopen], [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], [AC_CHECK_LIB([dld], [dld_link], [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) ]) ]) ]) ]) ]) ;; esac if test "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" AC_CACHE_CHECK([whether a program can dlopen itself], lt_cv_dlopen_self, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) ]) if test "x$lt_cv_dlopen_self" = xyes; then wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" AC_CACHE_CHECK([whether a statically linked program can dlopen itself], lt_cv_dlopen_self_static, [dnl _LT_TRY_DLOPEN_SELF( lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) ]) fi CPPFLAGS="$save_CPPFLAGS" LDFLAGS="$save_LDFLAGS" LIBS="$save_LIBS" ;; esac case $lt_cv_dlopen_self in yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; *) enable_dlopen_self=unknown ;; esac case $lt_cv_dlopen_self_static in yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; *) enable_dlopen_self_static=unknown ;; esac fi _LT_DECL([dlopen_support], [enable_dlopen], [0], [Whether dlopen is supported]) _LT_DECL([dlopen_self], [enable_dlopen_self], [0], [Whether dlopen of programs is supported]) _LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], [Whether dlopen of statically linked programs is supported]) ])# LT_SYS_DLOPEN_SELF # Old name: AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) # _LT_COMPILER_C_O([TAGNAME]) # --------------------------- # Check to see if options -c and -o are simultaneously supported by compiler. # This macro does not hard code the compiler like AC_PROG_CC_C_O. m4_defun([_LT_COMPILER_C_O], [m4_require([_LT_DECL_SED])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_TAG_COMPILER])dnl AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no $RM -r conftest 2>/dev/null mkdir conftest cd conftest mkdir out echo "$lt_simple_compile_test_code" > conftest.$ac_ext lt_compiler_flag="-o out/conftest2.$ac_objext" # Insert the option either (1) after the last *FLAGS variable, or # (2) before a word containing "conftest.", or (3) at the end. # Note that $ac_compile itself does not contain backslashes and begins # with a dollar sign (not a hyphen), so the echo should work correctly. lt_compile=`echo "$ac_compile" | $SED \ -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ -e 's:$: $lt_compiler_flag:'` (eval echo "\"\$as_me:$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 "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then # do not overwrite the value of need_locks provided by the user AC_MSG_CHECKING([if we can lock with hard links]) hard_links=yes $RM conftest* ln conftest.a conftest.b 2>/dev/null && hard_links=no touch conftest.a ln conftest.a conftest.b 2>&5 || hard_links=no ln conftest.a conftest.b 2>/dev/null && hard_links=no AC_MSG_RESULT([$hard_links]) if test "$hard_links" = no; then AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) need_locks=warn fi else need_locks=no fi _LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) ])# _LT_COMPILER_FILE_LOCKS # _LT_CHECK_OBJDIR # ---------------- m4_defun([_LT_CHECK_OBJDIR], [AC_CACHE_CHECK([for objdir], [lt_cv_objdir], [rm -f .libs 2>/dev/null mkdir .libs 2>/dev/null if test -d .libs; then lt_cv_objdir=.libs else # MS-DOS does not allow filenames that begin with a dot. lt_cv_objdir=_libs fi rmdir .libs 2>/dev/null]) objdir=$lt_cv_objdir _LT_DECL([], [objdir], [0], [The name of the directory that contains temporary libtool files])dnl m4_pattern_allow([LT_OBJDIR])dnl AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", [Define to the sub-directory in which libtool stores uninstalled libraries.]) ])# _LT_CHECK_OBJDIR # _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) # -------------------------------------- # Check hardcoding attributes. m4_defun([_LT_LINKER_HARDCODE_LIBPATH], [AC_MSG_CHECKING([how to hardcode library paths into programs]) _LT_TAGVAR(hardcode_action, $1)= if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || test -n "$_LT_TAGVAR(runpath_var, $1)" || test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then # We can hardcode non-existent directories. if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then # Linking always hardcodes the temporary library directory. _LT_TAGVAR(hardcode_action, $1)=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. _LT_TAGVAR(hardcode_action, $1)=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. _LT_TAGVAR(hardcode_action, $1)=unsupported fi AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi _LT_TAGDECL([], [hardcode_action], [0], [How to hardcode a shared library path into an executable]) ])# _LT_LINKER_HARDCODE_LIBPATH # _LT_CMD_STRIPLIB # ---------------- m4_defun([_LT_CMD_STRIPLIB], [m4_require([_LT_DECL_EGREP]) striplib= old_striplib= AC_MSG_CHECKING([whether stripping libraries is possible]) if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" test -z "$striplib" && striplib="$STRIP --strip-unneeded" AC_MSG_RESULT([yes]) else # FIXME - insert some real tests, host_os isn't really good enough case $host_os in darwin*) if test -n "$STRIP" ; then striplib="$STRIP -x" old_striplib="$STRIP -S" AC_MSG_RESULT([yes]) else AC_MSG_RESULT([no]) fi ;; *) AC_MSG_RESULT([no]) ;; esac fi _LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) _LT_DECL([], [striplib], [1]) ])# _LT_CMD_STRIPLIB # _LT_SYS_DYNAMIC_LINKER([TAG]) # ----------------------------- # PORTME Fill in your ld.so characteristics m4_defun([_LT_SYS_DYNAMIC_LINKER], [AC_REQUIRE([AC_CANONICAL_HOST])dnl m4_require([_LT_DECL_EGREP])dnl m4_require([_LT_FILEUTILS_DEFAULTS])dnl m4_require([_LT_DECL_OBJDUMP])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_CHECK_SHELL_FEATURES])dnl AC_MSG_CHECKING([dynamic linker characteristics]) m4_if([$1], [], [ if test "$GCC" = yes; then case $host_os in darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; *) lt_awk_arg="/^libraries:/" ;; esac 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` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[[lt_foo]]++; } if (lt_freq[[lt_foo]] == 1) { print lt_foo; } }'` # 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 "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[[01]] | aix4.[[01]].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) 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%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[[45]]*) version_type=linux # 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} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[[01]]* | freebsdelf3.[[01]]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # 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=no hardcode_into_libs=yes ;; 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=yes 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 "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # 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 "$lt_cv_prog_gnu_ld" = yes; 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 ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-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 # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;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*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[[89]] | openbsd2.[[89]].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # 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 "$with_gnu_ld" = yes; 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=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # 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 "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi _LT_DECL([], [variables_saved_for_relink], [1], [Variables whose values should be saved in libtool wrapper scripts and restored at link time]) _LT_DECL([], [need_lib_prefix], [0], [Do we need the "lib" prefix for modules?]) _LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) _LT_DECL([], [version_type], [0], [Library versioning type]) _LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) _LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) _LT_DECL([], [shlibpath_overrides_runpath], [0], [Is shlibpath searched before the hard-coded library search path?]) _LT_DECL([], [libname_spec], [1], [Format of library name prefix]) _LT_DECL([], [library_names_spec], [1], [[List of archive names. First name is the real one, the rest are links. The last name is the one that the linker finds with -lNAME]]) _LT_DECL([], [soname_spec], [1], [[The coded name of the library, if different from the real name]]) _LT_DECL([], [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], [2], [Run-time system search path for libraries]) ])# _LT_SYS_DYNAMIC_LINKER # _LT_PATH_TOOL_PREFIX(TOOL) # -------------------------- # find a file program which can recognize shared library AC_DEFUN([_LT_PATH_TOOL_PREFIX], [m4_require([_LT_DECL_EGREP])dnl AC_MSG_CHECKING([for $1]) AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, [case $MAGIC_CMD in [[\\/*] | ?:[\\/]*]) lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. ;; *) lt_save_MAGIC_CMD="$MAGIC_CMD" lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR dnl $ac_dummy forces splitting on constant user-supplied paths. dnl POSIX.2 word splitting is done only on the output of word expansions, dnl not every word. This closes a longstanding sh security hole. ac_dummy="m4_if([$2], , $PATH, [$2])" for ac_dir in $ac_dummy; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f $ac_dir/$1; then lt_cv_path_MAGIC_CMD="$ac_dir/$1" if test -n "$file_magic_test_file"; then case $deplibs_check_method in "file_magic "*) file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | $EGREP "$file_magic_regex" > /dev/null; then : else cat <<_LT_EOF 1>&2 *** Warning: the command libtool uses to detect shared libraries, *** $file_magic_cmd, produces output that libtool cannot recognize. *** The result is that libtool may fail to recognize shared libraries *** as such. This will affect the creation of libtool libraries that *** depend on shared libraries, but programs linked with such libtool *** libraries will work regardless of this problem. Nevertheless, you *** may want to report the problem to your system manager and/or to *** bug-libtool@gnu.org _LT_EOF fi ;; esac fi break fi done IFS="$lt_save_ifs" MAGIC_CMD="$lt_save_MAGIC_CMD" ;; esac]) MAGIC_CMD="$lt_cv_path_MAGIC_CMD" if test -n "$MAGIC_CMD"; then AC_MSG_RESULT($MAGIC_CMD) else AC_MSG_RESULT(no) fi _LT_DECL([], [MAGIC_CMD], [0], [Used to examine libraries when file_magic_cmd begins with "file"])dnl ])# _LT_PATH_TOOL_PREFIX # Old name: AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) # _LT_PATH_MAGIC # -------------- # find a file program which can recognize a shared library m4_defun([_LT_PATH_MAGIC], [_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) if test -z "$lt_cv_path_MAGIC_CMD"; then if test -n "$ac_tool_prefix"; then _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) else MAGIC_CMD=: fi fi ])# _LT_PATH_MAGIC # LT_PATH_LD # ---------- # find the pathname to the GNU or non-GNU linker AC_DEFUN([LT_PATH_LD], [AC_REQUIRE([AC_PROG_CC])dnl AC_REQUIRE([AC_CANONICAL_HOST])dnl AC_REQUIRE([AC_CANONICAL_BUILD])dnl m4_require([_LT_DECL_SED])dnl m4_require([_LT_DECL_EGREP])dnl 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 "$withval" = no || with_gnu_ld=yes], [with_gnu_ld=no])dnl ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. AC_MSG_CHECKING([for ld used by $CC]) case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [[\\/]]* | ?:[[\\/]]*) re_direlt='/[[^/]][[^/]]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then AC_MSG_CHECKING([for GNU ld]) else AC_MSG_CHECKING([for non-GNU ld]) fi AC_CACHE_VAL(lt_cv_path_LD, [if test -z "$LD"; then lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$lt_save_ifs" test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then lt_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some variants of GNU ld only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$lt_cv_path_LD" -v 2>&1 &1 /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 ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; 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) 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*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac ]) file_magic_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 case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi]) if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$DUMPBIN"; then : # Let the user override the test. else AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) 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 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 "x$lt_cv_path_mainfest_tool" != xyes; then MANIFEST_TOOL=: fi _LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl ])# _LT_PATH_MANIFEST_TOOL # 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 "$GCC" = yes; 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 "$host_cpu" = ia64; then symcode='[[ABCDEGRST]]' fi ;; irix* | nonstopux*) symcode='[[BCDEGRST]]' ;; osf*) symcode='[[BCDEGQRST]]' ;; solaris*) symcode='[[BDRT]]' ;; sco3.2v5*) symcode='[[DT]]' ;; sysv4.2uw2*) symcode='[[DT]]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[[ABDT]]' ;; sysv4) symcode='[[DFNSTU]]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[[ABCDGIRSTW]]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK ['"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx]" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi 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 con'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* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_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 "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done ]) if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then AC_MSG_RESULT(failed) else AC_MSG_RESULT(ok) fi # 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_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_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 "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | os2* | pw32* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; *djgpp*) # DJGPP does not support shared libraries at all _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; 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 "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; chorus*) case $cc_basename in cxch68*) # Green Hills C++ Compiler # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" ;; esac ;; 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 "$host_cpu" != ia64; then _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' fi ;; aCC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac ;; *) ;; esac ;; interix*) # This is c89, which is MS Visual C++ (no shared libs) # Anyone wants to do a port? ;; irix5* | irix6* | nonstopux*) case $cc_basename in CC*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' # CC pic flag -KPIC is the default. ;; *) ;; esac ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in KCC*) # KAI C++ Compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; ecpc* ) # old Intel C++ for x86_64 which still supported -KPIC. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; icpc* ) # Intel C++, used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; pgCC* | pgcpp*) # Portland Group C++ compiler _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' ;; cxx*) # Compaq C++ # Make sure the PIC flag is empty. It appears that all Alpha # Linux and Compaq Tru64 Unix objects are PIC. _LT_TAGVAR(lt_prog_compiler_pic, $1)= _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; xlc* | xlC* | 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 "$GCC" = yes; then _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' ;; m68k) # FIXME: we need at least 68020 code to build shared libraries, but # adding the `-m68020' flag to GCC prevents building anything better, # like `-m68040'. _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' ;; esac ;; beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) # PIC is the default for these OSes. ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). # Although the cygwin gcc ignores -fPIC, still need this for old-style # (--disable-auto-import) libraries m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; darwin* | rhapsody*) # PIC is the default on this platform # Common symbols not allowed in MH_DYLIB files _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' ;; 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 "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' else _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' fi ;; mingw* | cygwin* | pw32* | os2* | cegcc*) # This hack is so that the source file can tell whether it is being # built for inclusion in a dll (and should export symbols for example). m4_if([$1], [GCJ], [], [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) ;; hpux9* | hpux10* | hpux11*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but # not for PA HP-UX. case $host_cpu in hppa*64*|ia64*) # +Z the default ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' ;; esac # Is there a better lt_prog_compiler_static that works with the bundled CC? _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' ;; irix5* | irix6* | nonstopux*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' # PIC (with -KPIC) is the default. _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' ;; linux* | k*bsd*-gnu | kopensolaris*-gnu) case $cc_basename in # old Intel for x86_64 which still supported -KPIC. ecc*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # icc used to be incompatible with GCC. # ICC 10 doesn't accept -KPIC any more. icc* | ifort*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' ;; # Lahey Fortran 8.1. lf95*) _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' ;; 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' ;; 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 which do not support PIC, -DPIC is meaningless: *djgpp*) _LT_TAGVAR(lt_prog_compiler_pic, $1)= ;; *) _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" ;; esac AC_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 AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global defined # symbols, whereas GNU nm marks them as "W". 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) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi ;; pw32*) _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" ;; cygwin* | mingw* | cegcc*) 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 "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac _LT_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 "$with_gnu_ld" = yes; 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 "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else _LT_TAGVAR(whole_archive_flag_spec, $1)= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[[3-9]]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then _LT_TAGVAR(ld_shlibs, $1)=no cat <<_LT_EOF 1>&2 *** Warning: the GNU linker, at least up to release 2.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 (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; 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 ;; interix[[3-9]]*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. # Instead, shared libraries are loaded at an image base (0x10000000 by # default) and relocated if they conflict, which is a slow very memory # consuming and fragmenting process. To avoid this, we pick a random, # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link # time. Moving up from 0x10000000 also allows more sbrk(2) space. _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' ;; gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) tmp_diet=no if test "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $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' ;; 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 "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | 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 "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $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 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; sunos4*) _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' wlarc= _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $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 "$_LT_TAGVAR(ld_shlibs, $1)" = no; then runpath_var= _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= _LT_TAGVAR(export_dynamic_flag_spec, $1)= _LT_TAGVAR(whole_archive_flag_spec, $1)= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(always_export_symbols, $1)=yes _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. _LT_TAGVAR(hardcode_minus_L, $1)=yes if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then # Neither direct hardcoding nor static linking is supported with a # broken collect2. _LT_TAGVAR(hardcode_direct, $1)=unsupported fi ;; aix[[4-9]]*) if test "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". 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) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi ;; esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$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 "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$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 "$with_gnu_ld" = yes; 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 # This is similar to how AIX traditionally builds its shared libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='' ;; m68k) _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac ;; bsdi[[45]]*) _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic ;; cygwin* | mingw* | pw32* | cegcc*) # When not using gcc, we currently assume that we are using # Microsoft Visual C++. # hardcode_libdir_flag_spec is actually meaningless, as there is # no search path for DLLs. 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~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $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 "$GCC" = yes; 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 $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: _LT_TAGVAR(hardcode_direct, $1)=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; 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 "$with_gnu_ld" = no; 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 "$GCC" = yes && test "$with_gnu_ld" = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $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 "$with_gnu_ld" = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. _LT_TAGVAR(hardcode_minus_L, $1)=yes ;; esac fi ;; irix5* | irix6* | nonstopux*) if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $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 "$lt_cv_irix_exported_symbol" = yes; 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 ;; 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*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' else case $host_os in openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' ;; esac fi else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; os2*) _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(allow_undefined_flag, $1)=unsupported _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && 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 "$GCC" = yes; 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 "$GCC" = yes; 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 "$GCC" = yes; then _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' else _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' fi ;; esac _LT_TAGVAR(link_all_deplibs, $1)=yes ;; sunos4*) if test "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4) case $host_vendor in sni) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' _LT_TAGVAR(hardcode_direct, $1)=no ;; motorola) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; sysv4.3*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes _LT_TAGVAR(ld_shlibs, $1)=yes fi ;; sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; sysv5* | sco3.2v5* | sco5v6*) # Note: We can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' if test "$GCC" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' else _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' fi ;; uts4*) _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(ld_shlibs, $1)=no ;; esac if test x$host_vendor = xsni; then case $host in sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' ;; esac fi fi ]) AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld _LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl _LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl _LT_DECL([], [extract_expsyms_cmds], [2], [The commands to extract the exported symbol list from a shared archive]) # # Do we need to explicitly link libc? # case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in x|xyes) # Assume -lc should be added _LT_TAGVAR(archive_cmds_need_lc, $1)=yes if test "$enable_shared" = yes && test "$GCC" = yes; then case $_LT_TAGVAR(archive_cmds, $1) in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. AC_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 which library types will actually be built AC_MSG_CHECKING([if libtool supports shared libraries]) AC_MSG_RESULT([$can_build_shared]) AC_MSG_CHECKING([whether to build shared libraries]) test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_CONFIG($1) fi AC_LANG_POP CC="$lt_save_CC" ])# _LT_LANG_C_CONFIG # _LT_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 "X$CXX" != "Xno" && ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || (test "X$CXX" != "Xg++"))) ; then AC_PROG_CXXCPP else _lt_caught_CXX_error=yes fi 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 "$_lt_caught_CXX_error" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="int some_variable = 0;" # Code to be used in simple link tests lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_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 "$GXX" = yes; then _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' else _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= fi if test "$GXX" = yes; then # Set up default GNU C++ configuration LT_PATH_LD # Check if GNU C++ uses GNU ld as the underlying linker, since the # archiving commands below assume that GNU ld is being used. if test "$with_gnu_ld" = yes; then _LT_TAGVAR(archive_cmds, $1)='$CC $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 "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) for ld_flag in $LDFLAGS; do case $ld_flag in *-brtl*) aix_use_runtimelinking=yes break ;; esac done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. _LT_TAGVAR(archive_cmds, $1)='' _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' if test "$GXX" = yes; then case $host_os in aix4.[[012]]|aix4.[[012]].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null then # We have reworked collect2 : else # We have old collect2 _LT_TAGVAR(hardcode_direct, $1)=unsupported # It fails to find uninstalled libraries when the uninstalled # path is not listed in the libpath. Setting hardcode_minus_L # to unsupported forces relinking _LT_TAGVAR(hardcode_minus_L, $1)=yes _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)= fi esac shared_flag='-shared' if test "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' # It seems that -bexpall does not export symbols beginning with # underscore (_), so it is better to generate a list of symbols to # export. _LT_TAGVAR(always_export_symbols, $1)=yes if test "$aix_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. _LT_TAGVAR(allow_undefined_flag, $1)='-berok' # Determine the default libpath from the value encoded in an empty # executable. _LT_SYS_MODULE_PATH_AIX([$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 "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" else # Determine the default libpath from the value encoded in an # empty executable. _LT_SYS_MODULE_PATH_AIX([$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 "$with_gnu_ld" = yes; 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 # This is similar to how AIX traditionally builds its shared # libraries. _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; beos*) if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then _LT_TAGVAR(allow_undefined_flag, $1)=unsupported # Joseph Beckenbach 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~linknames=' _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $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 (1st line # is EXPORTS), use it as is; otherwise, prepend... _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' else _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; darwin* | rhapsody*) _LT_DARWIN_LINKER_FEATURES($1) ;; dgux*) case $cc_basename in ec++*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; ghcx*) # Green Hills C++ Compiler # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; *) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; esac ;; 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 ;; gnu*) ;; 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 $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; 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 $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no fi ;; esac ;; hpux10*|hpux11*) if test $with_gnu_ld = no; then _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=: case $host_cpu in hppa*64*|ia64*) ;; *) _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' ;; esac fi case $host_cpu in hppa*64*|ia64*) _LT_TAGVAR(hardcode_direct, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no ;; *) _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, # but as the default # location of the library. ;; esac case $cc_basename in CC*) # FIXME: insert proper C++ library support _LT_TAGVAR(ld_shlibs, $1)=no ;; aCC*) case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; *) _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; esac # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. # # There doesn't appear to be a way to prevent this compiler from # explicitly linking system object files so we need to strip them # from the output so that they don't get included in the library # dependencies. output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' ;; *) if test "$GXX" = yes; then if test $with_gnu_ld = no; then case $host_cpu in hppa*64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' ;; ia64*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $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 "$GXX" = yes; then if test "$with_gnu_ld" = no; 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) 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 "x$supports_anon_versioning" = xyes; then _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi ;; *) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; 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 ;; openbsd2*) # C++ shared libraries are fairly broken _LT_TAGVAR(ld_shlibs, $1)=no ;; openbsd*) if test -f /usr/libexec/ld.so; then _LT_TAGVAR(hardcode_direct, $1)=yes _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_direct_absolute, $1)=yes _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' fi output_verbose_link_cmd=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 "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' case $host in osf3*) _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && 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 "$GXX" = yes && test "$with_gnu_ld" = no; then _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' if $CC --version | $GREP -v '^2\.7' > /dev/null; then _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -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 $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' # Commands to make compiler produce verbose output that lists # what "hidden" libraries, object files and flags are used when # linking a shared library. output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -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 can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' _LT_TAGVAR(archive_cmds_need_lc, $1)=no _LT_TAGVAR(hardcode_shlibpath_var, $1)=no _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' _LT_TAGVAR(hardcode_libdir_separator, $1)=':' _LT_TAGVAR(link_all_deplibs, $1)=yes _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' runpath_var='LD_RUN_PATH' case $cc_basename in CC*) _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' _LT_TAGVAR(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 "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no _LT_TAGVAR(GCC, $1)="$GXX" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" CC=$lt_save_CC 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 "$_lt_caught_CXX_error" != yes 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 ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; 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 $p = "-L" || test $p = "-R"; 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 "$pre_test_object_deps_done" = no; 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 "$pre_test_object_deps_done" = no; then if test -z "$_LT_TAGVAR(predep_objects, $1)"; then _LT_TAGVAR(predep_objects, $1)="$p" else _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" fi else if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then _LT_TAGVAR(postdep_objects, $1)="$p" else _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" fi fi ;; *) ;; # Ignore the rest. esac done # Clean up. rm -f a.out a.exe else echo "libtool.m4: error: problem compiling $1 test program" fi $RM -f confest.$objext 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)= ;; linux*) case `$CC -V 2>&1 | sed 5q` in *Sun\ C*) # Sun C++ 5.9 # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; solaris*) case $cc_basename in CC* | sunCC*) # The more standards-conforming stlport4 library is # incompatible with the Cstd library. Avoid specifying # it if it's in CXXFLAGS. Ignore libCrun as # -library=stlport4 depends on it. case " $CXX $CXXFLAGS " in *" -library=stlport4 "*) solaris_use_stlport4=yes ;; esac # Adding this requires a known-good setup of shared libraries for # Sun compiler versions before 5.6, else PIC objects from an old # archive will be linked into the output, leading to subtle bugs. if test "$solaris_use_stlport4" != yes; then _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' fi ;; esac ;; esac ]) case " $_LT_TAGVAR(postdeps, $1) " in *" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; esac _LT_TAGVAR(compiler_lib_search_dirs, $1)= if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` fi _LT_TAGDECL([], [compiler_lib_search_dirs], [1], [The directories searched by this compiler when creating a shared library]) _LT_TAGDECL([], [predep_objects], [1], [Dependencies to place before and after the objects being linked to create a shared library]) _LT_TAGDECL([], [postdep_objects], [1]) _LT_TAGDECL([], [predeps], [1]) _LT_TAGDECL([], [postdeps], [1]) _LT_TAGDECL([], [compiler_lib_search_path], [1], [The library search path used internally by the compiler when linking a shared library]) ])# _LT_SYS_HIDDEN_LIBDEPS # _LT_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 "X$F77" = "Xno"; 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 "$_lt_disable_F77" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC 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 "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$G77" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC="$lt_save_CC" CFLAGS="$lt_save_CFLAGS" fi # test "$_lt_disable_F77" != yes 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 "X$FC" = "Xno"; 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 "$_lt_disable_FC" != yes; then # Code to be used in simple compile tests lt_simple_compile_test_code="\ subroutine t return end " # Code to be used in simple link tests lt_simple_link_test_code="\ program t end " # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC="$CC" lt_save_GCC=$GCC 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 "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[[4-9]]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac AC_MSG_RESULT([$enable_shared]) AC_MSG_CHECKING([whether to build static libraries]) # Make sure either enable_shared or enable_static is yes. test "$enable_shared" = yes || enable_static=yes AC_MSG_RESULT([$enable_static]) _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" _LT_TAGVAR(LD, $1)="$LD" ## CAVEAT EMPTOR: ## There is no encapsulation within the following macros, do not change ## the running order or otherwise move them around unless you know exactly ## what you are doing... _LT_SYS_HIDDEN_LIBDEPS($1) _LT_COMPILER_PIC($1) _LT_COMPILER_C_O($1) _LT_COMPILER_FILE_LOCKS($1) _LT_LINKER_SHLIBS($1) _LT_SYS_DYNAMIC_LINKER($1) _LT_LINKER_HARDCODE_LIBPATH($1) _LT_CONFIG($1) fi # test -n "$compiler" GCC=$lt_save_GCC CC=$lt_save_CC CFLAGS=$lt_save_CFLAGS fi # test "$_lt_disable_FC" != yes AC_LANG_POP ])# _LT_LANG_FC_CONFIG # _LT_LANG_GCJ_CONFIG([TAG]) # -------------------------- # Ensure that the configuration variables for the GNU Java Compiler compiler # are suitably defined. These variables are subsequently used by _LT_CONFIG # to write the compiler configuration to `libtool'. m4_defun([_LT_LANG_GCJ_CONFIG], [AC_REQUIRE([LT_PROG_GCJ])dnl AC_LANG_SAVE # Source file extension for Java test sources. ac_ext=java # Object file extension for compiled Java test sources. objext=o _LT_TAGVAR(objext, $1)=$objext # Code to be used in simple compile tests lt_simple_compile_test_code="class foo {}" # Code to be used in simple link tests lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' # ltmain only uses $CC for tagged configurations so make sure $CC is set. _LT_TAG_COMPILER # save warnings/boilerplate of simple test code _LT_COMPILER_BOILERPLATE _LT_LINKER_BOILERPLATE # Allow CC to be a program name with arguments. lt_save_CC=$CC lt_save_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 "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" AC_SUBST(GCJFLAGS)])])[]dnl ]) # Old name: AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_GCJ], []) # LT_PROG_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 $lt_ac_count -gt 10 && break lt_ac_count=`expr $lt_ac_count + 1` if test $lt_ac_count -gt $lt_ac_max; then lt_ac_max=$lt_ac_count lt_cv_path_SED=$lt_ac_sed fi done done ]) SED=$lt_cv_path_SED AC_SUBST([SED]) AC_MSG_RESULT([$SED]) ])#AC_PROG_SED ])#m4_ifndef # Old name: AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([LT_AC_PROG_SED], []) # _LT_CHECK_SHELL_FEATURES # ------------------------ # Find out whether the shell is Bourne or XSI compatible, # or has some other useful features. m4_defun([_LT_CHECK_SHELL_FEATURES], [AC_MSG_CHECKING([whether the shell understands some XSI constructs]) # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes AC_MSG_RESULT([$xsi_shell]) _LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) AC_MSG_CHECKING([whether the shell understands "+="]) lt_shell_append=no ( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes AC_MSG_RESULT([$lt_shell_append]) _LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then lt_unset=unset else lt_unset=false fi _LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl # test EBCDIC or ASCII case `echo X|tr X '\101'` in A) # ASCII based system # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr lt_SP2NL='tr \040 \012' lt_NL2SP='tr \015\012 \040\040' ;; *) # EBCDIC based system lt_SP2NL='tr \100 \n' lt_NL2SP='tr \r\n \100\100' ;; esac _LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl _LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl ])# _LT_CHECK_SHELL_FEATURES # _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) # ------------------------------------------------------ # In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and # '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. m4_defun([_LT_PROG_FUNCTION_REPLACE], [dnl { sed -e '/^$1 ()$/,/^} # $1 /c\ $1 ()\ {\ m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) } # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: ]) # _LT_PROG_REPLACE_SHELLFNS # ------------------------- # Replace existing portable implementations of several shell functions with # equivalent extended shell implementations where those features are available.. m4_defun([_LT_PROG_REPLACE_SHELLFNS], [if test x"$xsi_shell" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl case ${1} in */*) func_dirname_result="${1%/*}${2}" ;; * ) func_dirname_result="${3}" ;; esac func_basename_result="${1##*/}"]) _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are # positional parameters, so assign one to ordinary parameter first. func_stripname_result=${3} func_stripname_result=${func_stripname_result#"${1}"} func_stripname_result=${func_stripname_result%"${2}"}]) _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl func_split_long_opt_name=${1%%=*} func_split_long_opt_arg=${1#*=}]) _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl func_split_short_opt_arg=${1#??} func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl case ${1} in *.lo) func_lo2o_result=${1%.lo}.${objext} ;; *) func_lo2o_result=${1} ;; esac]) _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) fi if test x"$lt_shell_append" = xyes; then _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl func_quote_for_eval "${2}" dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) fi ]) # _LT_PATH_CONVERSION_FUNCTIONS # ----------------------------- # Determine which 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, 2008, 2009 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 7 ltoptions.m4 # This is to help aclocal find these macros, as it can't see m4_define. AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) # _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) # ------------------------------------------ m4_define([_LT_MANGLE_OPTION], [[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) # _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) # --------------------------------------- # Set option OPTION-NAME for macro MACRO-NAME, and if there is a # matching handler defined, dispatch to it. Other OPTION-NAMEs are # saved as a flag. m4_define([_LT_SET_OPTION], [m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), _LT_MANGLE_DEFUN([$1], [$2]), [m4_warning([Unknown $1 option `$2'])])[]dnl ]) # _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) # ------------------------------------------------------------ # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. m4_define([_LT_IF_OPTION], [m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) # _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) # ------------------------------------------------------- # Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME # are set. m4_define([_LT_UNLESS_OPTIONS], [m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), [m4_define([$0_found])])])[]dnl m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 ])[]dnl ]) # _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) # ---------------------------------------- # OPTION-LIST is a space-separated list of Libtool options associated # with MACRO-NAME. If any OPTION has a matching handler declared with # LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about # the unknown option and exit. m4_defun([_LT_SET_OPTIONS], [# Set options m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), [_LT_SET_OPTION([$1], _LT_Option)]) m4_if([$1],[LT_INIT],[ dnl dnl Simply set some default values (i.e off) if boolean options were not dnl specified: _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no ]) _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no ]) dnl dnl If no reference was made to various pairs of opposing options, then dnl we run the default mode handler for the pair. For example, if neither dnl `shared' nor `disable-shared' was passed, we enable building of shared dnl archives by default: _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], [_LT_ENABLE_FAST_INSTALL]) ]) ])# _LT_SET_OPTIONS # _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_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=default]) test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) _LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl ])# _LT_WITH_PIC LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) # Old name: AU_DEFUN([AC_LIBTOOL_PICMODE], [_LT_SET_OPTION([LT_INIT], [pic-only]) AC_DIAGNOSE([obsolete], [$0: Remove this warning and the call to _LT_SET_OPTION when you put the `pic-only' option into LT_INIT's first parameter.]) ]) dnl aclocal-1.4 backwards compatibility: dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) 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 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 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 3337 ltversion.m4 # This file is part of GNU Libtool m4_define([LT_PACKAGE_VERSION], [2.4.2]) m4_define([LT_PACKAGE_REVISION], [1.3337]) AC_DEFUN([LTVERSION_VERSION], [macro_version='2.4.2' macro_revision='1.3337' _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 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-2013 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.13' 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.13.4], [], [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.13.4])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-2013 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-2013 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-2013 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-2013 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. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each '.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996-2013 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. # 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_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([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. 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 ]) 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-2013 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}" != 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-2013 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-2013 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 to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997-2013 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 case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --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-2013 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])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996-2013 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-2013 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-2013 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-2013 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-2013 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/neon-ssl.m4]) m4_include([macros/neon-xml-parser.m4]) m4_include([macros/neon.m4]) m4_include([macros/pkg.m4]) avfs-1.0.5/missing0000755000175000017500000001533113102441264013641 0ustar michaelmichael#! /bin/sh # Common wrapper for a few potentially missing GNU programs. scriptversion=2012-06-26.16; # UTC # Copyright (C) 1996-2013 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=http://www.perl.org/ flex_URL=http://flex.sourceforge.net/ gnu_software_URL=http://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 'automa4te' 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 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: avfs-1.0.5/doc/0000755000175000017500000000000013102441322012777 5ustar michaelmichaelavfs-1.0.5/doc/INSTALL.preload0000644000175000017500000000644013102441254015465 0ustar michaelmichaelAt the moment the preload method only works for Solaris, but it should not be too hard to port it to other architectures supporting LD_PRELOAD. Unfortunately it is nearly impossible to make the preload method work under GLIBC versions >= 2.1, so don't expect this to be done. How To Install -------------- To compile type ./configure make To install, log in as root and type make install This will install the 'avfs_server' program in '/usr/lib/avfs/' and the 'avfs_preload.so' shared library in '/usr/lib/'. 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 either pass '--prefix' a directory that you own (for example your home directory), or copy the files manually. The avfs_server is started automatically, whenever it is first needed. If you used 'make install' to install the components, avfs should find the server automatically. Otherwise you will need to set the AVFS_SERVER_PATH environment variable to the complete pathname of the server (e.g. 'setenv AVFS_SERVER_PATH=/foo/bar/avfs_server') Enabling AVFS ------------- To enable AVFS support, set the environment variable LD_PRELOAD to avfs_preload.so: in C-shell type shells (csh, tcsh, ...) setenv LD_PRELOAD avfs_preload.so or setenv LD_PRELOAD /usr/lib/avfs_preload.so in Bourne-shell type shells (sh, bash, ...) export LD_PRELOAD=avfs_preload.so or export LD_PRELOAD=/usr/lib/avfs_preload.so You can try it out by entering the command ls /#avfsstat Having AVFS Permanently In Your System -------------------------------------- Simple method: - - - - - - - - If you want to have AVFS permanently, you could set the LD_PRELOAD variable in your '.profile' or '.tcshrc', but note, that this way the shell will still be started without AVFS, so no 'cd'-ing until you start a subshell. AVFS for the X desktop: - - - - - - - - - - - - A better solution is to set LD_PRELOAD for the window manager, or desktop manager. To do this you should set the variable in .xinitrc or .Xclients before the window manager is started. This way you'll have AVFS functionality in everything. For example your .Xclients could look like this: ---------------------------------------------------------------------- #!/bin/bash # add any local customizations here, before startke runs export LD_PRELOAD=avfs_preload.so /opt/kde/bin/startkde ---------------------------------------------------------------------- AVFS in login shells for all users: - - - - - - - - - - - - - - - - - - You could also have a look at the 'csh.login-beginning' and the 'profile-beginning' scripts written by Egmont Koblinger in the 'misc' directory. You can insert these at the beginning of the /etc/csh.login and /etc/profile scripts respectively. These scripts start a new shell with AVFS access on login, so you can 'cd' into virtual directories in your login shell. The scripts set AVFS access for all users except root. Users can disable AVFS by creating a '.no_avfs' file in their home directory. How Does It Work ---------------- The 'preload' method works by "overriding" the system calls in the libc library, and replacing them with versions that can emulate virtual files. avfs-1.0.5/doc/Makefile.am0000644000175000017500000000022013102441254015031 0ustar michaelmichaelEXTRA_DIST = FORMAT \ INSTALL.avfscoda \ INSTALL.preload \ INSTALL.library \ INSTALL.fuse \ api-overview \ background \ README.avfs-fuse avfs-1.0.5/doc/api-overview0000644000175000017500000004204013102441254015343 0ustar michaelmichaelAVFS 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.0.5/doc/INSTALL.avfscoda0000644000175000017500000002175713102441254015635 0ustar michaelmichael --------------------------------------------------------------- WARNING WARNING WARNING WARNING WARNING WARNING --------------------------------------------------------------- Avfscoda changes the behavior of the kernel. This change is simple, and in theory it is quite harmless, but regardless you should be aware! Backing up important data is always a good idea. This is alpha software, you should _NOT_INSTALL_ avfscoda on important servers! Avfscoda has been designed with security in mind, but it may not yet be 100% secure. Do not install it, if local security is very important (i.e. if you do not want a non root user to be able gain root access)! A Little Background ------------------- Well brave one, enter the wonderful world of avfscoda. If you have used AVFS with the 'preload' method, you should be pleasantly surprised by avfscoda. It is much faster (things remain cached between command invocations), there is no need to mess with the LD_PRELOAD variable, and more things should work (most notably the input/output redirection). However there are drawbacks (apart from the alpha nature of the software): - virtual file writing does not work yet - there is a kernel module involved which must be recompiled for each new kernel that you install How To Install -------------- First you must make sure that the coda module is compiled into the kernel, or is available as a kernel module (see chapter 'Troubleshooting' point 3). Most distributions do have coda as a kernel module, but if you compile your own kernel, then you need to enable CODA support! Check, if there is an RPM package for the realase + distribution that you are using. For example 'avfs-VVV-redhat60.i386.rpm' should work with vanila RedHat 6.0 distributions. To install the RPM package, log in as root, and type: rpm -Uvh avfs-VVV-DDD.i386.rpm And that is it. The binary avfscoda distribution depends on the exact kernel version used, so if you installed a new kernel, you must get the avfs source and compile it. See the section 'How to compile' If you are not sure, that the RPM version matched your kernel, then after installing the RPM type: /sbin/lsmod To see if the 'redir' module is inserted in the kernel. If there is a line beggining with 'redir' then you are OK. If not then you need to recompile avfscoda. Enabling AVFS ------------- After installing AVFS login in a new shell. In a shell, type 'avfs-on'. Then type 'avfs-stat'. It should write version and copyright information. If not, then see the section 'Troubleshooting'. If you want to enable avfs by default, create a '.avfs' file in your home directory by typing touch ~/.avfs After this avfs should be turned on by default when you log in. To turn avfs off in your shell, type 'avfs-off'. After this 'avfs-stat' should not write anything. How To Compile -------------- 1) Untar the source tree. 2) Type './configure'. It should detect that avfscoda should be built: checking whether to build preload or avfscoda... avfscoda If for some reason it does not, you can force it by adding '--disable-preload' argument to configure. If the configure script cannot find an xml library for dav, then you have two options: - install an xml library (expat or gnome-xml) or - pass the '--disable-dav' argument to configure 3) Do 'make' 4) Log in as root, and type 'make install' to complete the installation 5) Do 'make start' to start the avfscoda daemon and insert the redirection module Hopefully everything is set. Now you can go onto the 'Enabling AVFS' section. Troubleshooting --------------- Avfscoda is installed and started in quite a complex way. So many things could go wrong in the installation. The following lists the things you could check. If you find something wrong, please report it, so I can improve the installation method. (This is also a guide on how to install avfscoda by hand, if you should want to do that). 1) Check if the '/overlay' directory exists: If not, then create it: mkdir /overlay 2) Check if the CODA device, '/dev/cfs0' exists: 'ls -l /dev/cfs*' should show it like this: crw------- 1 root root 67, 0 Jan 20 1999 /dev/cfs0 crw------- 1 root root 67, 1 Jan 20 1999 /dev/cfs1 If not, then you need to create it with the command: mknod -m 600 /dev/cfs0 c 67 0 mknod -m 600 /dev/cfs1 c 67 1 3) Check if the CODA filesystem is in your kernel: cat /proc/filesystems If coda is listed, then OK, if not try inserting the coda module first: modprobe coda If coda is not in the kernel or as a kernel module, then you need to enable CODA filesystem support in the kernel, and recompile the kernel (see /usr/src/linux/README). 4) Check if the avfscoda daemon is running: ps axw | grep avfscoda It should find at least 2 processes with the name 'avfscoda' running. If not you could try to start it by hand: /usr/sbin/avfscoda 5) Check if the overlay directory is mounted and virtual files are accessible. ls /overlay/#avfsstat If not, then there is probably something wrong with the coda filesystem, or the avfsocda module (see 1-4). 6) Check if the 'redir' module is inserted in the kernel: /sbin/lsmod If 'redir' is not in the kernel try inserting it by hand (as root): insmod /lib/modules/your_kernel_version/misc/redir.o If redir.o is not in that directory, or if insmod prints something about the kernel version not matching, then you need to recompile avfscoda (see the section 'How to compile'). 7) Check if you can access virtual files: cat /#avfsstat/copyright ls -al targzfile.tgz#/ If not, then try to turn on AVFS in your shell: cd /#avfs-on It should print 'cd: /#avfs-on: File exists', if not then the redirection module probably does not work (see 6). 8) Check handlers: cat /#avfsstat/modules This should list all supported handlers. If things like "rpm" and "deb" are not listed, then the 'extfs' modules have not been installed. You can do this by copying the extfs directiory from the source to /usr/lib/avfs. 9) Check if 'avfs-on', 'avfs-off' and 'avfs-stat' work. If not, try to login in a new shell. If they still not work, then the shell login script probably did not include the file which defines these aliases. Copy the 'avfscoda.sh' and 'avfscoda.csh' files from the 'scripts' directory of the source distribution to /etc/profile.d. If there is no /etc/profile.d, you may try to edit the files /etc/profile, and /etc/csh.cshrc and source the files 'avfscoda.sh' and 'avfscoda.csh' respectively: /etc/csh.cshrc: ------------------------------------------------------------------------------- # /etc/csh.cshrc: system-wide .cshrc file for csh(1)/tcsh(1). ..... if ( -f /etc/avfscoda.csh ) then source /etc/avfscoda.csh endif ------------------------------------------------------------------------------- /etc/profile: ------------------------------------------------------------------------------- # /etc/profile: system-wide .profile file for the Bourne shell (sh(1)) ..... if [ -f /etc/avfscoda.sh ]; then source /etc/avfscoda.sh fi ------------------------------------------------------------------------------- How Does It Work ---------------- Avfscoda works by mounting the whole root filesystem, plus the virtual files in the directory '/overlay', through the CODA filesystem client. It would be very inconvenient to always have to switch to the '/overlay' directory, when you need a virtual file, so there is a redirector module, which intercepts system calls with a path parameter (e.g. open(), stat(), etc.), and checks if it is a virtual file. If it is, it prefixes the path with '/overlay'. There is also a per-process flag, that indicates whether that process should have avfs functionality or not. If this flag is not set, then the redirector module will not examine or change the paths. Here is a diagram, of how avfscoda works: +----------------------------------------+ |kernel other filesystems | | : | | +-----------+ : | | |CODA | +-----------+ | | |filesystem |.........|redirector | | | |module | |module | | | +-----------+ +-----------+ | | | | | +------|---------------------|-----------+ | | +-----------+ | |avfscoda | Your program |daemon | +-----------+ The avfscoda daemon is started by an init-script at the startup of the operating system. The redirector module is also loaded at the same time. The avfs-flag is turned on by the shell's init script, depending on whether the user has a '.avfs' in its home directory or not. This flag can be turned on or off later by the user. avfs-1.0.5/doc/INSTALL.fuse0000644000175000017500000000226513102441254015002 0ustar michaelmichaelThe 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.0.5/doc/background0000644000175000017500000001553413102441254015055 0ustar michaelmichaelBACKGROUND 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.0.5/doc/INSTALL.library0000644000175000017500000000140613102441254015500 0ustar michaelmichaelIntroduction ------------ In contrast to the avfscoda or preload code using 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.0.5/doc/FORMAT0000644000175000017500000000415113102441254013717 0ustar michaelmichaelHere 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.0.5/doc/README.avfs-fuse0000644000175000017500000000747413102441254015575 0ustar michaelmichaelNovember 2005 May 2006 (updated) This version of AVFS includes support for fuse (Filesystems in userspace). The other versions of AVFS, preload, library, and coda, do NOT have to be installed since they are not supported by applications and are unsupported in kernels >2.6.x or glibc > 2.1. Any user wishing to install the library may do so but will have to write his/her own program interface to it. 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 or coda methods. 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.0.5/doc/Makefile.in0000644000175000017500000003131413102441264015053 0ustar michaelmichael# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/neon-ssl.m4 \ $(top_srcdir)/macros/neon-xml-parser.m4 \ $(top_srcdir)/macros/neon.m4 $(top_srcdir)/macros/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) 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) 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@ EMACS = @EMACS@ 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@ KERNINCLUDE = @KERNINCLUDE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEONLIBS = @NEONLIBS@ NEONOBJS = @NEONOBJS@ NEON_BUILD_BUNDLED = @NEON_BUILD_BUNDLED@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ NEON_OBJEXT = @NEON_OBJEXT@ NEON_TARGET = @NEON_TARGET@ 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@ PRELOAD_LIBS = @PRELOAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ XML_CONFIG = @XML_CONFIG@ 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@ avfscoda_build = @avfscoda_build@ 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@ initstyle = @initstyle@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ kmoduledir = @kmoduledir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ preload_build = @preload_build@ profiledir = @profiledir@ program_transform_name = @program_transform_name@ psdir = @psdir@ rcdir = @rcdir@ rcscriptdir = @rcscriptdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ start_levels = @start_levels@ start_prio = @start_prio@ stop_levels = @stop_levels@ stop_prio = @stop_prio@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = FORMAT \ INSTALL.avfscoda \ INSTALL.preload \ 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 .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(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: $(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 # 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.0.5/configure0000755000175000017500000171423013102441265014157 0ustar michaelmichael#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for avfs 1.0.5. # # # 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.0.5' PACKAGE_STRING='avfs 1.0.5' 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_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS shared_build preload_build avfscoda_build install_scriptcomps VERSIONSCRIPT_OPTS BUILD_SHARED_FALSE BUILD_SHARED_TRUE INSTALL_CODADEV_FALSE INSTALL_CODADEV_TRUE INSTALL_SCRIPTLINKS_FALSE INSTALL_SCRIPTLINKS_TRUE INSTALL_INITSCRIPT_FALSE INSTALL_INITSCRIPT_TRUE INSTALL_AVFSCODA_FALSE INSTALL_AVFSCODA_TRUE INSTALL_AVFSCODA_PROFILE_FALSE INSTALL_AVFSCODA_PROFILE_TRUE INSTALL_FUSE_FALSE INSTALL_FUSE_TRUE USE_LIBLZMA_FALSE USE_LIBLZMA_TRUE LIBLZMA_LIBS LIBLZMA_CFLAGS FUSELIBS LIBFUSE_LIBS LIBFUSE_CFLAGS profiledir stop_prio start_prio stop_levels start_levels rcscriptdir rcdir initstyle kmoduledir KERNINCLUDE INSTALL_PRELOAD_FALSE INSTALL_PRELOAD_TRUE PRELOAD_LIBS INSTALL_EMACS_FALSE INSTALL_EMACS_TRUE PERL HAVE_ZIPINFO UNZIP ZIP EMACS moduledir LIBDAV DAV_LS DAV BUILD_DAVSUPPORT_FALSE BUILD_DAVSUPPORT_TRUE BUILD_NEON_LIB_FALSE BUILD_NEON_LIB_TRUE XML_CONFIG NEON_LINK_FLAGS NEONOBJS NEON_OBJEXT NEON_TARGET NEONLIBS NEON_BUILD_BUNDLED LIBOBJS ZLIB_CFLAGS PKG_CONFIG 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__quote am__include DEPDIR OBJEXT EXEEXT ac_ct_CC CPPFLAGS LDFLAGS CFLAGS CC 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' ac_subst_files='' ac_user_opts=' enable_option_checking enable_silent_rules enable_preload enable_avfscoda enable_library enable_fuse enable_debug enable_dav with_system_zlib with_system_bzlib enable_dependency_tracking enable_shared enable_static with_pic enable_fast_install with_gnu_ld with_sysroot enable_libtool_lock enable_largefile with_included_neon with_neon with_ssl enable_libxml with_expat with_kernel enable_fuse_test with_xz ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP PKG_CONFIG LIBFUSE_CFLAGS LIBFUSE_LIBS LIBLZMA_CFLAGS LIBLZMA_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.0.5 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.0.5:";; 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-preload Compile the preloaded library and server --enable-avfscoda Compile avfscoda (which uses the coda interface) --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 (needs an xml library) --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 --enable-libxml force use of libxml --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-pic[=PKGS] try to use only PIC/non-PIC objects [default=use both] --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-included-neon Force use of included neon library --with-neon Specify location of neon library --with-ssl=DIR enable OpenSSL support --with-expat=DIR specify Expat location --with-kernel Specify location of kernel source --with-xz use xz (default is YES, force to always enable) 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 PKG_CONFIG path to pkg-config utility 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 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.0.5 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.0.5, 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 # 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.13' 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 case $am_aux_dir in *\ * | *\ *) MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; *) MISSING="\${SHELL} $am_aux_dir/missing" ;; esac fi # Use eval to expand $SHELL if eval "$MISSING --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}" != 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.0.5' 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. 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 -' 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.0.5 NUMVERSION=105 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 preload, avfscoda, shared library and/or fuse daemon" >&5 $as_echo_n "checking whether to build preload, avfscoda, shared library and/or fuse daemon... " >&6; } shared=yes if test "$os" = "Linux"; then if test "$kernver" -ge "22" \ -a "$kernver" -le "24"; then avfscoda=yes else fuse=yes fi elif test "$os" = "SunOS"; then preload=yes fi # Check whether --enable-preload was given. if test "${enable_preload+set}" = set; then : enableval=$enable_preload; if test "$enableval" = yes; then preload=yes; else preload=no; fi fi # Check whether --enable-avfscoda was given. if test "${enable_avfscoda+set}" = set; then : enableval=$enable_avfscoda; if test "$enableval" = yes; then avfscoda=yes; else avfscoda=no; fi 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 avfscoda_build=no preload_build=no fuse_build=no build_result= if test "$avfscoda" = yes; then avfscoda_build=yes build_result=avfscoda fi if test "$preload" = yes; then preload_build=yes if test -z "$build_result"; then build_result=preload else build_result="$build_result preload" fi fi 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=no 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 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 DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo this is the am__doit target .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 $as_echo_n "checking for style of include used by $am_make... " >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # Ignore all kinds of additional output from 'make'. case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=include am__quote= _am_result=GNU ;; esac # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf case `$am_make -s -f confmf 2> /dev/null` in #( *the\ am__doit\ target*) am__include=.include am__quote="\"" _am_result=BSD ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 $as_echo "$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then : enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' 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.2' macro_revision='1.3337' 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 "$withval" = no || with_gnu_ld=yes else with_gnu_ld=no fi ac_prog=ld if test "$GCC" = yes; then # Check if gcc -print-prog-name=ld gives a path. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 $as_echo_n "checking for ld used by $CC... " >&6; } case $host in *-*-mingw*) # gcc leaves a trailing carriage return which upsets mingw ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; *) ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; esac case $ac_prog in # Accept absolute paths. [\\/]* | ?:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the pathname of ld ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 $as_echo_n "checking for GNU ld... " >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 $as_echo_n "checking for non-GNU ld... " >&6; } fi if ${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 case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in */dev/null* | *'Invalid file or object type'*) lt_cv_path_NM="$tmp_nm -B" break ;; *) case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in */dev/null*) lt_cv_path_NM="$tmp_nm -p" break ;; *) lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but continue # so that we can try to find one that supports BSD flags ;; esac ;; esac fi done IFS="$lt_save_ifs" done : ${lt_cv_path_NM=no} fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 $as_echo "$lt_cv_path_NM" >&6; } if test "$lt_cv_path_NM" != "no"; then NM="$lt_cv_path_NM" else # Didn't find any BSD compatible name lister, look for dumpbin. if test -n "$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 /dev/null 2>&1 | sed '1q'` in *COFF*) DUMPBIN="$DUMPBIN -symbols" ;; *) 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; ;; netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) # This has been around since 386BSD, at least. Likely further. if test -x /sbin/sysctl; then lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` elif test -x /usr/sbin/sysctl; then lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` else lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs fi # And add a safety zone lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` ;; interix*) # We know the value 262144 and hardcode it with a safety zone (like BSD) lt_cv_sys_max_cmd_len=196608 ;; 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"; 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 $i != 17 # 1/2 MB should be enough do i=`expr $i + 1` teststring=$teststring$teststring done # Only check the string length outside the loop. lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` teststring= # Add a significant safety factor because C++ compilers can tack on # massive amounts of additional arguments before passing them to the # linker. It appears as though 1/2 is a usable value. lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` fi ;; esac 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"} { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 $as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } # Try some XSI features xsi_shell=no ( _lt_dummy="a/b/c" test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ = c,a/b,b/c, \ && eval 'test $(( 1 + 1 )) -eq 2 \ && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ && xsi_shell=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 $as_echo "$xsi_shell" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 $as_echo_n "checking whether the shell understands \"+=\"... " >&6; } lt_shell_append=no ( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ >/dev/null 2>&1 \ && lt_shell_append=yes { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 $as_echo "$lt_shell_append" >&6; } 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 "$GCC" != yes; then reload_cmds=false fi ;; darwin*) if test "$GCC" = yes; then reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' else reload_cmds='$LD$reload_flag -o $output$reload_objs' fi ;; esac 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 # which responds to the $file_magic_cmd with a given extended regex. # If you have `file' or equivalent on your system and you're not sure # whether `pass_all' will *always* work, you probably want this one. case $host_os in aix[4-9]*) lt_cv_deplibs_check_method=pass_all ;; beos*) lt_cv_deplibs_check_method=pass_all ;; bsdi[45]*) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' lt_cv_file_magic_cmd='/usr/bin/file -L' lt_cv_file_magic_test_file=/shlib/libc.so ;; cygwin*) # func_win32_libid is a shell function defined in ltmain.sh lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' lt_cv_file_magic_cmd='func_win32_libid' ;; mingw* | pw32*) # Base MSYS/MinGW do not provide the 'file' command needed by # func_win32_libid shell function, so use a weaker test based on 'objdump', # unless we find 'file', for example because we are cross-compiling. # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. if ( test "$lt_cv_nm_interface" = "BSD nm" && 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 ;; gnu*) lt_cv_deplibs_check_method=pass_all ;; 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) 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*) if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' else lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' fi ;; osf3* | osf4* | osf5*) lt_cv_deplibs_check_method=pass_all ;; rdos*) lt_cv_deplibs_check_method=pass_all ;; solaris*) lt_cv_deplibs_check_method=pass_all ;; sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) lt_cv_deplibs_check_method=pass_all ;; sysv4 | sysv4.3*) case $host_vendor in motorola) lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` ;; ncr) lt_cv_deplibs_check_method=pass_all ;; sequent) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' ;; sni) lt_cv_file_magic_cmd='/bin/file' lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" lt_cv_file_magic_test_file=/lib/libc.so ;; siemens) lt_cv_deplibs_check_method=pass_all ;; pc) lt_cv_deplibs_check_method=pass_all ;; esac ;; tpf*) lt_cv_deplibs_check_method=pass_all ;; esac 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 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 "$ac_status" -eq 0; 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 "$ac_status" -ne 0; 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 "x$lt_cv_ar_at_file" = xno; 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 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 "$host_cpu" = ia64; then symcode='[ABCDEGRST]' fi ;; irix* | nonstopux*) symcode='[BCDEGRST]' ;; osf*) symcode='[BCDEGQRST]' ;; solaris*) symcode='[BDRT]' ;; sco3.2v5*) symcode='[DT]' ;; sysv4.2uw2*) symcode='[DT]' ;; sysv5* | sco5v6* | unixware* | OpenUNIX*) symcode='[ABDT]' ;; sysv4) symcode='[DFNSTU]' ;; esac # If we're using GNU nm, then use its standard symbol codes. case `$NM -V 2>&1` in *GNU* | *'with BFD'*) symcode='[ABCDGIRSTW]' ;; esac # Transform an extracted symbol line into a proper C declaration. # Some systems (esp. on ia64) link data and code symbols differently, # so use this general approach. lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" # Transform an extracted symbol line into symbol name and symbol address lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" # Handle CRLF in mingw tool chain opt_cr= case $build_os in mingw*) opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp ;; esac # Try without a prefix underscore, then with it. for ac_symprfx in "" "_"; do # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. symxfrm="\\1 $ac_symprfx\\2 \\2" # Write the raw and C identifiers. if test "$lt_cv_nm_interface" = "MS dumpbin"; then # Fake it for dumpbin and say T for any non-static function # and D for any global variable. # Also find C++ and __fastcall symbols from MSVC++, # which start with @ or ?. lt_cv_sys_global_symbol_pipe="$AWK '"\ " {last_section=section; section=\$ 3};"\ " /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\ " /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ " \$ 0!~/External *\|/{next};"\ " / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ " {if(hide[section]) next};"\ " {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ " {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ " s[1]~/^[@?]/{print s[1], s[1]; next};"\ " s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ " ' prfx=^$ac_symprfx" else lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" fi 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 con'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* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext cat <<\_LT_EOF >> conftest.$ac_ext {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt__PROGRAM__LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif _LT_EOF # Now try linking the two files. mv conftest.$ac_objext conftstm.$ac_objext lt_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 "$pipe_works" = yes; then break else lt_cv_sys_global_symbol_pipe= fi done fi if test -z "$lt_cv_sys_global_symbol_pipe"; then lt_cv_sys_global_symbol_to_cdecl= fi if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then { $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 "$GCC" = yes; 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; } # Check whether --enable-libtool-lock was given. if test "${enable_libtool_lock+set}" = set; then : enableval=$enable_libtool_lock; fi test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes # Some flags need to be propagated to the compiler or linker for good # libtool support. case $host in ia64-*-hpux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.$ac_objext` in *ELF-32*) HPUX_IA64_MODE="32" ;; *ELF-64*) HPUX_IA64_MODE="64" ;; esac fi rm -rf conftest* ;; *-*-irix6*) # Find out which ABI we are using. echo '#line '$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 "$lt_cv_prog_gnu_ld" = yes; then case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -melf32bsmip" ;; *N32*) LD="${LD-ld} -melf32bmipn32" ;; *64-bit*) LD="${LD-ld} -melf64bmip" ;; esac else case `/usr/bin/file conftest.$ac_objext` in *32-bit*) LD="${LD-ld} -32" ;; *N32*) LD="${LD-ld} -n32" ;; *64-bit*) LD="${LD-ld} -64" ;; esac fi fi rm -rf conftest* ;; x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \ s390*-*linux*|s390*-*tpf*|sparc*-*linux*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *32-bit*) case $host in x86_64-*kfreebsd*-gnu) LD="${LD-ld} -m elf_i386_fbsd" ;; x86_64-*linux*) LD="${LD-ld} -m elf_i386" ;; 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 x"$lt_cv_cc_needs_belf" != x"yes"; then # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf CFLAGS="$SAVE_CFLAGS" fi ;; *-*solaris*) # Find out which ABI we are using. echo 'int i;' > conftest.$ac_ext if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 (eval $ac_compile) 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then case `/usr/bin/file conftest.o` in *64-bit*) case $lt_cv_prog_gnu_ld in yes*) case $host in i?86-*-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 "x$lt_cv_path_mainfest_tool" != xyes; 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 $_lt_result -eq 0; 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 $_lt_result -eq 0 && $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 "$lt_cv_apple_cc_single_mod" = "yes"; then _lt_dar_single_mod='$single_module' fi if test "$lt_cv_ld_exported_symbols_list" = "yes"; then _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' else _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' fi if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then _lt_dsymutil='~$DSYMUTIL $lib || :' else _lt_dsymutil= fi ;; 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 test -z "$pic_mode" && pic_mode=default # Check whether --enable-fast-install was given. if test "${enable_fast_install+set}" = set; then : enableval=$enable_fast_install; p=${PACKAGE-default} case $enableval in yes) enable_fast_install=yes ;; no) enable_fast_install=no ;; *) enable_fast_install=no # Look at the argument we got. We use all the common list separators. lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," for pkg in $enableval; do IFS="$lt_save_ifs" if test "X$pkg" = "X$p"; then enable_fast_install=yes fi done IFS="$lt_save_ifs" ;; esac else enable_fast_install=yes fi # This can be used to rebuild libtool when needed LIBTOOL_DEPS="$ltmain" # Always use our own libtool. LIBTOOL='$(SHELL) $(top_builddir)/libtool' test -z "$LN_S" && LN_S="ln -s" if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 $as_echo_n "checking for objdir... " >&6; } if ${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 "X${COLLECT_NAMES+set}" != Xset; 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 for cc_temp in $compiler""; do case $cc_temp in compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; \-*) ;; *) break;; esac done cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` # Only perform the check for file, if the check method requires it test -z "$MAGIC_CMD" && MAGIC_CMD=file case $deplibs_check_method in file_magic*) if test "$file_magic_cmd" = '$MAGIC_CMD'; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 $as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } if ${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 "$GCC" = yes; 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" # 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 x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" else : fi fi lt_prog_compiler_wl= lt_prog_compiler_pic= lt_prog_compiler_static= if test "$GCC" = yes; then lt_prog_compiler_wl='-Wl,' lt_prog_compiler_static='-static' case $host_os in aix*) # All AIX code is PIC. if test "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' fi ;; amigaos*) 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' ;; 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 "$host_cpu" = ia64; then # AIX 5 now supports IA64 processor lt_prog_compiler_static='-Bstatic' else lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' fi ;; 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' ;; 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) 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' ;; 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 which do not support PIC, -DPIC is meaningless: *djgpp*) lt_prog_compiler_pic= ;; *) lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: 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" # 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 x"$lt_cv_prog_compiler_pic_works" = xyes; then case $lt_prog_compiler_pic in "" | " "*) ;; *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; esac else lt_prog_compiler_pic= lt_prog_compiler_can_build_shared=no fi fi # # 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 x"$lt_cv_prog_compiler_static_works" = xyes; 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 "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; 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 "$hard_links" = no; 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 "$GCC" != yes; then with_gnu_ld=no fi ;; interix*) # we just hope/assume this is gcc and not c89 (= MSVC++) with_gnu_ld=yes ;; openbsd*) with_gnu_ld=no ;; esac ld_shlibs=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 "$with_gnu_ld" = yes; 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 "$lt_use_gnu_ld_interface" = yes; then # If archive_cmds runs LD, not CC, wlarc should be empty wlarc='${wl}' # Set some defaults for GNU ld with shared library support. These # are reset later if shared libraries are not supported. Putting them # here allows them to be overridden if necessary. runpath_var=LD_RUN_PATH hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' export_dynamic_flag_spec='${wl}--export-dynamic' # ancient GNU ld didn't support --whole-archive et. al. if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' else whole_archive_flag_spec= fi supports_anon_versioning=no case `$LD -v 2>&1` in *GNU\ gold*) supports_anon_versioning=yes ;; *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... *\ 2.11.*) ;; # other 2.11 versions *) supports_anon_versioning=yes ;; esac # See if GNU ld supports shared libraries. case $host_os in aix[3-9]*) # On AIX/PPC, the GNU linker is very broken if test "$host_cpu" != ia64; then 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 (1st line # is EXPORTS), use it as is; otherwise, prepend... archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then cp $export_symbols $output_objdir/$soname.def; else echo EXPORTS > $output_objdir/$soname.def; cat $export_symbols >> $output_objdir/$soname.def; fi~ $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--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 ;; 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 "$host_os" = linux-dietlibc; then case $cc_basename in diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) esac fi if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ && test "$tmp_diet" = no then tmp_addflag=' $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' ;; 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 "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' fi case $cc_basename in xlf* | 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 "x$supports_anon_versioning" = xyes; then archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ echo "local: *; };" >> $output_objdir/$libname.ver~ $LD -shared $libobjs $deplibs $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 can not *** reliably create shared libraries on SCO systems. Therefore, libtool *** is disabling shared libraries support. We urge you to upgrade GNU *** binutils to release 2.16.91.0.3 or newer. Another option is to modify *** your PATH or compiler configuration so that the native linker is *** used, and then restart. _LT_EOF ;; *) # For security reasons, it is highly recommended that you always # use absolute paths for naming shared libraries, and exclude the # DT_RUNPATH tag from executables and libraries. But doing so # requires that you compile everything twice, which is a pain. if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then 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 "$ld_shlibs" = no; then runpath_var= hardcode_libdir_flag_spec= export_dynamic_flag_spec= whole_archive_flag_spec= fi else # PORTME fill in a description of your system's linker (not GNU ld) case $host_os in aix3*) allow_undefined_flag=unsupported always_export_symbols=yes archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' # Note: this linker hardcodes the directories in LIBPATH if there # are no directories specified by -L. hardcode_minus_L=yes if test "$GCC" = yes && test -z "$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 "$host_cpu" = ia64; then # On IA64, the linker does run time linking by default, so we don't # have to do anything special. aix_use_runtimelinking=no exp_sym_flag='-Bexport' no_entry_flag="" else # If we're using GNU nm, then we don't want the "-C" option. # -C means demangle to AIX nm, but means don't demangle with GNU nm # Also, AIX nm treats weak defined symbols like other global # defined symbols, whereas GNU nm marks them as "W". 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) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' else export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' fi aix_use_runtimelinking=no # Test if we are trying to use run time linking or normal # AIX style linking. If -brtl is somewhere in LDFLAGS, we # need to do runtime linking. case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) for ld_flag in $LDFLAGS; do if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then aix_use_runtimelinking=yes break fi done ;; esac exp_sym_flag='-bexport' no_entry_flag='-bnoentry' fi # When large executables or shared objects are built, AIX ld can # have problems creating the table of contents. If linking a library # or program results in "error TOC overflow" add -mminimal-toc to # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. archive_cmds='' hardcode_direct=yes hardcode_direct_absolute=yes hardcode_libdir_separator=':' link_all_deplibs=yes file_list_spec='${wl}-f,' if test "$GCC" = yes; then case $host_os in aix4.[012]|aix4.[012].*) # We only want to do this on AIX 4.2 and lower, the check # below for broken collect2 doesn't work under 4.3+ collect2name=`${CC} -print-prog-name=collect2` if test -f "$collect2name" && strings "$collect2name" | $GREP resolve_lib_name >/dev/null 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 "$aix_use_runtimelinking" = yes; then shared_flag="$shared_flag "'${wl}-G' fi else # not using gcc if test "$host_cpu" = ia64; then # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release # chokes on -Wl,-G. The following line is correct: shared_flag='-G' else if test "$aix_use_runtimelinking" = yes; then shared_flag='${wl}-G' else shared_flag='${wl}-bM:SRE' fi fi fi 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_use_runtimelinking" = yes; then # Warning - without using the other runtime loading flags (-brtl), # -berok will link without error, but may produce a broken library. allow_undefined_flag='-berok' # Determine the default libpath from the value encoded in an # empty executable. if test "${lt_cv_aix_libpath+set}" = 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 "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" else if test "$host_cpu" = ia64; then hardcode_libdir_flag_spec='${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 "${lt_cv_aix_libpath+set}" = 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 "$with_gnu_ld" = yes; 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 # This is similar to how AIX traditionally builds its shared libraries. archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' fi fi ;; amigaos*) case $host_cpu in powerpc) # see comment about AmigaOS4 .so support 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~linknames=' archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; else sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $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 "$lt_cv_ld_force_load" = "yes"; 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*) _lt_dar_can_shared=yes ;; *) _lt_dar_can_shared=$GCC ;; esac if test "$_lt_dar_can_shared" = "yes"; 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 "$GCC" = yes; 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 $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' else archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' fi hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' hardcode_libdir_separator=: hardcode_direct=yes # hardcode_minus_L: Not really in the search PATH, # but as the default location of the library. hardcode_minus_L=yes export_dynamic_flag_spec='${wl}-E' ;; hpux10*) if test "$GCC" = yes && test "$with_gnu_ld" = no; 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 "$with_gnu_ld" = no; 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 "$GCC" = yes && test "$with_gnu_ld" = no; 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 x"$lt_cv_prog_compiler__b" = xyes; 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 "$with_gnu_ld" = no; 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 "$GCC" = yes; 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 "$lt_cv_irix_exported_symbol" = yes; 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 ;; 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*) 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__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' export_dynamic_flag_spec='${wl}-E' else case $host_os in openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' hardcode_libdir_flag_spec='-R$libdir' ;; *) archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' hardcode_libdir_flag_spec='${wl}-rpath,$libdir' ;; esac fi else ld_shlibs=no fi ;; os2*) hardcode_libdir_flag_spec='-L$libdir' hardcode_minus_L=yes allow_undefined_flag=unsupported archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' ;; osf3*) if test "$GCC" = yes; then allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && 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 "$GCC" = yes; 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 "$GCC" = yes; 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 "$GCC" = yes; 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 "x$host_vendor" = xsequent; then # Use $CC to link under sequent, because it throws in some extra .o # files that make .init and .fini sections work. archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' else archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' fi hardcode_libdir_flag_spec='-L$libdir' hardcode_direct=yes hardcode_minus_L=yes hardcode_shlibpath_var=no ;; sysv4) case $host_vendor in sni) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=yes # is this really true??? ;; siemens) ## LD is ld it makes a PLAMLIB ## CC just makes a GrossModule. archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' reload_cmds='$CC -r -o $output$reload_objs' hardcode_direct=no ;; motorola) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_direct=no #Motorola manual says yes, but my tests say they lie ;; esac runpath_var='LD_RUN_PATH' hardcode_shlibpath_var=no ;; sysv4.3*) archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no export_dynamic_flag_spec='-Bexport' ;; sysv4*MP*) if test -d /usr/nec; then archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' hardcode_shlibpath_var=no runpath_var=LD_RUN_PATH hardcode_runpath_var=yes ld_shlibs=yes fi ;; sysv4*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 "$GCC" = yes; 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 can NOT use -z defs as we might desire, because we do not # link with -lc, and that would cause any symbols used from libc to # always be unresolved, which means just about no library would # ever link correctly. If we're not using GNU ld we use -z text # though, which does catch some bad symbols but isn't as heavy-handed # as -z defs. no_undefined_flag='${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 "$GCC" = yes; 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 x$host_vendor = xsni; 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 "$ld_shlibs" = no && 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 "$enable_shared" = yes && test "$GCC" = yes; then case $archive_cmds in *'~'*) # FIXME: we may have to deal with multi-command sequences. ;; '$CC '*) # Test whether the compiler implicitly links with -lc since on some # systems, -lgcc has to come before -lc. If gcc already passes -lc # to ld, don't add -lc before -lgcc. { $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 "$GCC" = yes; 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` for lt_sys_path in $lt_search_path_spec; do if test -d "$lt_sys_path/$lt_multi_os_dir"; then lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" else test -d "$lt_sys_path" && \ lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" fi done lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' BEGIN {RS=" "; FS="/|\n";} { lt_foo=""; lt_count=0; for (lt_i = NF; lt_i > 0; lt_i--) { if ($lt_i != "" && $lt_i != ".") { if ($lt_i == "..") { lt_count++; } else { if (lt_count == 0) { lt_foo="/" $lt_i lt_foo; } else { lt_count--; } } } } if (lt_foo != "") { lt_freq[lt_foo]++; } if (lt_freq[lt_foo] == 1) { print lt_foo; } }'` # 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 "$host_cpu" = ia64; then # AIX 5 supports IA64 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH else # With GCC up to 2.95.x, collect2 would create an import file # for dependence libraries. The import file would start with # the line `#! .'. This would cause the generated library to # depend on `.', always an invalid library. This was fixed in # development snapshots of GCC prior to 3.0. case $host_os in aix4 | aix4.[01] | aix4.[01].*) if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' echo ' yes ' echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then : else can_build_shared=no fi ;; esac # AIX (on Power*) has no versioning support, so currently we can not hardcode correct # soname into executable. Probably we can add versioning support to # collect2, so additional links can be useful in future. if test "$aix_use_runtimelinking" = yes; then # If using run time linking (on AIX 4.2 or later) use lib.so # instead of lib.a to let people know that these are not # typical AIX shared libraries. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' else # We preserve .a as extension for shared libraries through AIX4.2 # and later when we are not doing run time linking. library_names_spec='${libname}${release}.a $libname.a' soname_spec='${libname}${release}${shared_ext}$major' fi shlibpath_var=LIBPATH fi ;; amigaos*) 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%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' ;; esac ;; beos*) library_names_spec='${libname}${shared_ext}' dynamic_linker="$host_os ld.so" shlibpath_var=LIBRARY_PATH ;; bsdi[45]*) version_type=linux # 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} $libname${shared_ext}' need_version=no need_lib_prefix=no ;; freebsd-*) library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' need_version=yes ;; esac shlibpath_var=LD_LIBRARY_PATH case $host_os in freebsd2.*) shlibpath_overrides_runpath=yes ;; freebsd3.[01]* | freebsdelf3.[01]*) shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) shlibpath_overrides_runpath=no hardcode_into_libs=yes ;; *) # from 4.6 on, and DragonFly shlibpath_overrides_runpath=yes hardcode_into_libs=yes ;; esac ;; gnu*) version_type=linux # 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=no hardcode_into_libs=yes ;; 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=yes 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 "X$HPUX_IA64_MODE" = X32; then sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" else sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" fi sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; hppa*64*) shrext_cmds='.sl' hardcode_into_libs=yes dynamic_linker="$host_os dld.sl" shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec ;; *) shrext_cmds='.sl' dynamic_linker="$host_os dld.sl" shlibpath_var=SHLIB_PATH shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' ;; esac # HP-UX runs *really* slowly unless shared libraries are mode 555, ... postinstall_cmds='chmod 555 $lib' # 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 "$lt_cv_prog_gnu_ld" = yes; 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 ;; # This must be glibc/ELF. linux* | k*bsd*-gnu | kopensolaris*-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 # Append ld.so.conf contents to the search path if test -f /etc/ld.so.conf; then lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;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*) version_type=sunos sys_lib_dlsearch_path_spec="/usr/lib" need_lib_prefix=no # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. case $host_os in openbsd3.3 | openbsd3.3.*) need_version=yes ;; *) need_version=no ;; esac library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' shlibpath_var=LD_LIBRARY_PATH if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then case $host_os in openbsd2.[89] | openbsd2.[89].*) shlibpath_overrides_runpath=no ;; *) shlibpath_overrides_runpath=yes ;; esac else shlibpath_overrides_runpath=yes fi ;; os2*) libname_spec='$name' shrext_cmds=".dll" need_lib_prefix=no library_names_spec='$libname${shared_ext} $libname.a' dynamic_linker='OS/2 ld.exe' shlibpath_var=LIBPATH ;; osf3* | osf4* | osf5*) version_type=osf need_lib_prefix=no need_version=no soname_spec='${libname}${release}${shared_ext}$major' library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' shlibpath_var=LD_LIBRARY_PATH sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" ;; rdos*) dynamic_linker=no ;; solaris*) version_type=linux # 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 "$with_gnu_ld" = yes; 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=freebsd-elf need_lib_prefix=no need_version=no library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' soname_spec='${libname}${release}${shared_ext}$major' shlibpath_var=LD_LIBRARY_PATH shlibpath_overrides_runpath=yes hardcode_into_libs=yes if test "$with_gnu_ld" = yes; then sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' else sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' case $host_os in sco3.2v5*) sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" ;; esac fi sys_lib_dlsearch_path_spec='/usr/lib' ;; tpf*) # TPF is a cross-target only. Preferred cross-host = GNU/Linux. version_type=linux # 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 "$dynamic_linker" = no && can_build_shared=no variables_saved_for_relink="PATH $shlibpath_var $runpath_var" if test "$GCC" = yes; then variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" fi if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" fi if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" fi { $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 "X$hardcode_automatic" = "Xyes" ; then # We can hardcode non-existent directories. if test "$hardcode_direct" != no && # If the only mechanism to avoid hardcoding is shlibpath_var, we # have to relink, otherwise we might link with an installed library # when we should be linking with a yet-to-be-installed one ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && test "$hardcode_minus_L" != no; then # Linking always hardcodes the temporary library directory. hardcode_action=relink else # We can link without hardcoding, and we can hardcode nonexisting dirs. hardcode_action=immediate fi else # We cannot hardcode anything, or else we can only hardcode existing # directories. hardcode_action=unsupported fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 $as_echo "$hardcode_action" >&6; } if test "$hardcode_action" = relink || test "$inherit_rpath" = yes; then # Fast installation is not supported enable_fast_install=no elif test "$shlibpath_overrides_runpath" = yes || test "$enable_shared" = no; then # Fast installation is not necessary enable_fast_install=needless fi if test "x$enable_dlopen" != xyes; then enable_dlopen=unknown enable_dlopen_self=unknown enable_dlopen_self_static=unknown else lt_cv_dlopen=no lt_cv_dlopen_libs= case $host_os in beos*) lt_cv_dlopen="load_add_on" lt_cv_dlopen_libs= lt_cv_dlopen_self=yes ;; mingw* | pw32* | 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 ;; *) 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 "x$lt_cv_dlopen" != xno; then enable_dlopen=yes else enable_dlopen=no fi case $lt_cv_dlopen in dlopen) save_CPPFLAGS="$CPPFLAGS" test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" save_LDFLAGS="$LDFLAGS" wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" save_LIBS="$LIBS" LIBS="$lt_cv_dlopen_libs $LIBS" { $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 "$cross_compiling" = yes; then : lt_cv_dlopen_self=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_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 -fvisbility=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 "x$lt_cv_dlopen_self" = xyes; 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 "$cross_compiling" = yes; then : lt_cv_dlopen_self_static=cross else lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 lt_status=$lt_dlunknown cat > conftest.$ac_ext <<_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 -fvisbility=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 which library types will actually be built { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 $as_echo_n "checking if libtool supports shared libraries... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 $as_echo "$can_build_shared" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 $as_echo_n "checking whether to build shared libraries... " >&6; } test "$can_build_shared" = "no" && enable_shared=no # On AIX, shared libraries and static libraries use the same namespace, and # are all built from PIC. case $host_os in aix3*) test "$enable_shared" = yes && enable_static=no if test -n "$RANLIB"; then archive_cmds="$archive_cmds~\$RANLIB \$lib" postinstall_cmds='$RANLIB $lib' fi ;; aix[4-9]*) if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then test "$enable_shared" = yes && enable_static=no fi ;; esac { $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 "$enable_shared" = yes || 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 if test ! "$preload_build" = "yes"; then # 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 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sys/types.h defines makedev" >&5 $as_echo_n "checking whether sys/types.h defines makedev... " >&6; } if ${ac_cv_header_sys_types_h_makedev+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { return makedev(0, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_header_sys_types_h_makedev=yes else ac_cv_header_sys_types_h_makedev=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_sys_types_h_makedev" >&5 $as_echo "$ac_cv_header_sys_types_h_makedev" >&6; } if test $ac_cv_header_sys_types_h_makedev = no; then 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 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 build_neon_lib=no if test "$dav" = yes; then neon_require_major=0 neon_require_minor=12 neon_bundled_srcdir='${top_srcdir}/libneon' neon_bundled_builddir='${top_srcdir}/libneon' # Check whether --with-included-neon was given. if test "${with_included_neon+set}" = set; then : withval=$with_included_neon; neon_force_included="$withval" else neon_force_included="no" fi # 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" cat >>confdefs.h <<_ACEOF #define NEON_VERSION "${NEON_VERSION}" _ACEOF cat >>confdefs.h <<_ACEOF #define NEON_VERSION_MAJOR (${NEON_VERSION_MAJOR}) _ACEOF cat >>confdefs.h <<_ACEOF #define NEON_VERSION_MINOR (${NEON_VERSION_MINOR}) _ACEOF # Check whether --with-neon was given. if test "${with_neon+set}" = set; then : withval=$with_neon; neon_loc="$withval" fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for neon location" >&5 $as_echo_n "checking for neon location... " >&6; } 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! { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $neon_loc" >&5 $as_echo "found in $neon_loc" >&6; } if test "x$neon_require_major" = "x"; then : 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 else config=$neon_loc/bin/neon-config oLIBS="$LIBS" oCFLAGS="$CFLAGS" CFLAGS="$CFLAGS `$config --cflags`" LIBS="$LIBS `$config --libs`" ver=`$config --version` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for neon library version" >&5 $as_echo_n "checking for neon library version... " >&6; } if test "$cross_compiling" = yes; 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 $? "cannot run test program while cross compiling See \`config.log' for more details" "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main(void) { return neon_version_minimum($neon_require_major, $neon_require_minor); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : { $as_echo "$as_me:${as_lineno-$LINENO}: result: okay (found $ver)" >&5 $as_echo "okay (found $ver)" >&6; } LIBS="$oLIBS" CFLAGS="$oCFLAGS" 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 else { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed, found $ver wanted >=$neon_require_major.$neon_require_minor" >&5 $as_echo "failed, found $ver wanted >=$neon_require_major.$neon_require_minor" >&6; } LIBS="$oLIBS" CFLAGS="$oCFLAGS" neon_got_library=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 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 as_fn_error $? "could not find neon" "$LINENO" 5 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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: using supplied ($NEON_VERSION)" >&5 $as_echo "using supplied ($NEON_VERSION)" >&6; } CFLAGS="$CFLAGS -I$neon_bundled_srcdir" LDFLAGS="$LDFLAGS -L$neon_bundled_builddir" NEONLIBS="$LIBS -lneon" NEON_BUILD_BUNDLED="yes" { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 $as_echo_n "checking whether byte ordering is bigendian... " >&6; } if ${ac_cv_c_bigendian+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_bigendian=unknown # See if we're dealing with a universal compiler. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __APPLE_CC__ not a universal capable compiler #endif typedef int dummy; _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # Check for potential -arch flags. It is not universal unless # there are at least two -arch flags with different values. ac_arch= ac_prev= for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do if test -n "$ac_prev"; then case $ac_word in i?86 | x86_64 | ppc | ppc64) if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then ac_arch=$ac_word else ac_cv_c_bigendian=universal break fi ;; esac ac_prev= elif test "x$ac_word" = "x-arch"; then ac_prev=arch fi done fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_c_bigendian = unknown; then # See if sys/param.h defines the BYTE_ORDER macro. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ && LITTLE_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { #if BYTE_ORDER != BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) bogus endian macros #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : # It does; now see whether it defined to _BIG_ENDIAN or not. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { #ifndef _BIG_ENDIAN not big endian #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_bigendian=yes else ac_cv_c_bigendian=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi if test $ac_cv_c_bigendian = unknown; then # Compile a test program. if test "$cross_compiling" = yes; then : # Try to guess by grepping values from an object file. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; int use_ascii (int i) { return ascii_mm[i] + ascii_ii[i]; } short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; int use_ebcdic (int i) { return ebcdic_mm[i] + ebcdic_ii[i]; } extern int foo; int main () { return use_ascii (foo) == use_ebcdic (foo); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then ac_cv_c_bigendian=yes fi if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then if test "$ac_cv_c_bigendian" = unknown; then ac_cv_c_bigendian=no else # finding both strings is unlikely to happen, but who knows? ac_cv_c_bigendian=unknown fi fi fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* Are we little or big endian? From Harbison&Steele. */ union { long int l; char c[sizeof (long int)]; } u; u.l = 1; return u.c[sizeof (long int) - 1] == 1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_bigendian=no else ac_cv_c_bigendian=yes 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_c_bigendian" >&5 $as_echo "$ac_cv_c_bigendian" >&6; } case $ac_cv_c_bigendian in #( yes) $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h ;; #( no) ;; #( universal) $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h ;; #( *) as_fn_error $? "unknown endianness presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5 $as_echo_n "checking for inline... " >&6; } if ${ac_cv_c_inline+:} false; then : $as_echo_n "(cached) " >&6 else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifndef __cplusplus typedef int foo_t; static $ac_kw foo_t static_foo () {return 0; } $ac_kw foo_t foo () {return 0; } #endif _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_inline=$ac_kw fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext test "$ac_cv_c_inline" != no && break done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5 $as_echo "$ac_cv_c_inline" >&6; } case $ac_cv_c_inline in inline | yes) ;; *) case $ac_cv_c_inline in no) ac_val=;; *) ac_val=$ac_cv_c_inline;; esac cat >>confdefs.h <<_ACEOF #ifndef __cplusplus #define inline $ac_val #endif _ACEOF ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for an ANSI C-conforming const" >&5 $as_echo_n "checking for an ANSI C-conforming const... " >&6; } if ${ac_cv_c_const+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { #ifndef __cplusplus /* Ultrix mips cc rejects this sort of thing. */ typedef int charset[2]; const charset cs = { 0, 0 }; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this sort of thing. */ char tx; char *t = &tx; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this sort of thing, saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; } bx; struct s *b = &bx; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_const=yes else ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_const" >&5 $as_echo "$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then $as_echo "#define const /**/" >>confdefs.h fi for ac_header in stdarg.h string.h strings.h sys/time.h regex.h \ stdlib.h unistd.h limits.h sys/select.h arpa/inet.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_func "$LINENO" "strcasecmp" "ac_cv_func_strcasecmp" if test "x$ac_cv_func_strcasecmp" = xyes; then : $as_echo "#define HAVE_STRCASECMP 1" >>confdefs.h else case " $LIBOBJS " in *" strcasecmp.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS strcasecmp.$ac_objext" ;; esac 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 # Check whether --with-ssl was given. if test "${with_ssl+set}" = set; then : withval=$with_ssl; else with_ssl="no" fi # 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. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OpenSSL" >&5 $as_echo_n "checking for OpenSSL... " >&6; } 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" $as_echo "#define ENABLE_SSL 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: found in $neon_ssl_location" >&5 $as_echo "found in $neon_ssl_location" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } fi 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 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. : NEON_TARGET=libneon.a NEON_OBJEXT=o # Using the default set of object files to build. # 'o' is the object extension in use o=$NEON_OBJEXT { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable WebDAV support in neon" >&5 $as_echo_n "checking whether to enable WebDAV support in neon... " >&6; } 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" { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } 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. $as_echo "#define USE_DAV_LOCKS 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi # Extract the first word of "ar", so it can be a program name with args. set dummy ar; 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_AR+:} false; then : $as_echo_n "(cached) " >&6 else case $AR in [\\/]* | ?:[\\/]*) ac_cv_path_AR="$AR" # 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_AR="$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 AR=$ac_cv_path_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 if test "$NEON_NEED_XML_PARSER" = "yes"; then # Check whether --enable-libxml was given. if test "${enable_libxml+set}" = set; then : enableval=$enable_libxml; neon_force_libxml=$enableval else neon_force_libxml=no fi # Check whether --with-expat was given. if test "${with_expat+set}" = set; then : withval=$with_expat; 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 $as_echo "#define HAVE_EXPAT 1" >>confdefs.h CFLAGS="$CFLAGS -I$withval" 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 else neon_found_parser="no" fi if test "$neon_found_parser" = "no" -a "$neon_force_libxml" = "no"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XML_Parse in -lexpat" >&5 $as_echo_n "checking for XML_Parse in -lexpat... " >&6; } if ${ac_cv_lib_expat_XML_Parse+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lexpat $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 XML_Parse (); int main () { return XML_Parse (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_expat_XML_Parse=yes else ac_cv_lib_expat_XML_Parse=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_expat_XML_Parse" >&5 $as_echo "$ac_cv_lib_expat_XML_Parse" >&6; } if test "x$ac_cv_lib_expat_XML_Parse" = xyes; then : neon_expat_libs="-lexpat" neon_found_parser="expat" else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XML_Parse in -lxmlparse" >&5 $as_echo_n "checking for XML_Parse in -lxmlparse... " >&6; } if ${ac_cv_lib_xmlparse_XML_Parse+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lxmlparse -lxmltok $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 XML_Parse (); int main () { return XML_Parse (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_xmlparse_XML_Parse=yes else ac_cv_lib_xmlparse_XML_Parse=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_xmlparse_XML_Parse" >&5 $as_echo "$ac_cv_lib_xmlparse_XML_Parse" >&6; } if test "x$ac_cv_lib_xmlparse_XML_Parse" = xyes; then : neon_expat_libs="-lxmltok -lxmlparse" neon_found_parser="expat" else neon_found_parser="no" fi fi fi if test "$neon_found_parser" = "no"; then # Have we got libxml 1.8.3 or later? # Extract the first word of "xml-config", so it can be a program name with args. set dummy xml-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_prog_XML_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$XML_CONFIG"; then ac_cv_prog_XML_CONFIG="$XML_CONFIG" # 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_XML_CONFIG="xml-config" $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 XML_CONFIG=$ac_cv_prog_XML_CONFIG if test -n "$XML_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XML_CONFIG" >&5 $as_echo "$XML_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi 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`" { $as_echo "$as_me:${as_lineno-$LINENO}: checking for xmlCreatePushParserCtxt in -lxml" >&5 $as_echo_n "checking for xmlCreatePushParserCtxt in -lxml... " >&6; } if ${ac_cv_lib_xml_xmlCreatePushParserCtxt+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lxml $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 xmlCreatePushParserCtxt (); int main () { return xmlCreatePushParserCtxt (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_xml_xmlCreatePushParserCtxt=yes else ac_cv_lib_xml_xmlCreatePushParserCtxt=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_xml_xmlCreatePushParserCtxt" >&5 $as_echo "$ac_cv_lib_xml_xmlCreatePushParserCtxt" >&6; } if test "x$ac_cv_lib_xml_xmlCreatePushParserCtxt" = xyes; then : neon_found_parser="libxml" neon_xml_parser_message="libxml" NEONLIBS="$NEONLIBS $NEWLIBS" $as_echo "#define HAVE_LIBXML 1" >>confdefs.h else CFLAGS="$oCFLAGS" LIBS="$oLIBS" { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot use old libxml (1.8.3 or newer required)" >&5 $as_echo "$as_me: WARNING: cannot use old libxml (1.8.3 or newer required)" >&2;} fi 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_fn_c_check_header_mongrel "$LINENO" "xmlparse.h" "ac_cv_header_xmlparse_h" "$ac_includes_default" if test "x$ac_cv_header_xmlparse_h" = xyes; then : neon_expat_incs="" neon_found_expatincs="yes" else ac_fn_c_check_header_mongrel "$LINENO" "xmltok/xmlparse.h" "ac_cv_header_xmltok_xmlparse_h" "$ac_includes_default" if test "x$ac_cv_header_xmltok_xmlparse_h" = xyes; then : neon_expat_incs="-I/usr/include/xmltok" neon_found_expatincs="yes" fi fi if test "$neon_found_expatincs" = "yes"; then $as_echo "#define HAVE_EXPAT 1" >>confdefs.h if test "$neon_expat_incs"; then CFLAGS="$CFLAGS $neon_expat_incs" fi NEONLIBS="$NEONLIBS $neon_expat_libs" else as_fn_error $? "\"found expat library but could not find xmlparse.h\"" "$LINENO" 5 fi neon_xml_parser_message="expat in $neon_expat_libs" fi if test "$neon_found_parser" = "no" ; then if test "x" != "x"; then # Use the bundled expat sources case " $LIBOBJS " in *" /xmltok/xmltok.o /xmltok/xmlrole.o /xmlparse/xmlparse.o /xmlparse/hashtable.o.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS /xmltok/xmltok.o /xmltok/xmlrole.o /xmlparse/xmlparse.o /xmlparse/hashtable.o.$ac_objext" ;; esac CFLAGS="$CFLAGS -DXML_DTD -I/xmlparse -I/xmltok" { $as_echo "$as_me:${as_lineno-$LINENO}: result: using supplied expat XML parser" >&5 $as_echo "using supplied expat XML parser" >&6; } $as_echo "#define HAVE_EXPAT 1" >>confdefs.h neon_xml_parser_message="supplied expat in " else as_fn_error $? "no XML parser was found" "$LINENO" 5 fi fi fi fi # LIBS=$NEONLIBS DAV=dav.c DAV_LS=dav_ls.c LIBDAV=../libneon/libneon.la build_neon_lib=yes else NEON_BUILD_BUNDLED=no DAV= DAV_LS= LIBDAV= fi if test x$build_neon_lib = xyes; then BUILD_NEON_LIB_TRUE= BUILD_NEON_LIB_FALSE='#' else BUILD_NEON_LIB_TRUE='#' BUILD_NEON_LIB_FALSE= fi if test x$build_neon_lib = 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 "emacs", so it can be a program name with args. set dummy emacs; 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_EMACS+:} false; then : $as_echo_n "(cached) " >&6 else if test -n "$EMACS"; then ac_cv_prog_EMACS="$EMACS" # 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_EMACS="yes" $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_EMACS" && ac_cv_prog_EMACS="no" fi fi EMACS=$ac_cv_prog_EMACS if test -n "$EMACS"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $EMACS" >&5 $as_echo "$EMACS" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # 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 if test x$EMACS = xyes; then INSTALL_EMACS_TRUE= INSTALL_EMACS_FALSE='#' else INSTALL_EMACS_TRUE='#' INSTALL_EMACS_FALSE= fi if test $preload_build = yes; then origlibs=$LIBS LIBS= for ac_func in lseek64 getdents64 open64 creat64 stat64 acl 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 { $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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing dlsym" >&5 $as_echo_n "checking for library containing dlsym... " >&6; } if ${ac_cv_search_dlsym+:} 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 dlsym (); int main () { return dlsym (); ; return 0; } _ACEOF for ac_lib in '' dl; 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_dlsym=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_dlsym+:} false; then : break fi done if ${ac_cv_search_dlsym+:} false; then : else ac_cv_search_dlsym=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_dlsym" >&5 $as_echo "$ac_cv_search_dlsym" >&6; } ac_res=$ac_cv_search_dlsym if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi PRELOAD_LIBS=$LIBS LIBS=$origlibs fi if test x$preload_build = xyes; then INSTALL_PRELOAD_TRUE= INSTALL_PRELOAD_FALSE='#' else INSTALL_PRELOAD_TRUE='#' INSTALL_PRELOAD_FALSE= fi install_profilescripts=no install_avfscoda=no install_initscript=no install_scriptlinks=no install_codadev=no install_fuse=no if test $avfscoda_build = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking kernel source directory" >&5 $as_echo_n "checking kernel source directory... " >&6; } kernelsrc= # Check whether --with-kernel was given. if test "${with_kernel+set}" = set; then : withval=$with_kernel; kernelsrc="$withval" fi if test -z "$kernelsrc"; then buildlink=/lib/modules/`uname -r`/build if test -e $buildlink; then kernelsrc=`(cd $buildlink; /bin/pwd)` elif test -e /usr/src/linux; then kernelsrc=/usr/src/linux else { $as_echo "$as_me:${as_lineno-$LINENO}: result: Not found" >&5 $as_echo "Not found" >&6; } as_fn_error $? " *** Please specify the location of the kernel source with *** the '--with-kernel=SRCDIR' option" "$LINENO" 5 fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $kernelsrc" >&5 $as_echo "$kernelsrc" >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: checking kernel source version" >&5 $as_echo_n "checking kernel source version... " >&6; } origlibs=$LIBS LIBS="" kernsrcver=`if test "$cross_compiling" = yes; then : true else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include "$kernelsrc/include/linux/version.h" #include int main() { printf("%s\n", UTS_RELEASE); return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi ` if test -z "$kernsrcver"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: Not found" >&5 $as_echo "Not found" >&6; } as_fn_error $? " *** Cannot determine the version of the linux kernel source. Please *** configure the kernel before running this script" "$LINENO" 5 fi LIBS=$origlibs { $as_echo "$as_me:${as_lineno-$LINENO}: result: $kernsrcver" >&5 $as_echo "$kernsrcver" >&6; } KERNINCLUDE=${kernelsrc}/include kmoduledir=/lib/modules/${kernsrcver}/misc initstyle= { $as_echo "$as_me:${as_lineno-$LINENO}: checking for init-script style" >&5 $as_echo_n "checking for init-script style... " >&6; } if test -d /sbin/init.d -a -f /etc/rc.config; then initstyle=suse elif test -f /etc/rc.d/init.d/functions; then initstyle=redhat elif test -d /etc/rc2.d; then initstyle=debian else initstyle=generic fi; { $as_echo "$as_me:${as_lineno-$LINENO}: result: $initstyle" >&5 $as_echo "$initstyle" >&6; } rcdir= rcscriptdir= start_levels= stop_levels= start_prio= stop_prio= install_initscript=yes if test "$initstyle" = redhat; then install_scriptlinks=yes rcdir=/etc/rc.d rcscriptdir=init.d start_levels="2 3 4 5" stop_levels="0 1 6" start_prio=85 stop_prio=25 elif test "$initstyle" = suse; then install_scriptlinks=yes rcdir=/sbin/init.d rcscriptdir= start_levels="2 3" stop_levels="2 3" start_prio=20 stop_prio=20 elif test "$initstyle" = debian; then install_scriptlinks=yes rcdir=/etc rcscriptdir=init.d start_levels="2 3 4 5" stop_levels="0 1 6" start_prio=85 stop_prio=25 else rcdir=/etc/rc.d rcscriptdir= fi profiledir= newredir=no if test "$newredir" = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for profile directory" >&5 $as_echo_n "checking for profile directory... " >&6; } install_profilescripts=yes if test -d /etc/profile.d; then profiledir=/etc/profile.d else profiledir=/etc fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $profiledir" >&5 $as_echo "$profiledir" >&6; } fi install_codadev=yes install_avfscoda=yes fi 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 if test x$use_liblzma = xyes; then USE_LIBLZMA_TRUE= USE_LIBLZMA_FALSE='#' else USE_LIBLZMA_TRUE='#' USE_LIBLZMA_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 x$install_profilescripts = xyes; then INSTALL_AVFSCODA_PROFILE_TRUE= INSTALL_AVFSCODA_PROFILE_FALSE='#' else INSTALL_AVFSCODA_PROFILE_TRUE='#' INSTALL_AVFSCODA_PROFILE_FALSE= fi if test x$install_avfscoda = xyes; then INSTALL_AVFSCODA_TRUE= INSTALL_AVFSCODA_FALSE='#' else INSTALL_AVFSCODA_TRUE='#' INSTALL_AVFSCODA_FALSE= fi if test x$install_initscript = xyes; then INSTALL_INITSCRIPT_TRUE= INSTALL_INITSCRIPT_FALSE='#' else INSTALL_INITSCRIPT_TRUE='#' INSTALL_INITSCRIPT_FALSE= fi if test x$install_scriptlinks = xyes; then INSTALL_SCRIPTLINKS_TRUE= INSTALL_SCRIPTLINKS_FALSE='#' else INSTALL_SCRIPTLINKS_TRUE='#' INSTALL_SCRIPTLINKS_FALSE= fi if test x$install_codadev = xyes; then INSTALL_CODADEV_TRUE= INSTALL_CODADEV_FALSE='#' else INSTALL_CODADEV_TRUE='#' INSTALL_CODADEV_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 Makefile src/Makefile modules/Makefile zlib/Makefile bzlib/Makefile lib/Makefile include/Makefile avfscoda/Makefile avfscoda/redir/Makefile preload/Makefile libneon/Makefile extfs/Makefile scripts/Makefile scripts/init/Makefile test/Makefile spec/Makefile macros/Makefile patch/Makefile doc/Makefile fuse/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_NEON_LIB_TRUE}" && test -z "${BUILD_NEON_LIB_FALSE}"; then as_fn_error $? "conditional \"BUILD_NEON_LIB\" 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 "${INSTALL_EMACS_TRUE}" && test -z "${INSTALL_EMACS_FALSE}"; then as_fn_error $? "conditional \"INSTALL_EMACS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${INSTALL_PRELOAD_TRUE}" && test -z "${INSTALL_PRELOAD_FALSE}"; then as_fn_error $? "conditional \"INSTALL_PRELOAD\" 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 "${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 "${INSTALL_AVFSCODA_PROFILE_TRUE}" && test -z "${INSTALL_AVFSCODA_PROFILE_FALSE}"; then as_fn_error $? "conditional \"INSTALL_AVFSCODA_PROFILE\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${INSTALL_AVFSCODA_TRUE}" && test -z "${INSTALL_AVFSCODA_FALSE}"; then as_fn_error $? "conditional \"INSTALL_AVFSCODA\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${INSTALL_INITSCRIPT_TRUE}" && test -z "${INSTALL_INITSCRIPT_FALSE}"; then as_fn_error $? "conditional \"INSTALL_INITSCRIPT\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${INSTALL_SCRIPTLINKS_TRUE}" && test -z "${INSTALL_SCRIPTLINKS_FALSE}"; then as_fn_error $? "conditional \"INSTALL_SCRIPTLINKS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi if test -z "${INSTALL_CODADEV_TRUE}" && test -z "${INSTALL_CODADEV_FALSE}"; then as_fn_error $? "conditional \"INSTALL_CODADEV\" 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.0.5, 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.0.5 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" ac_aux_dir="$ac_aux_dir" # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. (unset CDPATH) >/dev/null 2>&1 && unset CDPATH sed_quote_subst='$sed_quote_subst' double_quote_subst='$double_quote_subst' delay_variable_subst='$delay_variable_subst' macro_version='`$ECHO "$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"`' 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_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"`' nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' lt_sysroot='`$ECHO "$lt_sysroot" | $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"`' sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $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_c_name_address \ lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ nm_file_list_spec \ 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\\"\\\`\\\\\\"" ;; *) 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 \ sys_lib_dlsearch_path_spec; do case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in *[\\\\\\\`\\"\\\$]*) eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" ;; *) eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" ;; esac done ac_aux_dir='$ac_aux_dir' xsi_shell='$xsi_shell' lt_shell_append='$lt_shell_append' # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes INIT. if test -n "\${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi PACKAGE='$PACKAGE' VERSION='$VERSION' TIMESTAMP='$TIMESTAMP' RM='$RM' ofile='$ofile' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF || 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" ;; "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" ;; "avfscoda/Makefile") CONFIG_FILES="$CONFIG_FILES avfscoda/Makefile" ;; "avfscoda/redir/Makefile") CONFIG_FILES="$CONFIG_FILES avfscoda/redir/Makefile" ;; "preload/Makefile") CONFIG_FILES="$CONFIG_FILES preload/Makefile" ;; "libneon/Makefile") CONFIG_FILES="$CONFIG_FILES libneon/Makefile" ;; "extfs/Makefile") CONFIG_FILES="$CONFIG_FILES extfs/Makefile" ;; "scripts/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/Makefile" ;; "scripts/init/Makefile") CONFIG_FILES="$CONFIG_FILES scripts/init/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" ;; "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. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named 'Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running 'make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "$am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $as_echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` as_dir=$dirpart/$fdir; as_fn_mkdir_p # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ;; "libtool":C) # See if we are running on zsh, and set the options which allow our # commands through without removal of \ escapes. if test -n "${ZSH_VERSION+set}" ; then setopt NO_GLOB_SUBST fi cfgfile="${ofile}T" trap "$RM \"$cfgfile\"; exit 1" 1 2 15 $RM "$cfgfile" cat <<_LT_EOF >> "$cfgfile" #! $SHELL # `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. # Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION # Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: # NOTE: Changes made to this file will be lost: look at ltmain.sh. # # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, # 2006, 2007, 2008, 2009, 2010, 2011 Free Software # Foundation, Inc. # Written by Gordon Matzigkeit, 1996 # # This file is part of GNU Libtool. # # GNU Libtool is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 2 of # the License, or (at your option) any later version. # # As a special exception to the GNU General Public License, # if you distribute this file as part of a program or library that # is built using GNU Libtool, you may include this file under the # same distribution terms that you use for the rest of that program. # # GNU Libtool is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, or # obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # The names of the tagged configurations supported by this script. available_tags="" # ### BEGIN LIBTOOL CONFIG # Which release of libtool.m4 was used? macro_version=$macro_version macro_revision=$macro_revision # Whether or not to build shared libraries. build_libtool_libs=$enable_shared # Whether or not to build static libraries. build_old_libs=$enable_static # What type of objects to build. pic_mode=$pic_mode # Whether or not to optimize for fast installation. fast_install=$enable_fast_install # 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 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 # 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 in which our libraries should be installed. lt_sysroot=$lt_sysroot # 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 # Run-time system search path for libraries. sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec # Whether dlopen is supported. dlopen_support=$enable_dlopen # Whether dlopen of programs is supported. dlopen_self=$enable_dlopen_self # Whether dlopen of statically linked programs is supported. dlopen_self_static=$enable_dlopen_self_static # Commands to strip libraries. old_striplib=$lt_old_striplib striplib=$lt_striplib # The linker used to build libraries. LD=$lt_LD # 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 case $host_os in aix3*) cat <<\_LT_EOF >> "$cfgfile" # AIX sometimes has problems with the GCC collect2 program. For some # reason, if we set the COLLECT_NAMES environment variable, the problems # vanish in a puff of smoke. if test "X${COLLECT_NAMES+set}" != Xset; then COLLECT_NAMES= export COLLECT_NAMES fi _LT_EOF ;; esac ltmain="$ac_aux_dir/ltmain.sh" # We use sed instead of cat because bash on DJGPP gets confused if # if finds mixed CR/LF and LF-only lines. Since sed operates in # text mode, it properly converts lines to CR/LF. This bash problem # is reportedly fixed, but why not run on old versions too? sed '$q' "$ltmain" >> "$cfgfile" \ || (rm -f "$cfgfile"; exit 1) if test x"$xsi_shell" = xyes; then sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ func_dirname ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ } # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_basename ()$/,/^} # func_basename /c\ func_basename ()\ {\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ func_dirname_and_basename ()\ {\ \ case ${1} in\ \ */*) func_dirname_result="${1%/*}${2}" ;;\ \ * ) func_dirname_result="${3}" ;;\ \ esac\ \ func_basename_result="${1##*/}"\ } # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ func_stripname ()\ {\ \ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ \ # positional parameters, so assign one to ordinary parameter first.\ \ func_stripname_result=${3}\ \ func_stripname_result=${func_stripname_result#"${1}"}\ \ func_stripname_result=${func_stripname_result%"${2}"}\ } # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ func_split_long_opt ()\ {\ \ func_split_long_opt_name=${1%%=*}\ \ func_split_long_opt_arg=${1#*=}\ } # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ func_split_short_opt ()\ {\ \ func_split_short_opt_arg=${1#??}\ \ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ } # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ func_lo2o ()\ {\ \ case ${1} in\ \ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ \ *) func_lo2o_result=${1} ;;\ \ esac\ } # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_xform ()$/,/^} # func_xform /c\ func_xform ()\ {\ func_xform_result=${1%.*}.lo\ } # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_arith ()$/,/^} # func_arith /c\ func_arith ()\ {\ func_arith_result=$(( $* ))\ } # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_len ()$/,/^} # func_len /c\ func_len ()\ {\ func_len_result=${#1}\ } # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$lt_shell_append" = xyes; then sed -e '/^func_append ()$/,/^} # func_append /c\ func_append ()\ {\ eval "${1}+=\\${2}"\ } # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ func_append_quoted ()\ {\ \ func_quote_for_eval "${2}"\ \ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ } # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: # Save a `func_append' function call where possible by direct use of '+=' sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: else # Save a `func_append' function call even when '+=' is not available sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ && mv -f "$cfgfile.tmp" "$cfgfile" \ || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") test 0 -eq $? || _lt_function_replace_fail=: fi if test x"$_lt_function_replace_fail" = x":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 $as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} fi 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 (recommended: yes)" else echo " Building library : no (recommended: yes)" fi if test "$fuse_build" = "yes"; then echo " Building avfsd for fuse : yes (recommended: yes)" else echo " Building avfsd for fuse : no (recommended: yes)" fi if test "$preload_build" = "yes"; then echo " Building preload library : yes (recommended: no)" else echo " Building preload library : no (recommended: no)" fi if test "$avfscoda_build" = "yes"; then echo " Building avfscoda daemon and kernel module: yes (recommended: no)" else echo " Building avfscoda daemon and kernel module: no (recommended: no)" fi echo "" if test "x$use_system_zlib" = "xyes"; then echo " Use system zlib : yes (recommended: no, slower access)" else echo " Use system zlib : no (recommended: no)" fi if test "x$use_system_bzlib" = "xyes"; then echo " Use system bzlib : yes (recommended: no, slower access)" else echo " Use system bzlib : no (recommended: no)" fi if test "x$use_liblzma" = "xyes"; then echo " Use liblzma : yes (recommended: yes)" else echo " Use liblzma : no (recommended: yes)" fi echo "" echo " Installation prefix : $prefix" echo "" avfs-1.0.5/libneon/0000755000175000017500000000000013102441322013660 5ustar michaelmichaelavfs-1.0.5/libneon/nsocket.h0000644000175000017500000001730213102441254015506 0ustar michaelmichael/* socket handling interface Copyright (C) 1999-2001, Joe Orton 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 */ #ifndef NSOCKET_H #define NSOCKET_H #ifdef WIN32 #include #include #else #include #include #include #endif #include "neon_defs.h" BEGIN_NEON_DECLS #define SOCK_ERROR -1 /* Read/Write timed out */ #define SOCK_TIMEOUT -2 /* Passed buffer was full */ #define SOCK_FULL -3 /* Socket was closed */ #define SOCK_CLOSED -4 /* Socket read timeout */ #define SOCKET_READ_TIMEOUT 120 typedef enum { sock_namelookup, /* Looking up hostname given by info */ sock_connecting, /* Connecting to server */ sock_connected, /* Connection established */ sock_secure_details /* Secure connection details */ } sock_status; struct nsocket_s; typedef struct nsocket_s nsocket; typedef void (*sock_block_reader) ( void *userdata, const char *buf, size_t len); typedef void (*sock_progress)(void *userdata, off_t progress, off_t total); typedef void (*sock_notify)(void *userdata, sock_status status, const char *info); void sock_register_progress(sock_progress cb, void *userdata); void sock_register_notify(sock_notify cb, void *userdata); void sock_call_progress(off_t progress, off_t total); /* Initialize the socket library. If you don't do this, SSL WILL NOT WORK. * Returns 0 on success, or non-zero on screwed up SSL library. */ int sock_init(void); /* Shutdown the socket library. */ void sock_exit(void); /* sock_read is read() with a timeout of SOCKET_TIMEOUT. * Returns: * SOCK_* on error, * 0 on no data to read (due to EOF), * >0 length of data read into buffer. */ int sock_read(nsocket *sock, char *buffer, size_t count); /* sock_peek is recv() with a timeout of SOCKET_TIMEOUT. * Returns: * SOCK_* on error, * 0 on no data to read (due to EOF), * >0 length of data read into buffer. */ int sock_peek(nsocket *sock, char *buffer, size_t count); /* Blocks waiting for data on the given socket for the given time. * Returns: * SOCK_* on error, * SOCK_TIMEOUT on no data within timeout, * 0 if data arrived on the socket. */ int sock_block(nsocket *sock, int timeout); /* Reads readlen bytes from fd and writes to socket. * (Not all in one go, obviously). * If readlen == -1, then it reads from srcfd until EOF. * Returns number of bytes written to destfd, or SOCK_* on error. */ int sock_transfer(int fd, nsocket *sock, off_t readlen); /* Sends the given line to given socket, CRLF appended */ int sock_sendline(nsocket *sock, const char *line); /* Sends the given block of data down the nsocket */ int sock_fullwrite(nsocket *sock, const char *data, size_t length); /* Sends the null-terminated string down the given nsocket */ int sock_send_string(nsocket *sock, const char *string); /* Reads a line from given nsocket */ int sock_readline(nsocket *sock, char *line, int len); /* Reads a chunk of data. */ int sock_fullread(nsocket *sock, char *buffer, int buflen); /* Creates and connects a nsocket */ nsocket *sock_connect(const struct in_addr host, unsigned short int portnum); /* Weirdo version of the above, which should go away */ nsocket *sock_connect_u(const struct in_addr addr, unsigned short int portnum, int call_fe); /* Not as good as accept(2), missing parms 2+3. * Addings parms 2+3 would probably mean passing socklen_t as an * int then casting internally, since we don't really want to * autogenerate the header file to be correct for the build platform. */ nsocket *sock_accept(int listener); /* Returns the file descriptor used for the socket */ int sock_get_fd(nsocket *sock); /* Closes the socket and frees the nsocket object. */ int sock_close(nsocket *sock); const char *sock_get_error(nsocket *sock); /* Do a name lookup on given hostname, writes the address into * given address buffer. Return -1 on failure. */ int sock_name_lookup(const char *hostname, struct in_addr *addr); /* Returns the standard TCP port for the given service */ int sock_service_lookup(const char *name); /* Read from socket, passing each block read to reader callback. * Pass userdata as first argument to reader callback. * * If length is -1, keep going till EOF is returned. SOCK_CLOSED * is never returned in this case. * * Otherwise, read exactly 'length' bytes. If EOF is encountered * before length bytes have been read, and SOCK_CLOSED will be * returned. * * Returns: * 0 on success, * SOCK_* on error (SOCK_CLOSED is a special case, as above) */ int sock_readfile_blocked(nsocket *sock, off_t length, sock_block_reader reader, void *userdata); /* Auxiliary for use with SSL. */ struct nssl_context_s; typedef struct nssl_context_s nssl_context; /* Netscape's prompts on getting a certificate which it doesn't * recognize the CA for: * 1. Hey, I don't recognize the CA for this cert. * 2. Here is the certificate: for foo signed by BLAH, * using encryption level BLEE * 3. Allow: accept for this session only, * don't accept * accept forever */ nssl_context *sock_create_ssl_context(void); void sock_destroy_ssl_context(nssl_context *ctx); /* Callback to decide whether the user will accept the * given certificate or not */ typedef struct { char *owner; /* Multi-line string describing owner of * certificate */ char *issuer; /* As above for issuer of certificate */ /* Strings the certificate is valid between */ char *valid_from, *valid_till; /* Certificate fingerprint */ char *fingerprint; } nssl_certificate; /* Returns: * 0 -> User accepts the certificate * non-zero -> user does NOT accept the certificate. */ typedef int (*nssl_accept)(void *userdata, const nssl_certificate *info); void sock_set_cert_accept(nssl_context *c, nssl_accept accepter, void *userdata); /* Callback for retrieving the private key password. * Filename will be the filename of the private key file. * Must return: * 0 on success. buf must be filled in with the password. * non-zero if the user cancelled the prompt. * * FIXME: this is inconsistent with the HTTP authentication callbacks. */ typedef int (*nssl_key_prompt)(void *userdata, const char *filename, char *buf, int buflen); void sock_set_key_prompt(nssl_context *c, nssl_key_prompt prompt, void *userdata); /* For PEM-encoded client certificates: use the given client * certificate and private key file. * Returns: 0 if certificate is read okay, * non-zero otherwise. * For decoding the private key file, the callback above will be used * to prompt for the password. If no callback has been set, then the * OpenSSL default will be used: the prompt appears on the terminal. * */ int sock_set_client_cert(nssl_context *ctx, const char *certfile, const char *keyfile); void sock_disable_tlsv1(nssl_context *c); void sock_disable_sslv2(nssl_context *c); void sock_disable_sslv3(nssl_context *c); /* Ctx is OPTIONAL. If it is NULL, defaults are used. */ int sock_make_secure(nsocket *sock, nssl_context *ctx); END_NEON_DECLS #endif /* NSOCKET_H */ avfs-1.0.5/libneon/string_utils.c0000644000175000017500000002645513102441254016572 0ustar michaelmichael/* String utility functions Copyright (C) 1999-2001, Joe Orton 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 */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #include "ne_alloc.h" #include "string_utils.h" struct sbuffer_s { char *data; /* KEEP THIS HERE, to allow SBUFFER_CAST to work */ size_t used; /* used bytes in buffer */ size_t length; /* length of buffer */ }; /* TODO: These are both crap. Rewrite to be like strsep(). */ char **split_string(const char *str, const char separator, const char *quotes, const char *whitespace) { return split_string_c(str, separator, quotes, whitespace, NULL); } char **split_string_c(const char *str, const char separator, const char *quotes, const char *whitespace, int *give_count) { char **comps; const char *pnt, *quot = NULL, *start, *end; /* The start of the current component */ int count, /* The number of components */ iswhite, /* is it whitespace */ issep, /* is it the separator */ curr, /* current component index */ length, /* length of component */ leading_wspace; /* in leading whitespace still? */ /* Inefficient, but easier - first off, count the number of * components we have. */ count = 1; for (pnt = str; *pnt!='\0'; pnt++) { if (quotes != NULL) { quot = strchr(quotes, *pnt); } if (quot != NULL) { /* We found a quote, so skip till the next quote */ for (pnt++; (*pnt!=*quot) && (*pnt!='\0'); pnt++) /* nullop */; } else if (*pnt == separator) { count++; } } if (give_count) { /* Write the count */ *give_count = count; } /* Now, have got the number of components. * Allocate the comps array. +1 for the NULL */ comps = ne_malloc(sizeof(char *) * (count + 1)); comps[count] = NULL; quot = end = start = NULL; curr = 0; leading_wspace = 1; /* Now fill in the array */ for (pnt = str; *pnt != '\0'; pnt++) { /* What is the current character - quote, whitespace, separator? */ if (quotes != NULL) { quot = strchr(quotes, *pnt); } iswhite = (whitespace!=NULL) && (strchr(whitespace, *pnt) != NULL); issep = (*pnt == separator); /* What to do? */ if (leading_wspace) { if (quot!=NULL) { /* Quoted bit */ start = pnt; length = 1; leading_wspace = 0; } else if (issep) { /* Zero-length component */ comps[curr++] = ne_strdup(""); } else if (!iswhite) { start = end = pnt; length = 1; leading_wspace = 0; } } else { if (quot!=NULL) { /* Quoted bit */ length++; } else if (issep) { /* End of component - enter it into the array */ length = (end - start) + 1; comps[curr] = ne_malloc(length+1); memcpy(comps[curr], start, length); comps[curr][length] = '\0'; curr++; leading_wspace = 1; } else if (!iswhite) { /* Not whitespace - update end marker */ end = pnt; } } if (quot != NULL) { /* Skip to closing quote */ for (pnt++; *pnt!=*quot && *pnt != '\0'; ++pnt) /* nullop */; /* Last non-wspace char is closing quote */ end = pnt; } } /* Handle final component */ if (leading_wspace) { comps[curr] = ne_strdup(""); } else { /* End of component - enter it into the array */ length = (end - start) + 1; comps[curr] = ne_malloc(length+1); memcpy(comps[curr], start, length); comps[curr][length] = '\0'; } return comps; } char **pair_string(const char *str, const char compsep, const char kvsep, const char *quotes, const char *whitespace) { char **comps, **pairs, *split; int count = 0, n, length; comps = split_string_c(str, compsep, quotes, whitespace, &count); /* Allocate space for 2* as many components as split_string returned, * +2 for the NULLS. */ pairs = ne_malloc((2*count+2) * sizeof(char *)); if (pairs == NULL) { return NULL; } for (n = 0; n < count; n++) { /* Find the split */ split = strchr(comps[n], kvsep); if (split == NULL) { /* No seperator found */ length = strlen(comps[n]); } else { length = split-comps[n]; } /* Enter the key into the array */ pairs[2*n] = comps[n]; /* Null-terminate the key */ pairs[2*n][length] = '\0'; pairs[2*n+1] = split?(split + 1):NULL; } free(comps); pairs[2*count] = pairs[2*count+1] = NULL; return pairs; } void split_string_free(char **components) { char **pnt = components; while (*pnt != NULL) { free(*pnt); pnt++; } free(components); } void pair_string_free(char **pairs) { int n; for (n = 0; pairs[n] != NULL; n+=2) { free(pairs[n]); } free(pairs); } char *shave_string(const char *str, const char ch) { size_t len = strlen(str); char *ret; if (str[len-1] == ch) { len--; } if (str[0] == ch) { len--; str++; } ret = ne_malloc(len + 1); memcpy(ret, str, len); ret[len] = '\0'; return ret; } char *ne_concat(const char *str, ...) { va_list ap; sbuffer tmp = sbuffer_create(); sbuffer_zappend(tmp, str); va_start(ap, str); sbuffer_concat(tmp, ap); va_end(ap); return sbuffer_finish(tmp); } char *sbuffer_data(sbuffer buf) { return buf->data; } int sbuffer_size(sbuffer buf) { return buf->used - 1; } void sbuffer_clear(sbuffer buf) { memset(buf->data, 0, buf->length); buf->used = 1; } /* Grows for given size, returns 0 on success, -1 on error. */ int sbuffer_grow(sbuffer buf, size_t newsize) { size_t newlen, oldbuflen; #define SBUFFER_GROWTH 512 if (newsize <= buf->length) return 0; /* big enough already */ /* FIXME: ah, can't remember my maths... better way to do this? */ newlen = ((newsize / SBUFFER_GROWTH) + 1) * SBUFFER_GROWTH; oldbuflen = buf->length; /* Reallocate bigger buffer */ buf->data = realloc(buf->data, newlen); if (buf->data == NULL) return -1; buf->length = newlen; /* Zero-out the new bit of buffer */ memset(buf->data+oldbuflen, 0, newlen-oldbuflen); return 0; } int sbuffer_concat(sbuffer buf, ...) { va_list ap; char *next; size_t totallen = buf->used; /* Find out how much space we need for all the args */ va_start(ap, buf); do { next = va_arg(ap, char *); if (next != NULL) { totallen += strlen(next); } } while (next != NULL); va_end(ap); /* Grow the buffer */ if (sbuffer_grow(buf, totallen)) return -1; /* Now append the arguments to the buffer */ va_start(ap, buf); do { next = va_arg(ap, char *); if (next != NULL) { /* TODO: use stpcpy */ strcat(buf->data, next); } } while (next != NULL); va_end(ap); buf->used = totallen; return 0; } /* Append zero-terminated string... returns 0 on success or -1 on * realloc failure. */ int sbuffer_zappend(sbuffer buf, const char *str) { size_t len = strlen(str); if (sbuffer_grow(buf, buf->used + len)) { return -1; } strcat(buf->data, str); buf->used += len; return 0; } int sbuffer_append(sbuffer buf, const char *data, size_t len) { if (sbuffer_grow(buf, buf->used + len)) { return -1; } memcpy(buf->data + buf->used - 1, data, len); buf->used += len; buf->data[buf->used - 1] = '\0'; return 0; } sbuffer sbuffer_create(void) { return sbuffer_create_sized(512); } sbuffer sbuffer_create_sized(size_t s) { sbuffer buf = ne_malloc(sizeof(struct sbuffer_s)); buf->data = ne_calloc(s); buf->length = s; buf->used = 1; return buf; } void sbuffer_destroy(sbuffer buf) { if (buf->data) { free(buf->data); } free(buf); } char *sbuffer_finish(sbuffer buf) { char *ret = buf->data; free(buf); return ret; } void sbuffer_altered(sbuffer buf) { buf->used = strlen(buf->data) + 1; } /* Writes the ASCII representation of the MD5 digest into the * given buffer, which must be at least 33 characters long. */ void md5_to_ascii(const unsigned char md5_buf[16], char *buffer) { int count; for (count = 0; count<16; count++) { buffer[count*2] = HEX2ASC(md5_buf[count] >> 4); buffer[count*2+1] = HEX2ASC(md5_buf[count] & 0x0f); } buffer[32] = '\0'; } /* Reads the ASCII representation of an MD5 digest. The buffer must * be at least 32 characters long. */ void ascii_to_md5(const char *buffer, unsigned char md5_buf[16]) { int count; for (count = 0; count<16; count++) { md5_buf[count] = ((ASC2HEX(buffer[count*2])) << 4) | ASC2HEX(buffer[count*2+1]); } } char *ne_utf8_encode(const char *str) { char *buffer = ne_malloc(strlen(str) * 2 + 1); int in, len = strlen(str); char *out; for (in = 0, out = buffer; in < len; in++, out++) { if ((unsigned char)str[in] <= 0x7D) { *out = str[in]; } else { *out++ = 0xC0 | ((str[in] & 0xFC) >> 6); *out = str[in] & 0xBF; } } /* nul-terminate */ *out = '\0'; return buffer; } #ifdef SPLIT_STRING_TEST #include int main(int argc, char *argv[]) { char *str, sep, **comps, *wspace, *quotes; int count; if (argc < 3) { printf("Usage: split_string [whitespace] [quotes]\n"); return -1; } sep = *argv[1]; str = argv[2]; if (argc > 3) { wspace = argv[3]; } else { wspace = " "; } if (argc > 4) { quotes = argv[4]; } else { quotes = "\""; } printf("String: [%s] Separator: `%c' Whitespace: [%s] Quotes: [%s]\n", str, sep, wspace, quotes); comps = split_string(str, sep, quotes, wspace); count = 0; do { printf("Component #%d: [%s]\n", count, comps[count]); } while (comps[++count] != NULL); return 0; } #endif #ifdef PAIR_STRING_TEST #include int main(int argc, char *argv[]) { char *str, compsep, kvsep, **comps, *wspace, *quotes; int count; if (argc < 4) { printf("Usage: pair_string [whitespace] [quotes]\n"); return -1; } compsep = *argv[1]; kvsep = *argv[2]; str = argv[3]; if (argc > 4) { wspace = argv[4]; } else { wspace = " "; } if (argc > 5) { quotes = argv[5]; } else { quotes = "\""; } printf("String: [%s] CompSep: `%c' K/VSep: `%c'\nWhitespace: [%s] Quotes: [%s]\n", str, compsep, kvsep, wspace, quotes); comps = pair_string(str, compsep, kvsep, quotes, wspace); count = 0; do { printf("Component #%d: Key [%s] Value [%s]\n", count, comps[count], comps[count+1]); } while (comps[(count+=2)] != NULL); return 0; } #endif /* variables: * * Local variables: * compile-command: "gcc -g -O2 -Wall -I.. -ansi -DHAVE_CONFIG_H -DSPLIT_STRING_TEST -o split_string string_utils.c" * End: */ avfs-1.0.5/libneon/http_auth.c0000644000175000017500000006313113102441254016034 0ustar michaelmichael/* HTTP Authentication routines Copyright (C) 1999-2001, Joe Orton 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 */ /* HTTP Authentication, as per RFC2617. * * TODO: * - Improve cnonce? Make it really random using /dev/random or whatever? * - Test auth-int support */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #include #ifdef HAVE_STRING_H #include #endif #include #ifdef HAVE_SNPRINTF_H #include "snprintf.h" #endif #include "base64.h" #include "dates.h" #include "http_auth.h" #include "string_utils.h" #include "uri.h" #include "http_utils.h" #include "ne_alloc.h" /* The MD5 digest of a zero-length entity-body */ #define DIGEST_MD5_EMPTY "d41d8cd98f00b204e9800998ecf8427e" /* A challenge */ struct http_auth_chall { http_auth_scheme scheme; char *realm; char *domain; char *nonce; char *opaque; unsigned int stale:1; /* if stale=true */ unsigned int got_qop:1; /* we were given a qop directive */ unsigned int qop_auth:1; /* "auth" token in qop attrib */ unsigned int qop_auth_int:1; /* "auth-int" token in qop attrib */ http_auth_algorithm alg; struct http_auth_chall *next; }; static const char *qop_values[] = { NULL, "auth", "auth-int" }; static const char *algorithm_names[] = { "MD5", "MD5-sess", NULL }; /* Private prototypes */ static char *get_cnonce(void); static void clean_session(http_auth_session *sess); static int digest_challenge(http_auth_session *, struct http_auth_chall *); static int basic_challenge(http_auth_session *, struct http_auth_chall *); static char *request_digest(http_auth_session *); static char *request_basic(http_auth_session *); /* Domain handling */ static int is_in_domain(http_auth_session *sess, const char *uri); static int parse_domain(http_auth_session *sess, const char *domain); /* Get the credentials, passing a temporary store for the password value */ static int get_credentials(http_auth_session *sess, char **password); /* Initialize an auth session */ void http_auth_init(http_auth_session *sess) { memset(sess, 0, sizeof(http_auth_session)); } http_auth_session *http_auth_create(void) { http_auth_session *sess = ne_calloc(sizeof(http_auth_session)); http_auth_init(sess); return sess; } void http_auth_destroy(http_auth_session *sess) { http_auth_finish(sess); free(sess); } void http_auth_set_creds_cb(http_auth_session *sess, http_auth_request_creds callback, void *userdata) { sess->reqcreds = callback; sess->reqcreds_udata = userdata; } #if 0 void http_auth_set_server(http_auth_session *sess, const char *host, unsigned int port, const char *scheme) { sess->host = host; sess->port = port; sess->req_scheme = scheme; } #endif /* Start a new request. */ void http_auth_new_request(http_auth_session *sess, const char *method, const char *uri, const char *body_buffer, FILE *body_stream) { if (!sess->can_handle) { DEBUG(DEBUG_HTTPAUTH, "Not handling session.\n"); } else if (!is_in_domain(sess, uri)) { /* We have moved out of the authentication domain */ DEBUG(DEBUG_HTTPAUTH, "URI %s outside session domain, not handling.\n", uri); sess->will_handle = 0; } else { DEBUG(DEBUG_HTTPAUTH, "URI %s inside session domain, will handle.\n", uri); sess->will_handle = 1; sess->uri = uri; sess->method = method; sess->got_body = (body_buffer!=NULL) || (body_stream!=NULL); sess->body_buffer = body_buffer; sess->body_stream = body_stream; md5_init_ctx(&sess->response_body); } } static void clean_session(http_auth_session *sess) { sess->can_handle = 0; HTTP_FREE(sess->basic); HTTP_FREE(sess->unq_realm); HTTP_FREE(sess->unq_nonce); HTTP_FREE(sess->unq_cnonce); HTTP_FREE(sess->opaque); HTTP_FREE(sess->username); if (sess->domain_count > 0) { split_string_free(sess->domain); sess->domain_count = 0; } } void http_auth_finish(http_auth_session *sess) { clean_session(sess); } /* Returns cnonce-value. We just use base64(time). * TODO: Could improve this? */ static char *get_cnonce(void) { char *ret, *tmp; tmp = rfc1123_date(time(NULL)); ret = base64(tmp); free(tmp); return ret; } static int get_credentials(http_auth_session *sess, char **password) { return (*sess->reqcreds)(sess->reqcreds_udata, sess->unq_realm, &sess->username, password); } static int parse_domain(http_auth_session *sess, const char *domain) { char *unq, **doms; int count, ret; unq = shave_string(domain, '"'); doms = split_string_c(unq, ' ', NULL, HTTP_WHITESPACE, &count); if (doms != NULL) { if (count > 0) { sess->domain = doms; sess->domain_count = count; ret = 0; } else { free(doms); ret = -1; } } else { ret = -1; } free(unq); return ret; } /* Returns: * 0: if uri is in NOT in domain of session * else: uri IS in domain of session (or no domain known) */ static int is_in_domain(http_auth_session *sess, const char *uri) { #if 1 return 1; #else /* TODO: Need proper URI comparison for this to work. */ int ret, dom; const char *abs_path; if (sess->domain_count == 0) { DEBUG(DEBUG_HTTPAUTH, "No domain, presuming okay.\n"); return 1; } ret = 0; abs_path = uri_abspath(uri); for (dom = 0; dom < sess->domain_count; dom++) { DEBUG(DEBUG_HTTPAUTH, "Checking domain: %s\n", sess->domain[dom]); if (uri_childof(sess->domain[dom], abs_path)) { ret = 1; break; } } return ret; #endif } /* Add authentication creditials to a request */ char *http_auth_request_header(http_auth_session *sess) { if (sess->will_handle) { switch(sess->scheme) { case http_auth_scheme_basic: return request_basic(sess); break; case http_auth_scheme_digest: return request_digest(sess); break; default: break; } } return NULL; } /* Examine a Basic auth challenge. * Returns 0 if an valid challenge, else non-zero. */ static int basic_challenge(http_auth_session *sess, struct http_auth_chall *parms) { char *tmp, *password; /* Verify challenge... must have a realm */ if (parms->realm == NULL) { return -1; } DEBUG(DEBUG_HTTPAUTH, "Got Basic challenge with realm [%s]\n", parms->realm); clean_session(sess); sess->unq_realm = shave_string(parms->realm, '"'); if (get_credentials(sess, &password)) { /* Failed to get credentials */ HTTP_FREE(sess->unq_realm); return -1; } sess->scheme = http_auth_scheme_basic; CONCAT3(tmp, sess->username, ":", password?password:""); sess->basic = base64(tmp); free(tmp); HTTP_FREE(password); return 0; } /* Add Basic authentication credentials to a request */ static char *request_basic(http_auth_session *sess) { char *buf; CONCAT3(buf, "Basic ", sess->basic, "\r\n"); return buf; } /* Examine a digest challenge: return 0 if it is a valid Digest challenge, * else non-zero. */ static int digest_challenge(http_auth_session *sess, struct http_auth_chall *parms) { struct md5_ctx tmp; unsigned char tmp_md5[16]; char *password; /* Do we understand this challenge? */ if (parms->alg == http_auth_alg_unknown) { DEBUG(DEBUG_HTTPAUTH, "Unknown algorithm.\n"); return -1; } if ((parms->alg == http_auth_alg_md5_sess) && !(parms->qop_auth || parms->qop_auth_int)) { DEBUG(DEBUG_HTTPAUTH, "Server did not give qop with MD5-session alg.\n"); return -1; } if ((parms->realm==NULL) || (parms->nonce==NULL)) { DEBUG(DEBUG_HTTPAUTH, "Challenge missing nonce or realm.\n"); return -1; } if (parms->stale) { /* Just a stale response, don't need to get a new username/password */ DEBUG(DEBUG_HTTPAUTH, "Stale digest challenge.\n"); } else { /* Forget the old session details */ DEBUG(DEBUG_HTTPAUTH, "In digest challenge.\n"); clean_session(sess); sess->unq_realm = shave_string(parms->realm, '"'); /* Not a stale response: really need user authentication */ if (get_credentials(sess, &password)) { /* Failed to get credentials */ HTTP_FREE(sess->unq_realm); return -1; } } sess->alg = parms->alg; sess->scheme = http_auth_scheme_digest; sess->unq_nonce = shave_string(parms->nonce, '"'); sess->unq_cnonce = get_cnonce(); if (parms->domain) { if (parse_domain(sess, parms->domain)) { /* TODO: Handle the error? */ } } else { sess->domain = NULL; sess->domain_count = 0; } if (parms->opaque != NULL) { sess->opaque = ne_strdup(parms->opaque); /* don't strip the quotes */ } if (parms->got_qop) { /* What type of qop are we to apply to the message? */ DEBUG(DEBUG_HTTPAUTH, "Got qop directive.\n"); sess->nonce_count = 0; if (parms->qop_auth_int) { sess->qop = http_auth_qop_auth_int; } else { sess->qop = http_auth_qop_auth; } } else { /* No qop at all/ */ sess->qop = http_auth_qop_none; } if (!parms->stale) { /* Calculate H(A1). * tmp = H(unq(username-value) ":" unq(realm-value) ":" passwd) */ DEBUG(DEBUG_HTTPAUTH, "Calculating H(A1).\n"); md5_init_ctx(&tmp); md5_process_bytes(sess->username, strlen(sess->username), &tmp); md5_process_bytes(":", 1, &tmp); md5_process_bytes(sess->unq_realm, strlen(sess->unq_realm), &tmp); md5_process_bytes(":", 1, &tmp); if (password != NULL) md5_process_bytes(password, strlen(password), &tmp); md5_finish_ctx(&tmp, tmp_md5); if (sess->alg == http_auth_alg_md5_sess) { unsigned char a1_md5[16]; struct md5_ctx a1; char tmp_md5_ascii[33]; /* Now we calculate the SESSION H(A1) * A1 = H(...above...) ":" unq(nonce-value) ":" unq(cnonce-value) */ md5_to_ascii(tmp_md5, tmp_md5_ascii); md5_init_ctx(&a1); md5_process_bytes(tmp_md5_ascii, 32, &a1); md5_process_bytes(":", 1, &a1); md5_process_bytes(sess->unq_nonce, strlen(sess->unq_nonce), &a1); md5_process_bytes(":", 1, &a1); md5_process_bytes(sess->unq_cnonce, strlen(sess->unq_cnonce), &a1); md5_finish_ctx(&a1, a1_md5); md5_to_ascii(a1_md5, sess->h_a1); DEBUG(DEBUG_HTTPAUTH, "Session H(A1) is [%s]\n", sess->h_a1); } else { md5_to_ascii(tmp_md5, sess->h_a1); DEBUG(DEBUG_HTTPAUTH, "H(A1) is [%s]\n", sess->h_a1); } HTTP_FREE(password); } DEBUG(DEBUG_HTTPAUTH, "I like this Digest challenge.\n"); return 0; } /* Return Digest authentication credentials header value for the given * session. */ static char *request_digest(http_auth_session *sess) { struct md5_ctx a2, rdig; unsigned char a2_md5[16], rdig_md5[16]; char a2_md5_ascii[33], rdig_md5_ascii[33]; char nc_value[9] = {0}, *ret; const char *qop_value; /* qop-value */ size_t retlen; /* Increase the nonce-count */ if (sess->qop != http_auth_qop_none) { sess->nonce_count++; snprintf(nc_value, 9, "%08x", sess->nonce_count); DEBUG(DEBUG_HTTPAUTH, "Nonce count is %d, nc is [%s]\n", sess->nonce_count, nc_value); } qop_value = qop_values[sess->qop]; /* Calculate H(A2). */ md5_init_ctx(&a2); md5_process_bytes(sess->method, strlen(sess->method), &a2); md5_process_bytes(":", 1, &a2); md5_process_bytes(sess->uri, strlen(sess->uri), &a2); if (sess->qop == http_auth_qop_auth_int) { /* Calculate H(entity-body) */ if (sess->got_body) { char tmp_md5_ascii[33]; unsigned char tmp_md5[16]; if (sess->body_stream != NULL) { DEBUG(DEBUG_HTTPAUTH, "Digesting body stream.\n"); md5_stream(sess->body_stream, tmp_md5); rewind(sess->body_stream); /* leave it at the beginning */ } else if (sess->body_buffer) { DEBUG(DEBUG_HTTPAUTH, "Digesting body buffer.\n"); md5_buffer(sess->body_buffer, strlen(sess->body_buffer), tmp_md5); } md5_to_ascii(tmp_md5, tmp_md5_ascii); DEBUG(DEBUG_HTTPAUTH, "H(entity-body) is [%s]\n", tmp_md5_ascii); /* Append to A2 */ md5_process_bytes(":", 1, &a2); md5_process_bytes(tmp_md5_ascii, 32, &a2); } else { /* No entity-body. */ DEBUG(DEBUG_HTTPAUTH, "Digesting empty entity-body.\n"); md5_process_bytes(":" DIGEST_MD5_EMPTY, 33, &a2); } } md5_finish_ctx(&a2, a2_md5); md5_to_ascii(a2_md5, a2_md5_ascii); DEBUG(DEBUG_HTTPAUTH, "H(A2): %s\n", a2_md5_ascii); DEBUG(DEBUG_HTTPAUTH, "Calculating Request-Digest.\n"); /* Now, calculation of the Request-Digest. * The first section is the regardless of qop value * H(A1) ":" unq(nonce-value) ":" */ md5_init_ctx(&rdig); /* Use the calculated H(A1) */ md5_process_bytes(sess->h_a1, 32, &rdig); md5_process_bytes(":", 1, &rdig); md5_process_bytes(sess->unq_nonce, strlen(sess->unq_nonce), &rdig); md5_process_bytes(":", 1, &rdig); if (sess->qop != http_auth_qop_none) { /* Add on: * nc-value ":" unq(cnonce-value) ":" unq(qop-value) ":" */ DEBUG(DEBUG_HTTPAUTH, "Have qop directive, digesting: [%s:%s:%s]\n", nc_value, sess->unq_cnonce, qop_value); md5_process_bytes(nc_value, 8, &rdig); md5_process_bytes(":", 1, &rdig); md5_process_bytes(sess->unq_cnonce, strlen(sess->unq_cnonce), &rdig); md5_process_bytes(":", 1, &rdig); /* Store a copy of this structure (see note below) */ sess->stored_rdig = rdig; md5_process_bytes(qop_value, strlen(qop_value), &rdig); md5_process_bytes(":", 1, &rdig); } else { /* Store a copy of this structure... we do this because the * calculation of the rspauth= field in the Auth-Info header * is the same as this digest, up to this point. */ sess->stored_rdig = rdig; } /* And finally, H(A2) */ md5_process_bytes(a2_md5_ascii, 32, &rdig); md5_finish_ctx(&rdig, rdig_md5); md5_to_ascii(rdig_md5, rdig_md5_ascii); /* Buffer size calculation. */ retlen = 6 /* Digest */ + 1 + 8 + 1 + 2 + strlen(sess->username) /* username="..." */ + 2 + 5 + 1 + 2 + strlen(sess->unq_realm) /* , realm="..." */ + 2 + 5 + 1 + 2 + strlen(sess->unq_nonce) /* , nonce="..." */ + 2 + 3 + 1 + 2 + strlen(sess->uri) /* , uri="..." */ + 2 + 8 + 1 + 2 + 32 /* , response="..." */ + 2 + 9 + 1 + 2 + strlen(algorithm_names[sess->alg]) /* , algorithm="..." */ ; if (sess->opaque != NULL) retlen += 2 + 6 + 1 + strlen(sess->opaque); /* , opaque=... */ if (sess->qop != http_auth_qop_none) retlen += 2 + 6 + 2 + 1 + strlen(sess->unq_cnonce) + /* , cnonce="..." */ 2 + 2 + 1 + 8 + /* , nc=... */ 2 + 3 + 1 + 2 + strlen(qop_values[sess->qop]) /* , qop="..." */ ; retlen += 2; /* \r\n */ DEBUG(DEBUG_HTTPAUTH, "Calculated length of buffer: %d\n", retlen); ret = ne_calloc(retlen + 1); sprintf(ret, "Digest username=\"%s\", realm=\"%s\"" ", nonce=\"%s\", uri=\"%s\", response=\"%s\"" ", algorithm=\"%s\"", sess->username, sess->unq_realm, sess->unq_nonce, sess->uri, rdig_md5_ascii, algorithm_names[sess->alg]); if (sess->opaque != NULL) { /* We never unquote it, so it's still quoted here */ strcat(ret, ", opaque="); strcat(ret, sess->opaque); } if (sess->qop != http_auth_qop_none) { /* Add in cnonce and nc-value fields */ strcat(ret, ", cnonce=\""); strcat(ret, sess->unq_cnonce); strcat(ret, "\", nc="); strcat(ret, nc_value); strcat(ret, ", qop=\""); strcat(ret, qop_values[sess->qop]); strcat(ret, "\""); } DEBUG(DEBUG_HTTPAUTH, "Digest header field value:\n%s\n", ret); strcat(ret, "\r\n"); DEBUG(DEBUG_HTTPAUTH, "Calculated length: %d, actual length: %d\n", retlen, strlen(ret)); return ret; } void http_auth_response_body(http_auth_session *sess, const char *buffer, size_t buffer_len) { if (!sess->will_handle || sess->scheme != http_auth_scheme_digest) return; DEBUG(DEBUG_HTTPAUTH, "Digesting %d bytes of response body.\n", buffer_len); md5_process_bytes(buffer, buffer_len, &sess->response_body); } /* Pass this the value of the 'Authentication-Info:' header field, if * one is received. * Returns: * 0 if it gives a valid authentication for the server * non-zero otherwise (don't believe the response in this case!). */ int http_auth_verify_response(http_auth_session *sess, const char *value) { char **pairs; http_auth_qop qop = http_auth_qop_none; char *nextnonce = NULL, /* for the nextnonce= value */ *rspauth = NULL, /* for the rspauth= value */ *cnonce = NULL, /* for the cnonce= value */ *nc = NULL, /* for the nc= value */ *unquoted, *qop_value = NULL; int n, nonce_count, okay; if (!sess->will_handle) { /* Ignore it */ return 0; } if (sess->scheme != http_auth_scheme_digest) { DEBUG(DEBUG_HTTPAUTH, "Found Auth-Info header not in response to Digest credentials - dodgy.\n"); return -1; } DEBUG (DEBUG_HTTPAUTH, "Auth-Info header: %s\n", value); pairs = pair_string(value, ',', '=', HTTP_QUOTES, HTTP_WHITESPACE); for (n = 0; pairs[n]!=NULL; n+=2) { unquoted = shave_string(pairs[n+1], '"'); if (strcasecmp(pairs[n], "qop") == 0) { qop_value = ne_strdup(pairs[n+1]); if (strcasecmp(pairs[n+1], "auth-int") == 0) { qop = http_auth_qop_auth_int; } else if (strcasecmp(pairs[n+1], "auth") == 0) { qop = http_auth_qop_auth; } else { qop = http_auth_qop_none; } } else if (strcasecmp(pairs[n], "nextnonce") == 0) { nextnonce = ne_strdup(unquoted); } else if (strcasecmp(pairs[n], "rspauth") == 0) { rspauth = ne_strdup(unquoted); } else if (strcasecmp(pairs[n], "cnonce") == 0) { cnonce = ne_strdup(unquoted); } else if (strcasecmp(pairs[n], "nc") == 0) { nc = ne_strdup(pairs[n]); if (sscanf(pairs[n+1], "%x", &nonce_count) != 1) { DEBUG(DEBUG_HTTPAUTH, "Couldn't scan [%s] for nonce count.\n", pairs[n+1]); } else { DEBUG(DEBUG_HTTPAUTH, "Got nonce_count: %d\n", nonce_count); } } free(unquoted); } pair_string_free(pairs); /* Presume the worst */ okay = -1; if ((qop != http_auth_qop_none) && (qop_value != NULL)) { if ((rspauth == NULL) || (cnonce == NULL) || (nc == NULL)) { DEBUG(DEBUG_HTTPAUTH, "Missing rspauth, cnonce or nc with qop.\n"); } else { /* Have got rspauth, cnonce and nc */ if (strcmp(cnonce, sess->unq_cnonce) != 0) { DEBUG(DEBUG_HTTPAUTH, "Response cnonce doesn't match.\n"); } else if (nonce_count != sess->nonce_count) { DEBUG(DEBUG_HTTPAUTH, "Response nonce count doesn't match.\n"); } else { /* Calculate and check the response-digest value. * joe: IMO the spec is slightly ambiguous as to whether * we use the qop which WE sent, or the qop which THEY * sent... */ struct md5_ctx a2; unsigned char a2_md5[16], rdig_md5[16]; char a2_md5_ascii[33], rdig_md5_ascii[33]; DEBUG(DEBUG_HTTPAUTH, "Calculating response-digest.\n"); /* First off, H(A2) again. */ md5_init_ctx(&a2); md5_process_bytes(":", 1, &a2); md5_process_bytes(sess->uri, strlen(sess->uri), &a2); if (qop == http_auth_qop_auth_int) { unsigned char heb_md5[16]; char heb_md5_ascii[33]; /* Add on ":" H(entity-body) */ md5_finish_ctx(&sess->response_body, heb_md5); md5_to_ascii(heb_md5, heb_md5_ascii); md5_process_bytes(":", 1, &a2); md5_process_bytes(heb_md5_ascii, 32, &a2); DEBUG(DEBUG_HTTPAUTH, "Digested [:%s]\n", heb_md5_ascii); } md5_finish_ctx(&a2, a2_md5); md5_to_ascii(a2_md5, a2_md5_ascii); /* We have the stored digest-so-far of * H(A1) ":" unq(nonce-value) * [ ":" nc-value ":" unq(cnonce-value) ] for qop * in sess->stored_rdig, to save digesting them again. * */ if (qop != http_auth_qop_none) { /* Add in qop-value */ DEBUG(DEBUG_HTTPAUTH, "Digesting qop-value [%s:].\n", qop_value); md5_process_bytes(qop_value, strlen(qop_value), &sess->stored_rdig); md5_process_bytes(":", 1, &sess->stored_rdig); } /* Digest ":" H(A2) */ md5_process_bytes(a2_md5_ascii, 32, &sess->stored_rdig); /* All done */ md5_finish_ctx(&sess->stored_rdig, rdig_md5); md5_to_ascii(rdig_md5, rdig_md5_ascii); DEBUG(DEBUG_HTTPAUTH, "Calculated response-digest of: [%s]\n", rdig_md5_ascii); DEBUG(DEBUG_HTTPAUTH, "Given response-digest of: [%s]\n", rspauth); /* And... do they match? */ okay = (strcasecmp(rdig_md5_ascii, rspauth) == 0)?0:-1; DEBUG(DEBUG_HTTPAUTH, "Matched: %s\n", okay?"nope":"YES!"); } free(rspauth); free(cnonce); free(nc); } free(qop_value); } else { DEBUG(DEBUG_HTTPAUTH, "No qop directive, auth okay.\n"); okay = 0; } /* Check for a nextnonce */ if (nextnonce != NULL) { DEBUG(DEBUG_HTTPAUTH, "Found nextnonce of [%s].\n", nextnonce); if (sess->unq_nonce != NULL) free(sess->unq_nonce); sess->unq_nonce = nextnonce; } return okay; } /* A new challenge presented by the server */ int http_auth_challenge(http_auth_session *sess, const char *value) { char **pairs, *pnt, *unquoted, *key; struct http_auth_chall *chall = NULL, *challenges = NULL; int n, success; DEBUG(DEBUG_HTTPAUTH, "Got new auth challenge: %s\n", value); /* The header value may be made up of one or more challenges. * We split it down into attribute-value pairs, then search for * schemes in the pair keys. */ pairs = pair_string(value, ',', '=', HTTP_QUOTES, HTTP_WHITESPACE); for (n = 0; pairs[n]!=NULL; n+=2) { /* Look for an auth-scheme in the key */ pnt = strchr(pairs[n], ' '); if (pnt != NULL) { /* We have a new challenge */ DEBUG(DEBUG_HTTPAUTH, "New challenge.\n"); chall = ne_calloc(sizeof *chall); chall->next = challenges; challenges = chall; /* Initialize the challenge parameters */ /* Which auth-scheme is it (case-insensitive matching) */ if (strncasecmp(pairs[n], "basic ", 6) == 0) { DEBUG(DEBUG_HTTPAUTH, "Basic scheme.\n"); chall->scheme = http_auth_scheme_basic; } else if (strncasecmp(pairs[n], "digest ", 7) == 0) { DEBUG(DEBUG_HTTPAUTH, "Digest scheme.\n"); chall->scheme = http_auth_scheme_digest; } else { DEBUG(DEBUG_HTTPAUTH, "Unknown scheme.\n"); free(chall); challenges = NULL; break; } /* Now, the real key for this pair starts after the * auth-scheme... skipping whitespace */ while (strchr(HTTP_WHITESPACE, *(++pnt)) != NULL) /* nullop */; key = pnt; } else if (chall == NULL) { /* If we haven't got an auth-scheme, and we're * haven't yet found a challenge, skip this pair. */ continue; } else { key = pairs[n]; } DEBUG(DEBUG_HTTPAUTH, "Got pair: [%s] = [%s]\n", key, pairs[n+1]); /* Most values are quoted, so unquote them here */ unquoted = shave_string(pairs[n+1], '"'); /* Now parse the attribute */ DEBUG(DEBUG_HTTPAUTH, "Unquoted pair is: [%s]\n", unquoted); if (strcasecmp(key, "realm") == 0) { chall->realm = pairs[n+1]; } else if (strcasecmp(key, "nonce") == 0) { chall->nonce = pairs[n+1]; } else if (strcasecmp(key, "opaque") == 0) { chall->opaque = pairs[n+1]; } else if (strcasecmp(key, "domain") == 0) { chall->domain = pairs[n+1]; } else if (strcasecmp(key, "stale") == 0) { /* Truth value */ chall->stale = (strcasecmp(unquoted, "true") == 0); } else if (strcasecmp(key, "algorithm") == 0) { if (strcasecmp(unquoted, "md5") == 0) { chall->alg = http_auth_alg_md5; } else if (strcasecmp(unquoted, "md5-sess") == 0) { chall->alg = http_auth_alg_md5_sess; } else { chall->alg = http_auth_alg_unknown; } } else if (strcasecmp(key, "qop") == 0) { char **qops; int qop; qops = split_string(unquoted, ',', NULL, HTTP_WHITESPACE); chall->got_qop = 1; for (qop = 0; qops[qop] != NULL; qop++) { if (strcasecmp(qops[qop], "auth") == 0) { chall->qop_auth = 1; } else if (strcasecmp(qops[qop], "auth-int") == 0) { chall->qop_auth_int = 1; } } split_string_free(qops); } free(unquoted); } DEBUG(DEBUG_HTTPAUTH, "Finished parsing parameters.\n"); /* Did we find any challenges */ if (challenges == NULL) { pair_string_free(pairs); return -1; } success = 0; DEBUG(DEBUG_HTTPAUTH, "Looking for Digest challenges.\n"); /* Try a digest challenge */ for (chall = challenges; chall != NULL; chall = chall->next) { if (chall->scheme == http_auth_scheme_digest) { if (!digest_challenge(sess, chall)) { success = 1; break; } } } if (!success) { DEBUG(DEBUG_HTTPAUTH, "No good Digest challenges, looking for Basic.\n"); for (chall = challenges; chall != NULL; chall = chall->next) { if (chall->scheme == http_auth_scheme_basic) { if (!basic_challenge(sess, chall)) { success = 1; break; } } } if (!success) { /* No good challenges - record this in the session state */ DEBUG(DEBUG_HTTPAUTH, "Did not understand any challenges.\n"); } } /* Remember whether we can now supply the auth details */ sess->can_handle = success; while (challenges != NULL) { chall = challenges->next; free(challenges); challenges = chall; } /* Free up the parsed header values */ pair_string_free(pairs); return !success; } avfs-1.0.5/libneon/dav_basic.c0000644000175000017500000001552513102441254015753 0ustar michaelmichael/* WebDAV Class 1 namespace operations and 207 error handling Copyright (C) 1999-2001, Joe Orton 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 */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #include "http_request.h" #include "dav_basic.h" #include "uri.h" /* for uri_has_trailing_slash */ #include "http_basic.h" /* for http_content_type */ #include "string_utils.h" /* for sbuffer */ #include "dav_207.h" #include "ne_alloc.h" #ifdef USE_DAV_LOCKS #include "dav_locks.h" #endif /* Handling of 207 errors: we keep a string buffer, and append * messages to it as they come down. * * Note, 424 means it would have worked but something else went wrong. * We will have had the error for "something else", so we display * that, and skip 424 errors. */ /* This is passed as userdata to the 207 code. */ struct context { char *href; sbuffer buf; unsigned int is_error; }; static void *start_response(void *userdata, const char *href) { struct context *ctx = userdata; HTTP_FREE(ctx->href); ctx->href = ne_strdup(href); return NULL; } static void handle_error(struct context *ctx, const char *status_line, const http_status *status, const char *description) { if (status && status->klass != 2) { if (status->code != 424) { ctx->is_error = 1; sbuffer_concat(ctx->buf, ctx->href, ": ", status_line, "\n", NULL); if (description != NULL) { /* TODO: these can be multi-line. Would be good to * word-wrap this at col 80. */ sbuffer_concat(ctx->buf, " -> ", description, "\n", NULL); } } } } static void end_response(void *userdata, void *response, const char *status_line, const http_status *status, const char *description) { struct context *ctx = userdata; handle_error(ctx, status_line, status, description); } static void end_propstat(void *userdata, void *propstat, const char *status_line, const http_status *status, const char *description) { struct context *ctx = userdata; handle_error(ctx, status_line, status, description); } void dav_add_depth_header(http_req *req, int depth) { const char *value; switch(depth) { case DAV_DEPTH_ZERO: value = "0"; break; case DAV_DEPTH_ONE: value = "1"; break; default: value = "infinity"; break; } http_add_request_header(req, "Depth", value); } /* Dispatch a DAV request and handle a 207 error response appropriately */ int dav_simple_request(http_session *sess, http_req *req) { int ret; http_content_type ctype = {0}; struct context ctx = {0}; dav_207_parser *p207; hip_xml_parser *p; p = hip_xml_create(); p207 = dav_207_create(p, &ctx); /* The error string is progressively written into the * sbuffer by the element callbacks */ ctx.buf = sbuffer_create(); dav_207_set_response_handlers(p207, start_response, end_response); dav_207_set_propstat_handlers(p207, NULL, end_propstat); http_add_response_body_reader(req, dav_accept_207, hip_xml_parse_v, p); http_add_response_header_handler(req, "Content-Type", http_content_type_handler, &ctype); dav_207_ignore_unknown(p207); ret = http_request_dispatch(req); if (ret == HTTP_OK) { if (http_get_status(req)->code == 207) { if (!hip_xml_valid(p)) { /* The parse was invalid */ http_set_error(sess, hip_xml_get_error(p)); ret = HTTP_ERROR; } else if (ctx.is_error) { /* If we've actually got any error information * from the 207, then set that as the error */ http_set_error(sess, sbuffer_data(ctx.buf)); ret = HTTP_ERROR; } } else if (http_get_status(req)->klass != 2) { ret = HTTP_ERROR; } } HTTP_FREE(ctype.value); dav_207_destroy(p207); hip_xml_destroy(p); sbuffer_destroy(ctx.buf); HTTP_FREE(ctx.href); http_request_destroy(req); return ret; } static int copy_or_move(http_session *sess, int is_move, int overwrite, const char *src, const char *dest ) { http_req *req = http_request_create( sess, is_move?"MOVE":"COPY", src ); #ifdef USE_DAV_LOCKS if (is_move) { dav_lock_using_resource(req, src, DAV_DEPTH_INFINITE); } dav_lock_using_resource(req, dest, DAV_DEPTH_INFINITE); /* And we need to be able to add members to the destination's parent */ dav_lock_using_parent(req, dest); #endif http_print_request_header(req, "Destination", "%s://%s%s", http_get_scheme(sess), http_get_server_hostport(sess), dest); http_add_request_header(req, "Overwrite", overwrite?"T":"F"); return dav_simple_request(sess, req); } int dav_copy(http_session *sess, int overwrite, const char *src, const char *dest) { return copy_or_move(sess, 0, overwrite, src, dest); } int dav_move(http_session *sess, int overwrite, const char *src, const char *dest) { return copy_or_move(sess, 1, overwrite, src, dest); } /* Deletes the specified resource. (and in only two lines of code!) */ int dav_delete(http_session *sess, const char *uri) { http_req *req = http_request_create(sess, "DELETE", uri); #ifdef USE_DAV_LOCKS dav_lock_using_resource(req, uri, DAV_DEPTH_INFINITE); dav_lock_using_parent(req, uri); #endif /* joe: I asked on the DAV WG list about whether we might get a * 207 error back from a DELETE... conclusion, you shouldn't if * you don't send the Depth header, since we might be an HTTP/1.1 * client and a 2xx response indicates success to them. But * it's all a bit unclear. In any case, DAV servers today do * return 207 to DELETE even if we don't send the Depth header. * So we handle 207 errors appropriately. */ return dav_simple_request(sess, req); } int dav_mkcol(http_session *sess, const char *uri) { http_req *req; char *real_uri; int ret; if (uri_has_trailing_slash(uri)) { real_uri = ne_strdup(uri); } else { CONCAT2(real_uri, uri, "/"); } req = http_request_create(sess, "MKCOL", real_uri); #ifdef USE_DAV_LOCKS dav_lock_using_resource(req, real_uri, 0); dav_lock_using_parent(req, real_uri); #endif ret = dav_simple_request(sess, req); free(real_uri); return ret; } avfs-1.0.5/libneon/dav_locks.h0000644000175000017500000001060013102441254015777 0ustar michaelmichael/* WebDAV Class 2 locking operations Copyright (C) 1999-2001, Joe Orton 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 */ #ifndef DAV_LOCKS_H #define DAV_LOCKS_H #include "http_request.h" /* for http_session + http_req */ /* The scope of a lock */ enum dav_lock_scope { dav_lockscope_exclusive, dav_lockscope_shared }; enum dav_lock_type { dav_locktype_write }; /* Would be typedef'ed to dav_lock except lock is a verb and a noun, * so we already have dav_lock the function. Damn the English * language. */ struct dav_lock { char *uri; int depth; enum dav_lock_type type; enum dav_lock_scope scope; char *token; char *owner; long timeout; struct dav_lock *next; struct dav_lock *prev; }; #define DAV_TIMEOUT_INFINITE -1 #define DAV_TIMEOUT_INVALID -2 typedef struct dav_lock_session_s dav_lock_session; /* TODO: * "session" is a bad word, and it's already used for http_session, * maybe think up a better name. lock_store is quite good. */ /* Register the locking hooks with an http_session. Owned locks * persist for the duration of this session. */ dav_lock_session *dav_lock_register(http_session *sess); /* Call this after destroying the http_session which this lock session * was registered with. Or register the lock session with a new * http_session. Using 'sess' after this function returns will have * undefined behaviour. */ void dav_lock_unregister(dav_lock_session *sess); /* Add a lock to the given session. The lock will subsequently be * submitted as required in an If: header with any requests created * using the http_session which the lock session is tied to. Requests * indicate to the locking layer which locks they might need using * dav_lock_using_*, as described below. */ void dav_lock_add(dav_lock_session *sess, struct dav_lock *lock); /* Remove lock, which must have been previously added to the * session using 'dav_lock_add' above. */ void dav_lock_remove(dav_lock_session *sess, struct dav_lock *lock); typedef void (*dav_lock_walkfunc)(struct dav_lock *lock, void *userdata); /* For each lock added to the session, call func, passing the lock * and the given userdata. Returns the number of locks. func may be * pass as NULL, in which case, can be used to simply return number * of locks in the session. */ int dav_lock_iterate(dav_lock_session *sess, dav_lock_walkfunc func, void *userdata); /* Issue a LOCK request for the given lock. */ int dav_lock(http_session *sess, struct dav_lock *lock); /* Issue an UNLOCK request for the given lock */ int dav_unlock(http_session *sess, struct dav_lock *lock); /* Find a lock in the session with given URI */ struct dav_lock *dav_lock_find(dav_lock_session *sess, const char *uri); /* Deep-copy a lock structure. */ struct dav_lock *dav_lock_copy(const struct dav_lock *lock); /* Free a lock structure */ void dav_lock_free(struct dav_lock *lock); /* Callback for lock discovery. If 'lock' is NULL, * something went wrong retrieving lockdiscover for the resource, * look at 'status' for the details. */ typedef void (*dav_lock_result)(void *userdata, const struct dav_lock *lock, const char *uri, const http_status *status); /* Perform lock discovery on the given URI. 'result' is called * with the results (possibly >1 times). */ int dav_lock_discover(http_session *sess, const char *uri, dav_lock_result result, void *userdata); /*** For use by method functions */ /* Indicate that this request is of depth n on given uri */ void dav_lock_using_resource(http_req *req, const char *uri, int depth); /* Indicate that this request will modify parent collection of given URI */ void dav_lock_using_parent(http_req *req, const char *uri); #endif /* DAV_LOCKS_H */ avfs-1.0.5/libneon/socket.c0000644000175000017500000005672013102441254015332 0ustar michaelmichael/* socket handling routines Copyright (C) 1998-2001, Joe Orton , except where otherwise indicated. Portions are: Copyright (C) 1999-2000 Tommi Komulainen Originally under GPL in Mutt, http://www.mutt.org/ Relicensed under LGPL for neon, http://www.webdav.org/neon/ 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 The sock_readline() function is: Copyright (c) 1999 Eric S. Raymond 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 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "config.h" #include #ifdef HAVE_SYS_TIME_H #include #endif #ifdef WIN32 #include #else #include #include #include #endif /* WIN32 */ #ifdef HAVE_ARPA_INET_H #include #endif #include #ifdef HAVE_SYS_SELECT_H #include #endif #include #include #include #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #include "neon_i18n.h" #include "string_utils.h" #include "http_utils.h" #include "nsocket.h" #include "ne_alloc.h" static sock_progress progress_cb = NULL; static sock_notify notify_cb = NULL; static void *progress_ud, *notify_ud; #if defined(BEOS_PRE_BONE) #define NEON_WRITE(a,b,c) send(a,b,c,0) #define NEON_READ(a,b,c) recv(a,b,c,0) #define NEON_CLOSE(s) closesocket(s) #elif defined(WIN32) #define NEON_WRITE(a,b,c) send(a,b,c,0) #define NEON_READ(a,b,c) recv(a,b,c,0) #define NEON_CLOSE(s) closesocket(s) #else /* really Unix! */ #define NEON_WRITE(a,b,c) write(a,b,c) #define NEON_READ(a,b,c) read(a,b,c) #define NEON_CLOSE(s) close(s) #endif #ifdef ENABLE_SSL #include #include /* Whilst the OpenSSL interface *looks* like it is not thread-safe, it * appears to do horrible gymnastics to maintain per-thread global * variables for error reporting. UGH! */ #define ERROR_SSL_STRING (ERR_reason_error_string(ERR_get_error())) #endif /* BeOS doesn't have fd==sockets on anything pre-bone, so see if * we need to drop back to our old ways... */ #ifdef __BEOS__ #ifndef BONE_VERSION /* if we have BONE this isn't an issue... */ #define BEOS_PRE_BONE #endif #endif struct nsocket_s { int fd; const char *error; /* Store error string here */ #ifdef ENABLE_SSL SSL *ssl; SSL_CTX *default_ctx; #endif #ifdef BEOS_PRE_BONE #define MAX_PEEK_BUFFER 1024 char peeked_bytes[MAX_PEEK_BUFFER]; char *peeked_bytes_curpos; int peeked_bytes_avail; #endif }; struct nssl_context_s { #ifdef ENABLE_SSL SSL_CTX *ctx; #endif nssl_accept cert_accept; void *accept_ud; /* userdata for callback */ /* private key prompt callback */ nssl_key_prompt key_prompt; void *key_userdata; const char *key_file; }; void sock_register_progress(sock_progress cb, void *userdata) { progress_cb = cb; progress_ud = userdata; } void sock_register_notify(sock_notify cb, void *userdata) { notify_cb = cb; notify_ud = userdata; } void sock_call_progress(off_t progress, off_t total) { if (progress_cb) { (*progress_cb)(progress_ud, progress, total); } } int sock_init(void) { #ifdef WIN32 WORD wVersionRequested; WSADATA wsaData; int err; wVersionRequested = MAKEWORD(2, 2); err = WSAStartup(wVersionRequested, &wsaData); if (err != 0) return -1; #endif #ifdef ENABLE_SSL SSL_load_error_strings(); SSL_library_init(); DEBUG(DEBUG_SOCKET, "Initialized SSL.\n"); #endif return 0; } void sock_exit(void) { #ifdef WIN32 WSACleanup(); #endif } /* sock_read is read() with a timeout of SOCKET_READ_TIMEOUT. */ int sock_read(nsocket *sock, char *buffer, size_t count) { int ret; if (count == 0) { DEBUG(DEBUG_SOCKET, "Passing 0 to sock_read is probably bad.\n"); /* But follow normal read() semantics anyway... */ return 0; } ret = sock_block(sock, SOCKET_READ_TIMEOUT); if (ret == 0) { /* Got data */ do { #ifdef ENABLE_SSL if (sock->ssl) { ret = SSL_read(sock->ssl, buffer, count); } else { #endif #ifndef BEOS_PRE_BONE ret = NEON_READ(sock->fd, buffer, count); #else if (sock->peeked_bytes_avail > 0) { /* simply return the peeked bytes.... */ if (count >= sock->peeked_bytes_avail){ /* we have room */ strncpy(buffer, sock->peeked_bytes_curpos, sock->peeked_bytes_avail); ret = sock->peeked_bytes_avail; sock->peeked_bytes_avail = 0; } else { strncpy(buffer, sock->peeked_bytes_curpos, count); sock->peeked_bytes_curpos += count; sock->peeked_bytes_avail -= count; ret = count; } } else { ret = recv(sock->fd, buffer, count, 0); } #endif #ifdef ENABLE_SSL } #endif } while (ret == -1 && errno == EINTR); if (ret < 0) { sock->error = strerror(errno); ret = SOCK_ERROR; } else if (ret == 0) { /* This might not or might not be an error depending on the context. */ sock->error = _("Connection was closed by server"); DEBUG(DEBUG_SOCKET, "read returned zero.\n"); ret = SOCK_CLOSED; } } return ret; } /* sock_peek is recv(...,MSG_PEEK) with a timeout of SOCKET_TIMEOUT. * Returns length of data read or SOCK_* on error */ int sock_peek(nsocket *sock, char *buffer, size_t count) { int ret; ret = sock_block(sock, SOCKET_READ_TIMEOUT); if (ret < 0) { return ret; } /* Got data */ #ifdef ENABLE_SSL if (sock->ssl) { ret = SSL_peek(sock->ssl, buffer, count); /* TODO: This is the fetchmail fix as in sock_readline. * Do we really need it? */ if (ret == 0) { if (sock->ssl->shutdown) { return SOCK_CLOSED; } if (0 != ERR_get_error()) { sock->error = ERROR_SSL_STRING; return SOCK_ERROR; } } } else { #endif do { #ifndef BEOS_PRE_BONE ret = recv(sock->fd, buffer, count, MSG_PEEK); #else /* we're on BeOS pre-BONE so we need to use the buffer... */ if (sock->peeked_bytes_avail > 0) { /* we've got some from last time!!! */ if (count >= sock->peeked_bytes_avail) { strncpy(buffer, sock->peeked_bytes_curpos, sock->peeked_bytes_avail); ret = sock->peeked_bytes_avail; } else { strncpy(buffer, sock->peeked_bytes_curpos, count); ret = count; } } else { if (count > MAX_PEEK_BUFFER) count = MAX_PEEK_BUFFER; ret = recv(sock->fd, buffer, count, 0); sock->peeked_bytes_avail = ret; strncpy(sock->peeked_bytes, buffer, ret); sock->peeked_bytes_curpos = sock->peeked_bytes; } #endif } while (ret == -1 && errno == EINTR); #ifdef ENABLE_SSL } #endif /* According to the Single Unix Spec, recv() will return * zero if the socket has been closed the other end. */ if (ret == 0) { ret = SOCK_CLOSED; } else if (ret < 0) { sock->error = strerror(errno); ret = SOCK_ERROR; } return ret; } /* Blocks waiting for read input on the given socket for the given time. * Returns: * 0 if data arrived * SOCK_TIMEOUT if data did not arrive before timeout * SOCK_ERROR on error */ int sock_block(nsocket *sock, int timeout) { struct timeval tv; fd_set fds; int ret; #ifdef ENABLE_SSL if (sock->ssl) { /* There may be data already available in the * SSL buffers */ if (SSL_pending(sock->ssl)) { return 0; } /* Otherwise, we should be able to select on * the socket as per normal. Probably? */ } #endif #ifdef BEOS_PRE_BONE if (sock->peeked_bytes_avail > 0) { return 0; } #endif /* Init the fd set */ FD_ZERO(&fds); FD_SET(sock->fd, &fds); /* Set the timeout */ tv.tv_sec = timeout; tv.tv_usec = 0; do { ret = select(sock->fd+1, &fds, NULL, NULL, &tv); } while (ret == -1 && errno == EINTR); switch(ret) { case 0: return SOCK_TIMEOUT; case -1: sock->error = strerror(errno); return SOCK_ERROR; default: return 0; } } /* Send the given line down the socket with CRLF appended. * Returns 0 on success or SOCK_* on failure. */ int sock_sendline(nsocket *sock, const char *line) { char *buffer; int ret; CONCAT2(buffer, line, "\r\n"); ret = sock_send_string(sock, buffer); free(buffer); return ret; } int sock_readfile_blocked(nsocket *sock, off_t length, sock_block_reader reader, void *userdata) { char buffer[BUFSIZ]; int ret; off_t done = 0; do { ret = sock_read(sock, buffer, BUFSIZ); if (ret < 0) { if (length == -1 && ret == SOCK_CLOSED) { /* Not an error condition. */ return 0; } return ret; } done += ret; sock_call_progress(done, length); (*reader)(userdata, buffer, ret); } while ((length == -1) || (done < length)); return 0; } /* Send a block of data down the given fd. * Returns 0 on success or SOCK_* on failure */ int sock_fullwrite(nsocket *sock, const char *data, size_t length) { ssize_t wrote; #ifdef ENABLE_SSL if (sock->ssl) { /* joe: ssl.h says SSL_MODE_ENABLE_PARTIAL_WRITE must * be enabled to have SSL_write return < length... * so, SSL_write should never return < length. */ wrote = SSL_write(sock->ssl, data, length); if (wrote >= 0 && wrote < length) { DEBUG(DEBUG_SOCKET, "SSL_write returned less than length!\n"); sock->error = ERROR_SSL_STRING; return SOCK_ERROR; } } else { #endif const char *pnt = data; size_t sent = 0; while (sent < length) { wrote = NEON_WRITE(sock->fd, pnt, length-sent); if (wrote < 0) { if (errno == EINTR) { continue; } else if (errno == EPIPE) { return SOCK_CLOSED; } else { sock->error = strerror(errno); return SOCK_ERROR; } } sent += wrote; pnt += wrote; #ifdef ENABLE_SSL } #endif } return 0; } /* Sends the given string down the given socket. * Returns 0 on success or -1 on failure. */ int sock_send_string(nsocket *sock, const char *data) { return sock_fullwrite(sock, data, strlen(data)); } /* This is from from Eric Raymond's fetchmail (SockRead() in socket.c) * since I wouldn't have a clue how to do it properly. * This function is Copyright 1999 (C) Eric Raymond. * Modifications Copyright 2000 (C) Joe Orton */ int sock_readline(nsocket *sock, char *buf, int len) { char *newline, *bp = buf; int n; do { /* * The reason for these gymnastics is that we want two things: * (1) to read \n-terminated lines, * (2) to return the true length of data read, even if the * data coming in has embedded NULS. */ #ifdef ENABLE_SSL if (sock->ssl) { /* Hack alert! */ /* OK... SSL_peek works a little different from MSG_PEEK Problem is that SSL_peek can return 0 if there is no data currently available. If, on the other hand, we loose the socket, we also get a zero, but the SSL_read then SEGFAULTS! To deal with this, we'll check the error code any time we get a return of zero from SSL_peek. If we have an error, we bail. If we don't, we read one character in SSL_read and loop. This should continue to work even if they later change the behavior of SSL_peek to "fix" this problem... :-(*/ DEBUG(DEBUG_SOCKET, "SSL readline... \n"); if ((n = SSL_peek(sock->ssl, bp, len)) < 0) { sock->error = ERROR_SSL_STRING; return(-1); } if (0 == n) { /* SSL_peek says no data... Does he mean no data or did the connection blow up? If we got an error then bail! */ DEBUG(DEBUG_SOCKET, "SSL_Peek says no data!\n"); /* Check properly to see if the connection has closed */ if (sock->ssl->shutdown) { DEBUG(DEBUG_SOCKET, "SSL says shutdown."); return SOCK_CLOSED; } else if (0 != (n = ERR_get_error())) { DEBUG(DEBUG_SOCKET, "SSL error occured.\n"); sock->error = ERROR_SSL_STRING; return -1; } /* We didn't get an error so read at least one character at this point and loop */ n = 1; /* Make sure newline start out NULL! We don't have a * string to pass through the strchr at this point yet * */ newline = NULL; } else if ((newline = memchr(bp, '\n', n)) != NULL) n = newline - bp + 1; n = SSL_read(sock->ssl, bp, n); DEBUG(DEBUG_SOCKET, "SSL_read returned %d\n", n); if (n == -1) { sock->error = ERROR_SSL_STRING; return(-1); } /* Check for case where our single character turned out to * be a newline... (It wasn't going to get caught by * the strchr above if it came from the hack...). */ if (NULL == newline && 1 == n && '\n' == *bp) { /* Got our newline - this will break out of the loop now */ newline = bp; } } else { #endif if ((n = sock_peek(sock, bp, len)) <= 0) return n; if ((newline = memchr(bp, '\n', n)) != NULL) n = newline - bp + 1; if ((n = sock_read(sock, bp, n)) < 0) return n; #ifdef ENABLE_SSL } #endif bp += n; len -= n; if (len < 1) { sock->error = _("Line too long"); return SOCK_FULL; } } while (!newline && len); *bp = '\0'; return bp - buf; } /*** End of ESR-copyrighted section ***/ /* Reads readlen bytes from fd and write to sock. * If readlen == -1, then it reads from srcfd until EOF. * Returns number of bytes written to destfd, or -1 on error. */ int sock_transfer(int fd, nsocket *sock, off_t readlen) { char buffer[BUFSIZ]; size_t curlen; /* total bytes yet to read from srcfd */ off_t sumwrlen; /* total bytes written to destfd */ if (readlen == -1) { curlen = BUFSIZ; /* so the buffer size test works */ } else { curlen = readlen; /* everything to do */ } sumwrlen = 0; /* nowt done yet */ while (curlen > 0) { int rdlen, wrlen; /* Get a chunk... if the number of bytes that are left to read * is less than the buffer size, only read that many bytes. */ rdlen = read(fd, buffer, (readlen==-1)?BUFSIZ:(min(BUFSIZ, curlen))); sock_call_progress(sumwrlen, readlen); if (rdlen < 0) { if (errno == EPIPE) { return SOCK_CLOSED; } else { sock->error = strerror(errno); return SOCK_ERROR; } } else if (rdlen == 0) { /* End of file... get out of here */ break; } if (readlen != -1) curlen -= rdlen; /* Otherwise, we have bytes! Write them to destfd */ wrlen = sock_fullwrite(sock, buffer, rdlen); if (wrlen < 0) { return wrlen; } sumwrlen += rdlen; } sock_call_progress(sumwrlen, readlen); return sumwrlen; } /* Reads buflen bytes into buffer until it's full. * Returns 0 on success, -1 on error */ int sock_fullread(nsocket *sock, char *buffer, int buflen) { char *pnt; /* current position within buffer */ int len; pnt = buffer; while (buflen > 0) { len = sock_read(sock, pnt, buflen); if (len < 0) return len; buflen -= len; pnt += len; } return 0; } /* Do a name lookup on given hostname, writes the address into * given address buffer. Return -1 on failure. */ int sock_name_lookup(const char *hostname, struct in_addr *addr) { struct hostent *hp; unsigned long laddr; if (notify_cb) (*notify_cb)(notify_ud, sock_namelookup, hostname); /* TODO?: a possible problem here, is that if we are passed an * invalid IP address e.g. "500.500.500.500", then this gets * passed to gethostbyname and returned as "Host not found". * Arguably wrong, but maybe difficult to detect correctly what is * an invalid IP address and what is a hostname... can hostnames * begin with a numeric character? */ laddr = (unsigned long)inet_addr(hostname); if ((int)laddr == -1) { /* inet_addr failed. */ hp = gethostbyname(hostname); if (hp == NULL) { #if 0 /* Need to get this back somehow, but we don't have * an nsocket * yet... */ switch(h_errno) { case HOST_NOT_FOUND: sock->error = _("Host not found"); break; case TRY_AGAIN: sock->error = _("Host not found (try again later?)"); break; case NO_ADDRESS: sock->error = _("Host exists but has no address."); break; case NO_RECOVERY: default: sock->error = _("Non-recoverable error in resolver library."); break; } #endif return SOCK_ERROR; } memcpy(addr, hp->h_addr, hp->h_length); } else { addr->s_addr = laddr; } return 0; } static nsocket *create_sock(int fd) { nsocket *sock = ne_calloc(sizeof *sock); #ifdef ENABLE_SSL sock->default_ctx = SSL_CTX_new(SSLv23_client_method()); #endif sock->fd = fd; return sock; } /* Opens a socket to the given port at the given address. * Returns -1 on failure, or the socket on success. * portnum must be in HOST byte order */ nsocket *sock_connect_u(const struct in_addr addr, unsigned short int portnum, int call_fe) { struct sockaddr_in sa; int fd; /* Create the socket */ fd = socket(AF_INET, SOCK_STREAM, 0); if (fd < 0) return NULL; /* Connect the nsocket */ sa.sin_family = AF_INET; sa.sin_port = htons(portnum); /* host -> net byte orders */ sa.sin_addr = addr; if (call_fe && notify_cb) (*notify_cb)(notify_ud, sock_connecting, NULL); if (connect(fd, (struct sockaddr *)&sa, sizeof(struct sockaddr_in)) < 0) { (void) NEON_CLOSE(fd); return NULL; } if (call_fe && notify_cb) (*notify_cb)(notify_ud, sock_connected, NULL); /* Success - return the nsocket */ return create_sock(fd); } nsocket *sock_accept(int listener) { int fd = accept(listener, NULL, NULL); if (fd > 0) { return create_sock(fd); } else { return NULL; } } int sock_get_fd(nsocket *sock) { return sock->fd; } nsocket *sock_connect(const struct in_addr addr, unsigned short int portnum) { return sock_connect_u(addr, portnum, 1); } nssl_context *sock_create_ssl_context(void) { nssl_context *ctx = ne_calloc(sizeof *ctx); #ifdef ENABLE_SSL ctx->ctx = SSL_CTX_new(SSLv23_client_method()); #endif return ctx; } void sock_destroy_ssl_context(nssl_context *ctx) { #ifdef ENABLE_SSL SSL_CTX_free(ctx->ctx); #endif free(ctx); } #ifdef ENABLE_SSL void sock_disable_tlsv1(nssl_context *c) { SSL_CTX_set_options(c->ctx, SSL_OP_NO_TLSv1); } void sock_disable_sslv2(nssl_context *c) { SSL_CTX_set_options(c->ctx, SSL_OP_NO_SSLv2); } void sock_disable_sslv3(nssl_context *c) { SSL_CTX_set_options(c->ctx, SSL_OP_NO_SSLv3); } /* The callback neon installs with OpenSSL for giving the private key * prompt. FIXME: WTH is 'rwflag'? */ static int key_prompt_cb(char *buf, int len, int rwflag, void *userdata) { nssl_context *ctx = userdata; int ret; ret = ctx->key_prompt(ctx->key_userdata, ctx->key_file, buf, len); if (ret) return -1; /* Obscurely OpenSSL requires the callback to return the length of * the password, this seems a bit weird so we don't expose this in * the neon API. */ return strlen(buf); } void sock_set_key_prompt(nssl_context *ctx, nssl_key_prompt prompt, void *userdata) { SSL_CTX_set_default_passwd_cb(ctx->ctx, key_prompt_cb); SSL_CTX_set_default_passwd_cb_userdata(ctx->ctx, ctx); ctx->key_prompt = prompt; ctx->key_userdata = userdata; } #else void sock_disable_tlsv1(nssl_context *c) {} void sock_disable_sslv2(nssl_context *c) {} void sock_disable_sslv3(nssl_context *c) {} void sock_set_key_prompt(nssl_context *c, nssl_key_prompt p, void *u) {} #endif int sock_make_secure(nsocket *sock, nssl_context *ctx) { #ifdef ENABLE_SSL int ret; SSL_CTX *ssl_ctx; if (ctx) { ssl_ctx = ctx->ctx; } else { ssl_ctx = sock->default_ctx; } sock->ssl = SSL_new(ssl_ctx); if (!sock->ssl) { sock->error = ERROR_SSL_STRING; /* Usually goes wrong because: */ fprintf(stderr, "Have you called sock_init()!?\n"); return SOCK_ERROR; } SSL_set_fd(sock->ssl, sock->fd); ret = SSL_connect(sock->ssl); if (ret == -1) { sock->error = ERROR_SSL_STRING; SSL_free(sock->ssl); sock->ssl = NULL; return SOCK_ERROR; } #if 0 /* Tommi Komulainen has donated his SSL * cert verification from the mutt IMAP/SSL code under the * LGPL... it will plug in here */ ret = sock_check_certicate(sock); if (ret) { SSL_shutdown(sock->ssl); SSL_free(sock->ssl); sock->ssl = NULL; return ret; } #endif if (notify_cb) (*notify_cb)(notify_ud, sock_secure_details, SSL_get_version(sock->ssl)); DEBUG(DEBUG_SOCKET, "SSL connected: version %s\n", SSL_get_version(sock->ssl)); return 0; #else sock->error = _("This application does not have SSL support."); return SOCK_ERROR; #endif } const char *sock_get_error(nsocket *sock) { return sock->error; } /* Closes given nsocket */ int sock_close(nsocket *sock) { int ret; #ifdef ENABLE_SSL if (sock->ssl) { SSL_shutdown(sock->ssl); SSL_free(sock->ssl); } SSL_CTX_free(sock->default_ctx); #endif ret = NEON_CLOSE(sock->fd); free(sock); return ret; } /* FIXME: get error messages back to the caller. */ int sock_set_client_cert(nssl_context *ctx, const char *cert, const char *key) { #ifdef ENABLE_SSL if (SSL_CTX_use_certificate_file(ctx->ctx, cert, SSL_FILETYPE_PEM) <= 0) { DEBUG(DEBUG_SOCKET, "Could not load cert file.\n"); return -1; } /* The cert file can contain the private key too, apparently. Not * sure under what circumstances this is sensible, but hey. */ if (key == NULL) key = cert; /* Set this so the callback can tell the user what's going on. */ ctx->key_file = key; if (SSL_CTX_use_PrivateKey_file(ctx->ctx, key, SSL_FILETYPE_PEM) <= 0) { DEBUG(DEBUG_SOCKET, "Could not load private key file.\n"); return -1; } /* Sanity check. */ if (!SSL_CTX_check_private_key(ctx->ctx)) { DEBUG(DEBUG_SOCKET, "Private key does not match certificate.\n"); return -1; } return 0; #else return -1; #endif } /* Returns HOST byte order port of given name */ int sock_service_lookup(const char *name) { struct servent *ent; ent = getservbyname(name, "tcp"); if (ent == NULL) { return 0; } else { return ntohs(ent->s_port); } } avfs-1.0.5/libneon/dates.h0000644000175000017500000000246113102441254015140 0ustar michaelmichael/* Date manipulation routines Copyright (C) 1999-2001, Joe Orton 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 */ #ifndef DATES_H #define DATES_H #include #include "neon_defs.h" BEGIN_NEON_DECLS /* Date manipulation routines as per RFC1123 and RFC1036 */ /* Return current date/time in RFC1123 format */ char *rfc1123_date(time_t anytime); /* Returns time from date/time in RFC1123 format */ time_t rfc1123_parse(const char *date); time_t rfc1036_parse(const char *date); /* Parses asctime date string */ time_t asctime_parse(const char *date); END_NEON_DECLS #endif /* DATES_H */ avfs-1.0.5/libneon/Makefile.am0000644000175000017500000000212313102441254015716 0ustar michaelmichaelEXTRA_DIST = README ChangeLog COPYING.LIB if BUILD_NEON_LIB noinst_LTLIBRARIES = libneon.la AM_CFLAGS = -I${top_srcdir}/include @CFLAGS@ @DEFS@ neon_link_flags = @NEON_LINK_FLAGS@ libneon_la_LDFLAGS = $(neon_link_flags) -module if BUILD_DAVSUPPORT libneon_la_SOURCES = \ base64.c \ dates.c \ dav_207.c \ dav_basic.c \ dav_locks.c \ dav_props.c \ hip_xml.c \ http_auth.c \ http_basic.c \ http_cookies.c \ http_redirect.c \ http_request.c \ http_utils.c \ md5.c \ ne_alloc.c \ socket.c \ string_utils.c \ uri.c else libneon_la_SOURCES = \ base64.c \ dates.c \ http_auth.c \ http_basic.c \ http_cookies.c \ http_redirect.c \ http_request.c \ http_utils.c \ md5.c \ ne_alloc.c \ socket.c \ string_utils.c \ uri.c endif endif noinst_HEADERS = \ base64.h \ dates.h \ dav_207.h \ dav_basic.h \ dav_locks.h \ dav_props.h \ hip_xml.h \ http_auth.h \ http_basic.h \ http_cookies.h \ http_private.h \ http_redirect.h \ http_request.h \ http_utils.h \ ne_alloc.h \ neon_defs.h \ neon_i18n.h \ neon_md5.h \ neonconf.h \ nsocket.h \ string_utils.h \ uri.h avfs-1.0.5/libneon/base64.h0000644000175000017500000000221113102441254015115 0ustar michaelmichael/* Text->Base64 convertion, from RFC1521 Copyright (C) 1998-2000 Joe Orton 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 */ #ifndef BASE64_H #define BASE64_H #include "neonconf.h" /* Plain->Base64 converter - will malloc the buffer to the correct size, * and fill it with the Base64 conversion of the parameter. * Base64 specification from RFC 1521. You must free() it. */ char *base64(const char *text); #endif /* BASE64_H */ avfs-1.0.5/libneon/neon_md5.h0000644000175000017500000001301213102441254015536 0ustar michaelmichael/* Declaration of functions and data types used for MD5 sum computing library functions. Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C 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. The GNU C 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 the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef NEON_MD5_H #define NEON_MD5_H 1 #include "neonconf.h" #include #if defined HAVE_LIMITS_H || _LIBC # include #endif /* The following contortions are an attempt to use the C preprocessor to determine an unsigned integral type that is 32 bits wide. An alternative approach is to use autoconf's AC_CHECK_SIZEOF macro, but doing that would require that the configure script compile and *run* the resulting executable. Locally running cross-compiled executables is usually not possible. */ #ifdef _LIBC # include typedef u_int32_t md5_uint32; #else # if defined __STDC__ && __STDC__ # define UINT_MAX_32_BITS 4294967295U # else # define UINT_MAX_32_BITS 0xFFFFFFFF # endif /* If UINT_MAX isn't defined, assume it's a 32-bit type. This should be valid for all systems GNU cares about because that doesn't include 16-bit systems, and only modern systems (that certainly have ) have 64+-bit integral types. */ # ifndef UINT_MAX # define UINT_MAX UINT_MAX_32_BITS # endif # if UINT_MAX == UINT_MAX_32_BITS typedef unsigned int md5_uint32; # else # if USHRT_MAX == UINT_MAX_32_BITS typedef unsigned short md5_uint32; # else # if ULONG_MAX == UINT_MAX_32_BITS typedef unsigned long md5_uint32; # else /* The following line is intended to evoke an error. Using #error is not portable enough. */ "Cannot determine unsigned 32-bit data type." # endif # endif # endif #endif #undef __P #if defined (__STDC__) && __STDC__ # define __P(x) x #else # define __P(x) () #endif /* Structure to save state of computation between the single steps. */ struct md5_ctx { md5_uint32 A; md5_uint32 B; md5_uint32 C; md5_uint32 D; md5_uint32 total[2]; md5_uint32 buflen; char buffer[128]; }; /* * The following three functions are build up the low level used in * the functions `md5_stream' and `md5_buffer'. */ /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ extern void __md5_init_ctx __P ((struct md5_ctx *ctx)); extern void md5_init_ctx __P ((struct md5_ctx *ctx)); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is necessary that LEN is a multiple of 64!!! */ extern void __md5_process_block __P ((const void *buffer, size_t len, struct md5_ctx *ctx)); extern void md5_process_block __P ((const void *buffer, size_t len, struct md5_ctx *ctx)); /* Starting with the result of former calls of this function (or the initialization function update the context for the next LEN bytes starting at BUFFER. It is NOT required that LEN is a multiple of 64. */ extern void __md5_process_bytes __P ((const void *buffer, size_t len, struct md5_ctx *ctx)); extern void md5_process_bytes __P ((const void *buffer, size_t len, struct md5_ctx *ctx)); /* Process the remaining bytes in the buffer and put result from CTX in first 16 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ extern void *__md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf)); extern void *md5_finish_ctx __P ((struct md5_ctx *ctx, void *resbuf)); /* Put result from CTX in first 16 bytes following RESBUF. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ extern void *__md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf)); extern void *md5_read_ctx __P ((const struct md5_ctx *ctx, void *resbuf)); /* Compute MD5 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ extern int __md5_stream __P ((FILE *stream, void *resblock)); extern int md5_stream __P ((FILE *stream, void *resblock)); /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ extern void *__md5_buffer __P ((const char *buffer, size_t len, void *resblock)); extern void *md5_buffer __P ((const char *buffer, size_t len, void *resblock)); #endif /* NEON_MD5_H */ avfs-1.0.5/libneon/hip_xml.h0000644000175000017500000001300013102441254015467 0ustar michaelmichael/* Higher Level Interface to XML Parsers. Copyright (C) 1999-2001, Joe Orton 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 */ #ifndef HIP_XML_H #define HIP_XML_H /* for sbuffer */ #include "string_utils.h" BEGIN_NEON_DECLS /* Generic XML parsing interface... Definitions: * A handler knows how to parse a certain set of XML elements. * The handler stack * Basic principle is that you provide these things: 1) a list of elements which you wish to handle 2) a validation callback which tells the parser whether you want to handle this element. 3) a callback function which is called when a complete element has been parsed (provided you are handling the element). This code then deals with the boring stuff like: - Dealing with XML namespaces - Collecting CDATA The element list is stored in a 'hip_xml_elm' array. For each element, you specify the element name, an element id, and some flags for that element. const static struct hip_xml_elm[] = { { "DAV:", "resourcetype", ELM_resourcetype, 0 }, { "DAV:", "collection", ELM_collection, HIP_ELM_CDATA }, { NULL } }; This list contains two elements, resourcetype and collection, both in the "DAV:" namespace. The collection element can contain cdata. */ /* Reserved element id's */ #define HIP_ELM_unknown -1 #define HIP_ELM_root 0 #define HIP_ELM_UNUSED (100) typedef int hip_xml_elmid; struct hip_xml_elm; /* An element */ struct hip_xml_elm { const char *nspace, *name; hip_xml_elmid id; unsigned int flags; }; /* Function to check element context... This callback must return: HIP_XML_VALID -> Yes, this is valid XML, and I want to handle this element. HIP_XML_INVALID -> No, this is NOT valid XML, and parsing should stop. HIP_XML_DECLINE -> I don't know anything about this element, someone else can handle it. */ #define HIP_XML_VALID (0) #define HIP_XML_INVALID (-1) #define HIP_XML_DECLINE (-2) typedef int (*hip_xml_validate_cb) (hip_xml_elmid parent, hip_xml_elmid child); typedef int (*hip_xml_startelm_cb) (void *userdata, const struct hip_xml_elm *elm, const char **atts); /* Called when a complete element is parsed */ typedef int (*hip_xml_endelm_cb) (void *userdata, const struct hip_xml_elm *s, const char *cdata); typedef void (*hip_xml_cdata_cb) (void *userdata, const struct hip_xml_elm *s, const char *cdata, int len); struct hip_xml_parser_s; typedef struct hip_xml_parser_s hip_xml_parser; /* Flags */ /* This element has no children */ #define HIP_XML_CDATA (1<<1) /* Collect complete contents of this node as cdata */ #define HIP_XML_COLLECT ((1<<2) | HIP_XML_CDATA) /* Decode UTF-8 data in cdata. */ #define HIP_XML_UTF8DECODE (1<<3) /* This element uses MIXED mode */ #define HIP_XML_MIXED (1<<4) /* Initialise the parser */ hip_xml_parser *hip_xml_create(void); /* Push a handler onto the handler stack for the given list of elements. * elements must be an array, with the last element .nspace being NULL. * Callbacks are called in order: * 1. validate_cb * 2. startelm_cb * 3. endelm_cb * (then back to the beginning again). * If any of the callbacks ever return non-zero, the parse will STOP. * userdata is passed as the first argument to startelm_cb and endelm_cb. */ void hip_xml_push_handler(hip_xml_parser *p, const struct hip_xml_elm *elements, hip_xml_validate_cb validate_cb, hip_xml_startelm_cb startelm_cb, hip_xml_endelm_cb endelm_cb, void *userdata); /* Add a handler which uses a mixed-mode cdata callback */ void hip_xml_push_mixed_handler(hip_xml_parser *p, const struct hip_xml_elm *elements, hip_xml_validate_cb validate_cb, hip_xml_startelm_cb startelm_cb, hip_xml_cdata_cb cdata_cb, hip_xml_endelm_cb endelm_cb, void *userdata); /* Returns non-zero if the parse was valid, zero if it failed (e.g., * any of the callbacks return non-zero, the XML was not well-formed, * etc). Use hip_xml_get_error to retrieve the error message if it * failed. */ int hip_xml_valid(hip_xml_parser *p); /* Destroys the parser. Any operations on it then have * undefined results. */ void hip_xml_destroy(hip_xml_parser *p); /* Parse the given block of input of length len. Block does * not need to be NULL-terminated. */ void hip_xml_parse(hip_xml_parser *p, const char *block, size_t len); /* As above, casting (hip_xml_parser *)userdata internally. * (This function can be passed to http_add_response_body_reader) */ void hip_xml_parse_v(void *userdata, const char *block, size_t len); /* Return current parse line for errors */ int hip_xml_currentline(hip_xml_parser *p); /* Set error message for parser */ void hip_xml_set_error(hip_xml_parser *p, const char *msg); const char *hip_xml_get_error(hip_xml_parser *p); END_NEON_DECLS #endif /* HIP_XML_H */ avfs-1.0.5/libneon/dates.c0000644000175000017500000001132713102441254015134 0ustar michaelmichael/* Date manipulation routines Copyright (C) 1999-2001, Joe Orton 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 */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #include #include #ifdef HAVE_STDLIB_H #include #endif #include #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_SNPRINTF_H #include "snprintf.h" #endif #include "ne_alloc.h" #include "dates.h" /* Generic date manipulation routines. */ /* RFC1123: Sun, 06 Nov 1994 08:49:37 GMT */ #define RFC1123_FORMAT "%3s, %02d %3s %4d %02d:%02d:%02d GMT" /* RFC850: Sunday, 06-Nov-94 08:49:37 GMT */ #define RFC1036_FORMAT "%s, %2d-%3s-%2d %2d:%2d:%2d GMT" /* asctime: Wed Jun 30 21:49:08 1993 */ #define ASCTIME_FORMAT "%3s %3s %2d %2d:%2d:%2d %4d" static const char *rfc1123_weekdays[7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; static const char *short_months[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; /* Returns the time/date GMT, in RFC1123-type format: eg * Sun, 06 Nov 1994 08:49:37 GMT. */ char *rfc1123_date(time_t anytime) { struct tm *gmt; char *ret; gmt = gmtime(&anytime); if (gmt == NULL) return NULL; ret = ne_malloc(29 + 1); /* dates are 29 chars long */ /* it goes: Sun, 06 Nov 1994 08:49:37 GMT */ snprintf(ret, 30, RFC1123_FORMAT, rfc1123_weekdays[gmt->tm_wday], gmt->tm_mday, short_months[gmt->tm_mon], 1900 + gmt->tm_year, gmt->tm_hour, gmt->tm_min, gmt->tm_sec); return ret; } /* Takes an RFC1123-formatted date string and returns the time_t. * Returns (time_t)-1 if the parse fails. */ time_t rfc1123_parse(const char *date) { struct tm gmt = {0}; static char wkday[4], mon[4]; int n; /* it goes: Sun, 06 Nov 1994 08:49:37 GMT */ n = sscanf(date, RFC1123_FORMAT, wkday, &gmt.tm_mday, mon, &gmt.tm_year, &gmt.tm_hour, &gmt.tm_min, &gmt.tm_sec); /* Is it portable to check n==7 here? */ gmt.tm_year -= 1900; for (n=0; n<12; n++) if (strcmp(mon, short_months[n]) == 0) break; /* tm_mon comes out as 12 if the month is corrupt, which is desired, * since the mktime will then fail */ gmt.tm_mon = n; return mktime(&gmt); } /* Takes a string containing a RFC1036-style date and returns the time_t */ time_t rfc1036_parse(const char *date) { struct tm gmt = {0}; int n; static char wkday[10], mon[4]; /* RFC850/1036 style dates: Sunday, 06-Nov-94 08:49:37 GMT */ n = sscanf(date, RFC1036_FORMAT, wkday, &gmt.tm_mday, mon, &gmt.tm_year, &gmt.tm_hour, &gmt.tm_min, &gmt.tm_sec); /* portable to check n here? */ for (n=0; n<12; n++) if (strcmp(mon, short_months[n]) == 0) break; /* tm_mon comes out as 12 if the month is corrupt, which is desired, * since the mktime will then fail */ gmt.tm_mon = n; return mktime(&gmt); } /* (as)ctime dates are like: * Wed Jun 30 21:49:08 1993 */ time_t asctime_parse(const char *date) { struct tm gmt = {0}; int n; static char wkday[4], mon[4]; n = sscanf(date, ASCTIME_FORMAT, wkday, mon, &gmt.tm_mday, &gmt.tm_hour, &gmt.tm_min, &gmt.tm_sec, &gmt.tm_year); /* portable to check n here? */ for (n=0; n<12; n++) if (strcmp(mon, short_months[n]) == 0) break; /* tm_mon comes out as 12 if the month is corrupt, which is desired, * since the mktime will then fail */ gmt.tm_mon = n; return mktime(&gmt); } #undef RFC1036_FORMAT #undef ASCTIME_FORMAT #undef RFC1123_FORMAT #ifdef RFC1123_TEST int main(int argc, char **argv) { time_t now, in; char *out; if (argc > 1) { printf("Got: %s\n", argv[1]); in = rfc1123_parse(argv[1]); printf("Parsed: %d\n", in); out = rfc1123_date(in); printf("Back again: %s\n", out); } else { now = time(NULL); out = rfc1123_date(now); in = rfc1123_parse(out); printf("time(NULL) = %d\n", now); printf("RFC1123 Time: [%s]\n", out); printf("Parsed = %d\n", in); out = rfc1123_date(in); printf("Back again: [%s]\n", out); } return 0; } #endif avfs-1.0.5/libneon/uri.c0000644000175000017500000002043213102441254014630 0ustar michaelmichael/* HTTP URI handling Copyright (C) 1999-2001, Joe Orton 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 */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #include #include #include "http_utils.h" /* for 'min' */ #include "string_utils.h" /* for CONCAT3 */ #include "uri.h" #include "ne_alloc.h" char *uri_parent(const char *uri) { const char *pnt; char *ret; pnt = uri+strlen(uri)-1; while (*(--pnt) != '/' && pnt >= uri) /* noop */; if (pnt < uri) { /* not a valid absPath */ return NULL; } /* uri * V * |---| * /foo/bar/ */ ret = ne_malloc((pnt - uri) + 2); memcpy(ret, uri, (pnt - uri) + 1); ret[1+(pnt-uri)] = '\0'; pnt++; return ret; } int uri_has_trailing_slash(const char *uri) { return (uri[strlen(uri)-1] == '/'); } const char *uri_abspath(const char *uri) { const char *ret; /* Look for the scheme: */ ret = strstr(uri, "://"); if (ret == NULL) { /* No scheme */ ret = uri; } else { /* Look for the abs_path */ ret = strchr(ret+3, '/'); if (ret == NULL) { /* Uh-oh */ ret = uri; } } return ret; } /* TODO: not a proper URI parser */ int uri_parse(const char *uri, struct uri *parsed, const struct uri *defaults) { const char *pnt, *slash, *colon; parsed->port = -1; parsed->host = NULL; parsed->path = NULL; parsed->scheme = NULL; pnt = strstr(uri, "://"); if (pnt) { parsed->scheme = ne_strndup(uri, pnt - uri); pnt += 3; /* start of hostport segment */ } else { pnt = uri; if (defaults && defaults->scheme != NULL) { parsed->scheme = ne_strdup(defaults->scheme); } } slash = strchr(pnt, '/'); colon = strchr(pnt, ':'); if (slash == NULL) { parsed->path = ne_strdup("/"); if (colon == NULL) { if (defaults) parsed->port = defaults->port; parsed->host = ne_strdup(pnt); } else { parsed->port = atoi(colon+1); parsed->host = ne_strndup(pnt, colon - pnt); } } else { if (colon == NULL || colon > slash) { /* No port segment */ if (defaults) parsed->port = defaults->port; parsed->host = ne_strndup(pnt, slash - pnt); } else { /* Port segment */ parsed->port = atoi(colon + 1); parsed->host = ne_strndup(pnt, colon - pnt); } parsed->path = ne_strdup(slash); } return 0; } void uri_free(struct uri *uri) { HTTP_FREE(uri->host); HTTP_FREE(uri->path); HTTP_FREE(uri->scheme); } /* Returns an absoluteURI */ char *uri_absolute(const char *uri, const char *scheme, const char *hostport) { char *ret; /* Is it absolute already? */ if (strncmp(uri, scheme, strlen(scheme)) == 0) { /* Yes it is */ ret = ne_strdup(uri); } else { /* Oh no it isn't */ CONCAT3(ret, scheme, hostport, uri); } return ret; } /* Un-escapes a URI. Returns ne_malloc-allocated URI */ char *uri_unescape(const char *uri) { const char *pnt; char *ret, *retpos, buf[5] = { "0x00\0" }; retpos = ret = ne_malloc(strlen(uri) + 1); for (pnt = uri; *pnt != '\0'; pnt++) { if (*pnt == '%') { if (!isxdigit((unsigned char) pnt[1]) || !isxdigit((unsigned char) pnt[2])) { /* Invalid URI */ return NULL; } buf[2] = *++pnt; buf[3] = *++pnt; /* bit faster than memcpy */ *retpos++ = (char)strtol(buf, NULL, 16); } else { *retpos++ = *pnt; } } *retpos = '\0'; return ret; } /* RFC2396 spake: * "Data must be escaped if it does not have a representation * using an unreserved character". */ /* Lookup table: character classes from 2396. (This is overkill) */ #define SP 0 /* space = */ #define CO 0 /* control = */ #define DE 0 /* delims = "<" | ">" | "#" | "%" | <"> */ #define UW 0 /* unwise = "{" | "}" | "|" | "\" | "^" | "[" | "]" | "`" */ #define MA 1 /* mark = "-" | "_" | "." | "!" | "~" | "*" | "'" | "(" | ")" */ #define AN 2 /* alphanum = alpha | digit */ #define RE 2 /* reserved = ";" | "/" | "?" | ":" | "@" | "&" | "=" | "+" | "$" | "," */ static const char uri_chars[128] = { /* +2 +4 +6 +8 +10 +12 +14 */ /* 0 */ CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, /* 16 */ CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, CO, /* 32 */ SP, MA, DE, DE, RE, DE, RE, MA, MA, MA, MA, RE, RE, MA, MA, RE, /* 48 */ AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, RE, RE, DE, RE, DE, RE, /* 64 */ RE, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, /* 80 */ AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, UW, UW, UW, UW, MA, /* 96 */ UW, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, /* 112 */ AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, AN, UW, UW, UW, MA, CO }; #define ESCAPE(ch) (((const signed char)(ch) < 0 || \ uri_chars[(unsigned int)(ch)] == 0)) #undef SP #undef CO #undef DE #undef UW #undef MA #undef AN #undef RE /* Escapes the abspath segment of a URI. * Returns ne_malloc-allocated string. */ char *uri_abspath_escape(const char *abs_path) { const char *pnt; char *ret, *retpos; int count = 0; for (pnt = abs_path; *pnt != '\0'; pnt++) { if (ESCAPE(*pnt)) { count++; } } if (count == 0) { return ne_strdup(abs_path); } /* An escaped character is "%xx", i.e., two MORE * characters than the original string */ retpos = ret = ne_malloc(strlen(abs_path) + 2*count + 1); for (pnt = abs_path; *pnt != '\0'; pnt++) { if (ESCAPE(*pnt)) { /* Escape it - % */ sprintf(retpos, "%%%02x", (unsigned char) *pnt); retpos += 3; } else { /* It's cool */ *retpos++ = *pnt; } } *retpos = '\0'; return ret; } #undef ESCAPE /* TODO: implement properly */ int uri_compare(const char *a, const char *b) { int ret = strcasecmp(a, b); if (ret) { /* This logic says: "If the lengths of the two URIs differ by * exactly one, and the LONGER of the two URIs has a trailing * slash and the SHORTER one DOESN'T, then..." */ int traila = uri_has_trailing_slash(a), trailb = uri_has_trailing_slash(b), lena = strlen(a), lenb = strlen(b); if (traila != trailb && abs(lena - lenb) == 1 && ((traila && lena > lenb) || (trailb && lenb > lena))) { /* Compare them, ignoring the trailing slash on the longer * URI */ if (strncasecmp(a, b, min(lena, lenb)) == 0) ret = 0; } } return ret; } /* Give it a path segment, it returns non-zero if child is * a child of parent. */ int uri_childof(const char *parent, const char *child) { char *root = ne_strdup(child); int ret; if (strlen(parent) >= strlen(child)) { ret = 0; } else { /* root is the first of child, equal to length of parent */ root[strlen(parent)] = '\0'; ret = (uri_compare(parent, root) == 0); } free(root); return ret; } #ifdef URITEST int main(int argc, char *argv[]) { char *tmp; if (argc<2 || argc>3) { printf("Usage:\nuritest uria [urib]\n" "e.g. uritest \"/this/is/a silly/but/hey\"\n"); exit(-1); } if (argv[2]) { printf("uri_compare: %s with %s: %s\n", argv[1], argv[2], uri_compare(argv[1], argv[2])==0?"true":"false"); } else { printf("Input URI: %s\n", argv[1]); tmp = uri_abspath_escape(argv[1]); printf("Encoded: %s\n", tmp); printf("Decoded: %s\n", uri_unescape(tmp)); } return 0; } #endif /* URITEST */ avfs-1.0.5/libneon/neonconf.h0000644000175000017500000002462213102441254015650 0ustar michaelmichael/* symbol redefines Copyright (C) 2005, Ralf Hoffmann 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 */ #ifndef NEONCONF_H #define NEONCONF_H #define NEON_PREFIX 1 #ifdef NEON_PREFIX # define base64 AN_base64 # define asctime_parse AN_asctime_parse # define rfc1036_parse AN_rfc1036_parse # define rfc1123_date AN_rfc1123_date # define rfc1123_parse AN_rfc1123_parse # define dav_207_create AN_dav_207_create # define dav_207_destroy AN_dav_207_destroy # define dav_207_get_current_propstat AN_dav_207_get_current_propstat # define dav_207_get_current_response AN_dav_207_get_current_response # define dav_207_ignore_unknown AN_dav_207_ignore_unknown # define dav_207_set_propstat_handlers AN_dav_207_set_propstat_handlers # define dav_207_set_response_handlers AN_dav_207_set_response_handlers # define dav_accept_207 AN_dav_accept_207 # define dav_add_depth_header AN_dav_add_depth_header # define dav_copy AN_dav_copy # define dav_delete AN_dav_delete # define dav_mkcol AN_dav_mkcol # define dav_move AN_dav_move # define dav_simple_request AN_dav_simple_request # define dav_lock AN_dav_lock # define dav_lock_add AN_dav_lock_add # define dav_lock_copy AN_dav_lock_copy # define dav_lock_discover AN_dav_lock_discover # define dav_lock_find AN_dav_lock_find # define dav_lock_free AN_dav_lock_free # define dav_lock_iterate AN_dav_lock_iterate # define dav_lock_register AN_dav_lock_register # define dav_lock_remove AN_dav_lock_remove # define dav_lock_unregister AN_dav_lock_unregister # define dav_lock_using_parent AN_dav_lock_using_parent # define dav_lock_using_resource AN_dav_lock_using_resource # define dav_unlock AN_dav_unlock # define dav_propfind_allprop AN_dav_propfind_allprop # define dav_propfind_create AN_dav_propfind_create # define dav_propfind_current_private AN_dav_propfind_current_private # define dav_propfind_destroy AN_dav_propfind_destroy # define dav_propfind_get_parser AN_dav_propfind_get_parser # define dav_propfind_named AN_dav_propfind_named # define dav_propfind_set_complex AN_dav_propfind_set_complex # define dav_propfind_set_flat AN_dav_propfind_set_flat # define dav_proppatch AN_dav_proppatch # define dav_propset_iterate AN_dav_propset_iterate # define dav_propset_private AN_dav_propset_private # define dav_propset_status AN_dav_propset_status # define dav_propset_value AN_dav_propset_value # define dav_simple_propfind AN_dav_simple_propfind # define propstat AN_propstat # define hip_xml_create AN_hip_xml_create # define hip_xml_currentline AN_hip_xml_currentline # define hip_xml_destroy AN_hip_xml_destroy # define hip_xml_get_error AN_hip_xml_get_error # define hip_xml_parse AN_hip_xml_parse # define hip_xml_parse_v AN_hip_xml_parse_v # define hip_xml_push_handler AN_hip_xml_push_handler # define hip_xml_push_mixed_handler AN_hip_xml_push_mixed_handler # define hip_xml_set_error AN_hip_xml_set_error # define hip_xml_valid AN_hip_xml_valid # define http_auth_challenge AN_http_auth_challenge # define http_auth_create AN_http_auth_create # define http_auth_destroy AN_http_auth_destroy # define http_auth_finish AN_http_auth_finish # define http_auth_init AN_http_auth_init # define http_auth_new_request AN_http_auth_new_request # define http_auth_request_header AN_http_auth_request_header # define http_auth_response_body AN_http_auth_response_body # define http_auth_set_creds_cb AN_http_auth_set_creds_cb # define http_auth_verify_response AN_http_auth_verify_response # define http_content_type_handler AN_http_content_type_handler # define http_get AN_http_get # define http_get_range AN_http_get_range # define http_getmodtime AN_http_getmodtime # define http_options AN_http_options # define http_post AN_http_post # define http_put AN_http_put # define http_put_if_unmodified AN_http_put_if_unmodified # define http_read_file AN_http_read_file # define http_cookie_hooks AN_http_cookie_hooks # define http_redirect_register AN_http_redirect_register # define redirect_hooks AN_redirect_hooks # define http_accept_2xx AN_http_accept_2xx # define http_add_hooks AN_http_add_hooks # define http_add_request_header AN_http_add_request_header # define http_add_response_body_reader AN_http_add_response_body_reader # define http_add_response_header_catcher AN_http_add_response_header_catcher # define http_add_response_header_handler AN_http_add_response_header_handler # define http_duplicate_header AN_http_duplicate_header # define http_get_error AN_http_get_error # define http_get_hook_private AN_http_get_hook_private # define http_get_request_headers AN_http_get_request_headers # define http_get_scheme AN_http_get_scheme # define http_get_server_hostport AN_http_get_server_hostport # define http_get_status AN_http_get_status # define http_handle_numeric_header AN_http_handle_numeric_header # define http_print_request_header AN_http_print_request_header # define http_request_create AN_http_request_create # define http_request_destroy AN_http_request_destroy # define http_request_dispatch AN_http_request_dispatch # define http_session_create AN_http_session_create # define http_session_decide_proxy AN_http_session_decide_proxy # define http_session_destroy AN_http_session_destroy # define http_session_proxy AN_http_session_proxy # define http_session_server AN_http_session_server # define http_set_accept_secure_upgrade AN_http_set_accept_secure_upgrade # define http_set_error AN_http_set_error # define http_set_expect100 AN_http_set_expect100 # define http_set_persist AN_http_set_persist # define http_set_proxy_auth AN_http_set_proxy_auth # define http_set_request_body_buffer AN_http_set_request_body_buffer # define http_set_request_body_stream AN_http_set_request_body_stream # define http_set_request_secure_upgrade AN_http_set_request_secure_upgrade # define http_set_secure AN_http_set_secure # define http_set_secure_context AN_http_set_secure_context # define http_set_server_auth AN_http_set_server_auth # define http_set_useragent AN_http_set_useragent # define http_version_pre_http11 AN_http_version_pre_http11 # define http_dateparse AN_http_dateparse # define http_parse_statusline AN_http_parse_statusline # define neon_debug AN_neon_debug # define neon_debug_init AN_neon_debug_init # define neon_debug_mask AN_neon_debug_mask # define neon_debug_stream AN_neon_debug_stream # define neon_version_minimum AN_neon_version_minimum # define neon_version_string AN_neon_version_string # define md5_buffer AN_md5_buffer # define md5_finish_ctx AN_md5_finish_ctx # define md5_init_ctx AN_md5_init_ctx # define md5_process_block AN_md5_process_block # define md5_process_bytes AN_md5_process_bytes # define md5_read_ctx AN_md5_read_ctx # define md5_stream AN_md5_stream # define ne_calloc AN_ne_calloc # define ne_malloc AN_ne_malloc # define ne_oom_callback AN_ne_oom_callback # define ne_realloc AN_ne_realloc # define ne_strdup AN_ne_strdup # define ne_strndup AN_ne_strndup # define sock_accept AN_sock_accept # define sock_block AN_sock_block # define sock_call_progress AN_sock_call_progress # define sock_close AN_sock_close # define sock_connect AN_sock_connect # define sock_connect_u AN_sock_connect_u # define sock_create_ssl_context AN_sock_create_ssl_context # define sock_destroy_ssl_context AN_sock_destroy_ssl_context # define sock_disable_sslv2 AN_sock_disable_sslv2 # define sock_disable_sslv3 AN_sock_disable_sslv3 # define sock_disable_tlsv1 AN_sock_disable_tlsv1 # define sock_exit AN_sock_exit # define sock_fullread AN_sock_fullread # define sock_fullwrite AN_sock_fullwrite # define sock_get_error AN_sock_get_error # define sock_get_fd AN_sock_get_fd # define sock_init AN_sock_init # define sock_make_secure AN_sock_make_secure # define sock_name_lookup AN_sock_name_lookup # define sock_peek AN_sock_peek # define sock_read AN_sock_read # define sock_readfile_blocked AN_sock_readfile_blocked # define sock_readline AN_sock_readline # define sock_register_notify AN_sock_register_notify # define sock_register_progress AN_sock_register_progress # define sock_send_string AN_sock_send_string # define sock_sendline AN_sock_sendline # define sock_service_lookup AN_sock_service_lookup # define sock_set_client_cert AN_sock_set_client_cert # define sock_set_key_prompt AN_sock_set_key_prompt # define sock_transfer AN_sock_transfer # define ascii_to_md5 AN_ascii_to_md5 # define md5_to_ascii AN_md5_to_ascii # define ne_concat AN_ne_concat # define ne_utf8_encode AN_ne_utf8_encode # define pair_string AN_pair_string # define pair_string_free AN_pair_string_free # define sbuffer_altered AN_sbuffer_altered # define sbuffer_append AN_sbuffer_append # define sbuffer_clear AN_sbuffer_clear # define sbuffer_concat AN_sbuffer_concat # define sbuffer_create AN_sbuffer_create # define sbuffer_create_sized AN_sbuffer_create_sized # define sbuffer_data AN_sbuffer_data # define sbuffer_destroy AN_sbuffer_destroy # define sbuffer_finish AN_sbuffer_finish # define sbuffer_grow AN_sbuffer_grow # define sbuffer_size AN_sbuffer_size # define sbuffer_zappend AN_sbuffer_zappend # define shave_string AN_shave_string # define split_string AN_split_string # define split_string_c AN_split_string_c # define split_string_free AN_split_string_free # define uri_absolute AN_uri_absolute # define uri_abspath AN_uri_abspath # define uri_abspath_escape AN_uri_abspath_escape # define uri_childof AN_uri_childof # define uri_compare AN_uri_compare # define uri_free AN_uri_free # define uri_has_trailing_slash AN_uri_has_trailing_slash # define uri_parent AN_uri_parent # define uri_parse AN_uri_parse # define uri_unescape AN_uri_unescape # define fetch_resource_list AN_fetch_resource_list # define free_resource AN_free_resource # define free_resource_list AN_free_resource_list #endif #endif avfs-1.0.5/libneon/neon_i18n.h0000644000175000017500000000216113102441254015633 0ustar michaelmichael/* Internationalization of neon Copyright (C) 1999-2001, Joe Orton 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 */ #ifndef NEON_I18N_H #define NEON_I18N_H #include "neonconf.h" #undef _ #ifdef ENABLE_NLS #include #define _(str) gettext(str) #else #define _(str) (str) #endif /* ENABLE_NLS */ #define N_(str) (str) /* Initialize i18n in neon */ void neon_i18n_init(void); #endif /* NEON_I18N_H */ avfs-1.0.5/libneon/http_private.h0000644000175000017500000001242313102441254016550 0ustar michaelmichael/* HTTP Request Handling Copyright (C) 1999-2001, Joe Orton 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 */ /* THIS IS NOT A PUBLIC INTERFACE. You CANNOT include this header file * from an application. */ #ifndef HTTP_PRIVATE_H #define HTTP_PRIVATE_H #include "http_auth.h" struct host_info { /* hostname is not const since it changes on redirects. */ char *hostname; int port; struct in_addr addr; char *hostport; /* URI hostport segment */ http_auth_session auth; http_request_auth auth_callback; void *auth_userdata; }; typedef enum { body_buffer, body_stream, body_none } request_body; /* This is called with each of the headers in the response */ struct header_handler { char *name; http_header_handler handler; void *userdata; struct header_handler *next; }; /* TODO: could unify these all into a generic callback list */ struct body_reader { http_block_reader handler; http_accept_response accept_response; unsigned int use:1; void *userdata; struct body_reader *next; }; /* Store hook information */ struct hook { const http_request_hooks *hooks; void *private; struct hook *next; }; /* Per-request store for hooks. * This is a bit noddy really. */ struct hook_request { struct hook *hook; void *cookie; struct hook_request *next; }; #define HAVE_HOOK(st,func) (st->hook->hooks->func != NULL) #define HOOK_FUNC(st, func) (*st->hook->hooks->func) /* Session support. */ struct http_session_s { /* Connection information */ nsocket *socket; struct host_info server, proxy; /* Connection states: * 0: Not connected at all. * 1: We have a TCP connection to the next-hop server. * 2: We have a negotiated an SSL connection over the proxy's * TCP tunnel. * * Note, 1 is all we need if we don't have a proxy server, or * if we do have a proxy server and we're not using SSL. */ unsigned int connected:2; /* Settings */ unsigned int have_proxy:1; /* do we have a proxy server? */ unsigned int no_persist:1; /* set to disable persistent connections */ unsigned int use_secure:1; /* whether a secure connection is required */ int expect100_works:2; /* known state of 100-continue support */ unsigned int in_connect:1; /* doing a proxy CONNECT */ unsigned int request_secure_upgrade:1; unsigned int accept_secure_upgrade:1; http_use_proxy proxy_decider; void *proxy_decider_udata; nssl_context *ssl_context; struct hook *hooks; char *location; /* 302 redirect location of last request */ char *user_agent; /* full User-Agent string */ /* The last HTTP-Version returned by the server */ int version_major; int version_minor; /* Error string */ char error[BUFSIZ]; }; struct http_req_s { const char *method; char *uri, *abs_path; /*** Request ***/ sbuffer headers; request_body body; FILE *body_stream; const char *body_buffer; size_t body_size; /**** Response ***/ /* The transfer encoding types */ struct http_response { unsigned int is_chunked; /* Are we using chunked TE? */ int length; /* Response entity-body content-length */ int left; /* Bytes left to read */ long int chunk_left; /* Bytes of chunk left to read */ } resp; /* List of callbacks which are passed response headers */ struct header_handler *header_catchers; /* We store response header handlers in a hash table. The hash is * derived from the header name in lower case. */ /* 53 is magic, of course. For a standard http_get (with * redirects), 9 header handlers are defined. Two of these are * for Content-Length (which is a bug, and should be fixed * really). Ignoring that hash clash, the 8 *different* handlers * all hash uniquely into the hash table of size 53. */ #define HH_HASHSIZE 53 struct header_handler *header_handlers[HH_HASHSIZE]; /* List of callbacks which are passed response body blocks */ struct body_reader *body_readers; /*** Miscellaneous ***/ unsigned int method_is_head:1; unsigned int use_proxy:1; unsigned int use_expect100:1; unsigned int can_persist:1; unsigned int forced_close:1; unsigned int upgrade_to_tls:1; http_session *session; http_status status; /* stores request-private hook info */ struct hook_request *hook_store; #ifdef USE_DAV_LOCKS /* TODO: move this to hooks... list of locks to submit */ struct dav_submit_locks *if_locks; #endif }; #endif /* HTTP_PRIVATE_H */ avfs-1.0.5/libneon/COPYING.LIB0000644000175000017500000006130313102441254015327 0ustar michaelmichael 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.0.5/libneon/dav_props.c0000644000175000017500000003706213102441254016035 0ustar michaelmichael/* WebDAV Properties manipulation Copyright (C) 2000-2001, Joe Orton 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 */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #include "ne_alloc.h" #include "dav_props.h" #include "dav_basic.h" #include "hip_xml.h" struct dav_propfind_handler_s { http_session *sess; const char *uri; int depth; int has_props; /* whether we've already written some * props to the body. */ sbuffer body; dav_207_parser *parser207; hip_xml_parser *parser; struct hip_xml_elm *elms; /* Callback to create the private structure. */ dav_props_create_complex private_creator; void *private_userdata; /* Current propset. */ dav_prop_result_set *current; dav_props_result callback; void *userdata; }; #define ELM_namedprop (DAV_ELM_207_UNUSED) /* We build up the results of one 'response' element in memory. */ struct prop { char *name, *nspace, *value; /* Store a dav_propname here too, for convienience. pname.name = * name, pname.nspace = nspace, but they are const'ed in pname. */ dav_propname pname; }; struct propstat { struct prop *props; int numprops; http_status status; } propstat; /* Results set. */ struct dav_prop_result_set_s { struct propstat *pstats; int numpstats; void *private; char *href; }; hip_xml_parser *dav_propfind_get_parser(dav_propfind_handler *handler) { return handler->parser; } static int propfind(dav_propfind_handler *handler, dav_props_result results, void *userdata) { int ret; http_req *req; /* Register the catch-all handler to ignore any cruft the * server returns. */ dav_207_ignore_unknown(handler->parser207); req = http_request_create(handler->sess, "PROPFIND", handler->uri); handler->callback = results; handler->userdata = userdata; http_set_request_body_buffer(req, sbuffer_data(handler->body)); http_add_request_header(req, "Content-Type", "text/xml"); /* TODO: UTF-8? */ dav_add_depth_header(req, handler->depth); http_add_response_body_reader(req, dav_accept_207, hip_xml_parse_v, handler->parser); ret = http_request_dispatch(req); if (ret == HTTP_OK && http_get_status(req)->klass != 2) { ret = HTTP_ERROR; } else if (!hip_xml_valid(handler->parser)) { http_set_error(handler->sess, hip_xml_get_error(handler->parser)); ret = HTTP_ERROR; } http_request_destroy(req); return ret; } static void set_body(dav_propfind_handler *hdl, const dav_propname *names) { sbuffer body = hdl->body; int n; if (!hdl->has_props) { sbuffer_zappend(body, "" EOL); hdl->has_props = 1; } for (n = 0; names[n].name != NULL; n++) { char *name, *nspace; /* TODO: * In retrospect it is probably Wrong to do UTF-8 encoding * here. More likely, it should be an API requirement that * property names/values are UTF-8 encoded strings. * * I'm not up on the issues and problems that need to be * solved in this arena, so someone who is please shout * at me and tell me I'm stupid: neon@webdav.org */ name = ne_utf8_encode(names[n].name); nspace = ne_utf8_encode(names[n].nspace); sbuffer_concat(body, "<", names[n].name, " xmlns=\"", names[n].nspace, "\"/>" EOL, NULL); free(name); free(nspace); } } int dav_propfind_allprop(dav_propfind_handler *handler, dav_props_result results, void *userdata) { sbuffer_zappend(handler->body, "" EOL); return propfind(handler, results, userdata); } int dav_propfind_named(dav_propfind_handler *handler, dav_props_result results, void *userdata) { sbuffer_zappend(handler->body, "" EOL); return propfind(handler, results, userdata); } /* The easy one... PROPPATCH */ int dav_proppatch(http_session *sess, const char *uri, const dav_proppatch_operation *items) { http_req *req = http_request_create(sess, "PROPPATCH", uri); sbuffer body = sbuffer_create(); char *utf8body; int n, ret; /* Create the request body */ sbuffer_zappend(body, "" EOL ""); for (n = 0; items[n].name != NULL; n++) { switch (items[n].type) { case dav_propset: /* value */ sbuffer_concat(body, "" "<", items[n].name->name, " xmlns=\"", items[n].name->nspace, "\">", items[n].value, "name, ">" EOL, NULL); break; case dav_propremove: /* */ sbuffer_concat(body, "<", items[n].name->name, " xmlns=\"", items[n].name->nspace, "\"/>" EOL, NULL); break; } } sbuffer_zappend(body, "" EOL); utf8body = ne_utf8_encode(sbuffer_data(body)); http_set_request_body_buffer(req, utf8body); http_add_request_header(req, "Content-Type", "text/xml"); /* TODO: UTF-8? */ ret = dav_simple_request(sess, req); sbuffer_destroy(body); free(utf8body); return ret; } /* Compare two property names. */ static int pnamecmp(const dav_propname *pn1, const dav_propname *pn2) { return (strcasecmp(pn1->nspace, pn2->nspace) || strcasecmp(pn1->name, pn2->name)); } /* Find property in 'set' with name 'pname'. If found, set pstat_ret * to the containing propstat, likewise prop_ret, and returns zero. * If not found, returns non-zero. */ static int findprop(const dav_prop_result_set *set, const dav_propname *pname, struct propstat **pstat_ret, struct prop **prop_ret) { int ps, p; for (ps = 0; ps < set->numpstats; ps++) { for (p = 0; p < set->pstats[ps].numprops; p++) { struct prop *prop = &set->pstats[ps].props[p]; if (pnamecmp(&prop->pname, pname) == 0) { if (pstat_ret != NULL) *pstat_ret = &set->pstats[ps]; if (prop_ret != NULL) *prop_ret = prop; return 0; } } } return -1; } const char *dav_propset_value(const dav_prop_result_set *set, const dav_propname *pname) { struct prop *prop; if (findprop(set, pname, NULL, &prop)) { return NULL; } else { return prop->value; } } void *dav_propfind_current_private(dav_propfind_handler *handler) { return handler->current->private; } void *dav_propset_private(const dav_prop_result_set *set) { return set->private; } int dav_propset_iterate(const dav_prop_result_set *set, dav_propset_iterator iterator, void *userdata) { int ps, p; for (ps = 0; ps < set->numpstats; ps++) { for (p = 0; p < set->pstats[ps].numprops; p++) { struct prop *prop = &set->pstats[ps].props[p]; int ret = iterator(userdata, &prop->pname, prop->value, &set->pstats[ps].status); if (ret) return ret; } } return 0; } const http_status *dav_propset_status(const dav_prop_result_set *set, const dav_propname *pname) { struct propstat *pstat; if (findprop(set, pname, &pstat, NULL)) { /* TODO: it is tempting to return a dummy status object here * rather than NULL, which says "Property result was not given * by server." but I'm not sure if this is best left to the * client. */ return NULL; } else { return &pstat->status; } } static int check_context(hip_xml_elmid parent, hip_xml_elmid child) { if (child == ELM_namedprop && parent == DAV_ELM_prop) return HIP_XML_VALID; if (child == HIP_ELM_unknown && parent == DAV_ELM_prop) return HIP_XML_VALID; return HIP_XML_DECLINE; } static void *start_response(void *userdata, const char *href) { dav_prop_result_set *set = ne_calloc(sizeof(*set)); dav_propfind_handler *hdl = userdata; set->href = ne_strdup(href); if (hdl->private_creator != NULL) { set->private = hdl->private_creator(hdl->private_userdata, href); } hdl->current = set; return set; } static void *start_propstat(void *userdata, void *response) { dav_prop_result_set *set = response; int n; struct propstat *pstat; n = set->numpstats; set->pstats = realloc(set->pstats, sizeof(struct propstat) * (n+1)); set->numpstats = n+1; pstat = &set->pstats[n]; memset(pstat, 0, sizeof(*pstat)); /* And return this as the new pstat. */ return &set->pstats[n]; } static int startelm(void *userdata, const struct hip_xml_elm *elm, const char **atts) { dav_propfind_handler *hdl = userdata; struct propstat *pstat = dav_207_get_current_propstat(hdl->parser207); struct prop *prop; int n; /* Paranoia */ if (pstat == NULL) { DEBUG(DEBUG_XML, "gp_startelm: No propstat found, or not my element."); return -1; } /* Add a property to this propstat */ n = pstat->numprops; pstat->props = realloc(pstat->props, sizeof(struct prop) * (n + 1)); pstat->numprops = n+1; /* Fill in the new property. */ prop = &pstat->props[n]; prop->pname.name = prop->name = ne_strdup(elm->name); prop->pname.nspace = prop->nspace = ne_strdup(elm->nspace); prop->value = NULL; DEBUG(DEBUG_XML, "Got property #%d: %s@@%s.\n", n, prop->nspace, prop->name); return 0; } static int endelm(void *userdata, const struct hip_xml_elm *elm, const char *cdata) { dav_propfind_handler *hdl = userdata; struct propstat *pstat = dav_207_get_current_propstat(hdl->parser207); int n; if (pstat == NULL) { DEBUG(DEBUG_XML, "gp_endelm: No propstat found, or not my element."); return -1; } n = pstat->numprops - 1; DEBUG(DEBUG_XML, "Value of property #%d is %s\n", n, cdata); pstat->props[n].value = ne_strdup(cdata); return 0; } static void end_propstat(void *userdata, void *pstat_v, const char *status_line, const http_status *status, const char *description) { struct propstat *pstat = pstat_v; /* If we get a non-2xx response back here, we wipe the value for * each of the properties in this propstat, so the caller knows to * look at the status instead. It's annoying, since for each prop * we will have done an unnecessary strdup("") above, but there is * no easy way round that given the fact that we don't know * whether we've got an error or not till after we get the * property element. */ if (status->klass != 2) { int n; for (n = 0; n < pstat->numprops; n++) { free(pstat->props[n].value); pstat->props[n].value = NULL; } } pstat->status = *status; } /* Frees up a results set */ static void free_propset(dav_prop_result_set *set) { int n; for (n = 0; n < set->numpstats; n++) { int m; struct propstat *p = &set->pstats[n]; for (m = 0; m < p->numprops; m++) { free(p->props[m].nspace); free(p->props[m].name); HTTP_FREE(p->props[m].value); } free(set->pstats[n].props); } free(set->pstats); free(set); } static void end_response(void *userdata, void *resource, const char *status_line, const http_status *status, const char *description) { dav_propfind_handler *handler = userdata; dav_prop_result_set *set = resource; /* TODO: Handle status here too? The status element is mandatory * inside each propstat, so, not much point probably. */ /* Pass back the results for this resource. */ if (handler->callback != NULL) { handler->callback(handler->userdata, set->href, set); } free(set->href); /* Clean up the propset tree we've just built. */ free_propset(set); } dav_propfind_handler * dav_propfind_create(http_session *sess, const char *uri, int depth) { dav_propfind_handler *ret = ne_calloc(sizeof(dav_propfind_handler)); ret->parser = hip_xml_create(); ret->parser207 = dav_207_create(ret->parser, ret); ret->uri = uri; ret->depth = depth; ret->sess = sess; ret->body = sbuffer_create(); dav_207_set_response_handlers(ret->parser207, start_response, end_response); dav_207_set_propstat_handlers(ret->parser207, start_propstat, end_propstat); /* The start of the request body is fixed: */ sbuffer_concat(ret->body, "" EOL "", NULL); return ret; } static struct hip_xml_elm *make_elms(const dav_propname *props) { int n; struct hip_xml_elm *elms; if (props == NULL) { /* Just collect unknown. Note this is a collect, so they get * a noddy text representation of the XML back, which is * probably never actually useful. */ DEBUG(DEBUG_XML, "using UNKNOWN element handler.\n"); elms = ne_calloc(sizeof(*elms) * 2); elms[0].id = HIP_ELM_unknown; elms[0].flags = HIP_XML_COLLECT | HIP_XML_UTF8DECODE; return elms; } else { /* Count the properties */ for (n = 0; props[n].name != NULL; n++) /* noop */; /* Allocate the array, enough for each */ elms = ne_calloc(sizeof(*elms) * (n+1)); /* Fill it in. Note that the elements all have the SAME * element ID, and we COLLECT inside them, since these * are flat properties. */ for (n = 0; props[n].name != NULL; n++) { elms[n].nspace = props[n].nspace; elms[n].name = props[n].name; elms[n].id = ELM_namedprop; elms[n].flags = HIP_XML_COLLECT | HIP_XML_UTF8DECODE; } } return elms; } static void free_elms(struct hip_xml_elm *elms) { free(elms); } /* Destroy a propfind handler */ void dav_propfind_destroy(dav_propfind_handler *handler) { dav_207_destroy(handler->parser207); hip_xml_destroy(handler->parser); if (handler->elms != NULL) free_elms(handler->elms); sbuffer_destroy(handler->body); free(handler); } int dav_simple_propfind(http_session *sess, const char *href, int depth, const dav_propname *props, dav_props_result results, void *userdata) { dav_propfind_handler *hdl; int ret; hdl = dav_propfind_create(sess, href, depth); if (props != NULL) { /* Named. */ dav_propfind_set_flat(hdl, props); ret = dav_propfind_named(hdl, results, userdata); } else { /* Allprop: register the catch-all-props handler. */ hdl->elms = make_elms(NULL); hip_xml_push_handler(hdl->parser, hdl->elms, check_context, startelm, endelm, hdl); ret = dav_propfind_allprop(hdl, results, userdata); } dav_propfind_destroy(hdl); return ret; } void dav_propfind_set_flat(dav_propfind_handler *hdl, const dav_propname *props) { set_body(hdl, props); /* Register our special flat-property handler, which * is used for every flat property that they just passed. */ hdl->elms = make_elms(props); hip_xml_push_handler(hdl->parser, hdl->elms, check_context, startelm, endelm, hdl); } void dav_propfind_set_complex(dav_propfind_handler *hdl, const dav_propname *props, dav_props_create_complex creator, void *userdata) { set_body(hdl, props); hdl->private_creator = creator; hdl->private_userdata = userdata; } avfs-1.0.5/libneon/http_cookies.c0000644000175000017500000000706413102441254016532 0ustar michaelmichael/* Basic cookie support for neon Copyright (C) 1999-2001, Joe Orton 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 */ /* A nice demo of hooks, since it doesn't need any external * interface to muck with the stored states. */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #include #include "http_request.h" #include "string_utils.h" #include "http_cookies.h" #include "ne_alloc.h" static void set_cookie_hdl(void *userdata, const char *value) { char **pairs = pair_string(value, ';', '=', HTTP_QUOTES, HTTP_WHITESPACE); http_cookie *cook; http_cookie_cache *cache = userdata; int n; /* Check sanity */ if (pairs[0] == NULL || pairs[1] == NULL) { /* yagaboo */ return; } DEBUG(DEBUG_HTTP, "Got cookie name=%s\n", pairs[0]); /* Search for a cookie of this name */ DEBUG(DEBUG_HTTP, "Searching for existing cookie...\n"); for (cook = cache->cookies; cook != NULL; cook = cook->next) { if (strcasecmp(cook->name, pairs[0]) == 0) { break; } } if (cook == NULL) { DEBUG(DEBUG_HTTP, "New cookie.\n"); cook = ne_malloc(sizeof(http_cookie)); memset(cook, 0, sizeof(http_cookie)); cook->name = pairs[0]; cook->next = cache->cookies; cache->cookies = cook; } else { /* Free the old value */ free(cook->value); } cook->value = pairs[1]; for (n = 2; pairs[n] != NULL; n+=2) { DEBUG(DEBUG_HTTP, "Cookie parm %s=%s\n", pairs[n], pairs[n+1]); if (strcasecmp(pairs[n], "path") == 0) { cook->path = pairs[n+1]; pairs[n+1] = NULL; } else if (strcasecmp(pairs[n], "max-age") == 0) { int t = atoi(pairs[n+1]); cook->expiry = time(NULL) + (time_t)t; } else if (strcasecmp(pairs[n], "domain") == 0) { cook->domain = pairs[n+1]; pairs[n+1] = NULL; } } DEBUG(DEBUG_HTTP, "End of parms.\n"); pair_string_free(pairs); } static void *create(void *session, http_req *req, const char *method, const char *uri) { http_cookie_cache *cache = session; http_add_response_header_handler(req, "Set-Cookie", set_cookie_hdl, cache); return cache; } /* Just before sending the request: let them add headers if they want */ static void pre_send(void *private, sbuffer request) { http_cookie_cache *cache = private; http_cookie *cook; if (cache->cookies == NULL) { return; } sbuffer_zappend(request, "Cookie: "); for (cook = cache->cookies; cook != NULL; cook=cook->next) { sbuffer_concat(request, cook->name, "=", cook->value, NULL); if (cook->next != NULL) { sbuffer_zappend(request, "; "); } } sbuffer_zappend(request, EOL); } static void destroy(void *private) { /* FIXME */ return; } http_request_hooks http_cookie_hooks = { "http://www.webdav.org/neon/hooks/cookies", create, NULL, pre_send, NULL, destroy }; avfs-1.0.5/libneon/hip_xml.c0000644000175000017500000005463513102441254015505 0ustar michaelmichael/* Higher Level Interface to XML Parsers. Copyright (C) 1999-2001, Joe Orton 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 */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #include "neon_i18n.h" #include "ne_alloc.h" #include "http_utils.h" #include "string_utils.h" #include "hip_xml.h" #ifdef HAVE_EXPAT /******** Expat ***********/ # include "xmlparse.h" typedef XML_Char hip_xml_char; #else /* not HAVE_EXPAT */ # ifdef HAVE_LIBXML /******** libxml **********/ # include typedef xmlChar hip_xml_char; # else /* not HAVE_LIBXML */ # error need an XML parser # endif /* not HAVE_LIBXML */ #endif /* not HAVE_EXPAT */ /* Approx. one screen of text: */ #define HIP_ERR_SIZE (2048) /* A list of elements */ struct hip_xml_handler { const struct hip_xml_elm *elements; /* put it in static memory */ hip_xml_validate_cb validate_cb; /* validation function */ hip_xml_startelm_cb startelm_cb; /* on-complete element function */ hip_xml_endelm_cb endelm_cb; /* on-complete element function */ hip_xml_cdata_cb cdata_cb; /* cdata callback for mixed mode */ void *userdata; struct hip_xml_handler *next; }; struct hip_xml_state { /* The element details */ const struct hip_xml_elm *elm; /* Storage for an unknown element */ struct hip_xml_elm elm_real; char *real_name; /* Namespaces declared in this element */ hip_xml_char *default_ns; /* A default namespace */ struct hip_xml_nspace *nspaces; /* List of other namespace scopes */ unsigned int mixed:1; /* are we in MIXED mode? */ /* Extras */ struct hip_xml_handler *handler; /* Where the element was declared */ struct hip_xml_state *parent; /* The parent in the tree */ }; /* TODO: * could move 'valid' into state, maybe allow optional * continuation past an invalid branch. */ /* We pass around a hip_xml_parser as the userdata in the parsing * library. This maintains the current state of the parse and various * other bits and bobs. Within the parse, we store the current branch * of the tree, i.e., the current element and all its parents, up to * the root, but nothing other than that. */ struct hip_xml_parser_s { struct hip_xml_state *root; /* the root of the document */ struct hip_xml_state *current; /* current element in the branch */ sbuffer buffer; /* the CDATA/collect buffer */ unsigned int valid:1; /* currently valid? */ unsigned int want_cdata:1; /* currently collecting CDATA? */ unsigned int collect; /* current collect depth */ struct hip_xml_handler *top_handlers; /* always points at the * handler on top of the stack. */ #ifdef HAVE_EXPAT XML_Parser parser; #else xmlParserCtxtPtr parser; #endif char error[HIP_ERR_SIZE]; }; static void destroy_state(struct hip_xml_state *s); static const char *friendly_name(const struct hip_xml_elm *elm) { switch(elm->id) { case HIP_ELM_root: return _("document root"); case HIP_ELM_unknown: return _("unknown element"); default: if (elm->name) { return elm->name; } else { return _("unspecified"); } } } const static struct hip_xml_elm root_element = { "@@", HIP_ELM_root, 0 }; /* The callback handlers */ static void start_element(void *userdata, const hip_xml_char *name, const hip_xml_char **atts); static void end_element(void *userdata, const hip_xml_char *name); static void char_data(void *userdata, const hip_xml_char *cdata, int len); #define HIP_XML_DECODE_UTF8 #ifdef HIP_XML_DECODE_UTF8 /* UTF-8 decoding */ /* Single byte range 0x00 -> 0x7F */ #define SINGLEBYTE_UTF8(ch) (((unsigned char) (ch)) < 0x80) /* Decode a double byte UTF8 string. * Returns 0 on success or non-zero on error. */ static inline int decode_utf8_double(char *dest, const char *src); #endif /* Linked list of namespace scopes */ struct hip_xml_nspace { hip_xml_char *name; hip_xml_char *uri; struct hip_xml_nspace *next; }; /* And an auxiliary */ static int parse_element(hip_xml_parser *p, struct hip_xml_state *state, const hip_xml_char *name, const hip_xml_char **atts); #ifdef HAVE_LIBXML /* Could be const as far as we care, but libxml doesn't want that */ static xmlSAXHandler sax_handler = { NULL, /* internalSubset */ NULL, /* isStandalone */ NULL, /* hasInternalSubset */ NULL, /* hasExternalSubset */ NULL, /* resolveEntity */ NULL, /* getEntity */ NULL, /* entityDecl */ NULL, /* notationDecl */ NULL, /* attributeDecl */ NULL, /* elementDecl */ NULL, /* unparsedEntityDecl */ NULL, /* setDocumentLocator */ NULL, /* startDocument */ NULL, /* endDocument */ start_element, /* startElement */ end_element, /* endElement */ NULL, /* reference */ char_data, /* characters */ NULL, /* ignorableWhitespace */ NULL, /* processingInstruction */ NULL, /* comment */ NULL, /* xmlParserWarning */ NULL, /* xmlParserError */ NULL, /* xmlParserError */ NULL, /* getParameterEntity */ char_data /* cdataBlock */ }; #endif /* HAVE_LIBXML */ #ifdef HIP_XML_DECODE_UTF8 static inline int decode_utf8_double(char *dest, const char *src) { /* From utf-8 man page; two-byte encoding is: * 0x00000080 - 0x000007FF: * 110xxxxx 10xxxxxx * If more than 8-bits of those x's are set, we fail. * So, we check that the first 6 bits of the first byte are: * 110000. * Then decode like: * 110000xx 10yyyyyy -> xxyyyyyy * Do this with a mask and a compare: * zzzzzzzz * & 11111100 <=> 0xFC * == 11000000 <=> 0xC0 * * joe: A real C hacker would probably do some funky bit * inversion, and turn this into an is-not-zero test, * but I'm a fake, so... */ if ((src[0] & 0xFC) == 0xC0) { dest[0] = ((src[0] & 0x03) << 6) | (src[1] & 0x3F); /* nb. * 00000011 = 0x03 * 00111111 = 0x3F */ return 0; } else { return -1; } } #endif int hip_xml_currentline(hip_xml_parser *p) { #ifdef HAVE_EXPAT return XML_GetCurrentLineNumber(p->parser); #else return p->parser->input->line; #endif } static int find_handler(hip_xml_parser *p, struct hip_xml_state *state) { struct hip_xml_handler *cur, *unk_handler = NULL; const char *name = state->elm_real.name, *nspace = state->elm_real.nspace; int n, got_unknown = 0; for (cur = state->parent->handler; cur != NULL; cur = cur->next) { for (n = 0; (cur->elements[n].nspace != NULL || ( cur->elements[n].nspace == NULL && cur->elements[n].id == HIP_ELM_unknown)); n++) { if (cur->elements[n].nspace != NULL && (strcasecmp(cur->elements[n].name, name) == 0 && strcasecmp(cur->elements[n].nspace, nspace) == 0)) { switch ((*cur->validate_cb)(state->parent->elm->id, cur->elements[n].id)) { case HIP_XML_VALID: DEBUG(DEBUG_XML, "Validated by handler.\n"); state->handler = cur; state->elm = &cur->elements[n]; return 0; case HIP_XML_INVALID: DEBUG(DEBUG_XML, "Invalid context.\n"); snprintf(p->error, HIP_ERR_SIZE, _("XML is not valid (%s found in parent %s)"), friendly_name(&cur->elements[n]), friendly_name(state->parent->elm)); return -1; default: /* ignore it */ DEBUG(DEBUG_XML, "Declined by handler.\n"); break; } } if (!got_unknown && cur->elements[n].id == HIP_ELM_unknown) { switch ((*cur->validate_cb)(state->parent->elm->id, HIP_ELM_unknown)) { case HIP_XML_VALID: unk_handler = cur; got_unknown = 1; state->elm_real.id = HIP_ELM_unknown; state->elm_real.flags = cur->elements[n].flags; break; case HIP_XML_INVALID: DEBUG(DEBUG_XML, "Invalid context.\n"); snprintf(p->error, HIP_ERR_SIZE, _("XML is not valid (%s found in parent %s)"), friendly_name(&cur->elements[n]), friendly_name(state->parent->elm)); return -1; default: DEBUG(DEBUG_XML, "Declined by handler.\n"); break; } } } } if (!cur && got_unknown) { /* Give them the unknown handler */ DEBUG(DEBUG_XMLPARSE, "Using unknown element handler\n"); state->handler = unk_handler; state->elm = &state->elm_real; return 0; } else { DEBUG(DEBUG_XMLPARSE, "Unexpected element\n"); snprintf(p->error, HIP_ERR_SIZE, _("Unknown XML element `%s (in %s)'"), name, nspace); return -1; } } /* Called with the start of a new element. */ static void start_element(void *userdata, const hip_xml_char *name, const hip_xml_char **atts) { hip_xml_parser *p = userdata; struct hip_xml_state *s; if (!p->valid) { /* We've stopped parsing */ DEBUG(DEBUG_XML, "Parse died. Ignoring start of element: %s\n", name); return; } /* If we are in collect mode, print the element to the buffer */ if (p->collect) { /* In Collect Mode. */ const hip_xml_char *pnt = strchr(name, ':'); if (pnt == NULL) { pnt = name; } else { pnt++; } sbuffer_concat(p->buffer, "<", pnt, NULL); if (atts != NULL) { int n; for (n = 0; atts[n] != NULL; n+=2) { sbuffer_concat(p->buffer, " ", atts[n], "=", atts[n+1], NULL); } } sbuffer_zappend(p->buffer, ">"); /* One deeper */ p->collect++; return; } /* Set the new state */ s = ne_calloc(sizeof(struct hip_xml_state)); s->parent = p->current; p->current = s; /* We need to handle namespaces ourselves */ if (parse_element(p, s, name, atts)) { /* it bombed. */ p->valid = 0; return; } /* Map the element name to an id */ DEBUG(DEBUG_XML, "Mapping element name %s@@%s... ", s->elm_real.nspace, s->elm_real.name); if (find_handler(p, s)) { p->valid = 0; return; } DEBUG(DEBUG_XMLPARSE, "mapped to id %d\n", s->elm->id); /* Do we want cdata? */ p->want_cdata = ((s->elm->flags & HIP_XML_CDATA) == HIP_XML_CDATA); p->collect = ((s->elm->flags & HIP_XML_COLLECT) == HIP_XML_COLLECT); /* Is this element using mixed-mode? */ s->mixed = ((s->elm->flags & HIP_XML_MIXED) == HIP_XML_MIXED); if (s->handler->startelm_cb) { if ((*s->handler->startelm_cb)(s->handler->userdata, s->elm, (const char **) atts)) { DEBUG(DEBUG_XML, "Startelm callback failed.\n"); p->valid = 0; } } else { DEBUG(DEBUG_XML, "No startelm handler.\n"); } } /* Destroys given state */ static void destroy_state(struct hip_xml_state *s) { struct hip_xml_nspace *this_ns, *next_ns; DEBUG(DEBUG_XMLPARSE, "Freeing namespaces...\n"); HTTP_FREE(s->default_ns); HTTP_FREE(s->real_name); /* Free the namespaces */ this_ns = s->nspaces; while (this_ns != NULL) { next_ns = this_ns->next; free(this_ns->name); free(this_ns->uri); free(this_ns); this_ns = next_ns; }; DEBUG(DEBUG_XMLPARSE, "Finished freeing namespaces.\n"); free(s); } static void char_data(void *userdata, const hip_xml_char *data, int len) { hip_xml_parser *p = userdata; if (p->current->mixed) { (*p->current->handler->cdata_cb)( p->current->handler->userdata, p->current->elm, data, len); return; } if (!p->want_cdata || !p->valid) return; /* First, if this is the beginning of the CDATA, skip all * leading whitespace, we don't want it. */ DEBUG(DEBUG_XMLPARSE, "Given %d bytes of cdata.\n", len); if (sbuffer_size(p->buffer) == 0) { int wslen = 0; /* Ignore any leading whitespace */ while (wslen < len && (data[wslen] == ' ' || data[wslen] == '\r' || data[wslen] == '\n' || data[wslen] == '\t')) { wslen++; } data += wslen; len -= wslen; DEBUG(DEBUG_XMLPARSE, "Skipped %d bytes of leading whitespace.\n", wslen); if (len == 0) { DEBUG(DEBUG_XMLPARSE, "Zero bytes of content.\n"); return; } } #ifdef HIP_XML_DECODE_UTF8 if ((p->current->elm->flags & HIP_XML_UTF8DECODE) == HIP_XML_UTF8DECODE) { int n, m, clen; char *dest; clen = sbuffer_size(p->buffer); sbuffer_grow(p->buffer, clen + len + 1); dest = sbuffer_data(p->buffer) + clen; /* #define TOO_MUCH_DEBUG 1 */ for (n = 0, m = 0; n < len; n++, m++) { #ifdef TOO_MUCH_DEBUG DEBUG(DEBUG_XML, "decoding 0x%02x", 0xFF & data[n]); #endif if (SINGLEBYTE_UTF8(data[n])) { dest[m] = data[n]; } else { /* An optimisation here: we only deal with 8-bit * data, which will be encoded as two bytes of UTF-8 */ if ((len - n < 2) || decode_utf8_double(&dest[m], &data[n])) { /* Failed to decode! */ DEBUG(DEBUG_XML, "Could not decode UTF-8 data.\n"); strcpy(p->error, "XML parser received non-8-bit data"); p->valid = 0; return; } else { #ifdef TOO_MUCH_DEBUG DEBUG(DEBUG_XML, "UTF-8 two-bytes decode: " "0x%02hx 0x%02hx -> 0x%02hx!\n", data[n] & 0xFF, data[n+1] & 0xFF, dest[m] & 0xFF); #endif /* Skip the second byte */ n++; } } } sbuffer_altered(p->buffer); } else { sbuffer_append(p->buffer, data, len); } #else /* !HIP_XML_DECODE_UTF8 */ sbuffer_append(p->buffer, data, len); #endif } /* Called with the end of an element */ static void end_element(void *userdata, const hip_xml_char *name) { hip_xml_parser *p = userdata; struct hip_xml_state *s = p->current; if (!p->valid) { /* We've stopped parsing */ DEBUG(DEBUG_XML, "Parse died. Ignoring end of element: %s\n", name); return; } if (p->collect > 0) { if (--p->collect) { const hip_xml_char *pnt = strchr(name, ':'); if (pnt == NULL) { pnt = name; } else { pnt++; } sbuffer_concat(p->buffer, "", NULL); return; } } /* process it */ if (s->handler->endelm_cb) { DEBUG(DEBUG_XMLPARSE, "Calling endelm callback for %s.\n", s->elm->name); if ((*s->handler->endelm_cb)(s->handler->userdata, s->elm, p->want_cdata?sbuffer_data(p->buffer): NULL)) { DEBUG(DEBUG_XML, "Endelm callback failed.\n"); p->valid = 0; } } p->current = s->parent; /* Move the current pointer up the branch */ DEBUG(DEBUG_XML, "Back in element: %s\n", friendly_name(p->current->elm)); if (p->want_cdata) { sbuffer_clear(p->buffer); } destroy_state(s); } /* Parses the attributes, and handles XML namespaces. * With a little bit of luck. * Returns: * the element name on success * or NULL on error. */ static int parse_element(hip_xml_parser *p, struct hip_xml_state *state, const hip_xml_char *name, const hip_xml_char **atts) { struct hip_xml_nspace *ns; const hip_xml_char *pnt; struct hip_xml_state *xmlt; DEBUG(DEBUG_XMLPARSE, "Parsing elm of name: [%s]\n", name); /* Parse the atts for namespace declarations... if we have any atts. * expat will never pass us atts == NULL, but libxml will. */ if (atts != NULL) { int attn; for (attn = 0; atts[attn]!=NULL; attn+=2) { DEBUG(DEBUG_XMLPARSE, "Got attribute: [%s] = [%s]\n", atts[attn], atts[attn+1]); if (strcasecmp(atts[attn], "xmlns") == 0) { /* New default namespace */ state->default_ns = ne_strdup(atts[attn+1]); DEBUG(DEBUG_XMLPARSE, "New default namespace: %s\n", state->default_ns); } else if (strncasecmp(atts[attn], "xmlns:", 6) == 0) { /* New namespace scope */ ns = ne_calloc(sizeof(struct hip_xml_nspace)); ns->next = state->nspaces; state->nspaces = ns; ns->name = ne_strdup(atts[attn]+6); /* skip the xmlns= */ ns->uri = ne_strdup(atts[attn+1]); DEBUG(DEBUG_XMLPARSE, "New namespace scope: %s -> %s\n", ns->name, ns->uri); } } } /* Now check the elm name for a namespace scope */ pnt = strchr(name, ':'); if (pnt == NULL) { /* No namespace prefix - have we got a default? */ state->real_name = ne_strdup(name); DEBUG(DEBUG_XMLPARSE, "No prefix found, searching for default.\n"); for (xmlt = state; xmlt!=NULL; xmlt=xmlt->parent) { if (xmlt->default_ns != NULL) { state->elm_real.nspace = xmlt->default_ns; break; } } if (state->elm_real.nspace == NULL) { DEBUG(DEBUG_XMLPARSE, "No default namespace, using empty.\n"); state->elm_real.nspace = ""; } } else { DEBUG(DEBUG_XMLPARSE, "Got namespace scope. Trying to resolve..."); /* Have a scope - resolve it */ for (xmlt = state; state->elm_real.nspace==NULL && xmlt!=NULL; xmlt=xmlt->parent) { for (ns = xmlt->nspaces; ns!=NULL; ns=ns->next) { /* Just compare against the bit before the : * pnt points to the colon. */ if (strncasecmp(ns->name, name, pnt-name) == 0) { /* Scope matched! Hoorah */ state->elm_real.nspace = ns->uri; /* end the search */ break; } } } if (state->elm_real.nspace != NULL) { DEBUG(DEBUG_XMLPARSE, "Resolved prefix to [%s]\n", state->elm_real.nspace); /* The name is everything after the ':' */ if (pnt[1] == '\0') { snprintf(p->error, HIP_ERR_SIZE, "Element name missing in '%s' at line %d.", name, hip_xml_currentline(p)); DEBUG(DEBUG_XMLPARSE, "No element name after ':'. Failed.\n"); return -1; } state->real_name = ne_strdup(pnt+1); } else { DEBUG(DEBUG_XMLPARSE, "Undeclared namespace.\n"); snprintf(p->error, HIP_ERR_SIZE, "Undeclared namespace in '%s' at line %d.", name, hip_xml_currentline(p)); return -1; } } state->elm_real.name = state->real_name; return 0; } hip_xml_parser *hip_xml_create(void) { hip_xml_parser *p = ne_calloc(sizeof *p); /* Initialize other stuff */ p->valid = 1; /* Placeholder for the root element */ p->current = p->root = ne_calloc(sizeof(struct hip_xml_state)); p->root->elm = &root_element; /* Initialize the cdata buffer */ p->buffer = sbuffer_create(); #ifdef HAVE_EXPAT p->parser = XML_ParserCreate(NULL); if (p->parser == NULL) { abort(); } XML_SetElementHandler(p->parser, start_element, end_element); XML_SetCharacterDataHandler(p->parser, char_data); XML_SetUserData(p->parser, (void *) p); #else p->parser = xmlCreatePushParserCtxt(&sax_handler, (void *)p, NULL, 0, NULL); if (p->parser == NULL) { abort(); } #endif return p; } static void push_handler(hip_xml_parser *p, struct hip_xml_handler *handler) { /* If this is the first handler registered, update the * base pointer too. */ if (p->top_handlers == NULL) { p->root->handler = handler; p->top_handlers = handler; } else { p->top_handlers->next = handler; p->top_handlers = handler; } } void hip_xml_push_handler(hip_xml_parser *p, const struct hip_xml_elm *elements, hip_xml_validate_cb validate_cb, hip_xml_startelm_cb startelm_cb, hip_xml_endelm_cb endelm_cb, void *userdata) { struct hip_xml_handler *hand = ne_calloc(sizeof(struct hip_xml_handler)); hand->elements = elements; hand->validate_cb = validate_cb; hand->startelm_cb = startelm_cb; hand->endelm_cb = endelm_cb; hand->userdata = userdata; push_handler(p, hand); } void hip_xml_push_mixed_handler(hip_xml_parser *p, const struct hip_xml_elm *elements, hip_xml_validate_cb validate_cb, hip_xml_startelm_cb startelm_cb, hip_xml_cdata_cb cdata_cb, hip_xml_endelm_cb endelm_cb, void *userdata) { struct hip_xml_handler *hand = ne_calloc(sizeof *hand); hand->elements = elements; hand->validate_cb = validate_cb; hand->startelm_cb = startelm_cb; hand->cdata_cb = cdata_cb; hand->endelm_cb = endelm_cb; hand->userdata = userdata; push_handler(p, hand); } void hip_xml_parse_v(void *userdata, const char *block, size_t len) { hip_xml_parser *p = userdata; /* FIXME: The two XML parsers break all our nice abstraction by * choosing different char *'s. The swine. This cast will come * back and bite us someday, no doubt. */ hip_xml_parse(p, block, len); } /* Parse the given block of input of length len */ void hip_xml_parse(hip_xml_parser *p, const char *block, size_t len) { int ret, flag; /* duck out if it's broken */ if (!p->valid) { DEBUG(DEBUG_XML, "Not parsing %d bytes.\n", len); return; } if (len == 0) { flag = -1; block = ""; DEBUG(DEBUG_XML, "Got 0-length buffer, end of document.\n"); } else { DEBUG(DEBUG_XML, "Parsing %d length buffer.\n", len); flag = 0; } /* Note, don't write a parser error if !p->valid, since an error * will already have been written in that case. */ #ifdef HAVE_EXPAT ret = XML_Parse(p->parser, block, len, flag); DEBUG(DEBUG_XMLPARSE, "XML_Parse returned %d\n", ret); if (ret == 0 && p->valid) { snprintf(p->error, HIP_ERR_SIZE, "XML parse error at line %d: %s", XML_GetCurrentLineNumber(p->parser), XML_ErrorString(XML_GetErrorCode(p->parser))); p->valid = 0; } #else ret = xmlParseChunk(p->parser, block, len, flag); DEBUG(DEBUG_XMLPARSE, "xmlParseChunk returned %d\n", ret); if (p->parser->errNo && p->valid) { /* FIXME: error handling */ snprintf(p->error, HIP_ERR_SIZE, "XML parse error at line %d.", hip_xml_currentline(p)); p->valid = 0; } #endif } int hip_xml_valid(hip_xml_parser *p) { return p->valid; } void hip_xml_destroy(hip_xml_parser *p) { struct hip_xml_state *s, *parent; struct hip_xml_handler *hand, *next; sbuffer_destroy(p->buffer); /* Clean up any states which may remain. * If p.valid, then this should be only the root element. */ for (s = p->current; s!=NULL; s=parent) { parent = s->parent; destroy_state(s); } /* Free up the handlers on the stack: the base of the stack * is the handler in the root element, so start there. */ for (hand = p->root->handler; hand!=NULL; hand=next) { next = hand->next; free(hand); } #ifdef HAVE_EXPAT XML_ParserFree(p->parser); #else xmlFreeParserCtxt(p->parser); #endif free(p); } void hip_xml_set_error(hip_xml_parser *p, const char *msg) { snprintf(p->error, HIP_ERR_SIZE, msg); } const char *hip_xml_get_error(hip_xml_parser *p) { return p->error; } avfs-1.0.5/libneon/http_request.h0000644000175000017500000003372713102441254016600 0ustar michaelmichael/* HTTP Request Handling Copyright (C) 1999-2001, Joe Orton 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 */ #ifndef HTTP_REQUEST_H #define HTTP_REQUEST_H #include /* For FILE * */ #include "http_utils.h" /* For http_status */ #include "string_utils.h" /* For sbuffer */ #include "nsocket.h" /* for nssl_context */ BEGIN_NEON_DECLS #define HTTP_OK (0) #define HTTP_ERROR (1) /* Generic error; use http_get_error(session) for message */ #define HTTP_LOOKUP (3) /* Name lookup failed */ #define HTTP_AUTH (4) /* User authentication failed on server */ #define HTTP_AUTHPROXY (5) /* User authentication failed on proxy */ #define HTTP_SERVERAUTH (6) /* Server authentication failed */ #define HTTP_PROXYAUTH (7) /* Proxy authentication failed */ #define HTTP_CONNECT (8) /* Could not connect to server */ #define HTTP_TIMEOUT (9) /* Connection timed out */ #define HTTP_FAILED (10) /* The precondition failed */ /* Internal use only */ #define HTTP_RETRY (101) #define EOL "\r\n" /****** Session Handling ******/ typedef struct http_session_s http_session; typedef struct http_req_s http_req; /* * Session handling: * Call order: * 0. sock_init MANDATORY * 1. http_session_create MANDATORY * 2. http_session_proxy OPTIONAL * 3. http_session_server MANDATORY * 4. http_set_* OPTIONAL * ... --- Any HTTP request method --- * n. http_session_destroy MANDATORY */ /* Create a new HTTP session */ http_session *http_session_create(void); /* Finish an HTTP session */ int http_session_destroy(http_session *sess); /* Set the server or proxy server to be used for the session. * Returns: * HTTP_LOOKUP if the DNS lookup for hostname failed. * HTTP_OK otherwise. * * Note that if a proxy is being used, http_session_proxy should be * called BEFORE http_session_server, so the DNS lookup can be skipped * on the server. */ int http_session_server(http_session *sess, const char *hostname, int port); int http_session_proxy(http_session *sess, const char *hostname, int port); /* Callback to determine whether the proxy server should be used or * not for a request to the given hostname using the given scheme. * Scheme will be "http" or "https" etc. * Must return: * Zero to indicate the proxy should NOT be used * Non-zero to indicate the proxy SHOULD be used. */ typedef int (*http_use_proxy)(void *userdata, const char *scheme, const char *hostname); /* Register the callback for determining whether the proxy server * should be used or not here. 'userdata' will be passed as the first * argument to the callback. The callback is only called if a proxy * server has been set up using http_session_proxy. * * This function MUST be called before calling http_session_server. */ void http_session_decide_proxy(http_session *sess, http_use_proxy use_proxy, void *userdata); /* Set protocol options for session: * expect100: Defaults to OFF * persist: Defaults to ON * * expect100: When set, send the "Expect: 100-continue" request header * with requests with bodies. * * persist: When set, use a persistent connection. (Generally, * you don't want to turn this off.) * */ void http_set_expect100(http_session *sess, int use_expect100); void http_set_persist(http_session *sess, int persist); /* Using SSL/TLS connections: * * Session settings: * secure: Defaults to OFF * secure_context: No callbacks, any protocol allowed. * request_secure_upgrade: Defaults to OFF * accept_secure_ugprade: Defaults to OFF * * secure_context: When set, specifies the settings to use for secure * connections, and any callbacks (see nsocket.h). The lifetime of * the context object must be >= to the lifetime of the session * object. * * secure: When set, use a secure (SSL/TLS) connection to the origin * server. This will tunnel (using CONNECT) through the proxy server * if one is being used. * * request_secure_upgrade: When set, notify the server with each * request made that an upgrade to a secure connection is desired, if * available. * * accept_secure_upgrade: When set, allow a server-requested upgrade * to a secure connection. * * NB: the latter three function calls will return -1 if SSL is not * supported by the library (i.e., it was not built against OpenSSL), * or 0 if it is. * */ void http_set_secure_context(http_session *sess, nssl_context *ctx); int http_set_secure(http_session *sess, int secure); int http_set_request_secure_upgrade(http_session *sess, int req_upgrade); int http_set_accept_secure_upgrade(http_session *sess, int acc_upgrade); /* Sets the user-agent string. neon/VERSION will be appended, to make * the full header "User-Agent: product neon/VERSION". * If this function is not called, the User-Agent header is not sent. * The product string must follow the RFC2616 format, i.e. * product = token ["/" product-version] * product-version = token * where token is any alpha-numeric-y string [a-zA-Z0-9]* */ void http_set_useragent(http_session *sess, const char *product); /* Determine if next-hop server claims HTTP/1.1 compliance. Returns: * 0 if next-hop server does NOT claim HTTP/1.1 compliance * non-zero if next-hop server DOES claim HTTP/1.1 compliance * Not that the "next-hop" server is the proxy server if one is being * used, otherwise, the origin server. */ int http_version_pre_http11(http_session *sess); /* Returns the 'hostport' URI segment for the end-server, e.g. * "my.server.com:8080" or "www.server.com" * (port segment is ommitted if == 80) */ const char *http_get_server_hostport(http_session *sess); /* Returns the URL scheme being used for the current session. * Does NOT include a trailing ':'. * Example returns: "http" or "https". */ const char *http_get_scheme(http_session *sess); #if 0 /* TODO: implement */ typedef int (*http_request_redirect)(void *userdata, int code, const char *reason, const char *from_uri, const char *to_uri); void http_set_redirect_handler(http_session *sess, http_request_redirect hdlr, void *userdata); #endif /* The callback used to request the username and password in the given * realm. The username and password must be placed in malloc()-allocated * memory. * Must return: * 0 on success: *username and *password must be non-NULL, and will * be free'd by the HTTP layer when necessary * -1 to cancel (*username and *password are ignored.) */ typedef int (*http_request_auth)( void *userdata, const char *realm, const char *hostname, char **username, char **password); /* Set callbacks to handle server and proxy authentication. * userdata is passed as the first argument to the callback. */ void http_set_server_auth(http_session *sess, http_request_auth callback, void *userdata); void http_set_proxy_auth(http_session *sess, http_request_auth callback, void *userdata); /* Set the error string for the session */ void http_set_error(http_session *sess, const char *errstring); /* Retrieve the error string for the session */ const char *http_get_error(http_session *sess); /**** Request hooks handling *****/ typedef struct { /* A slight hack? Allows access to the hook private information, * externally... */ const char *id; /* id could be a URI to be globally unique */ /* e.g. "http://webdav.org/neon/hooks/davlock" */ /* Register a new request: return value passed to subsequent * handlers as '_private'. Session cookie passed as 'session'. */ void *(*create)(void *cookie, http_req *req, const char *method, const char *uri); /* Tell them what request body we are using: either buffer or stream * will be non-NULL. */ void (*use_body)(void *_private, const char *buffer, FILE *stream); /* Just before sending the request: let them add headers if they want */ void (*pre_send)(void *_private, sbuffer request); /* After sending the request. May return: * HTTP_OK everything is okay * HTTP_RETRY try sending the request again */ int (*post_send)(void *_private, const http_status *status); /* Clean up after yourself. */ void (*destroy)(void *_private); } http_request_hooks; /* Add in hooks */ void http_add_hooks(http_session *sess, const http_request_hooks *hooks, void *cookie); /* Return private data for a new request */ void *http_get_hook_private(http_req *req, const char *id); /***** Request Handling *****/ /* Create a new request, with given method and URI. * Returns request pointer. */ http_req * http_request_create(http_session *sess, const char *method, const char *uri); /* 'buffer' will be sent as the request body with given request. */ void http_set_request_body_buffer(http_req *req, const char *buffer); /* Contents of stream will be sent as the request body with the given * request */ void http_set_request_body_stream(http_req *req, FILE *stream); /* Handling response bodies... you provide TWO callbacks: * * 1) 'acceptance' callback: determines whether you want to handle the * response body given the response-status information, e.g., if you * only want 2xx responses, say so here. * * 2) 'reader' callback: passed blocks of the response-body as they * arrive, if the acceptance callback returned non-zero. */ /* 'acceptance' callback type. Return non-zero to accept the response, * else zero to ignore it. */ typedef int (*http_accept_response)( void *userdata, http_req *req, http_status *st); /* An 'acceptance' callback which only accepts 2xx-class responses. * Ignores userdata. */ int http_accept_2xx(void *userdata, http_req *req, http_status *st); /* The 'reader' callback type */ typedef void (*http_block_reader)( void *userdata, const char *buf, size_t len); /* Add a response reader for the given request, with the given * acceptance function. userdata is passed as the first argument to * the acceptance + reader callbacks. */ void http_add_response_body_reader(http_req *req, http_accept_response accpt, http_block_reader rdr, void *userdata); /* Handle response headers. Each handler is associated with a specific * header field (indicated by name). The handler is then passed the * value of this header field. */ /* The header handler callback type */ typedef void (*http_header_handler)(void *userdata, const char *value); /* Adds a response header handler for the given request. userdata is passed * as the first argument to the header handler, and the 'value' is the * header field value (i.e. doesn't include the "Header-Name: " part"). */ void http_add_response_header_handler(http_req *req, const char *name, http_header_handler hdl, void *userdata); /* Add handler which is passed ALL header values regardless of name */ void http_add_response_header_catcher(http_req *req, http_header_handler hdl, void *userdata); /* Stock header handlers: * 'duplicate': *(char **)userdata = strdup(value) * 'numeric': *(int *)userdata = atoi(value) * e.g. * int mynum; * http_add_response_header_handler(myreq, "Content-Length", * http_handle_numeric_handler, &mynum); * ... arranges mynum to be set to the value of the Content-Length header. */ void http_duplicate_header(void *userdata, const char *value); void http_handle_numeric_header(void *userdata, const char *value); /* Adds a header to the request with given name and value. */ void http_add_request_header(http_req *req, const char *name, const char *value); /* Adds a header to the request with given name, using printf-like * format arguments for the value. */ void http_print_request_header(http_req *req, const char *name, const char *format, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 3, 4))) #endif /* __GNUC__ */ ; sbuffer http_get_request_headers(http_req *req); /* http_request_dispatch: Sends the given request, and reads the * response. Response-Status information can be retrieve with * http_get_status(req). * * Returns: * HTTP_OK if request sent + response read okay. * HTTP_AUTH if user authentication failed on origin server * HTTP_AUTHPROXY if user authentication failed on proxy server * HTTP_SERVERAUTH server authentication failed * HTTP_PROXYAUTH proxy authentication failed * HTTP_CONNECT could not connect to server/proxy server * HTTP_TIMEOUT connection timed out mid-request * HTTP_ERROR for other errors, and http_get_error() should * return a meaningful error string * * NB: HTTP_AUTH and HTTP_AUTHPROXY mean that the USER supplied the * wrong username/password. SERVER/PROXYAUTH mean that, after the * server has accepted a valid username/password, the server/proxy did * not authenticate the response message correctly. * */ int http_request_dispatch(http_req *req); /* Returns a pointer to the response status information for the * given request. */ const http_status *http_get_status(http_req *req) /* Declare this with attribute const, since we often call it >1 times * with the same argument, and it will return the same thing each * time. This lets the compiler optimize away any subsequent calls * (theoretically). */ #ifdef __GNUC__ __attribute__ ((const)) #endif /* __GNUC__ */ ; /* Destroy memory associated with request pointer */ void http_request_destroy(http_req *req); END_NEON_DECLS #endif /* HTTP_REQUEST_H */ avfs-1.0.5/libneon/http_cookies.h0000644000175000017500000000243013102441254016527 0ustar michaelmichael/* HTTP Request Handling Copyright (C) 1999-2001, Joe Orton 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 */ #ifndef COOKIES_H #define COOKIES_H #include "neonconf.h" struct http_cookie_s; typedef struct http_cookie_s http_cookie; struct http_cookie_s { char *name, *value; unsigned int secure:1; unsigned int discard:1; char *domain, *path; time_t expiry; /* time at which the cookie expires */ http_cookie *next; }; typedef struct { http_cookie *cookies; } http_cookie_cache; extern http_request_hooks http_cookie_hooks; #endif /* COOKIES_H */ avfs-1.0.5/libneon/http_redirect.h0000644000175000017500000000425013102441254016676 0ustar michaelmichael/* HTTP-redirect support Copyright (C) 1999-2001, Joe Orton 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 */ #ifndef HTTP_REDIRECT_H #define HTTP_REDIRECT_H #include "http_request.h" BEGIN_NEON_DECLS /* Get confirmation from the user that a redirect from * URI 'src' to URI 'dest' is acceptable. Should return: * Non-Zero to FOLLOW the redirect * Zero to NOT follow the redirect */ typedef int (*http_redirect_confirm)(void *userdata, const char *src, const char *dest); /* Notify the user that a redirect has been automatically * followed from URI 'src' to URI 'dest' */ typedef void (*http_redirect_notify)(void *userdata, const char *src, const char *dest); /* Register redirect handling for the given session. * Some redirect responses will be automatically followed. * If the redirect is automatically followed, the 'notify' callback * is called. * For redirects which are NOT automatically followed, the * 'confirm' callback is called: if this returns zero, the redirect * is ignored. * * 'confirm' may be passed as NULL: in this case, only automatic * redirects are followed. 'notify' may also be passed as NULL, * automatic redirects are still followed. * * 'userdata' is passed as the first argument to the confirm and * notify callbacks. */ void http_redirect_register(http_session *sess, http_redirect_confirm confirm, http_redirect_notify notify, void *userdata); END_NEON_DECLS #endif /* HTTP_REDIRECT_H */ avfs-1.0.5/libneon/dav_basic.h0000644000175000017500000000447713102441254015764 0ustar michaelmichael/* Basic WebDAV support Copyright (C) 1999-2001, Joe Orton 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 */ #ifndef DAV_BASIC_H #define DAV_BASIC_H #include "http_request.h" #include "dav_207.h" BEGIN_NEON_DECLS #define DAV_DEPTH_ZERO (0) #define DAV_DEPTH_ONE (1) #define DAV_DEPTH_INFINITE (2) /* Adds a Depth: header to a request */ void dav_add_depth_header(http_req *req, int depth); /* Handle a simple WebDAV request. * * Usage: * 1. Create the request using http_request_create() * 2. Set any headers, the request body, whatever. * 3. Call dav_simple_request to dispatch and destroy the request. * * (note the request IS destroyed by this function, don't do it * yourself). * * Returns HTTP_* as http_request_dispatch() would. If the response is * a 207, a user-friendly error message is written to the session * error buffer; e.g. DELETE /foo/ might give the error: * /foo/bar: HTTP/1.1 423 Locked */ int dav_simple_request(http_session *sess, http_req *req); /* Basic WebDAV methods: * dav_copy: copy resoure from src to dest * dav_move: move resource from src to dest * -> if overwrite is non-zero, the destination resource * will be overwritten if it exists. * dav_delete: delete resource at uri * dav_mkcol: create a collection at uri (uri MUST have a trailing slash). */ int dav_copy(http_session *sess, int overwrite, const char *src, const char *dest); int dav_move(http_session *sess, int overwrite, const char *src, const char *dest); int dav_delete(http_session *sess, const char *uri); int dav_mkcol(http_session *sess, const char *uri); END_NEON_DECLS #endif avfs-1.0.5/libneon/README0000644000175000017500000000070613102441254014547 0ustar michaelmichael This is the source directory of the 'neon' HTTP/WebDAV client library, which can be bundled inside other packages. For the complete neon package, see: http://www.webdav.org/neon/ This source directory may be distributed and/or modified under the terms of the GNU Library General Public License, as given in COPYING.LIB. Please send questions, bug reports, feature requests, etc, regarding the neon library, to the mailing list at: neon@webdav.org avfs-1.0.5/libneon/ChangeLog0000644000175000017500000014675113102441254015454 0ustar michaelmichaelMon Feb 26 22:38:41 2001 Joe Orton Patch from Kai Sommerfeld to remove URI escaping from inside neon. * dav_207.c (end_element): Don't unescape href elements. * http_request.c (http_request_create): Don't escape Request-URI. * dav_basic.c (copy_or_move): Don't escape destination URI. Mon Feb 26 21:44:56 2001 Joe Orton * dav_props.c (set_body): UTF-8 encode the property name and value. (make_elms): Request UTF-8 decoding of property values. Mon Feb 26 21:40:14 2001 Joe Orton * hip_xml.c: Do perform UTF-8 decoding when using libxml. (char_data): Fix UTF-8 decoding bug where the byte after a multi-byte encoded sequence would be skipped. Sun Feb 25 20:04:05 2001 Joe Orton * string_utils.c (ne_utf8_encode): New function. Sun Feb 25 19:52:01 2001 Joe Orton * ne_alloc.c (ne_realloc): New function. Sun Feb 25 17:00:32 2001 Joe Orton * Makefile.in (all): Rename NEON_IS_BUNDLED to NEON_BUILD_BUNDLED. Sun Feb 25 16:52:43 2001 Joe Orton * Makefile.in (all): Build according to NEON_IS_BUNDLED. Fri Feb 23 23:38:10 2001 Joe Orton * Makefile.in: Fix deps: neon_config.h has gone. Fri Feb 23 22:57:47 2001 Joe Orton * dav_props.c (dav_simple_propfind): Support a NULL 'props' argument to do an allprop request, as per the advertising literature. Register a catch-all handler in this case. Fri Feb 23 22:16:42 2001 Joe Orton * http_request.c (http_session_destroy): Free up hooks list. Thu Feb 22 21:54:36 2001 Joe Orton * http_request.h (http_add_hooks): Make request_hooks 'const'. Thu Feb 15 08:36:56 2001 Joe Orton * http_request.c (read_response_body): Accept SOCK_CLOSED as end-of-response if we don't have a Content-Length (and not chunked). (Kai Sommerfeld). Thu Feb 15 08:36:23 2001 Joe Orton * http_request.c (add_fixed_headers): Don't add the Host header here. (http_request_dispatch): Add it here instead. * http_request.c (set_hostinfo): Dup the hostname. (http_session_destroy): Free the hostname. (Kai Sommerfeld). Thu Feb 15 08:35:49 2001 Joe Orton * http_private.h: Make hostname in struct host_info char *. (Kai Sommerfeld). Thu Feb 15 08:08:50 2001 Joe Orton * http_redirect.h: Add C++ header-inclusion safety macros (Kai Sommerfeld ). Wed Feb 14 23:37:57 2001 Joe Orton * http_request.c (read_response_body): Use a size_t for readlen, as read_response_block requires. Wed Feb 14 23:25:44 2001 Joe Orton * http_auth.c (request_digest): Fix incorrect signed-ness of buffer. Wed Feb 14 23:22:13 2001 Joe Orton * uri.h, string_utils.h: Comment-out tokens after #endif. Sun Feb 4 14:36:11 2001 Joe Orton * http_redirect.c (post_send): Prototype change. Sun Feb 4 14:31:42 2001 Joe Orton * socket.c: Added key_prompt, key_userdata, key_file to nssl_context. (sock_set_key_prompt, key_prompt_cb): New functions. (sock_make_secure): Set ctx->key_file to private key filename. Sun Feb 4 13:31:44 2001 Joe Orton * http_request.h: Make http_status argument of post_send a const pointer. Sun Feb 4 10:38:12 2001 Joe Orton * http_request.c (set_sockerr): Only use the socket error if it is NULL, else print generic "something went wrong"-type error message. Sun Feb 4 10:29:37 2001 Joe Orton * socket.c (sock_set_client_cert): Call SSL_CTX_check_private_key to ensure that the cert and private key match. Sun Feb 4 10:28:02 2001 Joe Orton * socket.c (sock_make_secure): In error cases after SSL_connect succeeds, call SSL_shutdown and assign sock->ssl = NULL before returning. Sat Feb 3 18:33:56 2001 Joe Orton * socket.c (sock_close): Call SSL_shutdown before close()'ing the fd. Sat Feb 3 18:30:48 2001 Joe Orton * socket.c: Store an default SSL_CTX in nsocket, to be used when no nssl_context is supplied. (create_socket): Create default SSL_CTX (sock_close): Free it here. (sock_make_secure): Use it here. Sat Feb 3 15:52:15 2001 Joe Orton * socket.c (sock_set_client_cert): New function. Sat Feb 3 15:48:51 2001 Joe Orton * socket.c: Rejig of nssl_context handling. An nssl_context is now really a wrapper for an SSL_CTX. (sock_create_ssl_context): Create the SSL_CTX here. (sock_disable_tlsv1, sock_disable_sslv2, sock_disable_sslv3): Set the SSL_CTX option directly. (sock_make_secure): Create an SSL_CTX if no nssl_context is supplied, otherwise use SSL_CTX from nssl_context. Sun Jan 28 13:52:03 2001 Joe Orton * http_utils.c (neon_version_minimum): New function. Sun Jan 28 10:37:28 2001 Joe Orton * neon_config.h.in: Removed file. * http_request.c, http_utils.c: Don't include neon_config.h. Sat Jan 27 22:52:37 2001 Joe Orton * socket.c: Use closesocket() as NEON_CLOSE (Markus Fleck ). Sat Jan 27 22:35:16 2001 Joe Orton * hip_xml.c: Add 'char_data' as libxml cdataBlock handler. Tue Jan 23 23:17:00 2001 Joe Orton * neon_config.h.in: Renamed from neon_config.h. Define NEON_VERSION_MAJOR and NEON_VERSION_MINOR too: all picked up from the NEON_VERSIONS macro. Sun Jan 21 22:07:34 2001 Joe Orton * string_utils.c (ne_concat): New function. Thu Jan 18 22:25:34 2001 Joe Orton * ne_alloc.h: Added ne_oom_callback. * ne_alloc.c: Added DO_MALLOC macro to do the malloc and oom callback test. (ne_malloc): Use DO_MALLOC. (ne_strdup, ne_calloc, ne_strndup): Reimplement using DO_MALLOC rather than calling ne_malloc(). Tue Jan 16 20:16:35 2001 Joe Orton * neon_config.h: Bumped version to 0.10.1. Tue Jan 16 20:14:40 2001 Joe Orton * http_request.c (http_session_create): Default expect-100 support to OFF. Mon Jan 15 22:59:33 2001 Joe Orton * neon_config.h: Bumped version to 0.10.0. Mon Jan 15 22:58:04 2001 Joe Orton * dav_basic.c (dav_simple_request): Use dav_207_ignore_unknown. Sun Jan 14 22:52:31 2001 Joe Orton * dav_props.c (propfind): Call dav_207_ignore_unknown. Sun Jan 14 22:49:06 2001 Joe Orton * dav_207.c: Don't handle unknown elements in normal handler. (ignore_cc, dav_207_ignore_unknown): New functions, for ignoring any unknown elements in the parse. Sun Jan 14 21:53:00 2001 Joe Orton * hip_xml.c: Renamed 'handlers' back to top_handlers. (push_handler): Now, p->root->handlers points to BASE of stack, p->top_handlers points to TOP of stack. (hip_xml_destroy): Changed to start from new BASE of stack. Sun Jan 14 10:50:09 2001 Joe Orton * http_request.c (http_session_server): Do perform the DNS lookup if we have a proxy_decider function, since that means we MIGHT need to know the IP address of the origin server. (http_request_create): Pass the real scheme back to the proxy decider callback. Wed Jan 10 22:43:16 2001 Joe Orton * Makefile.in: Rename OBJ_EXT to NEON_OBJEXT. Remove NEON_INTERFACE_VERSION, use NEON_LINK_FLAGS instead. Wed Jan 10 22:02:02 2001 Joe Orton * dav_locks.c (create_private): New function. (dav_lock_discover): Switch to using new dav_propfind_set_complex API. Wed Jan 10 21:59:36 2001 Joe Orton * dav_props.h (dav_propfind_set_complex): Switch the 'sizeof_private' argument for a callback 'creator': the return value of this callback is used as the 'private' field for the current resource. Mon Jan 8 22:09:55 2001 Joe Orton * dav_locks.h (dav_lock_result): Re-order arguments. Make lock object const. * dav_locks.c (dav_lock_copy): New function. (discover_results): Set lock->uri given href for current results. Free lock object after passing to results. Sun Jan 7 21:55:14 2001 Joe Orton * dav_locks.c (dav_lock): Destroy XML parser after use. Remove handling of Lock-Token header: it wasn't used and it leaked. Sun Jan 7 19:58:29 2001 Joe Orton * dav_props.c (free_propset): Free the property values, and the result set URI too. Sun Jan 7 16:58:19 2001 Joe Orton * http_request.c (read_response_block): Fix handling of SOCK_CLOSED from sock_read as end-of-connection. Sat Jan 6 15:02:57 2001 Joe Orton * hip_xml.c (struct hip_xml_parser): Renamed 'top_handlers' to 'handlers' in hip_xml_parser. (push_handler): New function. (hip_xml_push_handler, hip_xml_push_mixed_handler): Use push_handler. * hip_xml.c (find_handler): Begin the search for a new handler from the handler of the current (parent) element, and work up the stack. Sat Jan 6 11:15:17 2001 Joe Orton * hip_xml.c (find_handler): Display error message for unknown XML element as 'elmname (in nspace)' rather than 'nspace:elmname' since the latter produces confusing errors like 'DAV::displayname'. Wed Jan 3 21:34:44 2001 Joe Orton * Makefile.in: Hard-code top_builddir as '..' (possibly wrong, but true for all neon apps so far). Remove INCLUDES, now unused. Add top_srcdir. Fri Dec 22 22:51:27 2000 Joe Orton * dav_props.c: Added 'has_props' field to propfind_handler struct. (set_body): Only add leading 'prop' element if has_props is not set. Set has_props. Don't add trailing element here. (dav_propfind_named): ... add it here instead. (dav_propfind_set_complex, dav_propfind_set_flat): New set_body interface. Fri Dec 22 21:10:39 2000 Joe Orton * socket.c (sock_transfer): Don't use NEON_READ here, this is for reading from a non-socket fd. Wed Dec 20 00:19:34 2000 Joe Orton * neon_config.h: Bumped version to 0.9.1. Wed Dec 20 00:19:09 2000 Joe Orton * dav_props.c (free_propset): Don't free the private structure, make this the caller's responsibility. Wed Dec 20 00:12:36 2000 Joe Orton * dav_props.c (end_propstat): Rename propstat argument to 'pstat_v' to kill warnings. Tue Dec 19 23:42:39 2000 Joe Orton * dav_props.c (start_response): Zero-out the private structure on creation. Tue Dec 19 22:54:06 2000 Joe Orton * http_request.c (read_response_block): Rename local variable 'socket' to 'sock'. Tue Dec 19 22:52:56 2000 Joe Orton * http_request.h: Rename argument from 'stat' in post_send definition. Tue Dec 19 22:52:32 2000 Joe Orton * http_utils.h: Add 'const' to char * argument. Tue Dec 19 22:19:28 2000 Joe Orton * neon_config.h: Bumped version to 0.9.0. Tue Dec 19 22:12:19 2000 Joe Orton * Makefile.in: New file. Tue Dec 19 22:07:50 2000 Joe Orton * Makefile.incl: Removed file. Tue Dec 19 22:06:06 2000 Joe Orton * dav_locks.c (dav_lock_discover): New callback-based lock discovery interface. Re-implemented using new propfind interface. Tue Dec 19 21:22:43 2000 Joe Orton * dav_props.h: Replace old dav_propfind_* interface with better one. (dav_simple_propfind): Renamed from dav_get_props. (dav_propfind_current_private, dav_propfind_set_complex, dav_propfind_set_flat): New functions. (dav_propfind_get_current_resource): Removed function. (dav_propfind_named, dav_propfind_allprop): Change second argument to be the results callback. * dav_props.c: Replace implementatino of old interface with new one. (dav_simple_propfind): Re-implemented on top of new all-singing all-dancing dav_propfind_* interface. Sun Dec 17 18:24:50 2000 Joe Orton * dav_props.c: Add dav_get_props, and all its auxiliaries. Sun Dec 17 15:43:55 2000 Joe Orton * dav_props.c (propfind): Destroy the request after calling http_get_status. Sun Dec 17 18:04:58 2000 Joe Orton * hip_xml.c (find_handler): Allow using NULL as name and nspace in HIP_ELM_unknown elements. Sun Dec 17 18:03:03 2000 Joe Orton * dav_207.c (check_context): Don't handle the unknown element when it is a child of the prop element, this prevents handling allprop responses. Thu Dec 14 21:48:06 2000 Joe Orton * neon_config.h: Bumped version to 0.8.0. Thu Dec 14 21:43:31 2000 Joe Orton * dav_basic.c, dav_locks.c, dav_props.c (everywhere): Changed to new response-status interface, and _class->klass change. Thu Dec 14 21:37:38 2000 Joe Orton * http_request.c (http_get_status): Add new response-status interface. Thu Dec 14 21:30:25 2000 Joe Orton * http_basic.c (everywhere): Use new status interface. Thu Dec 14 21:25:03 2000 Joe Orton * http_private.h: Made http_status pointer in http_req a declared object. * http_request.h: Removed passing status pointer to http_request_dispatch. * http_request.c (everywhere): Removed passing extra http_status * to auxiliaries, use req->status instead. Renamed '_class' to 'klass' everywhere. Thu Dec 14 21:15:54 2000 Joe Orton * http_utils.h: Renamed '_class' member of http_status to 'klass'. (http_parse_statusline): Change accordingly. Wed Dec 13 23:00:23 2000 Joe Orton * socket.c: Changes for pre-BONE BeOS (David Reid ). Wed Dec 13 21:29:36 2000 Joe Orton * uri.c (ESCAPE): Explicitly cast the character to const unsigned int. (uri_abspath_escape): Make 'pnt' a normal const char *. Wed Dec 13 21:17:31 2000 Joe Orton * http_request.c: Remove netinet/in.h include, add limits.h include. (Peter Boos) (read_response_block): Make readlen a size_t (David Reid). Wed Dec 13 21:08:08 2000 Joe Orton * ne_alloc.h [WIN32]: Include stdlib.h. (Peter Boos) Wed Dec 13 20:54:27 2000 Joe Orton Patches from Peter Boos and David Reid for Win32 and BeOS changes respectively: * socket.c: Add NEON_READ, NEON_WRITE, NEON_CLOSE macros to use send/recv/closesocket for BeOS, send/recv/close for Win32, write/read/close otherwise. Include WinSock2.h in Windows. Add arpa/inet.h check. (sock_read, sock_write): Use the NEON_ macros. (sock_connect, sock_close): Use NEON_CLOSE. (sock_init): Winsock initialization. (sock_exit) Winsock cleanup. (sock_fullwrite): Use size_t rather than ssize_t for 'sent'. (sock_connect, sock_connect_u): Make 'port' parameter an unsigned short int. Wed Dec 13 20:42:18 2000 Joe Orton * http_basic.c (clength_hdr_handler): Use an off_t for len, to avoid comparison with size_t. Wed Dec 13 20:38:59 2000 Joe Orton * hip_xml.c (char_data): Use an 'int' for wslen, avoid comparison between size_t (which is signed) and int (which [is|might be?] unsigned). Wed Dec 13 20:29:12 2000 Joe Orton * nsocket.h [WIN32]: Use Windows headers rather than Unixy ones. (sock_exit): New function. Wed Dec 13 20:21:22 2000 Joe Orton * string_utils.c, string_utils.h, uri.h: Includes change (Peter Boos). Wed Dec 13 20:20:09 2000 Joe Orton * http_auth.c (http_auth_response_body): Don't make inline. Includes change. (both by Peter Boos). Wed Dec 13 20:18:38 2000 Joe Orton * uri.c (uri_unescape): Cast strtol return to (char). Includes change as below (both by Peter Boos). Wed Dec 13 20:07:38 2000 Joe Orton * base64.c, dates.c, dates.h, dav_207.c, dav_207.h, dav_basic.h, dav_locks.h, hip_xml.h, http_auth.h, http_basic.h, http_cookies.c, http_redirect.c, http_redirect.h, http_request.h, http_utils.c, md5.c, ne_alloc.c: Use #include "..." rather than #include <...> for neon headers. (Peter Boos ). Thu Dec 7 21:45:02 2000 Joe Orton * socket.c (sock_read): Return zero immediately if a zero count parameter is passed, following SUSv2 semantics. Thu Dec 7 21:41:36 2000 Joe Orton * nsocket.h (sock_readfile_blocked): Define an interface, allow taking -1 as the length parameter. Only return SOCK_CLOSED if length == -1 is NOT passed. Sun Nov 26 09:46:53 2000 Joe Orton * nsocket.h: Fix use of 'socket' in function prototypes. Sun Nov 19 00:29:48 2000 Joe Orton * nsocket.h: Increase read timeout to 120 seconds. Sun Nov 5 14:42:46 2000 Joe Orton * dav_locks.c: Fix element id's (fixes segfault when using locks). Thu Oct 26 22:28:17 2000 Joe Orton * socket.c (sock_peek): Return SOCK_CLOSED if recv() returns zero. Thu Oct 26 22:24:14 2000 Joe Orton * socket.c (sock_block): Return "got data" if SSL_pending indicates data pending. Otherwise select on socket as normal. Thu Oct 26 22:15:14 2000 Joe Orton * socket.c (sock_readline, sock_peek): Check whether SSL connection has been closed if SSL_peek returns 0 (thanks to Jeff Costlow ). Thu Oct 14 19:57:31 2000 Joe Orton * Makefile.incl: Fix spurius backslash at line 69 (thanks to Dirk Bergstrom ). Sat Oct 14 19:51:44 2000 Joe Orton * dav_basic.c (copy_or_move): Use http_get_scheme rather than hard-coding "http". 2000-10-02 Joe Orton * http_request.c (http_get_scheme): New function. Tue Oct 10 19:56:42 2000 Joe Orton * neon_config.h: Bumped version to 0.7.5. Sat Oct 7 19:26:58 2000 Joe Orton * neon_config.h: Bumped version to 0.7.4. Sat Oct 7 19:19:37 2000 Joe Orton * http_auth.c (request_digest): Quote algorithm and qop parameters in digest header. Sat Oct 7 19:15:29 2000 Joe Orton * socket.c (sock_connect_u): Don't leak the fd if connect fails (David Sloat). Sat Sep 16 16:49:57 2000 Joe Orton * hip_xml.h: Add 'HIP_ELM_UNUSED', defining lowest element ID which should be used. * hip_xml.c, hip_xml.h (hip_xml_push_handler, hip_xml_push_mixed_handler): Renamed from hip_xml_add_handler / hip_xml_add_mixed_handler to reflect stack-like usage of handlers. 'handlers' field of hip_xml_parser renamed to top_handler for same reason (globally search'n'replaced). * hip_xml.h: Documentation update. Thu Sep 14 22:37:33 2000 Joe Orton * http_auth.c (request_digest): Quote qop= value, fixes IIS5 interop. Thu Sep 14 00:40:04 2000 Joe Orton * socket.c (sock_connect_u): If connect() fails, close the socket before returning: thanks to David Sloat . Tue Sep 12 20:08:40 2000 Joe Orton * http_request.c (read_response_headers): Remove redundant tolower(). Tue Sep 12 00:41:39 2000 Joe Orton * neon_config.h: Bumped version to 0.7.3. Mon Sep 11 15:31:13 2000 Joe Orton * http_request.c, http_auth.c: Include snprintf.h if HAVE_SNPRINTF_H is defined. Fri Sep 8 10:46:53 2000 Joe Orton * neon_config.h: Bumped version to 0.7.2. Fri Sep 8 10:44:42 2000 Joe Orton * socket.c (sock_block): Return immediately if this is an SSL socket. Thu Sep 7 00:31:12 2000 Joe Orton * hip_xml.h: Correct order of hip_xml_validate_cb arguments in prototype (thanks to Greg Stein). Thu Sep 7 00:27:29 2000 Joe Orton * dav_props.c (propfind): Don't destroy the handler after use. (dav_propfind_destroy): New function. Thu Sep 7 00:08:45 2000 Joe Orton * Makefile.incl: Added targets for ne_alloc.o, string_utils.o, uri.o, base64.o. Tue Aug 15 21:53:53 2000 Joe Orton * neon_config.h: Bumped version to 0.7.1. Tue Aug 15 21:16:34 2000 Joe Orton * http_request.c (http_request_create): Only add authentication response body callbacks if a supply-credentials callback has been set for the session. (http_request_dispatch): Similarly for response header callbacks. Mon Aug 14 09:28:38 2000 Joe Orton * neon_config.h: Bumped version to 0.7.0. Mon Aug 14 09:23:54 2000 Joe Orton * string_utils.h (SBUFFER_CAST): New macro. Mon Aug 14 09:13:05 2000 Joe Orton * http_private.h: Use a hash table for storing response header handlers. Added response header 'catchers', which are passed ALL response headers. * http_request.c (http_add_response_header_handler): Place the handler in the correct hash bucket. (hdr_hash): New function. (http_add_response_header_catcher): New function. (http_request_destroy): Destroy the header catchers, and iterate over the hash table to destroy the handlers. (read_response_headers): Optimisation: hash and search for ':' in a single loop. Remove another local variable. Iterate through catchers too. Sun Aug 13 15:57:35 2000 Joe Orton * neon_config.h: Bumped version to 0.6.1. Sun Aug 13 15:50:42 2000 Joe Orton * http_request.c (send_request): Only go through the loop at most twice. Sun Aug 13 15:49:52 2000 Joe Orton * http_redirect.c (destroy): Don't free the redirect structure. Sat Aug 12 17:10:32 2000 Joe Orton * neon_config.h: Bumped version to 0.6.0. Sat Aug 12 16:48:47 2000 Joe Orton * http_request.c (http_session_decide_proxy): New function. (http_request_create): Call proxy "decider callback" to determine whether to use the proxy server for a given request or not. Sat Aug 12 16:39:10 2000 Joe Orton * Makefile.incl: Updated for http_private.h and http_redirect.[ch]. Sat Aug 12 16:36:49 2000 Joe Orton * http_request.c: Removed data structure definitions. * http_private.h: New file, contains data structure definitions. Interface NOT exported. Sat Aug 12 16:31:32 2000 Joe Orton * http_redirect.c (destroy): No return value. Sat Aug 12 16:04:02 2000 Joe Orton * http_redirect.[ch]: First cut at HTTP redirect handling. Sat Aug 12 11:05:13 2000 Joe Orton * neon_config.h: Bumped version to 0.5.1. Sat Aug 12 02:04:15 2000 Joe Orton * dav_locks.c (dav_lock_using_resource, dav_lock_using_parent): Prevent segfault if locking is not in use. Fri Aug 11 17:19:06 2000 Joe Orton * neon_config.h: Bumped version to 0.5.0. Fri Aug 11 16:31:23 2000 Joe Orton * http_request.c (read_message_header): Take a buffer for storing continuation lines. (read_response_headers): No need to strip EOL since read_message_header does this already. Use one less variable. Fri Aug 4 22:12:04 2000 Joe Orton * http_request.c (send_request): Don't retry sending the request more than once. Wed Aug 2 11:08:31 2000 Joe Orton * ne_alloc.[ch]: Renamed from xalloc.[ch]. Wed Aug 2 02:15:32 2000 Joe Orton * socket.c (sock_transfer): Return SOCK_CLOSED, or set sock->error appropriately on read failure. Tue Aug 1 13:04:27 2000 Joe Orton * socket.c, nsocket.h (sock_progress, sock_call_progress, sock_transfer, sock_readfile_blocked): Use 'off_t' not 'size_t' as file size type. Fri Jul 28 13:32:37 2000 Joe Orton * neon_config.h: Bumped version to 0.4.2. Fri Jul 28 13:31:38 2000 Joe Orton * http_request.c (send_request): Fix sending request body after getting 100-continue response. Fri Jul 28 11:26:47 2000 Joe Orton * neon_config.h: Bumped version to 0.4.1. Fri Jul 28 10:32:34 2000 Joe Orton * neon_config.h: Bumped version to 0.4.0. Fri Jul 28 10:28:21 2000 Joe Orton * http_basic.[ch] (http_post): New function, from Sander Alberink . Thu Jul 27 18:55:49 2000 Joe Orton * http_utils.c (neon_debug): No conditional compilation for function body: compile it all regardless of whether debugging is enabled or not, to allow applications to be debugged regardless of whether debugging is compiled into the library or not. Thu Jul 27 16:59:26 2000 Joe Orton * http_basic.c (clength_hdr_handler): Cast off_t to long int for printing. Tue Jul 25 18:14:15 2000 Joe Orton * http_request.c (read_message_header): Iterate over header handler list before placing zero-terminator at ':': if a handler has a NULL name field, pass it the entire header value. Tue Jul 25 18:00:49 2000 Joe Orton * http_request.c (http_get_request_headers): New function. Mon Jul 24 16:55:29 2000 Joe Orton * neon_config.h: Bumped version to 0.3.9. Mon Jul 24 16:54:33 2000 Joe Orton * http_basic.h: Use 'off_t' in http_content_range. * http_basic.c (http_get_range): Cast range values to (long int) to prevent compiler warnings. Thu Jul 20 20:03:30 2000 Joe Orton * http_request.[ch], socket.c, http_basic.c: Include nsocket.h not socket.h. Thu Jul 20 20:02:20 2000 Joe Orton * http_utils.c (version_string): Indicate which XML parser is supported. Thu Jul 20 20:01:12 2000 Joe Orton * nsocket.h: Renamed from socket.h. Thu Jul 20 15:02:35 2000 Joe Orton * http_utils.c, socket.c, http_request.c: SSL_ENABLE renamaed to ENABLE_SSL. Thu Jul 20 12:20:13 2000 Joe Orton * md5.c, http_auth.h: Include neon_md5.h. Thu Jul 20 12:19:23 2000 Joe Orton * neon_md5.h: Renamed from md5.h. Wed Jul 19 22:33:46 2000 Joe Orton * dav_basic.c (dav_simple_request): Don't leak ctype.value. Wed Jul 19 22:32:03 2000 Joe Orton * dav_207.c (check_context): Accept unknown elements. Wed Jul 19 22:31:10 2000 Joe Orton * dav_locks.c (dav_lock_iterate): Allow passing func as NULL. Wed Jul 19 22:26:13 2000 Joe Orton * socket.h (SOCKET_READ_TIMEOUT): Increase to 60. Wed Jul 19 22:25:51 2000 Joe Orton * dav_locks.h: Include http_request.h. Mon Jul 17 11:41:16 2000 Joe Orton * dates.c (asctime_parse, rfc1036_parse): Actually pass the string to sscanf (thanks to lclint). (rfc1123_date): Check for gmtime() returning NULL. Mon Jul 17 09:16:43 2000 Joe Orton * neon_config.h: Bumped version to 0.3.1. Mon Jul 17 09:07:58 2000 Joe Orton * dav_locks.c: Include limits.h: thanks to Paul D'Anna. Sun Jul 16 18:47:15 2000 Joe Orton * neon_config.h: Bumped version to 0.3.0. Sun Jul 16 16:44:25 2000 Joe Orton * neon_i18n.c (neon_i18n_init) [ENABLE_NLS && NEON_IS_LIBRARY]: New compilation conditions. Sun Jul 16 16:41:12 2000 Joe Orton * neon_i18n.c: New file. Sun Jul 16 16:15:02 2000 Joe Orton * string_utils.c (sbuffer_*): Change to assert postcondition (buf->used == strlen(buf->data) + 1). (sbuffer_append): Fix brokenness. Sun Jul 16 16:11:05 2000 Joe Orton * socket.c (sock_transfer): Increase sum length written correctly. Sun Jul 16 16:10:23 2000 Joe Orton * http_request.c (http_get_hook_private): New function. Sun Jul 16 16:07:11 2000 Joe Orton * hip_xml.c (find_handler): Call validate_cb for any handler which recognizes the element. Allow return codes HIP_XML_{VALID,INVALID,DECLINE} from validate_cb. If DECLINE is returned, continue searching handlers until one returns (IN)VALID. (start_element): Don't call validate_cb. * hip_xml.c (start_element, end_element): In collect mode, don't print namespace prefix if present. Sun Jul 16 15:30:19 2000 Joe Orton * dav_locks.[ch]: New file, code mainly taken from cadaver and adapted for neon HTTP request/response handling. Sun Jul 16 15:28:25 2000 Joe Orton * dav_basic.c (copy_or_move, dav_move, dav_copy): Pass overwrite as parameter. Sun Jul 16 15:26:24 2000 Joe Orton * uri.c (uri_compare): Fixed to only return equal if *shorter* string has no trailing slash. Sat Jul 15 20:14:07 2000 Joe Orton * dav_207.c (dav_207_get_current_response, dav_207_get_current_propstat): New functions. * dav_props.c (dav_propfind_get_current_resource): Implement using dav_207_get_current_response. Sat Jul 15 17:36:37 2000 Joe Orton * xalloc.c (xcalloc): New function. Sat Jul 15 14:11:14 2000 Joe Orton * http_utils.[ch] and elsewhere: Replace 'class' field of http_status with '_class' to be C++-safe. (patch from Tom Bednarz). Thu Jul 6 18:48:52 2000 Joe Orton * dav_basic.c (copy_or_move): Escape the destination URI. Thu Jul 6 18:45:51 2000 Joe Orton * dav_props.c (end_response): Added description parameter. Thu Jul 6 18:43:14 2000 Joe Orton * dav_207.[ch] (end_element): Fix handling of responsedescription. Add "description" parameter to dav_207_end_response callback, and pass the contents of responsedescription. * dav_basic.c (handle_error, end_response, end_propstat): Pass description and add to error string when present. Tue Jul 4 11:43:03 2000 Joe Orton * dav_basic.c, dav_props.c, http_basic.c: Use http_{add,print}_request_header rather than http_get_request_header. Tue Jul 4 11:41:00 2000 Joe Orton * http_request.[ch] (http_add_request_header, http_print_request_header): New functions. (http_get_request_header): Removed function. Mon Jul 3 21:50:40 2000 Joe Orton * http_request.c: Add basic support for TLS upgrade (RFC2817). (http_set_request_secure_upgrade, http_set_accept_secure_upgrade): New functions. (send_request): If upgrade is requested, and a 101 response is received, negotiate the TLS connection. (add_fixed_headers): Add Upgrade header if necessary. Mon Jul 3 21:46:00 2000 Joe Orton * http_request.c (send_request): Don't go into an infinite loop. (read_message_header): Simplyify checking for end-of-line. Tue Jun 13 00:29:42 2000 Joe Orton * http_request.c (http_session_proxy, http_session_server): Allow calling >1 time per session, to switch servers. (send_request): Only retry sending request once. Mon Jun 12 21:50:41 2000 Joe Orton * http_request.c (http_add_hooks): New function. Mon Jun 12 21:37:24 2000 Joe Orton * http_cookies.[ch]: Added basic cookies support. Mon Jun 12 21:33:33 2000 Joe Orton * socket.c (sock_create_ssl_context, sock_destroy_ssl_context, sock_disable_tlsv1, sock_disable_sslv2, sock_disable_sslv3, sock_make_secure): Added nssl_context handling. Mon Jun 12 21:29:52 2000 Joe Orton * http_request.c (http_request_dispatch, http_request_create, http_request_destroy, http_set_request_body_buffer, http_set_request_body_stream): Added hook support. Mon Jun 12 21:04:00 2000 Joe Orton * http_request.c (http_set_secure): Store an nssl_context. (open_connection): Give the nssl_context. Sun Jun 11 16:37:52 2000 Joe Orton * sslcerts.c: Import of SSL support from mutt, relicensed under the LGPL for use in neon by the author, Tommi Komulainen . Sun Jun 11 11:30:16 2000 Joe Orton * http_request.c (set_sockerr): Updated to use sock_get_error. Sun Jun 11 11:29:29 2000 Joe Orton * uri.c (uri_parse): Allow scheme to be omitted. Fri Jun 9 20:39:24 2000 Joe Orton * socket.c (sock_get_error): New function. (sock_*): Set sock->error and SOCK_ERROR on error. Mon May 29 16:32:46 2000 Joe Orton * uri.c (uri_abspath_escape): Allocate the exact amount of memory needed. Mon May 29 15:53:33 2000 Joe Orton * dav_basic.c (dav_simple_request): Correct invalid XML logic. Mon May 29 15:52:08 2000 Joe Orton * socket.c (create_sock, sock_accept, sock_get_fd): New functions. (sock_connect_u): Use create_sock. Sun May 28 21:00:37 2000 Joe Orton * http_utils.c (neon_version_string): New function. Sun May 28 19:36:45 2000 Joe Orton * socket.c (sock_connect_u): Zero out allocated nsocket object. Thu May 25 01:27:04 2000 Joe Orton * *.h: Include other neon headers with . Thu May 25 01:02:12 2000 Joe Orton * dav_props.c: Include stdlib.h for 'free'. Wed May 24 20:15:08 2000 Joe Orton * http_request.c (read_message_header): Return HTTP_RETRY if more headers to read, HTTP_OK on end-of-headers. (read_response_headers): Changed accordingly. Wed May 24 19:56:29 2000 Joe Orton * http_request.c (send_request_body): Return a SOCK_* code. (send_request): Re-send request if socket has been closed (due to persistent connection timeout). Wed May 24 19:00:01 2000 Joe Orton * hip_xml.c (find_element): Fix unknown element handling. Tue May 23 19:12:26 2000 Joe Orton * dav_props.c (propfind): Destroy the request body sbuffer after use. Tue May 23 15:43:42 2000 Joe Orton * socket.c (sock_make_secure) [SSL_ENABLE]: Conditionally compile SSL code. [!SSL_ENABLE]: Return failure. (sock_close) [SSL_ENABLE]: Conditionally compile SSL code. Tue May 23 15:37:53 2000 Joe Orton * http_request.c (http_session_create): Renamed from http_session_init. (http_session_destroy): Renamed frmo http_session_finish. Sun May 21 23:50:58 2000 Joe Orton * http_request.c (lookup_host): Use sock_name_lookup. Sun May 21 23:40:39 2000 Joe Orton * http_request.c (http_request_create): Allow passing NULL uri (internal use only). (http_set_secure): New function. (read_response_block, read_message_headers): Redone for new socket API. (build_request): Moved http_auth_new_request calls here (from http_request_dispatch). (send_request): Always call open_connection before sending the request. (read_message_header, read_response_headers): Looser check for empty line. (normalize_response_length): Set response body length to zero on 2xx class response whilst in CONNECT, if no other response body length is given. (http_request_dispatch): Don't close the connection on a HTTP/1.0 2xx class response after a CONNECT request. (proxy_tunnel): New function. (open_connection): Use an SSL connection where appropriate. Use proxy_tunnel for tunnelling through a proxy. Sun May 21 01:35:40 2000 Joe Orton * src/socket.c: Added 'nsocket' ADT for handling sockets. (sock_*): All changed to take 'nsocket *' argument rather than integer file descriptor. Added 'sock_secure_details' to sock_status enum. (sock_make_secure, sock_init): New function. (sock_peek): Renamed from sock_recv. (send_file_*, recv_file_*): Removed functions. (sock_name_lookup): Renamed from host_lookup. (sock_service_lookup): Renamed from get_tcp_port. (sock_block, sock_read, sock_fullwrite, sock_peek, sock_readline): Added SSL support. (sock_transfer): Use sock_fullwrite and sock_read. Sun May 21 01:25:03 2000 Joe Orton * http_request.c (http_request_destroy): Free header handlers and body readers. Sun May 21 01:24:30 2000 Joe Orton * dav_props.h: Removed obsolte got_property callback type. Sun May 21 01:23:59 2000 Joe Orton * dav_props.c (propfind): Free handler object after use. Sun May 21 01:23:12 2000 Joe Orton * dav_207.c (dav_207_destroy): Don't try to free the 'response' field. Sat May 20 21:45:32 2000 Joe Orton * http_request.c: Changed 'te' enum of struct http_response to 'is_chunked' boolean. Sun May 14 01:00:42 2000 Joe Orton * dav_props.c (propfind): Return error on parse error. Sun May 14 00:40:50 2000 Joe Orton * neon_config.h (NEON_VERSION): Bumped to 0.2.0. Sat May 13 23:31:28 2000 Joe Orton * neon_defs.h (BEGIN_NEON_DECLS, END_NEON_DECLS): Added C++ safety macros. * *.h: Surround with C++ safety macros. Sat May 13 22:36:06 2000 Joe Orton * hip_xml.c (hip_xml_destroy): Free handlers. Sat May 13 21:12:14 2000 Joe Orton * hip_xml.c (hip_xml_valid): Reversed return value. Sat May 13 21:11:17 2000 Joe Orton * http_utils.c: Renamed http_debug_mask to neon_debug_mask, similarly neon_debug_stream. (neon_debug_init): Renamed from http_debug_init. Sat May 13 19:24:40 2000 Joe Orton * http_utils.c: Initialize http_debug_mask to zero. (http_debug_init): New function. * http_utils.h: Fixed #ifdef DEBUGGING. Only define relevant DEBUG_* constants. Sat May 13 19:23:34 2000 Joe Orton * neon_config.h: New file. * http_request.c: Include neon_config.h for NEON_VERSION. Sat May 13 18:28:05 2000 Joe Orton * dav_props.c (dav_propfind_create): Create a hip_xml_parser, a 207 parser, register start+end response handlers with 207 layer. (propfind): Fix allprop (Michael Sobolev). * dav_basic.c (dav_simple_request): Create and destroy hip_xml_parser and 207 parser appropriately. Sat May 13 18:24:49 2000 Joe Orton * dav_207.c: Now takes an externally-declared hip_xml parser pointer. (dav_207_create, dav_207_destroy): New functions. (dav_207_init, dav_207_init_with_handler, dav_207_parse, dav_207_error, dav_207_finish): Removed functions. Sat May 13 17:32:45 2000 Joe Orton * hip_xml.[ch]: Rewritten to use opaque hip_xml_parser pointer. struct hip_xml_handler and struct hip_xml_state removed from external interface. struct hip_xml_elm * passed to startelm_cb and endelm_cb. (hip_xml_add_handler, hip_xml_valid, hip_xml_create, hip_xml_destroy, hip_xml_set_error, hip_xml_get_error): New functions. (hip_xml_init, hip_xml_destroy): Removed functions. Sat May 13 13:43:56 2000 Joe Orton * neon.h: Removed. Sat May 13 13:42:20 2000 Joe Orton * string_utils.h: Don't include config.h. (CONCAT*): Don't use xmalloc, use malloc and abort manually. Sat May 13 13:32:46 2000 Joe Orton * http_utils.h, dates.h, http_basic.h: Don't include config.h Sat May 13 13:31:37 2000 Joe Orton * hip_xml.[ch], dav_207.c: Use HIP_ERR_SIZE for size of parser error string. Sat May 13 13:30:40 2000 Joe Orton * Makefile.incl: Use obj_ext for object file extension. Thu May 11 18:21:53 2000 Joe Orton * neon.h: Bumped version to 0.1.1. Thu May 11 18:16:08 2000 Joe Orton * http_basic.c (get_to_fd): Fix short writes. Wed May 10 19:22:01 2000 Joe Orton * neon.h: Bumped version to 0.1.0. Wed May 10 17:46:48 2000 Joe Orton * uri.c (uri_parse, uri_free): New functions. Wed May 10 17:43:37 2000 Joe Orton * http_basic.c (get_to_fd, http_get): Set error appropriately if fwrite() fails. Wed May 10 14:25:38 2000 Joe Orton * http_utils.c (http_debug): New function. Wed May 10 14:25:08 2000 Joe Orton * http_basic.c (get_callback): Call sock_call_progress. Wed May 10 14:24:20 2000 Joe Orton * socket.c (sock_call_progress): New function. (many places): Use it. Wed May 10 14:22:48 2000 Joe Orton * uri.c (uri_has_trailing_slash): Moved from being inline. Tue May 9 23:34:25 2000 Joe Orton * dav_props.c: Use handler as userdata for 207 callbacks, unified handler and context structures. (start_prop, end_prop, start_propelm, end_propelm): Removed functions. (dav_propfind_get_current_resource): New function. Tue May 9 23:29:44 2000 Joe Orton * xalloc.[ch]: New files. Tue May 9 23:05:47 2000 Joe Orton * dav_207.[ch]: Removed property and property element callbacks. Tue May 9 23:01:00 2000 Joe Orton * dav_207.c: Use separate name/namespace for element names. (dav_207_init_with_handler): New function. (end_element): Unescape URI in href element. Tue May 9 19:54:07 2000 Joe Orton * dav_props.c (dav_propfind_allprop, dav_propfind_named, propfind, start_response, end_response, start_prop, end_prop, start_propelm, end_propelm): New functions; PROPFIND support. Tue May 9 19:45:17 2000 Joe Orton * http_request.c (build_request): Renamed from make_request. Tue May 9 19:36:01 2000 Joe Orton * socket.[ch]: Added sock_block_reader. Tue May 9 15:52:56 2000 Joe Orton * uri.c (uri_childof): Return false when parent is the same length as child. Sun May 7 15:07:49 2000 Joe Orton * dav_207.c: Separated element namespace/names. Tue May 2 16:40:59 2000 Joe Orton * hip_xml.[ch]: Added HIP_XML_UTF8DECODE flag. Tue May 2 16:16:57 2000 Joe Orton * hip_xml.[ch]: Separate element name and namespace. Mon May 1 00:21:24 2000 Joe Orton * dav_207.c (dav_accept_207): Moved function from dav_basic.c. * dav_basic.c (dav_accept_207, dav_parse_xml_block): Removed functions. Sun Apr 30 22:47:47 2000 Joe Orton * dav_props.[ch]: Renamed dav_proppatch_item to dav_proppatch_operation. Sun Apr 30 22:45:04 2000 Joe Orton * hip_xml.c (start_element): Clearer error message. Sun Apr 30 19:12:07 2000 Joe Orton * http_basic.c (http_content_type_handler, dav_hdr_handler): New functions. (http_options): Handle DAV header. Sun Apr 30 18:08:53 2000 Joe Orton * dav_props.c (dav_proppatch): New function. Sun Apr 30 18:05:55 2000 Joe Orton * dav_basic.c (handle_error): New function. (end_response, end_propstat): Use it. (dav_simple_request): Don't return the 207 error string if we get all 2xx class status elements. Sun Apr 30 16:56:41 2000 Joe Orton * dav_basic.c (dav_add_depth_header): New function. Sun Apr 30 14:49:06 2000 Joe Orton * dav_207.c (start_element): Unknown element is only a property if the parent is DAV:propstat. Sun Apr 30 14:43:28 2000 Joe Orton * dav_basic.c (end_response, end_propstat): Only write error line if we have status information and the status is not a 424. Sun Apr 30 14:28:23 2000 Joe Orton * dav_basic.h: Added DAV_DEPTH_*. Sun Apr 30 12:47:50 2000 Joe Orton * dav_207.c (check_context): Allow (and ignore) unknown elements anywhere other than as the root. Sun Apr 30 12:35:39 2000 Joe Orton * string_utils.h (ASC2HEX, HEX2ASC): New macros. Sun Apr 30 12:34:37 2000 Joe Orton * http_auth.c [STANDALONE]: Removed. (everywhere): Switch to using md5_to_ascii rather than md5_hexify. Sun Apr 30 12:32:35 2000 Joe Orton * http_request.c (read_response_block): Fixed to return errors properly and block length to parameter. (read_response_body): Changed accordingly. Sun Apr 30 12:29:45 2000 Joe Orton * hip_xml.c (friendly_name): New function, was PRETTY_NAME macro. (start_element, end_element): Fix COLLECT handling. (hip_xml_parse): Only write parse error if the document has not already been marked invalid. Sun Apr 30 12:28:36 2000 Joe Orton * dav_basic.c (dav_simple_request): Rewritten for new 207 interface. (start_response, end_response, end_propstat): New functions. Sun Apr 30 12:27:52 2000 Joe Orton * dav_207.c (dav_207_error): Return the parser error. Sat Apr 29 14:46:48 2000 Joe Orton * socket.c (sock_register_progress, sock_register_notify): New functions. (everywhere): Use progress + notify callbacks rather than fe_*. Sat Apr 29 14:15:23 2000 Joe Orton * string_utils.c (md5_to_ascii, ascii_to_md5): New functions. Sat Apr 29 13:55:39 2000 Joe Orton * hip_xml.c (hip_xml_init): abort() on out-of-memory. Sat Apr 29 12:56:11 2000 Joe Orton * neon_i18n.h: New file. Sat Apr 29 12:55:24 2000 Joe Orton * dav_207.[ch]: Re-implemented with sensible interface. Fri Apr 28 14:56:01 2000 Joe Orton * http_auth.c (http_auth_request_header): Renamed from http_auth_request. * http_request.c (make_request): As above. Thu Apr 13 11:52:14 2000 Joe Orton * http_basic.c (http_put): Switched URI and stream arguments. Thu Apr 13 09:51:21 2000 Joe Orton * http_request.c: Added user_agent field to session structure. (http_set_useragent): New function. (add_fixed_headers): Only set user-agent if sess->user_agent is set. Thu Apr 13 09:49:32 2000 Joe Orton * http_request.c (lookup_host): New function, split from set_hostinfo. (set_hostinfo): Doesn't perform DNS lookup. (http_session_server): Don't do a DNS lookup if we have a proxy. Wed Apr 12 22:32:21 2000 Joe Orton * http_request.c (http_request_dispatch, http_request_create): Store auth header values in local variables rather than request structure. (http_request_create): Don't leak everything on error. Handle http_auth_challenge return value. Wed Apr 12 22:30:06 2000 Joe Orton * http_basic.c (http_options): Pass server capabilites object, parse Server header to detect Apache/1.3.6 and before, indicating broken 100-continue support. (server_hdr_handler): New function. Mon Apr 10 17:42:07 2000 Joe Orton * socket.c: Use 'int' for return values. Mon Apr 10 17:41:40 2000 Joe Orton * http_auth.c (is_in_domain): Dummy implementation. Mon Apr 10 17:40:21 2000 Joe Orton * http_request.c: Handle read() returning 0 when it shouldn't. i18n'ized error messages. Mon Apr 10 14:45:09 2000 Joe Orton * dates.[ch], md5.[ch], base64.[ch]: Imported date handling utilities, MD5 checksum functions, and text->base64 converter. Mon Apr 10 14:44:08 2000 Joe Orton * Makefile.incl: Dependancies updated for socket.[ch]. Mon Apr 10 14:43:36 2000 Joe Orton * dav_207.c: Replaced malloc() calls with xmalloc() calls. Mon Apr 10 14:42:35 2000 Joe Orton * http_auth.c, uri.c, string_utils.h: Replaced malloc() calls with xmalloc() calls. Mon Apr 10 14:41:40 2000 Joe Orton * socket.[ch]: Imported socket handling utilities. Mon Apr 10 14:36:03 2000 Joe Orton * string_utils.h (CONCAT*): Use xmalloc. Mon Apr 10 13:52:17 2000 Joe Orton * http_request.c (set_sockerr): Added handling for socket errors. Sat Apr 8 13:49:07 2000 Joe Orton * string_utils.[ch]: Imported string utilites. Sat Apr 8 00:26:06 2000 Joe Orton * http_request.c (http_set_persist, http_set_expect100): New functions. Sat Apr 8 00:25:37 2000 Joe Orton * http_basic.c (http_options): New function. Fri Apr 7 13:01:35 2000 Joe Orton * neon.h: New file. Fri Apr 7 12:59:40 2000 Joe Orton * http_request.c (normalize_response_length, read_response_body): New functions. (http_add_response_body_reader): Take a callback to determine whether the body reader wants to read the response body. Fri Apr 7 11:46:41 2000 Joe Orton * http_request.c (http_set_server_auth, http_set_proxy_auth): New functions. (give_creds): Use supplied callbacks for authentication. (get_request_bodysize): Send Content-Length: 0 if no entity-body is being sent with a request. (te_hdr_handler, connection_hdr_handler): New functions. (make_request): Don't use Expect: 100-continue if server is not HTTP/1.1 compliant. (read_message_header): Only read until HTTP_MAXIMUM_HEADER_LENGTH bytes of header have been read. (read_response_headers): No hard-coded header handling. (http_request_create): Set req->method_is_head here. Thu Apr 6 14:39:28 2000 Joe Orton * hip_xml.c [HIP_XML_DECODE_UTF8] (decode_utf8_double): New function. (char_data) [HIP_XML_DECODE_UTF8]: Decode UTF-8. Tue Mar 28 13:54:51 2000 Joe Orton * Makefile.incl: Imported makefile fragment. Tue Mar 28 13:54:09 2000 Joe Orton * http_request.[ch] (http_get_error): New function. Thu Mar 23 18:48:42 2000 Joe Orton * hip_xml.[ch]: Imported generic XML parsing layer. * dav_207.[ch]: Imported generic WebDAV 207 response handling. * dav_basic.[ch]: Imported/implemented DAV response handling and basic Class 1 namespace methods. Thu Mar 23 18:46:14 2000 Joe Orton * http_request.c (add_hooks, run_hooks, http_add_destroy_hook): Adding hooks support. (add_fixed_headers): Send TE token in Connection header. Only send Keep-Alive header & token to pre-1.1 origin servers (i.e., not proxies). Thu Mar 23 12:49:01 2000 Joe Orton * http_auth.[ch], uri.[ch]: Imported HTTP authentication and URI handling modules. Thu Mar 23 12:47:05 2000 Joe Orton * http_utils.c: Imported HTTP utility functions. Thu Mar 23 12:44:38 2000 Joe Orton * http_request.[ch]: Implemented modular HTTP request handling. * http_basic.[ch]: Implemented basic HTTP methods GET, PUT, and PUT with If-Unmodified. avfs-1.0.5/libneon/md5.c0000644000175000017500000003272113102441254014522 0ustar michaelmichael/* md5.c - Functions to compute MD5 message digest of files or memory blocks according to the definition of MD5 in RFC 1321 from April 1992. Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C 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. The GNU C 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 the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Written by Ulrich Drepper , 1995. */ #ifdef HAVE_CONFIG_H # include "config.h" #endif #include #if STDC_HEADERS || defined _LIBC # include # include #else #ifdef HAVE_STRING_H #include #endif # ifndef HAVE_MEMCPY # define memcpy(d, s, n) bcopy ((s), (d), (n)) # endif #endif #include "neon_md5.h" #ifdef _LIBC # include # if __BYTE_ORDER == __BIG_ENDIAN # define WORDS_BIGENDIAN 1 # endif /* We need to keep the namespace clean so define the MD5 function protected using leading __ and use weak aliases. */ # define md5_init_ctx __md5_init_ctx # define md5_process_block __md5_process_block # define md5_process_bytes __md5_process_bytes # define md5_finish_ctx __md5_finish_ctx # define md5_read_ctx __md5_read_ctx # define md5_stream __md5_stream # define md5_buffer __md5_buffer #endif #ifdef WORDS_BIGENDIAN # define SWAP(n) \ (((n) << 24) | (((n) & 0xff00) << 8) | (((n) >> 8) & 0xff00) | ((n) >> 24)) #else # define SWAP(n) (n) #endif /* This array contains the bytes used to pad the buffer to the next 64-byte boundary. (RFC 1321, 3.1: Step 1) */ static const unsigned char fillbuf[64] = { 0x80, 0 /* , 0, 0, ... */ }; /* Initialize structure containing state of computation. (RFC 1321, 3.3: Step 3) */ void md5_init_ctx (ctx) struct md5_ctx *ctx; { ctx->A = 0x67452301; ctx->B = 0xefcdab89; ctx->C = 0x98badcfe; ctx->D = 0x10325476; ctx->total[0] = ctx->total[1] = 0; ctx->buflen = 0; } /* Put result from CTX in first 16 bytes following RESBUF. The result must be in little endian byte order. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * md5_read_ctx (ctx, resbuf) const struct md5_ctx *ctx; void *resbuf; { ((md5_uint32 *) resbuf)[0] = SWAP (ctx->A); ((md5_uint32 *) resbuf)[1] = SWAP (ctx->B); ((md5_uint32 *) resbuf)[2] = SWAP (ctx->C); ((md5_uint32 *) resbuf)[3] = SWAP (ctx->D); return resbuf; } /* Process the remaining bytes in the internal buffer and the usual prolog according to the standard and write the result to RESBUF. IMPORTANT: On some systems it is required that RESBUF is correctly aligned for a 32 bits value. */ void * md5_finish_ctx (ctx, resbuf) struct md5_ctx *ctx; void *resbuf; { /* Take yet unprocessed bytes into account. */ md5_uint32 bytes = ctx->buflen; size_t pad; /* Now count remaining bytes. */ ctx->total[0] += bytes; if (ctx->total[0] < bytes) ++ctx->total[1]; pad = bytes >= 56 ? 64 + 56 - bytes : 56 - bytes; memcpy (&ctx->buffer[bytes], fillbuf, pad); /* Put the 64-bit file length in *bits* at the end of the buffer. */ *(md5_uint32 *) &ctx->buffer[bytes + pad] = SWAP (ctx->total[0] << 3); *(md5_uint32 *) &ctx->buffer[bytes + pad + 4] = SWAP ((ctx->total[1] << 3) | (ctx->total[0] >> 29)); /* Process last bytes. */ md5_process_block (ctx->buffer, bytes + pad + 8, ctx); return md5_read_ctx (ctx, resbuf); } /* Compute MD5 message digest for bytes read from STREAM. The resulting message digest number will be written into the 16 bytes beginning at RESBLOCK. */ int md5_stream (stream, resblock) FILE *stream; void *resblock; { /* Important: BLOCKSIZE must be a multiple of 64. */ #define BLOCKSIZE 4096 struct md5_ctx ctx; char buffer[BLOCKSIZE + 72]; size_t sum; /* Initialize the computation context. */ md5_init_ctx (&ctx); /* Iterate over full file contents. */ while (1) { /* We read the file in blocks of BLOCKSIZE bytes. One call of the computation function processes the whole buffer so that with the next round of the loop another block can be read. */ size_t n; sum = 0; /* Read block. Take care for partial reads. */ do { n = fread (buffer + sum, 1, BLOCKSIZE - sum, stream); sum += n; } while (sum < BLOCKSIZE && n != 0); if (n == 0 && ferror (stream)) return 1; /* If end of file is reached, end the loop. */ if (n == 0) break; /* Process buffer with BLOCKSIZE bytes. Note that BLOCKSIZE % 64 == 0 */ md5_process_block (buffer, BLOCKSIZE, &ctx); } /* Add the last bytes if necessary. */ if (sum > 0) md5_process_bytes (buffer, sum, &ctx); /* Construct result in desired memory. */ md5_finish_ctx (&ctx, resblock); return 0; } /* Compute MD5 message digest for LEN bytes beginning at BUFFER. The result is always in little endian byte order, so that a byte-wise output yields to the wanted ASCII representation of the message digest. */ void * md5_buffer (buffer, len, resblock) const char *buffer; size_t len; void *resblock; { struct md5_ctx ctx; /* Initialize the computation context. */ md5_init_ctx (&ctx); /* Process whole buffer but last len % 64 bytes. */ md5_process_bytes (buffer, len, &ctx); /* Put result in desired memory area. */ return md5_finish_ctx (&ctx, resblock); } void md5_process_bytes (buffer, len, ctx) const void *buffer; size_t len; struct md5_ctx *ctx; { /* When we already have some bits in our internal buffer concatenate both inputs first. */ if (ctx->buflen != 0) { size_t left_over = ctx->buflen; size_t add = 128 - left_over > len ? len : 128 - left_over; memcpy (&ctx->buffer[left_over], buffer, add); ctx->buflen += add; if (left_over + add > 64) { md5_process_block (ctx->buffer, (left_over + add) & ~63, ctx); /* The regions in the following copy operation cannot overlap. */ memcpy (ctx->buffer, &ctx->buffer[(left_over + add) & ~63], (left_over + add) & 63); ctx->buflen = (left_over + add) & 63; } buffer = (const char *) buffer + add; len -= add; } /* Process available complete blocks. */ if (len > 64) { md5_process_block (buffer, len & ~63, ctx); buffer = (const char *) buffer + (len & ~63); len &= 63; } /* Move remaining bytes in internal buffer. */ if (len > 0) { memcpy (ctx->buffer, buffer, len); ctx->buflen = len; } } /* These are the four functions used in the four steps of the MD5 algorithm and defined in the RFC 1321. The first function is a little bit optimized (as found in Colin Plumbs public domain implementation). */ /* #define FF(b, c, d) ((b & c) | (~b & d)) */ #define FF(b, c, d) (d ^ (b & (c ^ d))) #define FG(b, c, d) FF (d, b, c) #define FH(b, c, d) (b ^ c ^ d) #define FI(b, c, d) (c ^ (b | ~d)) /* Process LEN bytes of BUFFER, accumulating context into CTX. It is assumed that LEN % 64 == 0. */ void md5_process_block (buffer, len, ctx) const void *buffer; size_t len; struct md5_ctx *ctx; { md5_uint32 correct_words[16]; const md5_uint32 *words = buffer; size_t nwords = len / sizeof (md5_uint32); const md5_uint32 *endp = words + nwords; md5_uint32 A = ctx->A; md5_uint32 B = ctx->B; md5_uint32 C = ctx->C; md5_uint32 D = ctx->D; /* First increment the byte count. RFC 1321 specifies the possible length of the file up to 2^64 bits. Here we only compute the number of bytes. Do a double word increment. */ ctx->total[0] += len; if (ctx->total[0] < len) ++ctx->total[1]; /* Process all bytes in the buffer with 64 bytes in each round of the loop. */ while (words < endp) { md5_uint32 *cwp = correct_words; md5_uint32 A_save = A; md5_uint32 B_save = B; md5_uint32 C_save = C; md5_uint32 D_save = D; /* First round: using the given function, the context and a constant the next context is computed. Because the algorithms processing unit is a 32-bit word and it is determined to work on words in little endian byte order we perhaps have to change the byte order before the computation. To reduce the work for the next steps we store the swapped words in the array CORRECT_WORDS. */ #define OP(a, b, c, d, s, T) \ do \ { \ a += FF (b, c, d) + (*cwp++ = SWAP (*words)) + T; \ ++words; \ CYCLIC (a, s); \ a += b; \ } \ while (0) /* It is unfortunate that C does not provide an operator for cyclic rotation. Hope the C compiler is smart enough. */ #define CYCLIC(w, s) (w = (w << s) | (w >> (32 - s))) /* Before we start, one word to the strange constants. They are defined in RFC 1321 as T[i] = (int) (4294967296.0 * fabs (sin (i))), i=1..64 */ /* Round 1. */ OP (A, B, C, D, 7, 0xd76aa478); OP (D, A, B, C, 12, 0xe8c7b756); OP (C, D, A, B, 17, 0x242070db); OP (B, C, D, A, 22, 0xc1bdceee); OP (A, B, C, D, 7, 0xf57c0faf); OP (D, A, B, C, 12, 0x4787c62a); OP (C, D, A, B, 17, 0xa8304613); OP (B, C, D, A, 22, 0xfd469501); OP (A, B, C, D, 7, 0x698098d8); OP (D, A, B, C, 12, 0x8b44f7af); OP (C, D, A, B, 17, 0xffff5bb1); OP (B, C, D, A, 22, 0x895cd7be); OP (A, B, C, D, 7, 0x6b901122); OP (D, A, B, C, 12, 0xfd987193); OP (C, D, A, B, 17, 0xa679438e); OP (B, C, D, A, 22, 0x49b40821); /* For the second to fourth round we have the possibly swapped words in CORRECT_WORDS. Redefine the macro to take an additional first argument specifying the function to use. */ #undef OP #define OP(f, a, b, c, d, k, s, T) \ do \ { \ a += f (b, c, d) + correct_words[k] + T; \ CYCLIC (a, s); \ a += b; \ } \ while (0) /* Round 2. */ OP (FG, A, B, C, D, 1, 5, 0xf61e2562); OP (FG, D, A, B, C, 6, 9, 0xc040b340); OP (FG, C, D, A, B, 11, 14, 0x265e5a51); OP (FG, B, C, D, A, 0, 20, 0xe9b6c7aa); OP (FG, A, B, C, D, 5, 5, 0xd62f105d); OP (FG, D, A, B, C, 10, 9, 0x02441453); OP (FG, C, D, A, B, 15, 14, 0xd8a1e681); OP (FG, B, C, D, A, 4, 20, 0xe7d3fbc8); OP (FG, A, B, C, D, 9, 5, 0x21e1cde6); OP (FG, D, A, B, C, 14, 9, 0xc33707d6); OP (FG, C, D, A, B, 3, 14, 0xf4d50d87); OP (FG, B, C, D, A, 8, 20, 0x455a14ed); OP (FG, A, B, C, D, 13, 5, 0xa9e3e905); OP (FG, D, A, B, C, 2, 9, 0xfcefa3f8); OP (FG, C, D, A, B, 7, 14, 0x676f02d9); OP (FG, B, C, D, A, 12, 20, 0x8d2a4c8a); /* Round 3. */ OP (FH, A, B, C, D, 5, 4, 0xfffa3942); OP (FH, D, A, B, C, 8, 11, 0x8771f681); OP (FH, C, D, A, B, 11, 16, 0x6d9d6122); OP (FH, B, C, D, A, 14, 23, 0xfde5380c); OP (FH, A, B, C, D, 1, 4, 0xa4beea44); OP (FH, D, A, B, C, 4, 11, 0x4bdecfa9); OP (FH, C, D, A, B, 7, 16, 0xf6bb4b60); OP (FH, B, C, D, A, 10, 23, 0xbebfbc70); OP (FH, A, B, C, D, 13, 4, 0x289b7ec6); OP (FH, D, A, B, C, 0, 11, 0xeaa127fa); OP (FH, C, D, A, B, 3, 16, 0xd4ef3085); OP (FH, B, C, D, A, 6, 23, 0x04881d05); OP (FH, A, B, C, D, 9, 4, 0xd9d4d039); OP (FH, D, A, B, C, 12, 11, 0xe6db99e5); OP (FH, C, D, A, B, 15, 16, 0x1fa27cf8); OP (FH, B, C, D, A, 2, 23, 0xc4ac5665); /* Round 4. */ OP (FI, A, B, C, D, 0, 6, 0xf4292244); OP (FI, D, A, B, C, 7, 10, 0x432aff97); OP (FI, C, D, A, B, 14, 15, 0xab9423a7); OP (FI, B, C, D, A, 5, 21, 0xfc93a039); OP (FI, A, B, C, D, 12, 6, 0x655b59c3); OP (FI, D, A, B, C, 3, 10, 0x8f0ccc92); OP (FI, C, D, A, B, 10, 15, 0xffeff47d); OP (FI, B, C, D, A, 1, 21, 0x85845dd1); OP (FI, A, B, C, D, 8, 6, 0x6fa87e4f); OP (FI, D, A, B, C, 15, 10, 0xfe2ce6e0); OP (FI, C, D, A, B, 6, 15, 0xa3014314); OP (FI, B, C, D, A, 13, 21, 0x4e0811a1); OP (FI, A, B, C, D, 4, 6, 0xf7537e82); OP (FI, D, A, B, C, 11, 10, 0xbd3af235); OP (FI, C, D, A, B, 2, 15, 0x2ad7d2bb); OP (FI, B, C, D, A, 9, 21, 0xeb86d391); /* Add the starting values of the context. */ A += A_save; B += B_save; C += C_save; D += D_save; } /* Put checksum in context given as argument. */ ctx->A = A; ctx->B = B; ctx->C = C; ctx->D = D; } #ifdef _LIBC /* Define weak aliases. */ # undef md5_init_ctx weak_alias (__md5_init_ctx, md5_init_ctx) # undef md5_process_block weak_alias (__md5_process_block, md5_process_block) # undef md5_process_bytes weak_alias (__md5_process_bytes, md5_process_bytes) # undef md5_finish_ctx weak_alias (__md5_finish_ctx, md5_finish_ctx) # undef md5_read_ctx weak_alias (__md5_read_ctx, md5_read_ctx) # undef md5_stream weak_alias (__md5_stream, md5_stream) # undef md5_buffer weak_alias (__md5_buffer, md5_buffer) #endif avfs-1.0.5/libneon/http_auth.h0000644000175000017500000001601613102441254016041 0ustar michaelmichael/* HTTP authentication routines Copyright (C) 1999-2001, Joe Orton 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 */ #ifndef HTTPAUTH_H #define HTTPAUTH_H #include #include "neon_md5.h" /* HTTP Authentication - a pretty complete client implementation of RFC2617. */ /* To use: 1. A session state variable (http_auth_session) is needed for each of server state and proxy state. These may be statically declared (use _init/_finish), or dynamically (use _create/_destroy). 2. To begin a new session, call http_auth_init() or http_auth_create(). Set up a callback function with http_auth_set_creds_cb() for supplying the username and password on demand. See below for details. 3. Before sending a request, pass http_auth_new_request its details, on BOTH auth session variables if you are using a proxy server too. 4. Call http_auth_request_header() and add your 'Authentication:' header to the request if returns non-NULL. Similarly for Proxy-Authentication. 5. Send the request. 6. Read the response: - Pass the value of the '(Proxy|WWW)-Authenticate' header to http_auth_challenge. - If there is 'Authentication-Info', save its value for later. - Pass each block of the response entity-body to http_auth_response_body. 7. After reading the complete response, if an Auth-Info header was received, pass its value to http_auth_verify_response to check whether the SERVER was authenticated okay, passing the saved value. 8. If a 401 or a 407 response is received, retry once for each, by going back to step 3. Note that http_auth_new_request MUST be called again if the SAME request is being retried. */ /* The authentication scheme we are using */ typedef enum { http_auth_scheme_basic, http_auth_scheme_digest } http_auth_scheme; typedef enum { http_auth_alg_md5, http_auth_alg_md5_sess, http_auth_alg_unknown } http_auth_algorithm; /* Selected method of qop which the client is using */ typedef enum { http_auth_qop_none, http_auth_qop_auth, http_auth_qop_auth_int } http_auth_qop; /* The callback used to request the username and password in the given * realm. The username and password must be placed in malloc()-allocate * memory. * Must return: * 0 on success, * -1 to cancel. */ typedef int (*http_auth_request_creds)( void *userdata, const char *realm, char **username, char **password); /* Authentication session state. */ typedef struct { /* The scheme used for this authentication session */ http_auth_scheme scheme; /* The callback used to request new username+password */ http_auth_request_creds reqcreds; void *reqcreds_udata; /*** Session details ***/ /* The username and password we are using to authenticate with */ char *username; /* Whether we CAN supply authentication at the moment */ unsigned int can_handle:1; /* This used for Basic auth */ char *basic; /* These all used for Digest auth */ char *unq_realm; char *unq_nonce; char *unq_cnonce; char *opaque; /* A list of domain strings */ unsigned int domain_count; char **domain; http_auth_qop qop; http_auth_algorithm alg; int nonce_count; /* The ASCII representation of the session's H(A1) value */ char h_a1[33]; /* Used for calculation of H(entity-body) of the response */ struct md5_ctx response_body; /* Temporary store for half of the Request-Digest * (an optimisation - used in the response-digest calculation) */ struct md5_ctx stored_rdig; /* Details of server... needed to reconstruct absoluteURI's when * necessary */ const char *host; const char *uri_scheme; unsigned int port; /*** Details of current request ***/ /* The method and URI we are using for the current request */ const char *uri; const char *method; /* Whether we WILL supply authentication for this request or not */ unsigned int will_handle:1; /* Whether we have a request body for the current request */ unsigned int got_body:1; /* And what the body is - stream or buffer */ FILE *body_stream; const char *body_buffer; } http_auth_session; /* Initializes the authentication state for the given session, * which will use the given username and password. */ void http_auth_init(http_auth_session *sess); void http_auth_set_creds_cb(http_auth_session *sess, http_auth_request_creds callback, void *userdata); /* Finishes off the given authentication session, freeing * any memory used. */ void http_auth_finish(http_auth_session *sess); /* Creates a new authentication session. * Returns non-NULL on success */ http_auth_session * http_auth_create(void); /* Destroys an authentication session, freeing the session state * itself too. */ void http_auth_destroy(http_auth_session *sess); /* Call this before sending a request. Pass ONE OF body_buffer or * body_stream as non-NULL if the request will include an * entity-body. If body_buffer is non-NULL, it MUST be * \0-terminated. If body_stream is non-NULL, it may be read once * during http_auth_challenge, then rewound. uri must identical to * Request-URI, EXCEPT for server auth state, where if the request is * passing through a proxy, then uri should be the same as abs_path. */ void http_auth_new_request(http_auth_session *sess, const char *method, const char *uri, const char *body_buffer, FILE *body_stream); /* Returns the value of the authentication field if one is to be sent, * else NULL. The return value will be taken from malloc()'ed memory, * so should be free()'ed after use. */ char *http_auth_request_header(http_auth_session *sess); /* Pass this the value of the "(Proxy,WWW)-Authenticate: " header field. * Returns: * 0 if we can now authenticate ourselves with the server. * non-zero if we can't */ int http_auth_challenge(http_auth_session *sess, const char *value); /* As you receive sections of the response entity-body, pass them to * this function. */ void http_auth_response_body(http_auth_session *sess, const char *buffer, size_t buffer_len); /* If you receive a "(Proxy-)Authentication-Info:" header, pass its value to * this function. Returns zero if this successfully authenticates * the response as coming from the server, and false if it hasn't. */ int http_auth_verify_response(http_auth_session *sess, const char *value); #endif /* HTTPAUTH_H */ avfs-1.0.5/libneon/dav_207.c0000644000175000017500000001540613102441254015200 0ustar michaelmichael/* WebDAV 207 multi-status response handling Copyright (C) 1999-2001, Joe Orton 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 */ /* Generic handling for WebDAV 207 Multi-Status responses. */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #include "http_utils.h" #include "hip_xml.h" #include "dav_207.h" #include "uri.h" #include "ne_alloc.h" #include "neon_i18n.h" struct dav_207_parser_s { dav_207_start_response start_response; dav_207_end_response end_response; dav_207_start_propstat start_propstat; dav_207_end_propstat end_propstat; hip_xml_parser *parser; void *userdata; /* current position */ void *response, *propstat; /* caching */ http_status status; char *description, *href, *status_line; }; const static struct hip_xml_elm elements[] = { { "DAV:", "multistatus", DAV_ELM_multistatus, 0 }, { "DAV:", "response", DAV_ELM_response, 0 }, { "DAV:", "responsedescription", DAV_ELM_responsedescription, HIP_XML_CDATA }, { "DAV:", "href", DAV_ELM_href, HIP_XML_CDATA }, { "DAV:", "propstat", DAV_ELM_propstat, 0 }, { "DAV:", "prop", DAV_ELM_prop, 0 }, { "DAV:", "status", DAV_ELM_status, HIP_XML_CDATA }, { NULL } }; /* Set the callbacks for the parser */ void dav_207_set_response_handlers(dav_207_parser *p, dav_207_start_response start, dav_207_end_response end) { p->start_response = start; p->end_response = end; } void dav_207_set_propstat_handlers(dav_207_parser *p, dav_207_start_propstat start, dav_207_end_propstat end) { p->start_propstat = start; p->end_propstat = end; } void *dav_207_get_current_response(dav_207_parser *p) { return p->response; } void *dav_207_get_current_propstat(dav_207_parser *p) { return p->propstat; } static int start_element(void *userdata, const struct hip_xml_elm *elm, const char **atts) { dav_207_parser *p = userdata; switch (elm->id) { case DAV_ELM_response: /* Create new response delayed until we get HREF */ break; case DAV_ELM_propstat: if (p->start_propstat) { p->propstat = (*p->start_propstat)(p->userdata, p->response); } break; } return 0; } static int end_element(void *userdata, const struct hip_xml_elm *elm, const char *cdata) { dav_207_parser *p = userdata; switch (elm->id) { case DAV_ELM_responsedescription: if (cdata != NULL) { HTTP_FREE(p->description); p->description = ne_strdup(cdata); } break; case DAV_ELM_href: /* Now we have the href, begin the response */ if (p->start_response && cdata != NULL) { p->response = (*p->start_response)(p->userdata, cdata); } break; case DAV_ELM_status: if (cdata) { HTTP_FREE(p->status_line); p->status_line = ne_strdup(cdata); if (http_parse_statusline(p->status_line, &p->status)) { char buf[500]; DEBUG(DEBUG_HTTP, "Status line: %s\n", cdata); snprintf(buf, 500, _("Invalid HTTP status line in status element at line %d of response:\nStatus line was: %s"), hip_xml_currentline(p->parser), p->status_line); hip_xml_set_error(p->parser, buf); HTTP_FREE(p->status_line); return -1; } else { DEBUG(DEBUG_XML, "Decoded status line: %s\n", p->status_line); } } break; case DAV_ELM_propstat: if (p->end_propstat) { (*p->end_propstat)(p->userdata, p->propstat, p->status_line, p->status_line?&p->status:NULL, p->description); } p->propstat = NULL; HTTP_FREE(p->description); HTTP_FREE(p->status_line); break; case DAV_ELM_response: if (p->end_response) { (*p->end_response)(p->userdata, p->response, p->status_line, p->status_line?&p->status:NULL, p->description); } p->response = NULL; HTTP_FREE(p->status_line); HTTP_FREE(p->description); break; } return 0; } /* This should map directly from the DTD... with the addition of * ignoring anything we don't understand, being liberal in what we * accept. */ static int check_context(hip_xml_elmid parent, hip_xml_elmid child) { DEBUG(DEBUG_XML, "207cc: %d in %d\n", child, parent); switch (parent) { case HIP_ELM_root: switch (child) { case DAV_ELM_multistatus: case DAV_ELM_response: /* not sure why this is here... */ return HIP_XML_VALID; default: break; } break; case DAV_ELM_multistatus: /* */ switch (child) { case DAV_ELM_response: case DAV_ELM_responsedescription: return HIP_XML_VALID; default: break; } break; case DAV_ELM_response: /* */ switch (child) { case DAV_ELM_href: case DAV_ELM_status: case DAV_ELM_propstat: case DAV_ELM_responsedescription: return HIP_XML_VALID; default: break; } break; case DAV_ELM_propstat: /* */ switch (child) { case DAV_ELM_prop: case DAV_ELM_status: case DAV_ELM_responsedescription: return HIP_XML_VALID; default: break; } break; default: break; } return HIP_XML_DECLINE; } static int ignore_cc(hip_xml_elmid parent, hip_xml_elmid child) { if (child == HIP_ELM_unknown || parent == HIP_ELM_unknown) { DEBUG(DEBUG_XML, "207 catch-all caught %d in %d\n", child, parent); return HIP_XML_VALID; } return HIP_XML_DECLINE; } void dav_207_ignore_unknown(dav_207_parser *p) { static const struct hip_xml_elm any_elms[] = { { "", "", HIP_ELM_unknown, HIP_XML_COLLECT }, { NULL } }; hip_xml_push_handler(p->parser, any_elms, ignore_cc, NULL, NULL, NULL); } dav_207_parser *dav_207_create(hip_xml_parser *parser, void *userdata) { dav_207_parser *p = ne_calloc(sizeof *p); p->parser = parser; p->userdata = userdata; /* Add handler for the standard 207 elements */ hip_xml_push_handler(parser, elements, check_context, start_element, end_element, p); return p; } void dav_207_destroy(dav_207_parser *p) { free(p); } int dav_accept_207(void *userdata, http_req *req, http_status *status) { return (status->code == 207); } avfs-1.0.5/libneon/http_request.c0000644000175000017500000013243313102441254016565 0ustar michaelmichael/* HTTP request/response handling Copyright (C) 1999-2001, Joe Orton 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 */ /* This is the HTTP client request/response implementation. * The goal of this code is to be modular and simple. */ /* TODO: * - Move authentication into a hook */ #include "config.h" #include #include #ifdef __EMX__ #include #endif #ifdef HAVE_LIMITS_H #include /* just for Win32? */ #endif #include #include #include #include #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STRINGS_H #include #endif #ifdef HAVE_STDLIB_H #include #endif /* HAVE_STDLIB_H */ #ifdef HAVE_UNISTD_H #include #endif /* HAVE_UNISTD_H */ #ifdef HAVE_SNPRINTF_H #include "snprintf.h" #endif #include #include "neon_i18n.h" #include "ne_alloc.h" #include "http_request.h" #include "http_auth.h" #include "nsocket.h" #include "string_utils.h" /* for sbuffer */ #include "http_utils.h" #include "uri.h" #include "http_private.h" #define HTTP_PORT 80 #define HTTP_EXPECT_TIMEOUT 15 /* 100-continue only used if size > HTTP_EXPECT_MINSIZ */ #define HTTP_EXPECT_MINSIZE 1024 #define HTTP_VERSION_PRE11(s) \ ((s)->version_major<1 || ((s)->version_major==1 && (s)->version_minor<1)) #define HTTP_MAXIMUM_HEADER_LENGTH 8192 #define NEON_USERAGENT "neon/" NEON_VERSION; static void te_hdr_handler(void *userdata, const char *value); static void connection_hdr_handler(void *userdata, const char *value); static void set_hostinfo(struct host_info *info, const char *hostname, int port); static int lookup_host(struct host_info *info); static int open_connection(http_req *req); static int close_connection(http_session *req); static int set_sockerr(http_req *req, const char *doing, int sockerr); static char *get_hostport(struct host_info *host); static void add_fixed_headers(http_req *req); static int get_request_bodysize(http_req *req); static int send_request_body(http_req *req); static void build_request(http_req *req, sbuffer buf); static int read_message_header(http_req *req, sbuffer buf, char *extra); static int read_response_block(http_req *req, struct http_response *resp, char *buffer, size_t *buflen); static int read_response_body(http_req *req); /* The iterative step used to produce the hash value. This is DJB's * magic "*33" hash function. Ralf Engelschall has done some amazing * statistical analysis to show that *33 really is a good hash * function: check the new-httpd list archives, or his 'str' library * source code, for the details. * * TODO: due to limited range of characters used in header names, * could maybe get a better hash function to use? */ #define HH_ITERATE(hash, char) (((hash)*33 + char) % HH_HASHSIZE); /* Produce the hash value for a header name, which MUST be in lower * case. */ static unsigned int hdr_hash(const char *name) { const char *pnt; unsigned int hash = 0; for (pnt = name; *pnt != '\0'; pnt++) { hash = HH_ITERATE(hash,*pnt); } return hash; } /* Initializes an HTTP session */ http_session *http_session_create(void) { http_session *sess = ne_calloc(sizeof *sess); DEBUG(DEBUG_HTTP, "HTTP session begins.\n"); strcpy(sess->error, "Unknown error."); sess->version_major = -1; sess->version_minor = -1; /* Default expect-100 to OFF. */ sess->expect100_works = -1; return sess; } static char *lower_string(const char *str) { char *ret = ne_malloc(strlen(str) + 1), *pnt; for (pnt = ret; *str != '\0'; str++) { *pnt++ = tolower(*str); } *pnt = '\0'; return ret; } static void set_hostinfo(struct host_info *info, const char *hostname, int port) { HTTP_FREE(info->hostport); HTTP_FREE(info->hostname); info->hostname= ne_strdup(hostname); info->port = port; info->hostport = get_hostport(info); http_auth_init(&info->auth); } static int lookup_host(struct host_info *info) { if (sock_name_lookup(info->hostname, &info->addr)) { return HTTP_LOOKUP; } else { return HTTP_OK; } } int http_version_pre_http11(http_session *sess) { return HTTP_VERSION_PRE11(sess); } int http_session_server(http_session *sess, const char *hostname, int port) { if (sess->connected && !sess->have_proxy) { /* Reconnect */ close_connection(sess); } set_hostinfo(&sess->server, hostname, port); /* We do a name lookup on the origin server if either: * 1) we do not have a proxy server * 2) we *might not* have a proxy server (since we have a 'proxy decider' function). */ if (!sess->have_proxy || sess->proxy_decider) { return lookup_host(&sess->server); } else { return HTTP_OK; } } void http_set_secure_context(http_session *sess, nssl_context *ctx) { sess->ssl_context = ctx; } int http_set_request_secure_upgrade(http_session *sess, int req_upgrade) { #ifdef ENABLE_SSL sess->request_secure_upgrade = req_upgrade; return 0; #else return -1; #endif } int http_set_accept_secure_upgrade(http_session *sess, int acc_upgrade) { #ifdef ENABLE_SSL sess->accept_secure_upgrade = acc_upgrade; return 0; #else return -1; #endif } int http_set_secure(http_session *sess, int use_secure) { #ifdef ENABLE_SSL sess->use_secure = use_secure; return 0; #else return -1; #endif } void http_session_decide_proxy(http_session *sess, http_use_proxy use_proxy, void *userdata) { sess->proxy_decider = use_proxy; sess->proxy_decider_udata = userdata; } int http_session_proxy(http_session *sess, const char *hostname, int port) { if (sess->connected) { /* Reconnect */ close_connection(sess); } sess->have_proxy = 1; set_hostinfo(&sess->proxy, hostname, port); return lookup_host(&sess->proxy); } void http_set_server_auth(http_session *sess, http_request_auth callback, void *userdata) { sess->server.auth_callback = callback; sess->server.auth_userdata = userdata; } /* Set callback to handle proxy authentication */ void http_set_proxy_auth(http_session *sess, http_request_auth callback, void *userdata) { sess->proxy.auth_callback = callback; sess->proxy.auth_userdata = userdata; } void http_set_error(http_session *sess, const char *errstring) { strncpy(sess->error, errstring, BUFSIZ); sess->error[BUFSIZ-1] = '\0'; STRIP_EOL(sess->error); } const char *http_get_error(http_session *sess) { return sess->error; } /* Give authentication credentials */ static int give_creds(void *udata, const char *realm, char **username, char **password) { http_req *req = udata; http_session *sess = req->session; if (req->status.code == 407 && req->use_proxy && sess->proxy.auth_callback) { return (*sess->proxy.auth_callback)( sess->proxy.auth_userdata, realm, sess->proxy.hostname, username, password); } else if (req->status.code == 401 && sess->server.auth_callback) { return (*sess->server.auth_callback)( sess->server.auth_userdata, realm, sess->server.hostname, username, password); } return -1; } void http_duplicate_header(void *userdata, const char *value) { char **location = userdata; *location = ne_strdup(value); } void http_handle_numeric_header(void *userdata, const char *value) { int *location = userdata; *location = atoi(value); } /* The body reader callback */ static void auth_body_reader(void *userdata, const char *block, size_t length) { http_auth_session *sess = userdata; http_auth_response_body(sess, block, length); } void http_add_hooks(http_session *sess, const http_request_hooks *hooks, void *private) { struct hook *hk = ne_malloc(sizeof(struct hook)); hk->hooks = hooks; hk->private = private; hk->next = sess->hooks; sess->hooks = hk; } void *http_get_hook_private(http_req *req, const char *id) { struct hook_request *hk; for (hk = req->hook_store; hk != NULL; hk = hk->next) { if (strcasecmp(hk->hook->hooks->id, id) == 0) { return hk->cookie; } } return NULL; } int http_session_destroy(http_session *sess) { struct hook *hk; DEBUG(DEBUG_HTTP, "http_session_destroy called.\n"); http_auth_finish(&sess->server.auth); if (sess->have_proxy) { http_auth_finish(&sess->proxy.auth); } HTTP_FREE(sess->server.hostname); HTTP_FREE(sess->server.hostport); HTTP_FREE(sess->proxy.hostport); HTTP_FREE(sess->user_agent); /* Clear the hooks. */ hk = sess->hooks; while (hk) { struct hook *nexthk = hk->next; free(hk); hk = nexthk; } if (sess->connected) { close_connection(sess); } free(sess); return HTTP_OK; } /* Sends the body down the socket. * Returns 0 on success, or SOCK_* code */ static int send_request_body(http_req *req) { int ret; switch (req->body) { case body_stream: ret = sock_transfer(fileno(req->body_stream), req->session->socket, req->body_size); DEBUG(DEBUG_HTTP, "Sent %d bytes.\n", ret); rewind(req->body_stream); /* since we may have to send it again */ break; case body_buffer: DEBUG(DEBUG_HTTP, "Sending body:\n%s\n", req->body_buffer); ret = sock_send_string(req->session->socket, req->body_buffer); DEBUG(DEBUG_HTTP, "sock_send_string returns: %d\n", ret); break; default: ret = 0; break; } if (ret < 0) { /* transfer failed */ req->forced_close = 1; } return ret; } /* Deal with the body size. * Returns 0 on success or non-zero on error. */ static int get_request_bodysize(http_req *req) { struct stat bodyst; /* Do extra stuff if we have a body */ switch(req->body) { case body_stream: /* Get file length */ if (fstat(fileno(req->body_stream), &bodyst) < 0) { /* Stat failed */ DEBUG(DEBUG_HTTP, "Stat failed: %s\n", strerror(errno)); return -1; } req->body_size = bodyst.st_size; break; case body_buffer: req->body_size = strlen(req->body_buffer); break; default: /* No body, so no size. */ break; } if (req->body != body_none) { char tmp[BUFSIZ]; /* Add the body length header */ snprintf(tmp, BUFSIZ, "Content-Length: %d" EOL, req->body_size); sbuffer_zappend(req->headers, tmp); } else { sbuffer_zappend(req->headers, "Content-Length: 0" EOL); } return 0; } static char *get_hostport(struct host_info *host) { size_t len = strlen(host->hostname); char *ret = ne_malloc(len + 10); strcpy(ret, host->hostname); if (host->port != HTTP_PORT) { snprintf(ret + len, 9, ":%d", host->port); } return ret; } const char *http_get_server_hostport(http_session *sess) { return sess->server.hostport; } const char *http_get_scheme(http_session *sess) { if (sess->use_secure) { return "https"; } else { return "http"; } } /* Lob the User-Agent, connection and host headers in to the request * headers */ static void add_fixed_headers(http_req *req) { if (req->session->user_agent) { sbuffer_concat(req->headers, "User-Agent: ", req->session->user_agent, EOL, NULL); } /* Send Connection: Keep-Alive for pre-1.1 origin servers, so we * might get a persistent connection. 2068 sec 19.7.1 says we MUST * NOT do this for proxies, though. So we don't. Note that on the * first request on any session, we don't know whether the server * is 1.1 compliant, so we presume that it is not. */ if (HTTP_VERSION_PRE11(req->session) && !req->use_proxy) { sbuffer_zappend(req->headers, "Keep-Alive: " EOL); sbuffer_zappend(req->headers, "Connection: TE, Keep-Alive"); } else { sbuffer_zappend(req->headers, "Connection: TE"); } if (req->upgrade_to_tls) { sbuffer_zappend(req->headers, ", Upgrade"); } sbuffer_zappend(req->headers, EOL); if (req->upgrade_to_tls) { sbuffer_zappend(req->headers, "Upgrade: TLS/1.0" EOL); } /* We send TE: trailers since we understand trailers in the chunked * response. */ sbuffer_zappend(req->headers, "TE: trailers" EOL); } static int always_accept_response(void *userdata, http_req *req, http_status *st) { return 1; } int http_accept_2xx(void *userdata, http_req *req, http_status *st) { return (st->klass == 2); } /* Initializes the request with given method and URI. * URI must be abs_path - i.e., NO scheme+hostname. It will BREAK * otherwise. */ http_req *http_request_create(http_session *sess, const char *method, const char *uri) { sbuffer real_uri; http_req *req = ne_calloc(sizeof(http_req)); DEBUG(DEBUG_HTTP, "Creating request...\n"); req->session = sess; req->headers = sbuffer_create(); /* Add in the fixed headers */ add_fixed_headers(req); /* Set the standard stuff */ req->method = method; req->method_is_head = (strcmp(req->method, "HEAD") == 0); req->body = body_none; /* FIXME: the proxy_decider is broken if they called * http_session_proxy before http_session_server, since in that * case we have not done a name lookup on the session server. */ if (sess->have_proxy && sess->proxy_decider != NULL) { req->use_proxy = (*sess->proxy_decider)(sess->proxy_decider_udata, http_get_scheme(sess), sess->server.hostname); } else { req->use_proxy = sess->have_proxy; } if (sess->request_secure_upgrade == 1) { req->upgrade_to_tls = 1; } /* Add in standard callbacks */ if (sess->server.auth_callback != NULL) { http_auth_set_creds_cb(&sess->server.auth, give_creds, req); http_add_response_body_reader(req, always_accept_response, auth_body_reader, &req->session->server.auth); } if (req->use_proxy && sess->proxy.auth_callback != NULL) { http_auth_set_creds_cb(&sess->proxy.auth, give_creds, req); http_add_response_body_reader(req, always_accept_response, auth_body_reader, &req->session->proxy.auth); } /* Add in handlers for all the standard HTTP headers. */ http_add_response_header_handler(req, "Content-Length", http_handle_numeric_header, &req->resp.length); http_add_response_header_handler(req, "Transfer-Encoding", te_hdr_handler, &req->resp); http_add_response_header_handler(req, "Connection", connection_hdr_handler, req); if (uri) { req->abs_path = ne_strdup(uri); real_uri = sbuffer_create(); if (req->use_proxy) sbuffer_concat(real_uri, http_get_scheme(req->session), "://", req->session->server.hostport, NULL); sbuffer_zappend(real_uri, req->abs_path); req->uri = sbuffer_finish(real_uri); } { struct hook *hk; struct hook_request *store; void *cookie; DEBUG(DEBUG_HTTP, "Running request create hooks.\n"); for (hk = sess->hooks; hk != NULL; hk = hk->next) { cookie = (*hk->hooks->create)(hk->private, req, method, uri); if (cookie != NULL) { store = ne_malloc(sizeof(struct hook_request)); store->hook = hk; store->cookie = cookie; store->next = req->hook_store; req->hook_store = store; } } } DEBUG(DEBUG_HTTP, "Request created.\n"); return req; } static void run_set_body_hooks(http_req *req, const char *buf, FILE *f) { struct hook_request *st; for (st = req->hook_store; st!=NULL; st = st->next) { if (HAVE_HOOK(st,use_body)) { HOOK_FUNC(st,use_body)(st->cookie, buf, f); } } } void http_set_request_body_buffer(http_req *req, const char *buffer) { req->body = body_buffer; req->body_buffer = buffer; req->body_stream = NULL; run_set_body_hooks(req, buffer, NULL); } void http_set_request_body_stream(http_req *req, FILE *stream) { req->body = body_stream; req->body_stream = stream; req->body_buffer = NULL; run_set_body_hooks(req, NULL, stream); } void http_set_expect100(http_session *sess, int use_expect100) { if (use_expect100) { sess->expect100_works = 1; } else { sess->expect100_works = -1; } } void http_set_persist(http_session *sess, int persist) { sess->no_persist = !persist; } void http_set_useragent(http_session *sess, const char *token) { static const char *fixed = " " NEON_USERAGENT; HTTP_FREE(sess->user_agent); CONCAT2(sess->user_agent, token, fixed); } void http_add_request_header(http_req *req, const char *name, const char *value) { sbuffer_concat(req->headers, name, ": ", value, EOL, NULL); } sbuffer http_get_request_headers(http_req *req) { return req->headers; } void http_print_request_header(http_req *req, const char *name, const char *format, ...) { va_list params; char buf[BUFSIZ]; va_start(params, format); vsnprintf(buf, BUFSIZ, format, params); va_end(params); sbuffer_concat(req->headers, name, ": ", buf, EOL, NULL); } void http_add_response_header_handler(http_req *req, const char *name, http_header_handler hdl, void *userdata) { struct header_handler *new = ne_calloc(sizeof *new); int hash; new->name = lower_string(name); new->handler = hdl; new->userdata = userdata; hash = hdr_hash(new->name); new->next = req->header_handlers[hash]; req->header_handlers[hash] = new; } void http_add_response_header_catcher(http_req *req, http_header_handler hdl, void *userdata) { struct header_handler *new = ne_calloc(sizeof *new); new->handler = hdl; new->userdata = userdata; new->next = req->header_catchers; req->header_catchers = new; } void http_add_response_body_reader(http_req *req, http_accept_response acpt, http_block_reader rdr, void *userdata) { struct body_reader *new = ne_malloc(sizeof(struct body_reader)); new->accept_response = acpt; new->handler = rdr; new->userdata = userdata; new->next = req->body_readers; req->body_readers = new; } void http_request_destroy(http_req *req) { struct body_reader *rdr, *next_rdr; struct header_handler *hdlr, *next_hdlr; struct hook_request *st, *next_st; int n; HTTP_FREE(req->uri); HTTP_FREE(req->abs_path); for (rdr = req->body_readers; rdr != NULL; rdr = next_rdr) { next_rdr = rdr->next; free(rdr); } for (hdlr = req->header_catchers; hdlr != NULL; hdlr = next_hdlr) { next_hdlr = hdlr->next; free(hdlr); } for (n = 0; n < HH_HASHSIZE; n++) { for (hdlr = req->header_handlers[n]; hdlr != NULL; hdlr = next_hdlr) { next_hdlr = hdlr->next; free(hdlr->name); free(hdlr); } } sbuffer_destroy(req->headers); DEBUG(DEBUG_HTTP, "Running destroy hooks.\n"); for (st = req->hook_store; st!=NULL; st = next_st) { next_st = st->next; if (HAVE_HOOK(st,destroy)) { HOOK_FUNC(st,destroy)(st->cookie); } free(st); } DEBUG(DEBUG_HTTP, "Request ends.\n"); free(req); } /* Reads a block of the response into buffer, which is of size buflen. * Returns number of bytes read, 0 on end-of-response, or HTTP_* on error. * TODO?: only make one actual read() call in here... */ static int read_response_block(http_req *req, struct http_response *resp, char *buffer, size_t *buflen) { int willread, readlen; nsocket *sock = req->session->socket; if (resp->is_chunked) { /* We are doing a chunked transfer-encoding. * It goes: `SIZE CRLF CHUNK CRLF SIZE CRLF CHUNK CRLF ...' * ended by a `CHUNK CRLF 0 CRLF', a 0-sized chunk. * The slight complication is that we have to cope with * partial reads of chunks. * For this reason, resp.chunk_left contains the number of * bytes left to read in the current chunk. */ if (resp->chunk_left == 0) { long int chunk_len; /* We are at the start of a new chunk. */ DEBUG(DEBUG_HTTP, "New chunk.\n"); readlen = sock_readline(sock, buffer, *buflen); if (readlen <= 0) { return set_sockerr(req, _("Could not read chunk size"), readlen); } DEBUG(DEBUG_HTTP, "[Chunk Size] < %s", buffer); chunk_len = strtol(buffer, NULL, 16); if (chunk_len == LONG_MIN || chunk_len == LONG_MAX) { DEBUG(DEBUG_HTTP, "Couldn't read chunk size.\n"); http_set_error(req->session, _("Could not parse chunk size")); return -1; } DEBUG(DEBUG_HTTP, "Got chunk size: %ld\n", chunk_len); if (chunk_len == 0) { /* Zero-size chunk == end of response. */ DEBUG(DEBUG_HTTP, "Zero-size chunk.\n"); *buflen = 0; return HTTP_OK; } resp->chunk_left = chunk_len; } willread = min(*buflen - 1, resp->chunk_left); } else if (resp->length > 0) { /* Have we finished reading the body? */ if (resp->left == 0) { *buflen = 0; return HTTP_OK; } willread = min(*buflen - 1, resp->left); } else { /* Read until socket-close */ willread = *buflen - 1; } DEBUG(DEBUG_HTTP, "Reading %d bytes of response body.\n", willread); readlen = sock_read(sock, buffer, willread); DEBUG(DEBUG_HTTP, "Got %d bytes.\n", readlen); /* EOF is valid if we don't know the response body length, or * we've read all of the response body, and we're not using * chunked. */ if (readlen == SOCK_CLOSED && resp->length <= 0 && !resp->is_chunked) { readlen = 0; } else if (readlen < 0) { return set_sockerr(req, _("Could not read response body"), readlen); } buffer[readlen] = '\0'; *buflen = readlen; DEBUG(DEBUG_HTTPBODY, "Read block:\n%s\n", buffer); if (resp->is_chunked) { resp->chunk_left -= readlen; if (resp->chunk_left == 0) { char crlfbuf[2]; /* If we've read a whole chunk, read a CRLF */ readlen = sock_fullread(sock, crlfbuf, 2); if (readlen < 0 || strncmp(crlfbuf, EOL, 2) != 0) { return set_sockerr(req, _("Error reading chunked response body"), readlen); } } } else if (resp->length > 0) { resp->left -= readlen; } return HTTP_OK; } /* Build a request string into the buffer. * If we sent the data as we generated it, it's possible that multiple * packets could go out on the wire, which is less efficient. */ static void build_request(http_req *req, sbuffer buf) { const char *uri; char *tmp; http_session *sess = req->session; /* If we are talking to a proxy, we send them the absoluteURI * as the Request-URI. If we are talking to a server, we just * send abs_path. */ if (req->use_proxy) uri = req->uri; else uri = req->abs_path; sbuffer_clear(buf); /* Add in the request and the user-supplied headers */ sbuffer_concat(buf, req->method, " ", uri, " HTTP/1.1" EOL, sbuffer_data(req->headers), NULL); /* And the all-important Host header. This is done here since it * might change for a new server. */ sbuffer_concat(buf, "Host: ", req->session->server.hostport, EOL, NULL); /* Note that we pass the abs_path here... */ http_auth_new_request(&sess->server.auth, req->method, req->uri, req->body_buffer, req->body_stream); if (req->use_proxy) { /* ...and absoluteURI here. */ http_auth_new_request(&sess->proxy.auth, req->method, req->uri, req->body_buffer, req->body_stream); } /* Add the authorization headers in */ tmp = http_auth_request_header(&req->session->server.auth); if (tmp != NULL) { sbuffer_concat(buf, "Authorization: ", tmp, NULL); free(tmp); } if (req->use_proxy) { tmp = http_auth_request_header(&req->session->proxy.auth); if (tmp != NULL) { sbuffer_concat(buf, "Proxy-Authorization: ", tmp, NULL); free(tmp); } } /* Now handle the body. */ req->use_expect100 = 0; if (req->body!=body_none && (req->session->expect100_works > -1) && (req->body_size > HTTP_EXPECT_MINSIZE) && !HTTP_VERSION_PRE11(req->session)) { /* Add Expect: 100-continue. */ sbuffer_zappend(buf, "Expect: 100-continue" EOL); req->use_expect100 = 1; } } static int set_sockerr(http_req *req, const char *doing, int code) { switch(code) { case 0: /* FIXME: still needed? */ case SOCK_CLOSED: if (req->use_proxy) { snprintf(req->session->error, BUFSIZ, _("%s: connection was closed by proxy server."), doing); } else { snprintf(req->session->error, BUFSIZ, _("%s: connection was closed by server."), doing); } return HTTP_ERROR; case SOCK_TIMEOUT: snprintf(req->session->error, BUFSIZ, _("%s: connection timed out."), doing); return HTTP_TIMEOUT; default: if (req->session->socket != NULL) { const char *err = sock_get_error(req->session->socket); if (err != NULL) { snprintf(req->session->error, BUFSIZ, "%s: %s", doing, err); } else { snprintf(req->session->error, BUFSIZ, _("%s: socket error."), doing); } } else { snprintf(req->session->error, BUFSIZ, "%s: %s", doing, strerror(errno)); } return HTTP_ERROR; } } /* FIXME: this function need re-writing. * * buf is used to read response lines, must be created, and of size >= BUFSIZ. * Returns HTTP_*, and sets session error appropriately. */ static int send_request(http_req *req, const char *request, sbuffer buf) { http_session *sess = req->session; int ret, try_again, send_attempt; try_again = 1; do { /* FIXME: this is broken */ try_again--; #ifdef DEBUGGING { if ((DEBUG_HTTPPLAIN&neon_debug_mask) == DEBUG_HTTPPLAIN) { /* Display everything mode */ DEBUG(DEBUG_HTTP, "Sending request headers:\n%s", request); } else { /* Blank out the Authorization paramaters */ char *reqdebug = ne_strdup(request), *pnt = reqdebug; while ((pnt = strstr(pnt, "Authorization: ")) != NULL) { for (pnt += 15; *pnt != '\r' && *pnt != '\0'; pnt++) { *pnt = 'x'; } } DEBUG(DEBUG_HTTP, "Sending request headers:\n%s", reqdebug); free(reqdebug); } } #endif /* DEBUGGING */ /* Send the Request-Line and headers */ for (send_attempt = 0; send_attempt < 2; send_attempt++) { DEBUG(DEBUG_HTTP, "Sending headers: attempt %d\n", send_attempt); /* Open the connection if necessary */ ret = open_connection(req); if (ret != HTTP_OK) { return ret; } ret = sock_send_string(req->session->socket, request); if (ret == SOCK_CLOSED) { /* Could happen due to a persistent connection timeout. * Or the server being restarted. */ DEBUG(DEBUG_HTTP, "Connection was closed by server.\n"); close_connection(req->session); } else { break; } } if (ret < 0) { return set_sockerr(req, _("Could not send request"), ret); } DEBUG(DEBUG_HTTP, "Request sent\n"); /* Now, if we are doing a Expect: 100, hang around for a short * amount of time, to see if the server actually cares about the * Expect and sends us a 100 Continue response if the request * is valid, else an error code if it's not. This saves sending * big files to the server when they will be rejected. */ if (req->use_expect100) { DEBUG(DEBUG_HTTP, "Waiting for response...\n"); ret = sock_block(sess->socket, HTTP_EXPECT_TIMEOUT); switch(ret) { case SOCK_TIMEOUT: /* Timed out - i.e. Expect: ignored. There is a danger * here that the server DOES respect the Expect: header, * but was going SO slowly that it didn't get time to * respond within HTTP_EXPECT_TIMEOUT. * TODO: while sending the body, check to see if the * server has sent anything back - if it HAS, then * stop sending - this is a spec compliance SHOULD */ DEBUG(DEBUG_HTTP, "Wait timed out.\n"); sess->expect100_works = -1; /* don't try that again */ /* Try sending the request again without using 100-continue */ try_again++; continue; break; case SOCK_CLOSED: case SOCK_ERROR: /* error */ return set_sockerr(req, _("Error waiting for response"), ret); default: DEBUG(DEBUG_HTTP, "Wait got data.\n"); sess->expect100_works = 1; /* it works - use it again */ break; } } else if (req->body != body_none) { /* Just chuck the file down the socket */ DEBUG(DEBUG_HTTP, "Sending body...\n"); ret = send_request_body(req); if (ret == SOCK_CLOSED) { /* This happens if the persistent connection times out: * the first write() of the headers gets a delayed write * seemingly, so the write doesn't fail till this one. */ DEBUG(DEBUG_HTTP, "Connection closed before request sent, retrying\n"); try_again++; close_connection(req->session); continue; } else if (ret < 0) { DEBUG(DEBUG_HTTP, "Body send failed.\n"); return set_sockerr(req, _("Could not send request body"), ret); } DEBUG(DEBUG_HTTP, "Body sent.\n"); } /* Now, we have either: * - Sent the header and body, or * - Sent the header incl. Expect: line, and got some response. * In any case, we get the status line of the response. */ /* HTTP/1.1 says that the server MAY emit any number of * interim 100 (Continue) responses prior to the normal * response. So loop while we get them. */ do { if (sock_readline(sess->socket, sbuffer_data(buf), BUFSIZ) <= 0) { if (try_again) { return set_sockerr(req, _("Could not read status line"), ret); } DEBUG(DEBUG_HTTP, "Failed to read status line.\n"); try_again++; break; } DEBUG(DEBUG_HTTP, "[Status Line] < %s", sbuffer_data(buf)); /* Got the status line - parse it */ if (http_parse_statusline(sbuffer_data(buf), &req->status)) { http_set_error(sess, _("Could not parse response status line.")); return -1; } sess->version_major = req->status.major_version; sess->version_minor = req->status.minor_version; snprintf(sess->error, BUFSIZ, "%d %s", req->status.code, req->status.reason_phrase); STRIP_EOL(sess->error); if (req->status.klass == 1) { DEBUG(DEBUG_HTTP, "Got 1xx-class.\n"); /* Skip any headers, we don't need them */ do { ret = sock_readline(sess->socket, sbuffer_data(buf), BUFSIZ); if (ret <= 0) { return set_sockerr( req, _("Error reading response headers"), ret); } DEBUG(DEBUG_HTTP, "[Ignored header] < %s", sbuffer_data(buf)); } while (strcmp(sbuffer_data(buf), EOL) != 0); if (req->use_expect100 && (req->status.code == 100)) { /* We are using Expect: 100, and we got a 100-continue * return code... send the request body */ DEBUG(DEBUG_HTTP, "Got continue... sending body now.\n"); ret = send_request_body(req); if (ret <= 0) { return set_sockerr( req, _("Error sending request body"), ret); } DEBUG(DEBUG_HTTP, "Body sent.\n"); } else if (req->upgrade_to_tls && (req->status.code == 101)) { /* Switch to TLS on the fly */ if (sock_make_secure(sess->socket, sess->ssl_context)) { close_connection(sess); return set_sockerr(req, _("Could not negotiate SSL session"), SOCK_ERROR); } } } } while (req->status.klass == 1); if (try_again == 1) { /* If we're trying again, close the conn first */ DEBUG(DEBUG_HTTP, "Retrying request, closing connection first.\n"); close_connection(sess); } } while (try_again == 1); return HTTP_OK; } /* Read a message header from sock into buf. * 'extra' is used to store continuation lines in, and must be * at least of size BUFSIZ. * Returns: * HTTP_RETRY: Read a header into buf. * HTTP_OK: End-of-headers * HTTP_ERROR: Error (session error is set). */ static int read_message_header(http_req *req, sbuffer buf, char *extra) { char *pnt, ch; int ret; nsocket *sock = req->session->socket; ret = sock_readline(sock, sbuffer_data(buf), BUFSIZ); if (ret <= 0) return set_sockerr(req, _("Error reading response headers"), ret); DEBUG(DEBUG_HTTP, "[Header:%d] < %s", strlen(sbuffer_data(buf)), sbuffer_data(buf)); STRIP_EOL(sbuffer_data(buf)); sbuffer_altered(buf); if (sbuffer_size(buf) == 0) { DEBUG(DEBUG_HTTP, "End of headers.\n"); return HTTP_OK; } while (sbuffer_size(buf) < HTTP_MAXIMUM_HEADER_LENGTH) { /* Collect any extra lines into buffer */ ret = sock_peek(sock, &ch, 1); if (ret <= 0) { return set_sockerr(req, _("Error reading response headers"), ret); } if (ch != ' ' && ch != '\t') { /* No continuation of this header */ return HTTP_RETRY; } /* Read BUFSIZ-1 bytes to guarantee that we have a \0 */ ret = sock_readline(sock, extra, BUFSIZ-1); if (ret <= 0) { return set_sockerr(req, _("Error reading response headers"), ret); } DEBUG(DEBUG_HTTP, "[Cont:%d] < %s", strlen(extra), extra); /* Append a space to the end of the last header, in * place of the CRLF. */ sbuffer_append(buf, " ", 1); for (pnt = extra; *pnt!='\0' && (*pnt == ' ' || *pnt =='\t'); pnt++) /*oneliner*/; DEBUG(DEBUG_HTTP, "[Continued] < %s", pnt); sbuffer_zappend(buf, pnt); } http_set_error(req->session, _("Response header too long")); return HTTP_ERROR; } static void normalize_response_length(http_req *req) { /* Response entity-body length calculation, bit icky. * Here, we set: * length==-1 if we DO NOT know the exact body length * length>=0 if we DO know the body length. * * RFC2616, section 4.4: * NO body is returned if the method is HEAD, or the resp status * is 204 or 304 */ if (req->method_is_head || req->status.code==204 || req->status.code==304) { req->resp.length = 0; } else { /* RFC2616, section 4.4: if we have a transfer encoding * and a content-length, then ignore the content-length. */ if ((req->resp.length>-1) && (req->resp.is_chunked)) { req->resp.length = -1; } } /* Noddy noddy noddy. Testing from Apache/mod_proxy, CONNECT does * not return a Content-Length... */ if (req->resp.length == -1 && req->session->in_connect && req->status.klass == 2) { req->resp.length = 0; } } /* Read response headers, using buffer buffer. * Returns HTTP_* code, sets session error. */ static int read_response_headers(http_req *req, sbuffer buf) { char extra[BUFSIZ] = {0}; int ret; /* Read response headers. This loop has been optimized: my GCC * will put all the local vars in registers. */ while ((ret = read_message_header(req, buf, extra)) == HTTP_RETRY) { struct header_handler *hdl; char *hdr; /* hint to the compiler that we'd like these in registers */ register char *pnt; register int hash = 0; /* Quicker than sbuffer_data(), and means 'hdr' can be * optimized away. */ hdr = SBUFFER_CAST(buf); for (hdl = req->header_catchers; hdl != NULL; hdl = hdl->next) { (*hdl->handler)(hdl->userdata, hdr); } /* Iterate over the header name, converting it to lower case and * calculating the hash value as we go. */ for (pnt = hdr; *pnt != '\0' && *pnt != ':'; pnt++) { *pnt = tolower(*pnt); hash = HH_ITERATE(hash,*pnt); } if (*pnt != '\0') { /* Null-term name at the : */ *pnt = '\0'; /* Value starts after any whitespace... */ do { pnt++; } while (*pnt == ' ' || *pnt == '\t'); DEBUG(DEBUG_HTTP, "Header Name: [%s], Value: [%s]\n", hdr, pnt); /* Iterate through the header handlers */ for (hdl = req->header_handlers[hash]; hdl != NULL; hdl = hdl->next) { if (strcmp(hdr, hdl->name) == 0) { (*hdl->handler)(hdl->userdata, pnt); } } } else { http_set_error(req->session, _("Malformed header line.")); return HTTP_ERROR; } } return ret; } /* Read the response message body */ static int read_response_body(http_req *req) { char buffer[BUFSIZ]; int ret = HTTP_OK; size_t readlen; struct body_reader *rdr; /* If there is nothing to do... */ if (req->resp.length == 0) { /* Do nothing */ return HTTP_OK; } /* First off, tell all of the response body handlers that they are * going to get a body, and let them work out whether they want to * handle it or not */ for (rdr = req->body_readers; rdr != NULL; rdr=rdr->next) { rdr->use = (*rdr->accept_response)(rdr->userdata, req, &req->status); } req->resp.left = req->resp.length; req->resp.chunk_left = 0; /* Now actually read the thing */ do { /* Read a block */ readlen = BUFSIZ; ret = read_response_block(req, &req->resp, buffer, &readlen); /* TODO: Do we need to call them if readlen==0, or if * readlen == -1, to tell them something has gone wrong? */ if (ret == HTTP_OK) { for (rdr = req->body_readers; rdr!=NULL; rdr=rdr->next) { if (rdr->use) (*rdr->handler)(rdr->userdata, buffer, readlen); } } } while (ret == HTTP_OK && readlen > 0); if (ret != HTTP_OK) req->forced_close = 1; return ret; } /* Handler for the "Transfer-Encoding" response header */ static void te_hdr_handler(void *userdata, const char *value) { struct http_response *resp = userdata; if (strcasecmp(value, "chunked") == 0) { resp->is_chunked = 1; } else { resp->is_chunked = 0; } } /* Handler for the "Connection" response header */ static void connection_hdr_handler(void *userdata, const char *value) { http_req *req = userdata; if (strcasecmp(value, "close") == 0) { req->forced_close = 1; } else if (strcasecmp(value, "Keep-Alive") == 0) { req->can_persist = 1; } } /* HTTP/1.x request/response mechanism * * Returns an HTTP_* return code. * * The status information is placed in status. The error string is * placed in req->session->error * */ int http_request_dispatch(http_req *req) { http_session *sess = req->session; sbuffer buf, request; int ret, attempt, proxy_attempt, con_attempt, can_retry; /* Response header storage */ char *www_auth, *proxy_auth, *authinfo, *proxy_authinfo; http_status *status = &req->status; /* Initialization... */ DEBUG(DEBUG_HTTP, "Request started...\n"); http_set_error(sess, "Unknown error."); ret = HTTP_OK; if (get_request_bodysize(req)) return HTTP_ERROR; buf = sbuffer_create_sized(BUFSIZ); if (sess->server.auth_callback != NULL) { http_add_response_header_handler(req, "WWW-Authenticate", http_duplicate_header, &www_auth); http_add_response_header_handler(req, "Authentication-Info", http_duplicate_header, &authinfo); } if (req->use_proxy && sess->proxy.auth_callback != NULL) { http_add_response_header_handler(req, "Proxy-Authenticate", http_duplicate_header, &proxy_auth); http_add_response_header_handler(req, "Proxy-Authentication-Info", http_duplicate_header, &proxy_authinfo); } request = sbuffer_create(); proxy_attempt = con_attempt = attempt = 1; www_auth = proxy_auth = authinfo = proxy_authinfo = NULL; /* Loop sending the request: * Retry whilst authentication fails and we supply it. */ do { struct hook_request *st; can_retry = 0; req->can_persist = 0; req->forced_close = 0; build_request(req, request); DEBUG(DEBUG_HTTP, "Running pre_send hooks\n"); for (st = req->hook_store; st!=NULL; st = st->next) { if (HAVE_HOOK(st,pre_send)) { HOOK_FUNC(st,pre_send)(st->cookie, request); } } /* Final CRLF */ sbuffer_zappend(request, EOL); /* Now send the request, and read the Status-Line */ ret = send_request(req, sbuffer_data(request), buf); if (ret != HTTP_OK) goto dispatch_error; req->resp.length = -1; req->resp.is_chunked = 0; /* Read the headers */ if (read_response_headers(req, buf) != HTTP_OK) { ret = HTTP_ERROR; goto dispatch_error; } normalize_response_length(req); ret = read_response_body(req); if (ret != HTTP_OK) goto dispatch_error; /* Read headers in chunked trailers */ if (req->resp.is_chunked) { ret = read_response_headers(req, buf); if (ret != HTTP_OK) goto dispatch_error; } DEBUG(DEBUG_HTTP, "Running post_send hooks\n"); for (st = req->hook_store; st!=NULL; st = st->next) { if (HAVE_HOOK(st,post_send)) { int hret = HOOK_FUNC(st,post_send)(st->cookie, status); /* TODO: this will simplify down to using just 'ret' once * we move authentication into hooks. */ switch(hret) { case HTTP_OK: break; case HTTP_RETRY: can_retry = 1; break; default: /* They must set session error */ ret = hret; } } } if (proxy_authinfo != NULL && http_auth_verify_response(&sess->proxy.auth, proxy_authinfo)) { DEBUG(DEBUG_HTTP, "Proxy response authentication invalid.\n"); ret = HTTP_SERVERAUTH; http_set_error(sess, _("Proxy server was not authenticated correctly.")); } else if (authinfo != NULL && http_auth_verify_response(&sess->server.auth, authinfo)) { DEBUG(DEBUG_HTTP, "Response authenticated as invalid.\n"); ret = HTTP_PROXYAUTH; http_set_error(sess, _("Server was not authenticated correctly.")); } else if (status->code == 401 && www_auth != NULL && attempt++ == 1) { if (!http_auth_challenge(&sess->server.auth, www_auth)) { can_retry = 1; } } else if (status->code == 407 && proxy_auth != NULL && proxy_attempt++ == 1) { if (!http_auth_challenge(&sess->proxy.auth, proxy_auth)) { can_retry = 1; } } HTTP_FREE(www_auth); HTTP_FREE(proxy_auth); HTTP_FREE(authinfo); HTTP_FREE(proxy_authinfo); DEBUG(DEBUG_HTTP, "Connection status: %s, %s, %s\n", req->forced_close?"forced close":"no forced close", sess->no_persist?"no persistent connection":"persistent connection", HTTP_VERSION_PRE11(sess)?"pre-HTTP/1.1":"HTTP/1.1 or later"); /* Close the connection if any of the following are true: * - We have a forced close (e.g. "Connection: close" header) * - We are not using persistent connections for this session * - All of the following are true: * * this is HTTP/1.0 * * and they haven't said they can do persistent connections * * we've not just done a successful CONNECT */ if (req->forced_close || sess->no_persist || (HTTP_VERSION_PRE11(sess) && !req->can_persist && (!sess->in_connect || status->klass != 2))) { close_connection(sess); } /* Retry it if we had an auth challenge */ } while (can_retry); DEBUG(DEBUG_HTTP | DEBUG_FLUSH, "Request ends, status %d class %dxx, error line:\n%s\n", status->code, status->klass, sess->error); DEBUG(DEBUG_HTTPBASIC, "Response: %d %s", status->code, sess->error); if (ret == HTTP_OK) { switch(status->code) { case 401: ret = HTTP_AUTH; break; case 407: ret = HTTP_AUTHPROXY; break; default: break; } } dispatch_error: sbuffer_destroy(request); sbuffer_destroy(buf); HTTP_FREE(www_auth); HTTP_FREE(proxy_auth); HTTP_FREE(authinfo); HTTP_FREE(proxy_authinfo); return ret; } const http_status *http_get_status(http_req *req) { return &(req->status); } /* Create a CONNECT tunnel through the proxy server. * Returns HTTP_* */ static int proxy_tunnel(http_session *sess) { /* Hack up an HTTP CONNECT request... */ http_req *req = http_request_create(sess, "CONNECT", NULL); int ret = HTTP_OK; /* Fudge the URI to be how we want it */ req->uri = ne_strdup(sess->server.hostport); sess->connected = 1; sess->in_connect = 1; ret = http_request_dispatch(req); sess->in_connect = 0; if (ret != HTTP_OK || !sess->connected || req->status.klass != 2) { /* It failed */ http_set_error(sess, _("Could not create SSL connection through proxy server")); ret = HTTP_ERROR; } http_request_destroy(req); return ret; } static int open_connection(http_req *req) { http_session *sess = req->session; if (req->use_proxy) { switch(sess->connected) { case 0: /* Make the TCP connection to the proxy */ DEBUG(DEBUG_SOCKET, "Connecting to proxy at %s:%d...\n", sess->proxy.hostname, sess->proxy.port); sess->socket = sock_connect(sess->proxy.addr, sess->proxy.port); if (sess->socket == NULL) { (void) set_sockerr(req, _("Could not connect to proxy server"), SOCK_ERROR); return HTTP_CONNECT; } sess->connected = 1; /* FALL-THROUGH */ case 1: if (sess->use_secure && !sess->in_connect) { int ret; ret = proxy_tunnel(sess); if (ret != HTTP_OK) { close_connection(sess); return ret; } if (sock_make_secure(sess->socket, sess->ssl_context)) { (void) set_sockerr(req, _("Could not negotiate SSL session"), SOCK_ERROR); close_connection(sess); return HTTP_ERROR; } sess->connected = 2; } else { break; } break; default: /* We've got everything we need */ break; } } else if (sess->connected == 0) { DEBUG(DEBUG_SOCKET, "Connecting to server at %s:%d...\n", sess->server.hostname, sess->server.port); sess->socket = sock_connect(sess->server.addr, sess->server.port); if (sess->socket == NULL) { (void) set_sockerr(req, _("Could not connect to server"), -1); return HTTP_CONNECT; } if (sess->use_secure) { DEBUG(DEBUG_SOCKET, "Starting SSL...\n"); if (sock_make_secure(sess->socket, sess->ssl_context)) { (void) set_sockerr(req, _("Could not negotiate SSL session"), SOCK_ERROR); return HTTP_ERROR; } } sess->connected = 1; } return HTTP_OK; } static int close_connection(http_session *sess) { DEBUG(DEBUG_SOCKET, "Closing connection.\n"); if (sess->connected > 0) { sock_close(sess->socket); sess->socket = NULL; } sess->connected = 0; DEBUG(DEBUG_SOCKET, "Connection closed.\n"); return 0; } avfs-1.0.5/libneon/ne_alloc.c0000644000175000017500000000350613102441254015610 0ustar michaelmichael/* Replacement memory allocation handling etc. Copyright (C) 1999-2001, Joe Orton 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 */ #include "config.h" #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #include "ne_alloc.h" static void (*oom)(void); #define DO_MALLOC(ptr, len) do { \ ptr = malloc(len); \ if (!ptr) { \ if (oom != NULL) \ oom(); \ abort(); \ } \ } while(0); void ne_oom_callback(void (*callback)(void)) { oom = callback; } void *ne_malloc(size_t len) { void *ptr; DO_MALLOC(ptr, len); return ptr; } void *ne_calloc(size_t len) { void *ptr; DO_MALLOC(ptr, len); return memset(ptr, 0, len); } void *ne_realloc(void *ptr, size_t len) { void *ret = realloc(ptr, len); if (!ret) { if (oom) oom(); abort(); } return ret; } char *ne_strdup(const char *s) { char *ret; DO_MALLOC(ret, strlen(s) + 1); return strcpy(ret, s); } char *ne_strndup(const char *s, size_t n) { char *new; DO_MALLOC(new, n); new[n] = '\0'; memcpy(new, s, n); return new; } avfs-1.0.5/libneon/uri.h0000644000175000017500000000431613102441254014640 0ustar michaelmichael/* HTTP URI handling Copyright (C) 1999-2001, Joe Orton 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 */ #ifndef URI_H #define URI_H #include "neon_defs.h" BEGIN_NEON_DECLS /* Un-escapes a URI. Returns malloc-allocated URI on success, * or NULL on failure (malloc failure or invalid % sequence). */ char *uri_unescape(const char *uri); /* Escapes the abspath segment of a URI. * Returns malloc-allocated string on success, or NULL on malloc failure. */ char *uri_abspath_escape(const char *abs_path); /* Returns abspath segment in (absolute) uri */ const char *uri_abspath(const char *uri); /* Returns parent of path */ char *uri_parent(const char *path); /* Returns strcmp-like value giving comparison between a and b, * ignoring trailing-slashes. */ int uri_compare(const char *a, const char *b); /* Returns an absolute URI from a possibly-relative 'uri', using * given scheme + hostport segment. * Returns malloc-allocated string on success, or NULL on malloc failure. */ char *uri_absolute(const char *uri, const char *scheme, const char *hostport); /* Returns non-zero if child is a child of parent */ int uri_childof(const char *parent, const char *child); /* Returns non-zero if uri has a trailing slash character */ int uri_has_trailing_slash(const char *uri); struct uri { char *scheme; char *host; int port; char *path; }; int uri_parse(const char *uri, struct uri *parsed, const struct uri *defaults); void uri_free(struct uri *parsed); END_NEON_DECLS #endif /* URI_H */ avfs-1.0.5/libneon/http_basic.c0000644000175000017500000002723313102441254016157 0ustar michaelmichael/* HTTP/1.1 methods Copyright (C) 1999-2001, Joe Orton 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 */ #include "config.h" #include #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_STDLIB_H #include #endif #include #include "http_request.h" #include "http_basic.h" #ifdef USE_DAV_LOCKS #include "dav_locks.h" #endif #include "dates.h" #include "nsocket.h" #include "neon_i18n.h" #include "ne_alloc.h" /* Header parser to retrieve Last-Modified date */ static void get_lastmodified(void *userdata, const char *value) { time_t *modtime = userdata; *modtime = http_dateparse(value); } int http_getmodtime(http_session *sess, const char *uri, time_t *modtime) { http_req *req = http_request_create(sess, "HEAD", uri); int ret; http_add_response_header_handler(req, "Last-Modified", get_lastmodified, modtime); *modtime = -1; ret = http_request_dispatch(req); if (ret == HTTP_OK && http_get_status(req)->klass != 2) { *modtime = -1; ret = HTTP_ERROR; } http_request_destroy(req); return ret; } /* PUT's stream to URI */ int http_put(http_session *sess, const char *uri, FILE *stream) { http_req *req = http_request_create(sess, "PUT", uri); int ret; #ifdef USE_DAV_LOCKS dav_lock_using_resource(req, uri, 0); dav_lock_using_parent(req, uri); #endif http_set_request_body_stream(req, stream); ret = http_request_dispatch(req); if (ret == HTTP_OK && http_get_status(req)->klass != 2) ret = HTTP_ERROR; http_request_destroy(req); return ret; } /* Conditional HTTP put. * PUTs stream to uri, returning HTTP_FAILED if resource as URI has * been modified more recently than 'since'. */ int http_put_if_unmodified(http_session *sess, const char *uri, FILE *stream, time_t since) { http_req *req; char *date; int ret; if (http_version_pre_http11(sess)) { time_t modtime; /* Server is not minimally HTTP/1.1 compliant. Do a HEAD to * check the remote mod time. Of course, this makes the * operation very non-atomic, but better than nothing. */ ret = http_getmodtime(sess, uri, &modtime); if (ret != HTTP_OK) return ret; if (modtime != since) return HTTP_FAILED; } req = http_request_create(sess, "PUT", uri); date = rfc1123_date(since); /* Add in the conditionals */ http_add_request_header(req, "If-Unmodified-Since", date); free(date); #ifdef USE_DAV_LOCKS dav_lock_using_resource(req, uri, 0); /* FIXME: this will give 412 if the resource doesn't exist, since * PUT may modify the parent... does that matter? */ #endif http_set_request_body_stream(req, stream); ret = http_request_dispatch(req); if (ret == HTTP_OK) { if (http_get_status(req)->code == 412) { ret = HTTP_FAILED; } else if (http_get_status(req)->klass != 2) { ret = HTTP_ERROR; } } http_request_destroy(req); return ret; } struct get_context { int error; size_t total, progress; http_block_reader callback; /* used in read_file */ FILE *file; /* used in get_to_fd */ http_content_range *range; void *userdata; }; static void get_callback(void *userdata, const char *block, size_t length) { struct get_context *ctx = userdata; DEBUG(DEBUG_HTTP, "Got progress: %d out of %d\n", ctx->progress, ctx->total); (*ctx->callback)(ctx->userdata, block, length); /* Increase progress */ ctx->progress += length; if (ctx->progress > ctx->total) { /* Reset the counter if we're uploading it again */ ctx->progress -= ctx->total; } sock_call_progress(ctx->progress, ctx->total); } int http_read_file(http_session *sess, const char *uri, http_block_reader reader, void *userdata) { struct get_context ctx; http_req *req = http_request_create(sess, "GET", uri); int ret; ctx.total = -1; ctx.progress = 0; ctx.callback = reader; ctx.userdata = userdata; /* Read the value of the Content-Length header into ctx.total */ http_add_response_header_handler(req, "Content-Length", http_handle_numeric_header, &ctx.total); http_add_response_body_reader(req, http_accept_2xx, get_callback, &ctx); ret = http_request_dispatch(req); if (ret == HTTP_OK && http_get_status(req)->klass != 2) ret = HTTP_ERROR; http_request_destroy(req); return ret; } static void get_to_fd(void *userdata, const char *block, size_t length) { struct get_context *ctx = userdata; FILE *f = ctx->file; size_t ret; if (!ctx->error) { while (length > 0) { ret = fwrite(block, 1, length, f); if (ret < 0) { ctx->error = errno; break; } else { length -= ret; } } } } static int accept_206(void *ud, http_req *req, http_status *st) { return (st->code == 206); } static void clength_hdr_handler(void *ud, const char *value) { struct get_context *ctx = ud; off_t len = strtol(value, NULL, 10); if (ctx->range->end == -1) { ctx->range->end = ctx->range->start + len; } else if (len != (ctx->range->end - ctx->range->start)) { DEBUG(DEBUG_HTTP, "Expecting %ld bytes, got entity of length %ld\n", (long int) (ctx->range->end - ctx->range->start), (long int) len); ctx->error = 1; } } static void content_range_hdr_handler(void *ud, const char *value) { struct get_context *ctx = ud; if (strncmp(value, "bytes ", 6) != 0) { ctx->error = 1; } } int http_get_range(http_session *sess, const char *uri, http_content_range *range, FILE *f) { http_req *req = http_request_create(sess, "GET", uri); struct get_context ctx; int ret; if (range->end == -1) { ctx.total = -1; } else { ctx.total = range->end - range->start; } ctx.progress = 0; ctx.callback = get_to_fd; ctx.userdata = &ctx; ctx.file = f; ctx.error = 0; ctx.range = range; http_add_response_header_handler(req, "Content-Length", clength_hdr_handler, &ctx); http_add_response_header_handler(req, "Content-Range", content_range_hdr_handler, &ctx); http_add_response_body_reader(req, accept_206, get_callback, &ctx); /* icky casts to long int, which should be at least as large as the * off_t's */ if (range->end == -1) { http_print_request_header(req, "Range", "bytes=%ld-", (long int) range->start); } else { http_print_request_header(req, "Range", "bytes=%ld-%ld", (long int) range->start, (long int)range->end); } http_add_request_header(req, "Accept-Ranges", "bytes"); ret = http_request_dispatch(req); if (ret == HTTP_OK && http_get_status(req)->klass != 2) { ret = HTTP_ERROR; } else if (http_get_status(req)->code != 206) { http_set_error(sess, _("Server does not allow partial GETs.")); ret = HTTP_ERROR; } http_request_destroy(req); return ret; } /* Get to given stream */ int http_get(http_session *sess, const char *uri, FILE *f) { http_req *req = http_request_create(sess, "GET", uri); struct get_context ctx; int ret; ctx.total = -1; ctx.progress = 0; ctx.callback = get_to_fd; ctx.userdata = &ctx; ctx.file = f; ctx.error = 0; /* Read the value of the Content-Length header into ctx.total */ http_add_response_header_handler(req, "Content-Length", http_handle_numeric_header, &ctx.total); http_add_response_body_reader(req, http_accept_2xx, get_callback, &ctx); ret = http_request_dispatch(req); if (ctx.error) { char buf[BUFSIZ]; snprintf(buf, BUFSIZ, _("Could not write to file: %s"), strerror(ctx.error)); http_set_error(sess, buf); ret = HTTP_ERROR; } if (ret == HTTP_OK && http_get_status(req)->klass != 2) { ret = HTTP_ERROR; } http_request_destroy(req); return ret; } /* Get to given stream */ int http_post(http_session *sess, const char *uri, FILE *f, const char *buffer) { http_req *req = http_request_create(sess, "POST", uri); struct get_context ctx; int ret; ctx.total = -1; ctx.progress = 0; ctx.callback = get_to_fd; ctx.userdata = &ctx; ctx.file = f; ctx.error = 0; /* Read the value of the Content-Length header into ctx.total */ http_add_response_header_handler(req, "Content-Length", http_handle_numeric_header, &ctx.total); http_add_response_body_reader(req, http_accept_2xx, get_callback, &ctx); http_set_request_body_buffer(req, buffer); ret = http_request_dispatch(req); if (ctx.error) { char buf[BUFSIZ]; snprintf(buf, BUFSIZ, _("Could not write to file: %s"), strerror(ctx.error)); http_set_error(sess, buf); ret = HTTP_ERROR; } if (ret == HTTP_OK && http_get_status(req)->klass != 2) { ret = HTTP_ERROR; } http_request_destroy(req); return ret; } static void server_hdr_handler(void *userdata, const char *value) { char **tokens = split_string(value, ' ', HTTP_QUOTES, NULL); http_server_capabilities *caps = userdata; int n; for (n = 0; tokens[n] != NULL; n++) { if (strncasecmp(tokens[n], "Apache/", 7) == 0 && strlen(tokens[n]) > 11) { /* 12 == "Apache/1.3.0" */ const char *ver = tokens[n] + 7; int count; char **vers; vers = split_string_c(ver, '.', NULL, NULL, &count); /* Apache/1.3.6 and before have broken Expect: 100 support */ if (count > 1 && atoi(vers[0]) < 2 && atoi(vers[1]) < 4 && atoi(vers[2]) < 7) { caps->broken_expect100 = 1; } split_string_free(vers); } } split_string_free(tokens); } void http_content_type_handler(void *userdata, const char *value) { http_content_type *ct = userdata; char *sep, *parms; ct->value = ne_strdup(value); sep = strchr(ct->value, '/'); if (!sep) { HTTP_FREE(ct->value); return; } *++sep = '\0'; ct->type = ct->value; ct->subtype = sep; parms = strchr(ct->value, ';'); if (parms) { *parms = '\0'; /* TODO: handle charset. */ } } static void dav_hdr_handler(void *userdata, const char *value) { char **classes, **class; http_server_capabilities *caps = userdata; classes = split_string(value, ',', HTTP_QUOTES, HTTP_WHITESPACE); for (class = classes; *class!=NULL; class++) { if (strcmp(*class, "1") == 0) { caps->dav_class1 = 1; } else if (strcmp(*class, "2") == 0) { caps->dav_class2 = 1; } else if (strcmp(*class, "") == 0) { caps->dav_executable = 1; } } split_string_free(classes); } int http_options(http_session *sess, const char *uri, http_server_capabilities *caps) { http_req *req = http_request_create(sess, "OPTIONS", uri); int ret; http_add_response_header_handler(req, "Server", server_hdr_handler, caps); http_add_response_header_handler(req, "DAV", dav_hdr_handler, caps); ret = http_request_dispatch(req); if (ret == HTTP_OK && http_get_status(req)->klass != 2) { ret = HTTP_ERROR; } http_request_destroy(req); return ret; } avfs-1.0.5/libneon/http_basic.h0000644000175000017500000000713513102441254016163 0ustar michaelmichael/* HTTP/1.1 methods Copyright (C) 1999-2001, Joe Orton 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 */ #ifndef HTTP_BASIC_H #define HTTP_BASIC_H #include /* for time_t */ #include /* for FILE * */ #include "http_request.h" BEGIN_NEON_DECLS /* PUT resource at uri, reading request body from f */ int http_put(http_session *sess, const char *uri, FILE *f); /* PUT resource at uri as above, only if it has not been modified * since given modtime. If server is HTTP/1.1, uses If-Unmodified-Since * header; guaranteed failure if resource is modified after 'modtime'. * If server is HTTP/1.0, HEAD's the resource first to fetch current * modtime; race condition if resource is modified between HEAD and PUT. */ int http_put_if_unmodified(http_session *sess, const char *uri, FILE *stream, time_t modtime); /* GET resource at uri, writing response body into f */ int http_get(http_session *sess, const char *uri, FILE *f); /* GET resource at uri, passing response body blocks to 'reader' */ int http_read_file(http_session *sess, const char *uri, http_block_reader reader, void *userdata); /* Retrieve modification time of resource at uri, place in *modtime. * (uses HEAD) */ int http_getmodtime(http_session *sess, const char *uri, time_t *modtime); typedef struct { const char *type, *subtype; const char *charset; char *value; } http_content_type; /* Sets (*http_content_type)userdata appropriately. * Caller must free ->value after use */ void http_content_type_handler(void *userdata, const char *value); /* Server capabilities: */ typedef struct { unsigned int broken_expect100:1; /* True if the server is known to * have broken Expect: * 100-continue support; Apache * 1.3.6 and earlier. */ unsigned int dav_class1; /* True if Class 1 WebDAV server */ unsigned int dav_class2; /* True if Class 2 WebDAV server */ unsigned int dav_executable; /* True if supports the 'executable' * property a. la. mod_dav */ } http_server_capabilities; /* Determines server capabilities (using OPTIONS). * Pass uri="*" to determine proxy server capabilities if using * a proxy server. */ int http_options(http_session *sess, const char *uri, http_server_capabilities *caps); typedef struct { off_t start, end, total; } http_content_range; /* This will write to the CURRENT position of f; so if you want * to do a resume download, use: * struct http_content_range range; * range.start = resume_from; * range.end = range.total = 1000; * fseek(myfile, resume_from, SEEK_SET); * http_get_range(sess, uri, &range, myfile); */ int http_get_range(http_session *sess, const char *uri, http_content_range *range, FILE *f); /* Post using buffer as request-body: stream response into f */ int http_post(http_session *sess, const char *uri, FILE *f, const char *buffer); END_NEON_DECLS #endif avfs-1.0.5/libneon/dav_locks.c0000644000175000017500000003637513102441254016013 0ustar michaelmichael/* WebDAV Class 2 locking operations Copyright (C) 1999-2001, Joe Orton 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 */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #ifdef HAVE_LIMITS_H #include #endif #include "http_request.h" #include "dav_locks.h" #include "dav_basic.h" #include "dav_props.h" #include "uri.h" #include "dav_207.h" #include "neon_i18n.h" #include "hip_xml.h" #include "ne_alloc.h" #define HOOK_ID "http://webdav.org/neon/hooks/webdav-locking" /* The list of locks to submit in an If header * for the current requests */ struct submit_locks { const struct dav_lock *lock; const char *uri; struct submit_locks *next; }; struct dav_lock_session_s { struct dav_lock *locks; }; /* Per-request lock structure */ struct request_locks { struct submit_locks *locks; /* for the If header */ dav_lock_session *session; }; /* Context for PROPFIND/lockdiscovery callbacks */ struct discover_ctx { dav_lock_result results; void *userdata; }; /* Hook callbacks */ static void *create(void *session, http_req *req, const char *method, const char *uri); static void pre_send(void *private, sbuffer req); static void destroy(void *private); /* The hooks are needed for construction of the If header */ static http_request_hooks lock_hooks = { HOOK_ID, /* unique id for the locking hooks */ create, NULL, /* use_body not needed */ pre_send, NULL, /* post_send not needed */ destroy }; /* Element ID's start at HIP_ELM_UNUSED and work upwards */ #define DAV_ELM_LOCK_FIRST (DAV_ELM_207_UNUSED) #define DAV_ELM_lockdiscovery (DAV_ELM_LOCK_FIRST) #define DAV_ELM_activelock (DAV_ELM_LOCK_FIRST + 1) #define DAV_ELM_lockscope (DAV_ELM_LOCK_FIRST + 2) #define DAV_ELM_locktype (DAV_ELM_LOCK_FIRST + 3) #define DAV_ELM_depth (DAV_ELM_LOCK_FIRST + 4) #define DAV_ELM_owner (DAV_ELM_LOCK_FIRST + 5) #define DAV_ELM_timeout (DAV_ELM_LOCK_FIRST + 6) #define DAV_ELM_locktoken (DAV_ELM_LOCK_FIRST + 7) #define DAV_ELM_lockinfo (DAV_ELM_LOCK_FIRST + 8) #define DAV_ELM_write (DAV_ELM_LOCK_FIRST + 9) #define DAV_ELM_exclusive (DAV_ELM_LOCK_FIRST + 10) #define DAV_ELM_shared (DAV_ELM_LOCK_FIRST + 11) static const struct hip_xml_elm lock_elms[] = { #define A(x) { "DAV:", #x, DAV_ELM_ ## x, HIP_XML_COLLECT } /* ANY */ #define D(x) { "DAV:", #x, DAV_ELM_ ## x, 0 } /* normal */ #define C(x) { "DAV:", #x, DAV_ELM_ ## x, HIP_XML_CDATA } /* (#PCDATA) */ #define E(x) { "DAV:", #x, DAV_ELM_ ## x, 0 /* LEAF */ } /* EMPTY */ D(lockdiscovery), D(activelock), D(prop), D(lockscope), D(locktype), C(depth), A(owner), C(timeout), D(locktoken), /* no lockentry */ D(lockinfo), D(lockscope), D(locktype), E(write), E(exclusive), E(shared), C(href), #undef A #undef D #undef C #undef E { NULL, 0, 0 } }; static const dav_propname lock_props[] = { { "DAV:", "lockdiscovery" }, { NULL } }; static void *create(void *session, http_req *req, const char *method, const char *uri) { struct request_locks *rl = ne_calloc(sizeof *rl); rl->session = session; return rl; } static void pre_send(void *private, sbuffer req) { struct request_locks *rl = private; if (rl->locks != NULL) { struct submit_locks *item; /* Add in the If header */ sbuffer_zappend(req, "If:"); for (item = rl->locks; item != NULL; item = item->next) { sbuffer_concat(req, " <", item->lock->uri, "> (<", item->lock->token, ">)", NULL); } sbuffer_zappend(req, EOL); } } static void destroy(void *priv) { struct request_locks *rl = priv; struct submit_locks *lock, *next; for (lock = rl->locks; lock != NULL; lock = next) { next = lock->next; free(lock); } free(rl); } dav_lock_session *dav_lock_register(http_session *sess) { dav_lock_session *locksess = ne_calloc(sizeof *locksess); /* Register the hooks */ http_add_hooks(sess, &lock_hooks, locksess); return locksess; } void dav_lock_unregister(dav_lock_session *sess) { /* FIXME: free the lock list */ free(sess); } /* Submit the given lock for the given URI */ static void submit_lock(struct request_locks *rl, struct dav_lock *lock, const char *uri) { struct submit_locks *slock; /* Check for dups */ for (slock = rl->locks; slock != NULL; slock = slock->next) { if (strcasecmp(slock->lock->token, lock->token) == 0) return; } slock = ne_calloc(sizeof *slock); slock->lock = lock; slock->uri = uri; slock->next = rl->locks; rl->locks = slock; } struct dav_lock *dav_lock_find(dav_lock_session *sess, const char *uri) { struct dav_lock *cur; for (cur = sess->locks; cur != NULL; cur = cur->next) { if (uri_compare(uri, cur->uri) == 0) return cur; } return NULL; } void dav_lock_using_parent(http_req *req, const char *uri) { struct request_locks *rl = http_get_hook_private(req, HOOK_ID); char *parent; if (rl == NULL) return; parent = uri_parent(uri); if (parent != NULL) { struct dav_lock *lock; /* Find any locks on the parent resource. * FIXME: should check for depth-infinity locks too. */ lock = dav_lock_find(rl->session, parent); if (lock) { DEBUG(DEBUG_LOCKS, "Locked parent, %s on %s\n", lock->token, lock->uri); submit_lock(rl, lock, uri); } free(parent); } } int dav_lock_iterate(dav_lock_session *sess, dav_lock_walkfunc func, void *userdata) { struct dav_lock *lock; int count = 0; for (lock = sess->locks; lock != NULL; lock = lock->next) { if (func != NULL) { (*func)(lock, userdata); } count++; } return count; } void dav_lock_using_resource(http_req *req, const char *uri, int depth) { /* Grab the private cookie for this request */ struct request_locks *rl = http_get_hook_private(req, HOOK_ID); struct dav_lock *lock; /* all the known locks */ int match; if (rl == NULL) return; /* Iterate over the list of session locks to see if any of * them apply to this resource */ for (lock = rl->session->locks; lock != NULL; lock = lock->next) { match = 0; if (depth == DAV_DEPTH_INFINITE && uri_childof(uri, lock->uri)) { /* Case 1: this is a depth-infinity request which will * modify a lock somewhere inside the collection. */ DEBUG(DEBUG_LOCKS, "Has child: %s\n", lock->token); match = 1; } else if (uri_compare(uri, lock->uri) == 0) { /* Case 2: this request is directly on a locked resource */ DEBUG(DEBUG_LOCKS, "Has direct lock: %s\n", lock->token); match = 1; } else if (lock->depth == DAV_DEPTH_INFINITE && uri_childof(lock->uri, uri)) { /* Case 3: there is a higher-up infinite-depth lock which * covers the resource that this request will modify. */ DEBUG(DEBUG_LOCKS, "Is child of: %s\n", lock->token); match = 1; } if (match) { submit_lock(rl, lock, uri); } } } void dav_lock_add(dav_lock_session *sess, struct dav_lock *lock) { if (sess->locks != NULL) { sess->locks->prev = lock; } lock->prev = NULL; lock->next = sess->locks; sess->locks = lock; } void dav_lock_remove(dav_lock_session *sess, struct dav_lock *lock) { if (lock->prev != NULL) { lock->prev->next = lock->next; } else { sess->locks = lock->next; } if (lock->next != NULL) { lock->next->prev = lock->prev; } } struct dav_lock *dav_lock_copy(const struct dav_lock *lock) { struct dav_lock *ret = ne_calloc(sizeof *ret); ret->uri = ne_strdup(lock->uri); ret->depth = lock->depth; ret->type = lock->type; ret->scope = lock->scope; ret->token = ne_strdup(lock->token); ret->owner = ne_strdup(lock->owner); ret->timeout = lock->timeout; return ret; } void dav_lock_free(struct dav_lock *lock) { HTTP_FREE(lock->uri); HTTP_FREE(lock->owner); HTTP_FREE(lock->token); free(lock); } int dav_unlock(http_session *sess, struct dav_lock *lock) { http_req *req = http_request_create(sess, "UNLOCK", lock->uri); int ret; http_print_request_header(req, "Lock-Token", "<%s>", lock->token); /* TODO: need this or not? * it definitely goes away when lock-null resources go away */ dav_lock_using_parent(req, lock->uri); ret = http_request_dispatch(req); if (ret == HTTP_OK && http_get_status(req)->klass == 2) { ret = HTTP_OK; } else { ret = HTTP_ERROR; } http_request_destroy(req); return ret; } static int check_context(hip_xml_elmid parent, hip_xml_elmid child) { DEBUG(DEBUG_XML, "dav_locks: check_context %d in %d\n", child, parent); switch (parent) { case HIP_ELM_root: /* TODO: for LOCK requests only... * shouldn't allow this for PROPFIND really */ if (child == DAV_ELM_prop) return HIP_XML_VALID; break; case DAV_ELM_prop: if (child == DAV_ELM_lockdiscovery) return HIP_XML_VALID; break; case DAV_ELM_lockdiscovery: if (child == DAV_ELM_activelock) return HIP_XML_VALID; break; case DAV_ELM_activelock: switch (child) { case DAV_ELM_lockscope: case DAV_ELM_locktype: case DAV_ELM_depth: case DAV_ELM_owner: case DAV_ELM_timeout: case DAV_ELM_locktoken: return HIP_XML_VALID; default: break; } break; case DAV_ELM_lockscope: switch (child) { case DAV_ELM_exclusive: case DAV_ELM_shared: return HIP_XML_VALID; default: break; } case DAV_ELM_locktype: if (child == DAV_ELM_write) return HIP_XML_VALID; break; /* ... depth is PCDATA, owner is COLLECT, timeout is PCDATA */ case DAV_ELM_locktoken: if (child == DAV_ELM_href) return HIP_XML_VALID; break; } return HIP_XML_DECLINE; } static int parse_depth(const char *depth) { if (strcasecmp(depth, "infinity") == 0) { return DAV_DEPTH_INFINITE; } else if (isdigit(depth[0])) { return atoi(depth); } else { return -1; } } static long parse_timeout(const char *timeout) { if (strcasecmp(timeout, "infinite") == 0) { return DAV_TIMEOUT_INFINITE; } else if (strncasecmp(timeout, "Second-", 7) == 0) { long to = strtol(timeout, NULL, 10); if (to == LONG_MIN || to == LONG_MAX) return DAV_TIMEOUT_INVALID; return to; } else { return DAV_TIMEOUT_INVALID; } } static void discover_results(void *userdata, const char *href, const dav_prop_result_set *set) { struct discover_ctx *ctx = userdata; struct dav_lock *lock = dav_propset_private(set); if (lock == NULL) return; lock->uri = ne_strdup(href); ctx->results(ctx->userdata, lock, href, dav_propset_status(set, &lock_props[0])); dav_lock_free(lock); DEBUG(DEBUG_LOCKS, "End of response for %s\n", href); } static int end_element_common(struct dav_lock *l, const struct hip_xml_elm *elm, const char *cdata) { switch (elm->id){ case DAV_ELM_write: l->type = dav_locktype_write; break; case DAV_ELM_exclusive: l->scope = dav_lockscope_exclusive; break; case DAV_ELM_shared: l->scope = dav_lockscope_shared; break; case DAV_ELM_depth: DEBUG(DEBUG_LOCKS, "Got depth: %s\n", cdata); l->depth = parse_depth(cdata); if (l->depth == -1) { return -1; } break; case DAV_ELM_timeout: DEBUG(DEBUG_LOCKS, "Got timeout: %s\n", cdata); l->timeout = parse_timeout(cdata); if (l->timeout == DAV_TIMEOUT_INVALID) { return -1; } break; case DAV_ELM_owner: l->owner = strdup(cdata); break; case DAV_ELM_href: l->token = strdup(cdata); break; } return 0; } /* End-element handler for lock discovery PROPFIND response */ static int end_element_ldisc(void *userdata, const struct hip_xml_elm *elm, const char *cdata) { struct dav_lock *lock = dav_propfind_current_private(userdata); return end_element_common(lock, elm, cdata); } /* End-element handler for LOCK response */ static int end_element_lock(void *userdata, const struct hip_xml_elm *elm, const char *cdata) { struct dav_lock *lock = userdata; return end_element_common(lock, elm, cdata); } static void *create_private(void *userdata, const char *uri) { return ne_calloc(sizeof(struct dav_lock)); } /* Discover all locks on URI */ int dav_lock_discover(http_session *sess, const char *uri, dav_lock_result callback, void *userdata) { dav_propfind_handler *handler; struct discover_ctx ctx = {0}; int ret; ctx.results = callback; ctx.userdata = userdata; handler = dav_propfind_create(sess, uri, DAV_DEPTH_ZERO); dav_propfind_set_complex(handler, lock_props, create_private, NULL); hip_xml_push_handler(dav_propfind_get_parser(handler), lock_elms, check_context, NULL, end_element_ldisc, handler); ret = dav_propfind_named(handler, discover_results, &ctx); dav_propfind_destroy(handler); return ret; } int dav_lock(http_session *sess, struct dav_lock *lock) { http_req *req = http_request_create(sess, "LOCK", lock->uri); sbuffer body = sbuffer_create(); hip_xml_parser *parser = hip_xml_create(); int ret, parse_failed; hip_xml_push_handler(parser, lock_elms, check_context, NULL, end_element_lock, lock); /* Create the body */ sbuffer_concat(body, "" EOL "" EOL " ", lock->scope==dav_lockscope_exclusive? "":"", "" EOL "", NULL); if (lock->owner) { sbuffer_concat(body, "", lock->owner, "" EOL, NULL); } sbuffer_zappend(body, "" EOL); http_set_request_body_buffer(req, sbuffer_data(body)); http_add_response_body_reader(req, http_accept_2xx, hip_xml_parse_v, parser); http_add_request_header(req, "Content-Type", "text/xml"); dav_add_depth_header(req, lock->depth); /* TODO: * By 2518, we need this only if we are creating a lock-null resource. * Since we don't KNOW whether the lock we're given is a lock-null * or not, we cover our bases. */ dav_lock_using_parent(req, lock->uri); /* This one is clearer from 2518 sec 8.10.4. */ dav_lock_using_resource(req, lock->uri, lock->depth); ret = http_request_dispatch(req); sbuffer_destroy(body); parse_failed = !hip_xml_valid(parser); if (ret == HTTP_OK && http_get_status(req)->klass == 2) { if (parse_failed) { ret = HTTP_ERROR; http_set_error(sess, hip_xml_get_error(parser)); } else if (http_get_status(req)->code == 207) { ret = HTTP_ERROR; /* TODO: set the error string appropriately */ } } else { ret = HTTP_ERROR; } http_request_destroy(req); hip_xml_destroy(parser); /* TODO: free the list */ return ret; } avfs-1.0.5/libneon/http_utils.c0000644000175000017500000000767213102441254016243 0ustar michaelmichael/* HTTP utility functions Copyright (C) 1999-2001, Joe Orton 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 */ #include "config.h" #include #ifdef HAVE_STRING_H #include #endif #include /* isdigit() for http_parse_statusline */ #include "dates.h" #include "http_utils.h" #ifdef ENABLE_SSL #include #endif int neon_debug_mask = 0; FILE *neon_debug_stream; void neon_debug_init(FILE *stream, int mask) { neon_debug_stream = stream; neon_debug_mask = mask; } void neon_debug(int ch, const char *template, ...) { va_list params; if ((ch&neon_debug_mask) != ch) return; fflush(stdout); va_start(params, template); vfprintf(neon_debug_stream, template, params); va_end(params); if ((ch&DEBUG_FLUSH) == DEBUG_FLUSH) { fflush(neon_debug_stream); } } static const char *version_string = "neon " NEON_VERSION ": " #ifdef NEON_IS_LIBRARY "Library build" #else "Bundled build" #endif #ifdef HAVE_EXPAT ", Expat" #else #ifdef HAVE_LIBXML ", libxml" #endif #endif #ifdef ENABLE_SSL ", SSL support using " #ifdef OPENSSL_VERSION_TEXT OPENSSL_VERSION_TEXT #else "unknown SSL library" #endif /* OPENSSL_VERSION_TEXT */ #else /* !ENABLE_SSL */ ", no OpenSSL support" #endif /* ENABLE_SSL */ ; const char *neon_version_string(void) { return version_string; } int neon_version_minimum(int major, int minor) { return (NEON_VERSION_MAJOR < major) || (NEON_VERSION_MINOR < minor); } /* HTTP-date parser */ time_t http_dateparse(const char *date) { time_t tmp; tmp = rfc1123_parse(date); if (tmp == -1) { tmp = rfc1036_parse(date); if (tmp == -1) tmp = asctime_parse(date); } return tmp; } int http_parse_statusline(const char *status_line, http_status *st) { const char *part; int major, minor, status_code, klass; /* Check they're speaking the right language */ if (strncmp(status_line, "HTTP/", 5) != 0) { return -1; } /* And find out which dialect of this peculiar language * they can talk... */ major = 0; minor = 0; /* Note, we're good children, and accept leading zero's on the * version numbers */ for (part = status_line + 5; *part != '\0' && isdigit(*part); part++) { major = major*10 + (*part-'0'); } if (*part != '.') { return -1; } for (part++ ; *part != '\0' && isdigit(*part); part++) { minor = minor*10 + (*part-'0'); } if (*part != ' ') { return -1; } /* Skip any spaces */ for (; *part == ' ' ; part++) /* noop */; /* Now for the Status-Code. part now points at the first Y in * "HTTP/x.x YYY". We want value of YYY... could use atoi, but * probably quicker this way. */ if (!isdigit(part[0]) || !isdigit(part[1]) || !isdigit(part[2])) { return -1; } status_code = 100*(part[0]-'0') + 10*(part[1]-'0') + (part[2]-'0'); klass = part[0]-'0'; /* Skip whitespace between status-code and reason-phrase */ for (part+=3; *part == ' ' || *part == '\t'; part++) /* noop */; if (*part == '\0') { return -1; } /* Fill in the results */ st->major_version = major; st->minor_version = minor; st->reason_phrase = part; st->code = status_code; st->klass = klass; return 0; } avfs-1.0.5/libneon/Makefile.in0000644000175000017500000005777313102441264015755 0ustar michaelmichael# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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 = libneon DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp $(noinst_HEADERS) COPYING.LIB ChangeLog \ README ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/neon-ssl.m4 \ $(top_srcdir)/macros/neon-xml-parser.m4 \ $(top_srcdir)/macros/neon.m4 $(top_srcdir)/macros/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = LTLIBRARIES = $(noinst_LTLIBRARIES) libneon_la_LIBADD = am__libneon_la_SOURCES_DIST = base64.c dates.c http_auth.c \ http_basic.c http_cookies.c http_redirect.c http_request.c \ http_utils.c md5.c ne_alloc.c socket.c string_utils.c uri.c \ dav_207.c dav_basic.c dav_locks.c dav_props.c hip_xml.c @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@am_libneon_la_OBJECTS = \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ base64.lo \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ dates.lo \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ http_auth.lo \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ http_basic.lo \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ http_cookies.lo \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ http_redirect.lo \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ http_request.lo \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ http_utils.lo \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ md5.lo \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ ne_alloc.lo \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ socket.lo \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ string_utils.lo \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ uri.lo @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@am_libneon_la_OBJECTS = \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ base64.lo dates.lo \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ dav_207.lo \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ dav_basic.lo \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ dav_locks.lo \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ dav_props.lo \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ hip_xml.lo \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ http_auth.lo \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ http_basic.lo \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ http_cookies.lo \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ http_redirect.lo \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ http_request.lo \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ http_utils.lo \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ md5.lo ne_alloc.lo \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ socket.lo \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ string_utils.lo \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ uri.lo libneon_la_OBJECTS = $(am_libneon_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 = libneon_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(libneon_la_LDFLAGS) $(LDFLAGS) -o $@ @BUILD_NEON_LIB_TRUE@am_libneon_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__depfiles_maybe = depfiles 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 = $(libneon_la_SOURCES) DIST_SOURCES = $(am__libneon_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 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@ EMACS = @EMACS@ 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@ KERNINCLUDE = @KERNINCLUDE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEONLIBS = @NEONLIBS@ NEONOBJS = @NEONOBJS@ NEON_BUILD_BUNDLED = @NEON_BUILD_BUNDLED@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ NEON_OBJEXT = @NEON_OBJEXT@ NEON_TARGET = @NEON_TARGET@ 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@ PRELOAD_LIBS = @PRELOAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ XML_CONFIG = @XML_CONFIG@ 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@ avfscoda_build = @avfscoda_build@ 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@ initstyle = @initstyle@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ kmoduledir = @kmoduledir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ preload_build = @preload_build@ profiledir = @profiledir@ program_transform_name = @program_transform_name@ psdir = @psdir@ rcdir = @rcdir@ rcscriptdir = @rcscriptdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ start_levels = @start_levels@ start_prio = @start_prio@ stop_levels = @stop_levels@ stop_prio = @stop_prio@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = README ChangeLog COPYING.LIB @BUILD_NEON_LIB_TRUE@noinst_LTLIBRARIES = libneon.la @BUILD_NEON_LIB_TRUE@AM_CFLAGS = -I${top_srcdir}/include @CFLAGS@ @DEFS@ @BUILD_NEON_LIB_TRUE@neon_link_flags = @NEON_LINK_FLAGS@ @BUILD_NEON_LIB_TRUE@libneon_la_LDFLAGS = $(neon_link_flags) -module @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@libneon_la_SOURCES = \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ base64.c \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ dates.c \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ http_auth.c \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ http_basic.c \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ http_cookies.c \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ http_redirect.c \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ http_request.c \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ http_utils.c \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ md5.c \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ ne_alloc.c \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ socket.c \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ string_utils.c \ @BUILD_DAVSUPPORT_FALSE@@BUILD_NEON_LIB_TRUE@ uri.c @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@libneon_la_SOURCES = \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ base64.c \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ dates.c \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ dav_207.c \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ dav_basic.c \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ dav_locks.c \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ dav_props.c \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ hip_xml.c \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ http_auth.c \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ http_basic.c \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ http_cookies.c \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ http_redirect.c \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ http_request.c \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ http_utils.c \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ md5.c \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ ne_alloc.c \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ socket.c \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ string_utils.c \ @BUILD_DAVSUPPORT_TRUE@@BUILD_NEON_LIB_TRUE@ uri.c noinst_HEADERS = \ base64.h \ dates.h \ dav_207.h \ dav_basic.h \ dav_locks.h \ dav_props.h \ hip_xml.h \ http_auth.h \ http_basic.h \ http_cookies.h \ http_private.h \ http_redirect.h \ http_request.h \ http_utils.h \ ne_alloc.h \ neon_defs.h \ neon_i18n.h \ neon_md5.h \ neonconf.h \ nsocket.h \ string_utils.h \ uri.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 libneon/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu libneon/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(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}; \ } libneon.la: $(libneon_la_OBJECTS) $(libneon_la_DEPENDENCIES) $(EXTRA_libneon_la_DEPENDENCIES) $(AM_V_CCLD)$(libneon_la_LINK) $(am_libneon_la_rpath) $(libneon_la_OBJECTS) $(libneon_la_LIBADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/base64.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dates.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dav_207.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dav_basic.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dav_locks.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dav_props.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hip_xml.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_auth.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_basic.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_cookies.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_redirect.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_request.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http_utils.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/md5.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ne_alloc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socket.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/string_utils.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uri.Plo@am__quote@ .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 $< .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 `$(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: $(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 -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-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 -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am 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 # 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.0.5/libneon/dav_props.h0000644000175000017500000002200213102441254016026 0ustar michaelmichael/* WebDAV Properties manipulation Copyright (C) 1999-2001, Joe Orton 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 */ #ifndef DAV_PROPS_H #define DAV_PROPS_H #include "http_request.h" #include "dav_207.h" BEGIN_NEON_DECLS /* There are two interfaces for fetching properties. The first is * 'dav_simple_propfind', which is relatively simple, and easy to use, * but only lets you fetch FLAT properties, i.e. properties which are * just a string of bytes. The complex interface is 'dav_propfind_*', * which is complicated, and hard to use, but lets you parse * structured properties, i.e. properties which have XML content. */ /* The 'dav_simple_propfind' interface. *** * * dav_get_props allows you to fetch a set of properties for a single * resource, or a tree of resources. You set the operation going by * passing these arguments: * * - the session which should be used. * - the URI and the depth of the operation (0, 1, infinite) * - the names of the properties which you want to fetch * - a results callback, and the userdata for the callback. * * For each resource found, the results callback is called, passing * you two things along with the userdata you passed in originally: * * - the URI of the resource (const char *href) * - the properties results set (const dav_prop_result_set *results) * */ typedef struct dav_prop_result_set_s dav_prop_result_set; /* Get the value of a given property. Will return NULL if there was an * error fetching this property on this resource. Call * dav_propset_result to get the response-status if so. */ const char *dav_propset_value(const dav_prop_result_set *set, const dav_propname *propname); /* Returns the status structure for fetching the given property on * this resource. This function will return NULL if the server did not * return the property (which is a server error). */ const http_status *dav_propset_status(const dav_prop_result_set *set, const dav_propname *propname); /* Returns the private pointer for the given propset. */ void *dav_propset_private(const dav_prop_result_set *set); /* dav_propset_iterate iterates over a properties result set, * calling the callback for each property in the set. userdata is * passed as the first argument to the callback. value may be NULL, * indicating an error occurred fetching this property: look at * status for the error in that case. * * If the iterator returns non-zero, dav_propset_iterate will return * immediately with that value. */ typedef int (*dav_propset_iterator)(void *userdata, const dav_propname *pname, const char *value, const http_status *status); /* Iterate over all the properties in 'set', calling 'iterator' * for each, passing 'userdata' as the first argument to callback. * * Returns: * whatever value iterator returns. */ int dav_propset_iterate(const dav_prop_result_set *set, dav_propset_iterator iterator, void *userdata); typedef void (*dav_props_result)(void *userdata, const char *href, const dav_prop_result_set *results); /* Fetch properties for a resource (if depth == DAV_DEPTH_ZERO), * or a tree of resources (if depth == DAV_DEPTH_ONE or _INFINITE). * * Names of the properties required must be given in 'props', * or if props is NULL, *all* properties are fetched. * * 'results' is called for each resource in the response, userdata is * passed as the first argument to the callback. It is important to * note that the callback is called as the response is read off the * socket, so don't do anything silly in it (e.g. sleep(100), or call * any functions which use this session). * * Returns HTTP_*. */ int dav_simple_propfind(http_session *sess, const char *uri, int depth, const dav_propname *props, dav_props_result results, void *userdata); /* A PROPPATCH request may include any number of operations. Pass an * array of these operations to dav_proppatch, with the last item * having the name element being NULL. If the type is propset, the * property of the given name is set to the new value. If the type is * propremove, the property of the given name is deleted, and the * value is ignored. */ typedef struct { const dav_propname *name; enum { dav_propset, dav_propremove } type; const char *value; } dav_proppatch_operation; int dav_proppatch(http_session *sess, const char *uri, const dav_proppatch_operation *items); /* The complex, you-do-all-the-work, property fetch interface: */ struct dav_propfind_handler_s; typedef struct dav_propfind_handler_s dav_propfind_handler; /* Retrieve the 'private' pointer for the current propset for the * given handler, as returned by the dav_props_create_complex * callback. */ void *dav_propfind_current_private(dav_propfind_handler *handler); /* Create a PROPFIND handler, for the given URI. * Depth must be one of DAV_DEPTH_*. */ dav_propfind_handler * dav_propfind_create(http_session *sess, const char *uri, int depth); /* Return the XML parser for the given handler. */ hip_xml_parser *dav_propfind_get_parser(dav_propfind_handler *handler); /* A "complex property" has a value which is structured XML. To handle * complex properties, you must set up and register an XML handler * using the 'dav_propfind_get_parser' call, which will understand the * elements which make up such properties. * * To tell the PROPFIND handler to add the list of complex properties * to the list of properties to request from the server, use the * 'dav_propfind_set_complex' call below, and pass it a list of * properties. The list must be terminated by a property whose name is * NULL. * * To store the parsed value of the property, a 'private' structure is * allocated in each propset. When parsing the property value * elements, for each new resource encountered in the response, the * 'creator' callback is called to retrieve a 'private' structure for * this resource. * * Whilst in XML element callbacks you will have registered to handle * complex properties, you can use the 'dav_propfind_current_private' * call to retrieve the pointer to this private structure. * * To retrieve this 'private' structure from the propset in the * results callback, simply call 'dav_propset_private'. * * If more than one call to dav_propfind_set_complex is made for a given * handler, the result is undefined. * */ typedef void *(*dav_props_create_complex)(void *userdata, const char *uri); void dav_propfind_set_complex(dav_propfind_handler *handler, const dav_propname *proplist, dav_props_create_complex creator, void *userdata); /* A "simple property" is a flat string of bytes, and requires * no special handling by the XML parser. * * To tell the PROPFIND handler to retrieve a set of flat properties, * call 'dav_propfind_set_flat' with the properties. * * If more than one call to dav_propfind_set_flat is made for a given * handler, the result is undefined. * */ void dav_propfind_set_flat(dav_propfind_handler *handler, const dav_propname *prop); /* Note that the call: * * ret = dav_simple_propfind(sess, uri, depth, props, callback, ud); * * is equivalent to: * * hdl = dav_propfind_create(sess, uri, depth); * dav_propfind_set_flat(hdl, props); * ret = dav_propfind_named(hdl, callback, ud); * dav_propfind_destroy(hdl); * */ /* Find all properties. Calls to dav_propfind_set_flat and * dav_propfind_set_complex are ignored: all properties are treated * as flat. * * Returns HTTP_*. */ int dav_propfind_allprop(dav_propfind_handler *handler, dav_props_result result, void *userdata); /* Find properties named in a call to dav_propfind_set_flat and/or * dav_propfind_set_complex. * * Returns HTTP_*. */ int dav_propfind_named(dav_propfind_handler *handler, dav_props_result result, void *userdata); /* Destroy a propfind handler after use. */ void dav_propfind_destroy(dav_propfind_handler *handler); /* TODO: this API doesn't cope with complex properties in an allprop * request. But: * * 1. allprops is probably a bad thing, and might go away in a future * spec revision anyway. * * 2. the use case for complex properties and allprop is pretty * thin. If you know what properties are defined, you fetch a named * sets. If you don't know what props are defined on a resource, you * have know way of knowing what their XML values "mean", anyway. * */ END_NEON_DECLS #endif /* DAV_PROPS_H */ avfs-1.0.5/libneon/dav_207.h0000644000175000017500000000660013102441254015201 0ustar michaelmichael/* WebDAV 207 multi-status response handling Copyright (C) 1999-2001, Joe Orton 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 */ #ifndef DAV207_H #define DAV207_H #include "hip_xml.h" #include "http_request.h" /* for http_req */ BEGIN_NEON_DECLS #define DAV_ELM_207_first (HIP_ELM_UNUSED) #define DAV_ELM_multistatus (DAV_ELM_207_first) #define DAV_ELM_response (DAV_ELM_207_first + 1) #define DAV_ELM_responsedescription (DAV_ELM_207_first + 2) #define DAV_ELM_href (DAV_ELM_207_first + 3) #define DAV_ELM_propstat (DAV_ELM_207_first + 4) #define DAV_ELM_prop (DAV_ELM_207_first + 5) #define DAV_ELM_status (DAV_ELM_207_first + 6) #define DAV_ELM_207_UNUSED (HIP_ELM_UNUSED + 100) struct dav_207_parser_s; typedef struct dav_207_parser_s dav_207_parser; /* The name of a WebDAV property. */ typedef struct { const char *nspace, *name; } dav_propname; /* The handler structure: you provide a set of callbacks. * They are called in the order they are listed... start/end_prop * multiple times before end_prop, start/end_propstat multiple times * before an end_response, start/end_response multiple times. */ /* TODO: do we need to pass userdata to ALL of these? We could get away with * only passing the userdata to the start_'s and relying on the caller * to send it through as the _start return value if they need it. */ typedef void *(*dav_207_start_response)(void *userdata, const char *href); typedef void (*dav_207_end_response)( void *userdata, void *response, const char *status_line, const http_status *status, const char *description); typedef void *(*dav_207_start_propstat)(void *userdata, void *response); typedef void (*dav_207_end_propstat)( void *userdata, void *propstat, const char *status_line, const http_status *status, const char *description); /* Create a 207 parser */ dav_207_parser *dav_207_create(hip_xml_parser *parser, void *userdata); /* Set the callbacks for the parser */ void dav_207_set_response_handlers( dav_207_parser *p, dav_207_start_response start, dav_207_end_response end); void dav_207_set_propstat_handlers( dav_207_parser *p, dav_207_start_propstat start, dav_207_end_propstat end); void dav_207_destroy(dav_207_parser *p); /* An acceptance function which only accepts 207 responses */ int dav_accept_207(void *userdata, http_req *req, http_status *status); void *dav_207_get_current_propstat(dav_207_parser *p); void *dav_207_get_current_response(dav_207_parser *p); /* Call this as the LAST thing before beginning parsing, to install a * catch-all handler which means all unknown XML returned in the 207 * response is ignored gracefully. */ void dav_207_ignore_unknown(dav_207_parser *p); END_NEON_DECLS #endif /* DAV207_H */ avfs-1.0.5/libneon/http_redirect.c0000644000175000017500000001030713102441254016671 0ustar michaelmichael/* HTTP-redirect support Copyright (C) 1999-2001, Joe Orton 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 */ #include "config.h" #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #include "http_request.h" #include "ne_alloc.h" #include "http_private.h" #include "http_redirect.h" #include "uri.h" #include "neon_i18n.h" struct redirect { char *location; http_req *req; http_redirect_confirm confirm; http_redirect_notify notify; void *userdata; }; static void *create(void *session, http_req *req, const char *method, const char *uri); static int post_send(void *private, const http_status *status); static void destroy(void *private); http_request_hooks redirect_hooks = { "http://www.webdav.org/neon/hooks/http-redirect", create, NULL, NULL, post_send, destroy }; static void * create(void *session, http_req *req, const char *method, const char *uri) { struct redirect *red = session; /* for handling 3xx redirects */ http_add_response_header_handler(req, "Location", http_duplicate_header, &red->location); red->req = req; return red; } /* 2616 says we can't auto-redirect if the method is not GET or HEAD. * We extend this to PROPFIND too, which violates a 2616 MUST, but * is following the spirit of the spec, I think. */ static int auto_redirect(struct redirect *red) { return (red->req->method_is_head || strcasecmp(red->req->method, "GET") == 0 || strcasecmp(red->req->method, "PROPFIND") == 0); } static int post_send(void *private, const http_status *status) { struct redirect *red = private; struct uri uri; if ((status->code != 302 && status->code != 301) || red->location == NULL) { /* Nothing to do. */ return HTTP_OK; } if (uri_parse(red->location, &uri, NULL)) { /* Couldn't parse the URI */ http_set_error(red->req->session, _("Could not parse redirect location.")); return HTTP_ERROR; } if (auto_redirect(red)) { if (red->notify != NULL) { (*red->notify)(red->userdata, red->req->abs_path, uri.path); } } else { /* Need user-confirmation to follow the redirect */ if (red->confirm == NULL || !(*red->confirm)(red->userdata, red->req->abs_path, uri.path)) { return HTTP_OK; } } red->req->abs_path = ne_strdup(uri.path); /* Set red->req->uri and new host/port for the session, if necessary */ HTTP_FREE(red->req->uri); if (red->req->use_proxy) red->req->uri = ne_strdup(red->location); else red->req->uri = ne_strdup(red->req->abs_path); if (uri.host != NULL && strcasecmp(uri.host, red->req->session->server.hostname) != 0) { /* Handle redirecting to another host. */ if (uri.port <= 0) uri.port = HTTP_PORT; /* FIXME: shouldn't do this here. Let the caller control this. */ http_session_server(red->req->session, uri.host, uri.port); } /* FIXME: need to uri_free here (the above http_session_server() * call prevents this at the moment). */ return HTTP_RETRY; } static void destroy(void *private) { struct redirect *red = private; HTTP_FREE(red->location); } void http_redirect_register(http_session *sess, http_redirect_confirm confirm, http_redirect_notify notify, void *userdata) { struct redirect *red = ne_calloc(sizeof *red); red->confirm = confirm; red->notify = notify; red->userdata = userdata; http_add_hooks(sess, &redirect_hooks, red); } avfs-1.0.5/libneon/neon_defs.h0000644000175000017500000000036113102441254015775 0ustar michaelmichael #undef BEGIN_NEON_DECLS #undef END_NEON_DECLS #ifdef __cplusplus # define BEGIN_NEON_DECLS extern "C" { # define END_NEON_DECLS } #else # define BEGIN_NEON_DECLS /* empty */ # define END_NEON_DECLS /* empty */ #endif #include "neonconf.h" avfs-1.0.5/libneon/string_utils.h0000644000175000017500000001577613102441254016603 0ustar michaelmichael/* String utility functions Copyright (C) 1999-2001, Joe Orton 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 */ #ifndef STRING_UTILS_H #define STRING_UTILS_H #include "neon_defs.h" #include #include /* for tolower */ BEGIN_NEON_DECLS #define ASC2HEX(x) (((x) <= '9') ? ((x) - '0') : (tolower((x)) + 10 - 'a')) #define HEX2ASC(x) ((x) > 9 ? ((x) - 10 + 'a') : ((x) + '0')) /* Returns a ne_malloc-allocated UTF-8 encoded copy of 'str'. */ char *ne_utf8_encode(const char *str); /* Splits str into component parts using given seperator, * skipping given whitespace around separators and at the * beginning and end of str. Separators are ignored within * any pair of characters specified as being quotes. * Returns array of components followed by a NULL pointer. The * components are taken from dynamically allocated memory, and * the entire array can be easily freed using split_string_free. * * aka: What strtok should have been. */ char **split_string(const char *str, const char seperator, const char *quotes, const char *whitespace); /* As above, but returns count of items as well */ char **split_string_c(const char *str, const char seperator, const char *quotes, const char *whitespace, int *count); /* A bit like split_string, except each component is split into a pair. * Each pair is returned consecutively in the return array. * e.g.: * strpairs("aa=bb,cc=dd", ',', '=', NULL, NULL) * => "aa", "bb", "cc", "dd", NULL, NULL * Note, that if a component is *missing* it's key/value separator, * then the 'value' in the array will be a NULL pointer. But, if the * value is zero-length (i.e., the component separator follows directly * after the key/value separator, or with only whitespace inbetween), * then the value in the array will be a zero-length string. * e.g.: * pair_string("aaaa,bb=cc,dd=,ee=ff", ',', '=', NULL, NULL) * => "aaaa", NULL, "bb", "cc", "dd", "", "ee", "ff" * A NULL key indicates the end of the array (the value will also * be NULL, for convenience). */ char **pair_string(const char *str, const char compsep, const char kvsep, const char *quotes, const char *whitespace); /* Frees the array returned by split_string */ void split_string_free(char **components); /* Frees the array returned by pair_string */ void pair_string_free(char **pairs); /* Returns a string which is str with ch stripped from * beggining and end, if present in either. The string returned * is dynamically allocated using malloc(). * * e.g. shave_string("abbba", 'a') => "bbb". */ char *shave_string(const char *str, const char ch); #define EOL "\r\n" #define STRIP_EOL(str) \ do { \ char *p; \ if ((p = strrchr(str, '\r')) != NULL) *p = '\0'; \ if ((p = strrchr(str, '\n')) != NULL) *p = '\0'; \ } while (0) /* Return concatenation of all given strings. */ char *ne_concat(const char *str, ...); /* String buffer handling. (Strings are zero-terminated still). * A string buffer sbuffer * which grows dynamically with the string. */ struct sbuffer_s; typedef struct sbuffer_s *sbuffer; /* Returns contents of buffer at current point in time. * NOTE: if the buffer is modified with _concat, _append etc, * this value may no longer be correct. */ char *sbuffer_data(sbuffer buf); /* Quick and dirty cast of buf into a 'char *'. * Relies on sbuffer internal ordering. */ #define SBUFFER_CAST(buf) (*(char **)buf) /* Returns size of data in buffer, equiv to strlen(sbuffer_data(buf)) */ int sbuffer_size(sbuffer buf); /* Concatenate all given strings onto the end of the buffer. * The strings must be null-terminated, and MUST be followed by a * NULL argument marking the end of the list. * Returns: * 0 on success * non-zero on error */ int sbuffer_concat(sbuffer buf, ...); /* Create a new sbuffer. Returns NULL on error */ sbuffer sbuffer_create(void); /* Create a new sbuffer of given minimum size. Returns NULL on error */ sbuffer sbuffer_create_sized(size_t size); /* Destroys (deallocates) a buffer */ void sbuffer_destroy(sbuffer buf); /* Append a zero-terminated string 'str' to buf. * Returns 0 on success, non-zero on error. */ int sbuffer_zappend(sbuffer buf, const char *str); /* Append 'len' bytes of 'data' to buf. 'data' does not need to be * zero-terminated. The resultant string will have a zero-terminator, * either way. Returns 0 on success, non-zero on error. */ int sbuffer_append(sbuffer buf, const char *data, size_t len); /* Empties the contents of buf; makes the buffer zero-length. */ void sbuffer_clear(sbuffer buf); /* Grows the sbuffer to a minimum size. * Returns 0 on success, non-zero on error */ int sbuffer_grow(sbuffer buf, size_t size); void sbuffer_altered(sbuffer buf); /* MD5 ascii->binary conversion */ void md5_to_ascii(const unsigned char md5_buf[16], char *buffer); void ascii_to_md5(const char *buffer, unsigned char md5_buf[16]); /* Destroys a buffer, WITHOUT freeing the data, and returns the * data. */ char *sbuffer_finish(sbuffer buf); /* Handy macro to free things. */ #define SAFE_FREE(x) \ do { if ((x)!=NULL) free((x)); (x) = NULL; } while (0) /* TODO: do these with stpcpy instead... more efficient, but means * bloat on non-GNU platforms. */ /* TODO: could replace with glib equiv's where available, too */ /* NOTES: * - These abort() on malloc() returning NULL * - You will need to #include / YOURSELF to * prototype strlen and strcat. */ #define CONCAT2(out, str1, str2) \ do { \ out = malloc(strlen(str1) + strlen(str2) + 1); \ if (out != NULL) { \ strcpy(out, str1); \ strcat(out, str2); \ } else { \ abort(); \ } \ } while (0) #define CONCAT3(out, str1, str2, str3) \ do { \ out = malloc(strlen(str1) + strlen(str2) + strlen(str3) + 1); \ if (out != NULL) { \ strcpy(out, str1); \ strcat(out, str2); \ strcat(out, str3); \ } else { \ abort(); \ } \ } while (0) #define CONCAT4(out, str1, str2, str3, str4) \ do { \ out = malloc(strlen(str1) + strlen(str2) \ + strlen(str3) + strlen(str4) + 1); \ if (out != NULL) { \ strcpy(out, str1); \ strcat(out, str2); \ strcat(out, str3); \ strcat(out, str4); \ } else { \ abort(); \ } \ } while (0) END_NEON_DECLS #endif /* STRING_UTILS_H */ avfs-1.0.5/libneon/ne_alloc.h0000644000175000017500000000276513102441254015623 0ustar michaelmichael/* Replacement memory allocation handling etc. Copyright (C) 1999-2001, Joe Orton 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 */ #ifndef NE_ALLOC_H #define NE_ALLOC_H #include "neonconf.h" #ifdef WIN32 #include #else #include #endif /* Set callback which is called if malloc() returns NULL. */ void ne_oom_callback(void (*callback)(void)); /* Replacements for standard C library memory allocation functions. * These will NOT return NULL. If the C library malloc() returns NULL, * neon will call the OOM callback if you have registered it, or else, * call abort(). */ void *ne_malloc(size_t len); void *ne_calloc(size_t len); void *ne_realloc(void *ptr, size_t len); char *ne_strdup(const char *s); char *ne_strndup(const char *s, size_t n); #endif /* NE_ALLOC_H */ avfs-1.0.5/libneon/http_utils.h0000644000175000017500000000610713102441254016240 0ustar michaelmichael/* HTTP utility functions Copyright (C) 1999-2001, Joe Orton 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 */ #ifndef HTTP_UTILS_H #define HTTP_UTILS_H #include #include #include #include "neon_defs.h" BEGIN_NEON_DECLS /* Returns a user-visible version string like: * "neon 0.2.0: Standalone build, OpenSSL support" */ const char *neon_version_string(void); /* Returns non-zero if the neon API compiled in is less than * major.minor. i.e. * I am: 1.2 - neon_version_check(1, 3) => -1 * I am: 0.10 - neon_version_check(0, 9) => 0 */ int neon_version_minimum(int major, int minor); #define HTTP_QUOTES "\"'" #define HTTP_WHITESPACE " \r\n\t" /* Handy macro to free things. */ #define HTTP_FREE(x) do { if ((x) != NULL) free((x)); (x) = NULL; } while (0) #ifndef HTTP_PORT #define HTTP_PORT 80 #endif time_t http_dateparse(const char *date); #ifndef WIN32 #undef min #define min(a,b) ((a)<(b)?(a):(b)) #endif /* CONSIDER: mutt has a nicer way of way of doing debugging output... maybe * switch to like that. */ #ifndef DEBUGGING #define DEBUG if (0) neon_debug #else /* DEBUGGING */ #define DEBUG neon_debug #endif /* DEBUGGING */ #define DEBUG_SOCKET (1<<0) #define DEBUG_HTTP (1<<1) #define DEBUG_XML (1<<2) #define DEBUG_HTTPAUTH (1<<3) #define DEBUG_HTTPPLAIN (1<<4) #define DEBUG_LOCKS (1<<5) #define DEBUG_XMLPARSE (1<<6) #define DEBUG_HTTPBODY (1<<7) #define DEBUG_HTTPBASIC (1<<8) #define DEBUG_FLUSH (1<<30) void neon_debug_init(FILE *stream, int mask); extern int neon_debug_mask; void neon_debug(int ch, const char *, ...) #ifdef __GNUC__ __attribute__ ((format (printf, 2, 3))) #endif /* __GNUC__ */ ; /* Storing an HTTP status result */ typedef struct { int major_version; int minor_version; int code; /* Status-Code value */ /* We can't use 'class' as the member name since this crashes * with the C++ reserved keyword 'class', annoyingly. * This was '_class' previously, but that was even MORE annoying. * So know it is klass. */ int klass; /* Class of Status-Code (1-5) */ const char *reason_phrase; } http_status; /* Parser for strings which follow the Status-Line grammar from * RFC2616. * Returns: * 0 on success, *s will be filled in. * -1 on parse error. */ int http_parse_statusline(const char *status_line, http_status *s); END_NEON_DECLS #endif /* HTTP_UTILS_H */ avfs-1.0.5/libneon/base64.c0000644000175000017500000000556213102441254015124 0ustar michaelmichael/* Text->Base64 convertion, from RFC1521 Copyright (C) 1999-2001 Joe Orton 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 */ #ifdef HAVE_CONFIG_H #include "config.h" #endif #ifdef HAVE_STDLIB_H #include #endif #ifdef HAVE_STRING_H #include #endif #include "ne_alloc.h" #include "base64.h" /* Base64 specification from RFC 1521 */ static const char b64_alphabet[65] = { "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789+/=" }; char *base64(const char *text) { /* The tricky thing about this is doing the padding at the end, * doing the bit manipulation requires a bit of concentration only */ char *buffer, *point; int inlen, outlen; /* Use 'buffer' to store the output. Work out how big it should be... * This must be a multiple of 4 bytes */ inlen = strlen(text); outlen = (inlen*4)/3; if ((inlen % 3) > 0) /* got to pad */ outlen += 4 - (inlen % 3); buffer = ne_malloc(outlen + 1); /* +1 for the \0 */ /* now do the main stage of conversion, 3 bytes at a time, * leave the trailing bytes (if there are any) for later */ for (point=buffer; inlen>=3; inlen-=3, text+=3) { *(point++) = b64_alphabet[ (*text)>>2 ]; *(point++) = b64_alphabet[ ((*text)<<4 & 0x30) | (*(text+1))>>4 ]; *(point++) = b64_alphabet[ ((*(text+1))<<2 & 0x3c) | (*(text+2))>>6 ]; *(point++) = b64_alphabet[ (*(text+2)) & 0x3f ]; } /* Now deal with the trailing bytes */ if (inlen > 0) { /* We always have one trailing byte */ *(point++) = b64_alphabet[ (*text)>>2 ]; *(point++) = b64_alphabet[ (((*text)<<4 & 0x30) | (inlen==2?(*(text+1))>>4:0)) ]; *(point++) = (inlen==1?'=':b64_alphabet[ (*(text+1))<<2 & 0x3c ]); *(point++) = '='; } /* Null-terminate */ *point = '\0'; return buffer; } #ifdef BASE64_TEST /* Standalone tester */ #include /* Tester for Base64 algorithm */ int main(int argc, char **argv) { char *out; if (argc != 2) { printf("Usage: %s plaintext\n", argv[0]); exit(-1); } out = base64(argv[1]); printf("Plain: [%s], Base64: [%s]\n", argv[1], out); return 0; } #endif /* BASE64_TEST */ avfs-1.0.5/src/0000755000175000017500000000000013102441321013020 5ustar michaelmichaelavfs-1.0.5/src/utils.c0000644000175000017500000001631613102441254014340 0ustar michaelmichael/* 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.0.5/src/archutil.c0000644000175000017500000001076113102441254015011 0ustar michaelmichael/* 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.0.5/src/parsels.c0000644000175000017500000003447413102441254014656 0ustar michaelmichael/* 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.0.5/src/bzread.c0000644000175000017500000002714413102441254014450 0ustar michaelmichael/* 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.0.5/src/alloc.c0000644000175000017500000000323413102441254014265 0ustar michaelmichael/* 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.0.5/src/archive.c0000644000175000017500000003375413102441254014626 0ustar michaelmichael/* 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.0.5/src/socket.c0000644000175000017500000000374413102441254014471 0ustar michaelmichael/* 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.0.5/src/Makefile.am0000644000175000017500000000177213102441254015070 0ustar michaelmichaelEXTRA_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 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.0.5/src/mod_static.h0000644000175000017500000000037313102441254015327 0ustar michaelmichael/* 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.0.5/src/ugid.c0000644000175000017500000001066613102441254014132 0ustar michaelmichael/* 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.0.5/src/serialfile.c0000644000175000017500000002413013102441254015310 0ustar michaelmichael/* 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.0.5/src/filecache.c0000644000175000017500000000724013102441254015077 0ustar michaelmichael/* 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.0.5/src/namespace.c0000644000175000017500000002331113102441254015125 0ustar michaelmichael/* 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.0.5/src/modload.c0000644000175000017500000000526413102441254014617 0ustar michaelmichael/* 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.0.5/src/passwords.c0000644000175000017500000001343213102441254015221 0ustar michaelmichael/* 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.0.5/src/exit.c0000644000175000017500000000156313102441254014147 0ustar michaelmichael/* 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.0.5/src/parse.c0000644000175000017500000005307413102441254014314 0ustar michaelmichael/* 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 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 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); if(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.0.5/src/remote.c0000644000175000017500000005426313102441254014476 0ustar michaelmichael/* 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.0.5/src/cache.c0000644000175000017500000002321313102441254014235 0ustar michaelmichael/* 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.0.5/src/local.h0000644000175000017500000000037013102441254014270 0ustar michaelmichael/* 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.0.5/src/virtual.c0000644000175000017500000003151513102441254014664 0ustar michaelmichael/* 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.0.5/src/sysdeps.c0000644000175000017500000001443313102441254014670 0ustar michaelmichael/* 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.0.5/src/filtprog.h0000644000175000017500000000066113102441254015027 0ustar michaelmichael/* 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.0.5/src/make_info0000755000175000017500000000101713102441254014702 0ustar michaelmichael#! /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.0.5/src/default.c0000644000175000017500000001007113102441254014614 0ustar michaelmichael/* 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; } avfs-1.0.5/src/xzread.c0000644000175000017500000001613413102441254014473 0ustar michaelmichael/* 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.0.5/src/zread.c0000644000175000017500000003472013102441254014304 0ustar michaelmichael/* 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 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; avuint crc; vfile *infile; avoff_t dataoff; char inbuf[INBUFSIZE]; }; #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; 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_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->calccrc && fil->s.adler != fil->crc) { av_log(AVLOG_ERROR, "ZFILE: CRC error"); return -EIO; } AV_LOCK(zread_lock); if(fil->calccrc) zc->crc_ok = 1; zc->size = fil->s.total_out; AV_UNLOCK(zread_lock); 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, int calccrc) { 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 = calccrc; 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; 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.0.5/src/archint.h0000644000175000017500000000110413102441254014622 0ustar michaelmichael/* 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.0.5/src/Makefile.in0000644000175000017500000005441113102441265015101 0ustar michaelmichael# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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 subdir = src DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp $(noinst_HEADERS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/neon-ssl.m4 \ $(top_srcdir)/macros/neon-xml-parser.m4 \ $(top_srcdir)/macros/neon.m4 $(top_srcdir)/macros/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) 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 @USE_LIBLZMA_TRUE@am__objects_1 = xzread.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) 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__depfiles_maybe = depfiles 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 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@ EMACS = @EMACS@ 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@ KERNINCLUDE = @KERNINCLUDE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEONLIBS = @NEONLIBS@ NEONOBJS = @NEONOBJS@ NEON_BUILD_BUNDLED = @NEON_BUILD_BUNDLED@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ NEON_OBJEXT = @NEON_OBJEXT@ NEON_TARGET = @NEON_TARGET@ 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@ PRELOAD_LIBS = @PRELOAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ XML_CONFIG = @XML_CONFIG@ 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@ avfscoda_build = @avfscoda_build@ 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@ initstyle = @initstyle@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ kmoduledir = @kmoduledir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ preload_build = @preload_build@ profiledir = @profiledir@ program_transform_name = @program_transform_name@ psdir = @psdir@ rcdir = @rcdir@ rcscriptdir = @rcscriptdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ start_levels = @start_levels@ start_prio = @start_prio@ stop_levels = @stop_levels@ stop_prio = @stop_prio@ 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) 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 .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(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@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/archive.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/archutil.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bzread.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/default.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/exit.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fdops.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filebuf.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filecache.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filter.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filtprog.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/local.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/modload.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/namespace.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/oper.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parse.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parsels.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/passwords.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/prog.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/realfile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/remote.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/runprog.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/serialfile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/socket.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/state.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sysdeps.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tmpfile.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ugid.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/virtual.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xzread.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/zread.Plo@am__quote@ .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 $< .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 `$(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: $(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: 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 -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-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 -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: all check install install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am 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 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.0.5/src/tmpfile.c0000644000175000017500000000732313102441254014636 0ustar michaelmichael/* 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.0.5/src/oper.c0000644000175000017500000002667113102441254014152 0ustar michaelmichael/* 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.0.5/src/state.c0000644000175000017500000002304313102441254014313 0ustar michaelmichael/* 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.0.5/src/local.c0000644000175000017500000002360613102441254014272 0ustar michaelmichael/* 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.0.5/src/realfile.c0000644000175000017500000000442313102441254014757 0ustar michaelmichael/* 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.0.5/src/filter.c0000644000175000017500000003020313102441254014454 0ustar michaelmichael/* 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.0.5/src/filebuf.c0000644000175000017500000001250413102441254014607 0ustar michaelmichael/* 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.0.5/src/runprog.c0000644000175000017500000001122713102441254014670 0ustar michaelmichael/* 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.0.5/src/prog.c0000644000175000017500000000500113102441254014134 0ustar michaelmichael/* 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.0.5/src/fdops.c0000644000175000017500000001145313102441254014310 0ustar michaelmichael/* 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.0.5/src/filtprog.c0000644000175000017500000001642013102441254015022 0ustar michaelmichael/* 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.0.5/bzlib/0000755000175000017500000000000013102441322013334 5ustar michaelmichaelavfs-1.0.5/bzlib/Makefile.am0000644000175000017500000000056713102441254015404 0ustar michaelmichaelcppflags = -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.0.5/bzlib/compress.c0000644000175000017500000005012113102441254015336 0ustar michaelmichael /*-------------------------------------------------------------*/ /*--- 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.6 of 6 September 2010 Copyright (C) 1996-2010 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 <= (2 + (900000 / BZ_G_SIZE)), 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 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.0.5/bzlib/bzlib.c0000644000175000017500000013427113102441254014616 0ustar michaelmichael/* 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.6 of 6 September 2010 Copyright (C) 1996-2010 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 me at: jseward@bzip.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. Julian Seward, 10 December 2007.\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.0.5/bzlib/crctable.c0000644000175000017500000001132213102441254015262 0ustar michaelmichael /*-------------------------------------------------------------*/ /*--- 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.6 of 6 September 2010 Copyright (C) 1996-2010 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.0.5/bzlib/bzlib_private.h0000644000175000017500000003261713102441254016356 0ustar michaelmichael/* 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.6 of 6 September 2010 Copyright (C) 1996-2010 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.6, 6-Sept-2010" 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.0.5/bzlib/Makefile.in0000644000175000017500000006416413102441264015421 0ustar michaelmichael# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp $(noinst_HEADERS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/neon-ssl.m4 \ $(top_srcdir)/macros/neon-xml-parser.m4 \ $(top_srcdir)/macros/neon.m4 $(top_srcdir)/macros/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) 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__depfiles_maybe = depfiles 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 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@ EMACS = @EMACS@ 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@ KERNINCLUDE = @KERNINCLUDE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEONLIBS = @NEONLIBS@ NEONOBJS = @NEONOBJS@ NEON_BUILD_BUNDLED = @NEON_BUILD_BUNDLED@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ NEON_OBJEXT = @NEON_OBJEXT@ NEON_TARGET = @NEON_TARGET@ 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@ PRELOAD_LIBS = @PRELOAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ XML_CONFIG = @XML_CONFIG@ 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@ avfscoda_build = @avfscoda_build@ 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@ initstyle = @initstyle@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ kmoduledir = @kmoduledir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ preload_build = @preload_build@ profiledir = @profiledir@ program_transform_name = @program_transform_name@ psdir = @psdir@ rcdir = @rcdir@ rcscriptdir = @rcscriptdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ start_levels = @start_levels@ start_prio = @start_prio@ stop_levels = @stop_levels@ stop_prio = @stop_prio@ 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 .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(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@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbz_la-bzlib.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbz_la-compress.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbz_la-crctable.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbz_la-decompress.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbz_la-huffman.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libbz_la-randtable.Plo@am__quote@ .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 $< .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 `$(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: $(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 -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-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 -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am 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 # 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.0.5/bzlib/randtable.c0000644000175000017500000000742413102441254015447 0ustar michaelmichael /*-------------------------------------------------------------*/ /*--- 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.6 of 6 September 2010 Copyright (C) 1996-2010 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.0.5/bzlib/decompress.c0000644000175000017500000005066713102441254015666 0ustar michaelmichael /*-------------------------------------------------------------*/ /*--- 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.6 of 6 September 2010 Copyright (C) 1996-2010 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 > 6) 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); } s->selectorMtf[i] = j; } /*--- 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 ---*/ /*-------------------------------------------------------------*/ avfs-1.0.5/bzlib/bzconf.h0000644000175000017500000000735213102441254015001 0ustar michaelmichael/* 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.0.5/bzlib/huffman.c0000644000175000017500000001551713102441254015141 0ustar michaelmichael /*-------------------------------------------------------------*/ /*--- 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.6 of 6 September 2010 Copyright (C) 1996-2010 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.0.5/bzlib/blocksort.c0000644000175000017500000007374613102441254015527 0ustar michaelmichael /*-------------------------------------------------------------*/ /*--- 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.6 of 6 September 2010 Copyright (C) 1996-2010 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] |= (1 << ((zz) & 31)) #define CLEAR_BH(zz) bhtab[(zz) >> 5] &= ~(1 << ((zz) & 31)) #define ISSET_BH(zz) (bhtab[(zz) >> 5] & (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.0.5/bzlib/bzlib.h0000644000175000017500000001541213102441254014616 0ustar michaelmichael/* 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.6 of 6 September 2010 Copyright (C) 1996-2010 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.0.5/avfscoda/0000755000175000017500000000000013102441322014020 5ustar michaelmichaelavfs-1.0.5/avfscoda/avfscoda.h0000644000175000017500000000125013102441254015761 0ustar michaelmichael/* 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 struct child_message { int reqsize; int path1size; int path2size; }; extern void run(int cfs, const char *codadir, int dm); extern void child_process(int infd, int outfd); extern int mount_coda(const char *dev, const char *dir, int devfd, int quiet); extern int unmount_coda(const char *dir, int quiet); extern void set_signal_handlers(); extern void clean_exit(int status); extern void run_exit(); extern void user_child(pid_t pid); avfs-1.0.5/avfscoda/Makefile.am0000644000175000017500000000121513102441254016057 0ustar michaelmichaelEXTRA_DIST = redir/Makefile.in redir/redir.c noinst_HEADERS = avfscoda.h if INSTALL_AVFSCODA sbin_PROGRAMS = avfscoda AM_CFLAGS = -I$(top_srcdir)/include -DCODAINCLUDE=\"@KERNINCLUDE@/linux/coda.h\" @CFLAGS@ @CPPFLAGS@ avfscoda_LDFLAGS = @LDFLAGS@ @LIBS@ avfscoda_LDADD = ../lib/libavfs_static.la avfscoda_DEPENDENCIES = redir_module avfscoda_SOURCES = \ avfscoda.c \ mount.c \ dispatch.c \ child.c redir_module: ( cd redir && make ) install-exec-hook: ( cd redir && make install ) uninstall-hook: ( cd redir && make uninstall ) CLEANFILES = redir/redir.o else install-exec-hook: uninstall-hook: endif avfs-1.0.5/avfscoda/mount.c0000644000175000017500000000473213102441254015340 0ustar michaelmichael/* 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 #include #include #include #include #include #include #include CODAINCLUDE int mount_coda(const char *dev, const char *dir, int devfd, int quiet) { int res; const char *type; FILE *fd; struct mntent ent; void *mntdata = NULL; #ifdef CODA_MOUNT_VERSION struct coda_mount_data data; data.version = CODA_MOUNT_VERSION; data.fd = devfd; mntdata = &data; #endif type = "coda"; res = mount("coda", dir, type, MS_MGC_VAL | MS_NOSUID | MS_NODEV, mntdata); if(res == -1) { if(!quiet) fprintf(stderr, "mount failed: %s\n", strerror(errno)); return -1; } fd = setmntent("/etc/mtab", "a"); if(fd == NULL) { fprintf(stderr, "setmntent(\"/etc/mtab\") failed: %s\n", strerror(errno)); return -1; } ent.mnt_fsname = (char *) dev; ent.mnt_dir = (char *) dir; ent.mnt_type = (char *) type; ent.mnt_opts = "rw,nosuid,nodev"; ent.mnt_freq = 0; ent.mnt_passno = 0; res = addmntent(fd, & ent); if(res != 0) { fprintf(stderr, "addmntent() failed: %s\n", strerror(errno)); } endmntent(fd); return 0; } int unmount_coda(const char *dir, int quiet) { int res; FILE *fdold, *fdnew; struct mntent *entp; res = umount(dir); if(res == -1) { if(!quiet) fprintf(stderr, "umount failed: %s\n", strerror(errno)); return -1; } fdold = setmntent("/etc/mtab", "r"); if(fdold == NULL) { fprintf(stderr, "setmntent(\"/etc/mtab\") failed: %s\n", strerror(errno)); return -1; } fdnew = setmntent("/etc/mtab~", "w"); if(fdnew == NULL) { fprintf(stderr, "setmntent(\"/etc/mtab~\") failed: %s\n", strerror(errno)); return -1; } do { entp = getmntent(fdold); if(entp != NULL) { if(strcmp(entp->mnt_dir, dir) != 0) { res = addmntent(fdnew, entp); if(res != 0) { fprintf(stderr, "addmntent() failed: %s\n", strerror(errno)); } } } } while(entp != NULL); endmntent(fdold); endmntent(fdnew); res = rename("/etc/mtab~", "/etc/mtab"); if(res == -1) { fprintf(stderr, "rename(\"/etc/mtab~\", \"/etc/mtab\") failed: %s\n", strerror(errno)); return -1; } return 0; } avfs-1.0.5/avfscoda/avfscoda.c0000644000175000017500000001160713102441254015763 0ustar michaelmichael/* 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 #include #include #include #include #include #include #include #include #include "avfscoda.h" #define DEFAULT_DEV "/dev/cfs0" #define SECONDARY_DEV "/dev/cfs1" #define DEFAULT_DEVFS_DEV "/dev/coda/0" #define SECONDARY_DEVFS_DEV "/dev/coda/1" #define DEFAULT_DIR "/overlay" static pid_t mount_pid = -1; static pid_t main_pid = -1; void clean_exit(int status) { /* Just in case */ if(getpid() != main_pid) exit(status); run_exit(); if(mount_pid != -1) kill(mount_pid, SIGKILL); exit(status); } static void exit_handler(int sig) { clean_exit(0); } static void child_handler(int sig) { int status; pid_t pid; pid = wait(&status); if(pid == -1) { perror("Error calling wait()"); return; } if(pid != mount_pid) { user_child(pid); } else { if(!WIFEXITED(status) || WEXITSTATUS(status) != 0) { fprintf(stderr, "Mount child exited with an error\n"); clean_exit(1); } mount_pid = -1; } } void set_signal_handlers() { struct sigaction sa; sa.sa_handler = exit_handler; sigemptyset(&(sa.sa_mask)); sa.sa_flags = 0; if (sigaction(SIGHUP, &sa, NULL) == -1 || sigaction(SIGINT, &sa, NULL) == -1 || sigaction(SIGTERM, &sa, NULL) == -1) { perror("Cannot set exit signal handlers"); clean_exit(1); } sa.sa_handler = SIG_IGN; if(sigaction(SIGPIPE, &sa, NULL) == -1) { perror("Cannot set ignored signals"); clean_exit(1); } } static void turn_off_avfs() { struct stat stbuf; if(stat("/@avfs-off", &stbuf) == -1 && errno == EEXIST) fprintf(stderr, "Succesfuly turned off AVFS\n"); else fprintf(stderr, "AVFS cannot be turned off\n"); #if 0 if(stat("/@avfsstat", &stbuf) == 0) { fprintf(stderr, "Cannot start, because AVFS is already loaded\n"); exit(1); } #endif } static const char *progname; static void usage() { fprintf(stderr, "usage: %s [-h] [-d] [coda_dev [dir]]\n" " -h print this help\n" " -d debug mode (do not run in background)\n" " coda_dev coda device (default: %s)\n" " dir mountpoint (default: %s)\n", progname, DEFAULT_DEV, DEFAULT_DIR); exit(1); } int main(int argc, char *argv[]) { int cfs; int res; pid_t pid; const char *codadev = DEFAULT_DEV; const char *codadir = DEFAULT_DIR; struct sigaction sa; int devnull; int ctr; int debugmode = 0; progname = argv[0]; ctr = 1; if(argc > ctr && argv[ctr][0] == '-') { if(argv[ctr][1] == 'h') usage(); else if(argv[ctr][1] == 'd') debugmode = 1; else usage(); ctr++; } if(argc > ctr) { codadev = argv[ctr]; ctr++; } if(argc > ctr) { codadir = argv[ctr]; ctr++; } if(!debugmode) { setsid(); /* Run in background */ devnull = open("/dev/null", O_RDWR); if(devnull == -1) { perror("Could not open '/dev/null'"); exit(1); } pid = fork(); if(pid == -1) { perror("Could not fork"); exit(1); } else if(pid != 0) { /* parent */ return 0; } dup2(devnull, 0); dup2(devnull, 1); dup2(devnull, 2); } turn_off_avfs(); unmount_coda(codadir, 1); cfs = open(codadev, O_RDWR); if(cfs == -1 && errno == ENODEV) { /* try inserting module first */ mount_coda(codadev, codadir, 0, 1); cfs = open(codadev, O_RDWR); } if(cfs == -1) { codadev = SECONDARY_DEV; cfs = open(codadev, O_RDWR); } if(cfs == -1) { codadev = DEFAULT_DEVFS_DEV; cfs = open(codadev, O_RDWR); } if(cfs == -1) { codadev = SECONDARY_DEVFS_DEV; cfs = open(codadev, O_RDWR); } if(cfs == -1) { fprintf(stderr, "Error opening '%s': %s\n", codadev, strerror(errno)); exit(1); } sa.sa_handler = child_handler; sigemptyset(&(sa.sa_mask)); sa.sa_flags = SA_NOCLDSTOP; if(sigaction(SIGCHLD, &sa, NULL) == -1) { perror("Cannot set SIGCHLD handler"); exit(1); } pid = mount_pid = fork(); if(pid == -1) { perror("fork() failed"); close(cfs); exit(1); } if(pid == 0) { /* Child */ res = mount_coda(codadev, codadir, cfs, 0); if(res == -1) exit(1); exit(0); } fprintf(stderr, "Mount pid: %i\n", mount_pid); main_pid = getpid(); fprintf(stderr, "Main pid: %i\n", main_pid); run(cfs, codadir, debugmode); return 0; } avfs-1.0.5/avfscoda/dispatch.c0000644000175000017500000011463313102441254015777 0ustar michaelmichael/* 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 "avfscoda.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #include /* #include "KERNINCLUDE/linux/coda.h" */ #include CODAINCLUDE /* Keep file lookups cached for at least this many seconds: */ #define KEEPTIME 600 /* Flush attribute caches after this many seconds */ #define FLUSHTIME 2 /* Keep at most this many looked up files cached: */ #define MAXFILES 5000 /* Check looked up files after this many operations: */ #define CHECKNUM 1000 /* Maximum number of child processes running: */ #define MAXUSERS 10 #define MAXMSGLEN 1045 struct operation { struct operation *next; union inputArgs *req; char ibuf[MAXMSGLEN]; }; struct userinfo { uid_t uid; gid_t gid; volatile pid_t serverpid; int pipout; int pipin; time_t lastuse; int terminated; struct operation *ops; }; static struct userinfo currusers[MAXUSERS]; static int codafd; static const char *codadir; static FILE *logfile; static int numfids; static int checknum; static int debugmode; struct openfile { pid_t pid; char *tmpfile; int fd; int use; int wuse; struct openfile *next; }; struct fileinfo { struct fileinfo *prev; struct fileinfo *next; char *name; char *path; unsigned int unique; unsigned int parunique; time_t lasttime; int use; struct openfile *ofs; }; #define FMAPSIZE 65536 static struct fileinfo *fmap[FMAPSIZE]; static unsigned int nextunique = 0; #define HASHSIZE 6247 static struct fileinfo *fhash[HASHSIZE]; static int needflush; static struct fileinfo unused_files; static void log(const char *, ...) __attribute__ ((format (printf, 1, 2))); static void log(const char *fmt, ...) { if(debugmode) { va_list ap; va_start(ap, fmt); vfprintf(logfile, fmt, ap); va_end(ap); } } static void log_date() { if(debugmode) { struct tm tm; struct timeval tv; gettimeofday(&tv, NULL); localtime_r(&tv.tv_sec, &tm); log("%02i/%02i %02i:%02i:%02i.%03i\n", tm.tm_mon + 1, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, (int) (tv.tv_usec / 1000)); } } #define LOGMSG_SIZE 1024 static void logerr(const char *, ...) __attribute__ ((format (printf, 1, 2))); static void logerr(const char *fmt, ...) { char buf[LOGMSG_SIZE + 1]; va_list ap; va_start(ap, fmt); vsnprintf(buf, LOGMSG_SIZE, fmt, ap); va_end(ap); buf[LOGMSG_SIZE] = '\0'; syslog(LOG_INFO, "%s", buf); log(buf); } static unsigned int fi_hash(unsigned int unique, const char *name) { unsigned int hash = unique; for(; *name != 0; name++) { hash = (hash << 4) | (hash >> 28); hash ^= (unsigned int) *name; } return hash % HASHSIZE; } static struct fileinfo *remove_name(struct fileinfo *parentdir, const char *name) { struct fileinfo **fip; unsigned int hash = fi_hash(parentdir->unique, name); for(fip = &fhash[hash]; *fip != NULL; fip = &(*fip)->next) { struct fileinfo *fi = *fip; if(fi->parunique == parentdir->unique && strcmp(fi->name, name) == 0) { *fip = fi->next; return fi; } } return NULL; } static void add_name(struct fileinfo *fi, struct fileinfo *parentdir, const char *name, int hash) { fi->next = fhash[hash]; fhash[hash] = fi; fi->name = strdup(name); fi->parunique = parentdir->unique; fi->path = (char *) malloc(strlen(parentdir->path) + 1 + strlen(name) + 1); sprintf(fi->path, "%s/%s", parentdir->path, name); } static void rename_file(struct fileinfo *oldfi, const char *oldname, struct fileinfo *newfi, const char *newname) { struct fileinfo *fi; fi = remove_name(oldfi, oldname); if(fi != NULL) { unsigned int hash = fi_hash(newfi->unique, newname); free(fi->name); free(fi->path); add_name(fi, newfi, newname, hash); } } static struct fileinfo *get_file(struct fileinfo *parentdir, const char *name) { unsigned int hash = fi_hash(parentdir->unique, name); struct fileinfo *fi; int i; for(fi = fhash[hash]; fi != NULL; fi = fi->next) if(fi->parunique == parentdir->unique && strcmp(fi->name, name) == 0) return fi; fi = malloc(sizeof(*fi)); if(fi == NULL) { logerr("Out of memory"); clean_exit(1); } for(i = 0; i < FMAPSIZE; i++) { unsigned int index; nextunique ++; if(nextunique == 0) nextunique = 1; index = nextunique % FMAPSIZE; if(fmap[index] == NULL) { fmap[index] = fi; fi->unique = nextunique; break; } } if(i == FMAPSIZE) { logerr("fmap full\n"); clean_exit(1); } log("New fid: 0x%x\n", fi->unique); numfids ++; fi->lasttime = time(NULL); fi->ofs = NULL; fi->use = 0; add_name(fi, parentdir, name, hash); return fi; } static void put_file(struct fileinfo *fi) { struct fileinfo *prev; struct fileinfo *next; log("Put fid: 0x%x\n", fi->unique); prev = unused_files.prev; next = &unused_files; prev->next = fi; next->prev = fi; fi->next = next; fi->prev = prev; free(fi->name); fi->name = NULL; } static void remove_file(struct fileinfo *parentdir, const char *name) { struct fileinfo *fi; fi = remove_name(parentdir, name); if(fi != NULL) put_file(fi); } static void delete_file(struct fileinfo *fi) { unsigned int index; struct fileinfo *prev = fi->prev; struct fileinfo *next = fi->next; log("Delete fid: 0x%x\n", fi->unique); prev->next = next; next->prev = prev; index = fi->unique % FMAPSIZE; fmap[index] = NULL; free(fi->name); free(fi->path); free(fi); numfids --; } static struct fileinfo *get_info(unsigned int unique) { struct fileinfo *fi; unsigned int index = (unique % FMAPSIZE); fi = fmap[index]; if(fi == NULL || fi->unique != unique) { logerr("Deleted Fid: 0x%x\n", unique); return NULL; } return fi; } static struct fileinfo *look_info(ViceFid *id) { struct fileinfo *fi; if ((id->Volume != 0) || (id->Vnode != 0)) { logerr("Bad handle passed %lx/%lx/%lx\n", id->Volume, id->Vnode, id->Unique ); clean_exit(1); } log("unique: 0x%x\n", (unsigned int) id->Unique); if(id->Unique == 0) { static struct fileinfo rootinfo; rootinfo.path = "/"; return &rootinfo; } else { fi = get_info(id->Unique); if(fi != NULL) fi->lasttime = time(NULL); return fi; } } static char *look_name(ViceFid *id) { struct fileinfo *fi; fi = look_info(id); if(fi == NULL) return NULL; log("path: %s\n", fi->path); return fi->path; } static void ref_fid(ViceFid *fid) { struct fileinfo *fi = look_info(fid); if(fi != NULL) fi->use ++; } static void unref_fid(ViceFid *fid) { struct fileinfo *fi = look_info(fid); if(fi != NULL) fi->use --; } static void reset_signal_handlers() { struct sigaction sa; sa.sa_handler = SIG_DFL; sigemptyset(&(sa.sa_mask)); sa.sa_flags = 0; sigaction(SIGPIPE, &sa, NULL); sigaction(SIGCHLD, &sa, NULL); } static void send_to_kernel(union outputArgs *rep, int size) { int ret; log("%i bytes\n", size); ret = write(codafd, rep, size); if(ret == -1 || ret != size) { logerr("Error writing to device: %s\n", strerror(errno)); } } static struct fileinfo *create_file(const char *filename, ViceFid *parentid, ViceFid *newid) { struct fileinfo *fi; fi = look_info(parentid); if(fi == NULL) return NULL; fi = get_file(fi, filename); newid->Volume = 0; newid->Vnode = 0; newid->Unique = fi->unique; return fi; } static void purge_file(struct fileinfo *fi) { union outputArgs rep; log("=================================================================\n"); log_date(); log("Cleaning out 0x%x\n", fi->unique); log("CODA_PURGEFID\n"); rep.oh.opcode = CODA_PURGEFID; rep.oh.result = 0; rep.oh.unique = 0; rep.coda_purgefid.CodaFid.Volume = 0; rep.coda_purgefid.CodaFid.Vnode = 0; rep.coda_purgefid.CodaFid.Unique = fi->unique; send_to_kernel(&rep, sizeof(rep.coda_purgefid)); } static void zap_file(struct fileinfo *fi) { union outputArgs rep; log("=================================================================\n"); log_date(); log("Cleaning out 0x%x\n", fi->unique); log("CODA_ZAPFILE\n"); rep.oh.opcode = CODA_ZAPFILE; rep.oh.result = 0; rep.oh.unique = 0; rep.coda_zapfile.CodaFid.Volume = 0; rep.coda_zapfile.CodaFid.Vnode = 0; rep.coda_zapfile.CodaFid.Unique = fi->unique; send_to_kernel(&rep, sizeof(rep.coda_zapfile)); } #if 0 static void zap_dir(struct fileinfo *fi) { union outputArgs rep; log("=================================================================\n"); log_date(); log("Cleaning out 0x%x\n", fi->unique); log("CODA_ZAPDIR\n"); rep.oh.opcode = CODA_ZAPDIR; rep.oh.result = 0; rep.oh.unique = 0; rep.coda_zapdir.CodaFid.Volume = 0; rep.coda_zapdir.CodaFid.Vnode = 0; rep.coda_zapdir.CodaFid.Unique = fi->unique; send_to_kernel(&rep, sizeof(rep.coda_zapdir)); } #endif static void clean_up(time_t oldtime) { int i; for(i = 0; i < HASHSIZE; i++) { struct fileinfo **fip = &fhash[i]; while(*fip != NULL) { struct fileinfo *fi = *fip; if((!oldtime || fi->lasttime < oldtime) && fi->use == 0) { *fip = fi->next; purge_file(fi); put_file(fi); } else fip = &fi->next; } } } static void clean_up_unused() { struct fileinfo *fi; for(fi = unused_files.next; fi != &unused_files;) { struct fileinfo *nextfi = fi->next; if(fi->use == 0) delete_file(fi); fi = nextfi; } } static void clean_up_names() { clean_up_unused(); if(numfids > FMAPSIZE / 2) clean_up(0); else clean_up(time(NULL) - KEEPTIME); } static void open_file(union inputArgs *req, struct openfile *of) { int ret; union outputArgs rep; struct stat stbuf; rep.oh.opcode = req->ih.opcode; rep.oh.unique = req->ih.unique; if(req->ih.opcode == CODA_OPEN) { ret = stat(of->tmpfile, &stbuf); if(ret == -1) rep.oh.result = errno; else { rep.oh.result = 0; rep.coda_open.dev = stbuf.st_dev; rep.coda_open.inode = stbuf.st_ino; log("dev: %lli, ino: %lli\n", rep.coda_open.dev, rep.coda_open.inode); log("size: %lli\n", stbuf.st_size); of->use ++; if((req->coda_open.flags & (C_O_WRITE | C_O_TRUNC)) != 0) of->wuse ++; } send_to_kernel(&rep, sizeof(rep.coda_open)); } #ifdef CODA_OPEN_BY_FD else { if(of->fd == -1) { of->fd = open(of->tmpfile, O_RDONLY); if(of->fd == -1) rep.oh.result = errno; } if(of->fd != -1) { rep.oh.result = 0; rep.coda_open_by_fd.fd = of->fd; log("fd: %i\n", of->fd); of->use ++; if((req->coda_open.flags & (C_O_WRITE | C_O_TRUNC)) != 0) of->wuse ++; } send_to_kernel(&rep, sizeof(rep.coda_open_by_fd)); } #endif } static void del_file(const char *tmpname) { int res; /* Coda holds on to the inode, so to free up space: */ truncate(tmpname, 0); res = unlink(tmpname); if(res == -1) fprintf(stderr, "unlink(%s) failed (%s)\n", tmpname, strerror(errno)); } static void close_file(struct openfile *of, struct openfile **ofp, ViceFid *fid) { if(of->use > 0) of->use --; if(of->use == 0 && of->tmpfile != NULL) { if(of->fd != -1) close(of->fd); del_file(of->tmpfile); free(of->tmpfile); *ofp = of->next; free(of); unref_fid(fid); } } static void reply(union inputArgs *req, int res) { union outputArgs rep; rep.oh.opcode = req->ih.opcode; rep.oh.unique = req->ih.unique; rep.oh.result = res; send_to_kernel(&rep, sizeof(rep.oh)); } static void check_servers() { int i; for(i = 0; i < MAXUSERS; i++) { if(currusers[i].serverpid == 0) { /* FIXME: reply to the pending messages */ close(currusers[i].pipout); close(currusers[i].pipin); currusers[i].serverpid = -1; } } } static void grab_fids(union inputArgs *req) { /* All have first VFid in the same place */ ref_fid(&req->coda_getattr.VFid); if(req->ih.opcode == CODA_LINK) ref_fid(&req->coda_link.destFid); if(req->ih.opcode == CODA_RENAME) ref_fid(&req->coda_rename.destFid); } static void release_fids(union inputArgs *req) { /* All have first VFid in the same place */ unref_fid(&req->coda_getattr.VFid); if(req->ih.opcode == CODA_LINK) unref_fid(&req->coda_link.destFid); if(req->ih.opcode == CODA_RENAME) unref_fid(&req->coda_rename.destFid); } static void process_answer(struct userinfo *user) { int numread; char obuf[MAXMSGLEN]; union outputArgs *rep = (union outputArgs *) obuf; struct operation *op, **opp; struct fileinfo *fi; struct openfile *of, **ofp; char *filename; int insize; if(!needflush) needflush = time(NULL); numread = read(user->pipin, &insize, sizeof(insize)); if(numread == -1) { logerr("Error reading from device: %s\n", strerror(errno)); return; } if(insize > MAXMSGLEN || insize <= 0) { logerr("Error: illegal size"); return; } numread = read(user->pipin, obuf, insize); if(numread == -1) { logerr("Error reading from child [%i/%i]: %s\n", user->uid, user->gid, strerror(errno)); return; } log("+ %i/%i [%i] +++++++++++++++++++++++++++++++++++++++++++++++++++\n", user->uid, user->gid, user->serverpid); log_date(); log("%i (%i) bytes: opcode: %li, result: %i, unique: %li\n", numread, insize, rep->oh.opcode, (int) rep->oh.result, rep->oh.unique); for(opp = &user->ops; *opp != NULL; opp = &(*opp)->next) if((*opp)->req->ih.unique == rep->oh.unique) break; op = *opp; if(op == NULL) logerr("Operation not found!!!!\n"); else { log("Found operation: %li\n", op->req->ih.unique); switch(rep->oh.opcode) { #ifdef CODA_OPEN_BY_FD case CODA_OPEN_BY_FD: #endif case CODA_OPEN: fi = look_info(&op->req->coda_open.VFid); for(ofp = &fi->ofs; *ofp != NULL; ofp = &(*ofp)->next) if((*ofp)->pid == op->req->ih.pid) break; of = *ofp; if(of == NULL) { logerr("Output file not found!!!\n"); reply(op->req, ENOENT); } else { if(rep->oh.result == 0) { open_file(op->req, of); } else { close_file(of, ofp, &op->req->coda_open.VFid); send_to_kernel(rep, numread); } } break; case CODA_CLOSE: fi = look_info(&op->req->coda_close.VFid); for(ofp = &fi->ofs; *ofp != NULL; ofp = &(*ofp)->next) if((*ofp)->pid == op->req->ih.pid) break; of = *ofp; if(of == NULL) { logerr("Output file not found!!!\n"); reply(op->req, ENOENT); } else close_file(of, ofp, &op->req->coda_close.VFid); send_to_kernel(rep, numread); zap_file(fi); break; case CODA_LOOKUP: if(rep->oh.result == 0) { filename = (char *) op->req + op->req->coda_lookup.name; fi = create_file(filename, &op->req->coda_lookup.VFid, &rep->coda_lookup.VFid); if(fi == NULL) rep->oh.result = ENOENT; } send_to_kernel(rep, numread); break; case CODA_CREATE: if(rep->oh.result == 0) { filename = (char *) op->req + op->req->coda_create.name; fi = create_file(filename, &op->req->coda_create.VFid, &rep->coda_create.VFid); if(fi == NULL) rep->oh.result = ENOENT; } send_to_kernel(rep, numread); break; case CODA_MKDIR: if(rep->oh.result == 0) { filename = (char *) op->req + op->req->coda_mkdir.name; fi = create_file(filename, &op->req->coda_mkdir.VFid, &rep->coda_mkdir.VFid); if(fi == NULL) rep->oh.result = ENOENT; } send_to_kernel(rep, numread); break; case CODA_REMOVE: if(rep->oh.result == 0) { filename = (char *) op->req + op->req->coda_remove.name; fi = look_info(&op->req->coda_remove.VFid); remove_file(fi, filename); } send_to_kernel(rep, numread); break; case CODA_RMDIR: if(rep->oh.result == 0) { filename = (char *) op->req + op->req->coda_rmdir.name; fi = look_info(&op->req->coda_rmdir.VFid); remove_file(fi, filename); } send_to_kernel(rep, numread); break; case CODA_RENAME: if(rep->oh.result == 0) { char *newname; struct fileinfo *newfi; newname = (char *) op->req + op->req->coda_rename.destname; newfi = look_info(&op->req->coda_rename.destFid); remove_file(newfi, newname); filename = (char *) op->req + op->req->coda_rename.srcname; fi = look_info(&op->req->coda_rename.sourceFid); rename_file(fi, filename, newfi, newname); } send_to_kernel(rep, numread); break; default: send_to_kernel(rep, numread); } release_fids(op->req); *opp = op->next; free(op); } if(user->ops != NULL) { log("Remaining operations: "); for(op = user->ops; op != NULL; op = op->next) log("%li ", op->req->ih.unique); log("\n"); } } static void process_child_answer() { fd_set rfds; int ret; int maxfd; int i; check_servers(); FD_ZERO(&rfds); maxfd = 0; for(i = 0; i < MAXUSERS; i++) { if(currusers[i].serverpid > 0) { int pipfd = currusers[i].pipin; FD_SET(pipfd, &rfds); if(pipfd > maxfd) maxfd = pipfd; } } ret = select(maxfd+1, &rfds, NULL, NULL, NULL); if(ret == -1) { if(errno != EINTR) logerr("Select failed: %s\n", strerror(errno)); } else { for(i = 0; i < MAXUSERS; i++) { if(currusers[i].serverpid > 0) { int pipfd = currusers[i].pipin; if(FD_ISSET(pipfd, &rfds)) process_answer(&currusers[i]); } } } } static void kill_child() { struct userinfo *user; time_t oldesttime; int oldesti; int i; pid_t pid; oldesttime = 0; oldesti = -1; do { for(i = 0; i < MAXUSERS; i++) { user = currusers + i; if(user->serverpid == -1) return; if(user->serverpid == 0) { check_servers(); return; } if(user->ops == NULL) { if(oldesti == -1 || user->lastuse < oldesttime) { oldesttime = user->lastuse; oldesti = i; } } } if(oldesti == -1) { /* If every child is busy then block */ process_child_answer(); } } while(oldesti == -1); user = currusers + oldesti; /* FIXME: This is a mess, because user->serverpid can change to 0 when SIGCHLD is received */ pid = user->serverpid; if(pid > 0) { if(!user->terminated) { kill(pid, SIGTERM); user->terminated = 1; } else { log("kill(%i, SIGKILL)\n", pid); kill(pid, SIGKILL); } } /* FIXME: Need to wait for the death of the child or max 1 second. How can this be done? */ if(user->serverpid > 0) sleep(1); check_servers(); } static int new_child(struct userinfo *user, uid_t uid, gid_t gid) { int pipout[2]; int pipin[2]; int pid; int i; gid_t list[32]; int num; if(pipe(pipout) == -1) { logerr("Could not open pipe for child: %s\n", strerror(errno)); return -1; } if(pipe(pipin) == -1) { close(pipout[0]); close(pipout[1]); return -1; } user->serverpid = pid = fork(); if(pid == -1) { close(pipout[0]); close(pipout[1]); close(pipin[0]); close(pipin[1]); logerr("Could not fork child: %s\n", strerror(errno)); return -1; } user->pipout = pipout[1]; user->pipin = pipin[0]; if(pid == 0) { /* Child */ reset_signal_handlers(); /* Close everything, except the current pipes */ for(i = 0; i < MAXUSERS; i++) if(currusers[i].serverpid >= 0) { close(currusers[i].pipout); close(currusers[i].pipin); } close(codafd); #if 0 fclose(logfile); #endif /* Don't want any troublesome signals from the child */ setsid(); /* FIXME: What is the proper way of dealing with supplementary groups? */ list[0] = gid; num = 1; setgroups(num, list); #if 1 { struct passwd *pwbuf; /* FIXME: This messes up gdb. Why? */ pwbuf = getpwuid(uid); if(pwbuf != NULL) initgroups(pwbuf->pw_name, gid); } #endif setgid(gid); setuid(uid); fprintf(stderr, "Child process: %i/%i\n", getuid(), getgid()); num = getgroups(32, list); fprintf(stderr, "Supplementary groups: "); for(i = 0; i < num; i++) fprintf(stderr, "%i, ", list[i]); fprintf(stderr, "\n"); child_process(pipout[0], pipin[1]); exit(0); } /* Parent */ close(pipout[0]); close(pipin[1]); user->uid = uid; user->gid = gid; user->terminated = 0; user->lastuse = 0; user->ops = NULL; return 0; } static struct userinfo *get_user(uid_t uid, gid_t gid) { int i; struct userinfo *user = NULL; for(i = 0; i < MAXUSERS; i++) { if(currusers[i].serverpid > 0 && currusers[i].uid == uid && currusers[i].gid == gid) { user = &currusers[i]; break; } } if(user == NULL) { /* Create child */ do { /* Find a free slot */ for(i = 0; i < MAXUSERS; i++) if(currusers[i].serverpid == -1) break; if(i == MAXUSERS) { /* No free slots, must kill a child */ kill_child(); } } while(i == MAXUSERS); user = currusers + i; if(new_child(user, uid, gid) == -1) return NULL; } user->lastuse = time(NULL); return user; } static void send_to_child(union inputArgs *req, int reqsize, char *path1, char *path2) { struct operation *op; uid_t uid = req->ih.cred.cr_fsuid; gid_t gid = req->ih.cred.cr_fsgid; struct userinfo *user; int msgsize; struct child_message msg; char *message, *mp; int msgoff; int res; user = get_user(uid, gid); if(user == NULL) { reply(req, ENOMEM); return; } msg.reqsize = reqsize; msg.path1size = path1 ? strlen(path1) + 1 : 0; msg.path2size = path2 ? strlen(path2) + 1 : 0; msgoff = sizeof(struct child_message); msgsize = sizeof(int) + msgoff + msg.reqsize + msg.path1size + msg.path2size; message = malloc(msgsize); if(message == NULL) { reply(req, ENOMEM); return; } op = malloc(sizeof(struct operation)); if(op == NULL) { free(message); reply(req, ENOMEM); return; } memcpy(op->ibuf, req, reqsize); op->req = (union inputArgs *) op->ibuf; mp = message; *(int *) mp = (msgsize - sizeof(int)); mp += sizeof(int); memcpy(mp, &msg, msgoff); mp += msgoff; memcpy(mp, req, msg.reqsize); mp += msg.reqsize; log("****** opcode: %li\n", req->ih.opcode); log("****** msgsize: %i, msgoff: %i, msg.reqsize: %i, \n", msgsize, msgoff, msg.reqsize); if(path1) { memcpy(mp, path1, msg.path1size); mp += msg.path1size; } if(path2) { memcpy(mp, path2, msg.path2size); mp += msg.path2size; } res = write(user->pipout, message, msgsize); free(message); if(res != msgsize) { free(op); logerr("Error writing to child: %s\n", strerror(errno)); reply(req, errno); } else { grab_fids(req); op->next = user->ops; user->ops = op; } } static void send_with_path(union inputArgs *req, int reqsize, char *filename, ViceFid *id, char *path2) { char pathbuf[1024]; struct fileinfo *fi; char *path; fi = look_info(id); if(fi == NULL) { reply(req, ENOENT); return; } path = fi->path; sprintf(pathbuf, "%s/%s", path, filename); log("path1: %s, path2: %s\n", pathbuf, path2 ? path2 : "(null)"); /* FIXME: */ if(strcmp(pathbuf+1, codadir) == 0) reply(req, ENOENT); else send_to_child(req, reqsize, pathbuf, path2); } static void coda_flush() { union outputArgs rep; log("=================================================================\n"); log_date(); log("CODA_FLUSH\n"); rep.oh.opcode = CODA_FLUSH; rep.oh.result = 0; rep.oh.unique = 0; send_to_kernel(&rep, sizeof(rep.oh)); } void run_exit() { int i; for(i = 0; i < MAXUSERS; i++) { if(currusers[i].serverpid > 0) { kill(currusers[i].serverpid, SIGTERM); } } /* FIXME: should wait until the children are all dead */ coda_flush(); close(codafd); unmount_coda(codadir, 0); } void user_child(pid_t pid) { int i; for(i = 0; i < MAXUSERS; i++) { if(currusers[i].serverpid == pid) { log("Child %i (%i/%i) exited\n", pid, currusers[i].uid, currusers[i].gid); currusers[i].serverpid = 0; return; } } logerr("Unknown child %i exited\n", pid); } static void process_kernel_req() { char ibuf[MAXMSGLEN]; char pathbuf[1024]; union inputArgs *req = (union inputArgs *) ibuf; union outputArgs rep; struct openfile *of, **ofp; int numread; char *path; char *filename, *filename2; struct fileinfo *fi; struct operation **opp, *op; int i; numread = read(codafd, ibuf, MAXMSGLEN); if(numread == -1) { logerr("Error reading from device: %s\n", strerror(errno)); clean_exit(1); } log("=================================================================\n"); log_date(); log("%i bytes: opcode: %li, unique: %li\n", numread, req->ih.opcode, req->ih.unique); switch (req->ih.opcode) { case CODA_ROOT: log("CODA_ROOT\n"); rep.oh.opcode = req->ih.opcode; rep.oh.unique = req->ih.unique; rep.oh.result = 0; rep.coda_root.VFid.Volume = 0; rep.coda_root.VFid.Vnode = 0; rep.coda_root.VFid.Unique = 0; /* 0 means root */ send_to_kernel(&rep, sizeof(rep.coda_root)); break; case CODA_GETATTR: log("CODA_GETATTR\n"); path = look_name(&req->coda_getattr.VFid); if(path == NULL) reply(req, ENOENT); else send_to_child(req, numread, path, NULL); break; case CODA_ACCESS: log("CODA_ACCESS, flags: 0x%04x\n", req->coda_access.flags); path = look_name(&req->coda_access.VFid); if(path == NULL) reply(req, ENOENT); else send_to_child(req, numread, path, NULL); break; #ifdef CODA_OPEN_BY_FD case CODA_OPEN_BY_FD: log("CODA_OPEN_BY_FD, flags: 0x%04x\n", req->coda_open.flags); #endif case CODA_OPEN: if(req->ih.opcode == CODA_OPEN) log("CODA_OPEN, flags: 0x%04x\n", req->coda_open.flags); fi = look_info(&req->coda_open.VFid); if(fi == NULL) { reply(req, ENOENT); break; } path = fi->path; log("path: %s\n", path); for(of = fi->ofs; of != NULL; of = of->next) if(of->pid == req->ih.pid) break; if(of != NULL) { if((req->coda_open.flags & C_O_TRUNC) != 0) truncate(of->tmpfile, 0); open_file(req, of); } else { char tmpname[64]; int fd; strcpy(tmpname, "/tmp/.avfs_coda_XXXXXX"); fd = mkstemp(tmpname); if(fd == -1) { logerr("Could not make temporary file: %s\n", strerror(errno)); reply(req, ENFILE); } else { fchown(fd, req->ih.cred.cr_fsuid, req->ih.cred.cr_fsgid); close(fd); of = malloc(sizeof(struct openfile)); if(of == NULL) { reply(req, ENOMEM); } else { of->use = 0; of->wuse = 0; of->pid = req->ih.pid; of->tmpfile = strdup(tmpname); of->fd = -1; of->next = fi->ofs; fi->ofs = of; ref_fid(&req->coda_open.VFid); log("tmpfile: %s\n", of->tmpfile); send_to_child(req, numread, path, tmpname); } } } break; case CODA_CLOSE: log("CODA_CLOSE, flags: 0x%04x\n", req->coda_close.flags); fi = look_info(&req->coda_close.VFid); if(fi == NULL) { reply(req, ENOENT); break; } path = fi->path; log("path: %s\n", path); for(ofp = &fi->ofs; *ofp != NULL; ofp = &(*ofp)->next) if((*ofp)->pid == req->ih.pid) break; of = *ofp; if(of == NULL) { logerr("File not found\n"); reply(req, ENOENT); } else { int dowrite = 0; log("use: %i\n", of->use); log("wuse: %i\n", of->wuse); if(of->wuse > 0 && (req->coda_close.flags & (C_O_WRITE | C_O_TRUNC)) != 0) { of->wuse --; if(of->wuse == 0 && of->tmpfile != NULL) { log("tmpfile: %s\n", of->tmpfile); dowrite = 1; send_to_child(req, numread, path, of->tmpfile); } } if(!dowrite) { close_file(of, ofp, &req->coda_close.VFid); reply(req, 0); } } break; case CODA_LOOKUP: /* It is not clear to me, whether lookups should be done as 'user' or as 'root' */ filename = ibuf + req->coda_lookup.name; log("CODA_LOOKUP, name: '%s', flags: 0x%04x\n", filename, req->coda_lookup.flags); send_with_path(req, numread, filename, &req->coda_lookup.VFid, NULL); break; case CODA_CREATE: filename = ibuf + req->coda_create.name; log("CODA_CREATE, name: '%s', mode: 0%o, rdev: 0x%04x\n", filename, req->coda_create.mode, (int) req->coda_create.attr.va_rdev); send_with_path(req, numread, filename, &req->coda_create.VFid, NULL); break; case CODA_READLINK: log("CODA_READLINK\n"); path = look_name(&req->coda_readlink.VFid); if(path == NULL) reply(req, ENOENT); else send_to_child(req, numread, path, NULL); break; case CODA_SETATTR: log("CODA_SETATTR\n"); path = look_name(&req->coda_setattr.VFid); if(path == NULL) reply(req, ENOENT); else send_to_child(req, numread, path, NULL); break; case CODA_REMOVE: filename = ibuf + req->coda_remove.name; log("CODA_REMOVE, name: '%s'\n", filename); send_with_path(req, numread, filename, &req->coda_remove.VFid, NULL); break; case CODA_RMDIR: filename = ibuf + req->coda_rmdir.name; log("CODA_RMDIR, name: '%s'\n", filename); send_with_path(req, numread, filename, &req->coda_rmdir.VFid, NULL); break; case CODA_MKDIR: filename = ibuf + req->coda_mkdir.name; log("CODA_MKDIR, name: '%s', mode: 0%o\n", filename, req->coda_mkdir.attr.va_mode); send_with_path(req, numread, filename, &req->coda_mkdir.VFid, NULL); break; case CODA_RENAME: filename = ibuf + req->coda_rename.srcname; filename2 = ibuf + req->coda_rename.destname; log("CODA_RENAME, name1: '%s', name2: '%s'\n", filename, filename2); fi = look_info(&req->coda_rename.destFid); if(fi == NULL) { reply(req, ENOENT); break; } sprintf(pathbuf, "%s/%s", fi->path, filename2); send_with_path(req, numread, filename, &req->coda_rename.sourceFid, pathbuf); break; case CODA_SYMLINK: filename = ibuf + req->coda_symlink.srcname; filename2 = ibuf + req->coda_symlink.tname; log("CODA_SYMLINK, src: '%s', tname: '%s'\n", filename, filename2); send_with_path(req, numread, filename2, &req->coda_symlink.VFid, filename); break; case CODA_LINK: fi = look_info(&req->coda_link.sourceFid); if(fi == NULL) { reply(req, ENOENT); break; } filename = fi->path; filename2 = ibuf + req->coda_link.tname; log("CODA_LINK, src: '%s', tname: '%s'\n", filename, filename2); send_with_path(req, numread, filename2, &req->coda_link.destFid, filename); break; case CODA_SIGNAL: log("CODA_SIGNAL\n"); for(i = 0; i < MAXUSERS; i++) { for(opp = &currusers[i].ops; *opp != NULL; opp = &(*opp)->next) if((*opp)->req->ih.unique == req->ih.unique) break; if(*opp != NULL) break; } op = *opp; if(op == NULL) logerr("Operation not found!!!!\n"); else { /* FIXME: Inform the child that the operation is interrupted */ switch(op->req->ih.opcode) { #ifdef CODA_OPEN_BY_FD case CODA_OPEN_BY_FD: #endif case CODA_OPEN: fi = look_info(&op->req->coda_open.VFid); for(ofp = &fi->ofs; *ofp != NULL; ofp = &(*ofp)->next) if((*ofp)->pid == op->req->ih.pid) break; of = *ofp; if(of != NULL) close_file(of, ofp, &op->req->coda_open.VFid); break; default:; } release_fids(op->req); *opp = op->next; free(op); } break; default: reply(req, EOPNOTSUPP); log("========================================\n"); log(" N o t I m p l e m e n t e d \n"); log("========================================\n"); } } static void process() { fd_set rfds; int ret; int maxfd; int i; unused_files.prev = &unused_files; unused_files.next = &unused_files; while(1) { struct timeval timeout; check_servers(); checknum ++; if(numfids > MAXFILES && checknum > CHECKNUM) { clean_up_names(); checknum = 0; } FD_ZERO(&rfds); FD_SET(codafd, &rfds); maxfd = codafd; for(i = 0; i < MAXUSERS; i++) { if(currusers[i].serverpid > 0) { int pipfd = currusers[i].pipin; FD_SET(pipfd, &rfds); if(pipfd > maxfd) maxfd = pipfd; } } timeout.tv_sec = 2; timeout.tv_usec = 0; ret = select(maxfd+1, &rfds, NULL, NULL, &timeout); if(ret == -1) { if(errno == EINTR) continue; logerr("Select failed: %s\n", strerror(errno)); continue; } if(needflush && needflush + FLUSHTIME <= time(NULL)) { coda_flush(); needflush = 0; } if(ret == 0) continue; log("Numfids: %i\n", numfids); if(FD_ISSET(codafd, &rfds)) process_kernel_req(); for(i = 0; i < MAXUSERS; i++) { if(currusers[i].serverpid > 0) { int pipfd = currusers[i].pipin; if(FD_ISSET(pipfd, &rfds)) process_answer(&currusers[i]); } } } } void run(int cfs, const char *dir, int dm) { int i; openlog("avfscoda", LOG_CONS, LOG_USER); codafd = cfs; codadir = dir; logfile = stderr; numfids = 0; checknum = 0; debugmode = dm; for(i = 0; i < MAXUSERS; i++) currusers[i].serverpid = -1; set_signal_handlers(); process(); } avfs-1.0.5/avfscoda/redir/0000755000175000017500000000000013102441322015125 5ustar michaelmichaelavfs-1.0.5/avfscoda/redir/redir.c0000644000175000017500000004406113102441254016407 0ustar michaelmichael#include #include #ifdef CONFIG_MODVERSIONS #include #endif #include #include #include #include #include #include #include #include #ifdef MODULE_LICENSE MODULE_LICENSE("GPL"); #endif #if 0 #define DEB(X) printk X #else #define DEB(X) #endif #define REDIR_VERSION "0.93" #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0) #define NEWVFS 1 #else #define NEWVFS 0 #endif extern void *sys_call_table[]; typedef asmlinkage int (*chdir_func) (const char *); typedef asmlinkage int (*stat_func) (const char *, struct stat *); typedef asmlinkage int (*access_func) (const char *, int); typedef asmlinkage int (*open_func) (const char *, int, int); typedef asmlinkage int (*readlink_func) (const char *, char *, int); typedef asmlinkage int (*getcwd_func) (char *, unsigned long); static chdir_func orig_chdir; static stat_func orig_stat; static stat_func orig_lstat; static access_func orig_access; static open_func orig_open; static readlink_func orig_readlink; static getcwd_func orig_getcwd; #if NEWVFS typedef asmlinkage long (*stat64_func) (const char *, struct stat64 *, long); static stat64_func orig_stat64; static stat64_func orig_lstat64; #endif #ifdef __i386__ typedef asmlinkage int (*execve_func) (struct pt_regs); static execve_func orig_execve; #endif #define AVFS_MAGIC_CHAR '#' #define OVERLAY_DIR "/overlay" #define OVERLAY_DIR_LEN 8 #define PF_AVFS 0x00008000 #define path_ok(pwd) (pwd->d_parent == pwd || !list_empty(&pwd->d_hash)) #if NEWVFS static char *path_pwd(char *page) { return d_path(current->fs->pwd, current->fs->pwdmnt, page, PAGE_SIZE); } static int a_path_walk(const char *pathname, int flags, struct nameidata *nd) { int error; error = 0; if (path_init(pathname, flags, nd)) error = path_walk(pathname, nd); return error; } static void a_path_release(struct nameidata *nd) { dput(nd->dentry); mntput(nd->mnt); } static char *resolv_virt(const char *pathname, int must_exist, int flags) { struct nameidata root; struct nameidata nd; struct dentry *origroot; struct vfsmount *origrootmnt; char *newpathname = NULL; char *page = NULL; char *path = NULL; int pathlen = 0; int error; int newflags; lock_kernel(); DEB((KERN_INFO "resolve_virt pathname: '%s'\n", pathname ? pathname : "(null)")); error = a_path_walk(OVERLAY_DIR, LOOKUP_POSITIVE|LOOKUP_FOLLOW, &root); if(error) goto out; origroot = current->fs->root; origrootmnt = current->fs->rootmnt; current->fs->root = root.dentry; current->fs->rootmnt = root.mnt; newflags = flags; if(must_exist) newflags |= LOOKUP_POSITIVE; error = a_path_walk(pathname, newflags, &nd); if(!error) { if(path_ok(nd.dentry)) { page = (char *) __get_free_page(GFP_USER); if(page) { path = d_path(nd.dentry, nd.mnt, page, PAGE_SIZE); DEB((KERN_INFO "resolve_virt path = '%s'\n", path)); pathlen = (unsigned int) page + PAGE_SIZE - (unsigned int) path; } } a_path_release(&nd); } current->fs->root = origroot; current->fs->rootmnt = origrootmnt; a_path_release(&root); if(path) { int isvirtual; error = a_path_walk(path, flags, &nd); if(!error) { if(nd.dentry->d_inode) isvirtual = 0; else if(must_exist) isvirtual = 1; else if(strchr(path, AVFS_MAGIC_CHAR)) isvirtual = 1; else isvirtual = 0; a_path_release(&nd); } else { isvirtual = 1; } if(!isvirtual) { newpathname = kmalloc(pathlen + 1, GFP_USER); if(newpathname) strncpy(newpathname, path, pathlen); } else { newpathname = kmalloc(OVERLAY_DIR_LEN + pathlen + 1, GFP_USER); if(newpathname) { strcpy(newpathname, OVERLAY_DIR); strncat(newpathname, path, pathlen); } } } if(page) free_page((unsigned long) page); DEB((KERN_INFO "resolve_virt newpathname: '%s'\n", newpathname ? newpathname : "(null)")); out: unlock_kernel(); return newpathname; } #else /* NEWVFS */ static char *path_pwd(char *page) { return d_path(current->fs->pwd, page, PAGE_SIZE); } static char *resolv_virt(const char *pathname, int must_exist, int flags) { struct dentry *root, *origroot; struct dentry *dentry; char *newpathname = NULL; char *page = NULL; char *path = NULL; int pathlen = 0; lock_kernel(); DEB((KERN_INFO "resolve_virt pathname: '%s'\n", pathname ? pathname : "(null)")); root = lookup_dentry(OVERLAY_DIR, NULL, 1); if(IS_ERR(root)) goto out; if(!root->d_inode) { dput(root); goto out; } origroot = current->fs->root; current->fs->root = root; dentry = lookup_dentry(pathname, NULL, flags); if(!IS_ERR(dentry)) { if((!must_exist || dentry->d_inode) && path_ok(dentry)) { page = (char *) __get_free_page(GFP_USER); if(page) { path = d_path(dentry, page, PAGE_SIZE); DEB((KERN_INFO "resolve_virt path = '%s'\n", path)); pathlen = (unsigned int) page + PAGE_SIZE - (unsigned int) path; } } dput(dentry); } current->fs->root = origroot; dput(root); if(path) { int isvirtual; dentry = lookup_dentry(path, NULL, flags); if(!IS_ERR(dentry)) { if(dentry->d_inode) isvirtual = 0; else if(must_exist) isvirtual = 1; else if(strchr(path, AVFS_MAGIC_CHAR)) isvirtual = 1; else isvirtual = 0; dput(dentry); } else { isvirtual = 1; } if(!isvirtual) { newpathname = kmalloc(pathlen + 1, GFP_USER); if(newpathname) strncpy(newpathname, path, pathlen); } else { newpathname = kmalloc(OVERLAY_DIR_LEN + pathlen + 1, GFP_USER); if(newpathname) { strcpy(newpathname, OVERLAY_DIR); strncat(newpathname, path, pathlen); } } } if(page) free_page((unsigned long) page); DEB((KERN_INFO "resolve_virt newpathname: '%s'\n", newpathname ? newpathname : "(null)")); out: unlock_kernel(); return newpathname; } #endif /* NEWVFS */ #define cwd_virtual() \ (current->fs->pwd->d_sb->s_magic == CODA_SUPER_MAGIC) static char *get_abs_path(const char *filename) { char *cwd; int cwdlen, fnamelen; char *abspath, *s; char *page; if(!path_ok(current->fs->pwd)) return NULL; page = (char *) __get_free_page(GFP_USER); if(!page) return NULL; cwd = path_pwd(page); cwdlen = (unsigned int) page + PAGE_SIZE - (unsigned int) cwd - 1; if(cwd_virtual() && cwdlen > OVERLAY_DIR_LEN) { cwd += OVERLAY_DIR_LEN; cwdlen -= OVERLAY_DIR_LEN; } fnamelen = strlen(filename); abspath = kmalloc(cwdlen + 1 + fnamelen + 1, GFP_USER); if(abspath) { s = abspath; strncpy(s, cwd, cwdlen); s += cwdlen; *s++ = '/'; strncpy(s, filename, fnamelen + 1); } free_page((unsigned long) page); return abspath; } static char *resolve_name(const char *kfilename, int must_exist, int flags) { char *tmp; char *newfilename; tmp = getname(kfilename); if(IS_ERR(tmp)) return tmp; if((tmp[0] != '/' && cwd_virtual()) || strchr(tmp, AVFS_MAGIC_CHAR)) { DEB((KERN_INFO "resolve_name: %s (%i/%s)\n", tmp, current->pid, (current->flags & PF_AVFS) ? "on" : "off")); if(strcmp(tmp, "/#avfs-on") == 0) { printk(KERN_INFO "AVFS ON (pid: %i)\n", current->pid); current->flags |= PF_AVFS; newfilename = ERR_PTR(-EEXIST); } else if(!(current->flags & PF_AVFS)) newfilename = NULL; else if(strcmp(tmp, "/#avfs-off") == 0) { printk(KERN_INFO "AVFS OFF (pid: %i)\n", current->pid); current->flags &= ~PF_AVFS; newfilename = ERR_PTR(-EEXIST); } else { if(tmp[0] == '/') { newfilename = resolv_virt(tmp, must_exist, flags); } else { char *abspath; abspath = get_abs_path(tmp); if(abspath) { newfilename = resolv_virt(abspath, must_exist, flags); kfree(abspath); } else newfilename = NULL; } } } else newfilename = NULL; putname(tmp); return newfilename; } asmlinkage int virt_chdir(const char *filename) { int ret; mm_segment_t old_fs; char *newfilename; if(!cwd_virtual()) { ret = (*orig_chdir)(filename); if(ret != -ENOENT) return ret; } else ret = 0; newfilename = resolve_name(filename, 1, 1); if(!newfilename) { if(ret) return ret; else return (*orig_chdir)(filename); } if(IS_ERR(newfilename)) return PTR_ERR(newfilename); DEB((KERN_INFO "CHDIR: trying '%s'\n", newfilename)); old_fs = get_fs(); set_fs(get_ds()); ret = (*orig_chdir)(newfilename); set_fs(old_fs); kfree(newfilename); DEB((KERN_INFO "CHDIR: result %i\n", ret)); return ret; } static int do_orig_stat(stat_func sfunc, const char *filename, struct stat *statbuf) { int ret; mm_segment_t old_fs; struct stat locbuf; old_fs = get_fs(); set_fs(get_ds()); ret = (*sfunc)(filename, &locbuf); set_fs(old_fs); if(ret == 0) ret = (copy_to_user(statbuf, &locbuf, sizeof(locbuf)) ? -EFAULT : 0); return ret; } asmlinkage int virt_stat(const char *filename, struct stat *statbuf) { int ret; char *newfilename; if(!cwd_virtual()) { ret = (*orig_stat)(filename, statbuf); if(ret != -ENOENT) return ret; } else ret = 0; newfilename = resolve_name(filename, 1, 1); if(!newfilename) { if(ret) return ret; else return (*orig_stat)(filename, statbuf); } if(IS_ERR(newfilename)) return PTR_ERR(newfilename); DEB((KERN_INFO "STAT: trying '%s'\n", newfilename)); ret = do_orig_stat(orig_stat, newfilename, statbuf); kfree(newfilename); DEB((KERN_INFO "STAT: result %i\n", ret)); return ret; } asmlinkage int virt_lstat(const char *filename, struct stat *statbuf) { int ret; char *newfilename; if(!cwd_virtual()) { ret = (*orig_lstat)(filename, statbuf); if(ret != -ENOENT) return ret; } else ret = 0; newfilename = resolve_name(filename, 1, 0); if(!newfilename) { if(ret) return ret; else return (*orig_lstat)(filename, statbuf); } if(IS_ERR(newfilename)) return PTR_ERR(newfilename); DEB((KERN_INFO "LSTAT: trying '%s'\n", newfilename)); ret = do_orig_stat(orig_lstat, newfilename, statbuf); kfree(newfilename); DEB((KERN_INFO "LSTAT: result %i\n", ret)); return ret; } asmlinkage int virt_access(const char *filename, int mode) { int ret; mm_segment_t old_fs; char *newfilename; if(!cwd_virtual()) { ret = (*orig_access)(filename, mode); if(ret != -ENOENT) return ret; } else ret = 0; newfilename = resolve_name(filename, 1, 1); if(!newfilename) { if(ret) return ret; else return (*orig_access)(filename, mode); } if(IS_ERR(newfilename)) return PTR_ERR(newfilename); DEB((KERN_INFO "ACCESS: trying '%s'\n", newfilename)); old_fs = get_fs(); set_fs(get_ds()); ret = (*orig_access)(newfilename, mode); set_fs(old_fs); kfree(newfilename); DEB((KERN_INFO "ACCESS: result %i\n", ret)); return ret; } asmlinkage int virt_open(const char *filename, int flags, int mode) { int ret; mm_segment_t old_fs; char *newfilename; if(!cwd_virtual()) { ret = (*orig_open)(filename, flags, mode); if(ret != -ENOENT) return ret; } else ret = 0; newfilename = resolve_name(filename, 1, 1); if(!newfilename) { if(ret) return ret; else return (*orig_open)(filename, flags, mode); } if(IS_ERR(newfilename)) return PTR_ERR(newfilename); DEB((KERN_INFO "OPEN: trying '%s'\n", newfilename)); old_fs = get_fs(); set_fs(get_ds()); ret = (*orig_open)(newfilename, flags, mode); set_fs(old_fs); kfree(newfilename); DEB((KERN_INFO "OPEN: result %i\n", ret)); return ret; } asmlinkage int virt_readlink(const char *filename, char *buf, int bufsiz) { int ret; mm_segment_t old_fs; char *newfilename; char *locbuf; int len; if(!cwd_virtual()) { ret = (*orig_readlink)(filename, buf, bufsiz); if(ret != -ENOENT) return ret; } else ret = 0; newfilename = resolve_name(filename, 1, 0); if(!newfilename) { if(ret) return ret; else return (*orig_readlink)(filename, buf, bufsiz); } if(IS_ERR(newfilename)) return PTR_ERR(newfilename); DEB((KERN_INFO "READLINK: trying '%s'\n", newfilename)); /* bufsiz is legal (already checked by sys_readlink) */ len = bufsiz; if(bufsiz > PAGE_SIZE) len = PAGE_SIZE; locbuf = (char *) __get_free_page(GFP_USER); ret = -ENOMEM; if(locbuf) { old_fs = get_fs(); set_fs(get_ds()); ret = (*orig_readlink)(newfilename, locbuf, len); set_fs(old_fs); if(ret >= 0) if(copy_to_user(buf, locbuf, len)) ret = -EFAULT; free_page((unsigned long) locbuf); } kfree(newfilename); DEB((KERN_INFO "READLINK: result %i\n", ret)); return ret; } asmlinkage int virt_getcwd(char *buf, unsigned long size) { int ret; char *cwd; unsigned long cwdlen; char *page; char *newcwd; unsigned long newlen; ret = (*orig_getcwd)(buf, size); if(!cwd_virtual() || ret < 0) return ret; if(!path_ok(current->fs->pwd)) return -ENOENT; page = (char *) __get_free_page(GFP_USER); if(!page) return -ENOMEM; cwd = path_pwd(page); cwdlen = PAGE_SIZE + (page - cwd) - 1; if(cwdlen >= OVERLAY_DIR_LEN && strncmp(cwd, OVERLAY_DIR, OVERLAY_DIR_LEN) == 0) { if(cwdlen == OVERLAY_DIR_LEN) { newcwd = "/"; newlen = 1; } else { newcwd = cwd + OVERLAY_DIR_LEN; newlen = cwdlen - OVERLAY_DIR_LEN; } ret = -ERANGE; if(newlen + 1 <= size) { ret = newlen + 1; if(copy_to_user(buf, newcwd, newlen + 1)) ret = -EFAULT; } } free_page((unsigned long) page); return ret; } #if NEWVFS static long do_orig_stat64(stat64_func sfunc, const char *filename, struct stat64 * statbuf, long flags) { long ret; mm_segment_t old_fs; struct stat64 locbuf; old_fs = get_fs(); set_fs(get_ds()); ret = (*sfunc)(filename, &locbuf, flags); set_fs(old_fs); if(ret == 0) ret = (copy_to_user(statbuf, &locbuf, sizeof(locbuf)) ? -EFAULT : 0); return ret; } asmlinkage long virt_stat64(char * filename, struct stat64 * statbuf, long flags) { long ret; char *newfilename; if(!cwd_virtual()) { ret = (*orig_stat64)(filename, statbuf, flags); if(ret != -ENOENT) return ret; } else ret = 0; newfilename = resolve_name(filename, 1, 1); if(!newfilename) { if(ret) return ret; else return (*orig_stat64)(filename, statbuf, flags); } if(IS_ERR(newfilename)) return PTR_ERR(newfilename); DEB((KERN_INFO "STAT64: trying '%s'\n", newfilename)); ret = do_orig_stat64(orig_stat64, newfilename, statbuf, flags); kfree(newfilename); DEB((KERN_INFO "STAT64: result %li\n", ret)); return ret; } asmlinkage long virt_lstat64(char * filename, struct stat64 * statbuf, long flags) { long ret; char *newfilename; if(!cwd_virtual()) { ret = (*orig_lstat64)(filename, statbuf, flags); if(ret != -ENOENT) return ret; } else ret = 0; newfilename = resolve_name(filename, 1, 0); if(!newfilename) { if(ret) return ret; else return (*orig_lstat64)(filename, statbuf, flags); } if(IS_ERR(newfilename)) return PTR_ERR(newfilename); DEB((KERN_INFO "LSTAT64: trying '%s'\n", newfilename)); ret = do_orig_stat64(orig_lstat64, newfilename, statbuf, flags); kfree(newfilename); DEB((KERN_INFO "LSTAT64: result %li\n", ret)); return ret; } #endif /* NEWVFS */ #ifdef __i386__ asmlinkage int real_execve(struct pt_regs *regs) { int error; char * filename; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) lock_kernel(); #endif filename = getname((char *) regs->ebx); error = PTR_ERR(filename); if (IS_ERR(filename)) goto out; error = do_execve(filename, (char **) regs->ecx, (char **) regs->edx, regs); if (error == 0) { #ifdef PT_DTRACE current->ptrace &= ~PT_DTRACE; #else current->flags &= ~PF_DTRACE; #endif } putname(filename); out: #if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) unlock_kernel(); #endif return error; } asmlinkage int virt_execve(struct pt_regs regs) { int ret; char *newfilename; char *filename = (char *) regs.ebx; if(!cwd_virtual()) { ret = real_execve(®s); if(ret != -ENOENT) return ret; } else ret = 0; newfilename = resolve_name(filename, 1, 1); if(!newfilename) { if(ret) return ret; else return real_execve(®s); } if(IS_ERR(newfilename)) return PTR_ERR(newfilename); DEB((KERN_INFO "EXECVE: trying '%s'\n", newfilename)); ret = do_execve(newfilename, (char **) regs.ecx, (char **) regs.edx, ®s); if (ret == 0) { #ifdef PT_DTRACE current->ptrace &= ~PT_DTRACE; #else current->flags &= ~PF_DTRACE; #endif } kfree(newfilename); DEB((KERN_INFO "EXECVE: result %i\n", ret)); return ret; } #endif /* __i386__ */ void *replace_syscall(int index, void *new_syscall) { void *orig_syscall = sys_call_table[index]; printk(KERN_INFO "replacing syscall nr. %3i [%p] with [%p]\n", index, orig_syscall, new_syscall); sys_call_table[index] = new_syscall; return orig_syscall; } int init_module(void) { printk(KERN_INFO "redir init (version %s)\n", REDIR_VERSION); orig_chdir = replace_syscall(__NR_chdir, virt_chdir); orig_stat = replace_syscall(__NR_stat, virt_stat); orig_lstat = replace_syscall(__NR_lstat, virt_lstat); orig_access = replace_syscall(__NR_access, virt_access); orig_open = replace_syscall(__NR_open, virt_open); orig_readlink = replace_syscall(__NR_readlink, virt_readlink); orig_getcwd = replace_syscall(__NR_getcwd, virt_getcwd); #if NEWVFS orig_stat64 = replace_syscall(__NR_stat64, virt_stat64); orig_lstat64 = replace_syscall(__NR_lstat64, virt_lstat64); #endif #ifdef __i386__ orig_execve = replace_syscall(__NR_execve, virt_execve); #endif return 0; } void cleanup_module(void) { printk(KERN_INFO "redir cleanup\n"); replace_syscall(__NR_chdir, orig_chdir); replace_syscall(__NR_stat, orig_stat); replace_syscall(__NR_lstat, orig_lstat); replace_syscall(__NR_access, orig_access); replace_syscall(__NR_open, orig_open); replace_syscall(__NR_readlink, orig_readlink); replace_syscall(__NR_getcwd, orig_getcwd); #if NEWVFS replace_syscall(__NR_stat64, orig_stat64); replace_syscall(__NR_lstat64, orig_lstat64); #endif #ifdef __i386__ replace_syscall(__NR_execve, orig_execve); #endif } /* * Local Variables: * indent-tabs-mode: t * c-basic-offset: 8 * End: */ avfs-1.0.5/avfscoda/redir/Makefile.in0000644000175000017500000000100713102441254017174 0ustar michaelmichaelSHELL = /bin/sh kmoduledir = @kmoduledir@ i_kmoduledir = $(DESTDIR)$(kmoduledir) CC = @CC@ CFLAGS = -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -pipe CPPFLAGS = -I@KERNINCLUDE@ -D__KERNEL__ -DMODULE -D_LOOSE_KERNEL_NAMES INSTALL = @INSTALL@ all: redir.o clean: rm -f core core.* *.o .*.o *.s *.a *~ .c.o: $(CC) $(CFLAGS) $(CPPFLAGS) -c $< install: all @../../mkinstalldirs $(i_kmoduledir) $(INSTALL) -m 644 redir.o $(i_kmoduledir)/redir.o /sbin/depmod -a uninstall: rm -f $(i_kmoduledir)/redir.o avfs-1.0.5/avfscoda/Makefile.in0000644000175000017500000005305213102441264016077 0ustar michaelmichael# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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_AVFSCODA_TRUE@sbin_PROGRAMS = avfscoda$(EXEEXT) subdir = avfscoda DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp $(noinst_HEADERS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/neon-ssl.m4 \ $(top_srcdir)/macros/neon-xml-parser.m4 \ $(top_srcdir)/macros/neon.m4 $(top_srcdir)/macros/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(sbindir)" PROGRAMS = $(sbin_PROGRAMS) am__avfscoda_SOURCES_DIST = avfscoda.c mount.c dispatch.c child.c @INSTALL_AVFSCODA_TRUE@am_avfscoda_OBJECTS = avfscoda.$(OBJEXT) \ @INSTALL_AVFSCODA_TRUE@ mount.$(OBJEXT) dispatch.$(OBJEXT) \ @INSTALL_AVFSCODA_TRUE@ child.$(OBJEXT) avfscoda_OBJECTS = $(am_avfscoda_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 = avfscoda_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(avfscoda_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__depfiles_maybe = depfiles 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 = $(avfscoda_SOURCES) DIST_SOURCES = $(am__avfscoda_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 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@ EMACS = @EMACS@ 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@ KERNINCLUDE = @KERNINCLUDE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEONLIBS = @NEONLIBS@ NEONOBJS = @NEONOBJS@ NEON_BUILD_BUNDLED = @NEON_BUILD_BUNDLED@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ NEON_OBJEXT = @NEON_OBJEXT@ NEON_TARGET = @NEON_TARGET@ 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@ PRELOAD_LIBS = @PRELOAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ XML_CONFIG = @XML_CONFIG@ 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@ avfscoda_build = @avfscoda_build@ 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@ initstyle = @initstyle@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ kmoduledir = @kmoduledir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ preload_build = @preload_build@ profiledir = @profiledir@ program_transform_name = @program_transform_name@ psdir = @psdir@ rcdir = @rcdir@ rcscriptdir = @rcscriptdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ start_levels = @start_levels@ start_prio = @start_prio@ stop_levels = @stop_levels@ stop_prio = @stop_prio@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = redir/Makefile.in redir/redir.c noinst_HEADERS = avfscoda.h @INSTALL_AVFSCODA_TRUE@AM_CFLAGS = -I$(top_srcdir)/include -DCODAINCLUDE=\"@KERNINCLUDE@/linux/coda.h\" @CFLAGS@ @CPPFLAGS@ @INSTALL_AVFSCODA_TRUE@avfscoda_LDFLAGS = @LDFLAGS@ @LIBS@ @INSTALL_AVFSCODA_TRUE@avfscoda_LDADD = ../lib/libavfs_static.la @INSTALL_AVFSCODA_TRUE@avfscoda_DEPENDENCIES = redir_module @INSTALL_AVFSCODA_TRUE@avfscoda_SOURCES = \ @INSTALL_AVFSCODA_TRUE@ avfscoda.c \ @INSTALL_AVFSCODA_TRUE@ mount.c \ @INSTALL_AVFSCODA_TRUE@ dispatch.c \ @INSTALL_AVFSCODA_TRUE@ child.c @INSTALL_AVFSCODA_TRUE@CLEANFILES = redir/redir.o 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 avfscoda/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu avfscoda/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(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-sbinPROGRAMS: $(sbin_PROGRAMS) @$(NORMAL_INSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(sbindir)'"; \ $(MKDIR_P) "$(DESTDIR)$(sbindir)" || 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)$(sbindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(sbindir)$$dir" || exit $$?; \ } \ ; done uninstall-sbinPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(sbin_PROGRAMS)'; test -n "$(sbindir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' \ `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(sbindir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(sbindir)" && rm -f $$files clean-sbinPROGRAMS: @list='$(sbin_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list avfscoda$(EXEEXT): $(avfscoda_OBJECTS) $(avfscoda_DEPENDENCIES) $(EXTRA_avfscoda_DEPENDENCIES) @rm -f avfscoda$(EXEEXT) $(AM_V_CCLD)$(avfscoda_LINK) $(avfscoda_OBJECTS) $(avfscoda_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avfscoda.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/child.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dispatch.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mount.Po@am__quote@ .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 $< .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 `$(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: $(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) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(sbindir)"; 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: -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-sbinPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-sbinPROGRAMS @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) install-exec-hook install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-sbinPROGRAMS @$(NORMAL_INSTALL) $(MAKE) $(AM_MAKEFLAGS) uninstall-hook .MAKE: install-am install-exec-am install-strip uninstall-am .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libtool clean-sbinPROGRAMS 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-exec-hook install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-sbinPROGRAMS \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags tags-am uninstall uninstall-am \ uninstall-hook uninstall-sbinPROGRAMS @INSTALL_AVFSCODA_TRUE@redir_module: @INSTALL_AVFSCODA_TRUE@ ( cd redir && make ) @INSTALL_AVFSCODA_TRUE@install-exec-hook: @INSTALL_AVFSCODA_TRUE@ ( cd redir && make install ) @INSTALL_AVFSCODA_TRUE@uninstall-hook: @INSTALL_AVFSCODA_TRUE@ ( cd redir && make uninstall ) @INSTALL_AVFSCODA_FALSE@install-exec-hook: @INSTALL_AVFSCODA_FALSE@uninstall-hook: # 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.0.5/avfscoda/child.c0000644000175000017500000003130313102441254015253 0ustar michaelmichael/* 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 "virtual.h" #include "avfscoda.h" #include #include #include #include #include #include #include #include /* #include "KERNINCLUDE/linux/coda.h" */ #include CODAINCLUDE #define MULTITHREADED 1 #define MAXPMSGLEN 8192 #define MAXMSGLEN 1045 /* #define HAVE_FIFO_BUG */ static int child_outfd; static int st2type(struct stat *s) { if (S_ISDIR(s->st_mode)) return C_VDIR; if (S_ISREG(s->st_mode)) return C_VREG; if (S_ISBLK(s->st_mode)) return C_VBLK; if (S_ISCHR(s->st_mode)) return C_VCHR; if (S_ISLNK(s->st_mode)) return C_VLNK; if (S_ISSOCK(s->st_mode)) return C_VSOCK; if (S_ISFIFO(s->st_mode)) return C_VFIFO; fprintf(stderr, "Unknown type\n"); return C_VNON; } static void st2attr(struct stat *s, struct coda_vattr *a, ViceFid *id) { memset(a, 0, sizeof(struct coda_vattr)); a->va_type = st2type(s); a->va_mode = s->st_mode & 07777; /* File type handling in linux-coda is a mess */ a->va_mode |= (s->st_mode & S_IFMT); a->va_nlink = s->st_nlink; a->va_uid = s->st_uid; a->va_gid = s->st_gid; a->va_fileid = coda_f2i(id); a->va_size = s->st_size; a->va_blocksize = 1024; /* s->st_blksize */ a->va_atime.tv_nsec = a->va_ctime.tv_nsec = a->va_mtime.tv_nsec = 0; a->va_atime.tv_sec = s->st_atime; a->va_mtime.tv_sec = s->st_mtime; a->va_ctime.tv_sec = s->st_ctime; a->va_gen = 0; a->va_flags = 0; a->va_rdev = s->st_rdev; a->va_bytes = s->st_blocks * s->st_blksize; a->va_filerev = 0; #ifdef HAVE_FIFO_BUG /* Make a char device (255/255) out of pipes */ if(S_ISFIFO(s->st_mode)) { a->va_mode = (s->st_mode & 07777) | S_IFCHR; a->va_type = C_VCHR; a->va_rdev = ~0; } #endif } static int set_attr(const char *path, struct coda_vattr *a) { if(a->va_mode != (u_short) -1) { if(virt_chmod(path, a->va_mode & 07777) == -1) return -1; } if(a->va_uid != (vuid_t) -1 || a->va_gid != (vuid_t) -1) { if(virt_lchown(path, a->va_uid, a->va_gid) == -1) return -1; } if(a->va_size != (u_quad_t) -1) { if(virt_truncate(path, a->va_size) == -1) return -1; } if(a->va_atime.tv_sec != (time_t) -1 || a->va_mtime.tv_sec != (time_t) -1) { struct utimbuf utbuf; utbuf.actime = a->va_atime.tv_sec; utbuf.modtime = a->va_mtime.tv_sec; if(virt_utime(path, &utbuf) == -1) return -1; } return 0; } static int create_empty_dir(const char *tmpname) { int outfd; outfd = open(tmpname, O_WRONLY | O_TRUNC); if(outfd == -1) { fprintf(stderr, "open(%s, O_WRONLY | O_TRUNC) failed (%s)\n", tmpname, strerror(errno)); return -EIO; } close(outfd); return 0; } static int copy_dir(const char *path, const char *tmpname) { struct venus_dirent vd; int res; DIR *dirp; int outfd; struct dirent *ent; dirp = virt_opendir(path); if(dirp == NULL) return -errno; outfd = open(tmpname, O_WRONLY | O_TRUNC); if(outfd == -1) { fprintf(stderr, "open(%s, O_WRONLY | O_TRUNC) failed (%s)\n", tmpname, strerror(errno)); virt_closedir(dirp); return -EIO; } while(1) { errno = 0; ent = virt_readdir(dirp); if(ent == NULL) { if(errno != 0) res = -errno; else res = 0; break; } vd.d_fileno = 1; /* We don't know the inode number */ vd.d_type = CDT_UNKNOWN; strncpy(vd.d_name, ent->d_name, CODA_MAXNAMLEN); vd.d_name[CODA_MAXNAMLEN] = '\0'; vd.d_namlen = strlen(vd.d_name); vd.d_reclen = DIRSIZ(&vd); res = write(outfd, &vd, vd.d_reclen); if(res == -1) { fprintf(stderr, "write failed (%s)\n", strerror(errno)); res = -EIO; break; } } while(ent != NULL); close(outfd); if(res == 0) { res = virt_closedir(dirp); if(res == -1) return -errno; } else virt_closedir(dirp); return res; } #define COPYBUF 16384 static int copy_file(const char *name, const char *tmpname) { char buf[COPYBUF]; int infd; int outfd; int res; infd = virt_open(name, O_RDONLY, 0); if(infd == -1) return -errno; outfd = open(tmpname, O_WRONLY | O_TRUNC); if(outfd == -1) { fprintf(stderr, "open(%s) failed (%s)\n", tmpname, strerror(errno)); virt_close(infd); return -EIO; } do { res = virt_read(infd, buf, COPYBUF); if(res == -1) { res = -errno; break; } if (res > 0) { res = write(outfd, buf, res); if(res == -1) { fprintf(stderr, "write failed (%s)\n", strerror(errno)); res = -EIO; break; } } } while(res > 0); close(outfd); if(res == 0) { res = virt_close(infd); if(res == -1) return -errno; } else virt_close(infd); return res; } static int write_file(const char *tmpname, const char *name) { char buf[COPYBUF]; int infd; int outfd; int res; outfd = virt_open(name, O_WRONLY | O_TRUNC, 0); if(outfd == -1) return -errno; infd = open(tmpname, O_RDONLY, 0); if(infd == -1) { fprintf(stderr, "open(%s) failed (%s)\n", tmpname, strerror(errno)); virt_close(outfd); return -EIO; } do { res = read(infd, buf, COPYBUF); if(res == -1) { fprintf(stderr, "read failed (%s)\n", strerror(errno)); res = -EIO; break; } if (res > 0) { res = virt_write(outfd, buf, res); if(res == -1) { res = -errno; break; } } } while(res > 0); close(infd); if(res == 0) { res = virt_close(outfd); if(res == -1) return -errno; } return res; } static int create_empty_file(const char *tmpname) { int fd; fprintf(stderr, "create_empty_file: %s\n", tmpname); fd = open(tmpname, O_WRONLY | O_TRUNC); if(fd == -1) { fprintf(stderr, "open(%s, O_WRONLY | O_TRUNC) failed (%s)\n", tmpname, strerror(errno)); return -EIO; } close(fd); return 0; } void *process_request(void *arg) { char *ibuf = (char *) arg; int ret; struct child_message *msg = (struct child_message *) ibuf; union inputArgs *req; char obuf[MAXMSGLEN + sizeof(int)]; union outputArgs *rep = (union outputArgs *) (obuf + sizeof(int)); int size, noff; char *path1; char *path2; int offset = sizeof(struct child_message); struct stat stbuf; int outfd = child_outfd; req = (union inputArgs *) (ibuf + offset); if(msg->path1size != 0) path1 = ibuf + offset + msg->reqsize; else path1 = NULL; if(msg->path2size != 0) path2 = ibuf + offset + msg->reqsize + msg->path1size; else path2 = NULL; #if 0 fprintf(stderr, "- %i/%i [%i] ---------------------------------------------------\n", uid, gid, pid); fprintf(stderr, "%i (%i (%i)) bytes: opcode: %li, unique: %li\n", msg->reqsize, numread, insize, req->ih.opcode, req->ih.unique); fprintf(stderr, "ibuf: %p, req: %p msg: %p\n", ibuf, req, msg); #endif size = sizeof(rep->oh); rep->oh.opcode = req->ih.opcode; rep->oh.unique = req->ih.unique; rep->oh.result = 0; switch (req->ih.opcode) { case CODA_GETATTR: size = sizeof(rep->coda_getattr); ret = virt_lstat(path1, &stbuf); if(ret == -1) rep->oh.result = errno; else st2attr(&stbuf, &rep->coda_getattr.attr, &req->coda_getattr.VFid); break; case CODA_ACCESS: size = sizeof(rep->oh); ret = virt_access(path1, req->coda_access.flags & 0x7); if(ret == -1) rep->oh.result = errno; break; #ifdef CODA_OPEN_BY_FD case CODA_OPEN_BY_FD: #endif case CODA_OPEN: size = sizeof(rep->oh); if(strcmp(path1, "/") == 0) ret = create_empty_dir(path2); else { if((req->coda_open.flags & C_O_TRUNC) != 0) ret = create_empty_file(path2); else { ret = virt_stat(path1, &stbuf); if(ret == -1) ret = -errno; else { if(S_ISDIR(stbuf.st_mode)) ret = copy_dir(path1, path2); else ret = copy_file(path1, path2); } } } if(ret < 0) rep->oh.result = -ret; break; case CODA_CREATE: size = sizeof(rep->coda_create); if((req->coda_create.mode & S_IFMT) == S_IFREG) { ret = virt_open(path1, O_WRONLY | O_CREAT | O_TRUNC, req->coda_create.mode & 07777); if(ret != -1) ret = virt_close(ret); } else { ret = virt_mknod(path1, req->coda_create.mode, req->coda_create.attr.va_rdev); } if(ret == -1) rep->oh.result = errno; break; case CODA_CLOSE: size = sizeof(rep->oh); ret = write_file(path2, path1); if(ret < 0) rep->oh.result = -ret; break; case CODA_LOOKUP: size = sizeof(rep->coda_lookup); ret = virt_lstat(path1, &stbuf); if(ret == -1) rep->oh.result = errno; else { /* We don't know these */ rep->coda_lookup.VFid.Volume = 0; rep->coda_lookup.VFid.Vnode = 0; rep->coda_lookup.VFid.Unique = 0; rep->coda_lookup.vtype = st2type(&stbuf); } break; case CODA_READLINK: size = sizeof(rep->coda_readlink); noff = size; ret = virt_readlink(path1, (char *) rep + noff, MAXMSGLEN - noff); if(ret == -1) rep->oh.result = errno; else { rep->coda_readlink.data = (void *) noff; rep->coda_readlink.count = ret; size += ret; } break; case CODA_SETATTR: size = sizeof(rep->oh); ret = set_attr(path1, &req->coda_setattr.attr); if(ret == -1) rep->oh.result = errno; break; case CODA_REMOVE: size = sizeof(rep->oh); ret = virt_unlink(path1); if(ret == -1) rep->oh.result = errno; break; case CODA_RMDIR: size = sizeof(rep->oh); ret = virt_rmdir(path1); if(ret == -1) rep->oh.result = errno; break; case CODA_MKDIR: size = sizeof(rep->coda_mkdir); ret = virt_mkdir(path1, req->coda_mkdir.attr.va_mode & 07777); if(ret == -1) rep->oh.result = errno; break; case CODA_RENAME: size = sizeof(rep->oh); ret = virt_rename(path1, path2); if(ret == -1) rep->oh.result = errno; break; case CODA_SYMLINK: size = sizeof(rep->oh); ret = virt_symlink(path2, path1); if(ret == -1) rep->oh.result = errno; break; case CODA_LINK: size = sizeof(rep->oh); ret = virt_link(path2, path1); if(ret == -1) rep->oh.result = errno; break; default: rep->oh.result = EOPNOTSUPP; } *(int *) obuf = size; size += sizeof(int); ret = write(outfd, obuf, size); if(ret == -1 || ret != size) { fprintf(stderr, "Error writing to parent: %s\n", strerror(errno)); exit(1); } free(ibuf); return NULL; } void child_process(int infd, int outfd) { int res; int insize; int numread; char ibuf[MAXPMSGLEN]; char *bufcpy; pthread_attr_t attr; pthread_t thrid; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); child_outfd = outfd; #if 0 pid_t pid = getpid(); uid_t uid = getuid(); gid_t gid = getgid(); fprintf(stderr, "My pid: %i\n", pid); sleep(15); #endif while(1) { numread = read(infd, &insize, sizeof(insize)); if(numread == -1) { fprintf(stderr, "Error reading from device: %s\n", strerror(errno)); exit(1); } if(insize > MAXPMSGLEN || insize <= 0) { fprintf(stderr, "Error: illegal size"); exit(1); } numread = read(infd, ibuf, insize); if(numread == -1) { fprintf(stderr, "Error reading from device: %s\n", strerror(errno)); exit(1); } bufcpy = malloc(numread); if(bufcpy == NULL) { fprintf(stderr, "Out of memory\n"); exit(1); } memcpy(bufcpy, ibuf, numread); #if MULTITHREADED res = pthread_create(&thrid, &attr, process_request, bufcpy); if(res != 0) { fprintf(stderr, "Error creating thread: %s\n", strerror(errno)); exit(1); } #else process_request(bufcpy); #endif } } avfs-1.0.5/Makefile.am0000644000175000017500000000075713102441254014303 0ustar michaelmichael## Process this file with automake to produce Makefile.in AUTOMAKE_OPTIONS = dist-bzip2 ACLOCAL_AMFLAGS = -I macros SUBDIRS = \ src \ modules \ zlib \ bzlib \ libneon \ lib \ preload \ avfscoda \ include \ test \ scripts \ spec \ patch \ macros \ extfs \ doc \ fuse EXTRA_DIST = \ glassfs/Makefile \ glassfs/glassfs.c \ glassfs/redir2.c \ glassfs/redir2mount.c start: ( cd scripts && make start ) avfs-1.0.5/modules/0000755000175000017500000000000013102441321013701 5ustar michaelmichaelavfs-1.0.5/modules/dav.c0000644000175000017500000004301013102441254014622 0ustar michaelmichael/* AVFS: A Virtual File System Library Copyright (C) 1998 Miklos Szeredi 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 /* --------------------------------------------------------------------- */ static char AV_UserAgent[128]; static struct uri av_dav_uri_defaults = { "http", NULL, 80, NULL }; 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++; } } 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, const char *hostname, char **username, char **password) { struct pass_session *pass; struct davdata *davdat = (struct davdata *) userdata; pass = pass_get_password (&(davdat->sessions), realm, hostname); if (pass == NULL) { return -1; } /* TODO: really need to dup this? will neon free it? */ *username = ne_strdup (pass->username); *password = ne_strdup (pass->password); return 0; } static int dav_supply_creds_server(void *userdata, const char *realm, const char *hostname, char **username, char **password) { return dav_supply_creds(0, userdata, realm, hostname, username, password); } static int dav_supply_creds_proxy(void *userdata, const char *realm, const char *hostname, char **username, char **password) { return dav_supply_creds(1, userdata, realm, hostname, username, password); } /* ---------------------------------------------------------------------- */ static int av_dav_conn_init (struct av_dav_conn *conn, struct davdata *davdat) { conn->sesh = http_session_create(); /* 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); */ http_set_expect100 (conn->sesh, 1); http_set_useragent (conn->sesh, AV_UserAgent); http_set_server_auth (conn->sesh, dav_supply_creds_server, davdat); http_set_proxy_auth (conn->sesh, dav_supply_creds_proxy, davdat); 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; } if (conn->sesh == NULL) { /* NULL session? This one hasn't been initted yet. */ av_dav_conn_init (conn, davdat); av_log(AVLOG_DEBUG, "DAV: created new HTTP session"); } conn->isbusy = 1; 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 HTTP_ERROR: /* HTTP_ERROR (1) 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 HTTP_LOOKUP: /* HTTP_LOOKUP (3) Name lookup failed */ errval = -ECONNREFUSED; break; case HTTP_AUTH: /* HTTP_AUTH (4) User authentication failed on server */ errval = -EACCES; break; case HTTP_AUTHPROXY: /* HTTP_AUTHPROXY (5) User authentication failed on proxy */ errval = -EACCES; break; case HTTP_SERVERAUTH: /* HTTP_SERVERAUTH (6) Server authentication failed */ errval = -EACCES; break; case HTTP_PROXYAUTH: /* HTTP_PROXYAUTH (7) Proxy authentication failed */ errval = -EACCES; break; case HTTP_CONNECT: /* HTTP_CONNECT (8) Could not connect to server */ errval = -ECONNREFUSED; break; case HTTP_TIMEOUT: /* HTTP_TIMEOUT (9) Connection timed out */ errval = -ETIMEDOUT; break; case HTTP_FAILED: /* HTTP_FAILED (10) 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 void 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 %d", 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/%i)", res, len); } lf->currsize += len; } 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 (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; } 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; } http_session_server (conn->sesh, conn->uri.host, conn->uri.port); /* 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 = http_read_file (conn->sesh, lf->url, av_get_cb, lf); close (lf->fd); lf->fd = -1; if (res != HTTP_OK) { err = http_get_error(conn->sesh); res = http_error_to_errno ("GET", res, err); goto error; } conn->isbusy = 0; return 0; error: 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, remname, 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; 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 (uri_parse (url, &(conn->uri), &av_dav_uri_defaults) != 0 || conn->uri.path == NULL || conn->uri.host == NULL) { av_log(AVLOG_ERROR, "DAV: Invalid URI '%s'", url); res = -1; goto error; } http_session_server (conn->sesh, conn->uri.host, conn->uri.port); res = fetch_resource_list (conn, conn->uri.path, 1, 1, &reslist); if (res != HTTP_OK) { err = http_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; } conn->isbusy = 0; return 0; error: 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); 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_unref_obj(lf); av_free(lf->url); av_del_tmpfile(lf->tmpfile); 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"); 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.0.5/modules/floppy.c0000644000175000017500000002171013102441254015364 0ustar michaelmichael/* 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.0.5/modules/ugzip.c0000644000175000017500000000126113102441254015210 0ustar michaelmichael/* 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.0.5/modules/bz2.c0000644000175000017500000000133613102441254014552 0ustar michaelmichael/* 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.0.5/modules/gz.c0000644000175000017500000000126513102441254014476 0ustar michaelmichael/* 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.0.5/modules/ftp.c0000644000175000017500000005731413102441254014655 0ustar michaelmichael/* 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.0.5/modules/uxze.c0000644000175000017500000000175213102441254015052 0ustar michaelmichael/* 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. UXZE module */ #include "filter.h" #include "version.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; 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; return av_init_filt(module, AV_VER, "uxze", uxze_args, xze_args, uxze_exts, &avfs); } avfs-1.0.5/modules/gtar.h0000644000175000017500000002170113102441254015015 0ustar michaelmichael/* 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.0.5/modules/ucftp.c0000644000175000017500000014716313102441254015207 0ustar michaelmichael/* 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; int res2; 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) { res2 = 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 ***************************************/ 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 */ } /*************************************** * 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.0.5/modules/rsh.c0000644000175000017500000001273613102441254014657 0ustar michaelmichael/* 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_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); 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.0.5/modules/Makefile.am0000644000175000017500000000150713102441254015745 0ustar michaelmichaelAM_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 if USE_LIBLZMA modules += uxz.c endif libmodules_la_SOURCES = \ $(modules) if BUILD_DAVSUPPORT modules += dav.c libmodules_la_SOURCES += dav.c 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.0.5/modules/make_initmod0000755000175000017500000000077613102441254016306 0ustar michaelmichael#! /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.0.5/modules/uz.c0000644000175000017500000000146213102441254014513 0ustar michaelmichael/* 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.0.5/modules/extfs.c0000644000175000017500000002660713102441254015216 0ustar michaelmichael/* 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.0.5/modules/ubz2.c0000644000175000017500000001271513102441254014742 0ustar michaelmichael/* 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.0.5/modules/volatile.c0000644000175000017500000004326513102441254015703 0ustar michaelmichael/* 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.0.5/modules/dav.h0000644000175000017500000000340213102441254014630 0ustar michaelmichael#ifndef INCLUDED_DAV_H #define INCLUDED_DAV_H 1 #include "passwords.h" #include #include #include #include #include #include /* --------------------------------------------------------------------- */ #define DAV_PARAM_SEP ':' #define AV_MAX_DAV_CONNS 128 /* --------------------------------------------------------------------- */ /** * The DAV connection structure. */ struct av_dav_conn { http_session *sesh; char *user; char *password; struct uri uri; int isbusy; }; struct av_dav_fdidat { struct 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; char *displayname; 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.0.5/modules/ugz.c0000644000175000017500000002605113102441254014663 0ustar michaelmichael/* 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; avoff_t size; avoff_t dataoff; avuint crc; avtime_t mtime; }; struct gzfile { struct zfile *zfil; vfile *base; struct gznode *node; int validsize; }; #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; avoff_t sres; 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->dataoff = gb.total; sres = av_lseek(vf, -8, AVSEEK_END); if(sres < 0) return sres; res = av_read_all(vf, (char*)buf, 8); if(res < 0) return res; nod->crc = QBYTE(buf); nod->size = QBYTE(buf + 4); 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, nod->dataoff, nod->crc, 1); else fil->zfil = NULL; fil->base = base; fil->node = nod; if(strcmp(ve->mnt->opts, "-s") == 0) fil->validsize = 1; else fil->validsize = 0; *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, fil->node->dataoff, fil->node->crc, 0); 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; buf->size = nod->size; if(!fil->validsize && (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.0.5/modules/uzip.c0000644000175000017500000005474713102441254015062 0ustar michaelmichael/* 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; 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, 1); 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[5]; 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 = 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.0.5/modules/ubzip2.c0000644000175000017500000000127613102441254015273 0ustar michaelmichael/* 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.0.5/modules/urar.c0000644000175000017500000004077213102441254015035 0ustar michaelmichael/* 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 #define DOS_DIR_SEP_CHAR '\\' 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 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]; 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 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) { 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) == 0) return 0; 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 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; } static int read_rarfile(vfile *vf, struct archive *arch) { avoff_t headstart; int res; res = read_marker_block(vf); if(res < 0) return res; 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; } 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.0.5/modules/Makefile.in0000644000175000017500000005206113102441264015760 0ustar michaelmichael# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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 @BUILD_DAVSUPPORT_TRUE@am__append_2 = dav.c @BUILD_DAVSUPPORT_TRUE@am__append_3 = dav.c dav_ls.c subdir = modules DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp $(noinst_HEADERS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/neon-ssl.m4 \ $(top_srcdir)/macros/neon-xml-parser.m4 \ $(top_srcdir)/macros/neon.m4 $(top_srcdir)/macros/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) 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 uxz.c dav.c dav_ls.c @USE_LIBLZMA_TRUE@am__objects_1 = uxz.lo @BUILD_DAVSUPPORT_TRUE@am__objects_2 = dav.lo am__objects_3 = 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 $(am__objects_1) \ $(am__objects_2) @BUILD_DAVSUPPORT_TRUE@am__objects_4 = dav.lo dav_ls.lo am_libmodules_la_OBJECTS = $(am__objects_3) $(am__objects_4) 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__depfiles_maybe = depfiles 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 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@ EMACS = @EMACS@ 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@ KERNINCLUDE = @KERNINCLUDE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEONLIBS = @NEONLIBS@ NEONOBJS = @NEONOBJS@ NEON_BUILD_BUNDLED = @NEON_BUILD_BUNDLED@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ NEON_OBJEXT = @NEON_OBJEXT@ NEON_TARGET = @NEON_TARGET@ 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@ PRELOAD_LIBS = @PRELOAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ XML_CONFIG = @XML_CONFIG@ 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@ avfscoda_build = @avfscoda_build@ 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@ initstyle = @initstyle@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ kmoduledir = @kmoduledir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ preload_build = @preload_build@ profiledir = @profiledir@ program_transform_name = @program_transform_name@ psdir = @psdir@ rcdir = @rcdir@ rcscriptdir = @rcscriptdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ start_levels = @start_levels@ start_prio = @start_prio@ stop_levels = @stop_levels@ stop_prio = @stop_prio@ 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 $(am__append_1) $(am__append_2) libmodules_la_SOURCES = $(modules) $(am__append_3) 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 .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(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@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dav.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dav_ls.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extfs.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/floppy.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gz.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/http.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mod_static.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rsh.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uar.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ubz2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ubzip2.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ucftp.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ugz.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ugzip.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/urar.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utar.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uxz.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uxze.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uz.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uzip.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/volatile.Plo@am__quote@ .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 $< .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 `$(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: $(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 -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-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 -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am 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 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.0.5/modules/http.c0000644000175000017500000003370613102441254015042 0ustar michaelmichael/* 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.0.5/modules/dav_ls.c0000644000175000017500000001440213102441254015323 0ustar michaelmichael/* 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 #include #include #include #include "dav.h" 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 dav_propname flat_props[] = { { "DAV:", "getcontentlength" }, { "DAV:", "getlastmodified" }, { "DAV:", "displayname" }, { "http://apache.org/dav/props/", "executable" }, { NULL } }; static const dav_propname complex_props[] = { { "DAV:", "resourcetype" }, { NULL } }; #define ELM_resourcetype (DAV_ELM_207_UNUSED + 1) #define ELM_collection (DAV_ELM_207_UNUSED + 4) static const struct hip_xml_elm complex_elms[] = { { "DAV:", "resourcetype", ELM_resourcetype, 0 }, { "DAV:", "collection", ELM_collection, 0 }, { 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 char *uri, const dav_prop_result_set *set) { struct fetch_context *ctx = userdata; struct av_dav_resource *current, *previous, *newres; const char *clength, *modtime, *isexec, *abspath; const http_status *status = NULL; av_log (AVLOG_DEBUG, "DAV URI: %s", uri); newres = dav_propset_private(set); abspath = uri_abspath(uri); if (uri_compare(ctx->target, abspath) == 0 && !ctx->include_target) { /* This is the target URI, skip it */ av_free(newres); return; } newres->uri = ne_strdup(abspath); clength = dav_propset_value(set, &flat_props[0]); modtime = dav_propset_value(set, &flat_props[1]); isexec = dav_propset_value(set, &flat_props[2]); if (clength == NULL) status = dav_propset_status(set, &flat_props[0]); if (modtime == NULL) status = dav_propset_status(set, &flat_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 = http_dateparse(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; } static int end_element(void *userdata, const struct hip_xml_elm *elm, const char *cdata) { dav_propfind_handler *pfh = userdata; struct av_dav_resource *r = dav_propfind_current_private(pfh); if (r == NULL) { return 0; } if (elm->id == ELM_collection) { r->type = resr_collection; } return 0; } static int check_context(hip_xml_elmid parent, hip_xml_elmid child) { if ((parent == DAV_ELM_prop && child == ELM_resourcetype) || (parent == ELM_resourcetype && child == ELM_collection)) { return 0; } return 0; } void free_resource(struct av_dav_resource *res) { HTTP_FREE(res->uri); HTTP_FREE(res->displayname); HTTP_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 char *uri) { return ne_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) { dav_propfind_handler *pfh = dav_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; dav_propfind_set_flat(pfh, flat_props); hip_xml_push_handler(dav_propfind_get_parser(pfh), complex_elms, check_context, NULL, end_element, pfh); dav_propfind_set_complex(pfh, complex_props, create_private, NULL); ret = dav_propfind_named(pfh, results, &ctx); dav_propfind_destroy(pfh); return ret; } avfs-1.0.5/modules/uxz.c0000644000175000017500000001265313102441254014707 0ustar michaelmichael/* 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.0.5/modules/uar.c0000644000175000017500000001721113102441254014643 0ustar michaelmichael/* 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.0.5/modules/utar.c0000644000175000017500000011317513102441254015035 0ustar michaelmichael/* 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.0.5/modules/zipconst.h0000644000175000017500000000173513102441254015736 0ustar michaelmichael/* 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.0.5/install-sh0000755000175000017500000003325513102441264014253 0ustar michaelmichael#!/bin/sh # install - install a program, script, or datafile scriptversion=2011-11-20.07; # 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. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit=${DOITPROG-} if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # 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_glob='?' initialize_posix_glob=' test "$posix_glob" != "?" || { if (set -f) 2>/dev/null; then posix_glob= else posix_glob=: fi } ' posix_mkdir= # Desired mode of installed file. mode=0755 chgrpcmd= chmodcmd=$chmodprog chowncmd= mvcmd=$mvprog rmcmd="$rmprog -f" stripcmd= src= dst= dir_arg= dst_arg= copy_on_change=false no_target_directory= usage="\ Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: --help display this help and exit. --version display version info and exit. -c (ignored) -C install only if different (preserve the last 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. -s $stripprog installed files. -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 " 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 *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac shift;; -o) chowncmd="$chownprog $2" shift;; -s) stripcmd=$stripprog;; -t) dst_arg=$2 # Protect names problematic for 'test' and other utilities. case $dst_arg in -* | [=\(\)!]) dst_arg=./$dst_arg;; esac shift;; -T) no_target_directory=true;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac shift done 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 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=$? 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; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dst_arg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # 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 case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/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. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or 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 eval "$initialize_posix_glob" oIFS=$IFS IFS=/ $posix_glob set -f set fnord $dstdir shift $posix_glob 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=$dstdir/_inst.$$_ rmtmp=$dstdir/_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 && $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` && eval "$initialize_posix_glob" && $posix_glob set -f && set X $old && old=:$2:$4:$5:$6 && set X $new && new=:$2:$4:$5:$6 && $posix_glob set +f && test "$old" = "$new" && $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 then rm -f "$dsttmp" else # 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 -f "$dst" 2>/dev/null || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && { $doit $rmcmd -f "$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 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: avfs-1.0.5/NEWS0000644000175000017500000001762213102441254012745 0ustar michaelmichaelChanges 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.0.5/COPYING.LIB0000644000175000017500000006130313102441254013701 0ustar michaelmichael 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.0.5/config.guess0000755000175000017500000013111013102441264014554 0ustar michaelmichael#! /bin/sh # Attempt to guess a canonical system name. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-06-10' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 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. # # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD # # Please send patches with a ChangeLog entry to config-patches@gnu.org. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] Output the configuration name of the system \`$me' is run on. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. Copyright 1992-2013 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 trap 'exit 1' 1 2 15 # CC_FOR_BUILD -- compiler used by this script. Note that the use of a # compiler to aid in system detection is discouraged as it requires # temporary files to be created and, as you can see below, it is a # headache to deal with in a portable fashion. # Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still # use `HOST_CC' if defined, but it is deprecated. # Portable tmp directory creation inspired by the Autoconf team. set_cc_for_build=' trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; : ${TMPDIR=/tmp} ; { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; dummy=$tmp/dummy ; tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; case $CC_FOR_BUILD,$HOST_CC,$CC in ,,) echo "int x;" > $dummy.c ; for c in cc gcc c89 c99 ; do if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then CC_FOR_BUILD="$c"; break ; fi ; done ; if test x"$CC_FOR_BUILD" = x ; then CC_FOR_BUILD=no_compiler_found ; fi ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) if (test -f /.attbin/uname) >/dev/null 2>&1 ; then PATH=$PATH:/.attbin ; export PATH fi UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown case "${UNAME_SYSTEM}" in Linux|GNU|GNU/*) # If the system lacks a compiler, then just pick glibc. # We could probably try harder. LIBC=gnu eval $set_cc_for_build cat <<-EOF > $dummy.c #include #if defined(__UCLIBC__) LIBC=uclibc #elif defined(__dietlibc__) LIBC=dietlibc #else LIBC=gnu #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` ;; 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 # 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=`(/sbin/$sysctl 2>/dev/null || \ /usr/sbin/$sysctl 2>/dev/null || echo unknown)` case "${UNAME_MACHINE_ARCH}" in armeb) machine=armeb-unknown ;; arm*) machine=arm-unknown ;; sh3el) machine=shl-unknown ;; sh3eb) machine=sh-unknown ;; sh5el) machine=sh5le-unknown ;; *) machine=${UNAME_MACHINE_ARCH}-unknown ;; esac # The Operating System including object format, if it has switched # to ELF recently, or will in the future. case "${UNAME_MACHINE_ARCH}" in arm*|i386|m68k|ns32k|sh3*|sparc|vax) eval $set_cc_for_build if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -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 # The OS release # Debian GNU/NetBSD machines have a different userland, and # thus, need a distinct triplet. However, they do not need # kernel version information, so it can be replaced with a # suitable tag, in the style of linux-gnu. case "${UNAME_VERSION}" in Debian*) release='-gnu' ;; *) release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` ;; esac # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" exit ;; *: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 ;; *:ekkoBSD:*:*) echo ${UNAME_MACHINE}-${VENDOR}-ekkobsd${UNAME_RELEASE} exit ;; *:SolidBSD:*:*) echo ${UNAME_MACHINE}-${VENDOR}-solidbsd${UNAME_RELEASE} exit ;; macppc:MirBSD:*:*) echo powerpc-${VENDOR}-mirbsd${UNAME_RELEASE} exit ;; *:MirBSD:*:*) echo ${UNAME_MACHINE}-${VENDOR}-mirbsd${UNAME_RELEASE} 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 ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 exit ;; 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-pc-auroraux${UNAME_RELEASE} exit ;; i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) eval $set_cc_for_build SUN_ARCH="i386" # If there is a compiler, see if it is configured for 64-bit objects. # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. # This test works for both compilers. if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then SUN_ARCH="x86_64" fi fi echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # 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) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #ifdef __cplusplus #include /* for printf() prototype */ int main (int argc, char *argv[]) { #else int main (argc, argv) int argc; char *argv[]; { #endif #if defined (host_mips) && defined (MIPSEB) #if defined (SYSTYPE_SYSV) printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_SVR4) printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); #endif #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); #endif #endif exit (-1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && 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 [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] then if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ [ ${TARGET_BINARY_INTERFACE}x = x ] then echo m88k-dg-dgux${UNAME_RELEASE} else echo m88k-dg-dguxbcs${UNAME_RELEASE} fi else echo i586-dg-dgux${UNAME_RELEASE} fi exit ;; 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 [ -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 eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include main() { if (!__power_pc()) exit(1); puts("powerpc-ibm-aix3.2.5"); exit(0); } EOF 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 [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit ;; *:AIX:*:*) echo rs6000-ibm-aix exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) 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 [ -x /usr/bin/getconf ]; then sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` case "${sc_cpu_version}" in 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 532) # CPU_PA_RISC2_0 case "${sc_kernel_bits}" in 32) HP_ARCH="hppa2.0n" ;; 64) HP_ARCH="hppa2.0w" ;; '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 esac ;; esac fi if [ "${HP_ARCH}" = "" ]; then eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE #include #include int main () { #if defined(_SC_KERNEL_BITS) long bits = sysconf(_SC_KERNEL_BITS); #endif long cpu = sysconf (_SC_CPU_VERSION); switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0"); break; case CPU_PA_RISC1_1: puts ("hppa1.1"); break; case CPU_PA_RISC2_0: #if defined(_SC_KERNEL_BITS) switch (bits) { case 64: puts ("hppa2.0w"); break; case 32: puts ("hppa2.0n"); break; default: puts ("hppa2.0"); break; } break; #else /* !defined(_SC_KERNEL_BITS) */ puts ("hppa2.0"); break; #endif default: puts ("hppa1.0"); break; } exit (0); } EOF (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` test -z "$HP_ARCH" && HP_ARCH=hppa fi ;; esac if [ ${HP_ARCH} = "hppa2.0w" ] then eval $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:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #include int main () { long cpu = sysconf (_SC_CPU_VERSION); /* The order matters, because CPU_IS_HP_MC68K erroneously returns true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct results, however. */ if (CPU_IS_PA_RISC (cpu)) { switch (cpu) { case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; default: puts ("hppa-hitachi-hiuxwe2"); break; } } else if (CPU_IS_HP_MC68K (cpu)) puts ("m68k-hitachi-hiuxwe2"); else puts ("unknown-hitachi-hiuxwe2"); exit (0); } EOF $CC_FOR_BUILD -o $dummy $dummy.c && 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 [ -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}-pc-bsdi${UNAME_RELEASE} exit ;; sparc*:BSD/OS:*:*) echo sparc-${VENDOR}-bsdi${UNAME_RELEASE} exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-${VENDOR}-bsdi${UNAME_RELEASE} exit ;; *:FreeBSD:*:*) UNAME_PROCESSOR=`/usr/bin/uname -p` case ${UNAME_PROCESSOR} in amd64) echo x86_64-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; *) echo ${UNAME_PROCESSOR}-${VENDOR}-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; esac exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin exit ;; *:MINGW64*:*) echo ${UNAME_MACHINE}-pc-mingw64 exit ;; *:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 exit ;; i*:MSYS*:*) echo ${UNAME_MACHINE}-pc-msys exit ;; i*:windows32*:*) # uname -m includes "-pc" on this system. echo ${UNAME_MACHINE}-mingw32 exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 exit ;; *:Interix*:*) case ${UNAME_MACHINE} in x86) echo i586-pc-interix${UNAME_RELEASE} exit ;; authenticamd | genuineintel | EM64T) echo x86_64-${VENDOR}-interix${UNAME_RELEASE} exit ;; IA64) echo ia64-${VENDOR}-interix${UNAME_RELEASE} exit ;; esac ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks exit ;; 8664:Windows_NT:*) echo x86_64-pc-mks exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin exit ;; amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) echo x86_64-${VENDOR}-cygwin exit ;; p*:CYGWIN*:*) echo powerpcle-${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 '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-${LIBC} exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-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` 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:*:*) eval $set_cc_for_build if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ | grep -q __ARM_EABI__ then echo ${UNAME_MACHINE}-${VENDOR}-linux-${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 ;; frv:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; hexagon:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; i*86:Linux:*:*) echo ${UNAME_MACHINE}-pc-linux-${LIBC} exit ;; ia64: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:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c #undef CPU #undef ${UNAME_MACHINE} #undef ${UNAME_MACHINE}el #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) CPU=${UNAME_MACHINE}el #else #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) CPU=${UNAME_MACHINE} #else CPU= #endif #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` test x"${CPU}" != x && { echo "${CPU}-${VENDOR}-linux-${LIBC}"; exit; } ;; or1k:Linux:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} exit ;; or32: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 ;; 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:*:*) echo ${UNAME_MACHINE}-${VENDOR}-linux-${LIBC} 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}-pc-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}-pc-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}-pc-syllable exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) echo i386-${VENODR}-lynxos${UNAME_RELEASE} exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi exit ;; 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}-pc-sco$UNAME_REL else echo ${UNAME_MACHINE}-pc-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 configury will decide that # this is a cross-build. echo i586-pc-msdosdjgpp exit ;; Intel:Mach:3*:*) echo i386-pc-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-${VENODR}-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 [ -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-pc-beos exit ;; BePC:Haiku:*:*) # Haiku running on Intel PC compatible. echo i586-pc-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 ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} exit ;; *:Darwin:*:*) UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown eval $set_cc_for_build if test "$UNAME_PROCESSOR" = unknown ; then UNAME_PROCESSOR=powerpc fi if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ grep IS_64BIT_ARCH >/dev/null then case $UNAME_PROCESSOR in i386) UNAME_PROCESSOR=x86_64 ;; powerpc) UNAME_PROCESSOR=powerpc64 ;; esac fi 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-pc-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 ;; *: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. 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-pc-xenix exit ;; i*86:skyos:*:*) echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' exit ;; i*86:rdos:*:*) echo ${UNAME_MACHINE}-pc-rdos exit ;; i*86:AROS:*:*) echo ${UNAME_MACHINE}-pc-aros exit ;; x86_64:VMkernel:*:*) echo ${UNAME_MACHINE}-${VENDOR}-esx exit ;; esac eval $set_cc_for_build cat >$dummy.c < # include #endif main () { #if defined (sony) #if defined (MIPSEB) /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, I don't know.... */ printf ("mips-sony-bsd\n"); exit (0); #else #include printf ("m68k-sony-newsos%s\n", #ifdef NEWSOS4 "4" #else "" #endif ); exit (0); #endif #endif #if defined (__arm) && defined (__acorn) && defined (__unix) printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) printf ("m68k-hp-bsd\n"); exit (0); #endif #if defined (NeXT) #if !defined (__ARCHITECTURE__) #define __ARCHITECTURE__ "m68k" #endif int version; version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; if (version < 4) printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); else printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); exit (0); #endif #if defined (MULTIMAX) || defined (n16) #if defined (UMAXV) printf ("ns32k-encore-sysv\n"); exit (0); #else #if defined (CMU) printf ("ns32k-encore-mach\n"); exit (0); #else printf ("ns32k-encore-bsd\n"); exit (0); #endif #endif #endif #if defined (__386BSD__) printf ("i386-pc-bsd\n"); exit (0); #endif #if defined (sequent) #if defined (i386) printf ("i386-sequent-dynix\n"); exit (0); #endif #if defined (ns32000) printf ("ns32k-sequent-dynix\n"); exit (0); #endif #endif #if defined (_SEQUENT_) struct utsname un; uname(&un); if (strncmp(un.version, "V2", 2) == 0) { printf ("i386-sequent-ptx2\n"); exit (0); } if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ printf ("i386-sequent-ptx1\n"); exit (0); } printf ("i386-sequent-ptx\n"); exit (0); #endif #if defined (vax) # if !defined (ultrix) # include # if defined (BSD) # if BSD == 43 printf ("vax-dec-bsd4.3\n"); exit (0); # else # if BSD == 199006 printf ("vax-dec-bsd4.3reno\n"); exit (0); # else printf ("vax-dec-bsd\n"); exit (0); # endif # endif # else printf ("vax-dec-bsd\n"); exit (0); # endif # else printf ("vax-dec-ultrix\n"); exit (0); # endif #endif #if defined (alliant) && defined (i860) printf ("i860-alliant-bsd\n"); exit (0); #endif exit (1); } EOF $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) if [ -x /usr/convex/getsysinfo ] then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi exit ;; c34*) echo c34-convex-bsd exit ;; c38*) echo c38-convex-bsd exit ;; c4*) echo c4-convex-bsd exit ;; esac fi cat >&2 < in order to provide the needed information to handle your system. config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` /bin/uname -X = `(/bin/uname -X) 2>/dev/null` hostinfo = `(hostinfo) 2>/dev/null` /bin/universe = `(/bin/universe) 2>/dev/null` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` /bin/arch = `(/bin/arch) 2>/dev/null` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` UNAME_MACHINE = ${UNAME_MACHINE} UNAME_RELEASE = ${UNAME_RELEASE} UNAME_SYSTEM = ${UNAME_SYSTEM} UNAME_VERSION = ${UNAME_VERSION} EOF exit 1 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: avfs-1.0.5/fuse/0000755000175000017500000000000013102441322013174 5ustar michaelmichaelavfs-1.0.5/fuse/Makefile.am0000644000175000017500000000032213102441254015231 0ustar michaelmichaelif 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.0.5/fuse/Makefile.in0000644000175000017500000005020713102441264015252 0ustar michaelmichael# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/neon-ssl.m4 \ $(top_srcdir)/macros/neon-xml-parser.m4 \ $(top_srcdir)/macros/neon.m4 $(top_srcdir)/macros/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) 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__depfiles_maybe = depfiles 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 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@ EMACS = @EMACS@ 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@ KERNINCLUDE = @KERNINCLUDE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEONLIBS = @NEONLIBS@ NEONOBJS = @NEONOBJS@ NEON_BUILD_BUNDLED = @NEON_BUILD_BUNDLED@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ NEON_OBJEXT = @NEON_OBJEXT@ NEON_TARGET = @NEON_TARGET@ 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@ PRELOAD_LIBS = @PRELOAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ XML_CONFIG = @XML_CONFIG@ 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@ avfscoda_build = @avfscoda_build@ 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@ initstyle = @initstyle@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ kmoduledir = @kmoduledir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ preload_build = @preload_build@ profiledir = @profiledir@ program_transform_name = @program_transform_name@ psdir = @psdir@ rcdir = @rcdir@ rcscriptdir = @rcscriptdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ start_levels = @start_levels@ start_prio = @start_prio@ stop_levels = @stop_levels@ stop_prio = @stop_prio@ 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 .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(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@ .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 $< .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 `$(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: $(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 -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-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 -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am 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 # 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.0.5/fuse/avfsd.c0000644000175000017500000001336213102441254014454 0ustar michaelmichael/* 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.0.5/scripts/0000755000175000017500000000000013102441322013721 5ustar michaelmichaelavfs-1.0.5/scripts/davpass0000755000175000017500000000256313102441254015322 0ustar michaelmichael#! /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.0.5/scripts/Makefile.am0000644000175000017500000000444613102441254015771 0ustar michaelmichaelSUBDIRS = init #################### initstyle = @initstyle@ start_levels = @start_levels@ stop_levels = @stop_levels@ start_prio = @start_prio@ stop_prio = @stop_prio@ i_rcdir = $(DESTDIR)/@rcdir@ rcscriptdir = @rcscriptdir@ i_profiledir = @profiledir@ absrcscriptdir = $(i_rcdir)/$(rcscriptdir) startname = S$(start_prio)avfscoda stopname = K$(stop_prio)avfscoda i_overlaydir = $(DESTDIR)/overlay i_devdir = $(DESTDIR)/dev i_codadev0 = $(i_devdir)/cfs0 i_codadev1 = $(i_devdir)/cfs1 i_emacsstart = $(sysconfdir)/emacs/site-start.d ################# EXTRA_DIST = avfscoda.csh avfscoda.sh avfscoda.el davpass ftppass mountavfs umountavfs bin_SCRIPTS = ftppass davpass @install_scriptcomps@ EXTRA_SCRIPTS = avfs-config if INSTALL_EMACS if INSTALL_AVFSCODA emacsscriptdir = $(i_emacsstart) emacsscript_SCRIPTS = avfscoda.el endif endif if INSTALL_AVFSCODA_PROFILE avfscodaprofiledir = $(i_profiledir) avfscodaprofile_SCRIPTS = avfscoda.csh avfscoda.sh endif #if INSTALL_INITSCRIPT #initscriptdir = $(absrcscriptdir) #initscript_SCRIPTS = init/avfscoda.@initstyle@ #endif install-data-local: if INSTALL_INITSCRIPT @$(mkinstalldirs) $(absrcscriptdir) $(INSTALL_SCRIPT) $(srcdir)/init/avfscoda.@initstyle@ $(absrcscriptdir)/avfscoda endif if INSTALL_SCRIPTLINKS @for i in $(start_levels); do \ $(mkinstalldirs) $(i_rcdir)/rc$$i.d; \ echo Creating start link for runlevel $$i; \ rm -f $(i_rcdir)/rc$$i.d/$(startname); \ ln -s ../$(rcscriptdir)/avfscoda $(i_rcdir)/rc$$i.d/$(startname); \ done @for i in $(stop_levels); do \ $(mkinstalldirs) $(i_rcdir)/rc$$i.d; \ echo Creating stop link for runlevel $$i; \ rm -f $(i_rcdir)/rc$$i.d/$(stopname); \ ln -s ../$(rcscriptdir)/avfscoda $(i_rcdir)/rc$$i.d/$(stopname); \ done endif if INSTALL_CODADEV @$(mkinstalldirs) $(i_overlaydir) @$(mkinstalldirs) $(i_devdir) @if ! test -e $(i_codadev0); then mknod -m 600 $(i_codadev0) c 67 0; fi @if ! test -e $(i_codadev1); then mknod -m 600 $(i_codadev1) c 67 1; fi endif uninstall-local: if INSTALL_INITSCRIPT rm -f $(absrcscriptdir)/avfscoda endif if INSTALL_SCRIPTLINKS @for i in $(start_levels); do \ rm -f $(i_rcdir)/rc$$i.d/$(startname); \ done @for i in $(stop_levels); do \ rm -f $(i_rcdir)/rc$$i.d/$(stopname); \ done endif start: $(absrcscriptdir)/avfscoda start avfs-1.0.5/scripts/mountavfs0000755000175000017500000000141013102441254015671 0ustar michaelmichael#!/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.0.5/scripts/avfscoda.csh0000755000175000017500000000047113102441254016217 0ustar michaelmichaelif ( -f ~/.avfs) then if ( ! -f '/#avfs-on' ) then true endif else if ( ! -f '/#avfs-off' ) then true endif endif alias avfs-on 'if ( ! -f /#avfs-on ) echo "avfs turned on"' alias avfs-off 'if ( ! -f /#avfs-off ) echo "avfs turned off"' alias avfs-stat 'if ( -e /#avfsstat ) cat /#avfsstat/copyright' avfs-1.0.5/scripts/avfscoda.el0000644000175000017500000000121713102441254016036 0ustar michaelmichael;; avfscoda.el ;; ;; If a path begins with #, prevent ange-ftp in handling it. ;; ;; Written by David Hanak ;; ======================================================================== (defun avfs-normal-find-file-handler (op &rest args) (let ((file-name-handler-alist (apply 'append (mapcar '(lambda (itm) (unless (string-match "^ange-ftp-\\|^avfs-" (symbol-name (cdr itm))) (list itm))) file-name-handler-alist)))) (apply op args))) (or (assoc "^/#" file-name-handler-alist) (setq file-name-handler-alist (cons '("^/#" . avfs-normal-find-file-handler) file-name-handler-alist))) avfs-1.0.5/scripts/umountavfs0000644000175000017500000000110313102441254016052 0ustar michaelmichael#!/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.0.5/scripts/avfs-config.in0000644000175000017500000000223713102441254016463 0ustar michaelmichael#!/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.0.5/scripts/avfscoda.sh0000755000175000017500000000052113102441254016050 0ustar michaelmichaelif [ -f ~/.avfs ]; then if [ ! -f '/#avfs-on' ]; then true fi else if [ ! -f '/#avfs-off' ]; then true fi fi alias avfs-on='if [ ! -f /#avfs-on ]; then echo "avfs turned on"; fi' alias avfs-off='if [ ! -f /#avfs-off ]; then echo "avfs turned off"; fi' alias avfs-stat='if [ -e /#avfsstat ]; then cat /#avfsstat/copyright; fi' avfs-1.0.5/scripts/init/0000755000175000017500000000000013102441322014664 5ustar michaelmichaelavfs-1.0.5/scripts/init/avfscoda.debian0000755000175000017500000000160613102441254017630 0ustar michaelmichael#! /bin/sh # avfscoda # init script for debian return=$rc_done case "$1" in start) echo -n "Loading redir module" /sbin/modprobe -s redir || echo -n " failed" echo "." # try to load coda module (no problem if it fails, because it can be # in the kernel) /sbin/modprobe coda > /dev/null 2>&1 echo -n "Starting avfscoda" start-stop-daemon --start --quiet --exec /usr/sbin/avfscoda echo "." ;; stop) echo -n "Shutting down avfscoda" if test -x /usr/sbin/flushredir; then /usr/sbin/flushredir fi start-stop-daemon --stop --quiet --exec /usr/sbin/avfscoda echo "." echo -n "Unloading redir module" /sbin/rmmod -s redir || echo -n " failed" echo "." ;; restart|reload|force-reload) $0 stop && $0 start || return=$rc_failed ;; status) echo "Checking for avfscoda: ???" ;; *) echo "Usage: $0 {start|stop|status|restart|reload}" exit 1 ;; esac exit 0 avfs-1.0.5/scripts/init/avfscoda.generic0000755000175000017500000000204613102441254020021 0ustar michaelmichael#! /bin/sh # avfscoda # generic init script rc_failed="\tFAILED" rc_done="\tOK" return=$rc_done case "$1" in start) echo -n "Loading redir module" /sbin/modprobe -s redir || return=$rc_failed echo -e "$return" # try to load coda module (no problem if it fails, because it can be # in the kernel) /sbin/modprobe coda > /dev/null 2>&1 return=$rc_done echo -n "Starting avfscoda" /usr/sbin/avfscoda || return=$rc_failed echo -e "$return" ;; stop) echo -n "Shutting down avfscoda" if test -x /usr/sbin/flushredir; then /usr/sbin/flushredir fi /usr/bin/killall avfscoda || return=$rc_failed echo -e "$return" return=$rc_done echo -n "Unloading redir module" /sbin/rmmod -s redir || return=$rc_failed echo -e "$return" ;; restart|reload) $0 stop && $0 start || return=$rc_failed ;; status) echo "Checking for avfscoda: ???" ;; *) echo "Usage: $0 {start|stop|status|restart|reload}" exit 1 ;; esac # Inform the caller not only verbosely and set an exit status. test "$return" = "$rc_done" || exit 1 exit 0 avfs-1.0.5/scripts/init/Makefile.am0000644000175000017500000000012513102441254016722 0ustar michaelmichaelEXTRA_DIST = avfscoda.debian \ avfscoda.generic \ avfscoda.redhat \ avfscoda.suse avfs-1.0.5/scripts/init/avfscoda.redhat0000755000175000017500000000167613102441254017664 0ustar michaelmichael#!/bin/bash # # /etc/rc.d/init.d/avfscoda # # Starts the AVFS coda support # # chkconfig: 345 85 25 # description: Starts the AVFS coda support module. # processname: avfscoda # Source function library. . /etc/rc.d/init.d/functions case "$1" in start) action "Loading redir module: " /sbin/modprobe -s redir # try to load coda module (no problem if it fails, because it can be # in the kernel) /sbin/modprobe coda > /dev/null 2>&1 echo -n "Starting avfscoda: " daemon avfscoda echo touch /var/lock/subsys/avfscoda ;; stop) echo -n "Stopping avfscoda: " if test -x /usr/sbin/flushredir; then /usr/sbin/flushredir fi killproc avfscoda echo action "Unloading redir module: " /sbin/rmmod -s redir rm -f /var/lock/subsys/avfscoda ;; restart) $0 stop $0 start ;; status) status avfscoda ;; *) echo "Usage: $0 {start|stop|status|restart}" exit 1 esac exit 0 avfs-1.0.5/scripts/init/Makefile.in0000644000175000017500000003125413102441264016743 0ustar michaelmichael# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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/init DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/neon-ssl.m4 \ $(top_srcdir)/macros/neon-xml-parser.m4 \ $(top_srcdir)/macros/neon.m4 $(top_srcdir)/macros/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) 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) 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@ EMACS = @EMACS@ 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@ KERNINCLUDE = @KERNINCLUDE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEONLIBS = @NEONLIBS@ NEONOBJS = @NEONOBJS@ NEON_BUILD_BUNDLED = @NEON_BUILD_BUNDLED@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ NEON_OBJEXT = @NEON_OBJEXT@ NEON_TARGET = @NEON_TARGET@ 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@ PRELOAD_LIBS = @PRELOAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ XML_CONFIG = @XML_CONFIG@ 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@ avfscoda_build = @avfscoda_build@ 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@ initstyle = @initstyle@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ kmoduledir = @kmoduledir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ preload_build = @preload_build@ profiledir = @profiledir@ program_transform_name = @program_transform_name@ psdir = @psdir@ rcdir = @rcdir@ rcscriptdir = @rcscriptdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ start_levels = @start_levels@ start_prio = @start_prio@ stop_levels = @stop_levels@ stop_prio = @stop_prio@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = avfscoda.debian \ avfscoda.generic \ avfscoda.redhat \ avfscoda.suse 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/init/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu scripts/init/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(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: $(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 # 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.0.5/scripts/init/avfscoda.suse0000755000175000017500000000214213102441254017361 0ustar michaelmichael#! /bin/sh # avfscoda # init script for SuSE . /etc/rc.config return=$rc_done case "$1" in start) echo -n "Loading redir module" /sbin/modprobe -s redir || return=$rc_failed echo -e "$return" # try to load coda module (no problem if it fails, because it can be # in the kernel) /sbin/modprobe coda > /dev/null 2>&1 return=$rc_done echo -n "Starting avfscoda" startproc /usr/sbin/avfscoda || return=$rc_failed echo -e "$return" ;; stop) echo -n "Shutting down avfscoda" if test -x /usr/sbin/flushredir; then /usr/sbin/flushredir fi killproc -TERM /usr/sbin/avfscoda || return=$rc_failed echo -e "$return" return=$rc_done echo -n "Unloading redir module" /sbin/rmmod -s redir || return=$rc_failed echo -e "$return" ;; restart|reload) $0 stop && $0 start || return=$rc_failed ;; status) echo -n "Checking for avfscoda: " checkproc /usr/sbin/avfscoda && echo OK || echo No process ;; *) echo "Usage: $0 {start|stop|status|restart|reload}" exit 1 ;; esac # Inform the caller not only verbosely and set an exit status. test "$return" = "$rc_done" || exit 1 exit 0 avfs-1.0.5/scripts/Makefile.in0000644000175000017500000006767013102441264016013 0ustar michaelmichael# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(srcdir)/avfs-config.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/neon-ssl.m4 \ $(top_srcdir)/macros/neon-xml-parser.m4 \ $(top_srcdir)/macros/neon.m4 $(top_srcdir)/macros/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) 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)$(avfscodaprofiledir)" \ "$(DESTDIR)$(bindir)" "$(DESTDIR)$(emacsscriptdir)" SCRIPTS = $(avfscodaprofile_SCRIPTS) $(bin_SCRIPTS) \ $(emacsscript_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 = 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 \ distdir 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 DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) am__relativize = \ dir0=`pwd`; \ sed_first='s,^\([^/]*\)/.*$$,\1,'; \ sed_rest='s,^[^/]*/*,,'; \ sed_last='s,^.*/\([^/]*\)$$,\1,'; \ sed_butlast='s,/*[^/]*$$,,'; \ while test -n "$$dir1"; do \ first=`echo "$$dir1" | sed -e "$$sed_first"`; \ if test "$$first" != "."; then \ if test "$$first" = ".."; then \ dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ else \ first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ if test "$$first2" = "$$first"; then \ dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ else \ dir2="../$$dir2"; \ fi; \ dir0="$$dir0"/"$$first"; \ fi; \ fi; \ dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ done; \ reldir="$$dir2" ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ 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@ EMACS = @EMACS@ 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@ KERNINCLUDE = @KERNINCLUDE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEONLIBS = @NEONLIBS@ NEONOBJS = @NEONOBJS@ NEON_BUILD_BUNDLED = @NEON_BUILD_BUNDLED@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ NEON_OBJEXT = @NEON_OBJEXT@ NEON_TARGET = @NEON_TARGET@ 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@ PRELOAD_LIBS = @PRELOAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ XML_CONFIG = @XML_CONFIG@ 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@ avfscoda_build = @avfscoda_build@ 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@ #################### initstyle = @initstyle@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ kmoduledir = @kmoduledir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ preload_build = @preload_build@ profiledir = @profiledir@ program_transform_name = @program_transform_name@ psdir = @psdir@ rcdir = @rcdir@ rcscriptdir = @rcscriptdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ start_levels = @start_levels@ start_prio = @start_prio@ stop_levels = @stop_levels@ stop_prio = @stop_prio@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = init i_rcdir = $(DESTDIR)/@rcdir@ i_profiledir = @profiledir@ absrcscriptdir = $(i_rcdir)/$(rcscriptdir) startname = S$(start_prio)avfscoda stopname = K$(stop_prio)avfscoda i_overlaydir = $(DESTDIR)/overlay i_devdir = $(DESTDIR)/dev i_codadev0 = $(i_devdir)/cfs0 i_codadev1 = $(i_devdir)/cfs1 i_emacsstart = $(sysconfdir)/emacs/site-start.d ################# EXTRA_DIST = avfscoda.csh avfscoda.sh avfscoda.el davpass ftppass mountavfs umountavfs bin_SCRIPTS = ftppass davpass @install_scriptcomps@ EXTRA_SCRIPTS = avfs-config @INSTALL_AVFSCODA_TRUE@@INSTALL_EMACS_TRUE@emacsscriptdir = $(i_emacsstart) @INSTALL_AVFSCODA_TRUE@@INSTALL_EMACS_TRUE@emacsscript_SCRIPTS = avfscoda.el @INSTALL_AVFSCODA_PROFILE_TRUE@avfscodaprofiledir = $(i_profiledir) @INSTALL_AVFSCODA_PROFILE_TRUE@avfscodaprofile_SCRIPTS = avfscoda.csh avfscoda.sh all: all-recursive .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 .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(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-avfscodaprofileSCRIPTS: $(avfscodaprofile_SCRIPTS) @$(NORMAL_INSTALL) @list='$(avfscodaprofile_SCRIPTS)'; test -n "$(avfscodaprofiledir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(avfscodaprofiledir)'"; \ $(MKDIR_P) "$(DESTDIR)$(avfscodaprofiledir)" || 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)$(avfscodaprofiledir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(avfscodaprofiledir)$$dir" || exit $$?; \ } \ ; done uninstall-avfscodaprofileSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(avfscodaprofile_SCRIPTS)'; test -n "$(avfscodaprofiledir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(avfscodaprofiledir)'; $(am__uninstall_files_from_dir) 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) install-emacsscriptSCRIPTS: $(emacsscript_SCRIPTS) @$(NORMAL_INSTALL) @list='$(emacsscript_SCRIPTS)'; test -n "$(emacsscriptdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(emacsscriptdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(emacsscriptdir)" || 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)$(emacsscriptdir)$$dir'"; \ $(INSTALL_SCRIPT) $$files "$(DESTDIR)$(emacsscriptdir)$$dir" || exit $$?; \ } \ ; done uninstall-emacsscriptSCRIPTS: @$(NORMAL_UNINSTALL) @list='$(emacsscript_SCRIPTS)'; test -n "$(emacsscriptdir)" || exit 0; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 's,.*/,,;$(transform)'`; \ dir='$(DESTDIR)$(emacsscriptdir)'; $(am__uninstall_files_from_dir) mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs # 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" 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 distdir: $(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 @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 check-am: all-am check: check-recursive all-am: Makefile $(SCRIPTS) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(avfscodaprofiledir)" "$(DESTDIR)$(bindir)" "$(DESTDIR)$(emacsscriptdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: 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 Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive html-am: info: info-recursive info-am: install-data-am: install-avfscodaprofileSCRIPTS install-data-local \ install-emacsscriptSCRIPTS install-dvi: install-dvi-recursive install-dvi-am: install-exec-am: install-binSCRIPTS 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 Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic mostlyclean-libtool pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-avfscodaprofileSCRIPTS uninstall-binSCRIPTS \ uninstall-emacsscriptSCRIPTS uninstall-local .MAKE: $(am__recursive_targets) install-am install-strip .PHONY: $(am__recursive_targets) CTAGS GTAGS TAGS all all-am check \ check-am clean clean-generic clean-libtool cscopelist-am ctags \ ctags-am distclean distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-avfscodaprofileSCRIPTS \ install-binSCRIPTS install-data install-data-am \ install-data-local install-dvi install-dvi-am \ install-emacsscriptSCRIPTS 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 uninstall-avfscodaprofileSCRIPTS \ uninstall-binSCRIPTS uninstall-emacsscriptSCRIPTS \ uninstall-local #if INSTALL_INITSCRIPT #initscriptdir = $(absrcscriptdir) #initscript_SCRIPTS = init/avfscoda.@initstyle@ #endif install-data-local: @INSTALL_INITSCRIPT_TRUE@ @$(mkinstalldirs) $(absrcscriptdir) @INSTALL_INITSCRIPT_TRUE@ $(INSTALL_SCRIPT) $(srcdir)/init/avfscoda.@initstyle@ $(absrcscriptdir)/avfscoda @INSTALL_SCRIPTLINKS_TRUE@ @for i in $(start_levels); do \ @INSTALL_SCRIPTLINKS_TRUE@ $(mkinstalldirs) $(i_rcdir)/rc$$i.d; \ @INSTALL_SCRIPTLINKS_TRUE@ echo Creating start link for runlevel $$i; \ @INSTALL_SCRIPTLINKS_TRUE@ rm -f $(i_rcdir)/rc$$i.d/$(startname); \ @INSTALL_SCRIPTLINKS_TRUE@ ln -s ../$(rcscriptdir)/avfscoda $(i_rcdir)/rc$$i.d/$(startname); \ @INSTALL_SCRIPTLINKS_TRUE@ done @INSTALL_SCRIPTLINKS_TRUE@ @for i in $(stop_levels); do \ @INSTALL_SCRIPTLINKS_TRUE@ $(mkinstalldirs) $(i_rcdir)/rc$$i.d; \ @INSTALL_SCRIPTLINKS_TRUE@ echo Creating stop link for runlevel $$i; \ @INSTALL_SCRIPTLINKS_TRUE@ rm -f $(i_rcdir)/rc$$i.d/$(stopname); \ @INSTALL_SCRIPTLINKS_TRUE@ ln -s ../$(rcscriptdir)/avfscoda $(i_rcdir)/rc$$i.d/$(stopname); \ @INSTALL_SCRIPTLINKS_TRUE@ done @INSTALL_CODADEV_TRUE@ @$(mkinstalldirs) $(i_overlaydir) @INSTALL_CODADEV_TRUE@ @$(mkinstalldirs) $(i_devdir) @INSTALL_CODADEV_TRUE@ @if ! test -e $(i_codadev0); then mknod -m 600 $(i_codadev0) c 67 0; fi @INSTALL_CODADEV_TRUE@ @if ! test -e $(i_codadev1); then mknod -m 600 $(i_codadev1) c 67 1; fi uninstall-local: @INSTALL_INITSCRIPT_TRUE@ rm -f $(absrcscriptdir)/avfscoda @INSTALL_SCRIPTLINKS_TRUE@ @for i in $(start_levels); do \ @INSTALL_SCRIPTLINKS_TRUE@ rm -f $(i_rcdir)/rc$$i.d/$(startname); \ @INSTALL_SCRIPTLINKS_TRUE@ done @INSTALL_SCRIPTLINKS_TRUE@ @for i in $(stop_levels); do \ @INSTALL_SCRIPTLINKS_TRUE@ rm -f $(i_rcdir)/rc$$i.d/$(stopname); \ @INSTALL_SCRIPTLINKS_TRUE@ done start: $(absrcscriptdir)/avfscoda start # 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.0.5/scripts/ftppass0000755000175000017500000000134013102441254015331 0ustar michaelmichael#! /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.0.5/spec/0000755000175000017500000000000013102441322013164 5ustar michaelmichaelavfs-1.0.5/spec/avfspreload-libc5.spec0000644000175000017500000000154613102441254017354 0ustar michaelmichael%define libcver libc5 %define avfs_version 0.5.2 Summary: A Virtual File System Name: avfs Version: %{avfs_version} Release: %{libcver} Copyright: LGPL Group: Libraries Source: http://www.inf.bme.hu/~mszeredi/avfs/avfs-%{avfs_version}.tar.gz URL: http://www.inf.bme.hu/~mszeredi/avfs Packager: Miklos Szeredi BuildRoot: /tmp/avfs %description AVFS is a C library add-on, which enables all programs to look inside gzip, tar, zip, ... files, without recompiling the programs or changing the kernel. %prep %setup %build ./configure --disable-debug --enable-preload make %install rm -rf "$RPM_BUILD_ROOT" make install_root="$RPM_BUILD_ROOT" install %clean rm -rf "$RPM_BUILD_ROOT" %post /sbin/ldconfig %files %doc README COPYING COPYING.LIB FORMAT NEWS TODO %dir /usr/lib/avfs /usr/lib/libavfs.so* /usr/lib/avfs/avfs_module* /usr/lib/avfs/extfs/* avfs-1.0.5/spec/Makefile.am0000644000175000017500000000011313102441254015217 0ustar michaelmichaelEXTRA_DIST = avfscoda-redhat.spec avfspreload-libc5.spec avfsfuse-fc6.spec avfs-1.0.5/spec/avfscoda-redhat.spec0000644000175000017500000000265113102441254017103 0ustar michaelmichael%define avfs_release redhat60 %define avfs_version 0.5.2 %define kernel_version 2.2.5-15 Summary: A Virtual File System Name: avfs Version: %{avfs_version} Release: %{avfs_release} Copyright: LGPL Group: System_Environment/Daemons Source: http://www.inf.bme.hu/~mszeredi/avfs/avfs-%{avfs_version}.tar.gz URL: http://www.inf.bme.hu/~mszeredi/avfs Packager: Miklos Szeredi BuildRoot: /tmp/avfs AutoReqProv: no Requires: kernel = %{kernel_version} %description AVFS is a system, which enables all programs to look inside gzip, tar, zip, ... files, without recompiling the programs or changing the kernel. %prep %setup %build ./configure --disable-debug make %install rm -rf "$RPM_BUILD_ROOT" make install_root="$RPM_BUILD_ROOT" install %clean rm -rf "$RPM_BUILD_ROOT" %pre if test "$1" -gt 1; then /etc/rc.d/init.d/avfscoda stop fi %post if test ! -e /overlay; then mkdir /overlay; fi if test "$1" = 1; then /etc/rc.d/init.d/avfscoda start fi %preun if test "$1" = 0; then /etc/rc.d/init.d/avfscoda stop fi %postun if test "$1" -ge 1; then /etc/rc.d/init.d/avfscoda start fi %files %doc README INSTALL.avfscoda INSTALL.preload COPYING COPYING.LIB FORMAT NEWS TODO %dir /usr/lib/avfs %dir /usr/lib/avfs/extfs /usr/sbin/avfscoda /dev/cfs0 /usr/lib/avfs/extfs/* /lib/modules/%{kernel_version}/misc/redir.o /etc/profile.d/avfscoda.sh /etc/profile.d/avfscoda.csh /etc/rc.d/init.d/avfscoda /etc/rc.d/rc?.d/???avfscoda avfs-1.0.5/spec/avfsfuse-fc6.spec0000644000175000017500000000336513102441254016351 0ustar michaelmichael%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.0.5/spec/Makefile.in0000644000175000017500000003121113102441265015235 0ustar michaelmichael# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/neon-ssl.m4 \ $(top_srcdir)/macros/neon-xml-parser.m4 \ $(top_srcdir)/macros/neon.m4 $(top_srcdir)/macros/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) 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) 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@ EMACS = @EMACS@ 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@ KERNINCLUDE = @KERNINCLUDE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEONLIBS = @NEONLIBS@ NEONOBJS = @NEONOBJS@ NEON_BUILD_BUNDLED = @NEON_BUILD_BUNDLED@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ NEON_OBJEXT = @NEON_OBJEXT@ NEON_TARGET = @NEON_TARGET@ 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@ PRELOAD_LIBS = @PRELOAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ XML_CONFIG = @XML_CONFIG@ 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@ avfscoda_build = @avfscoda_build@ 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@ initstyle = @initstyle@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ kmoduledir = @kmoduledir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ preload_build = @preload_build@ profiledir = @profiledir@ program_transform_name = @program_transform_name@ psdir = @psdir@ rcdir = @rcdir@ rcscriptdir = @rcscriptdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ start_levels = @start_levels@ start_prio = @start_prio@ stop_levels = @stop_levels@ stop_prio = @stop_prio@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = avfscoda-redhat.spec avfspreload-libc5.spec 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 .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(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: $(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 # 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.0.5/README0000644000175000017500000002361013102441254013120 0ustar michaelmichaelWhat 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 supporting AVFS with LD_PRELOAD 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. - Avfscoda This method in theory works on any Linux system which has the 'coda' filesystem compiled in the kernel or as a kernel module. In practice it works best with glibc-6.1 or higher, and it has been tested on 2.2.X and 2.4.X kernels. It currently does not work on 2.6.X kernels. - Preload Currently this works on solaris systems. There are problems making the preload method work for GLIBC version 6.1 or higher, so systems using GLIBC are not supported. - 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', 'INSTALL.avfscoda', 'INSTALL.preload', 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: (For the 'preload' method the shell itself must be started with avfs) 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#/* . (For the 'preload' method, using '*' means that the shell must be started with AVFS) 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. NOTES: 1) ('preload' only) Input and output redirection to/from virtual files does not work, since, in the 'preload' method, virtual file descriptors cannot be kept open over exec(). This is not a problem with the 'avfscoda' method. E.g. you can't do patch -p0 < patchfile.gz# only cat patchfile.gz# | patch -p0 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) 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 #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 #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.0.5/ChangeLog0000644000175000017500000003764513102441254014027 0ustar michaelmichael2017-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.0.5/TODO0000644000175000017500000000127613102441254012734 0ustar michaelmichaelWrite 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 Avfscoda: - Clean soloution to file access permissions - Faster random access to files (at least streaming access) Preload: - remember cwd after exec - add missing operations avfs-1.0.5/lib/0000755000175000017500000000000013102441322013000 5ustar michaelmichaelavfs-1.0.5/lib/Makefile.am0000644000175000017500000000175413102441254015047 0ustar michaelmichael##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.0.5/lib/Makefile.in0000644000175000017500000004466313102441264015067 0ustar michaelmichael# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/neon-ssl.m4 \ $(top_srcdir)/macros/neon-xml-parser.m4 \ $(top_srcdir)/macros/neon.m4 $(top_srcdir)/macros/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) 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) 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@ EMACS = @EMACS@ 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@ KERNINCLUDE = @KERNINCLUDE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEONLIBS = @NEONLIBS@ NEONOBJS = @NEONOBJS@ NEON_BUILD_BUNDLED = @NEON_BUILD_BUNDLED@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ NEON_OBJEXT = @NEON_OBJEXT@ NEON_TARGET = @NEON_TARGET@ 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@ PRELOAD_LIBS = @PRELOAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ XML_CONFIG = @XML_CONFIG@ 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@ avfscoda_build = @avfscoda_build@ 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@ initstyle = @initstyle@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ kmoduledir = @kmoduledir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ preload_build = @preload_build@ profiledir = @profiledir@ program_transform_name = @program_transform_name@ psdir = @psdir@ rcdir = @rcdir@ rcscriptdir = @rcscriptdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ start_levels = @start_levels@ start_prio = @start_prio@ stop_levels = @stop_levels@ stop_prio = @stop_prio@ 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 .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(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: $(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 # 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.0.5/lib/libavfs.map0000644000175000017500000000106413102441254015132 0ustar michaelmichaelLIBAVFS { 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.0.5/test/0000755000175000017500000000000013102441322013211 5ustar michaelmichaelavfs-1.0.5/test/Makefile.am0000644000175000017500000000046213102441254015253 0ustar michaelmichaelnoinst_PROGRAMS = runtest testread 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 avfs-1.0.5/test/testread.c0000644000175000017500000000231013102441254015170 0ustar michaelmichael/* 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 int main( int argc, char **argv ) { int fd; ssize_t len; char buf[128*1024]; if ( argc < 2 ) { return 0; } fd = virt_open( argv[1], O_RDONLY, 0 ); if ( fd >= 0 ) { ssize_t total_len; for (;;) { len = virt_read( fd, buf, sizeof( buf ) ); total_len += len; printf( "Bytes read: %lu\n", len ); if ( len == 0 ) break; } 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.0.5/test/runtest.c0000644000175000017500000001272713102441254015076 0ustar michaelmichael/* 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.0.5/test/Makefile.in0000644000175000017500000004561613102441265015300 0ustar michaelmichael# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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) subdir = test DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/neon-ssl.m4 \ $(top_srcdir)/macros/neon-xml-parser.m4 \ $(top_srcdir)/macros/neon.m4 $(top_srcdir)/macros/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = PROGRAMS = $(noinst_PROGRAMS) am_runtest_OBJECTS = runtest.$(OBJEXT) runtest_OBJECTS = $(am_runtest_OBJECTS) runtest_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 = 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__depfiles_maybe = depfiles 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 = $(runtest_SOURCES) $(testread_SOURCES) DIST_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 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@ EMACS = @EMACS@ 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@ KERNINCLUDE = @KERNINCLUDE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEONLIBS = @NEONLIBS@ NEONOBJS = @NEONOBJS@ NEON_BUILD_BUNDLED = @NEON_BUILD_BUNDLED@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ NEON_OBJEXT = @NEON_OBJEXT@ NEON_TARGET = @NEON_TARGET@ 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@ PRELOAD_LIBS = @PRELOAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ XML_CONFIG = @XML_CONFIG@ 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@ avfscoda_build = @avfscoda_build@ 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@ initstyle = @initstyle@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ kmoduledir = @kmoduledir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ preload_build = @preload_build@ profiledir = @profiledir@ program_transform_name = @program_transform_name@ psdir = @psdir@ rcdir = @rcdir@ rcscriptdir = @rcscriptdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ start_levels = @start_levels@ start_prio = @start_prio@ stop_levels = @stop_levels@ stop_prio = @stop_prio@ 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 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 .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(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 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)/runtest.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/testread.Po@am__quote@ .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 $< .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 `$(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: $(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 -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-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 -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am 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 # 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.0.5/include/0000755000175000017500000000000013102441322013655 5ustar michaelmichaelavfs-1.0.5/include/state.h0000644000175000017500000000105513102441254015153 0ustar michaelmichael/* 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.0.5/include/serialfile.h0000644000175000017500000000215513102441254016154 0ustar michaelmichael/* 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.0.5/include/passwords.h0000644000175000017500000000310613102441254016057 0ustar michaelmichael/* 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.0.5/include/oper.h0000644000175000017500000000255013102441254015001 0ustar michaelmichael/* 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.0.5/include/runprog.h0000644000175000017500000000116313102441254015527 0ustar michaelmichael/* 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.0.5/include/namespace.h0000644000175000017500000000232513102441254015770 0ustar michaelmichael/* 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.0.5/include/socket.h0000644000175000017500000000040613102441254015322 0ustar michaelmichael/* 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.0.5/include/Makefile.am0000644000175000017500000000126613102441254015722 0ustar michaelmichael## 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 BUILT_SOURCES = version.h avfs-1.0.5/include/cache.h0000644000175000017500000000211013102441254015067 0ustar michaelmichael/* 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.0.5/include/zfile.h0000644000175000017500000000115213102441254015142 0ustar michaelmichael/* 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); struct zfile *av_zfile_new(vfile *vf, avoff_t dataoff, avuint crc, int calccrc); struct zcache *av_zcache_new(); avoff_t av_zcache_size(struct zcache *zc); avfs-1.0.5/include/archive.h0000644000175000017500000000355113102441254015457 0ustar michaelmichael/* 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.0.5/include/ugid.h0000644000175000017500000000104713102441254014764 0ustar michaelmichael/* 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.0.5/include/version.h.in0000644000175000017500000000035213102441254016124 0ustar michaelmichael/* 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.0.5/include/xzfile.h0000644000175000017500000000107113102441254015332 0ustar michaelmichael/* 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.0.5/include/virtual.h0000644000175000017500000000445013102441254015523 0ustar michaelmichael/* 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.0.5/include/operutil.h0000644000175000017500000000277113102441254015704 0ustar michaelmichael/* 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.0.5/include/filecache.h0000644000175000017500000000056013102441254015736 0ustar michaelmichael/* 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.0.5/include/realfile.h0000644000175000017500000000051713102441254015620 0ustar michaelmichael/* 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.0.5/include/remote.h0000644000175000017500000000231613102441254015327 0ustar michaelmichael/* 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.0.5/include/internal.h0000644000175000017500000000176013102441254015652 0ustar michaelmichael/* 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(); avfs-1.0.5/include/prog.h0000644000175000017500000000100313102441254014773 0ustar michaelmichael/* 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.0.5/include/filter.h0000644000175000017500000000064313102441254015322 0ustar michaelmichael/* 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.0.5/include/filebuf.h0000644000175000017500000000176013102441254015452 0ustar michaelmichael/* 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.0.5/include/parsels.h0000644000175000017500000000063013102441254015502 0ustar michaelmichael/* 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.0.5/include/bzfile.h0000644000175000017500000000104213102441254015302 0ustar michaelmichael/* 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.0.5/include/Makefile.in0000644000175000017500000004474713102441264015747 0ustar michaelmichael# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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 subdir = include DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/config.h.in $(srcdir)/version.h.in \ $(am__include_HEADERS_DIST) $(am__noinst_HEADERS_DIST) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/neon-ssl.m4 \ $(top_srcdir)/macros/neon-xml-parser.m4 \ $(top_srcdir)/macros/neon.m4 $(top_srcdir)/macros/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) 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 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 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@ EMACS = @EMACS@ 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@ KERNINCLUDE = @KERNINCLUDE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEONLIBS = @NEONLIBS@ NEONOBJS = @NEONOBJS@ NEON_BUILD_BUNDLED = @NEON_BUILD_BUNDLED@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ NEON_OBJEXT = @NEON_OBJEXT@ NEON_TARGET = @NEON_TARGET@ 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@ PRELOAD_LIBS = @PRELOAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ XML_CONFIG = @XML_CONFIG@ 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@ avfscoda_build = @avfscoda_build@ 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@ initstyle = @initstyle@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ kmoduledir = @kmoduledir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ preload_build = @preload_build@ profiledir = @profiledir@ program_transform_name = @program_transform_name@ psdir = @psdir@ rcdir = @rcdir@ rcscriptdir = @rcscriptdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ start_levels = @start_levels@ start_prio = @start_prio@ stop_levels = @stop_levels@ stop_prio = @stop_prio@ 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) 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 .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(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 @if test ! -f $@; then rm -f stamp-h1; else :; fi @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi 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: $(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: 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-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 # 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.0.5/include/avfs.h0000644000175000017500000002350013102441254014771 0ustar michaelmichael/* 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.0.5/include/tmpfile.h0000644000175000017500000000051013102441254015466 0ustar michaelmichael/* 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.0.5/include/exit.h0000644000175000017500000000036213102441254015004 0ustar michaelmichael/* 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.0.5/INSTALL0000644000175000017500000003660513102441264013302 0ustar michaelmichaelInstallation Instructions ************************* Copyright (C) 1994-1996, 1999-2002, 2004-2013 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 commands `./configure; make; make install' should configure, build, and install this package. The following more-detailed instructions are generic; see the `README' file for instructions specific to this package. 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.0.5/patch/0000755000175000017500000000000013102441322013331 5ustar michaelmichaelavfs-1.0.5/patch/coda_rmdir+rename.patch0000644000175000017500000000140313102441254017722 0ustar michaelmichaeldiff -ru /tmp/linux/linux/fs/coda/dir.c linux/fs/coda/dir.c --- /tmp/linux/linux/fs/coda/dir.c Mon Oct 16 21:58:51 2000 +++ linux/fs/coda/dir.c Fri Nov 10 14:51:34 2000 @@ -459,8 +459,7 @@ } coda_dir_changed(dir, -1); - de->d_inode->i_nlink--; - d_delete(de); + de->d_inode->i_nlink = 0; return 0; } @@ -490,8 +489,12 @@ if ( !error ) { if ( new_dentry->d_inode ) { - if ( S_ISDIR(new_dentry->d_inode->i_mode) ) + if ( S_ISDIR(new_dentry->d_inode->i_mode) ) { link_adjust = 1; + new_dentry->d_inode->i_nlink = 0; + } + else + new_dentry->d_inode->i_nlink--; coda_dir_changed(old_dir, -link_adjust); coda_dir_changed(new_dir, link_adjust); avfs-1.0.5/patch/virtual-2.4.0-test10.patch0000644000175000017500000002016113102441254017621 0ustar michaelmichaeldiff -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.0.5/patch/Makefile.am0000644000175000017500000000016113102441254015367 0ustar michaelmichaelEXTRA_DIST = coda_rmdir+rename.patch \ virtual-2.4.0-test10.patch \ virtual-2.4.0.patch \ virtual-2.4.1.patch avfs-1.0.5/patch/virtual-2.4.1.patch0000644000175000017500000002011213102441254016500 0ustar michaelmichaeldiff -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.0.5/patch/virtual-2.4.0.patch0000644000175000017500000002047113102441254016507 0ustar michaelmichaeldiff -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.0.5/patch/Makefile.in0000644000175000017500000003126313102441264015410 0ustar michaelmichael# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/neon-ssl.m4 \ $(top_srcdir)/macros/neon-xml-parser.m4 \ $(top_srcdir)/macros/neon.m4 $(top_srcdir)/macros/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) 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) 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@ EMACS = @EMACS@ 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@ KERNINCLUDE = @KERNINCLUDE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEONLIBS = @NEONLIBS@ NEONOBJS = @NEONOBJS@ NEON_BUILD_BUNDLED = @NEON_BUILD_BUNDLED@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ NEON_OBJEXT = @NEON_OBJEXT@ NEON_TARGET = @NEON_TARGET@ 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@ PRELOAD_LIBS = @PRELOAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ XML_CONFIG = @XML_CONFIG@ 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@ avfscoda_build = @avfscoda_build@ 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@ initstyle = @initstyle@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ kmoduledir = @kmoduledir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ preload_build = @preload_build@ profiledir = @profiledir@ program_transform_name = @program_transform_name@ psdir = @psdir@ rcdir = @rcdir@ rcscriptdir = @rcscriptdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ start_levels = @start_levels@ start_prio = @start_prio@ stop_levels = @stop_levels@ stop_prio = @stop_prio@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = coda_rmdir+rename.patch \ 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 .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(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: $(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 # 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.0.5/glassfs/0000755000175000017500000000000013102441321013673 5ustar michaelmichaelavfs-1.0.5/glassfs/glassfs.c0000644000175000017500000005711213102441254015514 0ustar michaelmichael#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.0.5/glassfs/Makefile0000644000175000017500000000053313102441254015341 0ustar michaelmichael#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.0.5/glassfs/redir2.c0000644000175000017500000002502113102441254015233 0ustar michaelmichael#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.0.5/glassfs/redir2mount.c0000644000175000017500000000144313102441254016320 0ustar michaelmichael#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.0.5/ltmain.sh0000644000175000017500000105152213102441263014064 0ustar michaelmichael # libtool (GNU libtool) 2.4.2 # Written by Gordon Matzigkeit , 1996 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, # 2007, 2008, 2009, 2010, 2011 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 GNU Libtool; see the file COPYING. If not, a copy # can be downloaded from http://www.gnu.org/licenses/gpl.html, # or obtained by writing to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. # Usage: $progname [OPTION]... [MODE-ARG]... # # Provide generalized library-building support services. # # --config show all configuration variables # --debug enable verbose shell tracing # -n, --dry-run display commands without modifying any files # --features display basic configuration information and exit # --mode=MODE use operation mode MODE # --preserve-dup-deps don't remove duplicate dependency libraries # --quiet, --silent don't print informational messages # --no-quiet, --no-silent # print informational messages (default) # --no-warn don't display warning messages # --tag=TAG use configuration variables from tag TAG # -v, --verbose print more informational messages than default # --no-verbose don't print the extra informational messages # --version print version information # -h, --help, --help-all print short, long, or detailed 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) # $progname: (GNU libtool) 2.4.2 # automake: $automake_version # autoconf: $autoconf_version # # Report bugs to . # GNU libtool home page: . # General help using GNU software: . PROGRAM=libtool PACKAGE=libtool VERSION=2.4.2 TIMESTAMP="" package_revision=1.3337 # 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 # A function that is used when there is no print builtin or printf. func_fallback_echo () { eval 'cat <<_LTECHO_EOF $1 _LTECHO_EOF' } # NLS nuisances: We save the old values to restore during execute mode. lt_user_locale= lt_safe_locale= for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${$lt_var+set}\" = set; then save_$lt_var=\$$lt_var $lt_var=C export $lt_var lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" fi" done LC_ALL=C LANGUAGE=C export LANGUAGE LC_ALL $lt_unset CDPATH # 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" : ${CP="cp -f"} test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} : ${MAKE="make"} : ${MKDIR="mkdir"} : ${MV="mv -f"} : ${RM="rm -f"} : ${SHELL="${CONFIG_SHELL-/bin/sh}"} : ${Xsed="$SED -e 1s/^X//"} # Global variables: EXIT_SUCCESS=0 EXIT_FAILURE=1 EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. exit_status=$EXIT_SUCCESS # Make sure IFS has a sensible default lt_nl=' ' IFS=" $lt_nl" dirname="s,/[^/]*$,," basename="s,^.*/,," # func_dirname file append nondir_replacement # Compute the dirname of FILE. If nonempty, add APPEND to the result, # otherwise set result to NONDIR_REPLACEMENT. func_dirname () { func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi } # func_dirname may be replaced by extended shell implementation # func_basename file func_basename () { func_basename_result=`$ECHO "${1}" | $SED "$basename"` } # func_basename may be replaced by extended shell implementation # func_dirname_and_basename file append nondir_replacement # perform func_basename and func_dirname in a single function # call: # dirname: Compute the dirname of FILE. If nonempty, # add APPEND to the result, otherwise set result # to NONDIR_REPLACEMENT. # value returned in "$func_dirname_result" # basename: Compute filename of FILE. # value retuned in "$func_basename_result" # Implementation must be kept synchronized with func_dirname # and func_basename. For efficiency, we do not delegate to # those functions but instead duplicate the functionality here. func_dirname_and_basename () { # Extract subdirectory from the argument. func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` if test "X$func_dirname_result" = "X${1}"; then func_dirname_result="${3}" else func_dirname_result="$func_dirname_result${2}" fi func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` } # func_dirname_and_basename may be replaced by extended shell implementation # func_stripname prefix suffix name # strip PREFIX and SUFFIX off of NAME. # PREFIX and SUFFIX must not contain globbing or regex special # characters, hashes, percent signs, but SUFFIX may contain a leading # dot (in which case that matches only a dot). # func_strip_suffix prefix name func_stripname () { case ${2} in .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; esac } # func_stripname may be replaced by extended shell implementation # These SED scripts presuppose an absolute path with a trailing slash. pathcar='s,^/\([^/]*\).*$,\1,' pathcdr='s,^/[^/]*,,' removedotparts=':dotsl s@/\./@/@g t dotsl s,/\.$,/,' collapseslashes='s@/\{1,\}@/@g' finalslash='s,/*$,/,' # 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. # value returned in "$func_normal_abspath_result" func_normal_abspath () { # 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 "$removedotparts" -e "$collapseslashes" -e "$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 "$pathcar"` func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ -e "$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_normal_abspath_result=$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_relative_path SRCDIR DSTDIR # generates a relative path from SRCDIR to DSTDIR, with a trailing # slash if non-empty, suitable for immediately appending a filename # without needing to append a separator. # value returned in "$func_relative_path_result" func_relative_path () { 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 "x$func_relative_path_tlibdir" = x ; 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 "x$func_stripname_result" != x ; then func_relative_path_result=${func_relative_path_result}/${func_stripname_result} fi # Normalisation. If bindir is libdir, return empty string, # else relative path ending with a slash; either way, target # file name can be directly appended. if test ! -z "$func_relative_path_result"; then func_stripname './' '' "$func_relative_path_result/" func_relative_path_result=$func_stripname_result fi } # The name of this program: func_dirname_and_basename "$progpath" progname=$func_basename_result # Make sure we have an absolute path for reexecution: case $progpath in [\\/]*|[A-Za-z]:\\*) ;; *[\\/]*) progdir=$func_dirname_result progdir=`cd "$progdir" && pwd` progpath="$progdir/$progname" ;; *) save_IFS="$IFS" IFS=${PATH_SEPARATOR-:} for progdir in $PATH; do IFS="$save_IFS" test -x "$progdir/$progname" && break done IFS="$save_IFS" test -n "$progdir" || progdir=`pwd` progpath="$progdir/$progname" ;; esac # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. Xsed="${SED}"' -e 1s/^X//' sed_quote_subst='s/\([`"$\\]\)/\\\1/g' # Same as above, but do not quote variable references. double_quote_subst='s/\(["`\\]\)/\\\1/g' # 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 # which contains forward slashes, into one that contains # (escaped) backslashes. A very naive implementation. lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' # Re-`\' parameter expansions in output of double_quote_subst that were # `\'-ed in input to the same. If an odd number of `\' preceded a '$' # in input to double_quote_subst, that '$' was protected from expansion. # Since each input `\' is now two `\'s, look for any number of runs of # four `\'s followed by two `\'s and then a '$'. `\' that '$'. bs='\\' bs2='\\\\' bs4='\\\\\\\\' dollar='\$' sed_double_backslash="\ s/$bs4/&\\ /g s/^$bs2$dollar/$bs&/ s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g s/\n//g" # Standard options: opt_dry_run=false opt_help=false opt_quiet=false opt_verbose=false opt_warning=: # func_echo arg... # Echo program name prefixed message, along with the current mode # name if it has been set yet. func_echo () { $ECHO "$progname: ${opt_mode+$opt_mode: }$*" } # func_verbose arg... # Echo program name prefixed message in verbose mode only. func_verbose () { $opt_verbose && func_echo ${1+"$@"} # A bug in bash halts the script if the last line of a function # fails when set -e is in force, so we need another command to # work around that: : } # func_echo_all arg... # Invoke $ECHO with all args, space-separated. func_echo_all () { $ECHO "$*" } # func_error arg... # Echo program name prefixed message to standard error. func_error () { $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 } # func_warning arg... # Echo program name prefixed warning message to standard error. func_warning () { $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 # bash bug again: : } # func_fatal_error arg... # Echo program name prefixed message to standard error, and exit. func_fatal_error () { func_error ${1+"$@"} exit $EXIT_FAILURE } # func_fatal_help arg... # Echo program name prefixed message to standard error, followed by # a help hint, and exit. func_fatal_help () { func_error ${1+"$@"} func_fatal_error "$help" } help="Try \`$progname --help' for more information." ## default # func_grep expression filename # Check whether EXPRESSION matches any line of FILENAME, without output. func_grep () { $GREP "$1" "$2" >/dev/null 2>&1 } # func_mkdir_p directory-path # Make sure the entire path to DIRECTORY-PATH is available. func_mkdir_p () { my_directory_path="$1" my_dir_list= if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then # Protect directory names starting with `-' case $my_directory_path in -*) my_directory_path="./$my_directory_path" ;; esac # While some portion of DIR does not yet exist... while test ! -d "$my_directory_path"; do # ...make a list in topmost first order. Use a colon delimited # list incase some portion of path contains whitespace. my_dir_list="$my_directory_path:$my_dir_list" # If the last portion added has no slash in it, the list is done case $my_directory_path in */*) ;; *) break ;; esac # ...otherwise throw away the child directory and loop my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` done my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` save_mkdir_p_IFS="$IFS"; IFS=':' for my_dir in $my_dir_list; do IFS="$save_mkdir_p_IFS" # mkdir can fail with a `File exist' error if two processes # try to create one of the directories concurrently. Don't # stop in that case! $MKDIR "$my_dir" 2>/dev/null || : done IFS="$save_mkdir_p_IFS" # Bail out if we (or some other process) failed to create a directory. test -d "$my_directory_path" || \ func_fatal_error "Failed to create \`$1'" fi } # func_mktempdir [string] # Make a temporary directory that won't clash with other running # libtool processes, and avoids race conditions if possible. If # given, STRING is the basename for that directory. func_mktempdir () { my_template="${TMPDIR-/tmp}/${1-$progname}" if test "$opt_dry_run" = ":"; then # Return a directory name, but don't create it in dry-run mode my_tmpdir="${my_template}-$$" else # If mktemp works, use that first and foremost my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` if test ! -d "$my_tmpdir"; then # Failing that, at least try and use $RANDOM to avoid a race my_tmpdir="${my_template}-${RANDOM-0}$$" save_mktempdir_umask=`umask` umask 0077 $MKDIR "$my_tmpdir" umask $save_mktempdir_umask fi # If we're not in dry-run mode, bomb out on failure test -d "$my_tmpdir" || \ func_fatal_error "cannot create temporary directory \`$my_tmpdir'" fi $ECHO "$my_tmpdir" } # func_quote_for_eval arg # Aesthetically quote ARG to be evaled later. # This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT # is double-quoted, suitable for a subsequent eval, whereas # FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters # which are still active within double quotes backslashified. func_quote_for_eval () { case $1 in *[\\\`\"\$]*) func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; *) func_quote_for_eval_unquoted_result="$1" ;; esac case $func_quote_for_eval_unquoted_result in # Double-quote args containing shell metacharacters to delay # word splitting, command substitution and and variable # expansion for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" ;; *) func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" esac } # 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 () { case $1 in *[\\\`\"]*) my_arg=`$ECHO "$1" | $SED \ -e "$double_quote_subst" -e "$sed_double_backslash"` ;; *) my_arg="$1" ;; esac case $my_arg in # Double-quote args containing shell metacharacters to delay # word splitting and command substitution for a subsequent eval. # Many Bourne shells cannot handle close brackets correctly # in scan sets, so we specify it separately. *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") my_arg="\"$my_arg\"" ;; esac func_quote_for_expand_result="$my_arg" } # func_show_eval cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. func_show_eval () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$my_cmd" my_status=$? if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi fi } # func_show_eval_locale cmd [fail_exp] # Unless opt_silent is true, then output CMD. Then, if opt_dryrun is # not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP # is given, then evaluate it. Use the saved locale for evaluation. func_show_eval_locale () { my_cmd="$1" my_fail_exp="${2-:}" ${opt_silent-false} || { func_quote_for_expand "$my_cmd" eval "func_echo $func_quote_for_expand_result" } if ${opt_dry_run-false}; then :; else eval "$lt_user_locale $my_cmd" my_status=$? eval "$lt_safe_locale" if test "$my_status" -eq 0; then :; else eval "(exit $my_status); $my_fail_exp" fi 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 () { case $1 in [0-9]* | *[!a-zA-Z0-9_]*) func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` ;; * ) func_tr_sh_result=$1 ;; esac } # func_version # Echo version message to standard output and exit. func_version () { $opt_debug $SED -n '/(C)/!b go :more /\./!{ N s/\n# / / b more } :go /^# '$PROGRAM' (GNU /,/# warranty; / { s/^# // s/^# *$// s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ p }' < "$progpath" exit $? } # func_usage # Echo short help message to standard output and exit. func_usage () { $opt_debug $SED -n '/^# Usage:/,/^# *.*--help/ { s/^# // s/^# *$// s/\$progname/'$progname'/ p }' < "$progpath" echo $ECHO "run \`$progname --help | more' for full usage" exit $? } # func_help [NOEXIT] # Echo long help message to standard output and exit, # unless 'noexit' is passed as argument. func_help () { $opt_debug $SED -n '/^# Usage:/,/# Report bugs to/ { :print s/^# // s/^# *$// s*\$progname*'$progname'* s*\$host*'"$host"'* s*\$SHELL*'"$SHELL"'* s*\$LTCC*'"$LTCC"'* s*\$LTCFLAGS*'"$LTCFLAGS"'* s*\$LD*'"$LD"'* s/\$with_gnu_ld/'"$with_gnu_ld"'/ s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/ s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/ p d } /^# .* home page:/b print /^# General help using/b print ' < "$progpath" ret=$? if test -z "$1"; then exit $ret fi } # func_missing_arg argname # Echo program name prefixed message to standard error and set global # exit_cmd. func_missing_arg () { $opt_debug func_error "missing argument for $1." exit_cmd=exit } # 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. func_split_short_opt () { my_sed_short_opt='1s/^\(..\).*$/\1/;q' my_sed_short_rest='1s/^..\(.*\)$/\1/;q' func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` } # func_split_short_opt may be replaced by extended shell implementation # func_split_long_opt longopt # Set func_split_long_opt_name and func_split_long_opt_arg shell # variables after splitting LONGOPT at the `=' sign. func_split_long_opt () { my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' my_sed_long_arg='1s/^--[^=]*=//' func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` } # func_split_long_opt may be replaced by extended shell implementation exit_cmd=: magic="%%%MAGIC variable%%%" magic_exe="%%%MAGIC EXE variable%%%" # Global variables. nonopt= preserve_args= lo2o="s/\\.lo\$/.${objext}/" o2lo="s/\\.${objext}\$/.lo/" 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= # func_append var value # Append VALUE to the end of shell variable VAR. func_append () { eval "${1}=\$${1}\${2}" } # func_append may be replaced by extended shell implementation # func_append_quoted var value # Quote VALUE and append to the end of shell variable VAR, separated # by a space. func_append_quoted () { func_quote_for_eval "${2}" eval "${1}=\$${1}\\ \$func_quote_for_eval_result" } # func_append_quoted may be replaced by extended shell implementation # func_arith arithmetic-term... func_arith () { func_arith_result=`expr "${@}"` } # func_arith may be replaced by extended shell implementation # func_len string # STRING may not start with a hyphen. func_len () { func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` } # func_len may be replaced by extended shell implementation # func_lo2o object func_lo2o () { func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` } # func_lo2o may be replaced by extended shell implementation # func_xform libobj-or-source func_xform () { func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` } # func_xform may be replaced by extended shell implementation # func_fatal_configuration arg... # Echo program name prefixed message to standard error, followed by # a configuration failure hint, and exit. func_fatal_configuration () { func_error ${1+"$@"} func_error "See the $PACKAGE documentation for more information." func_fatal_error "Fatal configuration error." } # 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 "$build_libtool_libs" = yes; then echo "enable shared libraries" else echo "disable shared libraries" fi if test "$build_old_libs" = yes; then echo "enable static libraries" else echo "disable static libraries" fi exit $? } # 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 } # 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 # Option defaults: opt_debug=: opt_dry_run=false opt_config=false opt_preserve_dup_deps=false opt_features=false opt_finish=false opt_help=false opt_help_all=false opt_silent=: opt_warning=: opt_verbose=: opt_silent=false opt_verbose=false # Parse options once, thoroughly. This comes as soon as possible in the # script to make things like `--version' happen as quickly as we can. { # this just eases exit handling while test $# -gt 0; do opt="$1" shift case $opt in --debug|-x) opt_debug='set -x' func_echo "enabling shell trace mode" $opt_debug ;; --dry-run|--dryrun|-n) opt_dry_run=: ;; --config) opt_config=: func_config ;; --dlopen|-dlopen) optarg="$1" opt_dlopen="${opt_dlopen+$opt_dlopen }$optarg" shift ;; --preserve-dup-deps) opt_preserve_dup_deps=: ;; --features) opt_features=: func_features ;; --finish) opt_finish=: set dummy --mode finish ${1+"$@"}; shift ;; --help) opt_help=: ;; --help-all) opt_help_all=: opt_help=': help-all' ;; --mode) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_mode="$optarg" case $optarg in # Valid mode arguments: clean|compile|execute|finish|install|link|relink|uninstall) ;; # Catch anything else as an error *) func_error "invalid argument for $opt" exit_cmd=exit break ;; esac shift ;; --no-silent|--no-quiet) opt_silent=false func_append preserve_args " $opt" ;; --no-warning|--no-warn) opt_warning=false func_append preserve_args " $opt" ;; --no-verbose) opt_verbose=false func_append preserve_args " $opt" ;; --silent|--quiet) opt_silent=: func_append preserve_args " $opt" opt_verbose=false ;; --verbose|-v) opt_verbose=: func_append preserve_args " $opt" opt_silent=false ;; --tag) test $# = 0 && func_missing_arg $opt && break optarg="$1" opt_tag="$optarg" func_append preserve_args " $opt $optarg" func_enable_tag "$optarg" shift ;; -\?|-h) func_usage ;; --help) func_help ;; --version) func_version ;; # Separate optargs to long options: --*=*) func_split_long_opt "$opt" set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} shift ;; # Separate non-argument short options: -\?*|-h*|-n*|-v*) func_split_short_opt "$opt" set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} shift ;; --) break ;; -*) func_fatal_help "unrecognized option \`$opt'" ;; *) set dummy "$opt" ${1+"$@"}; shift; break ;; esac done # Validate options: # save first non-option argument if test "$#" -gt 0; then nonopt="$opt" shift fi # preserve --debug test "$opt_debug" = : || func_append preserve_args " --debug" case $host in *cygwin* | *mingw* | *pw32* | *cegcc*) # 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 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then func_fatal_configuration "not configured to build any kind of library" fi # Darwin sucks eval std_shrext=\"$shrext_cmds\" # Only execute mode is allowed to have -dlopen flags. if test -n "$opt_dlopen" && test "$opt_mode" != execute; 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." } # Bail if the options were screwed $exit_cmd $EXIT_FAILURE } ## ----------- ## ## Main. ## ## ----------- ## # func_lalib_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_lalib_p () { test -f "$1" && $SED -e 4q "$1" 2>/dev/null \ | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 } # func_lalib_unsafe_p file # True iff FILE is a libtool `.la' library or `.lo' object file. # This function implements the same check as func_lalib_p without # resorting to external programs. To this end, it redirects stdin and # closes it afterwards, without saving the original file descriptor. # As a safety measure, use it only where a negative result would be # fatal anyway. Works if `file' does not exist. func_lalib_unsafe_p () { lalib_p=no if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then for lalib_p_l in 1 2 3 4 do read lalib_p_line case "$lalib_p_line" in \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; esac done exec 0<&5 5<&- fi test "$lalib_p" = yes } # func_ltwrapper_script_p file # True iff FILE is a libtool wrapper script # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_script_p () { func_lalib_p "$1" } # func_ltwrapper_executable_p file # True iff FILE is a libtool wrapper executable # This function is only a basic sanity check; it will hardly flush out # determined imposters. func_ltwrapper_executable_p () { func_ltwrapper_exec_suffix= case $1 in *.exe) ;; *) func_ltwrapper_exec_suffix=.exe ;; esac $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 } # func_ltwrapper_scriptname file # Assumes file is an ltwrapper_executable # uses $file to determine the appropriate filename for a # temporary ltwrapper_script. func_ltwrapper_scriptname () { func_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 () { $opt_debug save_ifs=$IFS; IFS='~' for cmd in $1; do IFS=$save_ifs eval cmd=\"$cmd\" func_show_eval "$cmd" "${2-:}" done IFS=$save_ifs } # func_source file # Source FILE, adding directory component if necessary. # Note that it is not necessary on cygwin/mingw to append a dot to # FILE even if both FILE and FILE.exe exist: automatic-append-.exe # behavior happens only for exec(3), not for open(2)! Also, sourcing # `FILE.' does not work on cygwin managed mounts. func_source () { $opt_debug case $1 in */* | *\\*) . "$1" ;; *) . "./$1" ;; esac } # func_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 () { $opt_debug 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 "$build_libtool_libs" = yes; then write_lobj=\'${2}\' else write_lobj=none fi if test "$build_old_libs" = yes; then write_oldobj=\'${3}\' else write_oldobj=none fi $opt_dry_run || { cat >${write_libobj}T </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 "$lt_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 () { $opt_debug # 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 () { $opt_debug 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 () { $opt_debug # awkward: cmd appends spaces to result func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | $SED -e 's/[ ]*$//' -e "$lt_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 () { $opt_debug 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 () { $opt_debug 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 () { $opt_debug 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 () { $opt_debug $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 () { $opt_debug 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 () { $opt_debug 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 () { $opt_debug 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 () { $opt_debug 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 () { $opt_debug 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 () { $opt_debug 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 () { $opt_debug 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 () { $opt_debug 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 () { $opt_debug 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 () { $opt_debug 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 () { $opt_debug 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 () { $opt_debug 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 () { $opt_debug 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_mode_compile arg... func_mode_compile () { $opt_debug # Get the compilation command and the source file. base_compile= srcfile="$nonopt" # always keep a non-empty value in "srcfile" 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 "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no continue ;; -static) build_libtool_libs=no build_old_libs=yes continue ;; -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 "$build_old_libs" = yes; 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 "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then # non-PIC code in shared libraries is not supported pic_mode=default fi # Calculate the filename of the output object if compiler does # not support -o with -c if test "$compiler_c_o" = no; then output_obj=`$ECHO "$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 "$need_locks" = yes; 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 "$need_locks" = warn; then if test -f "$lockfile"; then $ECHO "\ *** ERROR, $lockfile exists and contains: `cat $lockfile 2>/dev/null` This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $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 "$build_libtool_libs" = yes; then # Without this assignment, base_compile gets emptied. fbsd_hideous_sh_bug=$base_compile if test "$pic_mode" != no; 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 "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $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 "$suppress_opt" = yes; then suppress_output=' >/dev/null 2>&1' fi fi # Only build a position-dependent object if we build old libraries. if test "$build_old_libs" = yes; then if test "$pic_mode" != yes; then # Don't build PIC code command="$base_compile $qsrcfile$pie_flag" else command="$base_compile $qsrcfile $pic_flag" fi if test "$compiler_c_o" = yes; 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 "$need_locks" = warn && test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then $ECHO "\ *** ERROR, $lockfile contains: `cat $lockfile 2>/dev/null` but it should contain: $srcfile This indicates that another process is trying to use the same temporary object file, and libtool could not work around it because your compiler does not support \`-c' and \`-o' together. If you repeat this compilation, it may succeed, by chance, but you had better avoid parallel builds (make -j) in this platform, or get a better compiler." $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 "$need_locks" != no; then removelist=$lockfile $RM "$lockfile" fi } exit $EXIT_SUCCESS } $opt_help || { test "$opt_mode" = compile && 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 -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 () { $opt_debug # The first argument is the command name. cmd="$nonopt" test -z "$cmd" && \ func_fatal_help "you must specify a COMMAND" # Handle -dlopen flags immediately. for file in $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 test "X$opt_dry_run" = Xfalse; then if test -n "$shlibpath_var"; then # Export the shlibpath_var. eval "export $shlibpath_var" fi # Restore saved environment variables for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES do eval "if test \"\${save_$lt_var+set}\" = set; then $lt_var=\$save_$lt_var; export $lt_var else $lt_unset $lt_var fi" done # Now prepare to actually exec the command. exec_cmd="\$cmd$args" else # Display what would be done. if test -n "$shlibpath_var"; then eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" echo "export $shlibpath_var" fi $ECHO "$cmd$args" exit $EXIT_SUCCESS fi } test "$opt_mode" = execute && func_mode_execute ${1+"$@"} # func_mode_finish arg... func_mode_finish () { $opt_debug 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_silent && 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 "$opt_mode" = finish && func_mode_finish ${1+"$@"} # func_mode_install arg... func_mode_install () { $opt_debug # There may be an optional sh(1) argument at the beginning of # install_prog (especially on Windows NT). if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || # Allow the use of GNU shtool's install command. 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=no 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=yes ;; -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$prev" = x-m && 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=yes if test "$isdir" = yes; then destdir="$dest" destname= else func_dirname_and_basename "$dest" "" "." destdir="$func_dirname_result" destname="$func_basename_result" # Not a directory, so check to see that there is only one file specified. set dummy $files; shift test "$#" -gt 1 && \ func_fatal_help "\`$dest' is not a directory" fi case $destdir in [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case $file in *.lo) ;; *) func_fatal_help "\`$destdir' must be an absolute directory name" ;; esac done ;; esac # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" staticlibs= future_libdirs= current_libdirs= for file in $files; do # Do each installation. case $file in *.$libext) # Do the static libraries later. 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 ;; 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 "$build_old_libs" = yes; then # Deduce the name of the old-style object file. func_lo2o "$file" staticobj=$func_lo2o_result func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' fi exit $EXIT_SUCCESS ;; *) # Figure out destination file name, if it wasn't already specified. if test -n "$destname"; then destfile="$destdir/$destname" else func_basename "$file" destfile="$func_basename_result" destfile="$destdir/$destfile" fi # If the file is missing, and there is a .exe on the end, strip it # because it is most likely a libtool script we actually want to # install stripped_ext="" case $file in *.exe) if test ! -f "$file"; then func_stripname '' '.exe' "$file" file=$func_stripname_result stripped_ext=".exe" fi ;; esac # Do a test to see if this is really a libtool program. case $host in *cygwin* | *mingw*) if func_ltwrapper_executable_p "$file"; then func_ltwrapper_scriptname "$file" wrapper=$func_ltwrapper_scriptname_result else func_stripname '' '.exe' "$file" wrapper=$func_stripname_result fi ;; *) wrapper=$file ;; esac if func_ltwrapper_script_p "$wrapper"; then notinst_deplibs= relink_command= func_source "$wrapper" # Check the variables that should have been set. test -z "$generated_by_libtool_version" && \ func_fatal_error "invalid libtool wrapper script \`$wrapper'" finalize=yes for lib in $notinst_deplibs; do # Check to see that each library is installed. libdir= if test -f "$lib"; then func_source "$lib" fi libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test if test -n "$libdir" && test ! -f "$libfile"; then func_warning "\`$lib' has not been installed in \`$libdir'" finalize=no fi done relink_command= func_source "$wrapper" outputname= if test "$fast_install" = no && test -n "$relink_command"; then $opt_dry_run || { if test "$finalize" = yes; then tmpdir=`func_mktempdir` func_basename "$file$stripped_ext" file="$func_basename_result" outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` $opt_silent || { func_quote_for_expand "$relink_command" eval "func_echo $func_quote_for_expand_result" } if eval "$relink_command"; then : else func_error "error: relink \`$file' with the above command before installing it" $opt_dry_run || ${RM}r "$tmpdir" continue fi file="$outputname" else func_warning "cannot relink \`$file'" fi } else # Install the binary that we compiled earlier. file=`$ECHO "$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 "$opt_mode" = install && func_mode_install ${1+"$@"} # func_generate_dlsyms outputname originator pic_p # Extract symbols from dlprefiles and create ${outputname}S.o with # a dlpreopen symbol table. func_generate_dlsyms () { $opt_debug my_outputname="$1" my_originator="$2" my_pic_p="${3-no}" my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` my_dlsyms= if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then my_dlsyms="${my_outputname}S.c" else func_error "not configured to extract global symbols from dlpreopened files" fi fi if test -n "$my_dlsyms"; then case $my_dlsyms in "") ;; *.c) # Discover the nlist of each of the dlfiles. nlist="$output_objdir/${my_outputname}.nm" func_show_eval "$RM $nlist ${nlist}S ${nlist}T" # Parse the name list into a source file. func_verbose "creating $output_objdir/$my_dlsyms" $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ /* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ /* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ #ifdef __cplusplus extern \"C\" { #endif #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 con'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 /* External symbol declarations for the compiler. */\ " if test "$dlself" = yes; then func_verbose "generating symbol list for \`$output'" $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$ECHO "$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 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[]; LT_DLSYM_CONST lt_dlsymlist lt_${my_prefix}_LTX_preloaded_symbols[] = {\ { \"$my_originator\", (void *) 0 }," case $need_lib_prefix in no) eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; *) eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" ;; esac echo >> "$output_objdir/$my_dlsyms" "\ {0, (void *) 0} }; /* This works around a problem in FreeBSD linker */ #ifdef FREEBSD_WORKAROUND static const void *lt_preloaded_setup() { return lt_${my_prefix}_LTX_preloaded_symbols; } #endif #ifdef __cplusplus } #endif\ " } # !$opt_dry_run pic_flag_for_symtable= case "$compile_command " in *" -static "*) ;; *) case $host in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; *-*-hpux*) pic_flag_for_symtable=" $pic_flag" ;; *) if test "X$my_pic_p" != Xno; then pic_flag_for_symtable=" $pic_flag" fi ;; esac ;; esac symtab_cflags= for arg in $LTCFLAGS; do case $arg in -pie | -fpie | -fPIE) ;; *) 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"' # 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_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 () { $opt_debug win32_libid_type="unknown" win32_fileres=`file -L $1 2>/dev/null` case $win32_fileres in *ar\ archive\ import\ library*) # definitely import win32_libid_type="x86 archive import" ;; *ar\ archive*) # could be an import, or static # 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 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 } }'` 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 () { $opt_debug 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 () { $opt_debug 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 which possess that section. Heuristic: eliminate # all those which 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_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 () { $opt_debug 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 () { $opt_debug 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_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 () { $opt_debug 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 () { $opt_debug f_ex_an_ar_dir="$1"; shift f_ex_an_ar_oldlib="$1" if test "$lock_old_archive_extraction" = yes; 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 "$lock_old_archive_extraction" = yes; 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 () { $opt_debug my_gentop="$1"; shift my_oldlibs=${1+"$@"} my_oldobjs="" my_xlib="" my_xabs="" my_xdir="" for my_xlib in $my_oldlibs; do # Extract the objects. case $my_xlib in [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; *) my_xabs=`pwd`"/$my_xlib" ;; esac func_basename "$my_xlib" my_xlib="$func_basename_result" my_xlib_u=$my_xlib while :; do case " $extracted_archives " in *" $my_xlib_u "*) func_arith $extracted_serial + 1 extracted_serial=$func_arith_result my_xlib_u=lt$extracted_serial-$my_xlib ;; *) break ;; esac done extracted_archives="$extracted_archives $my_xlib_u" my_xdir="$my_gentop/$my_xlib_u" func_mkdir_p "$my_xdir" case $host in *-darwin*) func_verbose "Extracting $my_xabs" # Do not bother doing anything if just a dry run $opt_dry_run || { darwin_orig_dir=`pwd` cd $my_xdir || exit $? darwin_archive=$my_xabs darwin_curdir=`pwd` darwin_base_archive=`basename "$darwin_archive"` darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` if test -n "$darwin_arches"; then darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` darwin_arch= func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" for darwin_arch in $darwin_arches ; do func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" func_extract_an_archive "`pwd`" "${darwin_base_archive}" cd "$darwin_curdir" $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" done # $darwin_arches ## Okay now we've a bunch of thin objects, gotta fatten them up :) darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` darwin_file= darwin_files= for darwin_file in $darwin_filelist; do darwin_files=`find unfat-$$ -name $darwin_file -print | 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 in which 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$TIMESTAMP) $VERSION # # The $output program cannot be directly executed until all the libtool # libraries that it depends on are installed. # # This wrapper script should never be moved out of the build directory. # If it is, it will not operate correctly. # Sed substitution that helps us do robust quoting. It backslashifies # metacharacters that are still active within double-quoted strings. 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/ which is used only on # windows platforms, and (c) all begin with the string "--lt-" # (application programs are unlikely to have options which 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$TIMESTAMP) $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 "$fast_install" = yes; then $ECHO "\ program=lt-'$outputname'$exeext progdir=\"\$thisdir/$objdir\" if test ! -f \"\$progdir/\$program\" || { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ test \"X\$file\" != \"X\$progdir/\$program\"; }; then file=\"\$\$-\$program\" if test ! -d \"\$progdir\"; then $MKDIR \"\$progdir\" else $RM \"\$progdir/\$file\" fi" $ECHO "\ # relink executable if necessary if test -n \"\$relink_command\"; then if relink_command_output=\`eval \$relink_command 2>&1\`; then : else $ECHO \"\$relink_command_output\" >&2 $RM \"\$progdir/\$file\" exit 1 fi fi $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || { $RM \"\$progdir/\$program\"; $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } $RM \"\$progdir/\$file\" fi" else $ECHO "\ program='$outputname' progdir=\"\$thisdir/$objdir\" " fi $ECHO "\ if test -f \"\$progdir/\$program\"; then" # 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 "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then $ECHO "\ # Add our own library path to $shlibpath_var $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" # Some systems cannot cope with colon-terminated $shlibpath_var # The second colon is a workaround for a bug in BeOS R4 sed $shlibpath_var=\`\$ECHO \"\$$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 /* 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 platforms) ... */ #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 # ifndef _INTPTR_T_DEFINED # define _INTPTR_T_DEFINED # define intptr_t int # endif #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 ((void *) 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]; int 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 = 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 (strcmp (str, pat) == 0) *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 int len = strlen (name) + 1 + strlen (value) + 1; char *str = XMALLOC (char, len); sprintf (str, "%s=%s", name, value); if (putenv (str) != EXIT_SUCCESS) { XFREE (str); } #endif } } char * lt_extend_str (const char *orig_value, const char *add, int to_end) { char *new_value; if (orig_value && *orig_value) { int orig_value_len = strlen (orig_value); int add_len = strlen (add); new_value = XMALLOC (char, add_len + orig_value_len + 1); if (to_end) { strcpy (new_value, orig_value); strcpy (new_value + orig_value_len, add); } else { strcpy (new_value, add); strcpy (new_value + add_len, orig_value); } } else { new_value = xstrdup (add); } return new_value; } 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 #' */ int len = strlen (new_value); while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) { new_value[len-1] = '\0'; } lt_setenv (name, new_value); XFREE (new_value); } } void lt_update_lib_path (const char *name, const char *value) { 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 () { $opt_debug case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in *import*) : ;; *) false ;; esac } # func_mode_link arg... func_mode_link () { $opt_debug case $host in *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) # It is impossible to link a dll without this setting, and # we shouldn't force the makefile maintainer to figure out # which system we are compiling for in order to pass an extra # flag for every libtool invocation. # allow_undefined=no # FIXME: Unfortunately, there are problems with the above when trying # to make a dll which has undefined symbols, in which case not # even a static library is built. For now, we need to specify # -no-undefined on the libtool link line when we can be certain # that all symbols are satisfied, otherwise we get a static library. allow_undefined=yes ;; *) allow_undefined=yes ;; esac libtool_args=$nonopt 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= non_pic_objects= precious_files_regex= prefer_static_libs=no preload=no 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 "$build_libtool_libs" != yes && \ func_fatal_configuration "can not build a shared library" build_old_libs=no break ;; -all-static | -static | -static-libtool-libs) case $arg in -all-static) if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 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) if test "$preload" = no; then # Add the symbol object into the linking commands. func_append compile_command " @SYMFILE@" func_append finalize_command " @SYMFILE@" preload=yes fi case $arg in *.la | *.lo) ;; # We handle these cases below. force) if test "$dlself" = no; then dlself=needless export_dynamic=yes fi prev= continue ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes else dlself=needless export_dynamic=yes fi prev= continue ;; *) if test "$prev" = dlfiles; then 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 ;; 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 "$pic_object" = none && test "$non_pic_object" = none; 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 "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 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 "$prev" = dlprefiles; 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 "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; 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 ;; 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 "$prev" = rpath; 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$arg" = "X-export-symbols"; 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$arg" = "X-lc" || test "X$arg" = "X-lm"; 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$arg" = "X-lc" && continue ;; *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc due to us having libc/libc_r. test "X$arg" = "X-lc" && continue ;; *-*-rhapsody* | *-*-darwin1.[012]) # Rhapsody C and math libraries are in the System framework func_append deplibs " System.ltframework" continue ;; *-*-sco3.2v5* | *-*-sco5v6*) # Causes problems with __ctype test "X$arg" = "X-lc" && continue ;; *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) # Compiler inserts libc in the correct place for threads to work test "X$arg" = "X-lc" && continue ;; esac elif test "X$arg" = "X-lc_r"; then case $host in *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) # Do not include libc_r directly, use -pthread flag. continue ;; esac fi func_append deplibs " $arg" 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 ;; -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 # @file GCC response files # -tp=* Portland pgcc target processor selection # --sysroot=* for sysroot support # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization -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*|-flto*|-fwhopr*|-fuse-linker-plugin) 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 ;; # 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 "$pic_object" = none && test "$non_pic_object" = none; 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 "$pic_object" != none; then # Prepend the subdirectory the object is found in. pic_object="$xdir$pic_object" if test "$prev" = dlfiles; then if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 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 "$prev" = dlprefiles; 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 "$non_pic_object" != none; then # Prepend the subdirectory the object is found in. non_pic_object="$xdir$non_pic_object" # A standard non-PIC object func_append non_pic_objects " $non_pic_object" if test -z "$pic_object" || test "$pic_object" = none ; 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 "$prev" = dlfiles; then # This library was specified with -dlopen. func_append dlfiles " $func_resolve_sysroot_result" prev= elif test "$prev" = dlprefiles; 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 "$export_dynamic" = yes && 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\" 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 "$linkmode" = lib; then libs="$predeps $libs $compiler_lib_search_path $postdeps" # Compute libraries that are listed more than once in $predeps # $postdeps and mark them as special (i.e., whose duplicates are # not to be eliminated). pre_post_deps= if $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=no 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 "$linkmode,$pass" = "lib,link"; then ## FIXME: Find the place where the list is rebuilt in the wrong ## order, and fix it there properly tmp_deplibs= for deplib in $deplibs; do tmp_deplibs="$deplib $tmp_deplibs" done deplibs="$tmp_deplibs" fi if test "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan"; then libs="$deplibs" deplibs= fi if test "$linkmode" = prog; then case $pass in dlopen) libs="$dlfiles" ;; dlpreopen) libs="$dlprefiles" ;; link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; esac fi if test "$linkmode,$pass" = "lib,dlpreopen"; 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 "$pass" = dlopen; then # Collect dlpreopened libraries save_deplibs="$deplibs" deplibs= fi for deplib in $libs; do lib= found=no case $deplib in -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \ |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append compiler_flags " $deplib" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -l*) if test "$linkmode" != lib && test "$linkmode" != prog; then func_warning "\`-l' is ignored for archives/objects" continue fi func_stripname '-l' '' "$deplib" name=$func_stripname_result if test "$linkmode" = lib; then searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" else 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 "$search_ext" = ".la"; then found=yes else found=no fi break 2 fi done done if test "$found" != yes; then # deplib doesn't seem to be a libtool library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue else # deplib is a libtool library # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, # We need to do some special things here, and not later. if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then case " $predeps $postdeps " in *" $deplib "*) if 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=no func_dirname "$lib" "" "." ladir="$func_dirname_result" lib=$ladir/$old_library if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" fi continue fi fi ;; *) ;; esac fi fi ;; # -l *.ltframework) if test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else deplibs="$deplib $deplibs" if test "$linkmode" = lib ; then case "$new_inherited_linker_flags " in *" $deplib "*) ;; * ) func_append new_inherited_linker_flags " $deplib" ;; esac fi fi continue ;; -L*) case $linkmode in lib) deplibs="$deplib $deplibs" test "$pass" = conv && continue newdependency_libs="$deplib $newdependency_libs" func_stripname '-L' '' "$deplib" func_resolve_sysroot "$func_stripname_result" func_append newlib_search_path " $func_resolve_sysroot_result" ;; prog) if test "$pass" = conv; then deplibs="$deplib $deplibs" continue fi if test "$pass" = scan; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi 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 "$pass" = link; 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 "$pass" = conv; 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=no case $deplibs_check_method in match_pattern*) set dummy $deplibs_check_method; shift match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ | $EGREP "$match_pattern_regex" > /dev/null; then valid_a_lib=yes fi ;; pass_all) valid_a_lib=yes ;; esac if test "$valid_a_lib" != yes; then echo $ECHO "*** Warning: Trying to link with static lib archive $deplib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have" echo "*** because the file extensions .$libext of this argument makes me believe" echo "*** that it is just a static archive that I should not use here." else echo $ECHO "*** Warning: Linking the shared library $output against the" $ECHO "*** static library $deplib is not portable!" deplibs="$deplib $deplibs" fi ;; esac continue ;; prog) if test "$pass" != link; then deplibs="$deplib $deplibs" else compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" fi continue ;; esac # linkmode ;; # *.$libext *.lo | *.$objext) if test "$pass" = conv; then deplibs="$deplib $deplibs" elif test "$linkmode" = prog; then if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlopen support or we're linking statically, # we need to preload. func_append newdlprefiles " $deplib" compile_deplibs="$deplib $compile_deplibs" finalize_deplibs="$deplib $finalize_deplibs" else func_append newdlfiles " $deplib" fi fi continue ;; %DEPLIBS%) alldeplibs=yes continue ;; esac # case $deplib if test "$found" = yes || test -f "$lib"; then : else func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" fi # 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 "$linkmode,$pass" = "lib,link" || test "$linkmode,$pass" = "prog,scan" || { test "$linkmode" != prog && test "$linkmode" != lib; }; then test -n "$dlopen" && func_append dlfiles " $dlopen" test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" fi if test "$pass" = conv; then # Only check for convenience libraries deplibs="$lib $deplibs" if test -z "$libdir"; then if test -z "$old_library"; then 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 "$linkmode" != prog && test "$linkmode" != lib; 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 "$prefer_static_libs" = yes || test "$prefer_static_libs,$installed" = "built,no"; }; 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 "$pass" = dlopen; then if test -z "$libdir"; then func_fatal_error "cannot -dlopen a convenience library: \`$lib'" fi if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then # If there is no dlname, no dlopen support or we're linking # statically, we need to preload. We also need to preload any # dependent libraries so libltdl's deplib preloader doesn't # bomb out in the load deplibs phase. 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 "X$installed" = Xyes; 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 "X$hardcode_automatic" = Xyes && avoidtemprpath=yes else if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then dir="$ladir" absdir="$abs_ladir" # Remove this search path later 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 "$pass" = dlpreopen; then if test -z "$libdir" && test "$linkmode" = prog; 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 "$linkmode" = lib; then deplibs="$dir/$old_library $deplibs" elif test "$linkmode,$pass" = "prog,link"; then compile_deplibs="$dir/$old_library $compile_deplibs" finalize_deplibs="$dir/$old_library $finalize_deplibs" else deplibs="$lib $deplibs" # used for prog,scan pass fi continue fi if test "$linkmode" = prog && test "$pass" != link; then func_append newlib_search_path " $ladir" deplibs="$lib $deplibs" linkalldeplibs=no if test "$link_all_deplibs" != no || test -z "$library_names" || test "$build_libtool_libs" = no; then linkalldeplibs=yes fi tmp_libs= for deplib in $dependency_libs; do case $deplib in -L*) 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 test "$linkalldeplibs" = yes; then deplibs="$deplib $deplibs" else # Need to hardcode shared library paths # or/and link against static libraries newdependency_libs="$deplib $newdependency_libs" fi if $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 "$linkmode,$pass" = "prog,link"; then if test -n "$library_names" && { { test "$prefer_static_libs" = no || test "$prefer_static_libs,$installed" = "built,yes"; } || test -z "$old_library"; }; then # We need to hardcode the library path if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then # Make sure the rpath contains only unique directories. case "$temp_rpath:" in *"$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 test "$alldeplibs" = yes && { test "$deplibs_check_method" = pass_all || { test "$build_libtool_libs" = yes && test -n "$library_names"; }; }; then # We only need to search for static libraries continue fi fi link_static=no # Whether the deplib will be linked statically use_static_libs=$prefer_static_libs if test "$use_static_libs" = built && test "$installed" = yes; then use_static_libs=no fi if test -n "$library_names" && { test "$use_static_libs" = no || test -z "$old_library"; }; then case $host in *cygwin* | *mingw* | *cegcc*) # No point in relinking DLLs because paths are not encoded func_append notinst_deplibs " $lib" need_relink=no ;; *) if test "$installed" = no; 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 "$shouldnotlink" = yes && test "$pass" = link; then echo if test "$linkmode" = prog; then $ECHO "*** Warning: Linking the executable $output against the loadable module" else $ECHO "*** Warning: Linking the shared library $output against the loadable module" fi $ECHO "*** $linklib is not portable!" fi if test "$linkmode" = lib && test "$hardcode_into_libs" = yes; then # Hardcode the library path. # Skip directories that are in the system default run-time # search path. case " $sys_lib_dlsearch_path " in *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) 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*) 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 "$linkmode" = prog || test "$opt_mode" != relink; then add_shlibpath= add_dir= add= lib_linked=yes case $hardcode_action in immediate | unsupported) if test "$hardcode_direct" = no; then add="$dir/$linklib" case $host in *-*-sco3.2v5.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 can not # 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 "$hardcode_minus_L" = no; then case $host in *-*-sunos*) add_shlibpath="$dir" ;; esac add_dir="-L$dir" add="-l$name" elif test "$hardcode_shlibpath_var" = no; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; relink) if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$dir/$linklib" elif test "$hardcode_minus_L" = yes; 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 "$hardcode_shlibpath_var" = yes; then add_shlibpath="$dir" add="-l$name" else lib_linked=no fi ;; *) lib_linked=no ;; esac if test "$lib_linked" != yes; then 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 "$linkmode" = prog; then test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" test -n "$add" && compile_deplibs="$add $compile_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" if test "$hardcode_direct" != yes && test "$hardcode_minus_L" != yes && test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac fi fi fi if test "$linkmode" = prog || test "$opt_mode" = relink; then add_shlibpath= add_dir= add= # Finalize command for both is simple: just hardcode it. if test "$hardcode_direct" = yes && test "$hardcode_direct_absolute" = no; then add="$libdir/$linklib" elif test "$hardcode_minus_L" = yes; then add_dir="-L$libdir" add="-l$name" elif test "$hardcode_shlibpath_var" = yes; then case :$finalize_shlibpath: in *":$libdir:"*) ;; *) func_append finalize_shlibpath "$libdir:" ;; esac add="-l$name" elif test "$hardcode_automatic" = yes; then if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then add="$inst_prefix_dir$libdir/$linklib" else add="$libdir/$linklib" fi else # We cannot seem to hardcode it, guess we'll fake it. add_dir="-L$libdir" # Try looking first in the location we're being installed to. if test -n "$inst_prefix_dir"; then case $libdir in [\\/]*) func_append add_dir " -L$inst_prefix_dir$libdir" ;; esac fi add="-l$name" fi if test "$linkmode" = prog; then test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" test -n "$add" && finalize_deplibs="$add $finalize_deplibs" else test -n "$add_dir" && deplibs="$add_dir $deplibs" test -n "$add" && deplibs="$add $deplibs" fi fi elif test "$linkmode" = prog; then # Here we assume that one of hardcode_direct or hardcode_minus_L # is not unsupported. This is valid on all known static and # shared platforms. if test "$hardcode_direct" != unsupported; then test -n "$old_library" && linklib="$old_library" compile_deplibs="$dir/$linklib $compile_deplibs" finalize_deplibs="$dir/$linklib $finalize_deplibs" else compile_deplibs="-l$name -L$dir $compile_deplibs" finalize_deplibs="-l$name -L$dir $finalize_deplibs" fi elif test "$build_libtool_libs" = yes; then # Not a shared library if test "$deplibs_check_method" != pass_all; then # We're trying link a shared library against a static one # but the system doesn't support it. # Just print a warning and add the library to dependency_libs so # that the program can be linked against the static library. echo $ECHO "*** Warning: This system can not link to static lib archive $lib." echo "*** I have the capability to make that library automatically link in when" echo "*** you link to this library. But I can only do this if you have a" echo "*** shared version of the library, which you do not appear to have." if test "$module" = yes; then echo "*** But as you try to build a module library, libtool will still create " echo "*** a static module, that should work as long as the dlopening application" echo "*** is linked with the -dlopen flag to resolve symbols at runtime." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi else deplibs="$dir/$old_library $deplibs" link_static=yes fi fi # link shared/static library? if test "$linkmode" = lib; then if test -n "$dependency_libs" && { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes || test "$link_static" = yes; }; then # Extract -R from dependency_libs temp_deplibs= for libdir in $dependency_libs; do case $libdir in -R*) 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 "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" # ... and its dependency_libs tmp_libs= for deplib in $dependency_libs; do newdependency_libs="$deplib $newdependency_libs" case $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 "$link_all_deplibs" != no; then # Add the search paths of all dependency libraries for deplib in $dependency_libs; do path= case $deplib in -L*) path="$deplib" ;; *.la) 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 "$pass" = link; then if test "$linkmode" = "prog"; then compile_deplibs="$new_inherited_linker_flags $compile_deplibs" finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" else compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` fi fi dependency_libs="$newdependency_libs" if test "$pass" = dlpreopen; then # Link the dlpreopened libraries before other libraries for deplib in $save_deplibs; do deplibs="$deplib $deplibs" done fi if test "$pass" != dlopen; then if test "$pass" != conv; then # Make sure lib_search_path contains only unique directories. lib_search_path= for dir in $newlib_search_path; do case "$lib_search_path " in *" $dir "*) ;; *) func_append lib_search_path " $dir" ;; esac done newlib_search_path= fi if test "$linkmode,$pass" != "prog,link"; then vars="deplibs" else vars="compile_deplibs finalize_deplibs" fi for var in $vars dependency_libs; do # Add libraries to $var in reverse order eval tmp_libs=\"\$$var\" new_libs= for deplib in $tmp_libs; do # FIXME: Pedantically, this is the right thing to do, so # that some nasty dependency loop isn't accidentally # broken: #new_libs="$deplib $new_libs" # Pragmatically, this seems to cause very few problems in # practice: case $deplib in -L*) new_libs="$deplib $new_libs" ;; -R*) ;; *) # And here is the reason: when a library appears more # than once as an explicit dependence of a library, or # is implicitly linked in more than once by the # compiler, it is considered special, and multiple # occurrences thereof are not removed. Compare this # with having the same library being listed as a # dependency of multiple other libraries: in this case, # we know (pedantically, we assume) the library does not # need to be listed more than once, so we keep only the # last copy. This is not always right, but it is rare # enough that we require users that really mean to play # such unportable linking tricks to link the library # using -Wl,-lname, so that libtool does not consider it # for duplicate removal. case " $specialdeplibs " in *" $deplib "*) new_libs="$deplib $new_libs" ;; *) case " $new_libs " in *" $deplib "*) ;; *) new_libs="$deplib $new_libs" ;; esac ;; esac ;; esac done tmp_libs= for deplib in $new_libs; do case $deplib in -L*) case " $tmp_libs " in *" $deplib "*) ;; *) func_append tmp_libs " $deplib" ;; esac ;; *) func_append tmp_libs " $deplib" ;; esac done eval $var=\"$tmp_libs\" done # for var fi # Last step: remove runtime libs from dependency_libs # (they stay in deplibs) tmp_libs= for i in $dependency_libs ; do case " $predeps $postdeps $compiler_lib_search_path " in *" $i "*) i="" ;; esac if test -n "$i" ; then func_append tmp_libs " $i" fi done dependency_libs=$tmp_libs done # for pass if test "$linkmode" = prog; then dlfiles="$newdlfiles" fi if test "$linkmode" = prog || test "$linkmode" = lib; then dlprefiles="$newdlprefiles" fi case $linkmode in oldlib) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then func_warning "\`-dlopen' is ignored for archives" fi case " $deplibs" in *\ -l* | *\ -L*) 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 "$module" = no && \ func_fatal_help "libtool library \`$output' must begin with \`lib'" if test "$need_lib_prefix" != no; then # Add the "lib" prefix for modules if required 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 "$deplibs_check_method" != pass_all; 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 "$dlself" != no && \ func_warning "\`-dlopen self' is ignored for libtool libraries" set dummy $rpath shift test "$#" -gt 1 && \ func_warning "ignoring multiple \`-rpath's for a libtool library" install_libdir="$1" oldlibs= if test -z "$rpath"; then if test "$build_libtool_libs" = yes; then # Building a libtool convenience library. # Some compilers have problems with a `.al' extension so # convenience libraries should have the same extension an # archive normally would. oldlibs="$output_objdir/$libname.$libext $oldlibs" build_libtool_libs=convenience build_old_libs=yes fi 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 # which has an extra 1 added just for fun # case $version_type in # correct linux to gnu/linux during the next big refactor darwin|linux|osf|windows|none) func_arith $number_major + $number_minor current=$func_arith_result age="$number_minor" revision="$number_revision" ;; freebsd-aout|freebsd-elf|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" ;; freebsd-aout) major=".$current" versuffix=".$current.$revision"; ;; freebsd-elf) major=".$current" versuffix=".$current" ;; irix | nonstopux) if test "X$lt_irix_increment" = "Xno"; 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 "$loop" -ne 0; 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 "$loop" -ne 0; 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" ;; sunos) major=".$current" versuffix=".$current.$revision" ;; windows) # Use '-' rather than '.', since we only want one # extension on DOS 8.3 filesystems. 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 "$need_version" = no; then versuffix= else versuffix=".0.0" fi fi # Remove version info from name if versioning should be avoided if test "$avoid_version" = yes && test "$need_version" = no; then major= versuffix= verstring="" fi # Check to see if the archive will have undefined symbols. if test "$allow_undefined" = yes; then if test "$allow_undefined_flag" = unsupported; then func_warning "undefined symbols not allowed in $host shared libraries" build_libtool_libs=no build_old_libs=yes fi else # Don't allow undefined symbols. allow_undefined_flag="$no_undefined_flag" fi fi func_generate_dlsyms "$libname" "$libname" "yes" func_append libobjs " $symfileobj" test "X$libobjs" = "X " && libobjs= if test "$opt_mode" != relink; then # Remove our outputs, but don't remove object files since they # may have been created when compiling PIC objects. removelist= tempremovelist=`$ECHO "$output_objdir/*"` for p in $tempremovelist; do case $p in *.$objext | *.gcno) ;; $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) if test "X$precious_files_regex" != "X"; then if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 then 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 "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; 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 "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then dependency_libs="$temp_xrpath $dependency_libs" fi fi # Make sure dlfiles contains only unique files that won't be dlpreopened old_dlfiles="$dlfiles" dlfiles= for lib in $old_dlfiles; do case " $dlprefiles $dlfiles " in *" $lib "*) ;; *) 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 "$build_libtool_libs" = yes; 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 "$build_libtool_need_lc" = "yes"; 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 "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; 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 "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then for i in $predeps $postdeps ; do # can't use Xsed below, because $i might contain '/' tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` done fi case $tmp_deplibs in *[!\ \ ]*) echo if test "X$deplibs_check_method" = "Xnone"; then echo "*** Warning: inter-library dependencies are not supported in this platform." else echo "*** Warning: inter-library dependencies are not known to be supported." fi echo "*** All declared inter-library dependencies are being dropped." droppeddeps=yes ;; 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 "$droppeddeps" = yes; then if test "$module" = yes; then echo echo "*** Warning: libtool could not satisfy all declared inter-library" $ECHO "*** dependencies of module $libname. Therefore, libtool will create" echo "*** a static module, that should work as long as the dlopening" echo "*** application is linked with the -dlopen flag." if test -z "$global_symbol_pipe"; then echo echo "*** However, this would only work if libtool was able to extract symbol" echo "*** lists from a program, using \`nm' or equivalent, but libtool could" echo "*** not find such a program. So, this module is probably useless." echo "*** \`nm' from GNU binutils and a full rebuild may help." fi if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." if test "$allow_undefined" = no; then echo echo "*** Since this library must not contain undefined symbols," echo "*** because either the platform does not support them or" echo "*** it was explicitly requested with -no-undefined," echo "*** libtool will only create a static version of it." if test "$build_old_libs" = no; then oldlibs="$output_objdir/$libname.$libext" build_libtool_libs=module build_old_libs=yes else build_libtool_libs=no fi fi fi fi # Done checking deplibs! deplibs=$newdeplibs fi # 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 "$build_libtool_libs" = yes; then # Remove ${wl} instances when linking with ld. # FIXME: should test the right _cmds variable. case $archive_cmds in *\$LD\ *) wl= ;; esac if test "$hardcode_into_libs" = yes; then # Hardcode the library paths hardcode_libdirs= dep_rpath= rpath="$finalize_rpath" test "$opt_mode" != relink && rpath="$compile_rpath$rpath" for libdir in $rpath; do if test -n "$hardcode_libdir_flag_spec"; then if test -n "$hardcode_libdir_separator"; then 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 "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" if test -n "$shlibpath"; then eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" fi # Get the real and link names of the library. eval shared_ext=\"$shrext_cmds\" eval library_names=\"$library_names_spec\" set dummy $library_names 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 if test "x`$SED 1q $export_symbols`" != xEXPORTS; then # and it's NOT already a .def file. Must figure out # which of the given symbols are data symbols and tag # them as such. So, trigger use of export_symbols_cmds. # export_symbols gets reassigned inside the "prepare # the list of exported symbols" if statement, so the # include_expsyms logic still works. orig_export_symbols="$export_symbols" export_symbols= always_export_symbols=yes fi fi ;; esac # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 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 "$try_normal_branch" = yes \ && { 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 "X$skipped_export" != "X:"; then func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' func_show_eval '$MV "${export_symbols}T" "$export_symbols"' fi fi fi if test -n "$export_symbols" && test -n "$include_expsyms"; then 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 "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then # The given exports_symbols file has to be filtered, so filter it. func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" # FIXME: $output_objdir/$libname.filter potentially contains lots of # 's' commands which not all seds can handle. GNU sed should be fine # though. Also, the filter scales superlinearly with the number of # global variables. join(1) would be nice here, but unfortunately # isn't a blessed tool. $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter 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 "$compiler_needs_object" = yes && test -z "$libobjs"; then # extract the archives, so we have objects to list. # TODO: could optimize this to just extract one archive. whole_archive_flag_spec= fi if test -n "$whole_archive_flag_spec"; then save_libobjs=$libobjs eval libobjs=\"\$libobjs $whole_archive_flag_spec\" test "X$libobjs" = "X " && libobjs= else gentop="$output_objdir/${outputname}x" 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 "$thread_safe" = yes && 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 "$opt_mode" = relink; 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 "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then eval test_cmds=\"$module_expsym_cmds\" cmds=$module_expsym_cmds else eval test_cmds=\"$module_cmds\" cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval test_cmds=\"$archive_expsym_cmds\" cmds=$archive_expsym_cmds else eval test_cmds=\"$archive_cmds\" cmds=$archive_cmds fi fi if test "X$skipped_export" != "X:" && 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 "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then output=${output_objdir}/${output_la}.lnkscript func_verbose "creating GNU ld script: $output" echo 'INPUT (' > $output for obj in $save_libobjs do 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 "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then output=${output_objdir}/${output_la}.lnk func_verbose "creating linker input file list: $output" : > $output set x $save_libobjs shift firstobj= if test "$compiler_needs_object" = yes; then firstobj="$1 " shift fi for obj do 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 "X$objlist" = X || test "$len" -lt "$max_cmd_len"; then func_append objlist " $obj" else # The command $test_cmds is almost too long, add a # command to the queue. if test "$k" -eq 1 ; then # The first file doesn't have a previous command to add. 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 if ${skipped_export-false}; then func_verbose "generating symbol list for \`$libname.la'" export_symbols="$output_objdir/$libname.exp" $opt_dry_run || $RM $export_symbols libobjs=$output # Append the command to create the export file. test -z "$concat_cmds" || concat_cmds=$concat_cmds~ eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" if test -n "$last_robj"; then eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" fi 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_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; 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 if ${skipped_export-false}; then if test -n "$export_symbols" && test -n "$include_expsyms"; then tmp_export_symbols="$export_symbols" test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" $opt_dry_run || eval '$ECHO "$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 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 "$module" = yes && test -n "$module_cmds" ; then if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then cmds=$module_expsym_cmds else cmds=$module_cmds fi else if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then cmds=$archive_expsym_cmds else cmds=$archive_cmds fi fi 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="$save_ifs" eval cmd=\"$cmd\" $opt_silent || { func_quote_for_expand "$cmd" eval "func_echo $func_quote_for_expand_result" } $opt_dry_run || eval "$cmd" || { lt_exit=$? # Restore the uninstalled library and exit if test "$opt_mode" = relink; 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 "$opt_mode" = relink; 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 "$module" = yes || test "$export_dynamic" = yes; then # On all known operating systems, these are identical. dlname="$soname" fi fi ;; obj) if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; 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= # reload_cmds runs $LD directly, so let us get rid of # -Wl from whole_archive_flag_spec and hope we can get by with # turning comma into space.. wl= if test -n "$convenience"; then if test -n "$whole_archive_flag_spec"; then eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` 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 "$build_libtool_libs" != yes && 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" ### testsuite: skip nested quoting test 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 if test "$build_libtool_libs" != yes; then 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 fi if test -n "$pic_flag" || test "$pic_mode" != default; then # Only do commands if we really have different PIC objects. reload_objs="$libobjs $reload_conv_objs" output="$libobj" 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" test "$preload" = yes \ && test "$dlopen_support" = unknown \ && test "$dlopen_self" = unknown \ && test "$dlopen_self_static" = unknown && \ func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." case $host in *-*-rhapsody* | *-*-darwin1.[012]) # On Rhapsody replace the C library is the System framework compile_deplibs=`$ECHO " $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 "$tagname" = CXX ; 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 "$build_old_libs" = yes; 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@" "no" # template prelinking step if test -n "$prelink_cmds"; then func_execute_cmds "$prelink_cmds" 'exit $?' fi wrappers_required=yes case $host in *cegcc* | *mingw32ce*) # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. wrappers_required=no ;; *cygwin* | *mingw* ) if test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; *) if test "$need_relink" = no || test "$build_libtool_libs" != yes; then wrappers_required=no fi ;; esac if test "$wrappers_required" = no; then # Replace the output file specification. compile_command=`$ECHO "$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 fi if test -n "$compile_shlibpath$finalize_shlibpath"; then compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" fi if test -n "$finalize_shlibpath"; then finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" fi compile_var= finalize_var= if test -n "$runpath_var"; then if test -n "$perm_rpath"; then # We should set the runpath_var. rpath= for dir in $perm_rpath; do 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 "$no_install" = yes; then # We don't need to create a wrapper script. link_command="$compile_var$compile_command$compile_rpath" # Replace the output file specification. link_command=`$ECHO "$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 if test "$hardcode_action" = relink; then # Fast installation is not supported link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" func_warning "this platform does not like uninstalled shared libraries" func_warning "\`$output' will be relinked during installation" else if test "$fast_install" != no; then link_command="$finalize_var$compile_command$finalize_rpath" if test "$fast_install" = yes; then relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` else # fast_install is set to needless relink_command= fi else link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" fi fi # Replace the output file specification. link_command=`$ECHO "$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 if test "$build_libtool_libs" = convenience; then oldobjs="$libobjs_save $symfileobj" addlibs="$convenience" build_libtool_libs=no else if test "$build_libtool_libs" = module; then oldobjs="$libobjs_save" build_libtool_libs=no else oldobjs="$old_deplibs $non_pic_objects" if test "$preload" = yes && test -f "$symfileobj"; then func_append oldobjs " $symfileobj" fi fi addlibs="$old_convenience" fi 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 "$build_libtool_libs" = yes; 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 "X$oldobjs" = "X" ; 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 "$build_old_libs" = yes && 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 "$hardcode_automatic" = yes ; then relink_command= fi # Only create the output if not a dry run. $opt_dry_run || { for installed in no yes; do if test "$installed" = yes; then if test -z "$install_libdir"; then break fi output="$output_objdir/$outputname"i # Replace all uninstalled libtool libraries with the installed ones newdependency_libs= for deplib in $dependency_libs; do case $deplib in *.la) 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 "x$bindir" != x ; 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$TIMESTAMP) $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 can not go in dependency_libs. inherited_linker_flags='$new_inherited_linker_flags' # Libraries that this one depends upon. dependency_libs='$dependency_libs' # Names of additional weak libraries provided by this library weak_library_names='$weak_libs' # Version information for $libname. current=$current age=$age revision=$revision # Is this an already installed library? installed=$installed # Should we warn about portability when linking against -modules? shouldnotlink=$module # Files to dlopen/dlpreopen dlopen='$dlfiles' dlpreopen='$dlprefiles' # Directory that this library needs to be installed in: libdir='$install_libdir'" if test "$installed" = no && test "$need_relink" = yes; then $ECHO >> $output "\ relink_command=\"$relink_command\"" fi done } # 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 } { test "$opt_mode" = link || test "$opt_mode" = relink; } && func_mode_link ${1+"$@"} # func_mode_uninstall arg... func_mode_uninstall () { $opt_debug RM="$nonopt" files= rmforce= exit_status=0 # This variable tells wrapper scripts just to set variables rather # than running their programs. libtool_install_magic="$magic" for arg do case $arg in -f) func_append RM " $arg"; rmforce=yes ;; -*) 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 "X$dir" = X.; then odir="$objdir" else odir="$dir/$objdir" fi func_basename "$file" name="$func_basename_result" test "$opt_mode" = uninstall && odir="$dir" # Remember odir for removal later, being careful to avoid duplicates if test "$opt_mode" = clean; 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 test "$rmforce" = yes; 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" 'test "$rmforce" = yes || exit_status=1' fi if test -n "$old_library"; then # Do each command in the old_postuninstall commands. func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || 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 "$pic_object" != none; 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 "$non_pic_object" != none; then func_append rmfiles " $dir/$non_pic_object" fi fi ;; *) if test "$opt_mode" = clean ; 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 "$fast_install" = yes && 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 } { test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && func_mode_uninstall ${1+"$@"} 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 # in which we disable both kinds of libraries. Given conflicting # choices, we go for a static library, that is the most portable, # since we can't tell whether shared libraries were disabled because # the user asked for that or because the platform doesn't support # them. This is particularly important on AIX, because we don't # support having both static and shared libraries enabled at the same # time on that platform, so we default to a shared-only configuration. # If a disable-shared tag is given, we'll fallback to a static-only # configuration. But we'll never go from static-only to shared-only. # ### BEGIN LIBTOOL TAG CONFIG: disable-shared build_libtool_libs=no build_old_libs=yes # ### END LIBTOOL TAG CONFIG: disable-shared # ### BEGIN LIBTOOL TAG CONFIG: disable-static build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` # ### END LIBTOOL TAG CONFIG: disable-static # Local Variables: # mode:shell-script # sh-indentation:2 # End: # vi:sw=2 avfs-1.0.5/config.sub0000755000175000017500000010530113102441264014222 0ustar michaelmichael#! /bin/sh # Configuration validation subroutine script. # Copyright 1992-2013 Free Software Foundation, Inc. timestamp='2013-04-24' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by # 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 with a ChangeLog entry to config-patches@gnu.org. # # Configuration subroutine to validate and canonicalize a configuration type. # Supply the specified configuration type as an argument. # If it is invalid, we print an error message on stderr and exit with code 1. # Otherwise, we print the canonical config type on stdout and succeed. # You can get the latest version of this script from: # http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD # This file is supposed to be the same for all GNU packages # and recognize all the CPU types, system types and aliases # that are meaningful with *any* GNU software. # Each package is responsible for reporting which valid configurations # it does not support. The user should be able to distinguish # a failure to support a valid configuration from a meaningless # configuration. # The goal of this file is to map all the various variations of a given # machine specification into a single specification in the form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM # or in some cases, the newer four-part form: # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM # It is wrong to echo any other type of specification. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] CPU-MFR-OPSYS $0 [OPTION] ALIAS Canonicalize a configuration name. Operation modes: -h, --help print this help, then exit -t, --time-stamp print date of last modification, then exit -v, --version print version number, then exit Report bugs and patches to ." version="\ GNU config.sub ($timestamp) Copyright 1992-2013 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" 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 # Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \ linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \ knetbsd*-gnu* | netbsd*-gnu* | \ kopensolaris*-gnu* | \ storm-chaos* | os2-emx* | rtmk-nova*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; android-linux) os=-linux-android basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown ;; *) basic_machine=`echo $1 | sed 's/-[^-]*$//'` if [ $basic_machine != $1 ] then os=`echo $1 | sed 's/.*-/-/'` else os=; fi ;; esac ### Let's recognize common machines as not being operating systems so ### that things like config.sub decstation-3100 work. We also ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in -sun*os*) # Prevent following clause from handling this invalid input. ;; -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ -apple | -axis | -knuth | -cray | -microblaze*) os= basic_machine=$1 ;; -bluegene*) os=-cnk ;; -sim | -cisco | -oki | -wec | -winbond) os= basic_machine=$1 ;; -scout) ;; -wrs) os=-vxworks basic_machine=$1 ;; -chorusos*) os=-chorusos basic_machine=$1 ;; -chorusrdb) os=-chorusrdb basic_machine=$1 ;; -hiux*) os=-hiuxwe2 ;; -sco6) os=-sco5v6 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5) os=-sco3.2v5 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco4) os=-sco3.2v4 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2.[4-9]*) os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco3.2v[4-9]*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco5v6*) # Don't forget version if it is 3.2v4 or newer. basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -sco*) os=-sco3.2v2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -udk*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -isc) os=-isc2.2 basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -clix*) basic_machine=clipper-intergraph ;; -isc*) basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` ;; -lynx*178) os=-lynxos178 ;; -lynx*5) os=-lynxos5 ;; -lynx*) os=-lynxos ;; -ptx*) basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` ;; -windowsnt*) os=`echo $os | sed -e 's/windowsnt/winnt/'` ;; -psos*) os=-psos ;; -mint | -mint[0-9]*) basic_machine=m68k-atari os=-mint ;; esac # Decode aliases for certain CPU-COMPANY combinations. case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. 1750a | 580 \ | a29k \ | aarch64 | aarch64_be \ | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arceb \ | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \ | avr | avr32 \ | be32 | be64 \ | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | epiphany \ | fido | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | hexagon \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ | le32 | le64 \ | lm32 \ | m32c | m32r | m32rle | m68000 | m68k | m88k \ | maxq | mb | microblaze | microblazeel | mcore | mep | metag \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ | mips64octeon | mips64octeonel \ | mips64orion | mips64orionel \ | mips64r5900 | mips64r5900el \ | mips64vr | mips64vrel \ | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ | mipsisa64r2 | mipsisa64r2el \ | mipsisa64sb1 | mipsisa64sb1el \ | mipsisa64sr71k | mipsisa64sr71kel \ | mipsr5900 | mipsr5900el \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ | moxie \ | mt \ | msp430 \ | nds32 | nds32le | nds32be \ | nios | nios2 | nios2eb | nios2el \ | ns16k | ns32k \ | open8 \ | or1k | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle \ | pyramid \ | rl78 | rx \ | score \ | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ | we32k \ | x86 | xc16x | xstormy16 | xtensa \ | z8k | z80) basic_machine=$basic_machine-unknown ;; c54x) basic_machine=tic54x-unknown ;; c55x) basic_machine=tic55x-unknown ;; c6x) basic_machine=tic6x-unknown ;; m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | picochip) basic_machine=$basic_machine-unknown os=-none ;; m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) ;; ms1) basic_machine=mt-unknown ;; strongarm | thumb | xscale) basic_machine=arm-unknown ;; xgate) basic_machine=$basic_machine-unknown os=-none ;; xscaleeb) basic_machine=armeb-unknown ;; xscaleel) basic_machine=armel-unknown ;; # We use `pc' rather than `unknown' # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) basic_machine=$basic_machine-pc ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; # Recognize the basic CPU types with company name. 580-* \ | a29k-* \ | aarch64-* | aarch64_be-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* | avr32-* \ | be32-* | be64-* \ | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* \ | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ | h8300-* | h8500-* \ | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | hexagon-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ | le32-* | le64-* \ | lm32-* \ | m32c-* | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ | m88110-* | m88k-* | maxq-* | mcore-* | metag-* \ | microblaze-* | microblazeel-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ | mips64octeon-* | mips64octeonel-* \ | mips64orion-* | mips64orionel-* \ | mips64r5900-* | mips64r5900el-* \ | mips64vr-* | mips64vrel-* \ | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ | mipsisa64r2-* | mipsisa64r2el-* \ | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipsr5900-* | mipsr5900el-* \ | mipstx39-* | mipstx39el-* \ | mmix-* \ | mt-* \ | msp430-* \ | nds32-* | nds32le-* | nds32be-* \ | nios-* | nios2-* | nios2eb-* | nios2el-* \ | none-* | np1-* | ns16k-* | ns32k-* \ | open8-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \ | pyramid-* \ | rl78-* | romp-* | rs6000-* | rx-* \ | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ | tron-* \ | ubicom32-* \ | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \ | vax-* \ | we32k-* \ | x86-* | x86_64-* | xc16x-* | xps100-* \ | xstormy16-* | xtensa*-* \ | ymp-* \ | z8k-* | z80-*) ;; # Recognize the basic CPU types without company name, with glob match. xtensa*) basic_machine=$basic_machine-unknown ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) basic_machine=i386-unknown os=-bsd ;; 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) basic_machine=m68000-att ;; 3b*) basic_machine=we32k-att ;; a29khif) basic_machine=a29k-amd os=-udi ;; abacus) basic_machine=abacus-unknown ;; adobe68k) basic_machine=m68010-adobe os=-scout ;; alliant | fx80) basic_machine=fx80-alliant ;; altos | altos3068) basic_machine=m68k-altos ;; am29k) basic_machine=a29k-none os=-bsd ;; amd64) basic_machine=x86_64-pc ;; amd64-*) basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; amdahl) basic_machine=580-amdahl os=-sysv ;; amiga | amiga-*) basic_machine=m68k-unknown ;; amigaos | amigados) basic_machine=m68k-unknown os=-amigaos ;; amigaunix | amix) basic_machine=m68k-unknown os=-sysv4 ;; apollo68) basic_machine=m68k-apollo os=-sysv ;; apollo68bsd) basic_machine=m68k-apollo os=-bsd ;; aros) basic_machine=i386-pc os=-aros ;; aux) basic_machine=m68k-apple os=-aux ;; balance) basic_machine=ns32k-sequent os=-dynix ;; blackfin) basic_machine=bfin-unknown os=-linux ;; blackfin-*) basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; bluegene*) basic_machine=powerpc-ibm os=-cnk ;; c54x-*) basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c55x-*) basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c6x-*) basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'` ;; c90) basic_machine=c90-cray os=-unicos ;; cegcc) basic_machine=arm-unknown os=-cegcc ;; convex-c1) basic_machine=c1-convex os=-bsd ;; convex-c2) basic_machine=c2-convex os=-bsd ;; convex-c32) basic_machine=c32-convex os=-bsd ;; convex-c34) basic_machine=c34-convex os=-bsd ;; convex-c38) basic_machine=c38-convex os=-bsd ;; cray | j90) basic_machine=j90-cray os=-unicos ;; craynv) basic_machine=craynv-cray os=-unicosmp ;; cr16 | cr16-*) basic_machine=cr16-unknown os=-elf ;; crds | unos) basic_machine=m68k-crds ;; crisv32 | crisv32-* | etraxfs*) basic_machine=crisv32-axis ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; crx) basic_machine=crx-unknown os=-elf ;; da30 | da30-*) basic_machine=m68k-da30 ;; decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) basic_machine=mips-dec ;; decsystem10* | dec10*) basic_machine=pdp10-dec os=-tops10 ;; decsystem20* | dec20*) basic_machine=pdp10-dec os=-tops20 ;; delta | 3300 | motorola-3300 | motorola-delta \ | 3300-motorola | delta-motorola) basic_machine=m68k-motorola ;; delta88) basic_machine=m88k-motorola os=-sysv3 ;; dicos) basic_machine=i686-pc os=-dicos ;; djgpp) basic_machine=i586-pc os=-msdosdjgpp ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx ;; dpx2* | dpx2*-bull) basic_machine=m68k-bull os=-sysv3 ;; ebmon29k) basic_machine=a29k-amd os=-ebmon ;; elxsi) basic_machine=elxsi-elxsi os=-bsd ;; encore | umax | mmax) basic_machine=ns32k-encore ;; es1800 | OSE68k | ose68k | ose | OSE) basic_machine=m68k-ericsson os=-ose ;; fx2800) basic_machine=i860-alliant ;; genix) basic_machine=ns32k-ns ;; gmicro) basic_machine=tron-gmicro os=-sysv ;; go32) basic_machine=i386-pc os=-go32 ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; h8300hms) basic_machine=h8300-hitachi os=-hms ;; h8300xray) basic_machine=h8300-hitachi os=-xray ;; h8500hms) basic_machine=h8500-hitachi os=-hms ;; harris) basic_machine=m88k-harris os=-sysv3 ;; hp300-*) basic_machine=m68k-hp ;; hp300bsd) basic_machine=m68k-hp os=-bsd ;; hp300hpux) basic_machine=m68k-hp os=-hpux ;; hp3k9[0-9][0-9] | hp9[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k2[0-9][0-9] | hp9k31[0-9]) basic_machine=m68000-hp ;; hp9k3[2-9][0-9]) basic_machine=m68k-hp ;; hp9k6[0-9][0-9] | hp6[0-9][0-9]) basic_machine=hppa1.0-hp ;; hp9k7[0-79][0-9] | hp7[0-79][0-9]) basic_machine=hppa1.1-hp ;; hp9k78[0-9] | hp78[0-9]) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) # FIXME: really hppa2.0-hp basic_machine=hppa1.1-hp ;; hp9k8[0-9][13679] | hp8[0-9][13679]) basic_machine=hppa1.1-hp ;; hp9k8[0-9][0-9] | hp8[0-9][0-9]) basic_machine=hppa1.0-hp ;; hppa-next) os=-nextstep3 ;; hppaosf) basic_machine=hppa1.1-hp os=-osf ;; hppro) basic_machine=hppa1.1-hp os=-proelf ;; i370-ibm* | ibm*) basic_machine=i370-ibm ;; i*86v32) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv32 ;; i*86v4*) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv4 ;; i*86v) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-sysv ;; i*86sol2) basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` os=-solaris2 ;; i386mach) basic_machine=i386-mach os=-mach ;; i386-vsta | vsta) basic_machine=i386-unknown os=-vsta ;; iris | iris4d) basic_machine=mips-sgi case $os in -irix*) ;; *) os=-irix4 ;; esac ;; isi68 | isi) basic_machine=m68k-isi os=-sysv ;; m68knommu) basic_machine=m68k-unknown os=-linux ;; m68knommu-*) basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; m88k-omron*) basic_machine=m88k-omron ;; magnum | m3230) basic_machine=mips-mips os=-sysv ;; merlin) basic_machine=ns32k-utek os=-sysv ;; microblaze*) basic_machine=microblaze-xilinx ;; mingw64) basic_machine=x86_64-pc os=-mingw64 ;; mingw32) basic_machine=i386-pc os=-mingw32 ;; mingw32ce) basic_machine=arm-unknown os=-mingw32ce ;; miniframe) basic_machine=m68000-convergent ;; *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) basic_machine=m68k-atari os=-mint ;; mips3*-*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` ;; mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; monitor) basic_machine=m68k-rom68k os=-coff ;; morphos) basic_machine=powerpc-unknown os=-morphos ;; msdos) basic_machine=i386-pc os=-msdos ;; ms1-*) basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` ;; msys) basic_machine=i386-pc os=-msys ;; mvs) basic_machine=i370-ibm os=-mvs ;; nacl) basic_machine=le32-unknown os=-nacl ;; ncr3000) basic_machine=i486-ncr os=-sysv4 ;; netbsd386) basic_machine=i386-unknown os=-netbsd ;; netwinder) basic_machine=armv4l-rebel os=-linux ;; news | news700 | news800 | news900) basic_machine=m68k-sony os=-newsos ;; news1000) basic_machine=m68030-sony os=-newsos ;; news-3600 | risc-news) basic_machine=mips-sony os=-newsos ;; necv70) basic_machine=v70-nec os=-sysv ;; next | m*-next ) basic_machine=m68k-next case $os in -nextstep* ) ;; -ns2*) os=-nextstep2 ;; *) os=-nextstep3 ;; esac ;; nh3000) basic_machine=m68k-harris os=-cxux ;; nh[45]000) basic_machine=m88k-harris os=-cxux ;; nindy960) basic_machine=i960-intel os=-nindy ;; mon960) basic_machine=i960-intel os=-mon960 ;; nonstopux) basic_machine=mips-compaq os=-nonstopux ;; np1) basic_machine=np1-gould ;; neo-tandem) basic_machine=neo-tandem ;; nse-tandem) basic_machine=nse-tandem ;; nsr-tandem) basic_machine=nsr-tandem ;; op50n-* | op60c-*) basic_machine=hppa1.1-oki os=-proelf ;; openrisc | openrisc-*) basic_machine=or32-unknown ;; os400) basic_machine=powerpc-ibm os=-os400 ;; OSE68000 | ose68000) basic_machine=m68000-ericsson os=-ose ;; os68k) basic_machine=m68k-none os=-os68k ;; pa-hitachi) basic_machine=hppa1.1-hitachi os=-hiuxwe2 ;; paragon) basic_machine=i860-intel os=-osf ;; parisc) basic_machine=hppa-unknown os=-linux ;; parisc-*) basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` os=-linux ;; pbd) basic_machine=sparc-tti ;; pbb) basic_machine=m68k-tti ;; pc532 | pc532-*) basic_machine=ns32k-pc532 ;; pc98) basic_machine=i386-pc ;; pc98-*) basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium | p5 | k5 | k6 | nexgen | viac3) basic_machine=i586-pc ;; pentiumpro | p6 | 6x86 | athlon | athlon_*) basic_machine=i686-pc ;; pentiumii | pentium2 | pentiumiii | pentium3) basic_machine=i686-pc ;; pentium4) basic_machine=i786-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumpro-* | p6-* | 6x86-* | athlon-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentium4-*) basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; power) basic_machine=power-ibm ;; ppc | ppcbe) basic_machine=powerpc-unknown ;; ppc-* | ppcbe-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppcle | powerpclittle | ppc-le | powerpc-little) basic_machine=powerpcle-unknown ;; ppcle-* | powerpclittle-*) basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64) basic_machine=powerpc64-unknown ;; ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ppc64le | powerpc64little | ppc64-le | powerpc64-little) basic_machine=powerpc64le-unknown ;; ppc64le-* | powerpc64little-*) basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` ;; ps2) basic_machine=i386-ibm ;; pw32) basic_machine=i586-unknown os=-pw32 ;; rdos | rdos64) basic_machine=x86_64-pc os=-rdos ;; rdos32) basic_machine=i386-pc os=-rdos ;; rom68k) basic_machine=m68k-rom68k os=-coff ;; rm[46]00) basic_machine=mips-siemens ;; rtpc | rtpc-*) basic_machine=romp-ibm ;; s390 | s390-*) basic_machine=s390-ibm ;; s390x | s390x-*) basic_machine=s390x-ibm ;; sa29200) basic_machine=a29k-amd os=-udi ;; sb1) basic_machine=mipsisa64sb1-unknown ;; sb1el) basic_machine=mipsisa64sb1el-unknown ;; sde) basic_machine=mipsisa32-sde os=-elf ;; sei) basic_machine=mips-sei os=-seiux ;; sequent) basic_machine=i386-sequent ;; sh) basic_machine=sh-hitachi os=-hms ;; sh5el) basic_machine=sh5le-unknown ;; sh64) basic_machine=sh64-unknown ;; sparclite-wrs | simso-wrs) basic_machine=sparclite-wrs os=-vxworks ;; sps7) basic_machine=m68k-bull os=-sysv2 ;; spur) basic_machine=spur-unknown ;; st2000) basic_machine=m68k-tandem ;; stratus) basic_machine=i860-stratus os=-sysv4 ;; strongarm-* | thumb-*) basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'` ;; sun2) basic_machine=m68000-sun ;; sun2os3) basic_machine=m68000-sun os=-sunos3 ;; sun2os4) basic_machine=m68000-sun os=-sunos4 ;; sun3os3) basic_machine=m68k-sun os=-sunos3 ;; sun3os4) basic_machine=m68k-sun os=-sunos4 ;; sun4os3) basic_machine=sparc-sun os=-sunos3 ;; sun4os4) basic_machine=sparc-sun os=-sunos4 ;; sun4sol2) basic_machine=sparc-sun os=-solaris2 ;; sun3 | sun3-*) basic_machine=m68k-sun ;; sun4) basic_machine=sparc-sun ;; sun386 | sun386i | roadrunner) basic_machine=i386-sun ;; sv1) basic_machine=sv1-cray os=-unicos ;; symmetry) basic_machine=i386-sequent os=-dynix ;; t3e) basic_machine=alphaev5-cray os=-unicos ;; t90) basic_machine=t90-cray os=-unicos ;; tile*) basic_machine=$basic_machine-unknown os=-linux-gnu ;; tx39) basic_machine=mipstx39-unknown ;; tx39el) basic_machine=mipstx39el-unknown ;; toad1) basic_machine=pdp10-xkl os=-tops20 ;; tower | tower-32) basic_machine=m68k-ncr ;; tpf) basic_machine=s390x-ibm os=-tpf ;; udi29k) basic_machine=a29k-amd os=-udi ;; ultra3) basic_machine=a29k-nyu os=-sym1 ;; v810 | necv810) basic_machine=v810-nec os=-none ;; vaxv) basic_machine=vax-dec os=-sysv ;; vms) basic_machine=vax-dec os=-vms ;; vpp*|vx|vx-*) basic_machine=f301-fujitsu ;; vxworks960) basic_machine=i960-wrs os=-vxworks ;; vxworks68) basic_machine=m68k-wrs os=-vxworks ;; vxworks29k) basic_machine=a29k-wrs os=-vxworks ;; w65*) basic_machine=w65-wdc os=-none ;; w89k-*) basic_machine=hppa1.1-winbond os=-proelf ;; xbox) basic_machine=i686-pc os=-mingw32 ;; xps | xps100) basic_machine=xps100-honeywell ;; xscale-* | xscalee[bl]-*) basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'` ;; ymp) basic_machine=ymp-cray os=-unicos ;; z8k-*-coff) basic_machine=z8k-unknown os=-sim ;; z80-*-coff) basic_machine=z80-unknown os=-sim ;; none) basic_machine=none-none os=-none ;; # Here we handle the default manufacturer of certain CPU types. It is in # some cases the only manufacturer, in others, it is the most popular. w89k) basic_machine=hppa1.1-winbond ;; op50n) basic_machine=hppa1.1-oki ;; op60c) basic_machine=hppa1.1-oki ;; romp) basic_machine=romp-ibm ;; mmix) basic_machine=mmix-knuth ;; rs6000) basic_machine=rs6000-ibm ;; vax) basic_machine=vax-dec ;; pdp10) # there are many clones, so DEC is not a safe bet basic_machine=pdp10-unknown ;; pdp11) basic_machine=pdp11-dec ;; we32k) basic_machine=we32k-att ;; sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) basic_machine=sparc-sun ;; cydra) basic_machine=cydra-cydrome ;; orion) basic_machine=orion-highlevel ;; orion105) basic_machine=clipper-highlevel ;; mac | mpw | mac-mpw) basic_machine=m68k-apple ;; pmac | pmac-mpw) basic_machine=powerpc-apple ;; *-unknown) # Make sure to match an already-canonicalized machine name. ;; *) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 exit 1 ;; esac # Here we canonicalize certain aliases for manufacturers. case $basic_machine in *-digital*) basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` ;; *-commodore*) basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` ;; *) ;; esac # Decode manufacturer-specific aliases for certain operating systems. if [ x"$os" != x"" ] then case $os in # First match some system type aliases # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -auroraux) os=-auroraux ;; -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` ;; -solaris) os=-solaris2 ;; -svr4*) os=-sysv4 ;; -unixware*) os=-sysv4.2uw ;; -gnu/linux*) os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` ;; # First accept the basic system types. # The portable systems comes first. # Each alternative MUST END IN A *, to match a version number. # -sysv* is not here because it comes later, after sysvr4. -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ | -sym* | -kopensolaris* | -plan9* \ | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ | -aos* | -aros* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ | -bitrig* | -openbsd* | -solidbsd* \ | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* | -cegcc* \ | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \ | -linux-newlib* | -linux-musl* | -linux-uclibc* \ | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) case $basic_machine in x86-* | i*86-*) ;; *) os=-nto$os ;; esac ;; -nto-qnx*) ;; -nto*) os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) os=`echo $os | sed -e 's|mac|macos|'` ;; -linux-dietlibc) os=-linux-dietlibc ;; -linux*) os=`echo $os | sed -e 's|linux|linux-gnu|'` ;; -sunos5*) os=`echo $os | sed -e 's|sunos5|solaris2|'` ;; -sunos6*) os=`echo $os | sed -e 's|sunos6|solaris3|'` ;; -opened*) os=-openedition ;; -os400*) os=-os400 ;; -wince*) os=-wince ;; -osfrose*) os=-osfrose ;; -osf*) os=-osf ;; -utek*) os=-bsd ;; -dynix*) os=-bsd ;; -acis*) os=-aos ;; -atheos*) os=-atheos ;; -syllable*) os=-syllable ;; -386bsd) os=-bsd ;; -ctix* | -uts*) os=-sysv ;; -nova*) os=-rtmk-nova ;; -ns2 ) os=-nextstep2 ;; -nsk*) os=-nsk ;; # Preserve the version number of sinix5. -sinix5.*) os=`echo $os | sed -e 's|sinix|sysv|'` ;; -sinix*) os=-sysv4 ;; -tpf*) os=-tpf ;; -triton*) os=-sysv3 ;; -oss*) os=-sysv3 ;; -svr4) os=-sysv4 ;; -svr3) os=-sysv3 ;; -sysvr4) os=-sysv4 ;; # This must come after -sysvr4. -sysv*) ;; -ose*) os=-ose ;; -es1800*) os=-ose ;; -xenix) os=-xenix ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -aros*) os=-aros ;; -zvmoe) os=-zvmoe ;; -dicos*) os=-dicos ;; -nacl*) ;; -none) ;; *) # Get rid of the `-' at the beginning of $os. os=`echo $os | sed 's/[^-]*-//'` echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 exit 1 ;; esac else # Here we handle the default operating systems that come with various machines. # The value should be what the vendor currently ships out the door with their # machine or put another way, the most popular os provided with the machine. # Note that if you're going to try to match "-MANUFACTURER" here (say, # "-sun"), then you have to tell the case statement up towards the top # that MANUFACTURER isn't an operating system. Otherwise, code above # will signal an error saying that MANUFACTURER isn't an operating # system, and we'll never get to this point. case $basic_machine in score-*) os=-elf ;; spu-*) os=-elf ;; *-acorn) os=-riscix1.2 ;; arm*-rebel) os=-linux ;; arm*-semi) os=-aout ;; c4x-* | tic4x-*) os=-coff ;; hexagon-*) os=-elf ;; tic54x-*) os=-coff ;; tic55x-*) os=-coff ;; tic6x-*) os=-coff ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 ;; pdp11-*) os=-none ;; *-dec | vax-*) os=-ultrix4.2 ;; m68*-apollo) os=-domain ;; i386-sun) os=-sunos4.0.2 ;; m68000-sun) os=-sunos3 ;; m68*-cisco) os=-aout ;; mep-*) os=-elf ;; mips*-cisco) os=-elf ;; mips*-*) os=-elf ;; or1k-*) os=-elf ;; or32-*) os=-coff ;; *-tti) # must be before sparc entry or we get the wrong os. os=-sysv3 ;; sparc-* | *-sun) os=-sunos4.1.1 ;; *-be) os=-beos ;; *-haiku) os=-haiku ;; *-ibm) os=-aix ;; *-knuth) os=-mmixware ;; *-wec) os=-proelf ;; *-winbond) os=-proelf ;; *-oki) os=-proelf ;; *-hp) os=-hpux ;; *-hitachi) os=-hiux ;; i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) os=-sysv ;; *-cbm) os=-amigaos ;; *-dg) os=-dgux ;; *-dolphin) os=-sysv3 ;; m68k-ccur) os=-rtu ;; m88k-omron*) os=-luna ;; *-next ) os=-nextstep ;; *-sequent) os=-ptx ;; *-crds) os=-unos ;; *-ns) os=-genix ;; i370-*) os=-mvs ;; *-next) os=-nextstep3 ;; *-gould) os=-sysv ;; *-highlevel) os=-bsd ;; *-encore) os=-bsd ;; *-sgi) os=-irix ;; *-siemens) os=-sysv4 ;; *-masscomp) os=-rtu ;; f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) os=-coff ;; *-*bug) os=-coff ;; *-apple) os=-macos ;; *-atari*) os=-mint ;; *) os=-none ;; esac fi # Here we handle the case where we know the os, and the CPU type, but not the # manufacturer. We pick the logical manufacturer. vendor=unknown case $basic_machine in *-unknown) case $os in -riscix*) vendor=acorn ;; -sunos*) vendor=sun ;; -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 ;; -mvs* | -opened*) vendor=ibm ;; -os400*) vendor=ibm ;; -ptx*) vendor=sequent ;; -tpf*) vendor=ibm ;; -vxsim* | -vxworks* | -windiss*) vendor=wrs ;; -aux*) vendor=apple ;; -hms*) vendor=hitachi ;; -mpw* | -macos*) vendor=apple ;; -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; -vos*) vendor=stratus ;; esac basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` ;; esac echo $basic_machine$os exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: avfs-1.0.5/Makefile.in0000644000175000017500000006262313102441264014315 0ustar michaelmichael# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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 = . DIST_COMMON = INSTALL NEWS README AUTHORS ChangeLog \ $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/configure $(am__configure_deps) \ $(top_srcdir)/avfscoda/redir/Makefile.in COPYING COPYING.LIB \ TODO config.guess config.sub install-sh missing ltmain.sh ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/neon-ssl.m4 \ $(top_srcdir)/macros/neon-xml-parser.m4 \ $(top_srcdir)/macros/neon.m4 $(top_srcdir)/macros/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/include/config.h CONFIG_CLEAN_FILES = avfscoda/redir/Makefile 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 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) 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 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@ EMACS = @EMACS@ 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@ KERNINCLUDE = @KERNINCLUDE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEONLIBS = @NEONLIBS@ NEONOBJS = @NEONOBJS@ NEON_BUILD_BUNDLED = @NEON_BUILD_BUNDLED@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ NEON_OBJEXT = @NEON_OBJEXT@ NEON_TARGET = @NEON_TARGET@ 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@ PRELOAD_LIBS = @PRELOAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ XML_CONFIG = @XML_CONFIG@ 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@ avfscoda_build = @avfscoda_build@ 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@ initstyle = @initstyle@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ kmoduledir = @kmoduledir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ preload_build = @preload_build@ profiledir = @profiledir@ program_transform_name = @program_transform_name@ psdir = @psdir@ rcdir = @rcdir@ rcscriptdir = @rcscriptdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ start_levels = @start_levels@ start_prio = @start_prio@ stop_levels = @stop_levels@ stop_prio = @stop_prio@ 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 \ libneon \ lib \ preload \ avfscoda \ include \ test \ scripts \ spec \ patch \ macros \ extfs \ doc \ fuse 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 .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) $(am__cd) $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) $(am__aclocal_m4_deps): avfscoda/redir/Makefile: $(top_builddir)/config.status $(top_srcdir)/avfscoda/redir/Makefile.in cd $(top_builddir) && $(SHELL) ./config.status $@ 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: $(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) | GZIP=$(GZIP_ENV) gzip -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-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__post_remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -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*) \ GZIP=$(GZIP_ENV) gzip -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*) \ GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir) chmod u+w $(distdir) mkdir $(distdir)/_build $(distdir)/_inst chmod a-w $(distdir) test -d $(distdir)/_build || exit 0; \ dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && am__cwd=`pwd` \ && $(am__cd) $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(AM_DISTCHECK_CONFIGURE_FLAGS) \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ && cd "$$am__cwd" \ || exit 1 $(am__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 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 start: ( cd scripts && make start ) # 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.0.5/COPYING0000644000175000017500000004313313102441254013275 0ustar michaelmichael 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.0.5/extfs/0000755000175000017500000000000013102441322013363 5ustar michaelmichaelavfs-1.0.5/extfs/uc1541.in0000644000175000017500000000311213102441254014636 0ustar michaelmichael#! /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.0.5/extfs/uace.in0000644000175000017500000000220313102441254014631 0ustar michaelmichael#! /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.0.5/extfs/uarc0000644000175000017500000000232313102441254014244 0ustar michaelmichael#!/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.0.5/extfs/ucab0000644000175000017500000000355213102441254014231 0ustar michaelmichael#!/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.0.5/extfs/uxdms.in0000644000175000017500000000244613102441254015065 0ustar michaelmichael#! /bin/sh # # Written by Ralf Hoffmann # 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.0.5/extfs/deba.in0000644000175000017500000000577313102441254014626 0ustar michaelmichael#! @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=< # # 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. # 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 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.0.5/extfs/audio.in0000644000175000017500000000245113102441254015022 0ustar michaelmichael#! /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.0.5/extfs/uextrar.in0000644000175000017500000000632513102441254015417 0ustar michaelmichael#! /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.0.5/extfs/udar0000644000175000017500000000575213102441254014256 0ustar michaelmichael#! /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 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.0.5/extfs/uar.in0000644000175000017500000000172313102441254014511 0ustar michaelmichael#!/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.0.5/extfs/Makefile.am0000644000175000017500000000111313102441254015417 0ustar michaelmichaelEXTFS_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.0.5/extfs/trpm0000755000175000017500000002162613102441254014306 0ustar michaelmichael#! /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.0.5/extfs/uzip.in0000644000175000017500000003110213102441254014703 0ustar michaelmichael#! @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.0.5/extfs/upp.in0000644000175000017500000000175113102441254014527 0ustar michaelmichael#! /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.0.5/extfs/iso9660.in0000644000175000017500000000422513102441254015041 0ustar michaelmichael#! /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.0.5/extfs/uxpk.in0000644000175000017500000000510213102441254014704 0ustar michaelmichael#! /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.0.5/extfs/u7z.in0000644000175000017500000000636413102441254014455 0ustar michaelmichael#! /bin/sh # # u7z - 7zip file archive Virtual File System for Midnight Commander ( ftp://ftp.ibiblio.org/pub/Linux/utils/file/managers/mc/ ) # # Copyright (C) 2004 Sergiy Niskorodov (sgh at ukrpost dot net) # Written by Sergiy Niskorodov aka SGh # # beta version 4.16 (11 Apr 2005) # # 7z for linux can be found on http://sourceforge.net/projects/p7zip/ # Thanks to urar VFS authors andrey joukov 2:5020/337.13@fidonet.org, # christian.gennerat@alcatel.fr, Andrew V. Samoilov # 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.0.5/extfs/patchfs.in0000644000175000017500000002151213102441254015350 0ustar michaelmichael#! @PERL@ -w # # Written by Adam Byrtek , 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.0.5/extfs/ftplist0000755000175000017500000000442313102441254015005 0ustar michaelmichael#! /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.0.5/extfs/apt.in0000644000175000017500000002276713102441254014521 0ustar michaelmichael#! @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=< [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.0.5/extfs/extfs.ini0000644000175000017500000000225213102441254015222 0ustar michaelmichael# 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.0.5/extfs/uha.in0000644000175000017500000000171213102441254014475 0ustar michaelmichael#! /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.0.5/extfs/bpp0000755000175000017500000000226713102441254014105 0ustar michaelmichael#! /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.0.5/extfs/uadf0000644000175000017500000000366213102441254014240 0ustar michaelmichael#! /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.0.5/extfs/uarj.in0000644000175000017500000000317013102441254014661 0ustar michaelmichael#! /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.0.5/extfs/dpkg.in0000644000175000017500000002143713102441254014653 0ustar michaelmichael#! @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=< 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=< (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.0.5/extfs/lslR.in0000644000175000017500000000177613102441254014646 0ustar michaelmichael#! /bin/sh # Based on previous version of lslR # Modified by Tomas Novak 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.0.5/extfs/hp48.in0000644000175000017500000000510713102441254014505 0ustar michaelmichael#!/bin/sh # # Written by Christofer Edvardsen , 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.0.5/extfs/Makefile.in0000644000175000017500000005123213102441264015440 0ustar michaelmichael# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(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)/uha.in $(srcdir)/ulha.in $(srcdir)/upp.in \ $(srcdir)/uextrar.in $(srcdir)/uxdms.in $(srcdir)/uxpk.in \ $(srcdir)/uzip.in $(srcdir)/uzoo.in README ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/neon-ssl.m4 \ $(top_srcdir)/macros/neon-xml-parser.m4 \ $(top_srcdir)/macros/neon.m4 $(top_srcdir)/macros/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) 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) 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@ EMACS = @EMACS@ 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@ KERNINCLUDE = @KERNINCLUDE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEONLIBS = @NEONLIBS@ NEONOBJS = @NEONOBJS@ NEON_BUILD_BUNDLED = @NEON_BUILD_BUNDLED@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ NEON_OBJEXT = @NEON_OBJEXT@ NEON_TARGET = @NEON_TARGET@ 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@ PRELOAD_LIBS = @PRELOAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ XML_CONFIG = @XML_CONFIG@ 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@ avfscoda_build = @avfscoda_build@ 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@ initstyle = @initstyle@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ kmoduledir = @kmoduledir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ preload_build = @preload_build@ profiledir = @profiledir@ program_transform_name = @program_transform_name@ psdir = @psdir@ rcdir = @rcdir@ rcscriptdir = @rcscriptdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ start_levels = @start_levels@ start_prio = @start_prio@ stop_levels = @stop_levels@ stop_prio = @stop_prio@ 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 .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(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: $(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 # 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.0.5/extfs/debd.in0000644000175000017500000002436613102441254014630 0ustar michaelmichael#! @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=< 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.0.5/extfs/ucpio0000755000175000017500000000223213102441254014433 0ustar michaelmichael#! /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.0.5/extfs/rpms.in0000644000175000017500000000273613102441254014710 0ustar michaelmichael#! @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.0.5/extfs/a.in0000644000175000017500000000617713102441254014152 0ustar michaelmichael#! @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.0.5/extfs/uzoo.in0000644000175000017500000000262213102441254014715 0ustar michaelmichael#! /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.0.5/extfs/uimg0000644000175000017500000001310113102441254014247 0ustar michaelmichael#!/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.0.5/macros/0000755000175000017500000000000013102441322013516 5ustar michaelmichaelavfs-1.0.5/macros/neon-xml-parser.m40000644000175000017500000001024613102441254017016 0ustar michaelmichael# 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.0.5/macros/Makefile.am0000644000175000017500000000013513102441254015555 0ustar michaelmichaelEXTRA_DIST = neon-ssl.m4 \ neon-xml-parser.m4 \ neon.m4 \ ld-versionscript.m4 \ extfs.m4 avfs-1.0.5/macros/extfs.m40000644000175000017500000000112513102441254015114 0ustar michaelmichaeldnl 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.0.5/macros/pkg.m40000644000175000017500000001206313102441254014547 0ustar michaelmichael# 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.0.5/macros/ld-versionscript.m40000644000175000017500000000202513102441254017272 0ustar michaelmichael# 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.0.5/macros/Makefile.in0000644000175000017500000003124213102441264015572 0ustar michaelmichael# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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 DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/neon-ssl.m4 \ $(top_srcdir)/macros/neon-xml-parser.m4 \ $(top_srcdir)/macros/neon.m4 $(top_srcdir)/macros/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) 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) 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@ EMACS = @EMACS@ 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@ KERNINCLUDE = @KERNINCLUDE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEONLIBS = @NEONLIBS@ NEONOBJS = @NEONOBJS@ NEON_BUILD_BUNDLED = @NEON_BUILD_BUNDLED@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ NEON_OBJEXT = @NEON_OBJEXT@ NEON_TARGET = @NEON_TARGET@ 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@ PRELOAD_LIBS = @PRELOAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ XML_CONFIG = @XML_CONFIG@ 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@ avfscoda_build = @avfscoda_build@ 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@ initstyle = @initstyle@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ kmoduledir = @kmoduledir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ preload_build = @preload_build@ profiledir = @profiledir@ program_transform_name = @program_transform_name@ psdir = @psdir@ rcdir = @rcdir@ rcscriptdir = @rcscriptdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ start_levels = @start_levels@ start_prio = @start_prio@ stop_levels = @stop_levels@ stop_prio = @stop_prio@ 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 .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(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: $(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 # 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.0.5/macros/neon-ssl.m40000644000175000017500000000370513102441254015527 0ustar michaelmichael# 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.0.5/macros/neon.m40000644000175000017500000002221513102441254014725 0ustar michaelmichael# 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.0.5/AUTHORS0000644000175000017500000000011313102441254013301 0ustar michaelmichaelMiklos Szeredi Ralf Hoffmann avfs-1.0.5/depcomp0000755000175000017500000005601613102441264013624 0ustar michaelmichael#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2013-05-30.07; # UTC # Copyright (C) 1999-2013 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 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-time-zone: "UTC" # time-stamp-end: "; # UTC" # End: avfs-1.0.5/preload/0000755000175000017500000000000013102441322013660 5ustar michaelmichaelavfs-1.0.5/preload/utils.c0000644000175000017500000000542013102441254015171 0ustar michaelmichael/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU LGPL. See the file COPYING.LIB. */ #include "utils.h" #include #include #include #define VDEV_SEP_CHAR '#' struct fileinfo __av_dtable[AVFS_DTABLE_SIZE]; char __av_cwd[PATHBUF_LEN]; pthread_mutex_t __av_cwdlock; int __av_virtcwd; static int path_valid_virtual(const char *path) { const char *s = path; while(*s == '/') s++; for(; *s != '\0'; s++) { if(*s == '/') return 0; if(*s == ':') return 1; } return 0; } int __av_path_local(const char *path) { if(strchr(path, VDEV_SEP_CHAR) == NULL) { if(strchr(path, ':') == NULL) return 1; else if(path_valid_virtual(path)) return 0; else return 1; } else return 0; } static int make_abs_path(const char *path, char *pathbuf) { unsigned int len; if(__av_cwd[0] == '\0') { if(getcwd(__av_cwd, PATHBUF_LEN) == NULL) return -errno; } len = strlen(__av_cwd) + 1 + strlen(path); if(len >= PATHBUF_LEN) return -ENAMETOOLONG; sprintf(pathbuf, "%s/%s", __av_cwd, path); return 0; } static int try_convert_path(const char *path, char *pathbuf) { const char *s; const char *prefixenv; if(strlen(path) + 32 > PATHBUF_LEN) return 0; for(s = path; *s != '\0'; s++) { if(*s == ':') break; if(!isalpha((int) *s) && !isdigit((int) *s) && *s != '-' && *s != '.') return 0; } if(s == path || *s == '\0' || (s[1] != '/' && s[1] != '\0')) return 0; prefixenv = getenv("AVFS_HOST_PREFIX"); if(prefixenv == NULL) prefixenv = "rsh:"; if(strlen(path) + strlen(prefixenv) + 32 > PATHBUF_LEN) return 0; sprintf(pathbuf, "/%c%s%.*s%s", VDEV_SEP_CHAR, prefixenv, s - path, path, s + 1); return 1; } int __av_get_abs_path(const char *path, char *pathbuf, const char **resp) { int res; if(path[0] == '/') { if(strchr(path, ':') != NULL) { const char *s; for(s = path; *s == '/'; s++); if(try_convert_path(s, pathbuf)) { *resp = pathbuf; return 0; } } *resp = path; return 0; } if(strchr(path, ':') != NULL) { if(try_convert_path(path, pathbuf)) { *resp = pathbuf; return 0; } } pthread_mutex_lock(&__av_cwdlock); res = make_abs_path(path, pathbuf); pthread_mutex_unlock(&__av_cwdlock); if(res == 0) *resp = pathbuf; return res; } avfs-1.0.5/preload/avfs_server.c0000644000175000017500000005211313102441254016357 0ustar michaelmichael/* 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 "server.h" #include "cmd.h" #include "send.h" #include "internal.h" #include "operutil.h" #include "oper.h" #include #include #include #include #include #include #define MULTITHREADED 1 #if MULTITHREADED #include #endif enum file_holder_state { FIH_DELETED = -1, FIH_UNUSED = 0, FIH_USED = 1, }; struct file_holder { enum file_holder_state state; int serverfh; }; static struct file_holder *file_holders; static unsigned int file_holder_num; static AV_LOCK_DECL(file_holder_lock); struct cmdinfo { int fd; struct avfs_in_message inmsg; struct avfs_cmd cmd; }; static void init_inmsg(struct avfs_in_message *inmsg) { int i; for(i = 1; i < MAXSEG; i++) inmsg->seg[i].buf = NULL; } static void free_inmsg(struct avfs_in_message *inmsg) { int i; for(i = 1; i < MAXSEG; i++) { if(inmsg->seg[i].buf) free(inmsg->seg[i].buf); } } static int entry_local(ventry *ve) { if(ve->mnt->base == NULL) return 1; else return 0; } static int getattr_entry(ventry *ve, struct avstat *stbuf, 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, stbuf, attrmask); av_file_close(&vf); } return res; } static void send_error(int fd, int error) { int res; struct avfs_out_message outmsg; struct avfs_result result; outmsg.num = 1; outmsg.seg[0].len = sizeof(result); outmsg.seg[0].buf = &result; result.result = error; res = __av_write_message(fd, &outmsg); if(res == -1) av_log(AVLOG_ERROR, "Error sending message\n"); } static int do_readdir(int fd, struct avfs_direntry *de, char *name) { int res; struct avdirent buf; avoff_t n; res = av_fd_readdir(fd, &buf, &n); if(res > 0) { de->ino = buf.ino; de->type = buf.type; de->n = n; strncpy(name, buf.name, NAME_MAX); name[NAME_MAX] = '\0'; av_free(buf.name); } return res; } static void process_getattr(struct cmdinfo *ci) { int res; char *path = ci->inmsg.seg[1].buf; int flags = ci->cmd.u.getattr.flags; int attrmask = ci->cmd.u.getattr.attrmask; struct avstat stbuf; ventry *ve; struct avfs_out_message outmsg; struct avfs_result result; av_log(AVLOG_SYSCALL, "getattr(\"%s\", 0%o, 0%o)", path, flags, attrmask); outmsg.num = 3; outmsg.seg[0].len = sizeof(result); outmsg.seg[0].buf = &result; outmsg.seg[1].len = 0; outmsg.seg[2].len = 0; res = av_get_ventry(path, !(flags & AVO_NOFOLLOW), &ve); if(res < 0) result.result = res; else { if(entry_local(ve)) { result.result = -EPERM; outmsg.seg[1].buf = (char *) ve->data; outmsg.seg[1].len = strlen(outmsg.seg[1].buf) + 1; if(outmsg.seg[1].len > PATHBUF_LEN) { outmsg.seg[1].len = 0; result.result = -ENAMETOOLONG; } } else { res = getattr_entry(ve, &stbuf, attrmask, flags); result.result = res; if(res == 0) { outmsg.seg[2].buf = &stbuf; outmsg.seg[2].len = sizeof(stbuf); } } } av_log(AVLOG_SYSCALL, " getattr(\"%s\", 0%o, 0%o) = %i (%s)", path, flags, attrmask, result.result, outmsg.seg[1].len ? (char *) ve->data : ""); res = __av_write_message(ci->fd, &outmsg); if(res == -1) av_log(AVLOG_ERROR, "Error sending message\n"); av_free_ventry(ve); } static void register_holder(int holderfd, int serverfh) { int needclose = 0; int state; AV_LOCK(file_holder_lock); state = file_holders[holderfd].state; av_log(AVLOG_DEBUG, "register_holder: %i, state: %i/%i, serverfh: %i", holderfd, state, file_holders[holderfd].serverfh, serverfh); if(state == FIH_USED) { if(serverfh < 0) file_holders[holderfd].state = FIH_UNUSED; else file_holders[holderfd].serverfh = serverfh; } else { if(serverfh >= 0) needclose = 1; file_holders[holderfd].state = FIH_UNUSED; close(holderfd); } AV_UNLOCK(file_holder_lock); if(needclose) av_fd_close(serverfh); } static void process_open(struct cmdinfo *ci) { int res; char *path = ci->inmsg.seg[1].buf; int flags = ci->cmd.u.open.flags; mode_t mode = ci->cmd.u.open.mode; ventry *ve; struct avfs_out_message outmsg; struct avfs_result result; av_log(AVLOG_SYSCALL, "open(\"%s\", 0%o, 0%lo)", path, flags, (unsigned long) mode); outmsg.num = 2; outmsg.seg[0].len = sizeof(result); outmsg.seg[0].buf = &result; outmsg.seg[1].len = 0; res = av_get_ventry(path, 1, &ve); if(res < 0) result.result = res; else { if(entry_local(ve)) { result.result = -EPERM; outmsg.seg[1].buf = (char *) ve->data; outmsg.seg[1].len = strlen(outmsg.seg[1].buf) + 1; if(outmsg.seg[1].len > PATHBUF_LEN) { outmsg.seg[1].len = 0; result.result = -ENAMETOOLONG; } } else { struct avstat stbuf; res = getattr_entry(ve, &stbuf, AVA_MODE, 0); if(res == 0) { if(AV_ISDIR(stbuf.mode)) res = av_fd_open_entry(ve, flags | AVO_DIRECTORY, mode); else res = av_fd_open_entry(ve, flags, mode); } else if(res == -ENOENT && (flags & AVO_CREAT) != 0) res = av_fd_open_entry(ve, flags, mode); result.result = res; } } av_log(AVLOG_SYSCALL, " open(\"%s\", 0%o, 0%lo) = %i (%s)", path, flags, (unsigned long) mode, result.result, outmsg.seg[1].len ? (char *) ve->data : ""); register_holder(ci->fd, result.result); res = __av_write_message(ci->fd, &outmsg); if(res == -1) av_log(AVLOG_ERROR, "Error sending message\n"); av_free_ventry(ve); } static void process_close(struct cmdinfo *ci) { int res; int fh = ci->cmd.u.fdops.serverfh; struct avfs_out_message outmsg; struct avfs_result result; av_log(AVLOG_SYSCALL, "close(%i)", fh); outmsg.num = 1; outmsg.seg[0].len = sizeof(result); outmsg.seg[0].buf = &result; result.result = av_fd_close(fh); av_log(AVLOG_SYSCALL, " close(%i) = %i", fh, result.result); res = __av_write_message(ci->fd, &outmsg); if(res == -1) av_log(AVLOG_ERROR, "Error sending message\n"); } static void process_fstat(struct cmdinfo *ci) { int res; int fh = ci->cmd.u.fdops.serverfh; struct avfs_out_message outmsg; struct avfs_result result; struct avstat stbuf; av_log(AVLOG_SYSCALL, "fstat(%i)", fh); outmsg.num = 2; outmsg.seg[0].len = sizeof(result); outmsg.seg[0].buf = &result; outmsg.seg[1].len = 0; result.result = av_fd_getattr(fh, &stbuf, AVA_ALL); if(result.result == 0) { outmsg.seg[1].len = sizeof(stbuf); outmsg.seg[1].buf = &stbuf; } av_log(AVLOG_SYSCALL, " fstat(%i) = %i", fh, result.result); res = __av_write_message(ci->fd, &outmsg); if(res == -1) av_log(AVLOG_ERROR, "Error sending message\n"); } static void process_readdir(struct cmdinfo *ci) { int res; int fh = ci->cmd.u.fdops.serverfh; struct avfs_out_message outmsg; struct avfs_result result; char name[NAME_MAX + 1]; struct avfs_direntry de; av_log(AVLOG_SYSCALL, "readdir(%i, ...)", fh); outmsg.num = 3; outmsg.seg[0].len = sizeof(result); outmsg.seg[0].buf = &result; outmsg.seg[1].len = 0; outmsg.seg[2].len = 0; result.result = do_readdir(fh, &de, name); if(result.result > 0) { outmsg.seg[1].len = sizeof(de); outmsg.seg[1].buf = &de; outmsg.seg[2].len = strlen(name) + 1; outmsg.seg[2].buf = name; } av_log(AVLOG_SYSCALL, " readdir(%i, {%s, %lli, %i}) = %i", fh, result.result > 0 ? name : "", de.ino, de.n, result.result); res = __av_write_message(ci->fd, &outmsg); if(res == -1) av_log(AVLOG_ERROR, "Error sending message\n"); } static void process_lseek(struct cmdinfo *ci) { int res; int fh = ci->cmd.u.lseek.serverfh; avoff_t offset = ci->cmd.u.lseek.offset; int whence = ci->cmd.u.lseek.whence; struct avfs_out_message outmsg; struct avfs_result result; av_log(AVLOG_SYSCALL, "lseek(%i, %lli, %i)", fh, offset, whence); outmsg.num = 1; outmsg.seg[0].len = sizeof(result); outmsg.seg[0].buf = &result; result.u.lseek.offset = av_fd_lseek(fh, offset, whence); av_log(AVLOG_SYSCALL, " lseek(%i, %lli, %i) == %lli", fh, offset, whence, result.u.lseek.offset); res = __av_write_message(ci->fd, &outmsg); if(res == -1) av_log(AVLOG_ERROR, "Error sending message\n"); } static void process_read(struct cmdinfo *ci) { int res; int fh = ci->cmd.u.readwrite.serverfh; avsize_t nbyte = ci->cmd.u.readwrite.nbyte; struct avfs_out_message outmsg; struct avfs_result result; void *buf; outmsg.num = 2; outmsg.seg[0].len = sizeof(result); outmsg.seg[0].buf = &result; outmsg.seg[1].len = 0; buf = av_malloc(nbyte); result.result = av_fd_read(fh, buf, nbyte); if(result.result > 0) { outmsg.seg[1].len = result.result; outmsg.seg[1].buf = buf; } res = __av_write_message(ci->fd, &outmsg); if(res == -1) av_log(AVLOG_ERROR, "Error sending message\n"); av_free(buf); } static void process_write(struct cmdinfo *ci) { int res; int fh = ci->cmd.u.readwrite.serverfh; avsize_t nbyte = ci->cmd.u.readwrite.nbyte; struct avfs_out_message outmsg; struct avfs_result result; const void *buf = ci->inmsg.seg[1].buf; av_log(AVLOG_SYSCALL, "write(%i, ..., %u)", fh, nbyte); outmsg.num = 1; outmsg.seg[0].len = sizeof(result); outmsg.seg[0].buf = &result; result.result = av_fd_write(fh, buf, nbyte); av_log(AVLOG_SYSCALL, " write(%i, ..., %u) = %i", fh, nbyte, result.result); res = __av_write_message(ci->fd, &outmsg); if(res == -1) av_log(AVLOG_ERROR, "Error sending message\n"); } static void process_resolve(struct cmdinfo *ci) { int res; char *path = ci->inmsg.seg[1].buf; ventry *ve; struct avfs_out_message outmsg; struct avfs_result result; char *newpath = NULL; av_log(AVLOG_SYSCALL, "resolve(\"%s\")", path); outmsg.num = 2; outmsg.seg[0].len = sizeof(result); outmsg.seg[0].buf = &result; outmsg.seg[1].len = 0; res = av_get_ventry(path, 1, &ve); if(res < 0) result.result = res; else { if(entry_local(ve)) result.u.resolve.isvirtual = 0; else result.u.resolve.isvirtual = 1; res = av_generate_path(ve, &newpath); result.result = res; if(res == 0) { outmsg.seg[1].buf = newpath; outmsg.seg[1].len = strlen(outmsg.seg[1].buf) + 1; if(outmsg.seg[1].len > PATHBUF_LEN) { outmsg.seg[1].len = 0; result.result = -ENAMETOOLONG; } } av_free_ventry(ve); } av_log(AVLOG_SYSCALL, " resolve(\"%s\", \"%s\", %i) = %i", path, outmsg.seg[1].len ? newpath : "", result.u.resolve.isvirtual, result.result); res = __av_write_message(ci->fd, &outmsg); if(res == -1) av_log(AVLOG_ERROR, "Error sending message\n"); av_free(newpath); } static void process_readlink(struct cmdinfo *ci) { int res; char *path = ci->inmsg.seg[1].buf; avsize_t bufsize = ci->cmd.u.readlink.bufsize; char *buf = NULL; ventry *ve; struct avfs_out_message outmsg; struct avfs_result result; av_log(AVLOG_SYSCALL, "readlink(\"%s\", ..., %u)", path, bufsize); outmsg.num = 3; outmsg.seg[0].len = sizeof(result); outmsg.seg[0].buf = &result; outmsg.seg[1].len = 0; outmsg.seg[2].len = 0; res = av_get_ventry(path, 0, &ve); if(res < 0) result.result = res; else { if(entry_local(ve)) { result.result = -EPERM; outmsg.seg[1].buf = (char *) ve->data; outmsg.seg[1].len = strlen(outmsg.seg[1].buf) + 1; if(outmsg.seg[1].len > PATHBUF_LEN) { outmsg.seg[1].len = 0; result.result = -ENAMETOOLONG; } } else { res = av_readlink(ve, &buf); if(res == 0) { avsize_t linklen = strlen(buf); result.result = AV_MIN(linklen, bufsize); outmsg.seg[2].len = AV_MIN(linklen + 1, bufsize); outmsg.seg[2].buf = buf; } else result.result = res; } } av_log(AVLOG_SYSCALL, " readlink(\"%s\", \"%.*s\", %i) = %i (%s)", path, result.result < 0 ? 0 : result.result, buf == NULL ? "" : buf, bufsize, result.result, outmsg.seg[1].len ? (char *) ve->data : ""); res = __av_write_message(ci->fd, &outmsg); if(res == -1) av_log(AVLOG_ERROR, "Error sending message\n"); av_free_ventry(ve); av_free(buf); } static void process_access(struct cmdinfo *ci) { int res; char *path = ci->inmsg.seg[1].buf; int amode = ci->cmd.u.access.amode; ventry *ve; struct avfs_out_message outmsg; struct avfs_result result; av_log(AVLOG_SYSCALL, "access(\"%s\", 0%o)", path, amode); outmsg.num = 2; outmsg.seg[0].len = sizeof(result); outmsg.seg[0].buf = &result; outmsg.seg[1].len = 0; res = av_get_ventry(path, 1, &ve); if(res < 0) result.result = res; else { if(entry_local(ve)) { result.result = -EPERM; outmsg.seg[1].buf = (char *) ve->data; outmsg.seg[1].len = strlen(outmsg.seg[1].buf) + 1; if(outmsg.seg[1].len > PATHBUF_LEN) { outmsg.seg[1].len = 0; result.result = -ENAMETOOLONG; } } else result.result = av_access(ve, amode); } av_log(AVLOG_SYSCALL, " access(\"%s\", 0%o) = %i (%s)", path, amode, result.result, outmsg.seg[1].len ? (char *) ve->data : ""); res = __av_write_message(ci->fd, &outmsg); if(res == -1) av_log(AVLOG_ERROR, "Error sending message\n"); av_free_ventry(ve); } static void *process_message(void *arg) { struct cmdinfo *ci = (struct cmdinfo *) arg; switch(ci->cmd.type) { case CMD_GETATTR: process_getattr(ci); break; case CMD_OPEN: process_open(ci); break; case CMD_CLOSE: process_close(ci); break; case CMD_FSTAT: process_fstat(ci); break; case CMD_READDIR: process_readdir(ci); break; case CMD_LSEEK: process_lseek(ci); break; case CMD_READ: process_read(ci); break; case CMD_WRITE: process_write(ci); break; case CMD_RESOLVE: process_resolve(ci); break; case CMD_READLINK: process_readlink(ci); break; case CMD_ACCESS: process_access(ci); break; default: av_log(AVLOG_ERROR, "Unknown command: %i", ci->cmd.type); send_error(ci->fd, -ENOSYS); } if(ci->cmd.type != CMD_OPEN) close(ci->fd); free_inmsg(&ci->inmsg); av_free(ci); return NULL; } static void mark_file_holder(int holderfd) { AV_LOCK(file_holder_lock); if(holderfd >= file_holder_num) { int i; unsigned int newnum = holderfd + 1; unsigned int newsize = newnum * sizeof(struct file_holder); file_holders = realloc(file_holders, newsize); assert(file_holders != NULL); for(i = file_holder_num; i <= holderfd; i++) file_holders[i].state = FIH_UNUSED; file_holder_num = newnum; } if(file_holders[holderfd].state != FIH_UNUSED) av_log(AVLOG_ERROR, "Internal Error: file holder %i already used", holderfd); file_holders[holderfd].state = FIH_USED; file_holders[holderfd].serverfh = -1; AV_UNLOCK(file_holder_lock); } static void unmark_file_holder(int serverfh) { int i; AV_LOCK(file_holder_lock); for(i = 0; i < file_holder_num; i++) { if(file_holders[i].state == FIH_USED && file_holders[i].serverfh == serverfh) { file_holders[i].state = FIH_UNUSED; close(i); break; } } if(i == file_holder_num) av_log(AVLOG_DEBUG, "File holder not found for %i", serverfh); AV_UNLOCK(file_holder_lock); } static int wait_message(int sock) { int i; int nfds; struct pollfd *fds; int canaccept; int res; while(1) { AV_LOCK(file_holder_lock); nfds = 1; for(i = 0; i < file_holder_num; i++) { if(file_holders[i].state == FIH_USED) nfds++; } /* This is not av_malloc(), because exit will usually happen during poll(), and then there would be one unfreed memory. */ fds = malloc(sizeof(struct pollfd) * nfds); nfds = 1; for(i = 0; i < file_holder_num; i++) { if(file_holders[i].state == FIH_USED) { fds[nfds].fd = i; fds[nfds].events = POLLIN; nfds++; } } AV_UNLOCK(file_holder_lock); fds[0].fd = sock; fds[0].events = POLLIN; do res = poll(fds, nfds, -1); while(res == -1 && (errno == EAGAIN || errno == EINTR)); if(res == -1) { av_log(AVLOG_ERROR, "poll(): %s", strerror(errno)); exit(1); } for(i = 1; i < nfds; i++) { if(fds[i].revents != 0) { int holderfd = fds[i].fd; int serverfh; AV_LOCK(file_holder_lock); serverfh = file_holders[holderfd].serverfh; { char c; av_log(AVLOG_DEBUG, "File holder closed: %i", holderfd); av_log(AVLOG_DEBUG, "serverfh: %i", serverfh); av_log(AVLOG_DEBUG, "state: %i", file_holders[holderfd].state); av_log(AVLOG_DEBUG, "revents: 0%o", fds[i].revents); res = read(holderfd, &c, 1); av_log(AVLOG_DEBUG, "read: %i, (%i)", res, c); } if(file_holders[holderfd].state == FIH_USED) { if(serverfh == -1) file_holders[holderfd].state = FIH_DELETED; else { close(holderfd); file_holders[holderfd].state = FIH_UNUSED; } } else close(holderfd); AV_UNLOCK(file_holder_lock); av_log(AVLOG_DEBUG, "File holder for %i closed", serverfh); if(serverfh != -1) av_fd_close(serverfh); } } canaccept = fds[0].revents; free(fds); if(canaccept) { int fd; fd = accept(sock, NULL, NULL); if(fd == -1) { av_log(AVLOG_ERROR, "accept(): %s", strerror(errno)); exit(1); } return fd; } } } int main() { int sock; #if MULTITHREADED pthread_attr_t attr; pthread_t thrid; pthread_attr_init(&attr); pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); #endif sock = server_init(); while(1) { int fd; int res; struct cmdinfo *ci; fd = wait_message(sock); AV_NEW(ci); init_inmsg(&ci->inmsg); ci->inmsg.seg[0].buf = &ci->cmd; res = __av_read_message(fd, &ci->inmsg); if(res == -1) av_log(AVLOG_ERROR, "Error reading message"); else { ci->fd = fd; if(ci->cmd.type == CMD_OPEN) mark_file_holder(ci->fd); else if(ci->cmd.type == CMD_CLOSE) unmark_file_holder(ci->cmd.u.fdops.serverfh); #if MULTITHREADED res = pthread_create(&thrid, &attr, process_message, ci); if(res != 0) av_log(AVLOG_ERROR, "Error creating thread: %i", res); #else process_message(ci); #endif } } return 0; } avfs-1.0.5/preload/send.h0000644000175000017500000000140313102441254014764 0ustar michaelmichael/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed either under the terms of the GNU GPL or under the terms of the GNU LGPL. See the files COPYING and COPYING.LIB. */ #define MAXSEG 10 struct avfs_out_message_segment { unsigned int len; const void *buf; }; struct avfs_out_message { unsigned int num; struct avfs_out_message_segment seg[MAXSEG]; }; struct avfs_in_message_segment { unsigned int len; void *buf; }; struct avfs_in_message { unsigned int num; struct avfs_in_message_segment seg[MAXSEG]; }; int __av_read_message(int sock, struct avfs_in_message *msg); int __av_write_message(int sock, struct avfs_out_message *msg); avfs-1.0.5/preload/Makefile.am0000644000175000017500000000142013102441254015715 0ustar michaelmichaelAM_CFLAGS = -I$(top_srcdir)/include @CFLAGS@ @CPPFLAGS@ \ -DAVFS_SERVER_DIR=\"@moduledir@\" EXTRA_DIST = leak.c leakcheck LIBS = noinst_HEADERS = \ client.h \ cmd.h \ send.h \ server.h \ utils.h if INSTALL_PRELOAD lib_LTLIBRARIES = avfs_preload.la avfs_preload_la_LDFLAGS = -module avfs_preload_la_LIBADD = @PRELOAD_LIBS@ avfs_preload_la_SOURCES = \ client.c \ utils.c \ send.c \ file.c \ open.c \ stat.c \ misc.c server_PROGRAMS = avfs_server serverdir = @moduledir@ avfs_server_LDFLAGS = @LDFLAGS@ @LIBS@ avfs_server_DEPENDENCIES = send.lo avfs_server_LDADD = ../lib/libavfs_static.la send.lo @LIBS@ avfs_server_SOURCES = \ avfs_server.c \ server.c #avfs_server_SOURCES = \ # avfs_server.c \ # server.c \ # leak.c endif avfs-1.0.5/preload/utils.h0000644000175000017500000000300513102441254015173 0ustar michaelmichael/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU LGPL. See the file COPYING.LIB. */ #define _GNU_SOURCE /* necessary to get definition of RTLD_NEXT */ #include "cmd.h" #include "client.h" #include #include #define AVFS_DTABLE_SIZE 1024 struct fileinfo { int isvirtual; int serverfh; int holderfd; }; extern struct fileinfo __av_dtable[AVFS_DTABLE_SIZE]; extern char __av_cwd[PATHBUF_LEN]; extern pthread_mutex_t __av_cwdlock; extern int __av_virtcwd; #define ISVIRTUAL(fd) (__av_dtable[fd].isvirtual) #define FD_OK(fd) ((fd) >= 0 && (fd) < AVFS_DTABLE_SIZE) #define SERVERFH(fd) (__av_dtable[fd].serverfh) int __av_get_abs_path(const char *path, char *pathbuf, const char **resp); int __av_path_local(const char *path); static inline void *__av_get_real(const char *name) { void *res; int errnosave = errno; res = dlsym(RTLD_NEXT, name); errno = errnosave; return res; } static inline int __av_maybe_local(const char *path) { int isvirtual; pthread_mutex_lock(&__av_cwdlock); isvirtual = __av_virtcwd; pthread_mutex_unlock(&__av_cwdlock); if(!isvirtual || path == NULL || path[0] == '/') return 1; else return 0; } static inline int __av_is_local(int res, const char *path) { if(res != -1 || errno != ENOENT || __av_path_local(path)) return 1; else return 0; } avfs-1.0.5/preload/stat.c0000644000175000017500000003505513102441254015013 0ustar michaelmichael/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU LGPL. See the file COPYING.LIB. */ #include "utils.h" #include "config.h" #include #ifdef HAVE_ACL #include #endif #ifdef HAVE_STAT64 static int real_stat64(const char *path, struct stat64 *buf, int deref, int undersc) { if(!deref) { if(undersc == 0) { static int (*prev)(const char *, struct stat64 *); if(!prev) prev = (int (*)(const char *, struct stat64 *)) __av_get_real("lstat64"); return prev(path, buf); } else { static int (*prev)(const char *, struct stat64 *); if(!prev) prev = (int (*)(const char *, struct stat64 *)) __av_get_real("_lstat64"); return prev(path, buf); } } else { if(undersc == 0) { static int (*prev)(const char *, struct stat64 *); if(!prev) prev = (int (*)(const char *, struct stat64 *)) __av_get_real("stat64"); return prev(path, buf); } else { static int (*prev)(const char *, struct stat64 *); if(!prev) prev = (int (*)(const char *, struct stat64 *)) __av_get_real("_stat64"); return prev(path, buf); } } } static int real_fstat64(int fd, struct stat64 *buf, int undersc) { if(undersc == 0) { static int (*prev)(int, struct stat64 *); if(!prev) prev = (int (*)(int, struct stat64 *)) __av_get_real("fstat64"); return prev(fd, buf); } else { static int (*prev)(int, struct stat64 *); if(!prev) prev = (int (*)(int, struct stat64 *)) __av_get_real("_fstat64"); return prev(fd, buf); } } #endif static int real_stat(const char *path, struct stat *buf, int deref, int undersc) { if(!deref) { if(undersc == 0) { static int (*prev)(const char *, struct stat *); if(!prev) prev = (int (*)(const char *, struct stat *)) __av_get_real("lstat"); return prev(path, buf); } else { static int (*prev)(const char *, struct stat *); if(!prev) prev = (int (*)(const char *, struct stat *)) __av_get_real("_lstat"); return prev(path, buf); } } else { if(undersc == 0) { static int (*prev)(const char *, struct stat *); if(!prev) prev = (int (*)(const char *, struct stat *)) __av_get_real("stat"); return prev(path, buf); } else { static int (*prev)(const char *, struct stat *); if(!prev) prev = (int (*)(const char *, struct stat *)) __av_get_real("_stat"); return prev(path, buf); } } } static int real_fstat(int fd, struct stat *buf, int undersc) { if(undersc == 0) { static int (*prev)(int, struct stat *); if(!prev) prev = (int (*)(int, struct stat *)) __av_get_real("fstat"); return prev(fd, buf); } else { static int (*prev)(int, struct stat *); if(!prev) prev = (int (*)(int, struct stat *)) __av_get_real("_fstat"); return prev(fd, buf); } } #ifdef HAVE_ACL static int real_acl(const char *path, int cmd, int nent, aclent_t *aclbuf, int undersc) { if(undersc == 0) { static int (*prev)(const char *, int, int, aclent_t *); if(!prev) prev = (int (*)(const char *, int, int, aclent_t *)) __av_get_real("acl"); return prev(path, cmd, nent, aclbuf); } else { static int (*prev)(const char *, int, int, aclent_t *); if(!prev) prev = (int (*)(const char *, int, int, aclent_t *)) __av_get_real("_acl"); return prev(path, cmd, nent, aclbuf); } } #endif static int real_access(const char *path, int amode, int undersc) { if(undersc == 0) { static int (*prev)(const char *, int); if(!prev) prev = (int (*)(const char *, int)) __av_get_real("access"); return prev(path, amode); } else { static int (*prev)(const char *, int); if(!prev) prev = (int (*)(const char *, int)) __av_get_real("_access"); return prev(path, amode); } } static int cmd_getattr(const char *path, struct avstat *buf, int deref, char *pathbuf, int attrmask) { int res; struct avfs_out_message outmsg; struct avfs_in_message inmsg; struct avfs_cmd cmd; struct avfs_result result; const char *abspath; res = __av_get_abs_path(path, pathbuf, &abspath); if(res < 0) return res; cmd.type = CMD_GETATTR; if(deref) cmd.u.getattr.flags = 0; else cmd.u.getattr.flags = AVO_NOFOLLOW; cmd.u.getattr.attrmask = attrmask; outmsg.num = 2; outmsg.seg[0].len = sizeof(cmd); outmsg.seg[0].buf = &cmd; outmsg.seg[1].len = strlen(abspath) + 1; outmsg.seg[1].buf = abspath; inmsg.seg[0].buf = &result; inmsg.seg[1].buf = pathbuf; inmsg.seg[2].buf = buf; res = __av_send_message(&outmsg, &inmsg, 0); if(res == -1) return -EIO; if(inmsg.seg[1].len == 0) pathbuf[0] = '\0'; return result.result; } static int cmd_access(const char *path, int amode, char *pathbuf) { int res; struct avfs_out_message outmsg; struct avfs_in_message inmsg; struct avfs_cmd cmd; struct avfs_result result; const char *abspath; res = __av_get_abs_path(path, pathbuf, &abspath); if(res < 0) return res; cmd.type = CMD_ACCESS; cmd.u.access.amode = amode; outmsg.num = 2; outmsg.seg[0].len = sizeof(cmd); outmsg.seg[0].buf = &cmd; outmsg.seg[1].len = strlen(abspath) + 1; outmsg.seg[1].buf = abspath; inmsg.seg[0].buf = &result; inmsg.seg[1].buf = pathbuf; res = __av_send_message(&outmsg, &inmsg, 0); if(res == -1) return -EIO; if(inmsg.seg[1].len == 0) pathbuf[0] = '\0'; return result.result; } static int fstat_server(int serverfh, struct avstat *buf) { int res; struct avfs_out_message outmsg; struct avfs_in_message inmsg; struct avfs_cmd cmd; struct avfs_result result; cmd.type = CMD_FSTAT; cmd.u.fdops.serverfh = serverfh; outmsg.num = 1; outmsg.seg[0].len = sizeof(cmd); outmsg.seg[0].buf = &cmd; inmsg.seg[0].buf = &result; inmsg.seg[1].buf = buf; res = __av_send_message(&outmsg, &inmsg, 0); if(res == -1) return -EIO; return result.result; } #ifdef HAVE_STAT64 static void convert_stat64(struct avstat *vbuf, struct stat64 *lbuf) { memset((void *) lbuf, 0, sizeof(*lbuf)); lbuf->st_dev = vbuf->dev; lbuf->st_ino = vbuf->ino; lbuf->st_mode = vbuf->mode; lbuf->st_nlink = vbuf->nlink; lbuf->st_uid = vbuf->uid; lbuf->st_gid = vbuf->gid; lbuf->st_rdev = vbuf->rdev; lbuf->st_size = vbuf->size; lbuf->st_blksize = vbuf->blksize; lbuf->st_blocks = vbuf->blocks; lbuf->st_atime = vbuf->atime.sec; lbuf->st_mtime = vbuf->mtime.sec; lbuf->st_ctime = vbuf->ctime.sec; } static int virt_stat64(const char *path, struct stat64 *buf, int deref, int undersc) { int res = 0; int local = 0; if(__av_maybe_local(path)) { res = real_stat64(path, buf, deref, undersc); local = __av_is_local(res, path); } if(!local) { int errnosave; struct avstat vbuf; char pathbuf[PATHBUF_LEN]; errnosave = errno; res = cmd_getattr(path, &vbuf, deref, pathbuf, AVA_ALL); errno = errnosave; if(pathbuf[0]) res = real_stat64(pathbuf, buf, deref, undersc); else if(res < 0) errno = -res, res = -1; else convert_stat64(&vbuf, buf); } return res; } static int virt_fstat64(int fd, struct stat64 *buf, int undersc) { int res; if(!FD_OK(fd) || !ISVIRTUAL(fd)) res = real_fstat64(fd, buf, undersc); else { struct avstat vbuf; int errnosave = errno; res = fstat_server(SERVERFH(fd), &vbuf); if(res < 0) errno = -res, res = -1; else { errno = errnosave; convert_stat64(&vbuf, buf); } } return res; } #endif static void convert_stat(struct avstat *vbuf, struct stat *lbuf) { memset((void *) lbuf, 0, sizeof(*lbuf)); lbuf->st_dev = vbuf->dev; lbuf->st_ino = vbuf->ino; lbuf->st_mode = vbuf->mode; lbuf->st_nlink = vbuf->nlink; lbuf->st_uid = vbuf->uid; lbuf->st_gid = vbuf->gid; lbuf->st_rdev = vbuf->rdev; lbuf->st_size = vbuf->size; lbuf->st_blksize = vbuf->blksize; lbuf->st_blocks = vbuf->blocks; lbuf->st_atime = vbuf->atime.sec; lbuf->st_mtime = vbuf->mtime.sec; lbuf->st_ctime = vbuf->ctime.sec; } static int virt_stat(const char *path, struct stat *buf, int deref, int undersc) { int res = 0; int local = 0; if(__av_maybe_local(path)) { res = real_stat(path, buf, deref, undersc); local = __av_is_local(res, path); } if(!local) { int errnosave; struct avstat vbuf; char pathbuf[PATHBUF_LEN]; errnosave = errno; res = cmd_getattr(path, &vbuf, deref, pathbuf, AVA_ALL); errno = errnosave; if(pathbuf[0]) res = real_stat(pathbuf, buf, deref, undersc); else if(res < 0) errno = -res, res = -1; else convert_stat(&vbuf, buf); } return res; } static int virt_fstat(int fd, struct stat *buf, int undersc) { int res; if(!FD_OK(fd) || !ISVIRTUAL(fd)) res = real_fstat(fd, buf, undersc); else { struct avstat vbuf; int errnosave = errno; res = fstat_server(SERVERFH(fd), &vbuf); if(res < 0) errno = -res, res = -1; else { errno = errnosave; convert_stat(&vbuf, buf); } } return res; } #ifdef HAVE_ACL static int convert_acl(struct avstat *vbuf, int cmd, int nent, aclent_t *aclbuf) { int res; switch(cmd) { case GETACLCNT: res = 4; break; case SETACL: errno = ENOSYS; res = -1; break; case GETACL: if(nent < 4) { errno = ENOSPC; res = -1; } else { aclbuf[0].a_type = USER_OBJ; aclbuf[0].a_id = vbuf->uid; aclbuf[0].a_perm = (vbuf->mode & 0700) >> 6; aclbuf[1].a_type = GROUP_OBJ; aclbuf[1].a_id = vbuf->gid; aclbuf[1].a_perm = (vbuf->mode & 0070) >> 3; aclbuf[2].a_type = CLASS_OBJ; aclbuf[2].a_id = -1; aclbuf[2].a_perm = 0777; aclbuf[3].a_type = OTHER_OBJ; aclbuf[3].a_id = -1; aclbuf[3].a_perm = (vbuf->mode & 0007); res = 4; } break; default: errno = EINVAL; res = -1; break; } return res; } static int virt_acl(const char *path, int cmd, int nent, aclent_t *aclbuf, int undersc) { int res = 0; int local = 0; if(__av_maybe_local(path)) { res = real_acl(path, cmd, nent, aclbuf, undersc); local = __av_is_local(res, path); } if(!local) { int errnosave; struct avstat vbuf; char pathbuf[PATHBUF_LEN]; int attrmask = AVA_UID | AVA_GID | AVA_MODE; errnosave = errno; res = cmd_getattr(path, &vbuf, 1, pathbuf, attrmask); errno = errnosave; if(pathbuf[0]) res = real_acl(pathbuf, cmd, nent, aclbuf, undersc); else if(res < 0) errno = -res, res = -1; else res = convert_acl(&vbuf, cmd, nent, aclbuf); } return res; } #endif static int virt_access(const char *path, int amode, int undersc) { int res = 0; int local = 0; if(__av_maybe_local(path)) { res = real_access(path, amode, undersc); local = __av_is_local(res, path); } if(!local) { int errnosave; char pathbuf[PATHBUF_LEN]; errnosave = errno; res = cmd_access(path, amode, pathbuf); errno = errnosave; if(pathbuf[0]) res = real_access(pathbuf, amode, undersc); else if(res < 0) errno = -res, res = -1; } return res; } #ifdef HAVE_STAT64 int lstat64(const char *path, struct stat64 *buf) { return virt_stat64(path, buf, 0, 0); } int _lstat64(const char *path, struct stat64 *buf) { return virt_stat64(path, buf, 0, 1); } int stat64(const char *path, struct stat64 *buf) { return virt_stat64(path, buf, 1, 0); } int _stat64(const char *path, struct stat64 *buf) { return virt_stat64(path, buf, 1, 1); } int fstat64(int fd, struct stat64 *buf) { return virt_fstat64(fd, buf, 0); } int _fstat64(int fd, struct stat64 *buf) { return virt_fstat64(fd, buf, 1); } #endif int lstat(const char *path, struct stat *buf) { return virt_stat(path, buf, 0, 0); } int _lstat(const char *path, struct stat *buf) { return virt_stat(path, buf, 0, 1); } int stat(const char *path, struct stat *buf) { return virt_stat(path, buf, 1, 0); } int _stat(const char *path, struct stat *buf) { return virt_stat(path, buf, 1, 1); } int fstat(int fd, struct stat *buf) { return virt_fstat(fd, buf, 0); } int _fstat(int fd, struct stat *buf) { return virt_fstat(fd, buf, 1); } #ifdef HAVE_ACL int acl(const char *path, int cmd, int nent, aclent_t *aclbuf) { return virt_acl(path, cmd, nent, aclbuf, 0); } int _acl(const char *path, int cmd, int nent, aclent_t *aclbuf) { return virt_acl(path, cmd, nent, aclbuf, 1); } #endif int access(const char *path, int amode) { return virt_access(path, amode, 0); } int _access(const char *path, int amode) { return virt_access(path, amode, 1); } avfs-1.0.5/preload/misc.c0000644000175000017500000001446713102441254014777 0ustar michaelmichael/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU LGPL. See the file COPYING.LIB. */ #include "utils.h" #include static int real_chdir(const char *path, int undersc) { if(undersc == 0) { static int (*prev)(const char *); if(!prev) prev = (int (*)(const char *)) __av_get_real("chdir"); return prev(path); } else { static int (*prev)(const char *); if(!prev) prev = (int (*)(const char *)) __av_get_real("_chdir"); return prev(path); } } static char *real_getcwd(char *buf, size_t size, int undersc) { if(undersc == 0) { static char *(*prev)(char *, size_t); if(!prev) prev = (char *(*)(char *, size_t)) __av_get_real("getcwd"); return prev(buf, size); } else { static char *(*prev)(char *, size_t); if(!prev) prev = (char *(*)(char *, size_t)) __av_get_real("_getcwd"); return prev(buf, size); } } static int real_readlink(const char *path, char *buf, size_t bufsiz, int undersc) { if(undersc == 0) { static int (*prev)(const char *, char *, size_t); if(!prev) prev = (int (*)(const char *, char *, size_t)) __av_get_real("readlink"); return prev(path, buf, bufsiz); } else { static int (*prev)(const char *, char *, size_t); if(!prev) prev = (int (*)(const char *, char *, size_t)) __av_get_real("_readlink"); return prev(path, buf, bufsiz); } } static int cmd_resolve(const char *path, char *pathbuf, int *isvirtualp) { int res; struct avfs_out_message outmsg; struct avfs_in_message inmsg; struct avfs_cmd cmd; struct avfs_result result; const char *abspath; res = __av_get_abs_path(path, pathbuf, &abspath); if(res < 0) return res; cmd.type = CMD_RESOLVE; outmsg.num = 2; outmsg.seg[0].len = sizeof(cmd); outmsg.seg[0].buf = &cmd; outmsg.seg[1].len = strlen(abspath) + 1; outmsg.seg[1].buf = abspath; inmsg.seg[0].buf = &result; inmsg.seg[1].buf = pathbuf; res = __av_send_message(&outmsg, &inmsg, 0); if(res == -1) return -EIO; *isvirtualp = result.u.resolve.isvirtual; return result.result; } static void set_avfs_cwd(const char *cwd, int isvirtual) { pthread_mutex_lock(&__av_cwdlock); strcpy(__av_cwd, cwd); __av_virtcwd = isvirtual; pthread_mutex_unlock(&__av_cwdlock); } static int virt_chdir(const char *path, int undersc) { int res = 0; int local = 0; if(__av_maybe_local(path)) { res = real_chdir(path, undersc); if(res == 0) set_avfs_cwd("", 0); local = __av_is_local(res, path); } if(!local) { int errnosave; char pathbuf[PATHBUF_LEN]; int isvirtual; errnosave = errno; res = cmd_resolve(path, pathbuf, &isvirtual); errno = errnosave; if(res < 0) errno = -res, res = -1; else if(!isvirtual) { res = real_chdir(pathbuf, undersc); if(res == 0) set_avfs_cwd("", 0); } else { res = real_chdir("/", undersc); if(res == 0) set_avfs_cwd(pathbuf, 1); } } return res; } static char *getcwd_virt(char *buf, size_t size) { if(size == 0) { errno = EINVAL; return NULL; } if(size < strlen(__av_cwd) + 1) { errno = ERANGE; return NULL; } if(buf == NULL) { buf = malloc(size); if(buf == NULL) return NULL; } strcpy(buf, __av_cwd); return buf; } static char *virt_getcwd(char *buf, size_t size, int undersc) { char *cwd; pthread_mutex_lock(&__av_cwdlock); if(!__av_virtcwd) { pthread_mutex_unlock(&__av_cwdlock); return real_getcwd(buf, size, undersc); } cwd = getcwd_virt(buf, size); pthread_mutex_unlock(&__av_cwdlock); return cwd; } static int cmd_readlink(const char *path, char *buf, size_t bufsiz, char *pathbuf) { int res; struct avfs_out_message outmsg; struct avfs_in_message inmsg; struct avfs_cmd cmd; struct avfs_result result; const char *abspath; res = __av_get_abs_path(path, pathbuf, &abspath); if(res < 0) return res; cmd.type = CMD_READLINK; cmd.u.readlink.bufsize = bufsiz; outmsg.num = 2; outmsg.seg[0].len = sizeof(cmd); outmsg.seg[0].buf = &cmd; outmsg.seg[1].len = strlen(abspath) + 1; outmsg.seg[1].buf = abspath; inmsg.seg[0].buf = &result; inmsg.seg[1].buf = pathbuf; inmsg.seg[2].buf = buf; res = __av_send_message(&outmsg, &inmsg, 0); if(res == -1) return -EIO; if(inmsg.seg[1].len == 0) pathbuf[0] = '\0'; return result.result; } static int virt_readlink(const char *path, char *buf, size_t bufsiz, int undersc) { int res = 0; int local = 0; if(__av_maybe_local(path)) { res = real_readlink(path, buf, bufsiz, undersc); local = __av_is_local(res, path); } if(!local) { int errnosave; char pathbuf[PATHBUF_LEN]; errnosave = errno; res = cmd_readlink(path, buf, bufsiz, pathbuf); errno = errnosave; if(pathbuf[0]) res = real_readlink(pathbuf, buf, bufsiz, undersc); else if(res < 0) errno = -res, res = -1; } return res; } int chdir(const char *path) { return virt_chdir(path, 0); } int _chdir(const char *path) { return virt_chdir(path, 1); } char *getcwd(char *buf, size_t size) { return virt_getcwd(buf, size, 0); } char *_getcwd(char *buf, size_t size) { return virt_getcwd(buf, size, 1); } int readlink(const char *path, char *buf, size_t bufsiz) { return virt_readlink(path, buf, bufsiz, 0); } int _readlink(const char *path, char *buf, size_t bufsiz) { return virt_readlink(path, buf, bufsiz, 1); } avfs-1.0.5/preload/file.c0000644000175000017500000002562713102441254014763 0ustar michaelmichael/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU LGPL. See the file COPYING.LIB. */ #include "utils.h" #include "config.h" #include #ifdef HAVE_LSEEK64 static off64_t real_lseek64(int fd, off64_t offset, int whence, int undersc) { if(undersc == 0) { static off64_t (*prev)(int, off64_t, int); if(!prev) prev = (off64_t (*)(int, off64_t, int)) __av_get_real("lseek64"); return prev(fd, offset, whence); } else { static off64_t (*prev)(int, off64_t, int); if(!prev) prev = (off64_t (*)(int, off64_t, int)) __av_get_real("_lseek64"); return prev(fd, offset, whence); } } #endif static off_t real_lseek(int fd, off_t offset, int whence, int undersc) { if(undersc == 0) { static off_t (*prev)(int, off_t, int); if(!prev) prev = (off_t (*)(int, off_t, int)) __av_get_real("lseek"); return prev(fd, offset, whence); } else { static off_t (*prev)(int, off_t, int); if(!prev) prev = (off_t (*)(int, off_t, int)) __av_get_real("_lseek"); return prev(fd, offset, whence); } } static ssize_t real_read(int fd, void *buf, size_t nbyte, int undersc) { if(undersc == 0) { static ssize_t (*prev)(int, void *, size_t); if(!prev) prev = (ssize_t (*)(int, void *, size_t)) __av_get_real("read"); return prev(fd, buf, nbyte); } else { static ssize_t (*prev)(int, void *, size_t); if(!prev) prev = (ssize_t (*)(int, void *, size_t)) __av_get_real("_read"); return prev(fd, buf, nbyte); } } static ssize_t real_write(int fd, const void *buf, size_t nbyte, int undersc) { if(undersc == 0) { static ssize_t (*prev)(int, const void *, size_t); if(!prev) prev = (ssize_t (*)(int, const void *, size_t)) __av_get_real("write"); return prev(fd, buf, nbyte); } else { static ssize_t (*prev)(int, const void *, size_t); if(!prev) prev = (ssize_t (*)(int, const void *, size_t)) __av_get_real("_write"); return prev(fd, buf, nbyte); } } #ifdef HAVE_GETDENTS64 static int real_getdents64(int fd, struct dirent64 *buf, size_t nbyte, int undersc) { if(undersc == 0) { static int (*prev)(int, struct dirent64 *, size_t); if(!prev) prev = (int (*)(int, struct dirent64 *, size_t)) __av_get_real("getdents64"); return prev(fd, buf, nbyte); } else { static int (*prev)(int, struct dirent64 *, size_t); if(!prev) prev = (int (*)(int, struct dirent64 *, size_t)) __av_get_real("_getdents64"); return prev(fd, buf, nbyte); } } #endif static int real_getdents(int fd, struct dirent *buf, size_t nbyte, int undersc) { if(undersc == 0) { static int (*prev)(int, struct dirent *, size_t); if(!prev) prev = (int (*)(int, struct dirent *, size_t)) __av_get_real("getdents"); return prev(fd, buf, nbyte); } else { static int (*prev)(int, struct dirent *, size_t); if(!prev) prev = (int (*)(int, struct dirent *, size_t)) __av_get_real("_getdents"); return prev(fd, buf, nbyte); } } static avoff_t cmd_lseek(int serverfh, avoff_t offset, int whence) { int res; struct avfs_out_message outmsg; struct avfs_in_message inmsg; struct avfs_cmd cmd; struct avfs_result result; cmd.type = CMD_LSEEK; cmd.u.lseek.serverfh = serverfh; cmd.u.lseek.offset = offset; cmd.u.lseek.whence = whence; outmsg.num = 1; outmsg.seg[0].len = sizeof(cmd); outmsg.seg[0].buf = &cmd; inmsg.seg[0].buf = &result; res = __av_send_message(&outmsg, &inmsg, 0); if(res == -1) return -EIO; return result.u.lseek.offset; } static ssize_t cmd_read(int serverfh, void *buf, size_t nbyte) { int res; struct avfs_out_message outmsg; struct avfs_in_message inmsg; struct avfs_cmd cmd; struct avfs_result result; cmd.type = CMD_READ; cmd.u.readwrite.serverfh = serverfh; cmd.u.readwrite.nbyte = nbyte; outmsg.num = 1; outmsg.seg[0].len = sizeof(cmd); outmsg.seg[0].buf = &cmd; inmsg.seg[0].buf = &result; inmsg.seg[1].buf = buf; res = __av_send_message(&outmsg, &inmsg, 0); if(res == -1) return -EIO; return result.result; } static ssize_t cmd_write(int serverfh, const void *buf, size_t nbyte) { int res; struct avfs_out_message outmsg; struct avfs_in_message inmsg; struct avfs_cmd cmd; struct avfs_result result; cmd.type = CMD_WRITE; cmd.u.readwrite.serverfh = serverfh; cmd.u.readwrite.nbyte = nbyte; outmsg.num = 2; outmsg.seg[0].len = sizeof(cmd); outmsg.seg[0].buf = &cmd; outmsg.seg[1].len = nbyte; outmsg.seg[1].buf = buf; inmsg.seg[0].buf = &result; res = __av_send_message(&outmsg, &inmsg, 0); if(res == -1) return -EIO; return result.result; } #ifdef HAVE_LSEEK64 static off64_t virt_lseek64(int fd, off64_t offset, int whence, int undersc) { off64_t res; if(!FD_OK(fd) || !ISVIRTUAL(fd)) res = real_lseek64(fd, offset, whence, undersc); else { int errnosave = errno; res = cmd_lseek(SERVERFH(fd), offset, whence); if(res < 0) errno = -res, res = -1; else errno = errnosave; } return res; } #endif static off_t virt_lseek(int fd, off_t offset, int whence, int undersc) { off_t res; if(!FD_OK(fd) || !ISVIRTUAL(fd)) res = real_lseek(fd, offset, whence, undersc); else { int errnosave = errno; res = cmd_lseek(SERVERFH(fd), offset, whence); if(res < 0) errno = -res, res = -1; else errno = errnosave; } return res; } static ssize_t virt_read(int fd, void *buf, size_t nbyte, int undersc) { ssize_t res; if(!FD_OK(fd) || !ISVIRTUAL(fd)) res = real_read(fd, buf, nbyte, undersc); else { int errnosave = errno; res = cmd_read(SERVERFH(fd), buf, nbyte); if(res < 0) errno = -res, res = -1; else errno = errnosave; } return res; } static ssize_t virt_write(int fd, const void *buf, size_t nbyte, int undersc) { ssize_t res; if(!FD_OK(fd) || !ISVIRTUAL(fd)) res = real_write(fd, buf, nbyte, undersc); else { int errnosave = errno; res = cmd_write(SERVERFH(fd), buf, nbyte); if(res < 0) errno = -res, res = -1; else errno = errnosave; } return res; } static int cmd_readdir(int serverfh, struct avfs_direntry *de, char *name) { int res; struct avfs_out_message outmsg; struct avfs_in_message inmsg; struct avfs_cmd cmd; struct avfs_result result; cmd.type = CMD_READDIR; cmd.u.fdops.serverfh = serverfh; outmsg.num = 1; outmsg.seg[0].len = sizeof(cmd); outmsg.seg[0].buf = &cmd; inmsg.seg[0].buf = &result; inmsg.seg[1].buf = de; inmsg.seg[2].buf = name; res = __av_send_message(&outmsg, &inmsg, 0); if(res == -1) return -EIO; return result.result; } #ifdef HAVE_GETDENTS64 #define AVFS_DIR_RECLEN64 ((size_t)(((struct dirent64 *)0)->d_name)+NAME_MAX+1) static void avfs_direntry_to_dirent64(struct dirent64 *ent, struct avfs_direntry *avent) { ent->d_ino = avent->ino; ent->d_off = avent->n * AVFS_DIR_RECLEN64; ent->d_reclen = AVFS_DIR_RECLEN64; } static int virt_getdents64(int fd, struct dirent64 *buf, size_t nbyte, int undersc) { int res; if(!FD_OK(fd) || !ISVIRTUAL(fd)) res = real_getdents64(fd, buf, nbyte, undersc); else { struct avfs_direntry de; int errnosave; if(nbyte < AVFS_DIR_RECLEN64) { errno = EINVAL; return -1; } errnosave = errno; res = cmd_readdir(SERVERFH(fd), &de, buf->d_name); errno = errnosave; if(res < 0) errno = -res, res = -1; else if(res > 0) { avfs_direntry_to_dirent64(buf, &de); res = AVFS_DIR_RECLEN64; } } return res; } #endif #define AVFS_DIR_RECLEN ((size_t)(((struct dirent *)0)->d_name)+NAME_MAX+1) static void avfs_direntry_to_dirent(struct dirent *ent, struct avfs_direntry *avent) { ent->d_ino = avent->ino; ent->d_off = avent->n * AVFS_DIR_RECLEN; ent->d_reclen = AVFS_DIR_RECLEN; } static int virt_getdents(int fd, struct dirent *buf, size_t nbyte, int undersc) { int res; if(!FD_OK(fd) || !ISVIRTUAL(fd)) res = real_getdents(fd, buf, nbyte, undersc); else { struct avfs_direntry de; int errnosave; if(nbyte < AVFS_DIR_RECLEN) { errno = EINVAL; return -1; } errnosave = errno; res = cmd_readdir(SERVERFH(fd), &de, buf->d_name); errno = errnosave; if(res < 0) errno = -res, res = -1; else if(res > 0) { avfs_direntry_to_dirent(buf, &de); res = AVFS_DIR_RECLEN; } } return res; } #ifdef HAVE_LSEEK64 off64_t lseek64(int fd, off64_t offset, int whence) { return virt_lseek64(fd, offset, whence, 0); } off64_t _lseek64(int fd, off64_t offset, int whence) { return virt_lseek64(fd, offset, whence, 1); } #endif off_t lseek(int fd, off_t offset, int whence) { return virt_lseek(fd, offset, whence, 0); } off_t _lseek(int fd, off_t offset, int whence) { return virt_lseek(fd, offset, whence, 1); } ssize_t read(int fd, void *buf, size_t nbyte) { return virt_read(fd, buf, nbyte, 0); } ssize_t _read(int fd, void *buf, size_t nbyte) { return virt_read(fd, buf, nbyte, 1); } ssize_t write(int fd, const void *buf, size_t nbyte) { return virt_write(fd, buf, nbyte, 0); } ssize_t _write(int fd, const void *buf, size_t nbyte) { return virt_write(fd, buf, nbyte, 1); } #ifdef HAVE_GETDENTS64 int getdents64(int fd, struct dirent64 *buf, size_t nbyte) { return virt_getdents64(fd, buf, nbyte, 0); } int _getdents64(int fd, struct dirent64 *buf, size_t nbyte) { return virt_getdents64(fd, buf, nbyte, 1); } #endif int getdents(int fd, struct dirent *buf, size_t nbyte) { return virt_getdents(fd, buf, nbyte, 0); } int _getdents(int fd, struct dirent *buf, size_t nbyte) { return virt_getdents(fd, buf, nbyte, 1); } avfs-1.0.5/preload/send.c0000644000175000017500000000711013102441254014760 0ustar michaelmichael/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed either under the terms of the GNU GPL or under the terms of the GNU LGPL. See the files COPYING and COPYING.LIB. */ #include "send.h" #include #include #define BUFLEN 1024 struct buffer { int fd; char buf[BUFLEN]; unsigned int ptr; unsigned int len; int error; }; static int sock_write(int sock, const char *msg, unsigned int len) { int res; while(len > 0) { res = write(sock, msg, len); if(res == -1) return -1; len -= res; msg += res; } return 0; } static void init_buffer(struct buffer *buf, int fd) { buf->fd = fd; buf->ptr = 0; buf->len = 0; buf->error = 0; } static void read_buffer(struct buffer *buf, char *msg, unsigned int len) { int res; while(len > 0) { if(buf->error != 0) return; if(buf->len == 0 && len > BUFLEN) { res = read(buf->fd, msg, len); if(res <= 0) { buf->error = -1; return; } len -= res; msg += res; } else if(len <= buf->len) { memcpy(msg, buf->buf + buf->ptr, len); buf->len -= len; buf->ptr += len; return; } else { memcpy(msg, buf->buf + buf->ptr, buf->len); msg += buf->len; len -= buf->len; buf->ptr = 0; res = read(buf->fd, buf->buf, BUFLEN); if(res <= 0) buf->error = -1; else buf->len = res; } } } static void write_buffer(struct buffer *buf, const char *msg, unsigned int len) { unsigned int rem; while(len > 0) { if(buf->error != 0) return; if(buf->ptr == 0 && len > BUFLEN) { buf->error = sock_write(buf->fd, msg, len); return; } rem = BUFLEN - buf->ptr; if(len < rem) { memcpy(buf->buf + buf->ptr, msg, len); buf->ptr += len; return; } memcpy(buf->buf + buf->ptr, msg, rem); len -= rem; msg += rem; buf->error = sock_write(buf->fd, buf->buf, BUFLEN); buf->ptr = 0; } } static void flush_buffer(struct buffer *buf) { if(buf->error != 0) return; buf->error = sock_write(buf->fd, buf->buf, buf->ptr); } int __av_read_message(int sock, struct avfs_in_message *msg) { unsigned int lengths[MAXSEG]; struct buffer buf; int i; init_buffer(&buf, sock); read_buffer(&buf, (void *) lengths, sizeof(int) * MAXSEG); for(i = 0; i < MAXSEG; i++) { msg->seg[i].len = lengths[i]; if(lengths[i] != 0) { if(msg->seg[i].buf == NULL) msg->seg[i].buf = malloc(lengths[i]); read_buffer(&buf, msg->seg[i].buf, msg->seg[i].len); } } return buf.error; } int __av_write_message(int sock, struct avfs_out_message *msg) { int i; unsigned int lengths[MAXSEG]; struct buffer buf; for(i = 0; i < MAXSEG; i++) { if(i < msg->num) lengths[i] = msg->seg[i].len; else lengths[i] = 0; } init_buffer(&buf, sock); write_buffer(&buf, (void *) lengths, sizeof(int) * MAXSEG); for(i = 0; i < msg->num; i++) write_buffer(&buf, msg->seg[i].buf, msg->seg[i].len); flush_buffer(&buf); return buf.error; } avfs-1.0.5/preload/server.h0000644000175000017500000000034113102441254015341 0ustar michaelmichael/* 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. */ int server_init(); avfs-1.0.5/preload/leakcheck0000755000175000017500000000005713102441254015526 0ustar michaelmichael#! /bin/sh gdb -batch -n $1 -x /tmp/leak.out avfs-1.0.5/preload/leak.c0000644000175000017500000001323113102441254014744 0ustar michaelmichael// (c) 1999 Erwin S. Andreasen // Homepage: http://www.andreasen.org/LeakTracer/ #include #include #include #include "internal.h" static int new_count, // how many memory blocks do we have leaks_count, // amount of entries in the below array first_free_spot; // Where is the first free spot in the leaks array? static size_t new_size; // total size typedef struct { void *addr; size_t size; void *ret[10]; // void *ret2; // Not necessary anymore } Leak; static Leak *leaks; static AV_LOCK_DECL(lock); static int x(void *p) { int i = (int) p; #ifdef __linux__ if(!(i & 0x8000000)) return 0; return 1; #else if(i == 0 || i < 0) return 0; #endif // av_log(AVLOG_DEBUG, "p: 0x%08x", i); return 1; } static void* register_alloc (size_t size) { void *p = malloc(size); new_count++; new_size += size; if (!p) { // We should really throw some sort of exception or call the new_handler av_log(AVLOG_ERROR, "LeakTracer: out of memory"); _exit (1); } for (;;) { int i; int new_leaks_count; for (i = first_free_spot; i < leaks_count; i++) if (leaks[i].addr == NULL) { leaks[i].addr = p; leaks[i].size = size; do { if(!x(leaks[i].ret[0] = __builtin_return_address(0))) break; if(!x(leaks[i].ret[1] = __builtin_return_address(1))) break; if(!x(leaks[i].ret[2] = __builtin_return_address(2))) break; if(!x(leaks[i].ret[3] = __builtin_return_address(3))) break; if(!x(leaks[i].ret[4] = __builtin_return_address(4))) break; if(!x(leaks[i].ret[5] = __builtin_return_address(5))) break; if(!x(leaks[i].ret[6] = __builtin_return_address(6))) break; if(!x(leaks[i].ret[7] = __builtin_return_address(7))) break; if(!x(leaks[i].ret[8] = __builtin_return_address(8))) break; if(!x(leaks[i].ret[9] = __builtin_return_address(9))) break; } while(0); // leaks[i].ret2 = __builtin_return_address(2); first_free_spot = i+1; return p; } // Allocate a bigger array // Note that leaks_count starts out at 0. new_leaks_count = leaks_count == 0 ? 16 : leaks_count * 2; leaks = (Leak*)realloc(leaks, sizeof(*leaks) * new_leaks_count); if (!leaks) { av_log(AVLOG_ERROR, "LeakTracer: out of memory"); _exit(1); } memset(leaks+leaks_count, 0, sizeof(*leaks) * (new_leaks_count-leaks_count)); leaks_count = new_leaks_count; } } static void *register_realloc (void *p, size_t size) { void *p1; int i; p1 = realloc(p, size); for (i = 0; i < leaks_count; i++) if (leaks[i].addr == p) { leaks[i].addr = p1; new_size += size - leaks[i].size; leaks[i].size = size; return p1; } av_log(AVLOG_ERROR, "LeakTracer: realloc on an already deleted value"); abort(); } static void register_free (void *p) { int i; if (p == NULL) return; new_count--; for (i = 0; i < leaks_count; i++) if (leaks[i].addr == p) { leaks[i].addr = NULL; new_size -= leaks[i].size; if (i < first_free_spot) first_free_spot = i; free(p); return; } av_log(AVLOG_ERROR, "LeakTracer: free on an already deleted value"); abort(); } void *av_malloc(size_t size) { void *res; AV_LOCK(lock); res = register_alloc(size); AV_UNLOCK(lock); return res; } void *av_calloc(size_t size) { void *res; AV_LOCK(lock); res = register_alloc(size); memset(res, 0, size); AV_UNLOCK(lock); return res; } void *av_realloc(void *p, size_t size) { void *res; AV_LOCK(lock); if(p == NULL) res = register_alloc(size); else if(size == 0) { register_free(p); res = NULL; } else res = register_realloc(p, size); AV_UNLOCK(lock); return res; } void av_free(void *p) { AV_LOCK(lock); register_free(p); AV_UNLOCK(lock); } void av_check_malloc() { const char *filename = "/tmp/leak.out"; FILE *fp; av_log(AVLOG_DEBUG, "leak_count: %i (%i)", new_count, leaks_count); if (!(fp = fopen(filename, "w"))) av_log(AVLOG_ERROR, "LeakTracer: Could not open %s: %s\n", filename, strerror(errno)); else { int i; int numunfreed = 0; AV_LOCK(lock); fprintf(fp, "set prompt\n" "echo\n" "set listsize 0\n" "set height 0\n"); fprintf(fp, "echo leak size: %6d\\n\n", new_size); for (i = 0; i < leaks_count; i++) if (leaks[i].addr != NULL) { int j; numunfreed ++; fprintf(fp, "echo -------------------------------------------------------------------------\\n\n"); fprintf(fp, "echo addr: %8p size: %9ld\\n\n", leaks[i].addr, (long) leaks[i].size); for(j = 0; j < 10; j++) { if(!x(leaks[i].ret[j])) break; fprintf(fp, "l *0x%x\n", (int) leaks[i].ret[j]); } } AV_UNLOCK(lock); fclose(fp); av_log(AVLOG_WARNING, "number of unfreed pointers: %i", numunfreed); } } avfs-1.0.5/preload/client.c0000644000175000017500000001155313102441254015313 0ustar michaelmichael/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU LGPL. See the file COPYING.LIB. */ #include "send.h" #include #include #include #include #include #include #include #include #include #include #include #include #include #ifndef AVFS_SERVER_DIR #define AVFS_SERVER_DIR "/usr/lib/avfs" #endif #define AVFS_SERVER_PATH AVFS_SERVER_DIR "/avfs_server" #define PWBUFSIZE 256 #define MAXUSERNAME 32 extern char **environ; static const char *get_conndir() { static char conndir[64]; static pthread_mutex_t mutex; static int inited; char username[MAXUSERNAME + 1]; struct passwd pw; struct passwd *pwres; char buf[PWBUFSIZE]; int uid; int res; struct stat stbuf; pthread_mutex_lock(&mutex); if(!inited) { char *variant; char varbuf[32]; inited = 1; uid = getuid(); res = getpwuid_r(uid, &pw, buf, PWBUFSIZE, &pwres); if(res == 0) { strncpy(username, pwres->pw_name, MAXUSERNAME); username[MAXUSERNAME] = '\0'; } else sprintf(username, "%i", uid); varbuf[0] = '\0'; variant = getenv("AVFS_VARIANT"); if(variant != NULL) { unsigned long i = strtol(variant, NULL, 10); sprintf(varbuf, "-%lu", i); } sprintf(conndir, "/tmp/.avfsconn-%s%s", username, varbuf); res = stat(conndir, &stbuf); if(res == -1 && errno == ENOENT) { mkdir(conndir, 0700); res = stat(conndir, &stbuf); } if(res == -1 || stbuf.st_uid != uid || (stbuf.st_mode & 0077) != 0) { fprintf(stderr, "AVFS: please check permissions of <%s>\n", conndir); conndir[0] = '\0'; } } pthread_mutex_unlock(&mutex); if(conndir[0] != '\0') return conndir; else return NULL; } static int start_server() { int res; int pid; int status; sigset_t oldset; sigset_t newset; int success; const char *serverpath; serverpath = getenv("AVFS_SERVER_PATH"); if(serverpath == NULL || serverpath[0] == '\0') serverpath = AVFS_SERVER_PATH; sigfillset(&newset); sigprocmask(SIG_SETMASK, &newset, &oldset); pid = fork(); if(pid == -1) return -1; if(pid == 0) { int i; char **envp = environ; for(i = 0; envp[i] != NULL; i++) { if(strncmp(envp[i], "PWD=", 4) == 0) envp[i][4] = '\0'; else if(strncmp(envp[i], "LD_PRELOAD=", 11) == 0) envp[i][11] = '\0'; } res = execl(serverpath, "avfs_server", NULL); if(res == -1) fprintf(stderr, "AVFS: could not start server (%s): %s\n", serverpath, strerror(errno)); exit(1); } res = waitpid(pid, &status, 0); if(res != -1 && WIFEXITED(status) && WEXITSTATUS(status) == 0) success = 0; else success = -1; sigprocmask(SIG_SETMASK, &oldset, NULL); return success; } static int connect_server(int sock) { int res; struct sockaddr_un addr; unsigned int addrlen; const char *conndir = get_conndir(); if(conndir == NULL) return -1; addr.sun_family = AF_UNIX; sprintf(addr.sun_path, "%s/server", conndir); addrlen = (size_t) (((struct sockaddr_un *) 0)->sun_path) + strlen(addr.sun_path); res = connect(sock, (struct sockaddr *) &addr, addrlen); if(res == -1) { res = start_server(); if(res == -1) return -1; res = connect(sock, (struct sockaddr *) &addr, addrlen); if(res == -1) fprintf(stderr, "AVFS: could not connect to server socket (%s): %s\n", addr.sun_path, strerror(errno)); } return res; } static int sock_send_message(int sock, struct avfs_out_message *out, struct avfs_in_message *in) { int res; res = connect_server(sock); if(res == -1) return -1; res = __av_write_message(sock, out); if(res == -1) return -1; res = __av_read_message(sock, in); if(res == -1) return -1; return 0; } int __av_send_message(struct avfs_out_message *out, struct avfs_in_message *in, int keepsock) { int res; int sock; sock = socket(AF_UNIX, SOCK_STREAM, 0); if(sock == -1) return -1; res = sock_send_message(sock, out, in); if(res == -1) return -1; if(keepsock) return sock; else { close(sock); return 0; } } avfs-1.0.5/preload/Makefile.in0000644000175000017500000006247713102441264015752 0ustar michaelmichael# Makefile.in generated by automake 1.13.4 from Makefile.am. # @configure_input@ # Copyright (C) 1994-2013 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 = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' 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_PRELOAD_TRUE@server_PROGRAMS = avfs_server$(EXEEXT) subdir = preload DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \ $(top_srcdir)/depcomp $(noinst_HEADERS) ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/macros/extfs.m4 \ $(top_srcdir)/macros/ld-versionscript.m4 \ $(top_srcdir)/macros/neon-ssl.m4 \ $(top_srcdir)/macros/neon-xml-parser.m4 \ $(top_srcdir)/macros/neon.m4 $(top_srcdir)/macros/pkg.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) 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)" "$(DESTDIR)$(serverdir)" LTLIBRARIES = $(lib_LTLIBRARIES) avfs_preload_la_DEPENDENCIES = am__avfs_preload_la_SOURCES_DIST = client.c utils.c send.c file.c \ open.c stat.c misc.c @INSTALL_PRELOAD_TRUE@am_avfs_preload_la_OBJECTS = client.lo utils.lo \ @INSTALL_PRELOAD_TRUE@ send.lo file.lo open.lo stat.lo misc.lo avfs_preload_la_OBJECTS = $(am_avfs_preload_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 = avfs_preload_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(AM_CFLAGS) $(CFLAGS) $(avfs_preload_la_LDFLAGS) $(LDFLAGS) \ -o $@ @INSTALL_PRELOAD_TRUE@am_avfs_preload_la_rpath = -rpath $(libdir) PROGRAMS = $(server_PROGRAMS) am__avfs_server_SOURCES_DIST = avfs_server.c server.c @INSTALL_PRELOAD_TRUE@am_avfs_server_OBJECTS = avfs_server.$(OBJEXT) \ @INSTALL_PRELOAD_TRUE@ server.$(OBJEXT) avfs_server_OBJECTS = $(am_avfs_server_OBJECTS) avfs_server_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(avfs_server_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__depfiles_maybe = depfiles 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 = $(avfs_preload_la_SOURCES) $(avfs_server_SOURCES) DIST_SOURCES = $(am__avfs_preload_la_SOURCES_DIST) \ $(am__avfs_server_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 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@ EMACS = @EMACS@ 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@ KERNINCLUDE = @KERNINCLUDE@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBZ2 = @LIBBZ2@ LIBDAV = @LIBDAV@ LIBFUSE_CFLAGS = @LIBFUSE_CFLAGS@ LIBFUSE_LIBS = @LIBFUSE_LIBS@ LIBLZMA_CFLAGS = @LIBLZMA_CFLAGS@ LIBLZMA_LIBS = @LIBLZMA_LIBS@ LIBOBJS = @LIBOBJS@ LIBS = LIBTOOL = @LIBTOOL@ LIBZ = @LIBZ@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ NEONLIBS = @NEONLIBS@ NEONOBJS = @NEONOBJS@ NEON_BUILD_BUNDLED = @NEON_BUILD_BUNDLED@ NEON_LINK_FLAGS = @NEON_LINK_FLAGS@ NEON_OBJEXT = @NEON_OBJEXT@ NEON_TARGET = @NEON_TARGET@ 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@ PRELOAD_LIBS = @PRELOAD_LIBS@ RANLIB = @RANLIB@ SED = @SED@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ UNZIP = @UNZIP@ VERSION = @VERSION@ VERSIONSCRIPT_OPTS = @VERSIONSCRIPT_OPTS@ XML_CONFIG = @XML_CONFIG@ 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@ avfscoda_build = @avfscoda_build@ 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@ initstyle = @initstyle@ install_scriptcomps = @install_scriptcomps@ install_sh = @install_sh@ kmoduledir = @kmoduledir@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ moduledir = @moduledir@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ preload_build = @preload_build@ profiledir = @profiledir@ program_transform_name = @program_transform_name@ psdir = @psdir@ rcdir = @rcdir@ rcscriptdir = @rcscriptdir@ sbindir = @sbindir@ shared_build = @shared_build@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ start_levels = @start_levels@ start_prio = @start_prio@ stop_levels = @stop_levels@ stop_prio = @stop_prio@ 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@ \ -DAVFS_SERVER_DIR=\"@moduledir@\" EXTRA_DIST = leak.c leakcheck noinst_HEADERS = \ client.h \ cmd.h \ send.h \ server.h \ utils.h @INSTALL_PRELOAD_TRUE@lib_LTLIBRARIES = avfs_preload.la @INSTALL_PRELOAD_TRUE@avfs_preload_la_LDFLAGS = -module @INSTALL_PRELOAD_TRUE@avfs_preload_la_LIBADD = @PRELOAD_LIBS@ @INSTALL_PRELOAD_TRUE@avfs_preload_la_SOURCES = \ @INSTALL_PRELOAD_TRUE@ client.c \ @INSTALL_PRELOAD_TRUE@ utils.c \ @INSTALL_PRELOAD_TRUE@ send.c \ @INSTALL_PRELOAD_TRUE@ file.c \ @INSTALL_PRELOAD_TRUE@ open.c \ @INSTALL_PRELOAD_TRUE@ stat.c \ @INSTALL_PRELOAD_TRUE@ misc.c @INSTALL_PRELOAD_TRUE@serverdir = @moduledir@ @INSTALL_PRELOAD_TRUE@avfs_server_LDFLAGS = @LDFLAGS@ @LIBS@ @INSTALL_PRELOAD_TRUE@avfs_server_DEPENDENCIES = send.lo @INSTALL_PRELOAD_TRUE@avfs_server_LDADD = ../lib/libavfs_static.la send.lo @LIBS@ @INSTALL_PRELOAD_TRUE@avfs_server_SOURCES = \ @INSTALL_PRELOAD_TRUE@ avfs_server.c \ @INSTALL_PRELOAD_TRUE@ server.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 preload/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --gnu preload/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(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}; \ } avfs_preload.la: $(avfs_preload_la_OBJECTS) $(avfs_preload_la_DEPENDENCIES) $(EXTRA_avfs_preload_la_DEPENDENCIES) $(AM_V_CCLD)$(avfs_preload_la_LINK) $(am_avfs_preload_la_rpath) $(avfs_preload_la_OBJECTS) $(avfs_preload_la_LIBADD) $(LIBS) install-serverPROGRAMS: $(server_PROGRAMS) @$(NORMAL_INSTALL) @list='$(server_PROGRAMS)'; test -n "$(serverdir)" || list=; \ if test -n "$$list"; then \ echo " $(MKDIR_P) '$(DESTDIR)$(serverdir)'"; \ $(MKDIR_P) "$(DESTDIR)$(serverdir)" || 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)$(serverdir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(serverdir)$$dir" || exit $$?; \ } \ ; done uninstall-serverPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(server_PROGRAMS)'; test -n "$(serverdir)" || 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)$(serverdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(serverdir)" && rm -f $$files clean-serverPROGRAMS: @list='$(server_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 avfs_server$(EXEEXT): $(avfs_server_OBJECTS) $(avfs_server_DEPENDENCIES) $(EXTRA_avfs_server_DEPENDENCIES) @rm -f avfs_server$(EXEEXT) $(AM_V_CCLD)$(avfs_server_LINK) $(avfs_server_OBJECTS) $(avfs_server_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avfs_server.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/client.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/file.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/open.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/send.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/server.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/stat.Plo@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utils.Plo@am__quote@ .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 $< .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 `$(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: $(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) $(PROGRAMS) $(HEADERS) installdirs: for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(serverdir)"; 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-serverPROGRAMS mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-serverPROGRAMS 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 -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-libLTLIBRARIES uninstall-serverPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ clean-libLTLIBRARIES clean-libtool clean-serverPROGRAMS \ 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-libLTLIBRARIES \ install-man install-pdf install-pdf-am install-ps \ install-ps-am install-serverPROGRAMS 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-libLTLIBRARIES \ uninstall-serverPROGRAMS #avfs_server_SOURCES = \ # avfs_server.c \ # server.c \ # leak.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.0.5/preload/cmd.h0000644000175000017500000000276513102441254014612 0ustar michaelmichael/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed either under the terms of the GNU GPL or under the terms of the GNU LGPL. See the files COPYING and COPYING.LIB. */ #include "avfs.h" #include #include #include enum avfs_cmd_type { CMD_GETATTR, CMD_OPEN, CMD_CLOSE, CMD_FSTAT, CMD_READDIR, CMD_LSEEK, CMD_READ, CMD_WRITE, CMD_RESOLVE, CMD_READLINK, CMD_ACCESS }; struct avfs_cmd { enum avfs_cmd_type type; union { struct { int flags; int attrmask; } getattr; struct { int flags; avmode_t mode; } open; struct { int serverfh; } fdops; struct { int serverfh; avoff_t offset; int whence; } lseek; struct { int serverfh; avsize_t nbyte; } readwrite; struct { avsize_t bufsize; } readlink; struct { int amode; } access; } u; }; struct avfs_result { int result; union { struct { avoff_t offset; } lseek; struct { int isvirtual; } resolve; } u; }; struct avfs_direntry { avino_t ino; int type; int n; }; #define PATHBUF_LEN (PATH_MAX + 1) #ifndef NAME_MAX #define NAME_MAX 255 #endif avfs-1.0.5/preload/server.c0000644000175000017500000001210413102441254015334 0ustar michaelmichael/* 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 "send.h" #include "avfs.h" #include #include #include #include #include #include #include #include #include #include #include #include static int get_sockname(char *sockname) { int res; char username[33]; char sockdir[128]; char lockfile[128]; struct passwd *pw; int uid; int lockfd; struct flock flock; char *variant; char varbuf[32]; uid = getuid(); pw = getpwuid(uid); if(pw != NULL) { strncpy(username, pw->pw_name, 32); username[32] = '\0'; } else sprintf(username, "%i", uid); varbuf[0] = '\0'; variant = getenv("AVFS_VARIANT"); if(variant != NULL) { unsigned long i = strtol(variant, NULL, 10); sprintf(varbuf, "-%lu", i); } sprintf(sockdir, "/tmp/.avfsconn-%s%s", username, varbuf); sprintf(sockname, "%s/server", sockdir); sprintf(lockfile, "%s/lock", sockdir); res = mkdir(sockdir, 0700); if(res == -1) { struct stat stbuf; if(errno != EEXIST) { perror("mkdir()"); exit(1); } res = stat(sockdir, &stbuf); if(res == -1) { perror(sockdir); exit(1); } if(stbuf.st_uid != uid || (stbuf.st_mode & 0077) != 0) { fprintf(stderr, "Bad owner or permissons on %s\n", sockdir); exit(1); } } lockfd = open(lockfile, O_CREAT | O_RDWR, 0644); if(lockfd == -1) { perror(lockfile); exit(1); } fcntl(lockfd, F_SETFD, FD_CLOEXEC); memset(&flock, 0, sizeof(flock)); flock.l_type = F_WRLCK; flock.l_whence = 0; flock.l_start = 0; flock.l_len = 0; res = fcntl(lockfd, F_SETLK, &flock); if(res == -1) { if(errno == EAGAIN || errno == EACCES) return -1; perror("fcntl(F_SETLK)"); exit(1); } unlink(sockname); return 0; } static int socket_init(const char *sockname) { int sock; int res; struct sockaddr_un addr; unsigned int addrlen; sock = socket(AF_UNIX, SOCK_STREAM, 0); if(sock == -1) { perror("socket()"); exit(1); } addr.sun_family = AF_UNIX; strcpy(addr.sun_path, sockname); addrlen = (size_t) (((struct sockaddr_un *) 0)->sun_path) + strlen(addr.sun_path); res = bind(sock, (struct sockaddr *) &addr, addrlen); if(res == -1) { perror("bind()"); exit(1); } res = listen(sock, 5); if(res == -1) { perror("listen()"); exit(1); } return sock; } static void exit_handler(int sig) { exit(0); } #if 0 static void bad_handler(int sig) { av_log(AVLOG_ERROR, "%s, Exiting", strsignal(sig)); _exit(1); } #endif int server_init() { int res; int pip[2]; int pid; int nullfd; int i; char sockname[128]; int numfd; sigset_t newset; struct sigaction act; sigemptyset(&newset); sigprocmask(SIG_SETMASK, &newset, NULL); for(i = 0; i < 3; i++) { nullfd = open("/dev/null", O_RDONLY); if(nullfd == -1) { perror("avfs_server: open(/dev/null)"); exit(1); } } res = pipe(pip); if(res == -1) { perror("avfs_server: pipe()"); exit(1); } pid = fork(); if(pid == -1) { perror("avfs_server: fork()"); exit(1); } if(pid != 0) { int res; char c; close(pip[1]); res = read(pip[0], &c, 1); if(res == -1) { perror("avfs_server: read()"); exit(1); } if(res == 0) exit(1); exit(0); } setuid(getuid()); setgid(getgid()); // chdir("/"); chdir("/tmp"); setsid(); numfd = getdtablesize(); for(i = 0; i < numfd; i++) { if(i != pip[1]) close(i); } nullfd = open("/dev/null", O_RDWR); if(nullfd == -1) exit(1); for(i = 0; i < 3; i++) res = dup2(nullfd, i); res = get_sockname(sockname); if(res != -1) res = socket_init(sockname); if(write(pip[1], "m", 1) != 1) exit(1); if(res == -1) exit(0); close(pip[1]); act.sa_handler = exit_handler; sigemptyset(&act.sa_mask); act.sa_flags = 0; sigaction(SIGTERM, &act, NULL); sigaction(SIGHUP, &act, NULL); sigaction(SIGINT, &act, NULL); act.sa_handler = SIG_IGN; sigaction(SIGPIPE, &act, NULL); #if 0 act.sa_handler = bad_handler; sigfillset(&act.sa_mask); sigaction(SIGQUIT, &act, NULL); sigaction(SIGILL, &act, NULL); sigaction(SIGFPE, &act, NULL); sigaction(SIGABRT, &act, NULL); sigaction(SIGBUS, &act, NULL); sigaction(SIGSEGV, &act, NULL); #endif return res; } avfs-1.0.5/preload/client.h0000644000175000017500000000053313102441254015314 0ustar michaelmichael/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU LGPL. See the file COPYING.LIB. */ #include "send.h" int __av_send_message(struct avfs_out_message *out, struct avfs_in_message *in, int keepsock); avfs-1.0.5/preload/open.c0000644000175000017500000002227213102441254014776 0ustar michaelmichael/* AVFS: A Virtual File System Library Copyright (C) 1998-2001 Miklos Szeredi This program can be distributed under the terms of the GNU LGPL. See the file COPYING.LIB. */ #include "utils.h" #include "config.h" #include #include #include #include #define CREATFLAGS (O_WRONLY | O_CREAT | O_TRUNC) #ifdef HAVE_OPEN64 static int real_open64(const char *path, int flags, mode_t mode, int undersc) { int res; if(undersc == 0) { static int (*prev)(const char *, int, mode_t); if(!prev) prev = (int (*)(const char *, int, mode_t)) __av_get_real("open64"); res = prev(path, flags, mode); } else { static int (*prev)(const char *, int, mode_t); if(!prev) prev = (int (*)(const char *, int, mode_t)) __av_get_real("_open64"); res = prev(path, flags, mode); } return res; } #endif static int real_open32(const char *path, int flags, mode_t mode, int undersc) { int res; if(undersc == 0) { static int (*prev)(const char *, int, mode_t); if(!prev) prev = (int (*)(const char *, int, mode_t)) __av_get_real("open"); res = prev(path, flags, mode); } else { static int (*prev)(const char *, int, mode_t); if(!prev) prev = (int (*)(const char *, int, mode_t)) __av_get_real("_open"); res = prev(path, flags, mode); } return res; } #ifdef HAVE_CREAT64 static int real_creat64(const char *path, mode_t mode, int undersc) { int res; if(undersc == 0) { static int (*prev)(const char *, mode_t); if(!prev) prev = (int (*)(const char *, mode_t)) __av_get_real("creat64"); res = prev(path, mode); } else { static int (*prev)(const char *, mode_t); if(!prev) prev = (int (*)(const char *, mode_t)) __av_get_real("_creat64"); res = prev(path, mode); } return res; } #endif static int real_creat32(const char *path, mode_t mode, int undersc) { int res; if(undersc == 0) { static int (*prev)(const char *, mode_t); if(!prev) prev = (int (*)(const char *, mode_t)) __av_get_real("creat"); res = prev(path, mode); } else { static int (*prev)(const char *, mode_t); if(!prev) prev = (int (*)(const char *, mode_t)) __av_get_real("_creat"); res = prev(path, mode); } return res; } static int real_open(const char *path, int flags, mode_t mode, int undersc, int is64, int creat) { int res; is64 = is64; /* Possibly unused arg */ if(creat) { #ifdef HAVE_CREAT64 if(is64) res = real_creat64(path, mode, undersc); else #endif res = real_creat32(path, mode, undersc); } else { #ifdef HAVE_OPEN64 if(is64) res = real_open64(path, flags, mode, undersc); else #endif res = real_open32(path, flags, mode, undersc); } return res; } static int real_close(int fd, int undersc) { if(undersc == 0) { static int (*prev)(int); if(!prev) prev = (int (*)(int)) __av_get_real("close"); return prev(fd); } else { static int (*prev)(int); if(!prev) prev = (int (*)(int)) __av_get_real("_close"); return prev(fd); } } static int real_unlink(const char *path) { return unlink(path); } static int get_handle() { int fh = -1; char dummyfile[64]; int numtries; for(numtries = 0; numtries < 10; numtries++) { strcpy(dummyfile, "/tmp/.avfs_dummyfile_XXXXXX"); mktemp(dummyfile); if(dummyfile[0] != '\0') { fh = real_open(dummyfile, O_RDONLY | O_CREAT | O_EXCL, 0600, 1, 1, 0); real_unlink(dummyfile); } if(fh != -1) break; } if(fh == -1) return -EIO; if(!FD_OK(fh)) { real_close(fh, 1); return -EIO; } if(ISVIRTUAL(fh)) { real_close(fh, 1); __av_dtable[fh].isvirtual = 0; return -EFAULT; } fcntl(fh, F_SETFD, FD_CLOEXEC); __av_dtable[fh].isvirtual = 1; return fh; } static void free_handle(int fh) { if(FD_OK(fh)) __av_dtable[fh].isvirtual = 0; real_close(fh, 1); } 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; if(flags & O_SYNC) avflags |= AVO_SYNC; return avflags; } static int cmd_open(const char *path, int flags, mode_t mode, char *pathbuf, int *holderfd) { int res; struct avfs_out_message outmsg; struct avfs_in_message inmsg; struct avfs_cmd cmd; struct avfs_result result; const char *abspath; res = __av_get_abs_path(path, pathbuf, &abspath); if(res < 0) return res; cmd.type = CMD_OPEN; cmd.u.open.flags = oflags_to_avfs(flags); cmd.u.open.mode = mode; outmsg.num = 2; outmsg.seg[0].len = sizeof(cmd); outmsg.seg[0].buf = &cmd; outmsg.seg[1].len = strlen(abspath) + 1; outmsg.seg[1].buf = abspath; inmsg.seg[0].buf = &result; inmsg.seg[1].buf = pathbuf; res = __av_send_message(&outmsg, &inmsg, 1); if(res == -1) return -EIO; *holderfd = res; if(inmsg.seg[1].len == 0) pathbuf[0] = '\0'; return result.result; } static int cmd_close(int serverfh) { int res; struct avfs_out_message outmsg; struct avfs_in_message inmsg; struct avfs_cmd cmd; struct avfs_result result; cmd.type = CMD_CLOSE; cmd.u.fdops.serverfh = serverfh; outmsg.num = 1; outmsg.seg[0].len = sizeof(cmd); outmsg.seg[0].buf = &cmd; inmsg.seg[0].buf = &result; res = __av_send_message(&outmsg, &inmsg, 0); if(res == -1) return -EIO; return result.result; } static int do_open(const char *path, int flags, mode_t mode, char *pathbuf) { int serverfh; int holderfd; int fh; serverfh = cmd_open(path, flags, mode, pathbuf, &holderfd); if(serverfh < 0) { real_close(holderfd, 1); return serverfh; } fh = get_handle(); if(fh < 0) { cmd_close(serverfh); real_close(holderfd, 1); return fh; } fcntl(holderfd, F_SETFD, FD_CLOEXEC); __av_dtable[fh].serverfh = serverfh; __av_dtable[fh].holderfd = holderfd; return fh; } static int virt_open(const char *path, int flags, mode_t mode, int undersc, int is64, int creat) { int res = 0; int local = 0; if(__av_maybe_local(path)) { res = real_open(path, flags, mode, undersc, is64, creat); local = __av_is_local(res, path); } if(!local) { int errnosave; char pathbuf[PATHBUF_LEN]; errnosave = errno; res = do_open(path, flags, mode, pathbuf); errno = errnosave; if(pathbuf[0]) res = real_open(pathbuf, flags, mode, undersc, is64, creat); else if(res < 0) errno = -res, res = -1; } return res; } static int virt_close(int fd, int undersc) { int res; if(!FD_OK(fd) || !ISVIRTUAL(fd)) res = real_close(fd, undersc); else { int errnosave = errno; res = cmd_close(SERVERFH(fd)); real_close(__av_dtable[fd].holderfd, 1); free_handle(fd); if(res < 0) errno = -res, res = -1; else errno = errnosave; } return res; } #ifdef HAVE_OPEN64 int open64(const char *path, int flags, ...) { va_list ap; mode_t mode; va_start(ap, flags); mode = va_arg(ap, mode_t); va_end(ap); return virt_open(path, flags, mode, 0, 1, 0); } int _open64(const char *path, int flags, mode_t mode) { return virt_open(path, flags, mode, 1, 1, 0); } #endif int open(const char *path, int flags, ...) { va_list ap; mode_t mode; va_start(ap, flags); mode = va_arg(ap, mode_t); va_end(ap); return virt_open(path, flags, mode, 0, 0, 0); } int _open(const char *path, int flags, mode_t mode) { return virt_open(path, flags, mode, 1, 0, 0); } #ifdef HAVE_CREAT64 int creat64(const char *path, mode_t mode) { return virt_open(path, CREATFLAGS, mode, 0, 1, 1); } int _creat64(const char *path, mode_t mode) { return virt_open(path, CREATFLAGS, mode, 1, 1, 1); } #endif int creat(const char *path, mode_t mode) { return virt_open(path, CREATFLAGS, mode, 0, 0, 1); } int _creat(const char *path, mode_t mode) { return virt_open(path, CREATFLAGS, mode, 1, 0, 1); } int close(int fd) { return virt_close(fd, 0); } int _close(int fd) { return virt_close(fd, 1); } avfs-1.0.5/configure.ac0000644000175000017500000004237113102441254014533 0ustar michaelmichaeldnl Process this file with autoconf to produce a configure script. define(AVFS_MAJOR,[1]) define(AVFS_MINOR,[0]) define(AVFS_PATCH,[5]) 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 preload, avfscoda, shared library and/or fuse daemon]) dnl here come the default values shared=yes if test "$os" = "Linux"; then if test "$kernver" -ge "22" \ -a "$kernver" -le "24"; then avfscoda=yes else fuse=yes fi elif test "$os" = "SunOS"; then preload=yes fi AC_ARG_ENABLE([preload], AC_HELP_STRING([--enable-preload],[Compile the preloaded library and server]), [if test "$enableval" = yes; then preload=yes; else preload=no; fi]) AC_ARG_ENABLE([avfscoda], AC_HELP_STRING([--enable-avfscoda],[Compile avfscoda (which uses the coda interface)]), [if test "$enableval" = yes; then avfscoda=yes; else avfscoda=no; 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 avfscoda_build=no preload_build=no fuse_build=no build_result= if test "$avfscoda" = yes; then avfscoda_build=yes build_result=avfscoda fi if test "$preload" = yes; then preload_build=yes if test -z "$build_result"; then build_result=preload else build_result="$build_result preload" fi fi 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 (needs an xml library)], [if test "$enableval" = yes; then dav=yes; else dav=no; fi], dav=no) 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) dnl Checks for programs. cflags="$CFLAGS" AC_PROG_CC AC_PROG_CPP AC_PROG_INSTALL AC_PROG_LIBTOOL PKG_PROG_PKG_CONFIG if test ! "$preload_build" = "yes"; then AC_SYS_LARGEFILE 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 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) build_neon_lib=no if test "$dav" = yes; then dnl We require neon 0.12 NEON_REQUIRE(0,12) dnl Build neon. We support a VPATH build. NEON_BUNDLED('${top_srcdir}/libneon', [ NEON_NORMAL_BUILD NEON_XML_PARSER ]) # LIBS=$NEONLIBS DAV=dav.c DAV_LS=dav_ls.c LIBDAV=../libneon/libneon.la build_neon_lib=yes else NEON_BUILD_BUNDLED=no AC_SUBST(NEON_BUILD_BUNDLED) DAV= DAV_LS= LIBDAV= fi AM_CONDITIONAL(BUILD_NEON_LIB, test x$build_neon_lib = xyes) AM_CONDITIONAL(BUILD_DAVSUPPORT, test x$build_neon_lib = 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= AC_CHECK_PROG(EMACS, emacs, yes, no) MC_EXTFS_CHECKS AM_CONDITIONAL(INSTALL_EMACS, test x$EMACS = xyes) dnl ================================================================ dnl == Now comes the stuff that is only for preload == dnl ================================================================ if test $preload_build = yes; then origlibs=$LIBS LIBS= AC_CHECK_FUNCS(lseek64 getdents64 open64 creat64 stat64 acl) AC_SEARCH_LIBS(socket, socket inet) AC_SEARCH_LIBS(dlsym, dl) PRELOAD_LIBS=$LIBS AC_SUBST(PRELOAD_LIBS) LIBS=$origlibs fi AM_CONDITIONAL(INSTALL_PRELOAD, test x$preload_build = xyes) dnl ================================================================ dnl == Now comes the stuff that is only for avfscoda == dnl ================================================================ install_profilescripts=no install_avfscoda=no install_initscript=no install_scriptlinks=no install_codadev=no install_fuse=no if test $avfscoda_build = yes; then AC_MSG_CHECKING([kernel source directory]) kernelsrc= AC_ARG_WITH(kernel, [ --with-kernel Specify location of kernel source ], [kernelsrc="$withval"]) if test -z "$kernelsrc"; then buildlink=/lib/modules/`uname -r`/build if test -e $buildlink; then kernelsrc=`(cd $buildlink; /bin/pwd)` elif test -e /usr/src/linux; then kernelsrc=/usr/src/linux else AC_MSG_RESULT([Not found]) AC_MSG_ERROR([ *** Please specify the location of the kernel source with *** the '--with-kernel=SRCDIR' option]) fi fi AC_MSG_RESULT([$kernelsrc]) AC_MSG_CHECKING([kernel source version]) origlibs=$LIBS LIBS="" kernsrcver=`AC_TRY_RUN([ #include "$kernelsrc/include/linux/version.h" #include int main() { printf("%s\n", UTS_RELEASE); return 0; } ], , , true)` if test -z "$kernsrcver"; then AC_MSG_RESULT([Not found]) AC_MSG_ERROR([ *** Cannot determine the version of the linux kernel source. Please *** configure the kernel before running this script]) fi LIBS=$origlibs AC_MSG_RESULT([$kernsrcver]) KERNINCLUDE=${kernelsrc}/include AC_SUBST(KERNINCLUDE) kmoduledir=/lib/modules/${kernsrcver}/misc AC_SUBST(kmoduledir) initstyle= AC_MSG_CHECKING([for init-script style]) if test -d /sbin/init.d -a -f /etc/rc.config; then initstyle=suse elif test -f /etc/rc.d/init.d/functions; then initstyle=redhat elif test -d /etc/rc2.d; then initstyle=debian else initstyle=generic fi; AC_MSG_RESULT([$initstyle]) rcdir= rcscriptdir= start_levels= stop_levels= start_prio= stop_prio= install_initscript=yes if test "$initstyle" = redhat; then install_scriptlinks=yes rcdir=/etc/rc.d rcscriptdir=init.d start_levels="2 3 4 5" stop_levels="0 1 6" start_prio=85 stop_prio=25 elif test "$initstyle" = suse; then install_scriptlinks=yes rcdir=/sbin/init.d rcscriptdir= start_levels="2 3" stop_levels="2 3" start_prio=20 stop_prio=20 elif test "$initstyle" = debian; then install_scriptlinks=yes rcdir=/etc rcscriptdir=init.d start_levels="2 3 4 5" stop_levels="0 1 6" start_prio=85 stop_prio=25 else rcdir=/etc/rc.d rcscriptdir= fi AC_SUBST(initstyle) AC_SUBST(rcdir) AC_SUBST(rcscriptdir) AC_SUBST(start_levels) AC_SUBST(stop_levels) AC_SUBST(start_prio) AC_SUBST(stop_prio) profiledir= newredir=no if test "$newredir" = no; then AC_MSG_CHECKING([for profile directory]) install_profilescripts=yes if test -d /etc/profile.d; then profiledir=/etc/profile.d else profiledir=/etc fi AC_MSG_RESULT([$profiledir]) fi AC_SUBST(profiledir) install_codadev=yes install_avfscoda=yes fi 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 AM_CONDITIONAL(USE_LIBLZMA, test x$use_liblzma = xyes) AM_CONDITIONAL(INSTALL_FUSE, test x$install_fuse = xyes) AM_CONDITIONAL(INSTALL_AVFSCODA_PROFILE, test x$install_profilescripts = xyes) AM_CONDITIONAL(INSTALL_AVFSCODA, test x$install_avfscoda = xyes) AM_CONDITIONAL(INSTALL_INITSCRIPT, test x$install_initscript = xyes) AM_CONDITIONAL(INSTALL_SCRIPTLINKS, test x$install_scriptlinks = xyes) AM_CONDITIONAL(INSTALL_CODADEV, test x$install_codadev = 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(avfscoda_build) AC_SUBST(preload_build) AC_SUBST(shared_build) AC_OUTPUT([ Makefile src/Makefile modules/Makefile zlib/Makefile bzlib/Makefile lib/Makefile include/Makefile avfscoda/Makefile avfscoda/redir/Makefile preload/Makefile libneon/Makefile extfs/Makefile scripts/Makefile scripts/init/Makefile test/Makefile spec/Makefile macros/Makefile patch/Makefile doc/Makefile fuse/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 (recommended: yes)" else echo " Building library : no (recommended: yes)" fi if test "$fuse_build" = "yes"; then echo " Building avfsd for fuse : yes (recommended: yes)" else echo " Building avfsd for fuse : no (recommended: yes)" fi if test "$preload_build" = "yes"; then echo " Building preload library : yes (recommended: no)" else echo " Building preload library : no (recommended: no)" fi if test "$avfscoda_build" = "yes"; then echo " Building avfscoda daemon and kernel module: yes (recommended: no)" else echo " Building avfscoda daemon and kernel module: no (recommended: no)" fi echo "" if test "x$use_system_zlib" = "xyes"; then echo " Use system zlib : yes (recommended: no, slower access)" else echo " Use system zlib : no (recommended: no)" fi if test "x$use_system_bzlib" = "xyes"; then echo " Use system bzlib : yes (recommended: no, slower access)" else echo " Use system bzlib : no (recommended: no)" fi if test "x$use_liblzma" = "xyes"; then echo " Use liblzma : yes (recommended: yes)" else echo " Use liblzma : no (recommended: yes)" fi echo "" echo " Installation prefix : $prefix" echo ""