davfs2-1.5.2/0000755000175000017500000000000012376155302007711 500000000000000davfs2-1.5.2/configure.ac0000644000175000017500000000523512376154063012127 00000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. # Copyright (C) 2006, 2007, 2008, 2009, 2010, 2014 Werner Baumann # # This file is part of davfs2. # # davfs2 is free software; you can 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. # # davfs2 is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with davfs2; if not, write to the Free Software Foundation, # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ AC_PREREQ(2.59) AC_INIT(davfs2, 1.5.2, http://savannah.nongnu.org/projects/davfs2) AC_CONFIG_SRCDIR([src/cache.c]) AC_CONFIG_AUX_DIR([config]) AM_INIT_AUTOMAKE AC_CONFIG_HEADER([config.h]) # Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_PROG_LN_S # Checks for libraries. AM_GNU_GETTEXT_VERSION(0.18.1) AM_GNU_GETTEXT([external]) NE_REQUIRE_VERSIONS([0], [27 28 29 30]) DAV_CHECK_NEON # Checks for header files. AC_HEADER_DIRENT AC_HEADER_STDC AC_CHECK_HEADERS([fcntl.h libintl.h langinfo.h limits.h locale.h mntent.h stddef.h stdint.h stdlib.h string.h sys/file.h sys/mount.h sys/time.h syslog.h termios.h unistd.h utime.h]) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_UID_T AC_C_INLINE AC_TYPE_INT16_T AC_TYPE_INT32_T AC_TYPE_INT8_T AC_TYPE_MODE_T AC_TYPE_OFF_T AC_TYPE_PID_T AC_TYPE_SIZE_T AC_TYPE_SSIZE_T AC_CHECK_MEMBERS([struct stat.st_blksize]) AC_HEADER_TIME AC_STRUCT_TM AC_TYPE_UINT32_T AC_TYPE_UINT64_T AC_C_VOLATILE AC_CHECK_SIZEOF([void *]) # Checks for library functions. AC_FUNC_CHOWN AC_FUNC_CLOSEDIR_VOID AC_FUNC_ERROR_AT_LINE AC_FUNC_FORK AC_FUNC_GETGROUPS AC_FUNC_GETMNTENT AC_PROG_GCC_TRADITIONAL AC_HEADER_MAJOR AC_FUNC_MALLOC AC_FUNC_SELECT_ARGTYPES AC_FUNC_STRFTIME AC_FUNC_STAT AC_FUNC_UTIME_NULL AC_CHECK_FUNCS([endpwent ftruncate getmntent memset mkdir nl_langinfo rpmatch select setlocale strcasecmp strchr strdup strerror strpbrk strrchr strstr strtol strtoull utime]) # Misc. DAV_DEFAULTS DAV_LFS DAV_LINGUAS([de]) AC_DEFINE([_GNU_SOURCE], 1, [Define to enable GNU extensions]) AC_CONFIG_FILES([Makefile po/Makefile.in etc/Makefile man/Makefile man/de/Makefile man/es/Makefile src/Makefile]) AC_OUTPUT DAV_MESSAGE davfs2-1.5.2/src/0000755000175000017500000000000012376155302010500 500000000000000davfs2-1.5.2/src/cache.h0000644000175000017500000004140312371716575011650 00000000000000/* cache.h: directory and file cache. Copyright (C) 2006, 2007, 2008, 2009, 2014 Werner Baumann This file is part of davfs2. davfs2 is free software; you can 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. davfs2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with davfs2; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef DAV_CACHE_H #define DAV_CACHE_H /* Constants */ /*===========*/ /* A mask to separate access bits from mode. */ #define DAV_A_MASK (S_IRWXU | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX) /* Data Types */ /*============*/ /* File descriptors for open files are stored within a dav_node in a linked list. As coda does not return the file descriptor when closing a file, this data structure contains additional information to identify the appropriate file descriptor. */ typedef struct dav_handle dav_handle; struct dav_handle { dav_handle *next; /* Next in the list. */ int fd; /* File descriptor of the open file. */ int flags; /* Access mode flags only. */ pid_t pid; /* id of requesting process. */ pid_t pgid; /* Group id of requesting process. */ uid_t uid; /* User id of requesting process. */ }; /* A node in the cache. It represents a directory or a regular file. Nodes that are direct childs of the same directory-node are linked together by the next-pointer to a linked list. The hierarchical directory structure is formed by pointers to the parent direcotry and to the first member in the linked list of direct childs. Nodes are also stored in a hash table. The hash is derived from the nodes address. Nodes with the same hash value are linked together by table_next. */ typedef struct dav_node dav_node; struct dav_node { /* The parent directory. */ dav_node *parent; /* The first node in the linked list of childs. Will be NULL for files.*/ dav_node *childs; /* The next node in the linked list of childs. */ dav_node *next; /* The next node in the linked list of nodes with the same hash value. */ dav_node *table_next; /* The unescaped absolute path of the resource on the server. This must conform to RFC 2518. For collections it must have a trailing slash, for non-collections it must not have one. */ char *path; /* The name of the node (not path) without leading or trailing slash. The name of the root node is the empty string. Name may be different from the last component of path if the servers uses display-names. */ char *name; /* Path of the file where the contents of the node is cached. These files are only created when needed, and they are deleted when there is information that the contents is no langer valid. So cache_path may be NULL. For directories: A file containing the directory entries. For regular files: A local copy of the file. File times are set according the values from the server when the file is downloaded. As long as the file is cached only dav_set_attr() may changed file attributes directly, but they may be changed by open, read, write and close. */ char *cache_path; /* Etag from the server. Set when the resource is downloaded. Used for conditional GET requests and to detect whether a resource has been changed remotely. If present it overrides information from the Last-Modified time (smtime). */ char *etag; /* The media-type as in HTTP-header Content-Type. */ dav_handle *handles; /* Size of the contents of the node. Files: Initially set to the value of the content-lenght header. When the file is open it is updated to the size of the cached file. Directories: Size of the file containing the directory entries. */ off_t size; /* Initially set to the value of mtime. Updated by some upcalls Files: When a local copy exists its atime is also used for update. */ time_t atime; /* Initially set to the last-modified time from the server, or the system time if created locally. Files: When a local cache file exists updated to mtime of this cache file. Used to evaluate whether a file is dirty. */ time_t mtime; /* Initially set to the value of mtime. Updated by dav_setattr(). */ time_t ctime; /* Files: Last-modified time from the server. Like etag frozen when the file is opened for writing. Used to check whether the file has been changed remotely. */ time_t smtime; /* Time when the node has last been updated from the server. */ time_t utime; /* Files: Time when the lock expires. 0 if not locked. -1 locked infinitely. */ time_t lock_expire; /* Directories: Number of subdirectories, including "." and "..". Files: Allways 1. */ int nref; /* Files: File exists on the server. For locally created files that have not been put to the server it will be 0. Note: Some server create an empty file when locking. Maybe the RFC will be changed this way. */ int remote_exists; /* Files: Dirty flag. Must be set, when a file is opened for writing, and reset, when the file is saved back. */ int dirty; /* mode, uid and gid are initially set to the default values, but may be changed by dav_setattr(). */ mode_t mode; uid_t uid; gid_t gid; }; /* An item in a linked list. Each item holds a pointer to a dav_node.*/ typedef struct dav_node_item dav_node_list_item; struct dav_node_item { dav_node_list_item *next; dav_node *node; int attempts; time_t save_at; }; /* Returned by dav_statfs(). */ typedef struct dav_stat dav_stat; struct dav_stat { uint64_t blocks; uint64_t bavail; uint64_t files; uint64_t ffree; uint64_t n_nodes; off_t bsize; off_t namelen; time_t utime; }; /* Call back function that writes a directory entry to file descriptor fd. fd : An open file descriptor to write to. off : The current file size. node : The pointer to node is taken as inode/file number (shrinked to fit if necessary). name : File name; if NULL, the last, empty entry is written (if the kernel file system wants one). return value : New size of the file. -1 in case of an error. */ typedef off_t (*dav_write_dir_entry_fn)(int fd, off_t off, const dav_node *node, const char *name); /* Function prototypes */ /*=====================*/ /* Initializing and closing the cache. */ /* Sets a lot of private global variables that govern the behaviour of the cache, taking the values from parameters. It registers dummy functions for the callbacks from kernel interface. Creates the root node and restores the nodes from the permanent cache. Finally it retrieves the root directory entries from the server. If the connection to the server fails because of authentication failure it prints an error message and terminates the programm. If the connection fails due to other reasons, it will nevertheless return with success, as the filesystem can be mounted, but will only get useable when the connection comes up. paramters: if not self explaining, please see mount_davfs.c, struct args. */ void dav_init_cache(const dav_args *args, const char *mpoint); /* Tries to write back to the server all open files that have been changed or newly created. If a file from cache can not be stored back to the server, a local backup file is created. All local copies of files and the necessary directories are stored in the permanent cache. A new index file of the permanent cache is created. If *got_sigterm is 1, dirty files will not be stored back to the server. Finally it frees all nodes. */ void dav_close_cache(volatile int *got_sigterm); /* Registers the kernel_interface. Sets pointers to the write_dir_entry_fn flush_flag. If blksize is not NULL, the preferred bloksize for IO is asigned. It returns the value of alignment. */ size_t dav_register_kernel_interface(dav_write_dir_entry_fn write_fn, int *flush_flag, unsigned int *blksize); /* Scans the hash table for file nodes to be saved them back on the server, locks to be refreshed and locks to be released. If maximum cache size is reached, it removes the file with the lowest access time from the cache. It must be called regularly. The return value indicates whether another run would be useful. return value: 0 there is nothing left to do. 1 another call of dav_tidy_cache would be useful. */ int dav_tidy_cache(void); /* Upcalls from the kernel, via the interface module. */ /* All these functions will first check if the node addressed in the parameters exists. Common parameters (not all of this must be present in one function): dav_node **nodep : Used to return a pointer to a node. dav_node *node : A pointer to the node that shall be acted on. dav_node *parent : A pointer to the parent directory of the node in question. const char *name : Name of the node in question. It's is just one name, not a path, and without any trailing or leading slashes. uid_t uid : ID of the user that requested the operation. Common return values: 0 Success. EACCES Access is denied to user uid according to the acces bits. EAGAIN A temporary failure in the connection to the WebDAV server. EBUSY The action on the node can not be performed, as somebody else uses it allready in a way that would collide with the requested action. EEXIST Cration of a new node is requested with flag O_EXCL, but it exists. EINVAL One of the parameters has an invalid value. EIO Error performing I/O-operation. Usually there are problems in the communication with the WebDAV server. EISDIR The node is a directory but should not be. ENOENT The file or directory does not exist. ENOSPC There is not enough space on the server. ENOTDIR The node is not a directory but the requested action needs it to be. EPERM The reuested action is not allowed to user uid. */ /* Tests whether user uid has access described by how to node. int how : A bit mask describing the kind of acces. It may be any combination of R_OK, W_OK, X_OK and F_OK. */ int dav_access(dav_node *node, uid_t uid, int how); /* Closed file descriptor fd of node. Permissions are not checked, but flags are compared to the ones used for opening. If fd is 0 (coda), flags, pid and pgid are used to find the best matching file descriptor. Only access mode bits must be set in flags.*/ int dav_close(dav_node *node, int fd, int flags, pid_t pid, pid_t pgid); /* Creates a new file node with name name in directory parent. The file is locked on the server. The new node is returned in nodep. There must no node with name name allready exist in parent. The new node is owned by uid; group is the primary group of uid. Mode is set to mode, but with the bits from file_umask removed. Permissions: uid must have execute permission for parent and all of its ancestors, as well as write permission for parent. */ int dav_create(dav_node **nodep, dav_node *parent, const char *name, uid_t uid, mode_t mode); /* Checks whether node exists and uid has permissions. The kernel interface may then translate attributes from node. Permissions: uid must have execute permission for parent and all of its ancestors, as well as read permission for parent. */ int dav_getattr(dav_node *node, uid_t uid); /* Searches for a node with name name in the directory parent and returns the node in nodep. Permissions: uid must have execute permission for parent and all of its ancestors, as well as read permission for parent. */ int dav_lookup(dav_node **nodep, dav_node *parent, const char *name, uid_t uid); /* Creates a new directory named name in direcotry parent. The directory must not yet exist. The new node is returned in nodep. Owner will be uid, group the primary group of uid. Mode will be mode with the bits from dir_umask removed. Permissions: uid must have execute permission for parent and all of its ancestors, as well as write permission for parent. */ int dav_mkdir(dav_node **nodep, dav_node *parent, const char *name, uid_t uid, mode_t mode); /* Opens file or directory node according to flags and returns file descriptor fd. fd, together with pid, pgid and uid, is stored in node for read, write and close operations. Only the O_ACCESSMOE, O_APPEND and O_TRUNC bits in flags will be honoured. O_CREATE and O_EXCL are not allowed. Permissions: uid must have execute permission for parent and all of its ancestors, as as well as read and/or write permission for node, according to the accessmode. If open_create is set to 1, permissions will not be checked. This flag must only be set when the call to dav_open is part of an open-call with flag O_CREATE. It allows dav_open to succeed if when the file mode would not allow this. */ int dav_open(int *fd, dav_node *node, int flags, pid_t pid, pid_t pgid, uid_t uid, int open_create); /* Reads size bytes from file descriptor fd, starting at position offset and copies them into buf. The number of bytes read is returned in len. The file must be opened readonly or readwrite. */ int dav_read(ssize_t *len, dav_node * node, int fd, char *buf, size_t size, off_t offset); /* Removes file node name in directory parent from the cache and on the server. The file must not be locked by another WebDAV client. Permissions: uid must have execute permission for parent and all of its ancestors, as well as write permission for parent. */ int dav_remove(dav_node *parent, const char *name, uid_t uid); /* Moves file or directory src_name from directory src_parent to directory dst_parent and renames it to dst_name. If dst_name allready exists in dst_parent and is a directory, there must be no files opened for writing in it. Moves into the backup directory are not allowed. Permissions: uid must have execute permission for src_parent and dst_parent and all of their ancestors, as well as write permission for src_parent and dst_parent. */ int dav_rename(dav_node *src_parent, const char *src_name, dav_node *dst_parent, const char *dst_name, uid_t uid); /* Removes direcotry name in directory parent. The directory must be empty and not the local backup directory. uid must have execute permission for parent and all of its ancestors, as well as write permission for parent. */ int dav_rmdir(dav_node *parent, const char *name, uid_t uid); /* Returns a pointer to the root node in nodep. Permissions: uid must be root, as this function is only called when the file system is mounted. */ int dav_root(dav_node **nodep, uid_t uid); /* Changes attributes of the node. sm, so, ... are flags. A value of 1 indicates that the respective attribute is to be changed. Permissions: uid must have execute permission for parent directory of node and all of its ancestors. To change mode, owner, or gid, uid must be owner of the node or root. To change atime, mtime or size, uid must have write permission for node. To change gid, uid must be member of the new group or root. Note: This attributes, except size and the execute bit of mode, are only changed locally and not on the server. */ int dav_setattr(dav_node *node, uid_t uid, int sm, mode_t mode, int so, uid_t owner, int sg, gid_t gid, int sat, time_t atime, int smt, time_t mtime, int ssz, off_t size); /* Returns struct dav_stat. If the server does not provide theinformation it will contain fake data. No permissions necessary. */ dav_stat * dav_statfs(void); /* Calls fsync() for all filedescriptors of node, that are not read only. No permissions are checked. */ int dav_sync(dav_node *node); /* Writes size bytes from buf to file descriptor fd, starting at position offset. The number of bytes written is returned in len. The file must be opened writeonly or readwrite. */ int dav_write(size_t *written, dav_node * node, int fd, char *buf, size_t size, off_t offset); #endif /* DAV_CACHE_H */ davfs2-1.5.2/src/webdav.h0000644000175000017500000002655212361545743012061 00000000000000/* webdav.h: send requests to the WebDAV server. Copyright (C) 2006, 2007, 2008, 2009 Werner Baumann This file is part of davfs2. davfs2 is free software; you can 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. davfs2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with davfs2; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef DAV_WEBDAV_H #define DAV_WEBDAV_H /* Data Types */ /*============*/ /* This structure holds the properties retrieved from the server. Usually a linked list of these is returned by dav_get_collection(). Unused pointers should be set to NULL, integer types to 0. */ typedef struct dav_props dav_props; struct dav_props { char *path; /* The unescaped path of the resource. */ char *name; /* The name of the file or directory. Only the last component (no path), no slashes. */ char *etag; /* The etag string, including quotation characters, but without the mark for weak etags. */ off_t size; /* File size in bytes (regular files only). */ time_t mtime; /* Date of last modification. */ int is_dir; /* Boolean; 1 if a directory. */ int is_exec; /* -1 if not specified; 1 is executeable; 0 not executeable. */ dav_props *next; /* Next in the list. */ }; /* Function prototypes */ /*=====================*/ /* Creates and initializes a neon_session, using configuration information given as parameters, and checks the WebDAV class of the server. If the server does not support class 2, locking is disabled. It must only be initialized once, as it depends on global variables. If an error occurs, the program is terminated. paramters: if not self explaining, please see mount_davfs.h, struct args. */ void dav_init_webdav(const dav_args* args); /* Does an OPTIONS request to check the server capabilities. In case of success it will set the global variable initialized. If the server does not support locks, it will remove the lockstore and set locks to NULL. path : Path to the root collection. return value : 0 on success or an apropriate error code. */ int dav_init_connection(const char *path); /* Releases all locks (if possible) and closes the session. Does not free memory held by the session. */ void dav_close_webdav(void); /* Converts the character encoding of s from and to the local encoding. Converter handles are taken from global variables from_utf_8, to_utf_8, from_server_enc and to_server_enc. If no conversion is necessary, it just returns a copy of s. name : string to be converted. return value : the converted string, newly allocated. */ char * dav_conv_from_utf_8(const char *s); char * dav_conv_to_utf_8(const char *s); char * dav_conv_from_server_enc(const char *s); char * dav_conv_to_server_enc(const char *s); /* Deletes file path on the server. On success locks for this file are removed from the lock store. path : Absolute path of the file. expire : If not 0, the resource is assumed to be locked and the lock will be removed after successful delete. return value : 0 on success; an appropriate file error code otherwise. */ int dav_delete(const char *path, time_t *expire); /* Deletes collection path on the server. path : Absolute path of the collection. return value : 0 on success; an appropriate file error code otherwise. */ int dav_delete_dir(const char *path); /* Frees any resources held by props and finally frees props. */ void dav_delete_props(dav_props *props); /* Retrieves properties for the directory named by path and its direct childs (depth 1) from the server. The properties are returned as a linked list of dav_props. If successfull, this list contains at least one entry (the directory itself; its name is the empty string). The calling function is responsible for freeing the list and all the strings included. path : The absolute path of the directory with trailing slash. *props : Will point to the list of properties on return. NULL in case of an error. return value : 0 on success; an appropriate file error code otherwise. */ int dav_get_collection(const char *path, dav_props **props); /* Fetches file path from the server, stores it in cache_path and updates size, etag and mtime. If etag and/or mtime are supplied, a conditional GET will be performed. If the file has not been modified on the server, size, etag, mtime and mime will not be changed. If the GET request fails none of size, etag and mtime are changed. cache_path : Name of the cache file to store the file in. path : Absolute path of the file on the server. size : Points to the size of the cached file and will be updated if a new version of the file is retrieved. etag : Points to the ETag string of the cached version. If a new version of the file is retrieved this will be replaced by the new ETag value. May be NULL or point to NULL. mtime : Points to the Last-Modified value of the cached version. Will be updated if a new version of the file is retrieved. May be NULL. modified : Points to a flag that will be set 1 if the file cache_path has been replaced by a new version. May be NULL. return value : 0 on success; an appropriate file error code otherwise. Not-Modified counts as success. */ int dav_get_file(const char *path, const char *cache_path, off_t *size, char **etag, time_t *mtime, int *modified); /* Returns the error string from the last WebDAV request. Note: This will not be usefull in any case, because the last function called may have done more then one request (e.g. an additional lock discover. But it is usefull for dav_get_collection(). */ const char * dav_get_webdav_error(void); /* Tests for the existence of file path and uptdates etag, mtime and length. In case of an error etag and mtime are not changed. If the server does not send ETag or Last-Modified the corresponding value will not be changed. path : absolute path of the file on the server. etag : Points to the Etag; will be updated on success. May be NULL. length: Points to length; will be updated on success. May be NULL. mime : Points to mime_type; will be updated on success. May be NULL. return value : 0 if the file exists; an appropriate file error code otherwise. */ int dav_head(const char *path, char **etag, time_t *mtime, off_t *length); /* Locks the file path on the server with an excluse write lock and updates expire and exists. If a lock for path allready exists it will be refreshed. On success expire will be updated to the time when the lock expires. If the file does not yet exist and server creates a new file (as opposed to creating a locked-null-resource) exists will be set to 1. If the file is already locked, but not by this instance of davfs2, it will try if the lock is from the same user using davfs2, and if so, to use this lock. If it can't get a lock it will return an appropriate error code and set expire to 0. If the session is initialized with the nolocks option, it does nothing, but allways returns success and sets expire to 0. path : absolute path of the file on the server. expire : Points to the time when the lock expires. 0 if not locked. Will be updated. exists : Indicates whether the file exists on the server. If the server responds with "201 CREATED", it will be set to 1. return value : 0 on success; an appropriate file error code otherwise. */ int dav_lock(const char *path, time_t *expire, int *exists); /* Refreshes the lock for file path and updates expire. If no lock can be found for path expire is set to 0. If it can't refresh the lock it will do nothing. path : Absolute path of the file on the server. expire : The time when the lock expires, will be updated. */ void dav_lock_refresh(const char *path, time_t *expire); /* Creates a new collection on the server. path : Absolute path of the new collection on the server. return value : 0 on success; an appropriate file error code otherwise. */ int dav_make_collection(const char *path); /* Moves resource src to the new name/location dst. src : Absolute path of the resource on the server. dst : New absolute path of the resource on the server. return value : 0 on success; an appropriate file error code otherwise. */ int dav_move(const char *src, const char *dst); /* Stores the contents of file cache_path on the server location path and updates the value of exists, etag and mtime. Before uploading the file it tests whether the file on the server has been changed (compared to the values of exists, etag and mtime). If it has been changed the file will *not* be uploaded and an error returned instead. Sometimes a lock may be discovered during dav_put(). In this case expire will be updated. path : Absolute path of the file on the server. cache_path : Name of the local file to be stored on the server. exists : Indicates whether the file exists on the server. Used to check for changes on the server. If the upload is successful it will be set to 1. etag : The value of ETag used to check for changes on the server. Updated on success. May be NULL. mime : The value of mime_type. Updated on successMay be NULL. If a mime_type is set, the Content-Type header will be sent. execute : if 1 set execute property, else no change of execute property. return value : 0 on success; an appropriate file error code otherwise. */ int dav_put(const char *path, const char *cache_path, int *exists, time_t *expire, char **etag, time_t *mtime, int execute); /* Makes a PROPFIND request for path to get quota information (RFC 4331) and places them in available and used. If quota information is not available, an error is returned and available and used are not changed. */ int dav_quota(const char *path, uint64_t *available, uint64_t *used); /* Sets or resets the execute property of file path. path : Absolute path of the file on the server. set : boolean value; 0 reset execute property; 1 set execute property. */ int dav_set_execute(const char *path, int set); /* Tells webdav that no more terminal is available, so errors can only * be logged. Before this function is invoced webdav tries to * communicate with the user when problems occur. */ void dav_set_no_terminal(void); /* Releases the lock on file path on the serverand sets expire to 0. path : Absolute path of the file on the server. return value : 0 if no error occured; an appropriate file error code otherwise. */ int dav_unlock(const char *path, time_t *expire); #endif /* DAV_WEBDAV_H */ davfs2-1.5.2/src/coda.h0000644000175000017500000003560211171165021011474 00000000000000/* This header file was taken from Linux kernel 2.6.18. From the two alternative licences the Carnegie Mellon University specific licence has been chosen. Definitions intended for use by the kernel and not for userspace, old API definitions and other parts unused by davfs2 have been removed. Modifications by Werner Baumann, 2009-04-14. */ /* Coda: an Experimental Distributed File System Release 4.0 Copyright (c) 1987-1999 Carnegie Mellon University All Rights Reserved Permission to use, copy, modify and distribute this software and its documentation is hereby granted, provided that both the copyright notice and this permission notice appear in all copies of the software, derivative works or modified versions, and any portions thereof, and that both notices appear in supporting documentation, and that credit is given to Carnegie Mellon University in all documents and publicity pertaining to direct or indirect use of this code or its derivatives. CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS, SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF ANY DERIVATIVE WORK. Carnegie Mellon encourages users of this software to return any improvements or extensions that they make, and to grant Carnegie Mellon the rights to redistribute these changes without encumbrance. */ /* * * Based on cfs.h from Mach, but revamped for increased simplicity. * Linux modifications by * Peter Braam, Aug 1996 */ #ifndef _CODA_HEADER_ #define _CODA_HEADER_ #define cdev_t dev_t #ifndef __BIT_TYPES_DEFINED__ #define __BIT_TYPES_DEFINED__ typedef signed char int8_t; typedef unsigned char u_int8_t; typedef short int16_t; typedef unsigned short u_int16_t; typedef int int32_t; typedef unsigned int u_int32_t; #endif /* * Cfs constants */ #define CODA_MAXNAMLEN 255 #define CODA_MAXPATHLEN 1024 #define CODA_MAXSYMLINK 10 /* these are Coda's version of O_RDONLY etc combinations * to deal with VFS open modes */ #define C_O_READ 0x001 #define C_O_WRITE 0x002 #define C_O_TRUNC 0x010 #define C_O_EXCL 0x100 #define C_O_CREAT 0x200 /* these are to find mode bits in Venus */ #define C_M_READ 00400 #define C_M_WRITE 00200 /* for access Venus will use */ #define C_A_C_OK 8 /* Test for writing upon create. */ #define C_A_R_OK 4 /* Test for read permission. */ #define C_A_W_OK 2 /* Test for write permission. */ #define C_A_X_OK 1 /* Test for execute permission. */ #define C_A_F_OK 0 /* Test for existence. */ #ifndef _VENUS_DIRENT_T_ #define _VENUS_DIRENT_T_ 1 struct venus_dirent { u_int32_t d_fileno; /* file number of entry */ u_int16_t d_reclen; /* length of this record */ u_int8_t d_type; /* file type, see below */ u_int8_t d_namlen; /* length of string in d_name */ char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */ }; #undef DIRSIZ #define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \ (((dp)->d_namlen+1 + 3) &~ 3)) /* * File types */ #define CDT_UNKNOWN 0 #define CDT_FIFO 1 #define CDT_CHR 2 #define CDT_DIR 4 #define CDT_BLK 6 #define CDT_REG 8 #define CDT_LNK 10 #define CDT_SOCK 12 #define CDT_WHT 14 /* * Convert between stat structure types and directory types. */ #define IFTOCDT(mode) (((mode) & 0170000) >> 12) #define CDTTOIF(dirtype) ((dirtype) << 12) #endif #ifndef _VUID_T_ #define _VUID_T_ typedef u_int32_t vuid_t; typedef u_int32_t vgid_t; #endif /*_VUID_T_ */ struct CodaFid { u_int32_t opaque[4]; }; #define coda_f2i(fid)\ (fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0) #ifndef _VENUS_VATTR_T_ #define _VENUS_VATTR_T_ /* * Vnode types. VNON means no type. */ enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD }; struct coda_vattr { long va_type; /* vnode type (for create) */ u_short va_mode; /* files access mode and type */ short va_nlink; /* number of references to file */ vuid_t va_uid; /* owner user id */ vgid_t va_gid; /* owner group id */ long va_fileid; /* file id */ u_quad_t va_size; /* file size in bytes */ long va_blocksize; /* blocksize preferred for i/o */ struct timespec va_atime; /* time of last access */ struct timespec va_mtime; /* time of last modification */ struct timespec va_ctime; /* time file changed */ u_long va_gen; /* generation number of file */ u_long va_flags; /* flags defined for file */ cdev_t va_rdev; /* device special file represents */ u_quad_t va_bytes; /* bytes of disk space held by file */ u_quad_t va_filerev; /* file modification number */ }; #endif /* structure used by CODA_STATFS for getting cache information from venus */ struct coda_statfs { int32_t f_blocks; int32_t f_bfree; int32_t f_bavail; int32_t f_files; int32_t f_ffree; }; /* * Kernel <--> Venus communications. */ #define CODA_ROOT 2 #define CODA_OPEN_BY_FD 3 #define CODA_OPEN 4 #define CODA_CLOSE 5 #define CODA_IOCTL 6 #define CODA_GETATTR 7 #define CODA_SETATTR 8 #define CODA_ACCESS 9 #define CODA_LOOKUP 10 #define CODA_CREATE 11 #define CODA_REMOVE 12 #define CODA_LINK 13 #define CODA_RENAME 14 #define CODA_MKDIR 15 #define CODA_RMDIR 16 #define CODA_SYMLINK 18 #define CODA_READLINK 19 #define CODA_FSYNC 20 #define CODA_VGET 22 #define CODA_SIGNAL 23 #define CODA_REPLACE 24 /* DOWNCALL */ #define CODA_FLUSH 25 /* DOWNCALL */ #define CODA_PURGEUSER 26 /* DOWNCALL */ #define CODA_ZAPFILE 27 /* DOWNCALL */ #define CODA_ZAPDIR 28 /* DOWNCALL */ #define CODA_PURGEFID 30 /* DOWNCALL */ #define CODA_OPEN_BY_PATH 31 #define CODA_RESOLVE 32 #define CODA_REINTEGRATE 33 #define CODA_STATFS 34 #define CODA_STORE 35 #define CODA_RELEASE 36 #define CODA_NCALLS 37 #define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID) #define VC_MAXDATASIZE 8192 #define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\ VC_MAXDATASIZE #define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t) #define CODA_KERNEL_VERSION 3 /* 128-bit file identifiers */ /* * Venus <-> Coda RPC arguments */ struct coda_in_hdr { u_int32_t opcode; u_int32_t unique; /* Keep multiple outstanding msgs distinct */ pid_t pid; pid_t pgid; vuid_t uid; }; /* Really important that opcode and unique are 1st two fields! */ struct coda_out_hdr { u_int32_t opcode; u_int32_t unique; u_int32_t result; }; /* coda_root: NO_IN */ struct coda_root_out { struct coda_out_hdr oh; struct CodaFid VFid; }; struct coda_root_in { struct coda_in_hdr in; }; /* coda_open: */ struct coda_open_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_open_out { struct coda_out_hdr oh; cdev_t dev; ino_t inode; }; /* coda_store: */ struct coda_store_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_store_out { struct coda_out_hdr out; }; /* coda_release: */ struct coda_release_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_release_out { struct coda_out_hdr out; }; /* coda_close: */ struct coda_close_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_close_out { struct coda_out_hdr out; }; /* coda_ioctl: */ struct coda_ioctl_in { struct coda_in_hdr ih; struct CodaFid VFid; int cmd; int len; int rwflag; char *data; /* Place holder for data. */ }; struct coda_ioctl_out { struct coda_out_hdr oh; int len; caddr_t data; /* Place holder for data. */ }; /* coda_getattr: */ struct coda_getattr_in { struct coda_in_hdr ih; struct CodaFid VFid; }; struct coda_getattr_out { struct coda_out_hdr oh; struct coda_vattr attr; }; /* coda_setattr: NO_OUT */ struct coda_setattr_in { struct coda_in_hdr ih; struct CodaFid VFid; struct coda_vattr attr; }; struct coda_setattr_out { struct coda_out_hdr out; }; /* coda_access: NO_OUT */ struct coda_access_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_access_out { struct coda_out_hdr out; }; /* lookup flags */ #define CLU_CASE_SENSITIVE 0x01 #define CLU_CASE_INSENSITIVE 0x02 /* coda_lookup: */ struct coda_lookup_in { struct coda_in_hdr ih; struct CodaFid VFid; int name; /* Place holder for data. */ int flags; }; struct coda_lookup_out { struct coda_out_hdr oh; struct CodaFid VFid; int vtype; }; /* coda_create: */ struct coda_create_in { struct coda_in_hdr ih; struct CodaFid VFid; struct coda_vattr attr; int excl; int mode; int name; /* Place holder for data. */ }; struct coda_create_out { struct coda_out_hdr oh; struct CodaFid VFid; struct coda_vattr attr; }; /* coda_remove: NO_OUT */ struct coda_remove_in { struct coda_in_hdr ih; struct CodaFid VFid; int name; /* Place holder for data. */ }; struct coda_remove_out { struct coda_out_hdr out; }; /* coda_link: NO_OUT */ struct coda_link_in { struct coda_in_hdr ih; struct CodaFid sourceFid; /* cnode to link *to* */ struct CodaFid destFid; /* Directory in which to place link */ int tname; /* Place holder for data. */ }; struct coda_link_out { struct coda_out_hdr out; }; /* coda_rename: NO_OUT */ struct coda_rename_in { struct coda_in_hdr ih; struct CodaFid sourceFid; int srcname; struct CodaFid destFid; int destname; }; struct coda_rename_out { struct coda_out_hdr out; }; /* coda_mkdir: */ struct coda_mkdir_in { struct coda_in_hdr ih; struct CodaFid VFid; struct coda_vattr attr; int name; /* Place holder for data. */ }; struct coda_mkdir_out { struct coda_out_hdr oh; struct CodaFid VFid; struct coda_vattr attr; }; /* coda_rmdir: NO_OUT */ struct coda_rmdir_in { struct coda_in_hdr ih; struct CodaFid VFid; int name; /* Place holder for data. */ }; struct coda_rmdir_out { struct coda_out_hdr out; }; /* coda_symlink: NO_OUT */ struct coda_symlink_in { struct coda_in_hdr ih; struct CodaFid VFid; /* Directory to put symlink in */ int srcname; struct coda_vattr attr; int tname; }; struct coda_symlink_out { struct coda_out_hdr out; }; /* coda_readlink: */ struct coda_readlink_in { struct coda_in_hdr ih; struct CodaFid VFid; }; struct coda_readlink_out { struct coda_out_hdr oh; int count; caddr_t data; /* Place holder for data. */ }; /* coda_fsync: NO_OUT */ struct coda_fsync_in { struct coda_in_hdr ih; struct CodaFid VFid; }; struct coda_fsync_out { struct coda_out_hdr out; }; /* coda_vget: */ struct coda_vget_in { struct coda_in_hdr ih; struct CodaFid VFid; }; struct coda_vget_out { struct coda_out_hdr oh; struct CodaFid VFid; int vtype; }; /* CODA_SIGNAL is out-of-band, doesn't need data. */ /* CODA_INVALIDATE is a venus->kernel call */ /* CODA_FLUSH is a venus->kernel call */ /* coda_purgeuser: */ /* CODA_PURGEUSER is a venus->kernel call */ struct coda_purgeuser_out { struct coda_out_hdr oh; vuid_t uid; }; /* coda_zapfile: */ /* CODA_ZAPFILE is a venus->kernel call */ struct coda_zapfile_out { struct coda_out_hdr oh; struct CodaFid CodaFid; }; /* coda_zapdir: */ /* CODA_ZAPDIR is a venus->kernel call */ struct coda_zapdir_out { struct coda_out_hdr oh; struct CodaFid CodaFid; }; /* coda_purgefid: */ /* CODA_PURGEFID is a venus->kernel call */ struct coda_purgefid_out { struct coda_out_hdr oh; struct CodaFid CodaFid; }; /* coda_replace: */ /* CODA_REPLACE is a venus->kernel call */ struct coda_replace_out { /* coda_replace is a venus->kernel call */ struct coda_out_hdr oh; struct CodaFid NewFid; struct CodaFid OldFid; }; /* coda_open_by_fd: */ struct coda_open_by_fd_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_open_by_fd_out { struct coda_out_hdr oh; int fd; }; /* coda_open_by_path: */ struct coda_open_by_path_in { struct coda_in_hdr ih; struct CodaFid VFid; int flags; }; struct coda_open_by_path_out { struct coda_out_hdr oh; int path; }; /* coda_statfs: NO_IN */ struct coda_statfs_in { struct coda_in_hdr in; }; struct coda_statfs_out { struct coda_out_hdr oh; struct coda_statfs stat; }; union inputArgs { struct coda_in_hdr ih; /* NB: every struct below begins with an ih */ struct coda_open_in coda_open; struct coda_store_in coda_store; struct coda_release_in coda_release; struct coda_close_in coda_close; struct coda_ioctl_in coda_ioctl; struct coda_getattr_in coda_getattr; struct coda_setattr_in coda_setattr; struct coda_access_in coda_access; struct coda_lookup_in coda_lookup; struct coda_create_in coda_create; struct coda_remove_in coda_remove; struct coda_link_in coda_link; struct coda_rename_in coda_rename; struct coda_mkdir_in coda_mkdir; struct coda_rmdir_in coda_rmdir; struct coda_symlink_in coda_symlink; struct coda_readlink_in coda_readlink; struct coda_fsync_in coda_fsync; struct coda_vget_in coda_vget; struct coda_open_by_fd_in coda_open_by_fd; struct coda_open_by_path_in coda_open_by_path; struct coda_statfs_in coda_statfs; }; union outputArgs { struct coda_out_hdr oh; /* NB: every struct below begins with an oh */ struct coda_root_out coda_root; struct coda_open_out coda_open; struct coda_ioctl_out coda_ioctl; struct coda_getattr_out coda_getattr; struct coda_lookup_out coda_lookup; struct coda_create_out coda_create; struct coda_mkdir_out coda_mkdir; struct coda_readlink_out coda_readlink; struct coda_vget_out coda_vget; struct coda_purgeuser_out coda_purgeuser; struct coda_zapfile_out coda_zapfile; struct coda_zapdir_out coda_zapdir; struct coda_purgefid_out coda_purgefid; struct coda_replace_out coda_replace; struct coda_open_by_fd_out coda_open_by_fd; struct coda_open_by_path_out coda_open_by_path; struct coda_statfs_out coda_statfs; }; union coda_downcalls { /* CODA_INVALIDATE is a venus->kernel call */ /* CODA_FLUSH is a venus->kernel call */ struct coda_purgeuser_out purgeuser; struct coda_zapfile_out zapfile; struct coda_zapdir_out zapdir; struct coda_purgefid_out purgefid; struct coda_replace_out replace; }; /* Data passed to mount */ #define CODA_MOUNT_VERSION 1 struct coda_mount_data { int version; int fd; /* Opened device */ }; #endif davfs2-1.5.2/src/dav_fuse.c0000644000175000017500000010031212371716615012362 00000000000000/* dav_fuse.c: interface to the fuse kernel module FUSE_KERNEL_VERSION 7. Copyright (C) 2006, 2007, 2008. 2009, 2014 Werner Baumann This file is part of davfs2. davfs2 is free software; you can 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. davfs2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with davfs2; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #include #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_LIBINTL_H #include #endif #ifdef HAVE_STDDEF_H #include #endif #ifdef HAVE_STDINT_H #include #endif #include #include #include #ifdef HAVE_SYSLOG_H #include #endif #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #include "defaults.h" #include "mount_davfs.h" #include "cache.h" #include "kernel_interface.h" #include "fuse_kernel.h" #ifdef ENABLE_NLS #define _(String) gettext(String) #else #define _(String) String #endif /* Data Types */ /*============*/ /* There is no struct fuse_create_out in fuse_kernel.h. */ struct create_out { struct fuse_entry_out entry; struct fuse_open_out open; }; /* Private global variables */ /*==========================*/ /* Buffer used for communication with the kernel module (in and out). */ static size_t buf_size; static char *buf; /* fuse wants the nodeid of the root node to be 1, so we have to translate between the real nodeid and what fuse wants. */ static uint64_t root; /* Send debug messages to syslog if != 0. */ int debug; /* Private function prototypes */ /*=============================*/ /* Functions to handle upcalls fromthe kernel module. */ static uint32_t fuse_access(void); static uint32_t fuse_create(void); static uint32_t fuse_getattr(void); static uint32_t fuse_init(void); static uint32_t fuse_lookup(void); static uint32_t fuse_mkdir(void); static uint32_t fuse_mknod(void); static uint32_t fuse_open(void); static uint32_t fuse_read(void); static uint32_t fuse_release(void); static uint32_t fuse_rename(void); static uint32_t fuse_setattr(void); static uint32_t fuse_stat(void); static uint32_t fuse_write(void); /* Auxiliary functions. */ static off_t write_dir_entry(int fd, off_t off, const dav_node *node, const char *name); static void set_attr(struct fuse_attr *attr, const dav_node *node); /* Public functions */ /*==================*/ void dav_fuse_loop(int device, size_t bufsize, time_t idle_time, dav_is_mounted_fn is_mounted, volatile int *keep_on_running, int dbg) { debug = dbg; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "fuse kernel version 7"); buf_size = bufsize; buf = malloc(buf_size); if (!buf) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("can't allocate message buffer")); return; } dav_register_kernel_interface(&write_dir_entry, NULL, NULL); struct timeval tv; tv.tv_sec = idle_time; tv.tv_usec = 0; time_t last_tidy_cache = time(NULL); while (*keep_on_running) { fd_set fds; FD_ZERO(&fds); FD_SET(device, &fds); int ret = select(device + 1, &fds, NULL, NULL, &tv); if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "SELECT: %i", ret); if (ret > 0) { ssize_t bytes_read = read(device, buf, buf_size); if (bytes_read <= 0) { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "READ: %s", strerror(errno)); if (bytes_read == 0 || errno == EINTR || errno == EAGAIN || errno == ENOENT) { if (time(NULL) < (last_tidy_cache + idle_time)) { tv.tv_sec = last_tidy_cache + idle_time - time(NULL); } else { tv.tv_sec = 0; } continue; } break; } } else if (ret == 0) { if (!is_mounted()) break; if (dav_tidy_cache() == 0) { tv.tv_sec = idle_time; last_tidy_cache = time(NULL); } else { tv.tv_sec = 0; } continue; } else { break; } struct fuse_in_header *ih = (struct fuse_in_header *) buf; struct fuse_out_header *oh = (struct fuse_out_header *) buf; if (ih->nodeid == 1) ih->nodeid = root; switch (ih->opcode) { case FUSE_LOOKUP: oh->len = fuse_lookup(); break; case FUSE_FORGET: if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_FORGET: no reply"); oh->error = 0; oh->len = 0; break; case FUSE_GETATTR: oh->len = fuse_getattr(); break; case FUSE_SETATTR: oh->len = fuse_setattr(); break; case FUSE_READLINK: if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_READLINK:"); oh->error = -ENOSYS; oh->len = sizeof(struct fuse_out_header); break; case FUSE_SYMLINK: if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_SYMLINK:"); oh->error = -ENOSYS; oh->len = sizeof(struct fuse_out_header); break; case FUSE_MKNOD: oh->len = fuse_mknod(); break; case FUSE_MKDIR: oh->len = fuse_mkdir(); break; case FUSE_UNLINK: if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_UNLINK:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " p 0x%llx, %s", (unsigned long long) ih->nodeid, (char *) (buf + sizeof(struct fuse_in_header))); } oh->error = dav_remove((dav_node *) ((size_t) ih->nodeid), (char *) (buf + sizeof(struct fuse_in_header)), ih->uid); if (oh->error) oh->error *= -1; oh->len = sizeof(struct fuse_out_header); break; case FUSE_RMDIR: if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_RMDIR:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " p 0x%llx, %s", (unsigned long long) ih->nodeid, (char *) (buf + sizeof(struct fuse_in_header))); } oh->error = dav_rmdir((dav_node *) ((size_t) ih->nodeid), (char *) (buf + sizeof(struct fuse_in_header)), ih->uid); if (oh->error) oh->error *= -1; oh->len = sizeof(struct fuse_out_header); break; case FUSE_RENAME: oh->len = fuse_rename(); break; case FUSE_LINK: if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_LINK:"); oh->error = -ENOSYS; oh->len = sizeof(struct fuse_out_header); break; case FUSE_OPEN: oh->len = fuse_open(); break; case FUSE_READ: oh->len = fuse_read(); break; case FUSE_WRITE: oh->len = fuse_write(); break; case FUSE_STATFS: oh->len = fuse_stat(); break; case FUSE_RELEASE: oh->len = fuse_release(); last_tidy_cache = 0; break; case FUSE_FSYNC: if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_FSYNC:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " n 0x%llx", (unsigned long long) ih->nodeid); } oh->error = dav_sync((dav_node *) ((size_t) ih->nodeid)); if (oh->error) oh->error *= -1; oh->len = sizeof(struct fuse_out_header); break; case FUSE_SETXATTR: if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_SETXATTR:"); oh->error = -ENOSYS; oh->len = sizeof(struct fuse_out_header); break; case FUSE_GETXATTR: if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_GETXATTR:"); oh->error = -ENOSYS; oh->len = sizeof(struct fuse_out_header); break; case FUSE_LISTXATTR: if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_LISTXATTR:"); oh->error = -ENOSYS; oh->len = sizeof(struct fuse_out_header); break; case FUSE_REMOVEXATTR: if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_REMOVEXATTR:"); oh->error = -ENOSYS; oh->len = sizeof(struct fuse_out_header); break; case FUSE_FLUSH: if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_FLUSH: ignored"); oh->error = 0; oh->len = sizeof(struct fuse_out_header); break; case FUSE_INIT: oh->len = fuse_init(); break; case FUSE_OPENDIR: oh->len = fuse_open(); break; case FUSE_READDIR: oh->len = fuse_read(); break; case FUSE_RELEASEDIR: oh->len = fuse_release(); break; case FUSE_FSYNCDIR: if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_FSYNCDIR:"); oh->error = -ENOSYS; oh->len = sizeof(struct fuse_out_header); break; case FUSE_ACCESS: oh->len = fuse_access(); break; case FUSE_CREATE: oh->len = fuse_create(); break; default: if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "UNKNOWN FUSE CALL %i", ih->opcode); oh->error = -ENOSYS; oh->len = sizeof(struct fuse_out_header); break; } if (debug && oh->len) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "RET: %s", strerror(-oh->error)); ssize_t n = 0; ssize_t w = 0; while (n < oh->len && w >= 0) { w = write(device, buf + n, oh->len - n); n += w; } if (time(NULL) < (last_tidy_cache + idle_time)) { tv.tv_sec = last_tidy_cache + idle_time - time(NULL); } else { dav_tidy_cache(); tv.tv_sec = idle_time; last_tidy_cache = time(NULL); } } } /* Private functions */ /*===================*/ /* Functions to handle upcalls fromthe kernel module. The cache module only uses data types from the C-library. For file access, mode and the like it only uses symbolic constants defined in the C-library. So the main porpose of this functions is to translate from kernel specific types and constants to types and constants from the C-library, and back. All of this functions return the amount of data in buf that is to be send to the kernel module. */ static uint32_t fuse_access(void) { struct fuse_in_header *ih = (struct fuse_in_header *) buf; struct fuse_access_in *in = (struct fuse_access_in *) (buf + sizeof(struct fuse_in_header)); struct fuse_out_header *oh = (struct fuse_out_header *) buf; if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_ACCESS:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " n 0x%llx, f 0%o", (unsigned long long) ih->nodeid, in->mask); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " uid %i", ih->uid); } oh->error = dav_access((dav_node *) ((size_t) ih->nodeid), ih->uid, in->mask); if (oh->error) oh->error *= -1; return sizeof(struct fuse_out_header); } static uint32_t fuse_create(void) { struct fuse_in_header *ih= (struct fuse_in_header *) buf; struct fuse_open_in *in = (struct fuse_open_in *) (buf + sizeof(struct fuse_in_header)); char *name = buf + sizeof(struct fuse_in_header) + sizeof(struct fuse_open_in); struct fuse_out_header *oh = (struct fuse_out_header *) buf; struct create_out *out = (struct create_out *) (buf + sizeof(struct fuse_out_header)); if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_CREATE:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " n 0x%llx, f 0%o", (unsigned long long) ih->nodeid, in->flags); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " pid %i, mode 0%o", ih->pid, in->mode); } int created = 0; dav_node *node = NULL; oh->error = dav_lookup(&node, (dav_node *) ((size_t) ih->nodeid), name, ih->uid); if (!oh->error) { if (!node) { oh->error = -EIO; return sizeof(struct fuse_out_header); } else if (in->flags & O_EXCL) { oh->error = -EEXIST; return sizeof(struct fuse_out_header); } } else if (oh->error == ENOENT) { oh->error = dav_create(&node, (dav_node *) ((size_t) ih->nodeid), name, ih->uid, in->mode & DAV_A_MASK); if (oh->error || !node) { if (!oh->error) oh->error = EIO; oh->error *= -1; return sizeof(struct fuse_out_header); } created = 1; } else { oh->error *= -1; return sizeof(struct fuse_out_header); } int fd = 0; oh->error = dav_open(&fd, node, in->flags & ~(O_EXCL | O_CREAT), ih->pid, 0, ih->uid, 1); if (oh->error || !fd) { if (created) dav_remove((dav_node *) ((size_t) ih->nodeid), name, ih->uid); if (!oh->error) oh->error = EIO; oh->error *= -1; return sizeof(struct fuse_out_header); } out->entry.nodeid = (size_t) node; out->entry.generation = out->entry.nodeid; out->entry.entry_valid = 1; out->entry.attr_valid = 1; out->entry.entry_valid_nsec = 0; out->entry.attr_valid_nsec = 0; set_attr(&out->entry.attr, node); out->open.open_flags = in->flags & (O_ACCMODE | O_APPEND); out->open.fh = fd; out->open.padding = 0; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " fd %i", fd); return sizeof(struct fuse_out_header) + sizeof(struct create_out); } static uint32_t fuse_getattr(void) { struct fuse_in_header *ih = (struct fuse_in_header *) buf; struct fuse_out_header *oh = (struct fuse_out_header *) buf; struct fuse_attr_out *out = (struct fuse_attr_out *) (buf + sizeof(struct fuse_out_header)); if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_GETATTR:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " n 0x%llx", (unsigned long long) ih->nodeid); } oh->error = dav_getattr((dav_node *) ((size_t) ih->nodeid), ih->uid); if (oh->error) { oh->error *= -1; return sizeof(struct fuse_out_header); } set_attr(&out->attr, (dav_node *) ((size_t) ih->nodeid)); out->attr_valid = 1; out->attr_valid_nsec = 0; out->dummy = 0; return sizeof(struct fuse_out_header) + sizeof(struct fuse_attr_out); } static uint32_t fuse_init(void) { struct fuse_in_header *ih = (struct fuse_in_header *) buf; struct fuse_init_in *in = (struct fuse_init_in *) (buf + sizeof(struct fuse_in_header)); struct fuse_out_header *oh = (struct fuse_out_header *) buf; struct fuse_init_out *out = (struct fuse_init_out *) (buf + sizeof(struct fuse_out_header)); if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_INIT:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " version %i.%i", in->major, in->minor); } dav_node *node; oh->error = dav_root(&node, ih->uid); if (oh->error || !node) { if (!oh->error) oh->error = EIO; oh->error *= -1; return sizeof(struct fuse_out_header); } root = (size_t) node; out->major = FUSE_KERNEL_VERSION; out->minor = FUSE_KERNEL_MINOR_VERSION; out->unused[0] = 0; out->unused[1] = 0; out->unused[2] = 0; out->max_write = buf_size - sizeof(struct fuse_in_header) - sizeof(struct fuse_write_in) - 4095; return sizeof(struct fuse_out_header) + sizeof(struct fuse_init_out); } static uint32_t fuse_lookup(void) { struct fuse_in_header *ih = (struct fuse_in_header *) buf; char * name = (char *) (buf + sizeof(struct fuse_in_header)); struct fuse_out_header *oh = (struct fuse_out_header *) buf; struct fuse_entry_out *out = (struct fuse_entry_out *) (buf + sizeof(struct fuse_out_header)); if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_LOOKUP:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " p 0x%llx, %s", (unsigned long long) ih->nodeid, name); } dav_node *node = NULL; oh->error = dav_lookup(&node, (dav_node *) ((size_t) ih->nodeid), name, ih->uid); if (oh->error || !node) { if (!oh->error) oh->error = EIO; oh->error *= -1; return sizeof(struct fuse_out_header); } out->nodeid = (size_t) node; out->generation = out->nodeid; out->entry_valid = 1; out->attr_valid = 1; out->entry_valid_nsec = 0; out->attr_valid_nsec = 0; set_attr(&out->attr, node); return sizeof(struct fuse_out_header) + sizeof(struct fuse_entry_out); } static uint32_t fuse_mkdir(void) { struct fuse_in_header *ih = (struct fuse_in_header *) buf; struct fuse_mkdir_in *in = (struct fuse_mkdir_in *) (buf + sizeof(struct fuse_in_header)); char *name = (char *) (buf + sizeof(struct fuse_in_header) + sizeof(struct fuse_mkdir_in)); struct fuse_out_header *oh = (struct fuse_out_header *) buf; struct fuse_entry_out *out = (struct fuse_entry_out *) (buf + sizeof(struct fuse_out_header)); if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_MKDIR:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " p 0x%llx, %s", (unsigned long long) ih->nodeid, name); } dav_node *node = NULL; oh->error = dav_mkdir(&node, (dav_node *) ((size_t) ih->nodeid), name, ih->uid, in->mode & DAV_A_MASK); if (oh->error || !node) { if (!oh->error) oh->error = EIO; oh->error *= -1; return sizeof(struct fuse_out_header); } out->nodeid = (size_t) node; out->generation = out->nodeid; out->entry_valid = 1; out->attr_valid = 1; out->entry_valid_nsec = 0; out->attr_valid_nsec = 0; set_attr(&out->attr, node); return sizeof(struct fuse_out_header) + sizeof(struct fuse_entry_out); } static uint32_t fuse_mknod(void) { struct fuse_in_header *ih = (struct fuse_in_header *) buf; struct fuse_mknod_in *in = (struct fuse_mknod_in *) (buf + sizeof(struct fuse_in_header)); char *name = (char *) (buf + sizeof(struct fuse_in_header) + sizeof(struct fuse_mknod_in)); struct fuse_out_header *oh = (struct fuse_out_header *) buf; struct fuse_entry_out *out = (struct fuse_entry_out *) (buf + sizeof(struct fuse_out_header)); if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_MKNOD:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " p 0x%llx, m 0%o", (unsigned long long) ih->nodeid, in->mode); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " %s", name); } if (!S_ISREG(in->mode)) { oh->error = -ENOTSUP; return sizeof(struct fuse_out_header); } dav_node *node = NULL; oh->error = dav_create(&node, (dav_node *) ((size_t) ih->nodeid), name, ih->uid, in->mode & DAV_A_MASK); if (oh->error || !node) { if (!oh->error) oh->error = EIO; oh->error *= -1; return sizeof(struct fuse_out_header); } out->nodeid = (size_t) node; out->generation = out->nodeid; out->entry_valid = 1; out->attr_valid = 1; out->entry_valid_nsec = 0; out->attr_valid_nsec = 0; set_attr(&out->attr, node); return sizeof(struct fuse_out_header) + sizeof(struct fuse_entry_out); } static uint32_t fuse_open(void) { struct fuse_in_header *ih= (struct fuse_in_header *) buf; struct fuse_open_in *in = (struct fuse_open_in *) (buf + sizeof(struct fuse_in_header)); struct fuse_out_header *oh = (struct fuse_out_header *) buf; struct fuse_open_out *out = (struct fuse_open_out *) (buf + sizeof(struct fuse_out_header)); if (debug) { if (ih->opcode == FUSE_OPENDIR) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_OPENDIR:"); } else { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_OPEN:"); } syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " n 0x%llx, f 0%o", (unsigned long long) ih->nodeid, in->flags); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " pid %i, mode 0%o", ih->pid, in->mode); } int fd = 0; oh->error = dav_open(&fd, (dav_node *) ((size_t) ih->nodeid), in->flags, ih->pid, 0, ih->uid, 0); if (oh->error || !fd) { if (!oh->error) oh->error = EIO; oh->error *= -1; return sizeof(struct fuse_out_header); } out->open_flags = in->flags & (O_ACCMODE | O_APPEND); out->fh = fd; out->padding = 0; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " fd %i", fd); return sizeof(struct fuse_out_header) + sizeof(struct fuse_open_out); } static uint32_t fuse_read(void) { struct fuse_in_header *ih= (struct fuse_in_header *) buf; struct fuse_read_in *in = (struct fuse_read_in *) (buf + sizeof(struct fuse_in_header)); struct fuse_out_header *oh = (struct fuse_out_header *) buf; if (debug) { if (ih->opcode == FUSE_READDIR) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_READDIR:"); } else { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_READ:"); } syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " n 0x%llx, fd %llu", (unsigned long long) ih->nodeid, (unsigned long long) in->fh); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " pid %i", ih->pid); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " size %u, off %llu", in->size, (unsigned long long) in->offset); } if (in->size > (buf_size - sizeof(struct fuse_out_header))) { oh->error = -EINVAL; return sizeof(struct fuse_out_header); } ssize_t len; oh->error = dav_read(&len, (dav_node *) ((size_t) ih->nodeid), in->fh, buf + sizeof(struct fuse_out_header), in->size, in->offset); if (oh->error) oh->error *= -1; return len + sizeof(struct fuse_out_header); } static uint32_t fuse_release(void) { struct fuse_in_header *ih = (struct fuse_in_header *) buf; struct fuse_release_in *in = (struct fuse_release_in *) (buf + sizeof(struct fuse_in_header)); struct fuse_out_header *oh = (struct fuse_out_header *) buf; if (debug) { if (ih->opcode == FUSE_RELEASEDIR) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_RELEASEDIR:"); } else { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_RELEASE:"); } syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " n 0x%llx, f 0%o", (unsigned long long) ih->nodeid, in->flags); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " pid %i, fd %llu", ih->pid, (unsigned long long) in->fh); } oh->error = dav_close((dav_node *) ((size_t) ih->nodeid), in->fh, in->flags, ih->pid, 0); if (oh->error) oh->error *= -1; return sizeof(struct fuse_out_header); } static uint32_t fuse_rename(void) { struct fuse_in_header *ih = (struct fuse_in_header *) buf; struct fuse_rename_in *in = (struct fuse_rename_in *) (buf + sizeof(struct fuse_in_header)); char *old = (char *) (buf + sizeof(struct fuse_in_header) + sizeof(struct fuse_rename_in)); char *new = old + strlen(old) + 1; struct fuse_out_header *oh = (struct fuse_out_header *) buf; if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_RENAME:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " sp 0x%llx, %s", (unsigned long long) ih->nodeid, old); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " dp 0x%llx, %s", (unsigned long long) in->newdir, new); } if (in->newdir == 1) in->newdir = root; oh->error = dav_rename((dav_node *) ((size_t) ih->nodeid), old, (dav_node *) ((size_t) in->newdir), new, ih->uid); if (oh->error) oh->error *= -1; return sizeof(struct fuse_out_header); } static uint32_t fuse_setattr(void) { struct fuse_in_header *ih = (struct fuse_in_header *) buf; struct fuse_setattr_in *in = (struct fuse_setattr_in *) (buf + sizeof(struct fuse_in_header)); struct fuse_out_header *oh = (struct fuse_out_header *) buf; struct fuse_attr_out *out = (struct fuse_attr_out *) (buf + sizeof(struct fuse_out_header)); if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_SETATTR:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " n 0x%llx, m 0%o", (unsigned long long) ih->nodeid, in->mode); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " uid %i, gid %i", in->uid, in->gid); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " sz %llu, at %llu,", (unsigned long long) in->size, (unsigned long long) in->atime); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " mt %llu", (unsigned long long) in->mtime); } oh->error = dav_setattr((dav_node *) ((size_t) ih->nodeid), ih->uid, in->valid & FATTR_MODE, in->mode, in->valid & FATTR_UID, in->uid, in->valid & FATTR_GID, in->gid, in->valid & FATTR_ATIME, in->atime, in->valid & FATTR_MTIME, in->mtime, in->valid & FATTR_SIZE, in->size); if (oh->error) { oh->error *= -1; return sizeof(struct fuse_out_header); } set_attr(&out->attr, (dav_node *) ((size_t) ih->nodeid)); out->attr_valid = 1; out->attr_valid_nsec = 0; out->dummy = 0; return sizeof(struct fuse_out_header) + sizeof(struct fuse_attr_out); } static uint32_t fuse_stat(void) { struct fuse_out_header *oh = (struct fuse_out_header *) buf; struct fuse_statfs_out *out = (struct fuse_statfs_out *) (buf + sizeof(struct fuse_out_header)); if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_STATFS:"); dav_stat *st = dav_statfs(); if (!st) { oh->error = -ENOSYS; return sizeof(struct fuse_out_header); } out->st.blocks = st->blocks; out->st.bfree = st->bavail; out->st.bavail = st->bavail; out->st.bsize = st->bsize; out->st.files = st->files; out->st.ffree = st->ffree; out->st.namelen = st->namelen; out->st.frsize = 0; out->st.padding = 0; int i; for (i = 0; i < 6; i++) out->st.spare[i] = 0; oh->error = 0; return sizeof(struct fuse_out_header) + sizeof(struct fuse_statfs_out); } static uint32_t fuse_write(void) { struct fuse_in_header *ih= (struct fuse_in_header *) buf; struct fuse_write_in *in = (struct fuse_write_in *) (buf + sizeof(struct fuse_in_header)); struct fuse_out_header *oh = (struct fuse_out_header *) buf; struct fuse_write_out *out = (struct fuse_write_out *) (buf + sizeof(struct fuse_out_header)); if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "FUSE_WRITE:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " n 0x%llx, fd %llu", (unsigned long long) ih->nodeid, (unsigned long long) in->fh); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " pid %i, flags 0%o", ih->pid, in->write_flags); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " size %u, off %llu", in->size, (unsigned long long) in->offset); } if (in->size > (buf_size - sizeof(struct fuse_in_header) - sizeof(struct fuse_write_in))) { oh->error = -EINVAL; return sizeof(struct fuse_out_header); } size_t size; oh->error = dav_write(&size, (dav_node *) ((size_t) ih->nodeid), in->fh, buf + sizeof(struct fuse_in_header) + sizeof(struct fuse_write_in), in->size, in->offset); if (oh->error) { oh->error *= -1; return sizeof(struct fuse_out_header); } out->size = size; out->padding = 0; return sizeof(struct fuse_out_header) + sizeof(struct fuse_write_out); } /* Auxiliary functions. */ /* Writes a struct fuse_dirent to file with file descriptor fd. fd : An open file descriptor to write to. off : The current file size. name : File name; if NULL, the last, empty entry is written. return value : New size of the file. -1 in case of an error. */ static off_t write_dir_entry(int fd, off_t off, const dav_node *node, const char *name) { if (!name) return off; struct fuse_dirent entry; size_t head = offsetof(struct fuse_dirent, name); size_t reclen = (head + strlen(name) + sizeof(uint64_t) -1) & ~(sizeof(uint64_t) - 1); entry.ino = (((size_t) node) == root) ? 1 : (size_t) node; entry.off = off + reclen; entry.namelen = strlen(name); entry.type = (node->mode & S_IFMT) >> 12; size_t size = 0; ssize_t ret = 0; while (ret >= 0 && size < head) { ret = write(fd, (char *) &entry + size, head - size); size += ret; } if (size != head) return -1; ret = 0; while (ret >= 0 && size < (head + entry.namelen)) { ret = write(fd, name + size - head, entry.namelen - size + head); size += ret; } if (size != (head + entry.namelen)) return -1; ret = 0; while (ret >= 0 && size < reclen) { ret = write(fd, "\0", 1); size += ret; } if (size != reclen) return -1; return off + reclen; } static void set_attr(struct fuse_attr *attr, const dav_node *node) { attr->ino = (((size_t) node) == root) ? 1 : (size_t) node; attr->size = node->size; attr->blocks = (node->size + 511) / 512; attr->atime = node->atime; attr->mtime = node->mtime; attr->ctime = node->ctime; attr->atimensec = 0; attr->mtimensec = 0; attr->ctimensec = 0; attr->mode = node->mode; if (S_ISDIR(node->mode)) { attr->nlink = node->nref; } else { attr->nlink = 1; } attr->uid = node->uid; attr->gid = node->gid; attr->rdev = 0; } davfs2-1.5.2/src/fuse_kernel.h0000644000175000017500000001454411171165021013072 00000000000000/* This file is taken from FUSE 2.5.3. From the two alternative licences the BSD licence has been chosen. #include and #ifdef directives have been removed. Modifications by Werner Baumann, 2009-04-14. */ /* This file defines the kernel interface of FUSE */ /* Copyright (C) 2001-2006 Miklos Szeredi. 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. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``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 AUTHOR OR CONTRIBUTORS 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. */ #define __u64 uint64_t #define __u32 uint32_t #define __s32 int32_t /** Version number of this interface */ #define FUSE_KERNEL_VERSION 7 /** Minor version number of this interface */ #define FUSE_KERNEL_MINOR_VERSION 5 /** The node ID of the root inode */ #define FUSE_ROOT_ID 1 /** The major number of the fuse character device */ #define FUSE_MAJOR 10 /** The minor number of the fuse character device */ #define FUSE_MINOR 229 /* Make sure all structures are padded to 64bit boundary, so 32bit userspace works under 64bit kernels */ struct fuse_attr { __u64 ino; __u64 size; __u64 blocks; __u64 atime; __u64 mtime; __u64 ctime; __u32 atimensec; __u32 mtimensec; __u32 ctimensec; __u32 mode; __u32 nlink; __u32 uid; __u32 gid; __u32 rdev; }; struct fuse_kstatfs { __u64 blocks; __u64 bfree; __u64 bavail; __u64 files; __u64 ffree; __u32 bsize; __u32 namelen; __u32 frsize; __u32 padding; __u32 spare[6]; }; #define FATTR_MODE (1 << 0) #define FATTR_UID (1 << 1) #define FATTR_GID (1 << 2) #define FATTR_SIZE (1 << 3) #define FATTR_ATIME (1 << 4) #define FATTR_MTIME (1 << 5) #define FATTR_FH (1 << 6) /** * Flags returned by the OPEN request * * FOPEN_DIRECT_IO: bypass page cache for this open file * FOPEN_KEEP_CACHE: don't invalidate the data cache on open */ #define FOPEN_DIRECT_IO (1 << 0) #define FOPEN_KEEP_CACHE (1 << 1) enum fuse_opcode { FUSE_LOOKUP = 1, FUSE_FORGET = 2, /* no reply */ FUSE_GETATTR = 3, FUSE_SETATTR = 4, FUSE_READLINK = 5, FUSE_SYMLINK = 6, FUSE_MKNOD = 8, FUSE_MKDIR = 9, FUSE_UNLINK = 10, FUSE_RMDIR = 11, FUSE_RENAME = 12, FUSE_LINK = 13, FUSE_OPEN = 14, FUSE_READ = 15, FUSE_WRITE = 16, FUSE_STATFS = 17, FUSE_RELEASE = 18, FUSE_FSYNC = 20, FUSE_SETXATTR = 21, FUSE_GETXATTR = 22, FUSE_LISTXATTR = 23, FUSE_REMOVEXATTR = 24, FUSE_FLUSH = 25, FUSE_INIT = 26, FUSE_OPENDIR = 27, FUSE_READDIR = 28, FUSE_RELEASEDIR = 29, FUSE_FSYNCDIR = 30, FUSE_ACCESS = 34, FUSE_CREATE = 35 }; /* The read buffer is required to be at least 8k, but may be much larger */ /* 2009-04-14, increased size of FUSE_MIN_READ_BUFFER, Werner Baumann */ #define FUSE_MIN_READ_BUFFER 16384 struct fuse_entry_out { __u64 nodeid; /* Inode ID */ __u64 generation; /* Inode generation: nodeid:gen must be unique for the fs's lifetime */ __u64 entry_valid; /* Cache timeout for the name */ __u64 attr_valid; /* Cache timeout for the attributes */ __u32 entry_valid_nsec; __u32 attr_valid_nsec; struct fuse_attr attr; }; struct fuse_forget_in { __u64 nlookup; }; struct fuse_attr_out { __u64 attr_valid; /* Cache timeout for the attributes */ __u32 attr_valid_nsec; __u32 dummy; struct fuse_attr attr; }; struct fuse_mknod_in { __u32 mode; __u32 rdev; }; struct fuse_mkdir_in { __u32 mode; __u32 padding; }; struct fuse_rename_in { __u64 newdir; }; struct fuse_link_in { __u64 oldnodeid; }; struct fuse_setattr_in { __u32 valid; __u32 padding; __u64 fh; __u64 size; __u64 unused1; __u64 atime; __u64 mtime; __u64 unused2; __u32 atimensec; __u32 mtimensec; __u32 unused3; __u32 mode; __u32 unused4; __u32 uid; __u32 gid; __u32 unused5; }; struct fuse_open_in { __u32 flags; __u32 mode; }; struct fuse_open_out { __u64 fh; __u32 open_flags; __u32 padding; }; struct fuse_release_in { __u64 fh; __u32 flags; __u32 padding; }; struct fuse_flush_in { __u64 fh; __u32 flush_flags; __u32 padding; }; struct fuse_read_in { __u64 fh; __u64 offset; __u32 size; __u32 padding; }; struct fuse_write_in { __u64 fh; __u64 offset; __u32 size; __u32 write_flags; }; struct fuse_write_out { __u32 size; __u32 padding; }; #define FUSE_COMPAT_STATFS_SIZE 48 struct fuse_statfs_out { struct fuse_kstatfs st; }; struct fuse_fsync_in { __u64 fh; __u32 fsync_flags; __u32 padding; }; struct fuse_setxattr_in { __u32 size; __u32 flags; }; struct fuse_getxattr_in { __u32 size; __u32 padding; }; struct fuse_getxattr_out { __u32 size; __u32 padding; }; struct fuse_access_in { __u32 mask; __u32 padding; }; struct fuse_init_in { __u32 major; __u32 minor; }; struct fuse_init_out { __u32 major; __u32 minor; __u32 unused[3]; __u32 max_write; }; struct fuse_in_header { __u32 len; __u32 opcode; __u64 unique; __u64 nodeid; __u32 uid; __u32 gid; __u32 pid; __u32 padding; }; struct fuse_out_header { __u32 len; __s32 error; __u64 unique; }; struct fuse_dirent { __u64 ino; __u64 off; __u32 namelen; __u32 type; char name[0]; }; #define FUSE_NAME_OFFSET ((unsigned) ((struct fuse_dirent *) 0)->name) #define FUSE_DIRENT_ALIGN(x) (((x) + sizeof(__u64) - 1) & ~(sizeof(__u64) - 1)) #define FUSE_DIRENT_SIZE(d) \ FUSE_DIRENT_ALIGN(FUSE_NAME_OFFSET + (d)->namelen) davfs2-1.5.2/src/mount_davfs.c0000644000175000017500000025233512371717000013115 00000000000000/* mount_davfs.c: mount the davfs file system. Copyright (C) 2006, 2007, 2008, 2009, 2014 Werner Baumann This file is part of davfs2. davfs2 is free software; you can 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. davfs2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with davfs2; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #include #include #include #ifdef HAVE_FCNTL_H #include #endif #include #include #ifdef HAVE_LIBINTL_H #include #endif #ifdef HAVE_LIMITS_H #include #endif #ifdef HAVE_LOCALE_H #include #endif #ifdef HAVE_MNTENT_H #include #endif #include #include #ifdef HAVE_STDINT_H #include #endif #include #ifdef HAVE_STDLIB_H #include #endif #include #ifdef HAVE_SYSLOG_H #include #endif #ifdef HAVE_TERMIOS_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_FILE_H #include #endif #ifdef HAVE_SYS_MOUNT_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #include #include #include #include "defaults.h" #include "mount_davfs.h" #include "kernel_interface.h" #include "cache.h" #include "webdav.h" #ifdef ENABLE_NLS #define _(String) gettext(String) #else #define _(String) String #define textdomain(Domainname) #define bindtextdomain(Domainname, Dirname) #endif /* Private global variables */ /*==========================*/ /* The URL of the WebDAV server as taken from commandline. */ static char *url; /* The canonicalized mointpoint. */ static char *mpoint; /* The type of the kernel file system used. */ static char *kernel_fs; /* The file that holds information about mounted filesystems (/proc/mounts or /etc/mtab) */ static char *mounts; /* The PID file */ static char *pidfile; /* This flags signals the message loop of the kernel interface whether it shall do what it says or just stop. Will be reset by termination_handler. */ static volatile int keep_on_running = 1; /* This flag signals that SIGTERM was received. mount.davfs will then terminate without uploading dirty files. */ static volatile int got_sigterm; /* Private function prototypes */ /*=============================*/ /* Parsing, checking and mounting. */ static void change_persona(dav_args *args); static void check_dirs(dav_args *args); static char * check_double_mounts(dav_args *args); static void check_fstab(const dav_args *args); static void check_permissions(dav_args *args); static int do_mount(unsigned long int mopts, void *mdata); static int is_mounted(void); static dav_args * parse_commandline(int argc, char *argv[]); static void parse_config(dav_args *args); static void parse_secrets(dav_args *args); static int save_pid(void); static void termination_handler(int signo); static void write_mtab_entry(const dav_args *args); /* Helper functions. */ static int arg_to_int(const char *arg, int base, const char *opt); static void cp_file(const char *src, const char *dest); static int debug_opts(const char *s); static int debug_opts_neon(const char *s); static void delete_args(dav_args *args); static void get_options(dav_args *args, char *option); static dav_args * new_args(void); static void log_dbg_config(dav_args *args); static int parse_line(char *line, int parmc, char *parmv[]); static void proxy_from_env(dav_args *args); static void read_config(dav_args *args, const char * filename, int system); static void read_no_proxy_list(dav_args *args); static void read_secrets(dav_args *args, const char *filename); static int split_uri(char **scheme, char **host, int *port,char **path, const char *uri); static void usage(void); static char * user_input(const char *prompt); /* Public functions */ /*==================*/ int main(int argc, char *argv[]) { setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), PACKAGE_STRING); dav_args *args = parse_commandline(argc, argv); if (geteuid() != 0) error(EXIT_FAILURE, errno, _("program is not setuid root")); if (seteuid(getuid()) != 0) error(EXIT_FAILURE, errno, _("can't change effective user id")); if (getuid() != 0) check_fstab(args); parse_config(args); check_dirs(args); check_permissions(args); parse_secrets(args); pidfile = check_double_mounts(args); change_persona(args); dav_init_webdav(args); dav_init_cache(args, mpoint); int dev = 0; dav_run_msgloop_fn run_msgloop = NULL; void *mdata = NULL; if (args->kernel_fs) kernel_fs = ne_strdup(args->kernel_fs); size_t buf_size = args->buf_size * 1024; int mounted = dav_init_kernel_interface(&dev, &run_msgloop, &mdata, &kernel_fs, &buf_size, url, mpoint, args); if (args->debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "kernel_fs: %s", kernel_fs); if (args->debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Fork into daemon mode"); pid_t childpid = fork(); if (childpid > 0) { if (args->debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Parent: parent pid: %i, child pid: %i", getpid(), childpid); if (!mounted) { if (args->debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Parent: mounting filesystem"); if (do_mount(args->mopts, mdata) != 0) { kill(childpid, SIGTERM); delete_args(args); exit(EXIT_FAILURE); } } if (args->debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Parent: writing mtab entry"); write_mtab_entry(args); if (args->debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Parent: leaving now"); delete_args(args); exit(EXIT_SUCCESS); } else if (childpid < 0) { delete_args(args); error(EXIT_FAILURE, errno, _("can't start daemon process")); } if (args->debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Set signal handler"); struct sigaction action; action.sa_handler = termination_handler; sigemptyset(&action.sa_mask); sigaddset(&action.sa_mask, SIGTERM); sigaddset(&action.sa_mask, SIGHUP); action.sa_flags = 0; sigaction(SIGTERM, &action, NULL); sigaction(SIGHUP, &action, NULL); int ret = 0; if (args->debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Releasing root privileges"); uid_t daemon_id = geteuid(); seteuid(0); ret = setuid(daemon_id); if (ret) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("can't release root privileges")); kill(getppid(), SIGHUP); } time_t idle_time = args->delay_upload; if (!idle_time) idle_time = DAV_DELAY_UPLOAD; if (idle_time > args->lock_refresh / 2) idle_time = args->lock_refresh / 2; int debug = args->debug; delete_args(args); setsid(); if (!ret) { if (debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Releasing terminal"); close(STDIN_FILENO); close(STDOUT_FILENO); close(STDERR_FILENO); if (open("/dev/null", O_RDONLY) != 0 || open("/dev/null", O_WRONLY) != 1 || open("/dev/null", O_WRONLY) != 2) { ret = -1; syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("failed to release tty properly")); kill(getppid(), SIGHUP); } dav_set_no_terminal(); } if (!ret) { if (debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Writing pid file"); ret = save_pid(); if (ret) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("can't write pid file %s"), pidfile); kill(getppid(), SIGHUP); } } if (!ret) { if (debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Starting message loop"); run_msgloop(dev, buf_size, idle_time, is_mounted, &keep_on_running, debug & DAV_DBG_KERNEL); } if (debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Closing"); dav_close_cache(&got_sigterm); dav_close_webdav(); if (is_mounted()) { char *prog = ne_concat("/bin/umount -il ", mpoint, NULL); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("unmounting %s"), mpoint); if (system(prog) != 0 && is_mounted()) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("unmounting failed")); } if (debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Removing %s", pidfile); remove(pidfile); if (debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Done."); return 0; } char * dav_user_input_hidden(const char *prompt) { printf(" %s ", prompt); struct termios old; if (tcgetattr(fileno(stdin), &old) != 0) return NULL; struct termios new = old; new.c_lflag &= ~ECHO; if (tcsetattr(fileno(stdin), TCSAFLUSH, &new) != 0) return NULL; char *line = NULL; size_t n = 0; ssize_t len = getline(&line, &n, stdin); if (tcsetattr(fileno(stdin), TCSAFLUSH, &old) != 0) return NULL; printf("\n"); if (len < 0) abort(); if (len > 0 && *(line + len - 1) == '\n') *(line + len - 1) = '\0'; return line; } /* Private functions */ /*===================*/ /* Changes the group id of the process permanently to dav_group. The effective user id of the process will be changed too, but the real user id still has to be changed permanently. */ static void change_persona(dav_args *args) { struct group *grp = getgrnam(args->dav_group); if (!grp) error(EXIT_FAILURE, errno, _("group %s does not exist"), args->dav_group); seteuid(0); if (setgid(grp->gr_gid) != 0) error(EXIT_FAILURE, errno, _("can't change group id")); if (getuid() == 0) { struct passwd *pw = getpwnam(args->dav_user); if (!pw) error(EXIT_FAILURE, errno, _("user %s does not exist"), args->dav_user); if (seteuid(pw->pw_uid) != 0) error(EXIT_FAILURE, errno, _("can't change effective user id")); } else { if (seteuid(getuid()) != 0) error(EXIT_FAILURE, errno, _("can't change effective user id")); } if (args->debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "changing persona: euid %i, gid %i", geteuid(), getgid()); } /* Checks for the existence of necessary and usefull directories and files. - checks whether it can use the proc file system for information about mounted file systems, or has to use mtab - whether the directory to save pid files exists and has correct owner and permissions; if not it tries to create it and/or set owner and permissions - when invoked by non-root user: checks for configuration directory in the users homepage and creates missing directories and files - checks wether args->cache_dir is accessible. */ static void check_dirs(dav_args *args) { struct stat st; if (lstat(_PATH_MOUNTED, &st) != 0) error(EXIT_FAILURE, errno, _("can't access file %s"), _PATH_MOUNTED); int mtab_is_link = S_ISLNK(st.st_mode); if (stat(DAV_MOUNTS, &st) == 0) { mounts = DAV_MOUNTS; args->use_utab = mtab_is_link; } else { mounts = _PATH_MOUNTED; } if (args->debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "mounts in: %s", mounts); if (args->use_utab) { char *utab_dir = NULL; if (asprintf(&utab_dir,"%s/%s", DAV_LOCALSTATE_DIR, DAV_UTAB_DIR) < 0) abort(); if (stat(utab_dir, &st) != 0) { seteuid(0); if (mkdir(utab_dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) == 0) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " and %s/%s", utab_dir, DAV_UTAB); } else { error(0, errno, _("can't create directory %s"), utab_dir); } seteuid(getuid()); } free(utab_dir); } seteuid(0); if (stat(DAV_SYS_RUN, &st) != 0) { if (mkdir(DAV_SYS_RUN, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH | S_ISVTX) != 0) error(EXIT_FAILURE, errno, _("can't create directory %s"), DAV_SYS_RUN); } if (stat(DAV_SYS_RUN, &st) != 0) error(EXIT_FAILURE, errno, _("can't access directory %s"), DAV_SYS_RUN); if ((st.st_mode & (S_IRWXG | S_ISVTX)) != (S_IRWXG | S_ISVTX)) { if (chmod(DAV_SYS_RUN, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH | S_ISVTX) != 0) error(EXIT_FAILURE, errno, _("can't change mode of directory %s"), DAV_SYS_RUN); } struct group *grp = getgrnam(args->dav_group); if (!grp) error(EXIT_FAILURE, errno, _("group %s does not exist"), args->dav_group); if (st.st_gid != grp->gr_gid) { if (chown(DAV_SYS_RUN, 0, grp->gr_gid) != 0) error(EXIT_FAILURE, errno, _("can't change group of directory %s"), DAV_SYS_RUN); } seteuid(getuid()); if (getuid() != 0) { char *path = NULL; struct passwd *pw = getpwuid(getuid()); if (pw && pw->pw_dir) path = ne_concat(pw->pw_dir, "/.", PACKAGE, NULL); if (path && stat(path, &st) != 0) mkdir(path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); if (path && stat(path, &st) == 0) { char *dir = ne_concat(path, "/", DAV_CACHE, NULL); if (stat(dir, &st) != 0) mkdir(dir, S_IRWXU); free(dir); dir = ne_concat(path, "/", DAV_CERTS_DIR, NULL); if (stat(dir, &st) != 0) mkdir(dir, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH); free(dir); dir = ne_concat(path, "/", DAV_CERTS_DIR, "/", DAV_CLICERTS_DIR, NULL); if (stat(dir, &st) != 0) mkdir(dir, S_IRWXU); free(dir); char *file_name = ne_concat(path, "/", DAV_CONFIG, NULL); if (stat(file_name, &st) != 0) { char *template = ne_concat(DAV_DATA_DIR, "/", DAV_CONFIG, NULL); cp_file(template, file_name); free(template); } free(file_name); file_name = ne_concat(path, "/", DAV_SECRETS, NULL); if (stat(file_name, &st) != 0) { char *template = ne_concat(DAV_DATA_DIR, "/", DAV_SECRETS, NULL); cp_file(template, file_name); chmod(file_name, S_IRUSR | S_IWUSR); free(template); } free(file_name); } free(path); } if (strcmp(args->cache_dir, args->sys_cache) == 0) { seteuid(0); if (stat(args->sys_cache, &st) != 0) { if (mkdir(args->sys_cache, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) error(EXIT_FAILURE, errno, _("can't create directory %s"), args->sys_cache); } if (stat(args->sys_cache, &st) != 0) error(EXIT_FAILURE, errno, _("can't access directory %s"), args->sys_cache); if ((st.st_mode & S_IRWXG) != S_IRWXG) { if (chmod(args->sys_cache, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) error(EXIT_FAILURE, errno, _("can't change mode of directory %s"), args->sys_cache); } struct group *grp = getgrnam(args->dav_group); if (!grp) error(EXIT_FAILURE, errno, _("group %s does not exist"), args->dav_group); if (st.st_gid != grp->gr_gid) { if (chown(args->sys_cache, 0, grp->gr_gid) != 0) error(EXIT_FAILURE, errno, _("can't change group of directory %s"), args->sys_cache); } seteuid(getuid()); } else { struct passwd *pw = getpwuid(getuid()); if (!pw) error(EXIT_FAILURE, errno, _("can't read user data base")); if (!pw->pw_name) error(EXIT_FAILURE, 0, _("can't read user data base")); if (stat(args->cache_dir, &st) != 0) { if (mkdir(args->cache_dir, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) != 0) error(EXIT_FAILURE, errno, _("can't create directory %s"), args->cache_dir); } if (stat(args->cache_dir, &st) != 0) error(EXIT_FAILURE, errno, _("can't access directory %s"), args->cache_dir); if ((st.st_uid != getuid() || (st.st_mode & S_IRWXU) != S_IRWXU) && (st.st_mode & S_IRWXO) != S_IRWXO) { if ((st.st_mode & S_IRWXG) != S_IRWXG) error(EXIT_FAILURE, errno, _("can't access directory %s"), args->cache_dir); struct group *grp = getgrgid(st.st_gid); if (!grp) error(EXIT_FAILURE, errno, _("can't read group data base")); char **members = grp->gr_mem; while (*members && strcmp(*members, pw->pw_name) != 0) members++; if (!*members) error(EXIT_FAILURE, 0, _("can't access directory %s"), args->cache_dir); } } } /* Checks whether url is already mounted on mpoint, creates the name of the pid file and checks whether it already exists. If one of these tests is positive, it prints an error message and terminates the program. Otherwise it returns the name of the pid file. return value : the name of the pid file. */ static char * check_double_mounts(dav_args *args) { FILE *mtab = setmntent(mounts, "r"); if (!mtab) error(EXIT_FAILURE, errno, _("can't open file %s"), mounts); struct mntent *mt = getmntent(mtab); while (mt) { if (strcmp(mpoint, mt->mnt_dir) == 0 && strcmp(url, mt->mnt_fsname) == 0) error(EXIT_FAILURE, 0, _("%s is already mounted on %s"), url, mpoint); mt = getmntent(mtab); } endmntent(mtab); char *m = mpoint; while (*m == '/') m++; char *mp = ne_strdup(m); m = strchr(mp, '/'); while (m) { *m = '-'; m = strchr(mp, '/'); } char *pidf = NULL; if (asprintf(&pidf, "%s/%s.pid", DAV_SYS_RUN, mp) < 0) abort(); free(mp); if (args->debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "PID file: %s", pidf); FILE *file = fopen(pidf, "r"); if (file) error(EXIT_FAILURE, 0, _("found PID file %s.\n" "Either %s is used by another process,\n" "or another mount process ended irregular"), pidf, mpoint); return pidf; } /* Checks fstab whether there is an entry for the mountpoint specified in args and compares the values in args with the values in fstab. If there is no such entry, or this entry does not allow user-mount, or the values differ, an error message is printed and the program terminates. */ static void check_fstab(const dav_args *args) { dav_args *n_args = new_args(); n_args->mopts = DAV_USER_MOPTS; FILE *fstab = setmntent(_PATH_MNTTAB, "r"); if (!fstab) error(EXIT_FAILURE, errno, _("can't open file %s"), _PATH_MNTTAB); struct mntent *ft = getmntent(fstab); while (ft) { if (ft->mnt_dir) { char *mp = canonicalize_file_name(ft->mnt_dir); if (mp) { if (strcmp(mp, mpoint) == 0) { free(mp); break; } free(mp); } } ft = getmntent(fstab); } if (!ft) error(EXIT_FAILURE, 0, _("no entry for %s found in %s"), mpoint, _PATH_MNTTAB); if (strcmp(url, ft->mnt_fsname) != 0) { error(EXIT_FAILURE, 0, _("different URL in %s"), _PATH_MNTTAB); } if (!ft->mnt_type || strcmp(DAV_FS_TYPE, ft->mnt_type) != 0) error(EXIT_FAILURE, 0, _("different file system type in %s"), _PATH_MNTTAB); if (ft->mnt_opts) get_options(n_args, ft->mnt_opts); endmntent(fstab); if (args->conf || n_args->conf) { if (!args->conf || !n_args->conf || strcmp(args->conf, n_args->conf) != 0) error(EXIT_FAILURE, 0, _("different config file in %s"), _PATH_MNTTAB); } if (args->cl_username || n_args->cl_username) { if (!args->cl_username || !n_args->cl_username || strcmp(args->cl_username, n_args->cl_username) != 0) error(EXIT_FAILURE, 0, _("different username in %s"), _PATH_MNTTAB); } if (!n_args->user && !n_args->users) error(EXIT_FAILURE, 0, _("neither option `user' nor option `users' set in %s"), _PATH_MNTTAB); if (args->mopts != n_args->mopts || args->grpid != n_args->grpid) error(EXIT_FAILURE, 0, _("different mount options in %s"), _PATH_MNTTAB); if (args->uid != n_args->uid) error(EXIT_FAILURE, 0, _("different uid in %s"), _PATH_MNTTAB); if (args->gid != n_args->gid) error(EXIT_FAILURE, 0, _("different gid in %s"), _PATH_MNTTAB); if (args->dir_mode != n_args->dir_mode) error(EXIT_FAILURE, 0, _("different dir_mode in %s"), _PATH_MNTTAB); if (args->file_mode != n_args->file_mode) error(EXIT_FAILURE, 0, _("different file_mode in %s"), _PATH_MNTTAB); delete_args(n_args); } /* The mounting user must be either root or meet the following conditions: - The uid must not differ from the option uid, if this option is used. - The user must belong to the group specified in option gid (if used). - The user must be member of group args->dav_group. If this conditions are not met or an error occurs, an error message is printed and exit(EXIT_FAILURE) is called. */ static void check_permissions(dav_args *args) { if (getuid() == 0) return; if (args->uid != getuid()) error(EXIT_FAILURE, 0, _("you can't set file owner different from your uid")); if (args->debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "uid ok"); if (getgid() != args->gid) { struct passwd *pw = getpwuid(getuid()); if (!pw) error(EXIT_FAILURE, errno, _("can't read user data base")); if (!pw->pw_name) error(EXIT_FAILURE, 0, _("can't read user data base")); struct group *grp = getgrgid(args->gid); if (!grp) error(EXIT_FAILURE, 0, _("can't read group data base")); char **members = grp->gr_mem; while (*members && strcmp(*members, pw->pw_name) != 0) members++; if (!*members) error(EXIT_FAILURE, 0, _("you must be member of the group of the file system")); } if (args->debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "gid ok"); struct passwd *pw; pw = getpwuid(getuid()); if (!pw) error(EXIT_FAILURE, errno, _("can't read user data base")); if (!pw->pw_name) error(EXIT_FAILURE, 0, _("can't read user data base")); struct group *grp = getgrnam(args->dav_group); if (!grp) error(EXIT_FAILURE, errno, _("group %s does not exist"), args->dav_group); if (pw->pw_gid != grp->gr_gid) { int ngroups = getgroups(0, NULL); gid_t *groups = NULL; if (ngroups > 0) { groups = (gid_t *) malloc(ngroups * sizeof(gid_t)); if (!groups) abort(); if (getgroups(ngroups, groups) < 0) error(EXIT_FAILURE, 0, _("can't read group data base")); } else { error(EXIT_FAILURE, 0, _("can't read group data base")); } int i; for (i = 0; i < ngroups; i++) { if (grp->gr_gid == groups[i]) break; } free(groups); if (i == ngroups) error(EXIT_FAILURE, 0, _("user %s must be member of group %s"), pw->pw_name, grp->gr_name); } if (args->debug & DAV_DBG_CONFIG) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "memeber of group %s", args->dav_group); } /* Calls the mount()-function to mount the file system. Uses private global variables url and mpoint as device and mount point, kernel_fs as file system type, mopts as mount options and mdata as mount data. return value : 0 on success, -1 if mount() fails. */ static int do_mount(unsigned long int mopts, void *mdata) { uid_t orig = geteuid(); seteuid(0); int ret = mount(url, mpoint, kernel_fs, mopts, mdata); seteuid(orig); if (ret) { error(0, errno, _("can't mount %s on %s"), url, mpoint); if (errno == ENODEV) error(0, 0, _("kernel does not know file system %s"), kernel_fs); if (errno == EBUSY) error(0, 0, _("mount point is busy")); return -1; } return 0; } /* Checks wether the file system is mounted. It uses information from the private global variables mounts (mtab-file), url (must be device in the mtab entry) and mpoint (mount point). return value : 0 - no matching entry in the mtab-file (not mounted) 1 - matching entry in the mtab-file (mounted) */ static int is_mounted(void) { int found = 0; FILE *mtab = setmntent(mounts, "r"); if (mtab) { struct mntent *mt = getmntent(mtab); while (mt && !found) { if (strcmp(mpoint, mt->mnt_dir) == 0 && strcmp(url, mt->mnt_fsname) == 0) found = 1; mt = getmntent(mtab); } } endmntent(mtab); return found; } /* Parses commandline arguments and options and stores them in args and the private global variables url and mpoint. For arguments and options please see the usage()-funktion. As soon as 'version' or 'help' is found, an appropriate message is printed and exit(EXIT_SUCCESS) is called. If it does not find exactly two non-option-arguments (url and mointpoint) it prints an error message and calls exit(EXIT_FAILURE). argc : the number of arguments. argv[] : array of argument strings. return value : args, containig the parsed options and arguments. The args structure and all strings are newly allocated. The calling function is responsible to free them. */ static dav_args * parse_commandline(int argc, char *argv[]) { dav_args *args = new_args(); size_t len = argc; int i; for (i = 0; i < argc; i++) len += strlen(argv[i]); args->cmdline = ne_malloc(len); char *p = args->cmdline; for (i = 0; i < argc - 1; i++) { strcpy(p, argv[i]); p += strlen(argv[i]); *p = ' '; p++; } strcpy(p, argv[argc - 1]); char *short_options = "vwVho:"; static const struct option options[] = { {"version", no_argument, NULL, 'V'}, {"help", no_argument, NULL, 'h'}, {"option", required_argument, NULL, 'o'}, {0, 0, 0, 0} }; int o; o = getopt_long(argc, argv, short_options, options, NULL); while (o != -1) { switch (o) { case 'V': printf("%s <%s>\n\n", PACKAGE_STRING, PACKAGE_BUGREPORT); printf(_("This is free software; see the source for copying " "conditions. There is NO\n" "warranty; not even for MERCHANTABILITY or FITNESS " "FOR A PARTICULAR PURPOSE.\n")); exit(EXIT_SUCCESS); case 'h': usage(); exit(EXIT_SUCCESS); case 'o': get_options(args, optarg); break; case 'v': case 'w': case '?': break; default: error(EXIT_FAILURE, 0, _("unknown error parsing arguments")); } o = getopt_long(argc, argv, short_options, options, NULL); } i = optind; switch (argc - i) { case 0: case 1: error(0, 0, _("missing argument")); usage(); exit(EXIT_FAILURE); case 2: if (*argv[i] == '\"' || *argv[i] == '\'') { url = ne_strndup(argv[i] + 1, strlen(argv[i]) -2); } else { url = ne_strdup(argv[i]); } i++; mpoint = canonicalize_file_name(argv[i]); if (!mpoint) error(EXIT_FAILURE, 0, _("can't evaluate path of mount point %s"), mpoint); break; default: error(0, 0, _("too many arguments")); usage(); exit(EXIT_FAILURE); } if (getuid() != 0 && *argv[i] != '/') { struct passwd *pw = getpwuid(getuid()); if (!pw || !pw->pw_dir) error(EXIT_FAILURE, 0, _("can't get home directory for uid %i"), getuid()); if (strstr(mpoint, pw->pw_dir) != mpoint) error(EXIT_FAILURE, 0, _("A relative mount point must lie " "within your home directory")); } if (!url) error(EXIT_FAILURE, 0, _("no WebDAV-server specified")); if (split_uri(&args->scheme, &args->host, &args->port, &args->path, url) != 0) error(EXIT_FAILURE, 0, _("invalid URL")); if (!args->port) args->port = ne_uri_defaultport(args->scheme); return args; } /* Reads and parses the configuration files and stores the values in args. The system wide configuration file is parsed first. If args->conf is given it will be parsed too and overwrites the values from the system wide configuration file. */ static void parse_config(dav_args *args) { read_config(args, DAV_SYS_CONF_DIR "/" DAV_CONFIG, 1); struct passwd *pw = getpwuid(getuid()); if (!pw || !pw->pw_dir) error(EXIT_FAILURE, 0, _("can't determine home directory")); if (args->conf) { if (*args->conf == '~') { int p = 1; if (*(args->conf + p) == '/') p++; char *f = ne_concat(pw->pw_dir, "/", args->conf + p, NULL); free(args->conf); args->conf = f; } read_config(args, args->conf, 0); } args->mopts |= DAV_MOPTS; args->dir_mode |= S_IFDIR; args->file_mode |= S_IFREG; struct stat st; if (args->trust_ca_cert && *args->trust_ca_cert == '~') { int p = 1; if (*(args->trust_ca_cert + p) == '/') p++; char *f = ne_concat(pw->pw_dir, "/", args->trust_ca_cert + p, NULL); free(args->trust_ca_cert); args->trust_ca_cert = f; } if (args->trust_ca_cert && *args->trust_ca_cert != '/' && getuid() != 0) { char *f = ne_concat(pw->pw_dir, "/.", PACKAGE, "/", DAV_CERTS_DIR, "/", args->trust_ca_cert, NULL); if (stat(f, &st) == 0) { free(args->trust_ca_cert); args->trust_ca_cert = f; } else { free(f); } } if (args->trust_ca_cert && *args->trust_ca_cert != '/') { char *f = ne_concat(DAV_SYS_CONF_DIR, "/", DAV_CERTS_DIR, "/", args->trust_ca_cert, NULL); free(args->trust_ca_cert); args->trust_ca_cert = f; } if (args->trust_server_cert && *args->trust_server_cert == '~') { int p = 1; if (*(args->trust_server_cert + p) == '/') p++; char *f = ne_concat(pw->pw_dir, "/", args->trust_server_cert + p, NULL); free(args->trust_server_cert); args->trust_server_cert = f; } if (args->trust_server_cert && *args->trust_server_cert != '/' && getuid() != 0) { char *f = ne_concat(pw->pw_dir, "/.", PACKAGE, "/", DAV_CERTS_DIR, "/", args->trust_server_cert, NULL); if (stat(f, &st) == 0) { free(args->trust_server_cert); args->trust_server_cert = f; } else { free(f); } } if (args->trust_server_cert && *args->trust_server_cert != '/') { char *f = ne_concat(DAV_SYS_CONF_DIR, "/", DAV_CERTS_DIR, "/", args->trust_server_cert, NULL); free(args->trust_server_cert); args->trust_server_cert = f; } if (args->secrets && *args->secrets == '~') { int p = 1; if (*(args->secrets + p) == '/') p++; char *f = ne_concat(pw->pw_dir, "/", args->secrets + p, NULL); free(args->secrets); args->secrets = f; } if (args->clicert && *args->clicert == '~') { int p = 1; if (*(args->clicert + p) == '/') p++; char *f = ne_concat(pw->pw_dir, "/", args->clicert + p, NULL); free(args->clicert); args->clicert = f; } if (args->clicert && *args->clicert != '/' && getuid() != 0) { char *f = ne_concat(pw->pw_dir, "/.", PACKAGE, "/", DAV_CERTS_DIR, "/", DAV_CLICERTS_DIR, "/", args->clicert, NULL); if (stat(f, &st) == 0) { free(args->clicert); args->clicert = f; } } if (args->clicert && *args->clicert != '/' && getuid() == 0) { char *f = ne_concat(DAV_SYS_CONF_DIR, "/", DAV_CERTS_DIR, "/", DAV_CLICERTS_DIR, "/", args->clicert, NULL); free(args->clicert); args->clicert = f; } if (args->clicert) { struct stat st; seteuid(0); if (stat(args->clicert, &st) < 0) error(EXIT_FAILURE, 0, _("can't read client certificate %s"), args->clicert); seteuid(getuid()); if (st.st_uid != getuid() && st.st_uid != 0) error(EXIT_FAILURE, 0, _("client certificate file %s has wrong owner"), args->clicert); if ((st.st_mode & (S_IXUSR | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX)) != 0) error(EXIT_FAILURE, 0, _("client certificate file %s has wrong permissions"), args->clicert); } if (getuid() == 0 && !args->p_host) { proxy_from_env(args); read_no_proxy_list(args); } if (!args->p_host) args->useproxy = 0; if (!args->cache_dir) { args->cache_dir = ne_strdup(args->sys_cache); } else if (*args->cache_dir == '~') { int p = 1; if (*(args->cache_dir + p) == '/') p++; char *f = ne_concat(pw->pw_dir, "/", args->cache_dir + p, NULL); free(args->cache_dir); args->cache_dir = f; } if (args->debug & DAV_DBG_CONFIG) log_dbg_config(args); } /* Reads the secrets file and asks the user interactivly for credentials if necessary. The user secrets file is parsed after the system wide secrets file, so it will have precedence. */ static void parse_secrets(dav_args *args) { seteuid(0); read_secrets(args, DAV_SYS_CONF_DIR "/" DAV_SECRETS); seteuid(getuid()); if (args->secrets) { read_secrets(args, args->secrets); } if (args->cl_username) { if (args->username) free(args->username); args->username = args->cl_username; args->cl_username = NULL; if (args->password) free(args->password); args->password = NULL; args->password = user_input(_("Password: ")); } if (args->askauth && args->useproxy && !args->p_user) { printf(_("Please enter the username to authenticate with proxy\n" "%s or hit enter for none.\n"), args->p_host); args->p_user = user_input(_("Username:")); } if (args->askauth && args->useproxy && args->p_user && !args->p_passwd) { printf(_("Please enter the password to authenticate user %s with proxy\n" "%s or hit enter for none.\n"), args->p_user, args->p_host); if (isatty(fileno(stdin))) { args->p_passwd = dav_user_input_hidden(_("Password: ")); } else { args->p_passwd = user_input(_("Password: ")); } if (args->p_passwd && strlen(args->p_passwd) == 0) { free(args->p_passwd); args->p_passwd = NULL; } } if (args->askauth && !args->username) { printf(_("Please enter the username to authenticate with server\n" "%s or hit enter for none.\n"), url); args->username = user_input(_("Username:")); } if (args->askauth && args->username && !args->password) { printf(_("Please enter the password to authenticate user %s with " "server\n%s or hit enter for none.\n"), args->username, url); if (isatty(fileno(stdin))) { args->password = dav_user_input_hidden(_("Password: ")); } else { args->password = user_input(_("Password: ")); } if (args->password && strlen(args->password) == 0) { free(args->password); args->password = NULL; } } if (args->debug & DAV_DBG_SECRETS) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Secrets:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " username: %s", args->username); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " cl_username: %s", args->cl_username); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " password: %s", args->password); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " p_user: %s", args->p_user); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " p_passwd: %s", args->p_passwd); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " clicert_pw: %s", args->clicert_pw); } } /* Saves the pid of the mount.davfs daemon in the pid-file. The name of the pid-file is taken from the private global variable pidfile. If an error occurs during opening of the pid-file, the function returns with -1. */ static int save_pid(void) { FILE *file = fopen(pidfile, "w"); if (!file) return -1; int ret = 0; if (fprintf(file, "%i\n", getpid()) <= 0) ret = -1; fclose(file); chmod(pidfile, S_IRWXU | S_IRGRP | S_IROTH); return ret; } /* Signal handler for the daemon process. Sets global variable keep_on_running to 0, so the message loop will stop and the daemon will terminate gracefully. */ static void termination_handler(int signo) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("pid %i, got signal %i"), getpid(), signo); keep_on_running = 0; got_sigterm = 1; } /* Adds an entry to _PATH_MOUNTED for the mounted file system. If _PATH_MOUNTED is a symbolic link to /proc/mounts it will write an entry into /var/run/mount/utab instead. If this fails a warning will be printed, but this will not stop mounting. */ static void write_mtab_entry(const dav_args *args) { struct mntent mntent; mntent.mnt_opts = NULL; char *utab_line = NULL; char *tab_file = NULL; char *lock_file = NULL; int privileged = (getuid() == 0); struct passwd *pw = getpwuid(getuid()); if (!pw && !privileged) { error(0, errno, _("Warning: can't read user data base. Mounting " "anyway, but there is no entry in mtab.")); return; } char *uid_name = pw->pw_name; if (args->use_utab) { if (asprintf(&utab_line, "SRC=%s TARGET=%s ROOT=/ " "OPTS=uid=%i,gid=%i%s%s%s,helper=%s\n", url, mpoint, args->uid, args->gid, (args->grpid) ? ",grpid" : "", (!privileged) ? ",user=" : "", (!privileged) ? uid_name : "", DAV_FS_TYPE) < 0) abort(); if (asprintf(&tab_file, "%s/%s/%s", DAV_LOCALSTATE_DIR, DAV_UTAB_DIR, DAV_UTAB) < 0) abort(); if (asprintf(&lock_file, "%s,lock", tab_file) < 0) abort(); } else { mntent.mnt_fsname = url; mntent.mnt_dir = mpoint; mntent.mnt_type = DAV_FS_TYPE; if (asprintf(&mntent.mnt_opts, "%s%s%s%s%s%s,uid=%i,gid=%i%s%s", (args->mopts & MS_RDONLY) ? "ro" : "rw", (args->mopts & MS_NOSUID) ? ",nosuid" : "", (args->mopts & MS_NOEXEC) ? ",noexec" : "", (args->mopts & MS_NODEV) ? ",nodev" : "", (args->grpid) ? ",grpid" : "", (args->netdev) ? ",_netdev" : "", args->uid, args->gid, (!privileged) ? ",user=" : "", (!privileged) ? uid_name : "") < 0) abort(); mntent. mnt_freq = 0; mntent. mnt_passno = 0; tab_file = ne_strdup(_PATH_MOUNTED); if (asprintf(&lock_file, "%s~", tab_file) < 0) abort(); } sigset_t oldset; sigemptyset(&oldset); sigset_t newset; sigfillset(&newset); sigprocmask(SIG_BLOCK, &newset, &oldset); uid_t orig = geteuid(); seteuid(0); int ld = open(lock_file, O_RDONLY | O_CREAT, S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH); if (!ld) error(EXIT_FAILURE, errno, _("can't create file %s"), lock_file); while (flock(ld, LOCK_EX) != 0) { if (errno == EAGAIN || errno == EINTR) continue; error(EXIT_FAILURE, errno, _("can't lock file %s"), lock_file); } FILE *tab = NULL; if (args->use_utab) { tab = fopen(tab_file, "a"); } else { tab = setmntent(tab_file, "a"); } int err = 0; if (tab) { if (args->use_utab) { if (fputs(utab_line, tab) == EOF) err = 1; fclose(tab); } else { if (addmntent(tab, &mntent) != 0) err = 1; endmntent(tab); } } if (!tab || err) error(0, 0, _("Warning: can't write entry into %s, but will mount " "the file system anyway"), tab_file); close(ld); remove(lock_file); seteuid(orig); sigprocmask(SIG_SETMASK, &oldset, NULL); if (lock_file) free(lock_file); if (tab_file) free(tab_file); if (utab_line) free(utab_line); if (mntent.mnt_opts) free(mntent.mnt_opts); } /* Helper functions. */ /* Searches arg from the beginning for digits, valid in base, and converts them to an integer. If arg does not start with valid digits an error message is printed and exit(EXIT_FAILURE) is called. Otherwise the integer is returned. arg : string to be converted base : radix of the number; value between 2 and 36 opt : name of the option, arg belongs to. Used in the error message. return value: the value of the integer number in arg */ static int arg_to_int(const char *arg, int base, const char *opt) { char *tail = NULL; int n = strtol(arg, &tail, base); if (n < 0 || !tail) { if (base == 10) { error(EXIT_FAILURE, 0, _("option %s has invalid argument;" "it must be a decimal number"), opt); } else if (base == 8) { error(EXIT_FAILURE, 0, _("option %s has invalid argument;" "it must be an octal number"), opt); } else { error(EXIT_FAILURE, 0, _("option %s has invalid argument;" "it must be a number"), opt); } } return n; } /* Creates a copy of src with name dest. */ static void cp_file(const char *src, const char *dest) { FILE *in = fopen(src, "r"); if (!in) error(EXIT_FAILURE, errno, _("can't open file %s"), src); FILE *out = fopen(dest, "w"); if (!out) error(EXIT_FAILURE, errno, _("can't open file %s"), dest); size_t n = 0; char *line = NULL; int length = getline(&line, &n, in); while (length > 0) { if (fputs(line, out) == EOF) error(EXIT_FAILURE, errno, _("error writing to file %s"), dest); length = getline(&line, &n, in); } if (line) free(line); fclose(out); fclose(in); } /* Converts a debug option string s into numerical value. If s is not a valid debug option, it returns 0. */ static int debug_opts(const char *s) { if (strcmp(s, "config") == 0) return DAV_DBG_CONFIG; if (strcmp(s, "kernel") == 0) return DAV_DBG_KERNEL; if (strcmp(s, "cache") == 0) return DAV_DBG_CACHE; if (strcmp(s, "secrets") == 0) return DAV_DBG_SECRETS; if (strcmp(s, "most") == 0) return DAV_DBG_CONFIG | DAV_DBG_KERNEL | DAV_DBG_CACHE; return 0; } /* Converts a debug option string s into numerical value. If s is not a valid neon debug option, it returns 0. */ static int debug_opts_neon(const char *s) { if (strcmp(s, "http") == 0) return NE_DBG_HTTP | NE_DBG_SOCKET; if (strcmp(s, "xml") == 0) return NE_DBG_XML; if (strcmp(s, "httpauth") == 0) return NE_DBG_HTTPAUTH; if (strcmp(s, "locks") == 0) return NE_DBG_LOCKS; if (strcmp(s, "httpbody") == 0) return NE_DBG_HTTPBODY; if (strcmp(s, "ssl") == 0) return NE_DBG_SSL; if (strcmp(s, "secrets") == 0) return NE_DBG_HTTPPLAIN; if (strcmp(s, "most") == 0) return NE_DBG_SOCKET | NE_DBG_HTTP; return 0; } /* Frees all strings held by args and finally frees args. */ static void delete_args(dav_args *args) { if (args->cmdline) free(args->cmdline); if (args->dav_user) free(args->dav_user); if (args->dav_group) free(args->dav_group); if (args->conf) free(args->conf); if (args->kernel_fs) free(args->kernel_fs); if (args->scheme) free(args->scheme); if (args->host) free(args->host); if (args->path) free(args->path); if (args->trust_ca_cert) free(args->trust_ca_cert); if (args->trust_server_cert) free(args->trust_server_cert); if (args->secrets) free(args->secrets); if (args->username) { memset(args->username, '\0', strlen(args->username)); free(args->username); } if (args->cl_username) free(args->cl_username); if (args->password) { memset(args->password, '\0', strlen(args->password)); free(args->password); } if (args->clicert) free(args->clicert); if (args->clicert_pw) { memset(args->clicert_pw, '\0', strlen(args->clicert_pw)); free(args->clicert_pw); } if (args->p_host) free(args->p_host); if (args->p_user) { memset(args->p_user, '\0', strlen(args->p_user)); free(args->p_user); } if (args->p_passwd) { memset(args->p_passwd, '\0', strlen(args->p_passwd)); free(args->p_passwd); } if (args->lock_owner) free(args->lock_owner); if (args->s_charset) free(args->s_charset); if (args->header) free(args->header); if (args->sys_cache) free(args->sys_cache); if (args->cache_dir) free(args->cache_dir); if (args->backup_dir) free(args->backup_dir); free(args); } /* Parses the string option and stores the values in the appropriate fields of args. If an unknown option is found exit(EXIT_FAILURE) is called. All strings returned in args are newly allocated, and the calling function is responsible to free them. option : a comma separated list of options (like the options in fstab and in the -o option of the mount-programm). For known options see the declaration at the beginning of the the function definition. */ static void get_options(dav_args *args, char *option) { enum { CONF = 0, USERNAME, UID, GID, FILE_MODE, DIR_MODE, USER, NOUSER, USERS, NETDEV, NONETDEV, GRPID, NOGRPID, RW, RO, SUID, NOSUID, EXEC, NOEXEC, DEV, NODEV, ASYNC, AUTO, NOAUTO, COMMENT, DEFAULTS, END }; char *suboptions[] = { [CONF] = "conf", [USERNAME] = "username", [UID] = "uid", [GID] = "gid", [FILE_MODE] = "file_mode", [DIR_MODE] = "dir_mode", [USER] = "user", [NOUSER] = "nouser", [USERS] = "users", [NETDEV] = "_netdev", [NONETDEV] = "no_netdev", [GRPID] = "grpid", [NOGRPID] = "nogrpid", [RW] = "rw", [RO] = "ro", [SUID] = "suid", [NOSUID] = "nosuid", [EXEC] = "exec", [NOEXEC] = "noexec", [DEV] = "dev", [NODEV] = "nodev", [ASYNC] = "async", [AUTO] = "auto", [NOAUTO] = "noauto", [COMMENT] = "comment", [DEFAULTS] = "defaults", [END] = NULL }; int so; char *argument = NULL; struct passwd *pwd; struct group *grp; while (*option != 0) { so = getsubopt(&option, suboptions, &argument); if ((!argument) && (so < USER)) error(EXIT_FAILURE, 0, _("option %s requires argument"), suboptions[so]); switch (so) { case CONF: if (args->conf) free(args->conf); args->conf = ne_strdup(argument); break; case USERNAME: if (args->cl_username) free(args->cl_username); args->cl_username = ne_strdup(argument); break; case UID: pwd = getpwnam(argument); if (!pwd) { args->uid = arg_to_int(argument, 10, suboptions[so]); } else { args->uid = pwd->pw_uid; } break; case GID: grp = getgrnam(argument); if (!grp) { args->gid = arg_to_int(argument, 10, suboptions[so]); } else { args->gid = grp->gr_gid; } break; case FILE_MODE: args->file_mode = arg_to_int(argument, 8, suboptions[so]); break; case DIR_MODE: args->dir_mode = arg_to_int(argument, 8, suboptions[so]); break; case USER: args->user = 1; break; case NOUSER: args->user = 0; break; case USERS: args->users = 1; break; case NETDEV: args->netdev = 1; break; case NONETDEV: args->netdev = 0; break; case GRPID: args->grpid = 1; break; case NOGRPID: args->grpid = 0; break; case RW: args->mopts &= ~MS_RDONLY; break; case RO: args->mopts |= MS_RDONLY; break; case SUID: args->mopts &= ~MS_NOSUID; break; case NOSUID: args->mopts |= MS_NOSUID; break; case EXEC: args->mopts &= ~MS_NOEXEC; break; case NOEXEC: args->mopts |= MS_NOEXEC; break; case DEV: args->mopts &= ~MS_NODEV; break; case NODEV: args->mopts |= MS_NODEV; break; case ASYNC: case AUTO: case NOAUTO: case COMMENT: case DEFAULTS: break; default: if (so == -1) { printf(_("Unknown option %s.\n"), argument); usage(); exit(EXIT_FAILURE); } } } } /* Allocates a new dav_args-structure and initializes it. All members are set to reasonable defaults. */ static dav_args * new_args(void) { char *user_dir = NULL; if (getuid() != 0) { struct passwd *pw = getpwuid(getuid()); if (!pw) error(EXIT_FAILURE, errno, _("can't read user data base")); if (!pw->pw_dir) error(EXIT_FAILURE, 0, _("can't read user data base")); user_dir = ne_concat(pw->pw_dir, "/.", PACKAGE, NULL); } dav_args *args = ne_malloc(sizeof(*args)); args->cmdline = NULL; args->dav_user = ne_strdup(DAV_USER); args->dav_group = ne_strdup(DAV_GROUP); if (getuid() != 0) { args->conf = ne_concat(user_dir, "/", DAV_CONFIG, NULL); } else { args->conf = NULL; } args->user = 0; args->users = 0; args->netdev = 1; args->grpid = 0; args->mopts = DAV_MOPTS; args->kernel_fs = NULL; args->buf_size = 0; args->uid = getuid(); args->gid = getgid(); args->dir_mode = DAV_DIR_MODE; args->file_mode = DAV_FILE_MODE; args->scheme = NULL; args->host = NULL; args->port = 0; args->path = NULL; args->trust_ca_cert = NULL; args->trust_server_cert = NULL; if (getuid() != 0) { args->secrets = ne_concat(user_dir, "/", DAV_SECRETS, NULL); } else { args->secrets = NULL; } args->username = NULL; args->cl_username = NULL; args->password = NULL; args->clicert = NULL; args->clicert_pw = NULL; args->p_host = NULL; args->p_port = DAV_DEFAULT_PROXY_PORT; args->p_user = NULL; args->p_passwd = NULL; args->useproxy = DAV_USE_PROXY; args->lock_owner = NULL; args->lock_timeout = DAV_LOCK_TIMEOUT; args->lock_refresh = DAV_LOCK_REFRESH; args->askauth = DAV_ASKAUTH; args->locks = DAV_LOCKS; args->expect100 = DAV_EXPECT100; args->if_match_bug = DAV_IF_MATCH_BUG; args->drop_weak_etags = DAV_DROP_WEAK_ETAGS; args->n_cookies = DAV_N_COOKIES; args->precheck = DAV_PRECHECK; args->ignore_dav_header = DAV_IGNORE_DAV_HEADER; args->use_compression = DAV_USE_COMPRESSION; args->min_propset = DAV_MIN_PROPSET; args->follow_redirect = DAV_FOLLOW_REDIRECT; args->connect_timeout = DAV_CONNECT_TIMEOUT; args->read_timeout = DAV_READ_TIMEOUT; args->retry = DAV_RETRY; args->max_retry = DAV_MAX_RETRY; args->max_upload_attempts = DAV_MAX_UPLOAD_ATTEMPTS; args->s_charset = NULL; args->header = NULL; args->sys_cache = ne_strdup(DAV_SYS_CACHE); if (getuid() != 0) { args->cache_dir = ne_concat(user_dir, "/", DAV_CACHE, NULL); } else { args->cache_dir = NULL; } args->backup_dir = ne_strdup(DAV_BACKUP_DIR); args->cache_size = DAV_CACHE_SIZE; args->table_size = DAV_TABLE_SIZE; args->dir_refresh = DAV_DIR_REFRESH; args->file_refresh = DAV_FILE_REFRESH; args->delay_upload = DAV_DELAY_UPLOAD; args->gui_optimize = DAV_GUI_OPTIMIZE; args->minimize_mem = DAV_MINIMIZE_MEM; args->debug = 0; args->neon_debug = 0; if (user_dir) free(user_dir); return args; } static void log_dbg_config(dav_args *args) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "%s", args->cmdline); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Configuration:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " url: %s", url); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " mount point: %s", mpoint); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " dav_user: %s", args->dav_user); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " dav_group: %s", args->dav_group); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " conf: %s", args->conf); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " user: %i", args->user); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " netdev: %i", args->netdev); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " grpid: %i", args->grpid); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " mopts: %#lx", args->mopts); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " kernel_fs: %s", args->kernel_fs); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " buf_size: %llu KiB", (unsigned long long) args->buf_size); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " uid: %i", args->uid); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " gid: %i", args->gid); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " dir_mode: %#o", args->dir_mode); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " file_mode: %#o", args->file_mode); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " scheme: %s", args->scheme); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " host: %s", args->host); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " port: %i", args->port); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " path: %s", args->path); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " trust_ca_cert: %s", args->trust_ca_cert); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " trust_server_cert: %s", args->trust_server_cert); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " secrets: %s", args->secrets); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " clicert: %s", args->clicert); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " p_host: %s", args->p_host); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " p_port: %i", args->p_port); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " useproxy: %i", args->useproxy); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " askauth: %i", args->askauth); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " locks: %i", args->locks); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " lock_owner: %s", args->lock_owner); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " lock_timeout: %li s", args->lock_timeout); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " lock_refresh: %li s", args->lock_refresh); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " expect100: %i", args->expect100); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " if_match_bug: %i", args->if_match_bug); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " drop_weak_etags: %i", args->drop_weak_etags); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " n_cookies: %i", args->n_cookies); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " precheck: %i", args->precheck); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " ignore_dav_header: %i", args->ignore_dav_header); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " use_compression: %i", args->use_compression); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " follow_redirect: %i", args->follow_redirect); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " connect_timeout: %li s", args->connect_timeout); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " read_timeout: %li s", args->read_timeout); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " retry: %li s", args->retry); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " max_retry: %li s", args->max_retry); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " s_charset: %s", args->s_charset); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " header: %s", args->header); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " sys_cache: %s", args->sys_cache); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " cache_dir: %s", args->cache_dir); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " backup_dir: %s", args->backup_dir); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " cache_size: %llu MiB", (unsigned long long) args->cache_size); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " table_size: %llu", (unsigned long long) args->table_size); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " dir_refresh: %li s", args->dir_refresh); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " file_refresh: %li s", args->file_refresh); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " delay_upload: %i", args->delay_upload); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " gui_optimize: %i", args->gui_optimize); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " minimize_mem: %i", args->minimize_mem); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " debug: %#x", args->debug); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " neon_debug: %#x", args->neon_debug); } /* Parses line for max. parmc white-space separated parameter tokens and returns them in parmv[]. The '#' character marks the beginning of a comment and the rest of the line is ignored. Parameters containing one of the characters ' ' (space), '\t' (tab), '\', '"' or '#' must be enclosed in double quotes '"' *or* this character has to be escaped by preceeding a '\'-character. Inside double quotes the '"'-character must be escaped. '\' may be escaped; it must be escaped if there is more than on '\'-character in succession. Whitespace characters other than ' ' and tab must only occur at the end of the line. line : the line to be parsed. It will be changed by this function. parmc : the max. number of parameters. It is an error, if more than parmc parameters are found parmv[] : the parameters found are returned in this array. It contains pointers into the rearranged line parameter. reurn value : the numer of parameters or -1 if an error occurs. */ static int parse_line(char *line, int parmc, char *parmv[]) { enum { SPACE, SPACE_EXP, PARM, PARM_ESC, PARM_QUO, PARM_QUO_ESC, ERROR, END }; int state = SPACE; int parm_no = 0; char *pos = line; char *p = line; parmv[0] = line; while (state != END) { switch (state) { case SPACE: if (*p == '\0' || *p == '#' || *p == '\f' || *p == '\n' || *p == '\r' || *p == '\v') { state = END; } else if (*p == '\"') { state = PARM_QUO; } else if (*p == '\\') { state = PARM_ESC; } else if (isspace(*p)) { ; } else { *pos++ = *p; state = PARM; } if (parm_no >= parmc) return -1; break; case SPACE_EXP: if (*p == ' ' || *p == '\t') { state = SPACE; } else if (*p == '\0' || *p == '#' || *p == '\f' || *p == '\n' || *p == '\r' || *p == '\v') { state = END; } else { return -1; } break; case PARM: if (*p == '\"') { return -1; } else if (*p == '\\') { state = PARM_ESC; } else if (*p == ' ' || *p == '\t') { *pos++ = '\0'; parmv[++parm_no] = pos; state = SPACE; } else if (isspace(*p) || *p == '\0' || *p == '#') { *pos = '\0'; parm_no++; state = END; } else { *pos++ = *p; } break; case PARM_ESC: if (*p == '\"' || *p == '\\' || *p == '#' || *p == ' ' || *p == '\t') { *pos++ = *p; state = PARM; } else { return -1; } break; case PARM_QUO: if (*p == '\\') { state = PARM_QUO_ESC; } else if (*p == '\"') { *pos++ = '\0'; parmv[++parm_no] = pos; state = SPACE_EXP; } else if (*p == '\0' || *p == '\f' || *p == '\n' || *p == '\r' || *p == '\v') { return -1; } else { *pos++ = *p; } break; case PARM_QUO_ESC: if (*p == '\"' || *p == '\\') { *pos++ = *p; state = PARM_QUO; } else if (*p == '\0' || *p == '\f' || *p == '\n' || *p == '\r' || *p == '\v') { return -1; } else { *pos++ = '\\'; *pos++ = *p; state = PARM_QUO; } break; } p++; } int i; for (i = parm_no; i < parmc; i++) parmv[i] = NULL; return parm_no; } /* Checks for a matching xxx_proxy environment variable, and if found stores values in args->p_host and ars->p_port. */ static void proxy_from_env(dav_args *args) { const char *env = NULL; if (args->scheme && strcmp(args->scheme, "https") == 0) env = getenv("https_proxy"); if (!env) env = getenv("http_proxy"); if (!env) env = getenv("all_proxy"); if (!env) return; char *scheme = NULL; char *host = NULL; int port = 0; split_uri(&scheme, &host, &port, NULL, env); if (scheme && strcmp(scheme, "http") == 0 && host) { if (args->p_host) free(args->p_host); args->p_host = host; host = NULL; if (port) args->p_port = port; } if (scheme) free(scheme); if (host) free(host); } /* Reads the configuration file filename and stores the values in args. filename : name of the configuration file. system : boolean value. 1 means it is the system wide configuration file. Some parameters are allowed only in the system wide configuration file, some only in the user configuration file. */ static void read_config(dav_args *args, const char * filename, int system) { FILE *file = fopen(filename, "r"); if (!file) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("opening %s failed"), filename); return; } size_t n = 0; char *line = NULL; int length = getline(&line, &n, file); int lineno = 1; int applies = 1; while (length > 0) { int parmc = 3; char *parmv[parmc]; int count; count = parse_line(line, parmc, parmv); if (count == 1) { if (*parmv[0] != '[' || *(parmv[0] + strlen(parmv[0]) - 1) != ']') error_at_line(EXIT_FAILURE, 0, filename, lineno, _("malformed line")); *(parmv[0] + strlen(parmv[0]) - 1) = '\0'; char *mp = canonicalize_file_name(parmv[0] + 1); if (mp) { applies = (strcmp(mp, mpoint) == 0); free(mp); } } else if (applies && count == 2) { if (system && strcmp(parmv[0], "dav_user") == 0) { if (args->dav_user) free(args->dav_user); args->dav_user = ne_strdup(parmv[1]); } else if (system && strcmp(parmv[0], "dav_group") == 0) { if (args->dav_group) free(args->dav_group); args->dav_group = ne_strdup(parmv[1]); } else if (strcmp(parmv[0], "kernel_fs") == 0) { if (args->kernel_fs) free(args->kernel_fs); args->kernel_fs = ne_strdup(parmv[1]); } else if (strcmp(parmv[0], "buf_size") == 0) { args->buf_size = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "trust_ca_cert") == 0 || strcmp(parmv[0], "servercert") == 0) { if (args->trust_ca_cert) free(args->trust_ca_cert); args->trust_ca_cert = ne_strdup(parmv[1]); } else if (strcmp(parmv[0], "trust_server_cert") == 0) { if (args->trust_server_cert) free(args->trust_server_cert); args->trust_server_cert = ne_strdup(parmv[1]); } else if (!system && strcmp(parmv[0], "secrets") == 0) { if (args->secrets) free(args->secrets); args->secrets = ne_strdup(parmv[1]); } else if (strcmp(parmv[0], "clientcert") == 0) { if (args->clicert) free(args->clicert); args->clicert = ne_strdup(parmv[1]); } else if (system && strcmp(parmv[0], "proxy") == 0) { if (split_uri(NULL, &args->p_host, &args->p_port, NULL, parmv[1]) != 0) error_at_line(EXIT_FAILURE, 0, filename, lineno, _("malformed line")); } else if (system && strcmp(parmv[0], "use_proxy") == 0) { args->useproxy = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "ask_auth") == 0) { args->askauth = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "use_locks") == 0) { args->locks = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "lock_owner") == 0) { if (args->lock_owner) free(args->lock_owner); args->lock_owner = ne_strdup(parmv[1]); } else if (strcmp(parmv[0], "lock_timeout") == 0) { args->lock_timeout = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "lock_refresh") == 0) { args->lock_refresh = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "use_expect100") == 0) { args->expect100 = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "if_match_bug") == 0) { args->if_match_bug = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "drop_weak_etags") == 0) { args->drop_weak_etags = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "n_cookies") == 0) { args->n_cookies = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "precheck") == 0) { args->precheck = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "ignore_dav_header") == 0) { args->ignore_dav_header = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "use_compression") == 0) { args->use_compression = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "min_propset") == 0) { args->min_propset = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "follow_redirect") == 0) { args->follow_redirect = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "connect_timeout") == 0) { args->connect_timeout = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "read_timeout") == 0) { args->read_timeout = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "retry") == 0) { args->retry = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "max_retry") == 0) { args->max_retry = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "max_upload_attempts") == 0) { args->max_upload_attempts = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "server_charset") == 0) { if (args->s_charset) free(args->s_charset); args->s_charset = ne_strdup(parmv[1]); } else if (system && strcmp(parmv[0], "cache_dir") == 0) { if (args->sys_cache) free(args->sys_cache); args->sys_cache = ne_strdup(parmv[1]); } else if (!system && strcmp(parmv[0], "cache_dir") == 0) { if (args->cache_dir != NULL) free(args->cache_dir); args->cache_dir = ne_strdup(parmv[1]); } else if (strcmp(parmv[0], "backup_dir") == 0) { if (args->backup_dir) free(args->backup_dir); args->backup_dir = ne_strdup(parmv[1]); } else if (strcmp(parmv[0], "cache_size") == 0) { args->cache_size = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "table_size") == 0) { args->table_size = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "dir_refresh") == 0) { args->dir_refresh = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "file_refresh") == 0) { args->file_refresh = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "delay_upload") == 0) { args->delay_upload = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "gui_optimize") == 0) { args->gui_optimize = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "minimize_mem") == 0) { args->minimize_mem = arg_to_int(parmv[1], 10, parmv[0]); } else if (strcmp(parmv[0], "debug") == 0) { args->debug |= debug_opts(parmv[1]); args->neon_debug |= debug_opts_neon(parmv[1]); } else { error_at_line(EXIT_FAILURE, 0, filename, lineno, _("unknown option")); } } else if (applies && count == 3) { if (strcmp(parmv[0], "add_header") == 0) { char *tmp = args->header; args->header = ne_concat(parmv[1], ": ", parmv[2], "\r\n", tmp, NULL); if (tmp) free(tmp); } else { error_at_line(EXIT_FAILURE, 0, filename, lineno, _("unknown option")); } } else if (count < 0 || count > 3) { error_at_line(EXIT_FAILURE, 0, filename, lineno, _("malformed line")); } length = getline(&line, &n, file); lineno++; } if (line) free(line); fclose(file); } /* Reads environment variable no_proxy. no_proxy must be a comma separated list of domain names. If no_proxy is "*" or args->p_host matches any of the entries in the no_proxy-list, args->p_host is removed. */ static void read_no_proxy_list(dav_args *args) { if (!args->p_host || !args->host) return; const char *env = getenv("no_proxy"); if (!env) return; if (strcmp(env,"*") == 0) { free(args->p_host); args->p_host = NULL; return; } char *noproxy_list = ne_strdup(env); char *np = strtok(noproxy_list, ", "); while (np && args->p_host) { char *host = NULL; if (strchr(np, ':')) { if (asprintf(&host, "%s:%d", args->host, args->port) < 0) abort(); } else { host = strdup(args->host); } if (*np == '.') { char *substr = strcasestr(host, np); if (substr && *(substr + strlen(np)) == '\0') { free(args->p_host); args->p_host = NULL; } } else { if (strcasecmp(host, np) == 0) { free(args->p_host); args->p_host = NULL; } } free(host); np = strtok(NULL, ", "); } free(noproxy_list); } /* Searches the file filename for credentials for server url and for the proxy args->p_host and stores them in args. */ static void read_secrets(dav_args *args, const char *filename) { struct stat st; if (stat(filename, &st) < 0) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("opening %s failed"), filename); return; } if (st.st_uid != geteuid()) error(EXIT_FAILURE, 0, _("file %s has wrong owner"), filename); if ((st.st_mode & (S_IXUSR | S_IRWXG | S_IRWXO | S_ISUID | S_ISGID | S_ISVTX)) != 0) error(EXIT_FAILURE, 0, _("file %s has wrong permissions"), filename); FILE *file = fopen(filename, "r"); if (!file) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("opening %s failed"), filename); return; } size_t n = 0; char *line = NULL; int length = getline(&line, &n, file); int lineno = 1; while (length > 0) { int parmc = 3; char *parmv[parmc]; int count; count = parse_line(line, parmc, parmv); if (count != 0 && count != 3 && count != 2) error_at_line(EXIT_FAILURE, 0, filename, lineno, _("malformed line")); if (count == 2 || count == 3) { char *scheme = NULL; char *host = NULL; int port = 0; char *path = 0; split_uri(&scheme, &host, &port, &path, parmv[0]); int p_port = port; if (scheme && !port) port = ne_uri_defaultport(scheme); char *mp = canonicalize_file_name(parmv[0]); char *ccert = NULL; if (args->clicert) { ccert = strrchr(args->clicert, '/'); if (ccert && *(ccert + 1) == '\0') ccert = NULL; if (ccert) ccert++; } if ((mp && strcmp(mp, mpoint) == 0) || (scheme && args->scheme && strcmp(scheme, args->scheme) == 0 && host && args->host && strcmp(host, args->host) == 0 && port == args->port && path && args->path && strcmp(path, args->path) == 0)) { if (args->username) { memset(args->username, '\0', strlen(args->username)); free(args->username); } if (args->password) { memset(args->password, '\0', strlen(args->password)); free(args->password); } args->username = ne_strdup(parmv[1]); if (count == 3) args->password = ne_strdup(parmv[2]); } else if (strcmp(parmv[0], "proxy") == 0 || (host && args->p_host && strcmp(host, args->p_host) == 0 && (!p_port || p_port == args->p_port))) { if (args->p_user) { memset(args->p_user, '\0', strlen(args->p_user)); free(args->p_user); } if (args->p_passwd) { memset(args->p_passwd, '\0', strlen(args->p_passwd)); free(args->p_passwd); } args->p_user = ne_strdup(parmv[1]); if (count == 3) args->p_passwd = ne_strdup(parmv[2]); } else if (args->clicert && (strcmp(parmv[0], args->clicert) == 0 || strcmp(parmv[0], ccert) == 0)) { if (count != 2) error_at_line(EXIT_FAILURE, 0, filename, lineno, _("malformed line")); if (args->clicert_pw) { memset(args->clicert_pw, '\0', strlen(args->clicert_pw)); free(args->clicert_pw); } args->clicert_pw = ne_strdup(parmv[1]); } if (scheme) free(scheme); if (host) free(host); if (path) free(path); if (mp) free(mp); } memset(line, '\0', strlen(line)); length = getline(&line, &n, file); lineno++; } if (line) { memset(line, '\0', strlen(line)); free(line); } fclose(file); } /* Splits an uri and returns the components. The uri must contain a host, the other components are optional. It must not contain userinfo. It shall not contain a query or fragment component; they would be treated as part of path. The path component must *not* be %-encoded. scheme, if present in uri, must be either http or https. If host is a IPv6 address, it must be enclosed in square brackets. The pointers to the components may be NULL. If they point to a non-NULL string, it is freed and then replaced by a newly allocated string. If no scheme is foud the default sheme "http" is returned. If no path is found "/" is returned as path. path will always end with "/". There is *no* default value returned for port. return value : 0 on success, -1 otherwise. */ static int split_uri(char **scheme, char **host, int *port,char **path, const char *uri) { if (!uri || !*uri) return -1; const char *sch = NULL; int po = 0; const char *ho = strstr(uri, "://"); if (ho) { if ((ho - uri) == 4 && strcasestr(uri, "http") == uri) { sch = "http"; } else if ((ho - uri) == 5 && strcasestr(uri, "https") == uri) { sch = "https"; } else { return -1; } ho += 3; } else { ho = uri; } if (!*ho) return -1; const char *pa = strchrnul(ho, '/'); if (pa == ho) return -1; const char *end = strchr(ho, '@'); if (end && end < pa) return -1; if (*ho == '[') { end = strchr(ho, ']'); if (!end || end >= pa) return -1; end++; } else { end = strchr(ho, ':'); if (!end) end = pa; } if (end < pa) { if (end == ho || end == (pa - 1) || *end != ':') return -1; char *tail = NULL; po = strtol(end + 1, &tail, 10); if (po <= 0 || tail != pa) return -1; } if (scheme) { if (*scheme) free(*scheme); if (sch) { *scheme = strdup(sch); } else { *scheme = strdup("http"); } if (!*scheme) abort(); } if (port && po) *port = po; if (host) { if (*host) free(*host); *host = malloc(end - ho + 1); if (!*host) abort(); int i; for (i = 0; i < (end - ho); i++) { if (*ho == '[') { *(*host + i) = islower(*(ho + i)) ? toupper(*(ho + i)) : *(ho + i); } else { *(*host + i) = isupper(*(ho + i)) ? tolower(*(ho + i)) : *(ho + i); } } *(*host + i) = '\0'; } if (path) { if (*path) free(*path); if (!*pa) { *path = strdup("/"); } else if (*(pa + strlen(pa) - 1) == '/') { *path = strdup(pa); } else { if (asprintf(path, "%s/", pa) < 1) abort(); } if (!*path) abort(); } return 0; } /* Prints version und help text. */ static void usage(void) { printf(_("Usage:\n" " %s -V,--version : print version string\n" " %s -h,--help : print this message\n\n"), PROGRAM_NAME, PROGRAM_NAME); printf(_("To mount a WebDAV-resource don't call %s directly, but use\n" "`mount' instead.\n"), PROGRAM_NAME); printf(_(" mount : or\n" " mount : mount the WebDAV-resource as specified in\n" " /etc/fstab.\n")); printf(_(" mount -t davfs [-o options]\n" " : mount the WebDAV-resource \n" " on mountpoint . Only root\n" " is allowed to do this. options is a\n" " comma separated list of options.\n\n")); printf(_("Recognised options:\n" " conf= : absolute path of user configuration file\n" " uid= : owner of the filesystem (username or numeric id)\n" " gid= : group of the filesystem (group name or numeric id)\n" " file_mode= : default file mode (octal)\n" " dir_mode= : default directory mode (octal)\n")); printf(_(" ro : mount read-only\n" " rw : mount read-write\n" " [no]exec : (don't) allow execution of binaries\n" " [no]suid : (don't) allow suid and sgid bits to take effect\n" " [no]grpid : new files (don't) get the group id of the directory\n" " in which they are created.\n" " [no]_netdev : (no) network connection needed\n")); } /* Prints prompt to stdout and reads a line from stdin. A trailing newline is removed. return value : the user input. */ static char * user_input(const char *prompt) { printf(" %s ", prompt); char *line = NULL; size_t n = 0; ssize_t len = getline(&line, &n, stdin); if (len < 0) abort(); if (len > 0 && *(line + len - 1) == '\n') *(line + len - 1) = '\0'; return line; } davfs2-1.5.2/src/kernel_interface.c0000644000175000017500000001612712371716651014100 00000000000000/* kernel_interface.c: interface to fuse and coda kernel mocule. Copyright (C) 2006, 2007, 2008, 2009, 2014 Werner Baumann This file is part of davfs2. davfs2 is free software; you can 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. davfs2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with davfs2; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #include #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_LIBINTL_H #include #endif #ifdef HAVE_STDDEF_H #include #endif #ifdef HAVE_STDINT_H #include #endif #include #ifdef HAVE_STDLIB_H #include #endif #include #ifdef HAVE_SYSLOG_H #include #endif #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_MOUNT_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #include #include "defaults.h" #include "mount_davfs.h" #include "cache.h" #include "coda.h" #include "fuse_kernel.h" #include "kernel_interface.h" #ifdef ENABLE_NLS #define _(String) gettext(String) #else #define _(String) String #endif /* Private constants */ /*===================*/ /* Name, major number and minor number of the devices to communicate with the kernel file system. */ #define FUSE_DEV_NAME "fuse" #define CODA_DEV_NAME "cfs" #define CODA_MAJOR 67 #define MAX_CODADEVS 5 /* Coda minor number may be from 0 to 4. */ /* Private function prototypes */ /*=============================*/ static int init_coda(int *dev, dav_run_msgloop_fn *msg_loop, void **mdata); static int init_fuse(int *dev, dav_run_msgloop_fn *msg_loop, void **mdata, size_t *buf_size, const char *url, const char *mpoint, unsigned long int mopts, uid_t owner, gid_t group, mode_t mode); /* Public functions */ /*==================*/ int dav_init_kernel_interface(int *dev, dav_run_msgloop_fn *msg_loop, void **mdata, char **kernel_fs, size_t *buf_size, const char *url, const char *mpoint, const dav_args *args) { uid_t orig = geteuid(); seteuid(0); if (!*kernel_fs) *kernel_fs = strdup("fuse"); if (!*kernel_fs) abort(); int mounted = 0; if (strcmp(*kernel_fs, "coda") == 0) { if (init_coda(dev, msg_loop, mdata) != 0) { error(0, 0, _("trying fuse kernel file system")); if (init_fuse(dev, msg_loop, mdata, buf_size, url, mpoint, args->mopts, args->uid, args->gid, args->dir_mode) == 0) { free(*kernel_fs); *kernel_fs = strdup("fuse"); if (!*kernel_fs) abort(); mounted = 1; error(0, 0, _("fuse device opened successfully")); } else { exit(EXIT_FAILURE); } } } else if (strcmp(*kernel_fs, "fuse") == 0) { if (init_fuse(dev, msg_loop, mdata, buf_size, url, mpoint, args->mopts, args->uid, args->gid, args->dir_mode) == 0) { mounted = 1; } else { error(0, 0, _("trying coda kernel file system")); if (init_coda(dev, msg_loop, mdata) == 0) { free(*kernel_fs); *kernel_fs = strdup("coda"); if (*kernel_fs == NULL) abort(); error(0, 0, _("coda device opened successfully")); } else { exit(EXIT_FAILURE); } } } else { error(EXIT_FAILURE, 0, _("unknown kernel file system %s"), *kernel_fs); } seteuid(orig); return mounted; } /* Private functions */ /*===================*/ static int init_coda(int *dev, dav_run_msgloop_fn *msg_loop, void **mdata) { *dev = 0; int minor = 0; while (*dev <= 0 && minor < MAX_CODADEVS) { char *path; if (asprintf(&path, "%s/%s%i", DAV_DEV_DIR, CODA_DEV_NAME, minor) < 0) abort(); *dev = open(path, O_RDWR | O_NONBLOCK); free(path); ++minor; } if (*dev <= 0) { error(0, 0, _("no free coda device to mount")); return -1; } int version = 0; ioctl(*dev, CIOC_KERNEL_VERSION, &version); if (version == 3) { *msg_loop = dav_coda_loop; } else { error(0, 0, _("CODA_KERNEL_VERSION %u not supported"), version); close(*dev); return -1; } struct coda_mount_data *md = malloc(sizeof(struct coda_mount_data)); if (!md) abort(); md->version = CODA_MOUNT_VERSION; md->fd = *dev; *mdata = md; return 0; } static int init_fuse(int *dev, dav_run_msgloop_fn *msg_loop, void **mdata, size_t *buf_size, const char *url, const char *mpoint, unsigned long int mopts, uid_t owner, gid_t group, mode_t mode) { char *path; if (asprintf(&path, "%s/%s", DAV_DEV_DIR, FUSE_DEV_NAME) < 0) abort(); *dev = open(path, O_RDWR | O_NONBLOCK); if (*dev <= 0) { error(0, 0, _("loading kernel module fuse")); int ret; pid_t pid = fork(); if (pid == 0) { execl("/sbin/modprobe", "modprobe", "fuse", NULL); _exit(EXIT_FAILURE); } else if (pid < 0) { ret = -1; } else { if (waitpid(pid, &ret, 0) != pid) ret = -1; } if (ret) { error(0, 0, _("loading kernel module fuse failed")); } else { *dev = open(path, O_RDWR | O_NONBLOCK); } if (*dev <= 0) { error(0, 0, _("waiting for /dev/fuse to be created")); sleep(2); *dev = open(path, O_RDWR | O_NONBLOCK); } } free(path); if (*dev <= 0) { error(0, 0, _("can't open fuse device")); return -1; } if (*buf_size < (FUSE_MIN_READ_BUFFER + 4096)) { *buf_size = FUSE_MIN_READ_BUFFER + 4096; } #if SIZEOF_VOID_P == 8 if (asprintf((char **) mdata, "fd=%i,rootmode=%o,user_id=%i,group_id=%i," "allow_other,max_read=%lu", *dev, mode, owner, group, (unsigned long int) (*buf_size - 4096)) < 0) abort(); #else if (asprintf((char **) mdata, "fd=%i,rootmode=%o,user_id=%i,group_id=%i," "allow_other,max_read=%u", *dev, mode, owner, group, (unsigned int) (*buf_size - 4096)) < 0) abort(); #endif if (mount(url, mpoint, "fuse", mopts, *mdata) == 0) { *msg_loop = dav_fuse_loop; return 0; } free(*mdata); close(*dev); error(0, 0, _("can't mount using fuse kernel file system")); return -1; } davfs2-1.5.2/src/defaults.h0000644000175000017500000002026212371716631012405 00000000000000/* defauls.h: default values of configuration options and constants. Copyright (C) 2006, 2007, 2008, 2009, 2014 Werner Baumann This file is part of davfs2. davfs2 is free software; you can 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. davfs2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with davfs2; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef DAV_DEFAULTS_H #define DAV_DEFAULTS_H /* Misc. */ /*=======*/ /* File system type to be used with 'mount -t' and fstab. */ #define DAV_FS_TYPE "davfs" /* Mount options set by mount program in case of mounting by an ordinary user. */ #define DAV_USER_MOPTS (MS_MGC_VAL | MS_NOSUID | MS_NOEXEC | MS_NODEV) /* This mount options will allways be set by davfs2. Different values from command line and even fstab will be silently ignored. */ #define DAV_MOPTS (MS_MGC_VAL | MS_NOSUID | MS_NODEV) /* Mode of directories. May be overridden by command line or fstab. */ #define DAV_DIR_MODE (S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) /* Mode of regular files. May be overridden by command line or fstab. */ #define DAV_FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) /* XML namespace for the cache index file. */ #define DAV_XML_NS "http://dav.sf.net/" /* Directories and Files */ /*=======================*/ /* If _PATH_MOUNTED (the mtab file) is a symbolic link (to /proc/mounts) some information required for umount is missing (e.g. the option user= #include #include #ifdef HAVE_LIBINTL_H #include #endif #ifdef HAVE_LOCALE_H #include #endif #include #ifdef HAVE_STDLIB_H #include #endif #include #ifdef HAVE_UNISTD_H #include #endif #include #include "defaults.h" #ifdef ENABLE_NLS #define _(String) gettext(String) #else #define _(String) String #define textdomain(Domainname) #define bindtextdomain(Domainname, Dirname) #endif /* This is lazy programming. All the dirty work is left to the real umount program, while we just sit and wait for mount.davfs to terminate. umount.davfs is a umount helper. It is usually called by umount and makes sure, that umount will not return until mount.davfs has synchronized all files. It first reads the pid-file and identifies the mount.davfs process. Then it calls mount again, with option -i (to not be called again), to do the real unmounting. In a loop it will watch the process list. When the mount.davfs process terminates, it will return. If it can't identify the mount.davfs process, it will call umount -i anyway, but warn the user. */ int main(int argc, char *argv[]) { setuid(getuid()); setgid(getgid()); setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); char *short_options = "Vhflnrt:v"; static const struct option options[] = { {"version", no_argument, NULL, 'V'}, {"help", no_argument, NULL, 'h'}, {0, 0, 0, 0} }; int o; o = getopt_long(argc, argv, short_options, options, NULL); while (o != -1) { switch (o) { case 'V': printf("%s <%s>\n\n", PACKAGE_STRING, PACKAGE_BUGREPORT); printf(_("This is free software; see the source for copying " "conditions. There is NO\n" "warranty; not even for MERCHANTABILITY or FITNESS " "FOR A PARTICULAR PURPOSE.\n")); exit(EXIT_SUCCESS); case 'h': printf(_("Usage:\n" " u%s -V,--version : print version string\n" " u%s -h,--help : print this message\n\n"), PROGRAM_NAME, PROGRAM_NAME); printf(_("To umount a WebDAV-resource don't call u%s directly, " "but use\n" "`umount' instead.\n"), PROGRAM_NAME); printf(_(" umount : umount the WebDAV-resource as " "specified in\n" " /etc/fstab.\n")); exit(EXIT_SUCCESS); case 'f': case 'l': case 'n': case 'r': case 'v': case 't': case '?': break; default: error(EXIT_FAILURE, 0, _("unknown error parsing arguments")); } o = getopt_long(argc, argv, short_options, options, NULL); } if (optind > (argc - 1)) error(EXIT_FAILURE, 0, _("missing argument")); if (optind < (argc - 1)) error(EXIT_FAILURE, 0, _("too many arguments")); char *mpoint = canonicalize_file_name(argv[optind]); char *umount_command = NULL; if (mpoint) { umount_command = ne_concat("umount -i '", mpoint, "'", NULL); } else { umount_command = ne_concat("umount -i '", argv[optind], "'", NULL); error(0, 0, _("\n" " can't evaluate PID file name;\n" " trying to unmount anyway;\n" " please wait for %s to terminate"), PROGRAM_NAME); return system(umount_command); } char *m = mpoint; while (*m == '/') m++; char *mp = ne_strdup(m); m = strchr(mp, '/'); while (m) { *m = '-'; m = strchr(mp, '/'); } char *pidfile = ne_concat(DAV_SYS_RUN, "/", mp, ".pid", NULL); free(mp); char *pid = NULL; FILE *file = fopen(pidfile, "r"); if (!file || fscanf(file, "%a[0-9]", &pid) != 1 || !pid) { error(0, 0, _("\n" " can't read PID from file %s;\n" " trying to unmount anyway;\n" " please wait for %s to terminate"), pidfile, PROGRAM_NAME); return system(umount_command); } fclose(file); char *ps_command = ne_concat("ps -p ", pid, NULL); FILE *ps_in = popen(ps_command, "r"); if (!ps_in) { error(0, 0, _("\n" " can't read process list;\n" " trying to unmount anyway;\n" " please wait for %s to terminate"), PROGRAM_NAME); return system(umount_command); } int found = 0; size_t n = 0; char *ps_line = NULL; while (!found && getline(&ps_line, &n, ps_in) > 0) found = (strstr(ps_line, pid) && strstr(ps_line, PROGRAM_NAME)); pclose(ps_in); if (!found) { error(0, 0, _("\n" " can't find %s-process with pid %s;\n" " trying to unmount anyway.\n" " you propably have to remove %s manually"), PROGRAM_NAME, pid, pidfile); return system(umount_command); } if (system(umount_command) != 0) exit(EXIT_FAILURE); printf(_("%s: waiting while %s (pid %s) synchronizes the cache ."), argv[0], PROGRAM_NAME, pid); fflush(stdout); while (found) { sleep(3); printf("."); fflush(stdout); ps_in = popen(ps_command, "r"); if (!ps_in) { printf("\n"); error(EXIT_FAILURE, 0, _("an error occured while waiting; " "please wait for %s to terminate"), PROGRAM_NAME); } found = 0; while (!found && getline(&ps_line, &n, ps_in) > 0) found = (strstr(ps_line, pid) && strstr(ps_line, PROGRAM_NAME)); pclose(ps_in); } printf(" OK\n"); return 0; } davfs2-1.5.2/src/Makefile.in0000644000175000017500000004517112376154675012511 00000000000000# Makefile.in generated by automake 1.11.6 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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__make_dryrun = \ { \ am__dry=no; \ case $$MAKEFLAGS in \ *\\[\ \ ]*) \ echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \ | grep '^AM OK$$' >/dev/null || am__dry=yes;; \ *) \ for am__flg in $$MAKEFLAGS; do \ case $$am__flg in \ *=*|--*) ;; \ *n*) am__dry=yes; break;; \ esac; \ done;; \ esac; \ test $$am__dry = yes; \ } 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@ sbin_PROGRAMS = mount.davfs$(EXEEXT) umount.davfs$(EXEEXT) subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/davfs2.m4 \ $(top_srcdir)/config/gettext.m4 $(top_srcdir)/config/iconv.m4 \ $(top_srcdir)/config/intlmacosx.m4 \ $(top_srcdir)/config/lib-ld.m4 \ $(top_srcdir)/config/lib-link.m4 \ $(top_srcdir)/config/lib-prefix.m4 \ $(top_srcdir)/config/neon.m4 $(top_srcdir)/config/nls.m4 \ $(top_srcdir)/config/po.m4 $(top_srcdir)/config/progtest.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(sbindir)" PROGRAMS = $(sbin_PROGRAMS) am_mount_davfs_OBJECTS = cache.$(OBJEXT) dav_coda.$(OBJEXT) \ dav_fuse.$(OBJEXT) kernel_interface.$(OBJEXT) \ mount_davfs.$(OBJEXT) webdav.$(OBJEXT) mount_davfs_OBJECTS = $(am_mount_davfs_OBJECTS) mount_davfs_LDADD = $(LDADD) am_umount_davfs_OBJECTS = umount_davfs.$(OBJEXT) umount_davfs_OBJECTS = $(am_umount_davfs_OBJECTS) umount_davfs_LDADD = $(LDADD) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ SOURCES = $(mount_davfs_SOURCES) $(umount_davfs_SOURCES) DIST_SOURCES = $(mount_davfs_SOURCES) $(umount_davfs_SOURCES) am__can_run_installinfo = \ case $$AM_UPDATE_INFO_DIR in \ n|no|NO) false;; \ *) (install-info --version) >/dev/null 2>&1;; \ esac ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = -DPROGRAM_NAME=\"mount.davfs\" \ -DDAV_SYS_CONF_DIR=\"$(pkgsysconfdir)\" \ -DDAV_LOCALSTATE_DIR=\"$(dav_localstatedir)\" \ -DDAV_SYS_RUN=\"$(pkglocalstatedir)\" \ -DDAV_SYS_CACHE=\"$(pkgsyscachedir)\" \ -DDAV_SECRETS=\"secrets\" \ -DDAV_CONFIG=\"$(PACKAGE).conf\" \ -DDAV_CERTS_DIR=\"certs\" \ -DDAV_CLICERTS_DIR=\"private\" \ -DDAV_DATA_DIR=\"$(pkgdatadir)\" \ -DLOCALEDIR=\"$(localedir)\" \ -DDAV_USER=\"$(dav_user)\" \ -DDAV_GROUP=\"$(dav_group)\" \ -D_FORTIFY_SOURCE=2 @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GETTEXT_MACRO_VERSION = @GETTEXT_MACRO_VERSION@ GMSGFMT = @GMSGFMT@ GMSGFMT_015 = @GMSGFMT_015@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ INTL_MACOSX_LIBS = @INTL_MACOSX_LIBS@ LDFLAGS = @LDFLAGS@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBOBJS = @LIBOBJS@ LIBS = $(NEON_LIBS) @LIBS@ LINGUAS = @LINGUAS@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ MSGFMT = @MSGFMT@ MSGFMT_015 = @MSGFMT_015@ MSGMERGE = @MSGMERGE@ NEON_CONFIG = @NEON_CONFIG@ NEON_LIBS = @NEON_LIBS@ NE_FLAG_IPV6 = @NE_FLAG_IPV6@ NE_FLAG_LFS = @NE_FLAG_LFS@ NE_FLAG_SOCKS = @NE_FLAG_SOCKS@ NE_FLAG_SSL = @NE_FLAG_SSL@ NE_FLAG_TS_SSL = @NE_FLAG_TS_SSL@ NE_FLAG_ZLIB = @NE_FLAG_ZLIB@ OBJEXT = @OBJEXT@ 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@ POSUB = @POSUB@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XGETTEXT_015 = @XGETTEXT_015@ XGETTEXT_EXTRA_OPTIONS = @XGETTEXT_EXTRA_OPTIONS@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ dav_group = @dav_group@ dav_linguas = @dav_linguas@ dav_localstatedir = @dav_localstatedir@ dav_syscachedir = @dav_syscachedir@ dav_user = @dav_user@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = $(datadir)/locale localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ ssbindir = @ssbindir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ pkgsysconfdir = $(sysconfdir)/@PACKAGE@ pkglocalstatedir = $(dav_localstatedir)/mount.davfs pkgsyscachedir = $(dav_syscachedir)/@PACKAGE@ mount_davfs_SOURCES = cache.c dav_coda.c \ dav_fuse.c kernel_interface.c mount_davfs.c webdav.c \ cache.h coda.h defaults.h fuse_kernel.h \ kernel_interface.h mount_davfs.h webdav.h umount_davfs_SOURCES = umount_davfs.c defaults.h AM_CFLAGS = -Wall -Werror=format-security \ -fstack-protector --param=ssp-buffer-size=4 all: all-am .SUFFIXES: .SUFFIXES: .c .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): 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; \ 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) $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(sbindir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(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: -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS) mount.davfs$(EXEEXT): $(mount_davfs_OBJECTS) $(mount_davfs_DEPENDENCIES) $(EXTRA_mount_davfs_DEPENDENCIES) @rm -f mount.davfs$(EXEEXT) $(LINK) $(mount_davfs_OBJECTS) $(mount_davfs_LDADD) $(LIBS) umount.davfs$(EXEEXT): $(umount_davfs_OBJECTS) $(umount_davfs_DEPENDENCIES) $(EXTRA_umount_davfs_DEPENDENCIES) @rm -f umount.davfs$(EXEEXT) $(LINK) $(umount_davfs_OBJECTS) $(umount_davfs_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cache.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dav_coda.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dav_fuse.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/kernel_interface.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mount_davfs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/umount_davfs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/webdav.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @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)$(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: 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-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 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 all all-am check check-am clean clean-generic \ clean-sbinPROGRAMS ctags distclean distclean-compile \ distclean-generic 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 pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-hook \ uninstall-sbinPROGRAMS install-exec-hook: chmod u+s $(DESTDIR)$(sbindir)/mount.davfs; \ if test "$(sbindir)" != "$(ssbindir)"; then \ $(mkinstalldirs) $(DESTDIR)$(ssbindir); \ $(LN_S) -f $(sbindir)/mount.davfs $(DESTDIR)$(ssbindir)/mount.davfs; \ $(LN_S) -f $(sbindir)/umount.davfs $(DESTDIR)$(ssbindir)/umount.davfs; \ fi uninstall-hook: if test "$(sbindir)" != "$(ssbindir)"; then \ rm -f $(DESTDIR)$(ssbindir)/mount.davfs; \ rm -f $(DESTDIR)$(ssbindir)/umount.davfs; \ fi # 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: davfs2-1.5.2/src/kernel_interface.h0000644000175000017500000001034411171165021014062 00000000000000/* kernel_interface.h: interface to fuse and coda kernel mocule. Copyright (C) 2006, 2007, 2008, 2009 Werner Baumann This file is part of davfs2. davfs2 is free software; you can 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. davfs2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with davfs2; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef DAV_KERNEL_INTERFACE_H #define DAV_KERNEL_INTERFACE_H /* Function type definitions */ /*===========================*/ /* Call back function to be passed to dav_init_kernel_interface(). Will be called to see whether the file system is still mounted. return value : 1 is mounted, 0 is not mounted. */ typedef int (*dav_is_mounted_fn)(void); /* Typedef of the message loop of the specific kernel interfaces. The real function will be returned by dav_init_kernel_interface(). device : File descriptor of the open fuse device. buf_size : Size of the buffer for communication with the kernel module. idle_t : Time to wait for upcalls before calling dav_tidy_cache(). is_mounted_fn : Call back function to check of still mounted. keep_on_running : Pointer to run flag. dbg : send debug messages to syslog if dbg != 0 */ typedef void (*dav_run_msgloop_fn)(int device, size_t bufsize, time_t idle_time, dav_is_mounted_fn is_mounted, volatile int *keep_on_running, int dbg); /* Function prototypes */ /*=====================*/ /* Opens the device for communication with the kernel file system, if possible mounts the file system and updates the interface data (dev, dav_ran_msgloop_fn, mdata, kernel_fs and buf_size). In case of an error it prints an error message and terminates the program. dev : File descriptor of the open device for communication with the kernel file system. msg_loop : The specific message loop function that will process the kernel upcalls. mdata : That mount data that will be passed to the mount function. kernel_fs : Type of the kernel file system to us (fuse or coda). If this does not work, the other file system will be tried. The name of the file system that is really used is returned. If NULL, fuse is tried first. buf_size : Size of the buffer for communication with the kernel file system (fuse only). The size passed to this function is checked against the requirements of the kernel fs and updated if necessary. url : Server url. mpoint : Mount point. mopts : Mount options. owner : The owner of the file system (fuse only). group : Group the file system belongs to (fuse only). mode : Mode of the root node (fuse only). return value : 0: the file system has not yet been mounted 1: the file system has been mounted successfully. */ int dav_init_kernel_interface(int *dev, dav_run_msgloop_fn *msg_loop, void **mdata, char **kernel_fs, size_t *buf_size, const char *url, const char *mpoint, const dav_args *args); /* Message loop for coda kernel module CODA_KERNEL_VERSION 3. Parameters see dav_run_msgloop_fn(). */ void dav_coda_loop(int device, size_t bufsize, time_t idle_time, dav_is_mounted_fn is_mounted, volatile int *keep_on_running, int dbg); /* Message loop for fuse kernel module with major number 7. Parameters see dav_run_msgloop_fn(). */ void dav_fuse_loop(int device, size_t bufsize, time_t idle_time, dav_is_mounted_fn is_mounted, volatile int *keep_on_running, int dbg); #endif /* DAV_KERNEL_INTERFACE_H */ davfs2-1.5.2/src/dav_coda.c0000644000175000017500000006115012361545726012336 00000000000000/* dav_coda.c: interface to the Coda kernel module CODA_KERNEL_VERSION 3. Copyright (C) 2006, 2007, 2008, 2009 Werner Baumann This file is part of davfs2. davfs2 is free software; you can 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. davfs2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with davfs2; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #include #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_LIBINTL_H #include #endif #ifdef HAVE_LIMITS_H #include #endif #ifdef HAVE_STDDEF_H #include #endif #ifdef HAVE_STDINT_H #include #endif #include #include #include #ifdef HAVE_SYSLOG_H #include #endif #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_SYS_TIME_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #include "defaults.h" #include "mount_davfs.h" #include "cache.h" #include "kernel_interface.h" #include "coda.h" #ifdef ENABLE_NLS #define _(String) gettext(String) #else #define _(String) String #endif /* Constants */ /*===========*/ /* Size of buffer for communication with the kernel module. */ #define BUF_SIZE 2048 /* This constants are used by davfs2 to fill fields of struct CodaFid that are not used by davfs2, but are expected by coda. */ #define DAV_VOL 0x01234567 #define DAV_VNODE 0xffffffff /* Private global variables */ /*==========================*/ /* Buffer used for communication with the kernel module (in and out). */ static char *buf; /* The preferred blocksize used by the local filesystem for cache files. Used by set_attr(). */ static unsigned int blocksize; /* Alignment boundary of dav_node in byte. Used to compute file numbers from node pointers. */ static size_t alignment; /* Send debug messages to syslog if != 0. */ int debug; /* Private function prototypes */ /*=============================*/ /* Functions to handle upcalls fromthe kernel module. */ static uint32_t coda_access(void); static uint32_t coda_close(void); static uint32_t coda_create(void); static uint32_t coda_getattr(void); static uint32_t coda_lookup(void); static uint32_t coda_mkdir(void); static uint32_t coda_open_by_fd(void); static uint32_t coda_root(void); static uint32_t coda_setattr(void); static uint32_t coda_statfs(void); /* Functions that will do a downcall to the kernel module. */ static void coda_flush(int device); /* Auxiliary functions. */ static off_t write_dir_entry(int fd, off_t off, const dav_node *node, const char *name); static void set_attr(struct coda_vattr *attr, const dav_node *node); /* Public functions */ /*==================*/ void dav_coda_loop(int device, size_t bufsize, time_t idle_time, dav_is_mounted_fn is_mounted, volatile int *keep_on_running, int dbg) { debug = dbg; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "coda kernel version 3"); buf = malloc(BUF_SIZE); if (!buf) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("can't allocate message buffer")); return; } static int flush = 0; alignment = dav_register_kernel_interface(&write_dir_entry, &flush, &blocksize); struct timeval tv; tv.tv_sec = idle_time; tv.tv_usec = 0; time_t last_tidy_cache = time(NULL); while (*keep_on_running) { fd_set fds; FD_ZERO(&fds); FD_SET(device, &fds); int ret = select(device + 1, &fds, NULL, NULL, &tv); if (ret > 0) { ssize_t bytes_read = read(device, buf, BUF_SIZE); if (bytes_read <= 0) { if (bytes_read == 0 || errno == EINTR || errno == EAGAIN) { if (time(NULL) < (last_tidy_cache + idle_time)) { tv.tv_sec = last_tidy_cache + idle_time - time(NULL); } else { tv.tv_sec = 0; } continue; } break; } } else if (ret == 0) { if (!is_mounted()) break; if (dav_tidy_cache() == 0) { tv.tv_sec = idle_time; last_tidy_cache = time(NULL); } else { tv.tv_sec = 0; } continue; } else { break; } struct coda_in_hdr *ih = (struct coda_in_hdr *) buf; struct coda_out_hdr *oh = (struct coda_out_hdr *) buf; uint32_t len; switch (ih->opcode) { case CODA_ROOT: len = coda_root(); break; case CODA_OPEN_BY_FD: len = coda_open_by_fd(); break; case CODA_OPEN: if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_OPEN:"); oh->result = ENOSYS; len = sizeof(struct coda_out_hdr); break; case CODA_CLOSE: len = coda_close(); last_tidy_cache = 0; break; case CODA_IOCTL: if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_IOCTL:"); oh->result = ENOSYS; len = sizeof(struct coda_out_hdr); break; case CODA_GETATTR: len = coda_getattr(); break; case CODA_SETATTR: len = coda_setattr(); break; case CODA_ACCESS: len = coda_access(); break; case CODA_LOOKUP: len = coda_lookup(); break; case CODA_CREATE: len = coda_create(); break; case CODA_REMOVE: { struct coda_remove_in *in = (struct coda_remove_in *) buf; dav_node *node = *((dav_node **) &(in->VFid.opaque[2])); if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_REMOVE:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " p %p, %s", node, buf + in->name); } oh->result = dav_remove(node, buf + in->name, ih->uid); len = sizeof(struct coda_out_hdr); break; } case CODA_LINK: if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_LINK:"); oh->result = ENOSYS; len = sizeof(struct coda_out_hdr); break; case CODA_RENAME: { struct coda_rename_in *in = (struct coda_rename_in *) buf; dav_node *src = *((dav_node **) &(in->sourceFid.opaque[2])); dav_node *dst = *((dav_node **) &(in->destFid.opaque[2])); if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_RENAME:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " sp %p, %s", src, buf + in->srcname); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " dp %p, %s", dst, buf + in->destname); } oh->result = dav_rename(src, buf + in->srcname, dst, buf + in->destname, ih->uid); len = sizeof(struct coda_out_hdr); break; } case CODA_MKDIR: len = coda_mkdir(); break; case CODA_RMDIR: { struct coda_rmdir_in *in = (struct coda_rmdir_in *) buf; dav_node *node = *((dav_node **) &(in->VFid.opaque[2])); if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_RMDIR:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " p %p, %s", node, buf + in->name); } oh->result = dav_rmdir(node, buf + in->name, ih->uid); len = sizeof(struct coda_out_hdr); break; } case CODA_SYMLINK: if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_SYMLINK:"); oh->result = ENOSYS; len = sizeof(struct coda_out_hdr); break; case CODA_READLINK: if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_READLINK:"); oh->result = ENOSYS; len = sizeof(struct coda_out_hdr); break; case CODA_FSYNC: { struct coda_fsync_in *in = (struct coda_fsync_in *) buf; dav_node *node = *((dav_node **) &(in->VFid.opaque[2])); if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_FSYNC:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " n %p", node); } oh->result = dav_sync(node); len = sizeof(struct coda_out_hdr); break; } case CODA_VGET: if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_VGET:"); oh->result = ENOSYS; len = sizeof(struct coda_out_hdr); break; case CODA_OPEN_BY_PATH: if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_OPEN_BY_PATH:"); oh->result = ENOSYS; len = sizeof(struct coda_out_hdr); break; case CODA_STATFS: len = coda_statfs(); break; case CODA_STORE: { struct coda_store_in *in = (struct coda_store_in *) buf; dav_node *node = *((dav_node **) &(in->VFid.opaque[2])); if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_STORE:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " n %p, f 0x%x", node, in->flags); } oh->result = dav_sync(node); len = sizeof(struct coda_out_hdr); break; } case CODA_RELEASE: len = coda_close(); last_tidy_cache = 0; break; default: if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "UNKNOWN CODA CALL %u", ih->opcode); oh->result = ENOSYS; len = sizeof(struct coda_out_hdr); break; } if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "RET: %s", strerror(oh->result)); ssize_t n = 0; ssize_t w = 0; while (n < len && w >= 0) { w = write(device, buf + n, len - n); n += w; } if (time(NULL) < (last_tidy_cache + idle_time)) { tv.tv_sec = last_tidy_cache + idle_time - time(NULL); } else { dav_tidy_cache(); tv.tv_sec = idle_time; last_tidy_cache = time(NULL); } if (flush) { coda_flush(device); flush = 0; } } } /* Private functions */ /*===================*/ /* Functions to handle upcalls fromthe kernel module. The cache module only uses data types from the C-library. For file access, mode and the like it only uses symbolic constants defined in the C-library. So the main porpose of this functions is to translate from kernel specific types and constants to types and constants from the C-library, and back. All of this functions return the amount of data in buf that is to be send to the kernel module. */ static uint32_t coda_access(void) { struct coda_in_hdr *ih = (struct coda_in_hdr *) buf; struct coda_access_in *in = (struct coda_access_in *) buf; dav_node *node = *((dav_node **) &(in->VFid.opaque[2])); struct coda_out_hdr *oh = (struct coda_out_hdr *) buf; if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_ACCESS:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " n %p, f %x", node, in->flags); } int how = (in->flags & C_A_R_OK) ? R_OK : 0; how |= (in->flags & C_A_W_OK) ? W_OK : 0; how |= (in->flags & C_A_X_OK) ? X_OK : 0; how |= (in->flags & C_A_F_OK) ? F_OK : 0; oh->result = dav_access(node, ih->uid, how); return sizeof(struct coda_out_hdr); } static uint32_t coda_close(void) { struct coda_in_hdr *ih = (struct coda_in_hdr *) buf; struct coda_close_in *in = (struct coda_close_in *) buf; dav_node *node = *((dav_node **) &(in->VFid.opaque[2])); struct coda_out_hdr *oh = (struct coda_out_hdr *) buf; if (debug) { if (ih->opcode == CODA_CLOSE) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_CLOSE:"); } else { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_RELEASE:"); } syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " n %p, f %x", node, in->flags); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " pid %i, pgid %i", ih->pid, ih->pgid); } int flags = 0; if ((in->flags & C_O_READ) && (in->flags & C_O_WRITE)) { flags = O_RDWR; } else if (in->flags & C_O_READ) { flags = O_RDONLY; } else if (in->flags & C_O_WRITE) { flags = O_WRONLY; } oh->result = dav_close(node, 0, flags, ih->pid, ih->pgid); return sizeof(struct coda_out_hdr); } static uint32_t coda_create(void) { struct coda_in_hdr *ih = (struct coda_in_hdr *) buf; struct coda_create_in *in = (struct coda_create_in *) buf; dav_node *parent = *((dav_node **) &(in->VFid.opaque[2])); struct coda_out_hdr *oh = (struct coda_out_hdr *) buf; struct coda_create_out *out = (struct coda_create_out *) buf; if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_CREATE:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " p %p, m %o", parent, in->mode); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " %s", buf + in->name); } dav_node *node = NULL; oh->result = dav_create(&node, parent, buf + in->name, ih->uid, in->mode & DAV_A_MASK); if (oh->result || !node) { if (!oh->result) oh->result = EIO; return sizeof(struct coda_out_hdr); } out->VFid.opaque[0] = DAV_VOL; out->VFid.opaque[1] = DAV_VNODE; out->VFid.opaque[3] = 0; *((dav_node **) &(out->VFid.opaque[2])) = node; set_attr(&out->attr, node); return sizeof(struct coda_create_out); } static uint32_t coda_getattr(void) { struct coda_in_hdr *ih = (struct coda_in_hdr *) buf; struct coda_getattr_in *in = (struct coda_getattr_in *) buf; dav_node *node = *((dav_node **) &(in->VFid.opaque[2])); struct coda_out_hdr *oh = (struct coda_out_hdr *) buf; struct coda_getattr_out *out = (struct coda_getattr_out *) buf; if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_GETATTR:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " n %p", node); } oh->result = dav_getattr(node, ih->uid); if (oh->result) return sizeof(struct coda_out_hdr); set_attr(&out->attr, node); return sizeof(struct coda_getattr_out); } static uint32_t coda_lookup(void) { struct coda_in_hdr *ih = (struct coda_in_hdr *) buf; struct coda_lookup_in *in = (struct coda_lookup_in *) buf; dav_node *parent = *((dav_node **) &(in->VFid.opaque[2])); struct coda_out_hdr *oh = (struct coda_out_hdr *) buf; struct coda_lookup_out *out = (struct coda_lookup_out *) buf; if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_LOOKUP:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " p %p, %s", parent, buf + in->name); } dav_node *node = NULL; oh->result = dav_lookup(&node, parent, buf + in->name, ih->uid); if (oh->result || !node) { if (!oh->result) oh->result = EIO; return sizeof(struct coda_out_hdr); } out->VFid.opaque[0] = DAV_VOL; out->VFid.opaque[1] = DAV_VNODE; out->VFid.opaque[3] = 0; *((dav_node **) &(out->VFid.opaque[2])) = node; out->vtype = (node->mode & S_IFDIR) ? CDT_DIR : CDT_REG; return sizeof(struct coda_lookup_out); } static uint32_t coda_mkdir(void) { struct coda_in_hdr *ih = (struct coda_in_hdr *) buf; struct coda_mkdir_in *in = (struct coda_mkdir_in *) buf; dav_node *parent = *((dav_node **) &(in->VFid.opaque[2])); struct coda_out_hdr *oh = (struct coda_out_hdr *) buf; struct coda_mkdir_out *out = (struct coda_mkdir_out *) buf; if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_MKDIR:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " p %p, %s", parent, buf + in->name); } dav_node *node = NULL; oh->result = dav_mkdir(&node, parent, buf + in->name, ih->uid, in->attr.va_mode & DAV_A_MASK); if (oh->result || !node) { if (!oh->result) oh->result = EIO; return sizeof(struct coda_out_hdr); } out->VFid.opaque[0] = DAV_VOL; out->VFid.opaque[1] = DAV_VNODE; out->VFid.opaque[3] = 0; *((dav_node **) &(out->VFid.opaque[2])) = node; set_attr(&out->attr, node); return sizeof(struct coda_mkdir_out); } static uint32_t coda_open_by_fd(void) { struct coda_in_hdr *ih = (struct coda_in_hdr *) buf; struct coda_open_by_fd_in *in = (struct coda_open_by_fd_in *) buf; dav_node *node = *((dav_node **) &(in->VFid.opaque[2])); struct coda_out_hdr *oh = (struct coda_out_hdr *) buf; struct coda_open_by_fd_out *out = (struct coda_open_by_fd_out *) buf; if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_OPEN_BY_FD:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " n %p, f %x", node, in->flags); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " pid %i, pgid %i", ih->pid, ih->pgid); } int flags = 0; if ((in->flags & C_O_READ) && (in->flags & C_O_WRITE)) { flags = O_RDWR; } else if (in->flags & C_O_READ) { flags = O_RDONLY; } else if (in->flags & C_O_WRITE) { flags = O_WRONLY; } flags |= (in->flags & C_O_TRUNC) ? O_TRUNC : 0; oh->result = dav_open(&out->fd, node, flags, ih->pid, ih->pgid, ih->uid, 0); if (oh->result || !out->fd) { if (!oh->result) oh->result = EIO; return sizeof(struct coda_out_hdr); } return sizeof(struct coda_open_by_fd_out); } static uint32_t coda_root(void) { struct coda_in_hdr *ih = (struct coda_in_hdr *) buf; struct coda_out_hdr *oh = (struct coda_out_hdr *) buf; struct coda_root_out *out = (struct coda_root_out *) buf; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_ROOT:"); dav_node *node = NULL; oh->result = dav_root(&node, ih->uid); if (oh->result || !node) { if (!oh->result) oh->result = EIO; return sizeof(struct coda_out_hdr); } out->VFid.opaque[0] = DAV_VOL; out->VFid.opaque[1] = DAV_VNODE; out->VFid.opaque[3] = 0; *((dav_node **) &(out->VFid.opaque[2])) = node; return sizeof(struct coda_root_out); } static uint32_t coda_setattr(void) { struct coda_in_hdr *ih = (struct coda_in_hdr *) buf; struct coda_setattr_in *in = (struct coda_setattr_in *) buf; dav_node *node = *((dav_node **) &(in->VFid.opaque[2])); struct coda_out_hdr *oh = (struct coda_out_hdr *) buf; if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_SETATTR:"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " n %p, m %o", node, in->attr.va_mode); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " uid: %i, gid: %i", in->attr.va_uid, in->attr.va_gid); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " at %li, mt %li", in->attr.va_atime.tv_sec, in->attr.va_mtime.tv_sec); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " ct %li, sz %llu", in->attr.va_ctime.tv_sec, in->attr.va_size); } oh->result = dav_setattr(node, ih->uid, in->attr.va_mode != USHRT_MAX, in->attr.va_mode & DAV_A_MASK, in->attr.va_uid != UINT32_MAX, in->attr.va_uid, in->attr.va_gid != UINT32_MAX, in->attr.va_gid, in->attr.va_atime.tv_sec != -1, in->attr.va_atime.tv_sec, in->attr.va_mtime.tv_sec != -1, in->attr.va_mtime.tv_sec, in->attr.va_size != UINT64_MAX, in->attr.va_size); return sizeof(struct coda_out_hdr); } static uint32_t coda_statfs(void) { struct coda_out_hdr *oh = (struct coda_out_hdr *) buf; struct coda_statfs_out *out = (struct coda_statfs_out *) buf; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "CODA_STATFS:"); dav_stat *st = dav_statfs(); if (!st) { oh->result = EIO; return sizeof(struct coda_out_hdr); } out->stat.f_blocks = st->blocks; out->stat.f_bfree = st->bavail; out->stat.f_bavail = st->bavail; out->stat.f_files = st->files; out->stat.f_ffree = st->ffree; oh->result = 0; return sizeof(struct coda_statfs_out); } /* Functions that will do a downcall to the kernel module. */ /* Downcall to inform the kernel that nodes have been added or removed. */ static void coda_flush(int device) { struct coda_out_hdr *oh = (struct coda_out_hdr *) buf; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " CODA_FLUSH:"); oh->opcode = CODA_FLUSH; oh->unique = 0; oh->result = 0; ssize_t n = 0; ssize_t w = 0; while (n < sizeof(struct coda_out_hdr) && w >= 0) { w = write(device, buf + n, sizeof(struct coda_out_hdr) - n); n += w; } } /* Auxiliary functions. */ /* Writes a struct venus_dirent to file with file descriptor fd. fd : An open file descriptor to write to. off : The current file size. name : File name; if NULL, the last, empty entry is written. return value : New size of the file. -1 in case of an error. */ static off_t write_dir_entry(int fd, off_t off, const dav_node *node, const char *name) { struct venus_dirent entry; size_t head = offsetof(struct venus_dirent, d_name); if (name) { entry.d_fileno = (size_t) node / alignment; entry.d_type = (S_ISDIR(node->mode)) ? CDT_DIR : CDT_REG; entry.d_namlen = (strlen(name) > CODA_MAXNAMLEN) ? CODA_MAXNAMLEN : strlen(name); entry.d_reclen = (head + entry.d_namlen +4) & ~3; } else { entry.d_fileno = 0; entry.d_type = 0; entry.d_namlen = 0; entry.d_reclen = (head + 4) & ~3; } size_t size = 0; ssize_t ret = 0; while (ret >= 0 && size < head) { ret = write(fd, (char *) &entry + size, head - size); size += ret; } if (size != head) return -1; ret = 0; while (ret >= 0 && size < (head + entry.d_namlen)) { ret = write(fd, name + size - head, entry.d_namlen - size + head); size += ret; } if (size != (head + entry.d_namlen)) return -1; ret = 0; while (ret >= 0 && size < entry.d_reclen) { ret = write(fd, "\0", 1); size += ret; } if (size != entry.d_reclen) return -1; return off + entry.d_reclen; } /* Translates attribute from node to attr. Note: Members va_fileid, v_gen, va_flags, va_rdev and va_filerev have no meaning for davfs. va_fileid is treated like d_fileno in struct venus_dirent, the other are set to zero. The meaning of va_type is not clear at all. Times are only set with 1 second precision, as this is the precision of the last-modified time in HTTP. */ static void set_attr(struct coda_vattr *attr, const dav_node *node) { attr->va_type = 0; attr->va_mode = node->mode; if (S_ISDIR(node->mode)) { attr->va_nlink = node->nref; } else { attr->va_nlink = 1; } attr->va_uid = node->uid; attr->va_gid = node->gid; attr->va_fileid = (size_t) node / alignment; attr->va_size = node->size; attr->va_blocksize = blocksize; attr->va_atime.tv_sec = node->atime; attr->va_atime.tv_nsec = 0; attr->va_mtime.tv_sec = node->mtime; attr->va_mtime.tv_nsec = 0; attr->va_ctime.tv_sec = node->ctime; attr->va_ctime.tv_nsec = 0; attr->va_gen = 0; attr->va_flags = 0; attr->va_rdev = 0; attr->va_bytes = node->size; attr->va_filerev = 0; } davfs2-1.5.2/src/cache.c0000644000175000017500000031673112371716460011645 00000000000000/* cache.c: directory and file cache. Copyright (C) 2006, 2007, 2008, 2009, 2014 Werner Baumann This file is part of davfs2. davfs2 is free software; you can 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. davfs2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with davfs2; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #ifdef HAVE_DIRENT_H #include #endif #include #include #ifdef HAVE_FCNTL_H #include #endif #include #ifdef HAVE_LIBINTL_H #include #endif #include #ifdef HAVE_STDINT_H #include #endif #include #ifdef HAVE_STDLIB_H #include #endif #include #ifdef HAVE_SYSLOG_H #include #endif #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_UTIME_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #ifdef HAVE_SYS_TYPES_H #include #endif #include #include #include #include #include "defaults.h" #include "mount_davfs.h" #include "webdav.h" #include "cache.h" #ifdef ENABLE_NLS #define _(String) gettext(String) #else #define _(String) String #endif /* Private constants */ /*===================*/ /* Constants describing different types of XML elements and attributes in cache index file. */ enum { ROOT = 1, BACKUP, DDIR, REG, PATH, NAME, CACHE_PATH, SIZE, MODE, UID, GID, ATIME, MTIME, CTIME, SMTIME, ETAG, LOCK_EXPIRE, DIRTY, REMOTE_EXISTS, END }; static const char* const type[] = { [ROOT] = "root", [BACKUP] = "backup", [DDIR] = "dir", [REG] = "reg", [PATH] = "path", [NAME] = "name", [CACHE_PATH] = "cache_path", [SIZE] = "size", [MODE] = "mode", [UID] = "uid", [GID] = "gid", [ATIME] = "atime", [MTIME] = "mtime", [CTIME] = "ctime", [SMTIME] = "smtime", [ETAG] = "etag", [LOCK_EXPIRE] = "lock_expire", [DIRTY] = "dirty", [REMOTE_EXISTS] = "remote_exists", [END] = NULL }; /* Private global variables */ /*==========================*/ /* File system statistics. */ static dav_stat *fs_stat; /* Root node of the directory cache. */ static dav_node *root; /* Directory for local buckups. */ static dav_node *backup; /* A hash table to store the nodes. The hash is computed from the pointer to the node, which is also the node number. */ static dav_node **table; /* Size of the hash table. */ static size_t table_size; /* Number of files in list changed. */ static int nchanged; /* List of nodes, that have been changed and the changes must be saved back to the server. */ static dav_node_list_item *changed; /* How long results of PROPFIND for directories are considered valid. */ static time_t dir_refresh; /* Wait that many seconds from last file access before doing a new GET If-Modiefied request. */ static time_t file_refresh; /* Upload file that many seconds after closing. */ static time_t delay_upload; /* Optimize file updates for graphical user interfaces = use PROPFIND to get the Last-Modified-dates for the whole directory instead of GET If-Modified-Since for single files. */ static int gui_optimize; /* Remove nodes that are currently not needed to minimize memory usage. */ static int minimize_mem; /* When to next run minimize_tree. 0 means to not run minimize_tree. Must be updated when a node is created. */ static time_t next_minimize; /* Time interval to wait, before a directory is updated. Usually equal to dir_refresh, but will be varied in case the connection timed out.*/ static time_t retry; /* Minimum retry time. */ static time_t min_retry; /* Maximum retry time. */ static time_t max_retry; /* Maximum number of upload attempts. */ static int max_upload_attempts; /* Refresh locks this much seconds before they time out. */ static time_t lock_refresh; /* Defaults for file ownership and mode. */ static uid_t default_uid; static gid_t default_gid; static mode_t default_file_mode; static mode_t default_dir_mode; /* New files get the group id of the directory in which they are created if this variable is set to 1. */ static int grpid; /* Directory for cached files and directories. */ static char *cache_dir; /* Maximum cache size. If open files require more space, this will be ignored. */ static unsigned long long max_cache_size; /* Actual cache size. */ static unsigned long long cache_size; /* Alignment boundary of dav_node in byte. Used to compute a hash value and file numbers from node pointers. */ static size_t alignment; /* Pointers that will be set by dav_register_kernel_interface(), which must be called by the kernel-interface. Initialized to point to dummies as long as dav_register_kernel_interface() has not been called. */ /* A call back functions, that writes one direntry. The dummy returns EIO. Registering a working function is essential for mount.davfs. */ static off_t write_dir_entry_dummy(int fd, off_t off, const dav_node *node, const char *name) { return -1; } static dav_write_dir_entry_fn write_dir_entry = write_dir_entry_dummy; /* Points to a flag in the kernel interface module. If set to 1, at the end of the upcall the kernel dentries will be flushed. */ static int flush_dummy; static int *flush = &flush_dummy; /* Whether to create debug messages. */ static int debug; /* Buffer for xml_cdata callback. */ static char *xml_data = NULL; /* Private function prototypes and inline functions */ /*==================================================*/ /* Node operations. */ static void add_node(dav_node *parent, dav_props *props); static void add_to_changed(dav_node *node); static inline void attr_from_cache_file(dav_node *node) { struct stat st; if (!node->cache_path || stat(node->cache_path, &st) != 0) return; off_t old_size = node->size; node->size = st.st_size; cache_size += node->size - old_size; node->atime = (st.st_atime > node->atime) ? st.st_atime : node->atime; node->mtime = (st.st_mtime > node->mtime) ? st.st_mtime : node->mtime; } static void backup_node(dav_node *orig); static void clean_tree(dav_node *node, volatile int *got_sigterm); static void delete_node(dav_node *node); static void delete_tree(dav_node *node); static inline time_t get_upload_time(dav_node *node) { dav_node_list_item *item = changed; while (item && item->node != node) item = item->next; if (!item) return 0; return item->save_at; } static void minimize_tree(dav_node *node); static int move_dir(dav_node *src, dav_node *dst, dav_node *dst_parent, const char *dst_name); static int move_no_remote(dav_node *src, dav_node *dst, dav_node *dst_parent, const char *dst_name); static int move_reg(dav_node *src, dav_node *dst, dav_node *dst_parent, const char *dst_name); static dav_node * new_node(dav_node *parent, mode_t mode); static void remove_from_changed(dav_node *node); static void remove_from_table(dav_node *node); static void remove_from_tree(dav_node *node); static void remove_node(dav_node *node); static inline int set_next_upload_attempt(dav_node *node) { dav_node_list_item *item = changed; while (item && item->node != node) item = item->next; if (!item) return 0; item->attempts++; if (item->attempts > max_upload_attempts) return -1; time_t delay = item->attempts * min_retry; item->save_at += (delay > max_retry) ? max_retry : delay; return 0; } static inline void set_upload_time(dav_node *node) { dav_node_list_item *item = changed; while (item && item->node != node) item = item->next; if (item) item->save_at = time(NULL) + delay_upload; } static int update_directory(dav_node *dir, time_t refresh); static int update_node(dav_node *node, dav_props *props); static void update_path(dav_node *node, const char *src_path, const char *dst_path); /* Get information about node. */ static int exists(const dav_node *node); static inline dav_node * get_child(const dav_node *parent, const char *name) { dav_node *node = parent->childs; while (node && strcmp(name, node->name) != 0) node = node->next; return node; } static dav_handle * get_file_handle(dav_node * node, int fd, int accmode, pid_t pid, pid_t pgid); static int has_permission(const dav_node *node, uid_t uid, int how); static inline int is_backup(const dav_node *node) { return (node == backup || node->parent == backup); } static int is_busy(const dav_node *node); static inline int is_cached(dav_node *node) { return (S_ISREG(node->mode) && node->cache_path); } static inline int is_created(const dav_node *node) { return (S_ISREG(node->mode) && node->cache_path && !node->remote_exists && node->parent && node->parent != backup); } static inline int is_dir(const dav_node *node) { return S_ISDIR(node->mode); } static inline int is_dirty(const dav_node *node) { return (S_ISREG(node->mode) && node->dirty); } static inline int is_locked(const dav_node *node) { return (S_ISREG(node->mode) && node->lock_expire); } static inline int is_open(const dav_node *node) { return (node->handles != NULL); } static inline int is_open_write(const dav_node *node) { dav_handle *fh = node->handles; while (fh) { if (fh->flags == O_RDWR || fh->flags == O_WRONLY) return 1; fh = fh->next; } return 0; } static inline int is_reg(const dav_node *node) { return S_ISREG(node->mode); } static int is_valid(const dav_node *node); /* Cache file functions. */ static void close_fh(dav_node *node, dav_handle *fh); static int create_cache_file(dav_node *node); static int create_dir_cache_file(dav_node *node); static inline void delete_cache_file(dav_node *node) { if (node->cache_path) { remove(node->cache_path); free(node->cache_path); node->cache_path = NULL; node->dirty = 0; if (is_reg(node)) cache_size -= node->size; } } static inline void set_cache_file_times(dav_node *node) { if (!node->cache_path) return; struct utimbuf t; t.actime = node->atime; t.modtime = node->mtime; utime(node->cache_path, &t); } static int open_file(int *fd, dav_node *node, int flags, pid_t pid, pid_t pgid, uid_t uid); static int update_cache_file(dav_node *node); static off_t write_dir(dav_node *dir, int fd); /* Permanent cache maintenance. */ static void check_cache_dir(const char *dir, const char *host, const char *path, const char *mpoint); static void clean_cache(void); static void parse_index(void); static void resize_cache(void); static int write_node(dav_node *node, FILE *file, const char *indent); static int xml_cdata(void *userdata, int state, const char *cdata, size_t len); static int xml_end_backup(void *userdata, int state, const char *nspace, const char *name); static int xml_end_date(void *userdata, int state, const char *nspace, const char *name); static int xml_end_decimal(void *userdata, int state, const char *nspace, const char *name); static int xml_end_dir(void *userdata, int state, const char *nspace, const char *name); static int xml_end_mode(void *userdata, int state, const char *nspace, const char *name); static int xml_end_reg(void *userdata, int state, const char *nspace, const char *name); static int xml_end_root(void *userdata, int state, const char *nspace, const char *name); static int xml_end_size(void *userdata, int state, const char *nspace, const char *name); static int xml_end_string(void *userdata, int state, const char *nspace, const char *name); static int xml_end_string_old(void *userdata, int state, const char *nspace, const char *name); static int xml_start_backup(void *userdata, int parent, const char *nspace, const char *name, const char **atts); static int xml_start_date(void *userdata, int parent, const char *nspace, const char *name, const char **atts); static int xml_start_decimal(void *userdata, int parent, const char *nspace, const char *name, const char **atts); static int xml_start_dir(void *userdata, int parent, const char *nspace, const char *name, const char **atts); static int xml_start_mode(void *userdata, int parent, const char *nspace, const char *name, const char **atts); static int xml_start_reg(void *userdata, int parent, const char *nspace, const char *name, const char **atts); static int xml_start_root(void *userdata, int parent, const char *nspace, const char *name, const char **atts); static int xml_start_size(void *userdata, int parent, const char *nspace, const char *name, const char **atts); static int xml_start_string(void *userdata, int parent, const char *nspace, const char *name, const char **atts); /* Auxiliary. */ static size_t test_alignment(); /* Public functions */ /*==================*/ void dav_init_cache(const dav_args *args, const char *mpoint) { debug = args->debug & DAV_DBG_CACHE; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Initializing cache"); alignment = test_alignment(); if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Alignment of dav_node: %i", (int) alignment); default_uid = args->uid; default_gid = args->gid; default_file_mode = args->file_mode; default_dir_mode = args->dir_mode; grpid = args->grpid; table_size = args->table_size; table = ne_calloc(sizeof(*table) * table_size); dir_refresh = args->dir_refresh; file_refresh = args->file_refresh; delay_upload = args->delay_upload; gui_optimize = args->gui_optimize; minimize_mem = args->minimize_mem; retry = dir_refresh; min_retry = args->retry; max_retry = args->max_retry; max_upload_attempts = args->max_upload_attempts; lock_refresh = args->lock_refresh; fs_stat = (dav_stat *) malloc(sizeof(dav_stat)); if (!fs_stat) abort(); fs_stat->blocks = 333333333; fs_stat->bavail = 133333333; fs_stat->n_nodes = 0; fs_stat->ffree = fs_stat->bavail / 4; fs_stat->bsize = 4096; fs_stat->namelen = 256; fs_stat->utime = 0; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Checking cache directory"); max_cache_size = (unsigned long long) args->cache_size * 0x100000; check_cache_dir(args->cache_dir, args->host, args->path, mpoint); if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " %s", cache_dir); root = new_node(NULL, default_dir_mode); if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Reading stored cache data"); parse_index(); root->name = ne_strdup(""); root->path = dav_conv_to_server_enc(args->path); root->mode = default_dir_mode; if (!backup) backup = new_node(root, S_IFDIR | S_IRWXU); backup->name = ne_strdup(args->backup_dir); backup->mode = S_IFDIR | S_IRWXU; clean_cache(); next_minimize = 0; int ret = update_directory(root, 0); if (ret == EAGAIN) { root->utime = 0; ret = update_directory(root, 0); } if (ret == EAGAIN) { error(0, 0, _("connection timed out two times;\n" "trying one last time")); root->utime = 0; ret = update_directory(root, 0); if (!ret) printf(_("Last try succeeded.\n")); } if (ret == EAGAIN) { error(0, 0, _("server temporarily unreachable;\n" "mounting anyway")); } else if (ret) { error(EXIT_FAILURE, 0, _("Mounting failed.\n%s"), dav_get_webdav_error()); } else { dav_statfs(); } } void dav_close_cache(volatile int *got_sigterm) { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Closing cache"); write_dir_entry = &write_dir_entry_dummy; flush = &flush_dummy; clean_tree(root, got_sigterm); char *new_index = ne_concat(cache_dir, "/", DAV_INDEX, ".new", NULL); if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Creating index %s.", new_index); FILE *new_file = fopen(new_index, "w"); if (new_file) { int ret = fprintf(new_file, "\n"); if (ret >= 0) ret = write_node(root, new_file, ""); fclose(new_file); if (ret >= 0) { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Replacing old index"); char *old_index = ne_concat(cache_dir, "/", DAV_INDEX, NULL); if (rename(new_index, old_index) != 0) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("can't replace %s with %s"), old_index, new_index); free(old_index); } else { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("error writing new index file %s"), new_index); } } else { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("can't create new index file for %s"), cache_dir); } free(new_index); } size_t dav_register_kernel_interface(dav_write_dir_entry_fn write_fn, int *flush_flag, unsigned int *blksize) { if (write_fn) write_dir_entry = write_fn; if (flush_flag) flush = flush_flag; if (blksize) *blksize = fs_stat->bsize; return alignment; } int dav_tidy_cache(void) { if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "tidy: %i of %llu nodes changed", nchanged, (long long int) fs_stat->n_nodes); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "cache-size: %llu MiBytes.", (unsigned long long) ((cache_size + 0x80000) / 0x100000)); } static dav_node_list_item *item = NULL; dav_node_list_item *next_item = changed; dav_node *node = NULL; int found = 0; while (next_item) { node = next_item->node; if (is_locked(node) && node->lock_expire < time(NULL) + lock_refresh) dav_lock_refresh(node->path, &node->lock_expire); if (next_item == item) found = 1; next_item = next_item->next; } if (!found) item = changed; time_t save_at = 0; if (item) { node = item->node; save_at = item->save_at; item = item->next; } else { node = NULL; } if (node && (is_dirty(node) || is_created(node)) && !is_open_write(node) && !is_backup(node) && save_at && save_at <= time(NULL)) { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "tidy: %s", node->path); int set_execute = -1; if (is_created(node) && node->mode & (S_IXUSR | S_IXGRP | S_IXOTH)) set_execute = 1; int ret = dav_put(node->path, node->cache_path, &node->remote_exists, &node->lock_expire, &node->etag, &node->smtime, set_execute); if (!ret) { node->utime = time(NULL); node->dirty = 0; if (dav_unlock(node->path, &node->lock_expire) == 0) remove_from_changed(node); } else { if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "tidy: neon error"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " %s", dav_get_webdav_error()); } if (ret == EACCES || ret == EINVAL || ret == ENOENT || ret == EPERM || ret == ENOSPC || ret == EEXIST || set_next_upload_attempt(node) < 0) { dav_unlock(node->path, &node->lock_expire); delete_cache_file(node->parent); node->parent->utime = 0; remove_node(node); *flush = 1; } } } else if (node && is_locked(node) && !is_dirty(node) && !is_created(node) && !is_open_write(node)) { if (dav_unlock(node->path, &node->lock_expire) == 0) remove_from_changed(node); } if (cache_size > max_cache_size) resize_cache(); if (minimize_mem && next_minimize && time(NULL) > next_minimize) { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "minimize_tree"); next_minimize = 0; minimize_tree(root); if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "minimize_tree: %llu nodes remaining", fs_stat->n_nodes); } if (item) return 1; return 0; } /* Upcalls from the kernel. */ int dav_access(dav_node *node, uid_t uid, int how) { if (!is_valid(node)) return ENOENT; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "access %s", node->path); if (!has_permission(node, uid, how)) return EACCES; return 0; } int dav_close(dav_node *node, int fd, int flags, pid_t pid, pid_t pgid) { if (!exists(node)) return ENOENT; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " close %s", node->path); dav_handle *fh = get_file_handle(node, fd, is_dir(node) ? O_RDWR : flags & O_ACCMODE, pid, pgid); if (!fh) return EBADF; close_fh(node, fh); if (!node->parent && node != root && !is_open(node)) { remove_from_table(node); delete_node(node); *flush = 1; return 0; } if (is_dir(node)) { node->atime = time(NULL); delete_cache_file(node); return 0; } attr_from_cache_file(node); set_upload_time(node); fs_stat->utime = 0; if (delay_upload == 0 && (is_dirty(node) || is_created(node)) && !is_open_write(node) && !is_backup(node)) { int set_execute = -1; if (is_created(node) && node->mode & (S_IXUSR | S_IXGRP | S_IXOTH)) set_execute = 1; int ret = dav_put(node->path, node->cache_path, &node->remote_exists, &node->lock_expire, &node->etag, &node->smtime, set_execute); if (!ret) { node->utime = time(NULL); node->dirty = 0; if (dav_unlock(node->path, &node->lock_expire) == 0) remove_from_changed(node); } else { if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "close: neon error"); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " %s", dav_get_webdav_error()); } if (ret == EACCES || ret == EINVAL || ret == ENOENT || ret == EPERM || ret == ENOSPC || ret == EEXIST || set_next_upload_attempt(node) < 0) { dav_unlock(node->path, &node->lock_expire); delete_cache_file(node->parent); node->parent->utime = 0; remove_node(node); *flush = 1; } } return ret; } return 0; } int dav_create(dav_node **nodep, dav_node *parent, const char *name, uid_t uid, mode_t mode) { if (!is_valid(parent)) return ENOENT; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "create %s%s", parent->path, name); if (!is_dir(parent)) return ENOTDIR; if ((parent == root && strcmp(name, backup->name) == 0) || parent == backup) return EINVAL; if (!has_permission(parent, uid, X_OK | W_OK)) return EACCES; if (get_child(parent, name)) return EEXIST; struct passwd *pw = getpwuid(uid); if (!pw) return EINVAL; char *name_conv = dav_conv_to_server_enc(name); char *path = ne_concat(parent->path, name_conv, NULL); free(name_conv); *nodep = new_node(parent, mode | S_IFREG); (*nodep)->path = path; (*nodep)->name = ne_strdup(name); (*nodep)->uid = uid; if (grpid && parent->gid != 0) { (*nodep)->gid = parent->gid; } else { (*nodep)->gid = pw->pw_gid; } int ret = create_cache_file(*nodep); if (!ret) ret = dav_lock(path, &(*nodep)->lock_expire, &(*nodep)->remote_exists); if (ret == EEXIST) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("File %s exists on the server but should not. " "Maybe it is an error in the server's LOCK impementation. " "You may try option 'use_locks 0' in davfs2.conf."), (*nodep)->path); if (!ret) { (*nodep)->smtime = (*nodep)->mtime; if (!is_created(*nodep)) dav_head((*nodep)->path, &(*nodep)->etag, &(*nodep)->smtime, NULL); (*nodep)->utime = (*nodep)->smtime; delete_cache_file(parent); *flush = 1; parent->mtime = (*nodep)->mtime; parent->ctime = (*nodep)->mtime; add_to_changed(*nodep); } else { remove_from_tree(*nodep); remove_from_table(*nodep); delete_node(*nodep); } return ret; } int dav_getattr(dav_node *node, uid_t uid) { if (!is_valid(node)) return ENOENT; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "getattr %s", node->path); if (node->parent && !has_permission(node->parent, uid, X_OK | R_OK)) return EACCES; if (is_dir(node)) { if (!node->utime) update_directory(node, retry); if (!node->cache_path) { if (create_dir_cache_file(node) != 0) return EIO; delete_cache_file(node); } } else if (is_open(node)) { attr_from_cache_file(node); } return 0; } int dav_lookup(dav_node **nodep, dav_node *parent, const char *name, uid_t uid) { if (!is_valid(parent)) return ENOENT; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "lookup %s%s", parent->path, name); if (!is_dir(parent)) return ENOTDIR; if (!has_permission(parent, uid, X_OK | R_OK)) return EACCES; update_directory(parent, retry); *nodep = get_child(parent, name); if (!*nodep) { update_directory(parent, file_refresh); *nodep = get_child(parent, name); } if (!*nodep) return ENOENT; if (is_dir(*nodep)) { if (!(*nodep)->utime) update_directory(*nodep, retry); } else if (is_open(*nodep)) { attr_from_cache_file(*nodep); } return 0; } int dav_mkdir(dav_node **nodep, dav_node *parent, const char *name, uid_t uid, mode_t mode) { if (!is_valid(parent)) return ENOENT; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "mkdir %s%s", parent->path, name); if (!is_dir(parent)) return ENOTDIR; if (parent == backup) return EINVAL; if (!has_permission(parent, uid, X_OK | W_OK)) return EACCES; update_directory(parent, retry); if (get_child(parent, name)) return EEXIST; struct passwd *pw = getpwuid(uid); if (!pw) return EINVAL; char *name_conv = dav_conv_to_server_enc(name); char *path = ne_concat(parent->path, name_conv, "/", NULL); free(name_conv); int ret = dav_make_collection(path); if (!ret) { *nodep = new_node(parent, mode | S_IFDIR); (*nodep)->path = path; (*nodep)->name = ne_strdup(name); (*nodep)->uid = uid; if (grpid && parent->gid != 0) { (*nodep)->gid = parent->gid; } else { (*nodep)->gid = pw->pw_gid; } (*nodep)->smtime = (*nodep)->mtime; (*nodep)->utime = (*nodep)->mtime; delete_cache_file(parent); *flush = 1; parent->mtime = (*nodep)->mtime; parent->ctime = (*nodep)->mtime; } else { free(path); } return ret; } int dav_open(int *fd, dav_node *node, int flags, pid_t pid, pid_t pgid, uid_t uid, int open_create) { if (!is_valid(node)) return ENOENT; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "open %s", node->path); if (flags & (O_EXCL | O_CREAT)) return EINVAL; int how; if ((O_ACCMODE & flags) == O_WRONLY) { how = W_OK; } else if ((O_ACCMODE & flags) == O_RDONLY) { how = R_OK; } else { how = R_OK | W_OK; } if (!open_create && !has_permission(node, uid, how)) return EACCES; if (is_dir(node)) { if ((how & W_OK) || (flags & O_TRUNC)) return EINVAL; update_directory(node, file_refresh); if (create_dir_cache_file(node) != 0) return EIO; node->atime = time(NULL); return open_file(fd, node, O_RDWR, pid, pgid, uid); } int ret = 0; if ((O_ACCMODE & flags) == O_RDONLY) { ret = update_cache_file(node); if (!ret) ret = open_file(fd, node, flags & O_ACCMODE, pid, pgid, uid); } else { if (!is_locked(node) && !is_backup(node)) ret = dav_lock(node->path, &node->lock_expire, &node->remote_exists); if (!ret && (flags & O_TRUNC)) { ret = create_cache_file(node); if (!ret) { ret = open_file(fd, node, flags & (O_ACCMODE | O_TRUNC | O_APPEND), pid, pgid, uid); } } else if (!ret) { ret = update_cache_file(node); if (!ret) ret = open_file(fd, node, flags & (O_ACCMODE | O_APPEND), pid, pgid, uid); } if (!ret) add_to_changed(node); } return ret; } int dav_read(ssize_t *len, dav_node * node, int fd, char *buf, size_t size, off_t offset) { if (!exists(node)) return ENOENT; dav_handle *fh = get_file_handle(node, fd, 0, 0, 0); if (!fh) return EBADF; if (fh->flags == O_WRONLY) return EINVAL; if (offset == 0 && is_dir(node) && !node->cache_path) { if (ftruncate(fh->fd, 0) != 0) return EIO; off_t sz = write_dir(node, fh->fd); if (sz <= 0) return EIO; node->size = sz; } *len = pread(fd, buf, size, offset); if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "read %lli", (long long int) *len); if (*len < 0) return errno; if (*len < size) memset(buf + *len, '\0', size - *len); return 0; } int dav_remove(dav_node *parent, const char *name, uid_t uid) { if (!is_valid(parent)) return ENOENT; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "remove %s%s", parent->path, name); if (!is_dir(parent)) return ENOTDIR; if (!has_permission(parent, uid, X_OK | W_OK)) return EACCES; update_directory(parent, retry); dav_node *node = get_child(parent, name); if (!node) { delete_cache_file(parent); parent->utime = 0; *flush = 1; return ENOENT; } if (is_dir(node)) return EISDIR; int ret = 0; if (is_created(node)) { if (is_locked(node)) ret = dav_unlock(node->path, &node->lock_expire); } else if (!is_backup(node)) { ret = dav_delete(node->path, &node->lock_expire); if (ret == ENOENT) ret = 0; } if (ret) return ret; fs_stat->utime = 0; remove_from_tree(node); remove_from_changed(node); if (is_open(node)) { node->parent = NULL; } else { remove_from_table(node); delete_node(node); } delete_cache_file(parent); parent->mtime = time(NULL); parent->ctime = parent->mtime; *flush = 1; return 0; } int dav_rename(dav_node *src_parent, const char *src_name, dav_node *dst_parent, const char *dst_name, uid_t uid) { if (!is_valid(src_parent) || !is_valid(dst_parent)) return ENOENT; if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "rename %s%s", src_parent->path, src_name); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " into %s%s", dst_parent->path, dst_name); } if (!is_dir(src_parent) || !is_dir(dst_parent)) return ENOTDIR; if (is_backup(dst_parent)) return EINVAL; if (!has_permission(src_parent, uid, X_OK | W_OK) || !has_permission(dst_parent, uid, X_OK | W_OK)) return EACCES; update_directory(src_parent, retry); dav_node *src = get_child(src_parent, src_name); dav_node *dst = get_child(dst_parent, dst_name); if (!src) { delete_cache_file(src_parent); src_parent->utime = 0; *flush = 1; return ENOENT; } if (src == backup || (dst && is_backup(dst))) return EINVAL; int ret; if (is_dir(src)) { ret = move_dir(src, dst, dst_parent, dst_name); } else { if (is_created(src) || is_backup(src)) { ret = move_no_remote(src, dst, dst_parent, dst_name); } else { ret = move_reg(src, dst, dst_parent, dst_name); } } if (!ret) { if (src_parent != dst_parent) { remove_from_tree(src); delete_cache_file(src_parent); src_parent->mtime = time(NULL); src_parent->ctime = src_parent->mtime; src->parent = dst_parent; src->next = dst_parent->childs; dst_parent->childs = src; if (is_dir(src)) ++src->parent->nref; } delete_cache_file(dst_parent); dst_parent->mtime = time(NULL); dst_parent->ctime = dst_parent->mtime; *flush = 1; } return ret; } int dav_rmdir(dav_node *parent, const char *name, uid_t uid) { if (!is_valid(parent)) return ENOENT; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "rmdir %s%s", parent->path, name); if (!is_dir(parent)) return ENOTDIR; if (!has_permission(parent, uid, X_OK | W_OK)) return EACCES; update_directory(parent, retry); dav_node *node = get_child(parent, name); if (!node) { delete_cache_file(parent); parent->utime = 0; *flush = 1; return ENOENT; } if (node == backup) return EINVAL; if (!is_dir(node)) return ENOTDIR; if (node->childs) return ENOTEMPTY; int ret = dav_delete_dir(node->path); if (!ret) { remove_node(node); delete_cache_file(parent); parent->mtime = time(NULL); parent->ctime = parent->mtime; *flush = 1; } return ret; } int dav_root(dav_node **nodep, uid_t uid) { if (uid != 0) return EPERM; *nodep = root; return 0; } int dav_setattr(dav_node *node, uid_t uid, int sm, mode_t mode, int so, uid_t owner, int sg, gid_t gid, int sat, time_t atime, int smt, time_t mtime, int ssz, off_t size) { if (!is_valid(node)) return ENOENT; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "setattr %s", node->path); if (node->parent != NULL && !has_permission(node->parent, uid, X_OK)) return EACCES; if (so) { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " set owner to %i", owner); if (node == backup) return EINVAL; if (uid != 0 && (uid != owner || uid != node->uid)) return EPERM; if (!getpwuid(owner)) return EINVAL; } if (sg) { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " set group to %i", gid); if (node == backup) return EINVAL; if (uid != node->uid && uid != 0) return EPERM; if (uid != 0) { struct passwd *pw = getpwuid(uid); if (!pw) return EPERM; if (pw->pw_gid != gid) { struct group *gr = getgrgid(gid); if (!gr) return EPERM; char **member = gr->gr_mem; while (*member != NULL && strcmp(*member, pw->pw_name) != 0) ++member; if (*member == NULL) return EPERM; } } if (!getgrgid(gid)) return EINVAL; } if (sm) { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " set mode to %o", mode); if (node == backup) return EINVAL; if (uid != node->uid && uid != 0) return EPERM; } if (sat || smt) { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " set times"); if (uid != node->uid && uid != 0 && !has_permission(node, uid, W_OK)) return EPERM; } if (ssz) { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " set size"); if (is_dir(node)) return EINVAL; if (uid != node->uid && uid != 0 && !has_permission(node, uid, W_OK)) return EPERM; int ret = 0; if (!is_locked(node) && !is_backup(node)) ret = dav_lock(node->path, &node->lock_expire, &node->remote_exists); if (!ret && size == 0) { ret = create_cache_file(node); } else if (!ret) { ret = update_cache_file(node); } if (!ret) ret = truncate(node->cache_path, size); if (ret) return ret; attr_from_cache_file(node); node->dirty = 1; add_to_changed(node); set_upload_time(node); } if (so) node->uid = owner; if (sg) node->gid = gid; if (sm) { if (!is_backup(node) && !is_created(node)) { int set_execute = -1; if ((node->mode & (S_IXUSR | S_IXGRP | S_IXOTH)) && !(mode & (S_IXUSR | S_IXGRP | S_IXOTH))) set_execute = 0; if (!(node->mode & (S_IXUSR | S_IXGRP | S_IXOTH)) && (mode & (S_IXUSR | S_IXGRP | S_IXOTH))) set_execute = 1; if (set_execute != -1) { if (is_dirty(node) && !is_locked(node)) { int err = 0; time_t smtime = 0; char *etag = NULL; dav_head(node->path, &etag, &smtime, NULL); if (etag && node->etag && strcmp(etag, node->etag) != 0) err = EIO; if (smtime && smtime > node->smtime) err = EIO; if (etag) free(etag); if (err) return EIO; } dav_set_execute(node->path, set_execute); if (is_dirty(node)) dav_head(node->path, &node->etag, &node->smtime, NULL); } } node->mode = (node->mode & ~DAV_A_MASK) | mode; } if (sat) node->atime = atime; if (smt) node->mtime = mtime; if (sat || smt) set_cache_file_times(node); node->ctime = time(NULL); return 0; } dav_stat * dav_statfs(void) { if (time(NULL) > (fs_stat->utime + retry)) { uint64_t available = 0; uint64_t used = 0; if (dav_quota(root->path, &available, &used) == 0) { fs_stat->bavail = available / fs_stat->bsize; fs_stat->ffree = fs_stat->bavail / 4; if (used > 0) { fs_stat->blocks = fs_stat->bavail + (used / fs_stat->bsize); } else { fs_stat->blocks = fs_stat->bavail + (fs_stat->n_nodes * 4); } fs_stat->utime = time(NULL); } } fs_stat->files = fs_stat->ffree + fs_stat->n_nodes; return fs_stat; } int dav_sync(dav_node *node) { if (!exists(node)) return ENOENT; dav_handle *fh = node->handles; while (fh) { if (fh->flags != O_RDONLY) fsync(fh->fd); fh = fh->next; } return 0; } int dav_write(size_t *written, dav_node * node, int fd, char *buf, size_t size, off_t offset) { if (!exists(node)) return ENOENT; if (is_dir(node)) return EBADF; dav_handle *fh = get_file_handle(node, fd, 0, 0, 0); if (!fh) return EBADF; if (fh->flags == O_RDONLY) return EINVAL; *written = 0; ssize_t n = 0; while (*written < size && n >= 0) { n = pwrite(fd, buf + *written, size - *written, offset + *written); if (n < 0) return errno; *written += n; } if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " written %lli", (unsigned long long) *written); return 0; } /* Private functions */ /*===================*/ /* Node maintenance. */ /* Creates a new node taking properties from props and adds it to the child list of parent and to the hash table. If props references directory backup, no node will be created. parent : The parent directory node for the new node. props : Properties retrieved from the server. Will be freed. */ static void add_node(dav_node *parent, dav_props *props) { if (parent == root && strcmp(props->name, backup->name) == 0) { dav_delete_props(props); return; } dav_node *node; if (props->is_dir) { node = new_node(parent, default_dir_mode); } else { node = new_node(parent, default_file_mode); node->size = props->size; node->remote_exists = 1; if (props->is_exec == 1) { node->mode |= (node->mode & S_IRUSR) ? S_IXUSR : 0; node->mode |= (node->mode & S_IRGRP) ? S_IXGRP : 0; node->mode |= (node->mode & S_IROTH) ? S_IXOTH : 0; } else if (props->is_exec == 0) { node->mode &= ~(S_IXUSR | S_IXGRP | S_IXOTH); } } if (grpid && parent->gid != 0) node->gid = parent->gid; node->path = props->path; node->name = props->name; node->etag = props->etag; node->smtime = props->mtime; if (node->smtime > 0) node->mtime = node->smtime; node->ctime = node->mtime; free(props); if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "added %s", node->path); } /* Checks whether node is allready in the list of changed nodes. If not it will be appended at the end of the list. */ static void add_to_changed(dav_node *node) { dav_node_list_item **chp = &changed; while (*chp) { if ((*chp)->node == node) return; chp = &(*chp)->next; } *chp = (dav_node_list_item *) malloc(sizeof(dav_node_list_item)); if (!*chp) abort(); (*chp)->node = node; (*chp)->next = NULL; (*chp)->attempts = 0; (*chp)->save_at = 0; nchanged++; } /* Creates a new file in directory backup. The name will be the name of the cache file of orig and attributes will be taken from orig. The cache file will be moved from orig to the new node. Open file descriptors will stay with orig. orig : the node to be backed up. */ static void backup_node(dav_node *orig) { if (!orig->cache_path) return; dav_node *node = new_node(backup, orig->mode); node->name = ne_strdup(orig->cache_path + strlen(cache_dir) +1); node->cache_path = orig->cache_path; orig->cache_path = NULL; orig->dirty = 0; node->size = orig->size; node->uid = default_uid; node->gid = default_gid; if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "created backup of %p", orig); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " %s", orig->path); } delete_cache_file(backup); backup->mtime = time(NULL); backup->ctime = backup->mtime; *flush = 1; } /* Scans the directory tree starting from node and - if *got_sigterm == 1: saves dirty files to the server and unlocks them. If it can not be safed, a local backup is created and the node is deleted. - removes any file nodes without cached file - removes all dir nodes that have not at least one file node below. Short: removes everthing that is not necessary to correctly reference the cached files. Node node itself will be removed and deleted if possible. Directory backup and root will never be removed. Kernel will *not* be notified about changes. Member nref of directories will be adjusted. */ static void clean_tree(dav_node *node, volatile int *got_sigterm) { if (node == backup) { delete_cache_file(backup); return; } if (is_dir(node)) { dav_node *child = node->childs; while (child) { dav_node *next = child->next; clean_tree(child, got_sigterm); child = next; } if (!node->childs && node != root && node != backup) { remove_from_tree(node); remove_from_table(node); delete_node(node); } else { delete_cache_file(node); } } else if (!is_cached(node) || access(node->cache_path, F_OK) != 0) { if (is_locked(node) && !*got_sigterm) dav_unlock(node->path, &node->lock_expire); remove_from_tree(node); remove_from_table(node); delete_node(node); } else if ((is_dirty(node) || is_created(node)) && !*got_sigterm) { int set_execute = -1; if (is_created(node) && node->mode & (S_IXUSR | S_IXGRP | S_IXOTH)) set_execute = 1; int ret = dav_put(node->path, node->cache_path, &node->remote_exists, &node->lock_expire, &node->etag, &node->smtime, set_execute); if (is_locked(node)) dav_unlock(node->path, &node->lock_expire); if (!ret) { node->mtime = node->smtime; if (node->mtime > node->atime) node->atime = node->mtime; set_cache_file_times(node); node->dirty = 0; } else if (ret == EACCES || ret == EINVAL || ret == ENOENT || ret == EPERM || ret == ENOSPC || ret == EEXIST) { backup_node(node); remove_from_tree(node); remove_from_table(node); delete_node(node); } } else { node->mtime = node->smtime; if (node->mtime > node->atime) node->atime = node->mtime; set_cache_file_times(node); } } /* Frees any resources held by node and finally frees node. If there are open file descriptors, this will be closed. */ static void delete_node(dav_node *node) { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "deleting node %p", node); if (node->path) free(node->path); if (node->name) free(node->name); delete_cache_file(node); if (node->etag) free(node->etag); while (node->handles) { dav_handle *tofree = node->handles; node->handles = node->handles->next; close(tofree->fd); free(tofree); } free(node); fs_stat->n_nodes--; } /* Deletes the tree starting at and including node. The tree is freed uncontionally, no checks for lost update problem and the like are done, also backup will be deleted if in tree. Exeption: the root node will not be deleted. */ static void delete_tree(dav_node *node) { while (node->childs) delete_tree(node->childs); if (node != root) { remove_from_tree(node); remove_from_table(node); delete_node(node); if (node == backup) backup = NULL; } } /* Removes file nodes that are currently not needed to minimize memory usage. */ static void minimize_tree(dav_node *node) { if (node == backup) return; if (is_dir(node)) { int rm = !is_open(node) && (time(NULL) > (node->utime + 2 * file_refresh)) && (time(NULL) > (node->atime + 2 * file_refresh)); dav_node *child = node->childs; while (child) { dav_node *next = child->next; if (rm || is_dir(child)) { minimize_tree(child); } else if (next_minimize == 0) { next_minimize = time(NULL) + 2 * file_refresh; } child = next; } } else if (!is_cached(node) && !is_locked(node) && !is_created(node)) { remove_from_tree(node); remove_from_table(node); delete_node(node); *flush = 1; } else if (next_minimize == 0) { next_minimize = time(NULL) + file_refresh; } } /* Moves directory src to dst using WebDAV method MOVE. */ static int move_dir(dav_node *src, dav_node *dst, dav_node *dst_parent, const char *dst_name) { if (dst && !is_dir(dst)) return ENOTDIR; if (dst && is_busy(dst)) return EBUSY; char *dst_path; if (!dst) { char *dst_conv = dav_conv_to_server_enc(dst_name); dst_path = ne_concat(dst_parent->path, dst_conv, "/", NULL); free(dst_conv); } else { dst_path = ne_strdup(dst->path); } if (dav_move(src->path, dst_path) != 0) { free(dst_path); return EIO; } if (dst) remove_node(dst); free(src->name); src->name = ne_strdup(dst_name); update_path(src, src->path, dst_path); free(dst_path); return 0; } /* src does not exist on the server, but there may be a locked null-resource. - if dst exists it will be removed, local and remote - if src is locked, it is unlocked - the path of src is changed according dst_name - dst is locked on the server - src is moved to its new position in the tree. */ static int move_no_remote(dav_node *src, dav_node *dst, dav_node *dst_parent, const char *dst_name) { if (dst && is_dir(dst)) return EISDIR; char *dst_path; if (!dst) { char *dst_conv = dav_conv_to_server_enc(dst_name); dst_path = ne_concat(dst_parent->path, dst_conv, NULL); free(dst_conv); } else { dst_path = ne_strdup(dst->path); } if (dst) { int ret = 0; if (is_created(dst)) { if (is_locked(dst)) ret = dav_unlock(dst_path, &dst->lock_expire); } else { ret = dav_delete(dst_path, &dst->lock_expire); } if (ret == ENOENT) ret = 0; if (ret) { free(dst_path); return EIO; } remove_from_tree(dst); remove_from_changed(dst); if (is_open(dst)) { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "invalidating node %p", dst); dst->parent = NULL; } else { remove_from_table(dst); delete_node(dst); } } if (is_created(src) && is_locked(src)) dav_unlock(src->path, &src->lock_expire); src->remote_exists = 0; dav_lock(dst_path, &src->lock_expire, &src->remote_exists); if (!is_created(src) && (src->mode & (S_IXUSR | S_IXGRP | S_IXOTH))) dav_set_execute(dst_path, 1); free(src->name); src->name = ne_strdup(dst_name); free(src->path); src->path = dst_path; if (src->etag) { free(src->etag); src->etag = NULL; } src->smtime = time(NULL); if (!is_created(src)) dav_head(src->path, &src->etag, &src->smtime, NULL); src->utime = time(NULL); return 0; } /* Moves file src to dst using WebDAV method MOVE. */ static int move_reg(dav_node *src, dav_node *dst, dav_node *dst_parent, const char *dst_name) { if (dst && is_dir(dst)) return EISDIR; char *dst_path; if (!dst) { char *dst_conv = dav_conv_to_server_enc(dst_name); dst_path = ne_concat(dst_parent->path, dst_conv, NULL); free(dst_conv); } else { dst_path = ne_strdup(dst->path); } if (dav_move(src->path, dst_path) != 0) { free(dst_path); return EIO; } if (is_locked(src)) { src->lock_expire = 0; if (is_dirty(src)) dav_lock(dst_path, &src->lock_expire, &src->remote_exists); } if (is_cached(src)) dav_head(dst_path, &src->etag, &src->smtime, NULL); if (dst) { remove_from_tree(dst); remove_from_changed(dst); if (is_open(dst)) { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "invalidating node %p", dst); dst->parent = NULL; } else { remove_from_table(dst); delete_node(dst); } } free(src->name); src->name = ne_strdup(dst_name); free(src->path); src->path = dst_path; src->utime = time(NULL); return 0; } /* Creates a new node. mode must have the I_ISDIR or I_ISREG bit set. node->mode is set to mode. All other members are set to reasonable defaults. The new node will be inserted into the child list of parent and the hash table. Member nref of the parent will be updated. parent : The parent of the new node, may be NULL. mode : Tthe mode of the new node. return value : A pointer to the new node. */ static dav_node * new_node(dav_node *parent, mode_t mode) { dav_node *node = (dav_node *) ne_malloc(sizeof(dav_node)); node->parent = parent; node->childs = NULL; if (parent) { if (S_ISDIR(mode)) ++parent->nref; node->next = parent->childs; parent->childs = node; } else { node->next = NULL; } size_t i = ((size_t) node / alignment) % table_size; node->table_next = table[i]; table[i] = node; node->path = NULL; node->name = NULL; node->cache_path = NULL; node->etag = NULL; node->handles = NULL; node->size = 0; node->atime = time(NULL); node->mtime = node->atime; node->ctime = node->atime; node->utime = 0; node->smtime = 0; node->lock_expire = 0; if (S_ISDIR(mode)) { node->nref = 2; } else { node->nref = 1; } node->remote_exists = 0; node->dirty = 0; node->uid = default_uid; node->gid = default_gid; node->mode = mode; if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "new node: %p->%p", node->parent, node); fs_stat->n_nodes++; if (next_minimize == 0) next_minimize = node->atime + file_refresh; return node; } /* Removes a node from the list of changed nodes. */ static void remove_from_changed(dav_node *node) { dav_node_list_item **chp = &changed; while (*chp && (*chp)->node != node) chp = &(*chp)->next; if (*chp) { dav_node_list_item *tofree = *chp; *chp = (*chp)->next; free(tofree); nchanged--; } } /* Removes a node from the hash table. The root node can not be removed. */ static void remove_from_table(dav_node *node) { if (node == root) return; size_t i = ((size_t) node / alignment) % table_size; dav_node **np = &table[i]; while (*np && *np != node) np = &(*np)->table_next; if (*np) *np = (*np)->table_next; } /* Removes a node from the directory tree. The root node can not be removed. If node is a directory, member nref of the parent will be decremented. But no other attributes of the parent directory will be changed. */ static void remove_from_tree(dav_node *node) { if (node == root) return; dav_node **np = &node->parent->childs; while (*np && *np != node) np = &(*np)->next; if (*np) { *np = node->next; if (is_dir(node)) --node->parent->nref; } } /* Frees locks, removes the node from the tree and from the hash table, and deletes it. Depending on the kind of node and its state additional action will be taken: - For directories the complete tree below is removed too. - If a regular file is dirty, open for writing or created, a backup in driectory backup will be created, that holds the cached local copy of the file. - If a file is open, it will not be removed from the hash table to allow proper closing of open file descriptors. */ static void remove_node(dav_node *node) { remove_from_tree(node); if (is_dir(node)) { while (node->childs != NULL) remove_node(node->childs); remove_from_table(node); delete_node(node); } else { remove_from_changed(node); if (is_locked(node)) dav_unlock(node->path, &node->lock_expire); if (is_dirty(node) || is_open_write(node) || is_created(node)) backup_node(node); if (is_open(node)) { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "invalidating node %p", node); node->parent = NULL; node->dirty = 0; node->remote_exists = 0; } else { remove_from_table(node); delete_node(node); } } } /* Gets a property list from the server and updates node dir and its childs accordingly. If there are inconsistencies between the information from the server and the locally stored state, the local information is updated. Backups are created if necessary. This will only be done if the utime of dear is reached, otherwise this function will do nothing. utime and retry will be updated. If the contents or the mtime of the dir has changed, the dir-cache-file will be deleted and the flush flag will be set to force new lookups by the kernel. */ static int update_directory(dav_node *dir, time_t refresh) { if (dir == backup || time(NULL) <= (dir->utime + refresh)) return 0; dav_props *props = NULL; int ret = dav_get_collection(dir->path, &props); dir->utime = time(NULL); if (ret) { if (retry == dir_refresh) { retry = min_retry; } else { retry *= 2; retry = (retry > max_retry) ? max_retry : retry; retry = (retry == dir_refresh) ? (retry + 1) : retry; } return ret; } else { retry = dir_refresh; } int changed = 0; dav_node *child = dir->childs; while (child) { dav_node *next = child->next; if (!is_backup(child)) { dav_props **pp = &props; while (*pp && strcmp((*pp)->path, child->path) != 0) pp = &(*pp)->next; if (*pp) { dav_props *p = *pp; *pp = p->next; changed |= update_node(child, p); } else if (!is_created(child)) { remove_node(child); changed = 1; } } child = next; } while (props) { dav_props *next = props->next; if (strlen(props->name) > 0) { add_node(dir, props); changed = 1; } else { if (props->mtime > dir->smtime) { dir->smtime = props->mtime; dir->mtime = props->mtime; } if (dir->mtime > dir->ctime) dir->ctime = dir->mtime; if (dir->etag) free(dir->etag); dir->etag = props->etag; props->etag = NULL; dav_delete_props(props); } props = next; } if (changed) { delete_cache_file(dir); *flush = 1; } if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "directory updated: %p->%p", dir->parent, dir); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " %s", dir->path); } return 0; } /* Updates the properties of node according to props and frees props. If props is incompatibel with node or indicates a lost update problem, a new node is created from props and the old node is deleted, creating a local back up if necessary. If nodes are removed or created, flag flush is set, to force new lookups by the kernel. node : The node to be updated. It must not be the root node and have a valid parent. props : The properties retrieved from the server. They will be freed. return value: Value 1 indicates that the contents of the parent directory has changed and therefore the parents dir-cache-file has to be updated; 0 otherwise. NOTE: node may be removed and the pointer node may become invalid. */ static int update_node(dav_node *node, dav_props *props) { if (debug) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "updating node: %p->%p", node->parent, node); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " %s", node->path); } if (!node->parent) return 0; int ret = 0; if ((is_dir(node) && !props->is_dir) || (!is_dir(node) && props->is_dir)) { add_node(node->parent, props); remove_node(node); *flush = 1; return 1; } if (strcmp(node->name, props->name) != 0) { free(node->name); node->name = ne_strdup(props->name); ret = 1; *flush = 1; } if (is_created(node)) { if (!is_open(node) && (props->size > 0)) { add_node(node->parent, props); remove_node(node); *flush = 1; return 1; } else { dav_delete_props(props); return ret; } } if (is_cached(node)) { if ((!node->etag && props->mtime > node->smtime) || (node->etag && props->etag && strcmp(node->etag, props->etag) != 0)) { if (is_open(node)) { node->utime = 0; dav_delete_props(props); return ret; } else if (is_dirty(node)) { add_node(node->parent, props); remove_node(node); *flush = 1; return 1; } else { delete_cache_file(node); *flush = 1; } } else { node->utime = time(NULL); dav_delete_props(props); return ret; } } if (props->mtime > node->atime) node->atime = props->mtime; if (props->mtime > node->smtime) { node->mtime = props->mtime; node->smtime = props->mtime; node->utime = 0; delete_cache_file(node); *flush = 1; } if (node->etag) free(node->etag); node->etag = props->etag; props->etag = NULL; if (is_reg(node)) { if (props->is_exec == 1 && !(node->mode & (S_IXUSR | S_IXGRP | S_IXOTH))) { node->mode |= (node->mode & S_IWUSR) ? S_IXUSR : 0; node->mode |= (node->mode & S_IWGRP) ? S_IXGRP : 0; node->mode |= (node->mode & S_IWOTH) ? S_IXOTH : 0; *flush = 1; } else if (props->is_exec == 0 && (node->mode & (S_IXUSR | S_IXGRP | S_IXOTH))) { node->mode &= ~(S_IXUSR | S_IXGRP | S_IXOTH); *flush = 1; } if (props->size && props->size != node->size) { node->size = props->size; *flush = 1; } } dav_delete_props(props); return ret; } /* For node and all nodes in the tree below nodethe compinent src_path in its path will be replaced by dst_path. If the path of a node does not start with src_path the node will *not* be removed, but its parent directory will be invalidated, so an update is forced. */ static void update_path(dav_node *node, const char *src_path, const char *dst_path) { dav_node *n = node->childs; while (n) { update_path(n, src_path, dst_path); n = n->next; } if (!node->path || strstr(node->path, src_path) != node->path) { delete_cache_file(node->parent); node->parent->utime = 0; *flush = 1; return; } char *path = ne_concat(dst_path, node->path + strlen(src_path), NULL); free(node->path); node->path = path; } /* Get information about node. */ static int exists(const dav_node *node) { size_t i = ((size_t) node / alignment) % table_size; dav_node *n = table[i]; while (n && n != node) n = n->table_next; if (n) { return 1; } else { *flush = 1; return 0; } } static dav_handle * get_file_handle(dav_node * node, int fd, int accmode, pid_t pid, pid_t pgid) { dav_handle *fh = node->handles; if (fd) { while (fh && fh->fd != fd) fh = fh->next; } else { while (fh && (fh->flags != accmode || fh->pid != pid)) fh = fh->next; if (!fh) { fh = node->handles; while (fh && (fh->flags != accmode || fh->pgid != pgid)) fh = fh->next; } } return fh; } /* Checks whether user uid has access to node according to how. In any case the user must have execute permission for the parent of node and all of its parents up to the root node. int how : How to acces the node. May be any combination of R_OK, W_OK, X_OK and F_OK. return value: 1 access is allowed. 0 access is denied. */ static int has_permission(const dav_node *node, uid_t uid, int how) { if (uid == 0) return 1; if (node->parent && !has_permission(node->parent, uid, X_OK)) return 0; mode_t a_mode = (how & R_OK) ? (S_IRUSR | S_IRGRP | S_IROTH) : 0; a_mode |= (how & W_OK) ? (S_IWUSR | S_IWGRP | S_IWOTH) : 0; a_mode |= (how & X_OK) ? (S_IXUSR | S_IXGRP | S_IXOTH) : 0; if (node->uid == uid) { if (~node->mode & S_IRWXU & a_mode) return 0; return 1; } struct passwd *pw = getpwuid(uid); if (!pw) return 0; if (pw->pw_gid == node->gid) { if (~node->mode & S_IRWXG & a_mode) return 0; return 1; } struct group *grp = getgrgid(node->gid); if (!grp) return 0; char **members = grp->gr_mem; while (*members && strcmp(*members, pw->pw_name) != 0) members++; if (*members) { if (~node->mode & S_IRWXG & a_mode) return 0; return 1; } if (!(~node->mode & S_IRWXO & a_mode)) return 1; return 0; } /* A node is considered busy if it is open for writing or, in case of a directory, if in the tree below the node there is any file open for write. return value : 1 if busy, 0 if not. */ static int is_busy(const dav_node *node) { dav_node *child = node->childs; while (child) { if (is_busy(child)) return 1; } return (is_reg(node) && is_open_write(node)); } /* Checks whether node exists and is valid. The parent directory is updated if necessary. */ static int is_valid(const dav_node *node) { if (!exists(node) || (!node->parent && node != root)) return 0; if (node == root || node == backup) return 1; update_directory(node->parent, retry); if (!exists(node) || (!node->parent && node != root)) return 0; return 1; } /* Cache file functions. */ static void close_fh(dav_node *node, dav_handle *fh) { close(fh->fd); dav_handle **fhp = &node->handles; while (*fhp && *fhp != fh) fhp = &(*fhp)->next; if (*fhp) *fhp = (*fhp)->next; free(fh); } /* It creates a new empty cache file for node. If a cache file already exists, it does nothing. return value : 0 on success, EIO if no cache file could be created. */ static int create_cache_file(dav_node *node) { if (node->cache_path) { if (access(node->cache_path, F_OK) == 0) { return 0; } else { free(node->cache_path); } } node->cache_path = ne_concat(cache_dir, "/", node->name, "-XXXXXX", NULL); int fd = mkstemp(node->cache_path); if (fd <= 0) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("can't create cache file %s"), node->cache_path); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), "%s", strerror(errno)); free(node->cache_path); node->cache_path = NULL; return EIO; } close(fd); return 0; } /* Creates a file in the cache that holds dir-entries of directory dir. dir will be updated if necessary. If this file already exists, it does nothing. To write the dir-entries it calls the write_dir_entry function of the kernel interface. return value : 0 on success, EIO if no cache file could be created. */ static int create_dir_cache_file(dav_node *dir) { if (dir->cache_path) { if (access(dir->cache_path, F_OK) == 0) { return 0; } else { free(dir->cache_path); } } dir->cache_path = ne_concat(cache_dir, "/dir-", dir->name, "-XXXXXX", NULL); int fd = mkstemp(dir->cache_path); if (fd <= 0) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("can't create cache file %s"), dir->cache_path); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), "%s", strerror(errno)); free(dir->cache_path); dir->cache_path = NULL; return EIO; } off_t size = write_dir(dir, fd); close(fd); if (size > 0) { dir->size = size; return 0; } else { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("error writing directory %s"), dir->cache_path); remove(dir->cache_path); free(dir->cache_path); dir->cache_path = NULL; return EIO; } } /* Opens the cache file of node using flags and stores the file descriptor in fd. A new structure dav_handle is created and added to the list of handles. return value : 0 on success, EIO if the file could not be opend. */ static int open_file(int *fd, dav_node *node, int flags, pid_t pid, pid_t pgid, uid_t uid) { *fd = open(node->cache_path, flags, node->mode); if (*fd <= 0) return EIO; dav_handle *fh = (dav_handle *) ne_malloc(sizeof(dav_handle)); fh->fd = *fd; fh->flags = O_ACCMODE & flags; fh->pid = pid; fh->pgid = pgid; fh->uid = uid; fh->next = node->handles; node->handles = fh; if ((O_ACCMODE & flags) == O_WRONLY || (O_ACCMODE & flags) == O_RDWR) node->dirty = 1; return 0; } /* Updates the cached file from the server if necessary and possible, or retrieves one from the server if no cache file exists. It is not necessary or possible if - node is in directory backup - node is created (does not yet exist on the server) - node is open for writing - it has been updated within the last second - node is dirty. If the node is dirty but not open for write, it will be stored back on the server. */ static int update_cache_file(dav_node *node) { if (is_backup(node) || is_created(node) || is_open_write(node) || (is_dirty(node) && is_locked(node))) { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " no update"); return 0; } int ret = 0; if (is_dirty(node)) { if (get_upload_time(node) >= time(NULL)) return 0; ret = dav_put(node->path, node->cache_path, &node->remote_exists, &node->lock_expire, &node->etag, &node->smtime, -1); if (!ret) { node->utime = time(NULL); node->dirty = 0; remove_from_changed(node); } else if (ret == EACCES || ret == EINVAL || ret == ENOENT || ret == EPERM || ret == ENOSPC) { delete_cache_file(node->parent); node->parent->utime = 0; *flush = 1; remove_node(node); ret = EIO; } return ret; } if (gui_optimize && is_cached(node) && time(NULL) > (node->utime +file_refresh)) { update_directory(node->parent, file_refresh); if (!exists(node) || node->parent == NULL) return ENOENT; } if (is_cached(node) && access(node->cache_path, F_OK) == 0) { if (time(NULL) <= (node->utime + file_refresh)) return 0; int modified = 0; off_t old_size = node->size; ret = dav_get_file(node->path, node->cache_path, &node->size, &node->etag, &node->smtime, &modified); if (!ret) { if (modified) { node->mtime = node->smtime; node->atime = node->smtime; set_cache_file_times(node); } node->utime = time(NULL); cache_size += node->size - old_size; } } else { if (create_cache_file(node) != 0) return EIO; time_t smtime = 0; char *etag = NULL; ret = dav_get_file(node->path, node->cache_path, &node->size, &etag, &smtime, NULL); if (!ret) { if (node->etag) free(node->etag); node->etag = etag; if (smtime) { node->atime = smtime; node->mtime = smtime; node->smtime = smtime; } node->utime = time(NULL); set_cache_file_times(node); cache_size += node->size; } else { if (ret == ENOENT) { delete_cache_file(node->parent); node->parent->utime = 0; *flush = 1; remove_node(node); } delete_cache_file(node); if (etag) free(etag); } } return ret; } static off_t write_dir(dav_node *dir, int fd) { off_t size = write_dir_entry(fd, 0, dir, "."); if (size > 0 && dir->parent != NULL) size = write_dir_entry(fd, size, dir->parent, ".."); dav_node *node = dir->childs; while (size > 0 && node) { size = write_dir_entry(fd, size, node, node->name); node = node->next; } if (size > 0) size = write_dir_entry(fd, size, NULL, NULL); return size; } /* Permanent cache maintenance. */ /* Checks whether there is an cache directory for the server host, path path, mountpoint mpoint and the default_user in the top level cache directory dir. If not it will create one. In case of an error it will print an error message and terminate the program. dir : The top level cache directory. host : Domain name of the server. path : Path of the resource onthe server. mpoint : Mount point. */ static void check_cache_dir(const char *dir, const char *host, const char *path, const char *mpoint) { struct passwd *pw = getpwuid(default_uid); if (!pw || !pw->pw_name) error(EXIT_FAILURE, 0, _("can't read user data base")); char *dir_name = ne_concat(host, path, mpoint + 1, "+", pw->pw_name, NULL); *(dir_name + strlen(host) + strlen(path) - 1) = '+'; char *pos = strchr(dir_name, '/'); while (pos) { *pos = '-'; pos = strchr(pos, '/'); } DIR *tl_dir = opendir(dir); if (!tl_dir) error(EXIT_FAILURE, 0, _("can't open cache directory %s"), dir); struct dirent *de = readdir(tl_dir); while (de && !cache_dir) { if (strcmp(de->d_name, dir_name) == 0) { cache_dir = ne_concat(dir, "/", de->d_name, NULL); } de = readdir(tl_dir); } closedir(tl_dir); if (!cache_dir) { cache_dir = ne_concat(dir, "/", dir_name, NULL); if (mkdir(cache_dir, S_IRWXU) != 0) error(EXIT_FAILURE, 0, _("can't create cache directory %s"), cache_dir); } free(dir_name); struct stat st; if (stat(cache_dir, &st) != 0) error(EXIT_FAILURE, 0, _("can't access cache directory %s"), cache_dir); if (st.st_uid != geteuid()) error(EXIT_FAILURE, 0, _("wrong owner of cache directory %s"), cache_dir); if ((DAV_A_MASK & st.st_mode) != S_IRWXU) error(EXIT_FAILURE, 0, _("wrong permissions set for cache directory %s"), cache_dir); } /* Searches cache for orphaned files and puts them into backup. */ static void clean_cache(void) { DIR *dir = opendir(cache_dir); if (!dir) return; struct dirent *de = readdir(dir); while (de) { if (strcmp(de->d_name, ".") != 0 && strcmp(de->d_name, "..") != 0 && strcmp(de->d_name, DAV_INDEX) != 0) { char *path = ne_concat(cache_dir, "/", de->d_name, NULL); int i = 0; dav_node *node = NULL; while (!node && i < table_size) { node = table[i]; while (node && (!is_reg(node) || !node->cache_path || strcmp(path, node->cache_path) != 0)) { node = node->table_next; } i++; } if (!node) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("found orphaned file in cache:")); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), " %s", path); dav_node *found = new_node(backup, default_file_mode); found->mode &= ~(S_IRWXG | S_IRWXO); found->cache_path = path; found->name = ne_strdup(de->d_name); attr_from_cache_file(found); backup->mtime = time(NULL); backup->ctime = backup->mtime; } else { free(path); } } de = readdir(dir); } closedir(dir); } /* Reads the index file of the cache and creates a tree of nodes from the XML data in the index file. Will be called when the cache module is initialized. The root node must already exist. If an error occurs all nodes created up to this will be deleted. */ static void parse_index(void) { char *index = ne_concat(cache_dir, "/", DAV_INDEX, NULL); FILE *idx = fopen(index, "r"); if (!idx) { free(index); return; } char *buf = ne_malloc(DAV_XML_BUF_SIZE); size_t len = fread(buf, 1, DAV_XML_BUF_SIZE, idx); if (len <= 0) { free(buf); fclose(idx); free(index); return; } dav_node *node = root; ne_xml_parser *parser = ne_xml_create(); ne_xml_push_handler(parser, xml_start_root, NULL, xml_end_root, &node); ne_xml_push_handler(parser, xml_start_backup, NULL, xml_end_backup, &node); ne_xml_push_handler(parser, xml_start_dir, NULL, xml_end_dir, &node); ne_xml_push_handler(parser, xml_start_reg, NULL, xml_end_reg, &node); ne_xml_push_handler(parser, xml_start_date, xml_cdata, xml_end_date, &node); ne_xml_push_handler(parser, xml_start_decimal, xml_cdata, xml_end_decimal, &node); ne_xml_push_handler(parser, xml_start_mode, xml_cdata, xml_end_mode, &node); ne_xml_push_handler(parser, xml_start_size, xml_cdata, xml_end_size, &node); if (strstr(buf, "") == buf) { ne_xml_push_handler(parser, xml_start_string, xml_cdata, xml_end_string, &node); } else { ne_xml_push_handler(parser, xml_start_string, xml_cdata, xml_end_string_old, &node); } int ret = 0; while (len > 0 && !ret) { ret = ne_xml_parse(parser, buf, len); len = fread(buf, 1, DAV_XML_BUF_SIZE, idx); } ret = ne_xml_parse(parser, buf, 0); free(buf); if (ret) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("error parsing %s"), index); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _(" at line %i"), ne_xml_currentline(parser)); delete_tree(root); } ne_xml_destroy(parser); fclose(idx); free(index); } /* Removes the files with lowest access time from cache until the cache size is smaller than max_cache_size or there are no more files that may be removed. */ static void resize_cache(void) { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "resize cache: %llu of %llu MiBytes used.", (cache_size + 0x80000) / 0x100000, (max_cache_size + 0x80000) / 0x100000); while (1) { dav_node *least_recent = NULL; cache_size = 0; size_t i; for (i = 0; i < table_size; i++) { dav_node *node = table[i]; while (node) { if (is_cached(node)) { if (!is_open(node) && !is_dirty(node) && !is_created(node) && !is_backup(node) && (!least_recent || node->atime < least_recent->atime)) least_recent = node; cache_size += node->size; } node = node->table_next; } } if (cache_size < max_cache_size) break; if (!least_recent) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("open files exceed max cache size by %llu MiBytes"), (cache_size - max_cache_size + 0x80000) / 0x100000); break; } delete_cache_file(least_recent); cache_size -= least_recent->size; } if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), " %llu of %llu MiBytes used.", (cache_size + 0x80000) / 0x100000, (max_cache_size + 0x80000) / 0x100000); return; } /* Creates an entry for node in the index file file, removes the node from the tree and the hash table and deletes the node. The entry will be indented by indent to get proper alignment of nested entries. node : the node. file : the index file for this cache directory. indent : a string of spaces to indent the entry. return value : 0 on success, -1 if an error occurs. */ static int write_node(dav_node *node, FILE *file, const char *indent) { if (node == root) { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "writing root %p", node); if (fprintf(file, "\n", type[ROOT], DAV_XML_NS) < 0) return -1; } else if (node == backup) { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "writing backup %p", node); if (fprintf(file, "%s\n", indent, type[BACKUP]) < 0) return -1; } else if (is_dir(node)) { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "writing directory %p", node); if (fprintf(file, "%s\n", indent, type[DDIR]) < 0) return -1; } else { if (debug) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "writing file %p", node); if (fprintf(file, "%s\n", indent, type[REG]) < 0) return -1; } char *ind = ne_concat(indent, " ", NULL); if (node != root && !is_backup(node)) { if (fprintf(file, "%s\n", ind, type[PATH], node->path, type[PATH]) < 0) return -1; } if (node != root && node != backup) { char *name = dav_conv_to_utf_8(node->name); int ret = fprintf(file, "%s\n", ind, type[NAME], name, type[NAME]); free(name); if (ret < 0) return -1; } if (is_reg(node) && node->cache_path != NULL) { char *path = dav_conv_to_utf_8(node->cache_path); int ret = fprintf(file, "%s\n", ind, type[CACHE_PATH], path, type[CACHE_PATH]); free(path); if (ret < 0) return -1; } if (is_reg(node) && !is_backup(node) && node->etag != NULL) { if (fprintf(file, "%s\n", ind, type[ETAG], node->etag, type[ETAG]) < 0) return -1; } if (is_reg(node)) { if (fprintf(file, "%s%lli\n", ind, type[SIZE], (long long int) node->size, type[SIZE]) < 0) return -1; } char t[64]; struct tm *lt = localtime(&node->atime); strftime(t, 64, "(%FT%T%z)", lt); if (fprintf(file, "%s%li%s\n", ind, type[ATIME], node->atime, t, type[ATIME]) < 0) return -1; lt = localtime(&node->mtime); strftime(t, 64, "(%FT%T%z)", lt); if (fprintf(file, "%s%li%s\n", ind, type[MTIME], node->mtime, t, type[MTIME]) < 0) return -1; lt = localtime(&node->ctime); strftime(t, 64, "(%FT%T%z)", lt); if (fprintf(file, "%s%li%s\n", ind, type[CTIME], node->ctime, t, type[CTIME]) < 0) return -1; if (is_reg(node) && !is_backup(node)) { lt = localtime(&node->smtime); strftime(t, 64, "(%FT%T%z)", lt); if (fprintf(file, "%s%li%s\n", ind, type[SMTIME], node->smtime, t, type[SMTIME]) < 0) return -1; } if (is_reg(node) && !is_backup(node) && (is_dirty(node) || is_created(node))) { lt = localtime(&node->lock_expire); strftime(t, 64, "(%FT%T%z)", lt); if (fprintf(file, "%s%li%s\n", ind, type[LOCK_EXPIRE], node->lock_expire, t, type[LOCK_EXPIRE]) < 0) return -1; if (fprintf(file, "%s%i\n", ind, type[REMOTE_EXISTS], node->remote_exists, type[REMOTE_EXISTS]) < 0) return -1; if (fprintf(file, "%s%i\n", ind, type[DIRTY], node->dirty, type[DIRTY]) < 0) return -1; } if (node != backup) { if (fprintf(file, "%s%o\n", ind, type[MODE], node->mode, type[MODE]) < 0) return -1; } if (node != root && node != backup) { if (fprintf(file, "%s%i\n", ind, type[UID], node->uid, type[UID]) < 0) return -1; if (fprintf(file, "%s%i\n", ind, type[GID], node->gid, type[GID]) < 0) return -1; } dav_node *child = node->childs; while (child != NULL) { if (write_node(child, file, ind) < 0) return -1; child = child->next; } if (node == root) { if (fprintf(file, "%s\n", indent, type[ROOT]) < 0) return -1; } else if (node == backup) { if (fprintf(file, "%s\n", indent, type[BACKUP]) < 0) return -1; } else if (is_dir(node)) { if (fprintf(file, "%s\n", indent, type[DDIR]) < 0) return -1; } else { if (fprintf(file, "%s\n", indent, type[REG]) < 0) return -1; } free(ind); return 0; } /* Concatenate data from subsequent callbacks into xml_data. */ static int xml_cdata(void *userdata, int state, const char *cdata, size_t len) { if (!xml_data) { xml_data = ne_strndup(cdata, len); } else { char *add = ne_strndup(cdata, len); char *new = ne_concat(xml_data, add, NULL); free(add); free(xml_data); xml_data = new; } return 0; } /* Finishes the creation of directory backup. userdata is set to the parent of backup. return value : allways 0. */ static int xml_end_backup(void *userdata, int state, const char *nspace, const char *name) { dav_node *dir = *((dav_node **) userdata); *((dav_node **) userdata) = dir->parent; if (dir->path) { free(dir->path); dir->path = NULL; } if (dir->name) { free(dir->name); dir->name = NULL; } delete_cache_file(dir); if (dir->etag) { free(dir->etag); dir->etag = NULL; } dir->smtime = 0; return 0; } /* xml_data must be a string representing a value as a decimal number. Its value is assigned to the appropriate member of node userdata. state indacates the member of node. return value : 0 on success, -1 if an error occurs. */ static int xml_end_date(void *userdata, int state, const char *nspace, const char *name) { if (!xml_data) return -1; char *tail; time_t t = strtol(xml_data, &tail, 10); if (*tail != '\0' && *tail != '(') { free(xml_data); xml_data = NULL; return -1; } free(xml_data); xml_data = NULL; switch (state) { case ATIME: (*((dav_node **) userdata))->atime = t; break; case MTIME: (*((dav_node **) userdata))->mtime = t; break; case CTIME: (*((dav_node **) userdata))->ctime = t; break; case SMTIME: (*((dav_node **) userdata))->smtime = t; break; case LOCK_EXPIRE: (*((dav_node **) userdata))->lock_expire = t; break; default: return -1; } return 0; } /* xml_dat must be a string representation of a decimal number. Its value is assigned to the appropriate member of node userdata. state indacates the member of node. return value : 0 on success, -1 if an error occurs. */ static int xml_end_decimal(void *userdata, int state, const char *nspace, const char *name) { if (!xml_data) return -1; char *tail; long int n = strtol(xml_data, &tail, 10); if (*tail != '\0') { free(xml_data); xml_data = NULL; return -1; } free(xml_data); xml_data = NULL; switch (state) { case UID: (*((dav_node **) userdata))->uid = n; break; case GID: (*((dav_node **) userdata))->gid = n; break; case DIRTY: (*((dav_node **) userdata))->dirty = n; break; case REMOTE_EXISTS: (*((dav_node **) userdata))->remote_exists = n; break; default: return -1; } return 0; } /* Finishes the creation of a directory. Members name and path of the not must not be NULL, or the direcotry tree will be deleted. userdata is set to the parent of the directory. return value : allways 0. */ static int xml_end_dir(void *userdata, int state, const char *nspace, const char *name) { dav_node *dir = *((dav_node **) userdata); *((dav_node **) userdata) = dir->parent; if (!dir->name || !dir->path) { delete_tree(dir); return 0; } delete_cache_file(dir); if (dir->etag) { free(dir->etag); dir->etag = NULL; } dir->size = 0; dir->smtime = 0; return 0; } /* xml_data must be a string representation of an octal number. Its value is assigned to member mode of node userdata. return value : 0 on success, -1 if an error occurs. */ static int xml_end_mode(void *userdata, int state, const char *nspace, const char *name) { if (!xml_data) return -1; char *tail; (*((dav_node **) userdata))->mode = strtol(xml_data, &tail, 8); if (*tail != '\0') { free(xml_data); xml_data = NULL; return -1; } free(xml_data); xml_data = NULL; return 0; } /* Finishes the creation of a node of a regular file. Members path, name and cach_path must not be NULL and the cache file must exist, or the node will be deleted. If the file is in directory backup, member path may be NULL. userdata is set to the parent of the file node. return value : allways 0. */ static int xml_end_reg(void *userdata, int state, const char *nspace, const char *name) { dav_node *reg = *((dav_node **) userdata); *((dav_node **) userdata) = reg->parent; struct stat st; if (!reg->name || !reg->cache_path || stat(reg->cache_path, &st) != 0 || reg->size != st.st_size || (!reg->path && !is_backup(reg))) { if (reg->cache_path) { remove(reg->cache_path); free(reg->cache_path); reg->cache_path = NULL; } delete_tree(reg); return 0; } cache_size += reg->size; if (is_backup(reg)) { if (reg->path) { free(reg->path); reg->path = NULL; } if (reg->etag) { free(reg->etag); reg->etag = NULL; } reg->smtime = 0; } else if (is_dirty(reg) || is_created(reg)) { add_to_changed(reg); set_upload_time(reg); } return 0; } /* Finishes the creation of the root directory. userdata must be equal to root, or the complete tree will be deleted. Members path, name, cache_path and etag will be NULL. return value : allways 0. */ static int xml_end_root(void *userdata, int state, const char *nspace, const char *name) { dav_node *dir = *((dav_node **) userdata); if (dir != root) delete_tree(dir); if (dir->path) { free(dir->path); dir->path = NULL; } if (dir->name) { free(dir->name); dir->name = NULL; } delete_cache_file(dir); if (dir->etag) { free(dir->etag); dir->etag = NULL; } dir->size = 0; dir->smtime = 0; return 0; } /* xml_data must be a string representation of a decimal number representing a file size. Its value is assigned to member size of the node. return value : 0 on success, -1 if an error occurs. */ static int xml_end_size(void *userdata, int state, const char *nspace, const char *name) { if (!xml_data) return -1; char *tail; #if _FILE_OFFSET_BITS == 64 (*((dav_node **) userdata))->size = strtoll(xml_data, &tail, 10); #else (*((dav_node **) userdata))->size = strtol(xml_data, &tail, 10); #endif if (*tail != '\0') { free(xml_data); xml_data = NULL; return -1; } free(xml_data); xml_data = NULL; return 0; } /* Stores xml_data in the appropriate member of node userdata. state indicates the member of node. return value : 0 on success, -1 if an error occurs. */ static int xml_end_string(void *userdata, int state, const char *nspace, const char *name) { if (!xml_data) return -1; switch (state) { case PATH: (*((dav_node **) userdata))->path = xml_data; break; case NAME: (*((dav_node **) userdata))->name = dav_conv_from_utf_8(xml_data); free(xml_data); break; case CACHE_PATH: (*((dav_node **) userdata))->cache_path = dav_conv_from_utf_8(xml_data); free(xml_data); break; case ETAG: (*((dav_node **) userdata))->etag = xml_data; break; default: free(xml_data); xml_data = NULL; return -1; } xml_data = NULL; return 0; } /* Stores xml_data in the appropriate member of node userdata. state indicates the member of node. return value : 0 on success, -1 if an error occurs. */ static int xml_end_string_old(void *userdata, int state, const char *nspace, const char *name) { if (!xml_data) return -1; switch (state) { case PATH: (*((dav_node **) userdata))->path = xml_data; break; case NAME: (*((dav_node **) userdata))->name = xml_data; break; case CACHE_PATH: (*((dav_node **) userdata))->cache_path = xml_data; break; case ETAG: (*((dav_node **) userdata))->etag = xml_data; break; default: free(xml_data); xml_data = NULL; return -1; } xml_data = NULL; return 0; } /* Will be called when the start tag of a XML-element is found, and tests wheather it is a BACKUP elemt. In this case parent must be ROOT. userdata will be set to the newly created node backup and also the global variable backup will be set. return value : 0 not responsible for this kind of element. BACKUP if it is the backup element -1 XML error, parent is not root. */ static int xml_start_backup(void *userdata, int parent, const char *nspace, const char *name, const char **atts) { if (strcmp(name, type[BACKUP]) != 0) return 0; if (parent != ROOT) return -1; dav_node *dir = new_node(*((dav_node **) userdata), S_IFDIR | S_IRWXU); backup = dir; *((dav_node **) userdata) = dir; return BACKUP; } /* Will be called when the start tag of a XML-element is found, and tests whether it is an element that contains a date. In this case the parent must be either a directory (including root and backup) or a file node. return value : 0 not responsible for this kind of element. A value that indicates which member of a node the decimal value must be assigned to. -1 XML error, parent must not contain this property. */ static int xml_start_date(void *userdata, int parent, const char *nspace, const char *name, const char **atts) { int ret; if (strcmp(name, type[ATIME]) == 0) { ret = ATIME; } else if (strcmp(name, type[MTIME]) == 0) { ret = MTIME; } else if (strcmp(name, type[CTIME]) == 0) { ret = CTIME; } else if (strcmp(name, type[SMTIME]) == 0) { ret = SMTIME; } else if (strcmp(name, type[LOCK_EXPIRE]) == 0) { ret = LOCK_EXPIRE; } else { return 0; } if (parent != DDIR && parent != REG && parent != BACKUP && parent != ROOT) return -1; return ret; } /* Will be called when the start tag of a XML-element is found, and tests whether it is an element that contains a decimal value. In this case the parent must be either a directory (including root and backup) or a file node. If parent is ROOT or BACKUP the element type must not be UID or GID. DIRTY and REMOTE_EXISTS are only allowed for parent REG. return value : 0 not responsible for this kind of element. A value that indicates which member of a node the decimal value must be assigned to. -1 XML error, parent must not contain this property. */ static int xml_start_decimal(void *userdata, int parent, const char *nspace, const char *name, const char **atts) { int ret; if (strcmp(name, type[UID]) == 0) { ret = UID; } else if (strcmp(name, type[GID]) == 0) { ret = GID; } else if (strcmp(name, type[DIRTY]) == 0) { ret = DIRTY; } else if (strcmp(name, type[REMOTE_EXISTS]) == 0) { ret = REMOTE_EXISTS; } else { return 0; } if (parent != DDIR && parent != REG && parent != BACKUP && parent != ROOT) return -1; if ((parent == BACKUP || parent == ROOT) && (ret == UID || ret == GID)) return -1; if (parent != REG && (ret == DIRTY || ret == REMOTE_EXISTS)) return -1; return ret; } /* Will be called when the start tag of a XML-element is found, and tests whether it is an directory element. Inthis case parent must be a directory (including root but nur backup). userdata will be set to the newly created directory node. return value : 0 not responsible for this kind of element. DDIR if it is a directory element. -1 XML error, parent must not contain this property. */ static int xml_start_dir(void *userdata, int parent, const char *nspace, const char *name, const char **atts) { if (strcmp(name, type[DDIR]) != 0) return 0; if (parent != DDIR && parent != ROOT) return -1; dav_node *dir = new_node(*((dav_node **) userdata), default_dir_mode); *((dav_node **) userdata) = dir; return DDIR; } /* Will be called when the start tag of a XML-element is found, and tests whether it is an mode element. In this case parent must be a regular node or a directory (including root but not backup). return value : 0 not responsible for this kind of element. MODE if it is a mode element. -1 XML error, parent must not contain this property. */ static int xml_start_mode(void *userdata, int parent, const char *nspace, const char *name, const char **atts) { if (strcmp(name, type[MODE]) != 0) return 0; if (parent != DDIR && parent != REG && parent != ROOT) return -1; return MODE; } /* Will be called when the start tag of a XML-element is found, and tests whether it is an element that represents a file node. In this case parent must be a directory (including root and backup). userdata will be set to the newly created file node. return value : 0 not responsible for this kind of element. REG if the element represents a file node. -1 XML error, parent must not contain this property. */ static int xml_start_reg(void *userdata, int parent, const char *nspace, const char *name, const char **atts) { if (strcmp(name, type[REG]) != 0) return 0; if (parent != DDIR && parent != BACKUP && parent != ROOT) return -1; dav_node *reg = new_node(*((dav_node **) userdata), default_file_mode); *((dav_node **) userdata) = reg; if (parent != BACKUP) reg->remote_exists = 1; return REG; } /* Will be called when the start tag of a XML-element is found, and tests whether the element represents the root node. In this case parent must be 0. return value : 0 not responsible for this kind of element. ROOT if it is the root node element. -1 XML error, root property with parent not equal 0. */ static int xml_start_root(void *userdata, int parent, const char *nspace, const char *name, const char **atts) { if (strcmp(name, type[ROOT]) != 0) return 0; if (parent != 0) return -1; return ROOT; } /* Will be called when the start tag of a XML-element is found, and tests whether it is an element that contains the file size. In this case the parent must be a file node. return value : 0 not responsible for this kind of element. SIZE if the element represents the file size. value must be assigned to. -1 XML error, parent must not contain this property. */ static int xml_start_size(void *userdata, int parent, const char *nspace, const char *name, const char **atts) { if (strcmp(name, type[SIZE]) != 0) { return 0; } if (parent != REG) return -1; return SIZE; } /* Will be called when the start tag of a XML-element is found, and tests whether it is an element that rcontains a string. In this case parent must be a directory or a file node. return value : 0 not responsible for this kind of element. A value that indicates which member of a node the string must be assigned to. -1 XML error, parent must not contain this property. */ static int xml_start_string(void *userdata, int parent, const char *nspace, const char *name, const char **atts) { int ret; if (strcmp(name, type[PATH]) == 0) { ret = PATH; } else if (strcmp(name, type[NAME]) == 0) { ret = NAME; } else if (strcmp(name, type[CACHE_PATH]) == 0) { ret = CACHE_PATH; } else if (strcmp(name, type[ETAG]) == 0) { ret = ETAG; } else { return 0; } if (parent != DDIR && parent != REG) return -1; return ret; } /* Auxiliary. */ /* Tries to evaluate the alignment of structure dav_node. It allocates dav_node structures and random length strings alternatively and inspects the address. return value : the alignment (e.g. alignment = 4 means addresses are always multiples of 4 */ static size_t test_alignment() { srand(time(0)); size_t align = 64; size_t trials = 100; char *s[trials]; dav_node *n[trials]; size_t j = 0; while (align > 0 && j < trials) { s[j] = (char *) ne_malloc((rand() / (RAND_MAX / 1024)) % (4 *align)); n[j] = (dav_node *) ne_malloc(sizeof(dav_node)); while (align > 0 && ((size_t) n[j] % align) > 0) align /= 2; ++j; } for (j = 0; j < trials; j++) { if (n[j]) free(n[j]); if (s[j]) free(s[j]); } return align; } davfs2-1.5.2/src/mount_davfs.h0000644000175000017500000002040612371717057013126 00000000000000/* mount_davfs.h: structure to collect arguments and options. Copyright (C) 2006, 2007, 2008, 2009, 2014 Werner Baumann This file is part of davfs2. davfs2 is free software; you can 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. davfs2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with davfs2; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #ifndef DAV_MOUNT_DAVFS_H #define DAV_MOUNT_DAVFS_H /* Data Types */ /*============*/ /* This data structure holds almost everything davfs gathers while reading and checking command line and configuration files. (See comment for data origin; highest precedence first.) Some data will be copied into global or local variables to be available in daemon mode. The rest will be freed when forking into daemon mode. */ typedef struct { char *cmdline; char *dav_user; /* System config file */ char *dav_group; /* System config file */ char *conf; /* Command line */ /* Mount options */ int user; /* Command line */ int users; /* Command line */ int netdev; /* Command line */ int grpid; /* Command line */ unsigned long int mopts; /* Command line */ char *kernel_fs; /* User config file, system config file */ int use_utab; size_t buf_size; /* User config file, system config file */ /* File mode */ uid_t uid; /* Command line */ gid_t gid; /* Command line */ mode_t dir_mode; /* Command line */ mode_t file_mode; /* Command line */ /* WebDAV-resource */ char *scheme; /* Command line */ char *host; /* Command line */ int port; /* Command line */ char *path; /* Command line */ char *trust_ca_cert; /* User config file, system config file */ char *trust_server_cert; /* User config file, system config file */ char *secrets; /* User config file */ char *username; /* User secrets file, system secrets file */ char *cl_username; /* Command line */ char *password; /* User secrets file, system secrets file */ char *clicert; /* User config file, system config file */ char *clicert_pw; /* User secrets file, system secrets file */ char *p_host; /* User config file, sys conf f., environment */ int p_port; /* User config file, sys conf f., environment */ char *p_user; /* User secrets file, system secrets file */ char *p_passwd; /* User secrets file, system secrets file */ int useproxy; /* User config file, sys conf f., command line */ int askauth; /* User config file, sys conf f., command line */ int locks; /* User config file, sys conf f., command line */ char * lock_owner; /* User config file, system config file */ time_t lock_timeout; /* User config file, system config file */ time_t lock_refresh; /* User config file, system config file */ int expect100; /* User config file, system config file */ int if_match_bug; /* User config file, system config file */ int drop_weak_etags; /* User config file, system config file */ int n_cookies; /* User config file, system config file */ int precheck; /* User config file, system config file */ int ignore_dav_header; /* User config file, system config file */ int use_compression; /* User config file, system config file */ int min_propset; /* User config file, system config file */ int follow_redirect; /* User config file, system config file */ time_t connect_timeout; /* User config file, system config file */ time_t read_timeout; /* User config file, system config file */ time_t retry; /* User config file, system config file */ time_t max_retry; /* User config file, system config file */ int max_upload_attempts; /* User config file, system config file */ char * s_charset; /* User config file, system config file */ char * header; /* User config file, system config file */ /* Cache */ char *sys_cache; /* System config file */ char *cache_dir; /* User config file */ char *backup_dir; /* User config file, system config file */ size_t cache_size; /* User config file, system config file */ size_t table_size; /* User config file, system config file */ time_t dir_refresh; /* User config file, system config file */ time_t file_refresh; /* User config file, system config file */ int delay_upload; /* User config file, system config file */ int gui_optimize; /* User config file, system config file */ int minimize_mem; /* User config file, system config file */ /* Debugging */ int debug; /* User config file, system config file */ int neon_debug; /* User config file, system config file */ } dav_args; /* Public functions. */ /*===================*/ /* Main launches a daemon program that runs a directory and file cache and is connected to the WbDAV resource and the kernel file system module. It must run setuid root. After forking into daemon mode it releases root permissions permanently. The daemon runs with the uid of the user that owns the file system. (If invoked by root and the mounted file system is owned by root, the daemon runs as root. This should be avoided.) Launching the daemon (and stopping) is done in 5 steps. Step 1: - Gathering information from command line, configuration files and environment. - Checking this information for consistency and any errors that would prevent successful running of the daemon. - Checking whether the the user has permissions to mount. - Checking whether the neccessary files and directories for running the daemon are available. Step 2: - The modules for connecting to the kernel, connecting to the WebDAV resource and for caching are initialised. If an error accurs during step 1 or step 2 an error message is printed and the program dies immediately. Clean up is left to the operating system. Step 3: - Forking into daemon mode. - While the daemon (child) writes the pid file and starts reading upcalls from the kernel in an endless loop, the parent process tries to mount the file system and write an entry into mtab (_PROC_MOUNTS). - If an error occurs in one of the processes it sends SIGTERM to the other. While the parent just dies, the daemon will run its normal exit code (see step 5). In rare cases this might nevertheless leave stale pid files or entries in mtab that must be cleaned manually by the administrator. - If mounting is successful the parent process exits with success. Step 4: - Running as daemon. Step 5: - Terminating. - The daemon has set a signal handler for SIGTERM and SIGHUP. If it gets one of these signals it tries to unmount the file system and resets the global variable keep_on_running. This will terminate the message loop gracefully. - If the file system is unmounted (by the umount programm), the message loop will terminate gracefully. - The close functions of the modules are called, that will clean up the cache, save cached information if neccessary and close the connections. */ int main(int argc, char *argv[]); /* Prints prompt to stdout and reads a line from stdin. Echoing the user input to stdout is prohibited. A trailing newline is removed. return value : the user input. */ char * dav_user_input_hidden(const char *prompt); #endif /* DAV_MOUNT_DAVFS_H */ davfs2-1.5.2/src/Makefile.am0000644000175000017500000000500312325540246012451 00000000000000## Makefile for program src directory in davfs. ## Copyright (C) 2006, 2007, 2008, 2009 Werner Baumann ## ## This file is part of davfs2. ## ## davfs2 is free software; you can 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. ## ## davfs2 is distributed in the hope that it will be useful, ## but WITHOUT ANY WARRANTY; without even the implied warranty of ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## GNU General Public License for more details. ## ## You should have received a copy of the GNU General Public License ## along with davfs2; if not, write to the Free Software Foundation, ## Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ ## Process this file with automake to produce Makefile.in localedir = $(datadir)/locale pkgsysconfdir = $(sysconfdir)/@PACKAGE@ pkglocalstatedir = $(dav_localstatedir)/mount.davfs pkgsyscachedir = $(dav_syscachedir)/@PACKAGE@ ssbindir = @ssbindir@ sbin_PROGRAMS = mount.davfs umount.davfs mount_davfs_SOURCES = cache.c dav_coda.c \ dav_fuse.c kernel_interface.c mount_davfs.c webdav.c \ cache.h coda.h defaults.h fuse_kernel.h \ kernel_interface.h mount_davfs.h webdav.h umount_davfs_SOURCES = umount_davfs.c defaults.h AM_CFLAGS = -Wall -Werror=format-security \ -fstack-protector --param=ssp-buffer-size=4 DEFS = -DPROGRAM_NAME=\"mount.davfs\" \ -DDAV_SYS_CONF_DIR=\"$(pkgsysconfdir)\" \ -DDAV_LOCALSTATE_DIR=\"$(dav_localstatedir)\" \ -DDAV_SYS_RUN=\"$(pkglocalstatedir)\" \ -DDAV_SYS_CACHE=\"$(pkgsyscachedir)\" \ -DDAV_SECRETS=\"secrets\" \ -DDAV_CONFIG=\"$(PACKAGE).conf\" \ -DDAV_CERTS_DIR=\"certs\" \ -DDAV_CLICERTS_DIR=\"private\" \ -DDAV_DATA_DIR=\"$(pkgdatadir)\" \ -DLOCALEDIR=\"$(localedir)\" \ -DDAV_USER=\"$(dav_user)\" \ -DDAV_GROUP=\"$(dav_group)\" \ -D_FORTIFY_SOURCE=2 @DEFS@ LIBS = $(NEON_LIBS) @LIBS@ install-exec-hook: chmod u+s $(DESTDIR)$(sbindir)/mount.davfs; \ if test "$(sbindir)" != "$(ssbindir)"; then \ $(mkinstalldirs) $(DESTDIR)$(ssbindir); \ $(LN_S) -f $(sbindir)/mount.davfs $(DESTDIR)$(ssbindir)/mount.davfs; \ $(LN_S) -f $(sbindir)/umount.davfs $(DESTDIR)$(ssbindir)/umount.davfs; \ fi uninstall-hook: if test "$(sbindir)" != "$(ssbindir)"; then \ rm -f $(DESTDIR)$(ssbindir)/mount.davfs; \ rm -f $(DESTDIR)$(ssbindir)/umount.davfs; \ fi davfs2-1.5.2/src/webdav.c0000644000175000017500000016353312371717022012045 00000000000000/* webdav.c: send requests to the WebDAV server. Copyright (C) 2006, 2007, 2008, 2009, 2014 Werner Baumann This file is part of davfs2. davfs2 is free software; you can 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. davfs2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with davfs2; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. */ #include "config.h" #include #include #ifdef HAVE_FCNTL_H #include #endif #ifdef HAVE_ICONV_H #include #endif #ifdef HAVE_LANGINFO_H #include #endif #ifdef HAVE_LIBINTL_H #include #endif #ifdef HAVE_LIMITS_H #include #endif #ifdef HAVE_STDINT_H #include #endif #include #ifdef HAVE_STDLIB_H #include #endif #include #ifdef HAVE_SYSLOG_H #include #endif #include #ifdef HAVE_UNISTD_H #include #endif #ifdef HAVE_SYS_STAT_H #include #endif #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "defaults.h" #include "mount_davfs.h" #include "webdav.h" #ifdef ENABLE_NLS #define _(String) gettext(String) #else #define _(String) String #endif /* Data Types */ /*============*/ /* Data structures used as userdata in neon callback functions. */ typedef struct { const char *path; /* The *not* url-encoded path. */ dav_props *results; /* Start of the linked list of dav_props. */ } propfind_context; typedef struct { int error; /* An error occured while reading/writing. */ const char *file; /* cache_file to store the data in. */ int fd; /* file descriptor of the open cache file. */ } get_context; typedef struct { int error; uint64_t available; /* Amount of available bytes (quota - used). */ uint64_t used; /* Used bytes. */ } quota_context; /* Private constants */ /*===================*/ /* Properties to be retrieved from the server. This constants are used by dav_get_collection(). */ enum { TYPE = 0, LENGTH, ETAG, MODIFIED, EXECUTE }; static const ne_propname full_prop_names[] = { [TYPE] = {"DAV:", "resourcetype"}, [LENGTH] = {"DAV:", "getcontentlength"}, [ETAG] = {"DAV:", "getetag"}, [MODIFIED] = {"DAV:", "getlastmodified"}, [EXECUTE] = {"http://apache.org/dav/props/", "executable"}, {NULL, NULL} }; static const ne_propname full_anonymous_prop_names[] = { [TYPE] = {NULL, "resourcetype"}, [LENGTH] = {NULL, "getcontentlength"}, [ETAG] = {NULL, "getetag"}, [MODIFIED] = {NULL, "getlastmodified"}, [EXECUTE] = {NULL, "executable"}, {NULL, NULL} }; static const ne_propname min_prop_names[] = { [TYPE] = {"DAV:", "resourcetype"}, [LENGTH] = {"DAV:", "getcontentlength"}, {NULL, NULL} }; static const ne_propname min_anonymous_prop_names[] = { [TYPE] = {NULL, "resourcetype"}, [LENGTH] = {NULL, "getcontentlength"}, {NULL, NULL} }; /* Properties to be retrieved from the server. This constants are used by dav_quota(). */ enum { AVAILABLE = 0, USED }; static const ne_propname quota_names[] = { [AVAILABLE] = {"DAV:", "quota-available-bytes"}, [USED] = {"DAV:", "quota-used-bytes"}, {NULL, NULL} }; static size_t log_bufsize = 512; static char *none_match_header = "If-None-Match: *\r\n"; /* Private global variables */ /*==========================*/ /* The neon session. Will be set by dav_init_webdav(). */ static ne_session *session; /* Timeout for requests. Set by dav_init_webdav(). */ static int read_timeout; /* Timeout for creating a connection. Set by dav_init_webdav(). */ static int connect_timeout; /* Lock store, lock owner and lock timeout for session. Will be set by dav_init_webdav(). */ static ne_lock_store *locks; static char *owner; static time_t lock_timeout; /* Credentials for this session. Will be set by dav_init_webdav(). */ static char *username; static char *password; static char *p_username; static char *p_password; /* If this is not NULL the server must present exactly this certificate. */ static ne_ssl_certificate *server_cert; /* Whether to send expect 100-continue header in PUT requests. */ static int use_expect100; /* Whether to use HEAD for prechecking instead of If-Match and If-None-Match on PTU and LOCK. */ static int has_if_match_bug; /* Some servers sends a weak invalid etag that turns into a valid strong etag after one second. With this flag set weak etags are not used at all, otherwise the weakness indicator is removed. */ static int drop_weak_etags; /* Check with HEAD for existence or modification of a file, before locking or uploading a new file. */ static int precheck; /* Ignore the information in the DAV-header because it is wrong. */ static int ignore_dav_header; /* Use "Content-Encoding: gzip" for GET requests. */ static int use_compression; /* Only request a minimal set of properties. */ static int min_propset; static const ne_propname *prop_names; static const ne_propname *anonymous_prop_names; /* Will be set to 1 when dav_init_connection() succeeded. */ static int initialized; /* Whether a terminal is available to communicate with the user. Should be reset with set_no_terminal() when forking into daemon mode. Needed by ssl_verify() which may be called at any time. */ static int have_terminal; #ifdef HAVE_ICONV_H /* Handle to convert character encoding from utf-8 to LC_CTYPE. If NULL no conversion is done. */ static iconv_t from_utf_8; /* Handle to convert character encoding from LC_CTYPE to utf-8. If NULL no conversion is done. */ static iconv_t to_utf_8; /* Handle to convert character encing of path names to LC_CTYPE. If NULL no conversion is done. */ static iconv_t from_server_enc; /* Handle to convert from LC_CTYPE to character encoding of path names. If NULL no conversion is done. */ static iconv_t to_server_enc; #endif /* A GNU custom stream, used to redirect neon debug messages to syslog. */ static FILE *log_stream; /* A user defined header that is added to all requests. */ char *custom_header; /* Array of max. n_cookies cookie strings. NULL if configuration option allow_cookies is 0. The array must be allocated by dav_init_webdav. */ static int n_cookies; static char **cookie_list; /* Private function prototypes and inline functions */ /*==================================================*/ #ifdef HAVE_ICONV_H static void convert(char **s, iconv_t conv); #endif static ne_session * create_rd_session(const ne_uri *uri); static int get_error(int ret, const char *method, ne_session *sess); static int get_ne_error(const char *method, ne_session *sess); int get_redirect(const ne_uri *uri, const char *cache_path, off_t *size, char **etag, time_t *mtime, int *modified); static struct ne_lock * lock_by_path(const char *path); static int lock_discover(const char *path, time_t *expire); static void lock_refresh(struct ne_lock *lock, time_t *expire); static ssize_t log_writer(void *cookie, const char *buffer, size_t size); static char * normalize_etag(const char *etag); static void replace_slashes(char **name); /* Call-back functions for neon. */ static void add_header(ne_request *req, void *userdata, ne_buffer *header); static int auth(void *userdata, const char *realm, int attempt, char *user, char *pwd); static int file_reader(void *userdata, const char *block, size_t length); static void get_cookies(ne_request *req, void *userdata, const ne_status *status); static void lock_result(void *userdata, const struct ne_lock *lock, const ne_uri *uri, const ne_status *status); static void prop_result(void *userdata, const ne_uri *uri, const ne_prop_result_set *set); static void quota_result(void *userdata, const ne_uri *uri, const ne_prop_result_set *set); static int ssl_verify(void *userdata, int failures, const ne_ssl_certificate *cert); /* Public functions */ /*==================*/ void dav_init_webdav(const dav_args *args) { if (args->neon_debug & ~NE_DBG_HTTPPLAIN) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Initializing webdav"); #ifdef HAVE_ICONV_H char *lc_charset = nl_langinfo(CODESET); if (lc_charset && strcasecmp(lc_charset, "UTF-8") != 0) { from_utf_8 = iconv_open(lc_charset, "UTF-8"); if (from_utf_8 == (iconv_t) -1) from_utf_8 = 0; to_utf_8 = iconv_open("UTF-8", lc_charset); if (to_utf_8 == (iconv_t) -1) to_utf_8 = 0; } if (lc_charset && args->s_charset && strcasecmp(args->s_charset, lc_charset) != 0) { if (strcasecmp(args->s_charset, "UTF-8") == 0) { from_server_enc = from_utf_8; to_server_enc = to_utf_8; } else { from_server_enc = iconv_open(lc_charset, args->s_charset); if (from_server_enc == (iconv_t) -1) from_server_enc = 0; to_server_enc = iconv_open(args->s_charset, lc_charset); if (to_server_enc == (iconv_t) -1) to_server_enc = 0; } } #endif /* HAVE_ICONV */ if (ne_sock_init() != 0) error(EXIT_FAILURE, errno, _("socket library initialization failed")); if (args->neon_debug & ~NE_DBG_HTTPPLAIN) { char *buf = malloc(log_bufsize); cookie_io_functions_t *log_func = malloc(sizeof(cookie_io_functions_t)); if (!log_func) abort(); log_func->read = NULL; log_func->write = log_writer; log_func->seek = NULL; log_func->close = NULL; log_stream = fopencookie(buf, "w", *log_func); if (!log_stream) error(EXIT_FAILURE, errno, _("can't open stream to log neon-messages")); ne_debug_init(log_stream, args->neon_debug); } session = ne_session_create(args->scheme, args->host, args->port); read_timeout = args->read_timeout; ne_set_read_timeout(session, read_timeout); connect_timeout = args->connect_timeout; ne_set_connect_timeout(session, connect_timeout); char *useragent = ne_concat(PACKAGE_TARNAME, "/", PACKAGE_VERSION, NULL); ne_set_useragent(session, useragent); free(useragent); if (args->follow_redirect) ne_redirect_register(session); if (args->username) username = ne_strdup(args->username); if (args->password) password = ne_strdup(args->password); ne_add_server_auth(session, NE_AUTH_ALL, auth, "server"); if (args->useproxy && args->p_host) { ne_session_proxy(session, args->p_host, args->p_port); if (args->p_user) p_username = ne_strdup(args->p_user); if (args->p_passwd) p_password = ne_strdup(args->p_passwd); ne_add_proxy_auth(session, NE_AUTH_ALL, auth, "proxy"); } if (strcmp(args->scheme, "https") == 0) { if (!ne_has_support(NE_FEATURE_SSL)) error(EXIT_FAILURE, 0, _("neon library does not support TLS/SSL")); ne_ssl_set_verify(session, ssl_verify, NULL); if (args->trust_server_cert) { server_cert = ne_ssl_cert_read(args->trust_server_cert); if (!server_cert) error(EXIT_FAILURE, 0, _("can't read server certificate %s"), args->trust_server_cert); } else if (args->trust_ca_cert) { ne_ssl_certificate *ca_cert = ne_ssl_cert_read(args->trust_ca_cert); if (!ca_cert) error(EXIT_FAILURE, 0, _("can't read server certificate %s"), args->trust_ca_cert); ne_ssl_trust_cert(session, ca_cert); } else { ne_ssl_trust_default_ca(session); } if (args->clicert) { ne_ssl_client_cert *client_cert = ne_ssl_clicert_read(args->clicert); if (!client_cert) { uid_t orig = geteuid(); seteuid(0); client_cert = ne_ssl_clicert_read(args->clicert); seteuid(orig); } if (!client_cert) error(EXIT_FAILURE, 0, _("can't read client certificate %s"), args->clicert); if (client_cert && ne_ssl_clicert_encrypted(client_cert)) { char *pw = NULL; if (!args->clicert_pw && args->askauth) { printf(_("Please enter the password to decrypt client\n" "certificate %s.\n"), args->clicert); pw = dav_user_input_hidden(_("Password: ")); } else { pw = ne_strdup(args->clicert_pw); } int ret = 1; if (pw) { ret = ne_ssl_clicert_decrypt(client_cert, pw); memset(pw, '\0', strlen(pw)); free(pw); } if (ret) error(EXIT_FAILURE, 0, _("can't decrypt client certificate %s"), args->clicert); } ne_ssl_set_clicert(session, client_cert); ne_ssl_clicert_free(client_cert); } } have_terminal = args->askauth; if (args->locks) { locks = ne_lockstore_create(); if (!args->lock_owner) { if (!args->username) { owner = ne_strdup(PACKAGE_STRING); } else { owner = ne_strdup(args->username); } } else { owner = ne_strdup(args->lock_owner); } lock_timeout = args->lock_timeout; } if (args->header) { custom_header = ne_strdup(args->header); } if (args->n_cookies) { n_cookies = args->n_cookies; cookie_list = (char **) ne_calloc(n_cookies * sizeof(char *)); ne_hook_post_headers(session, get_cookies, NULL); } if (custom_header || cookie_list) ne_hook_pre_send(session, add_header, NULL); use_expect100 = args->expect100; has_if_match_bug = args->if_match_bug; drop_weak_etags = args->drop_weak_etags; precheck = args->precheck; ignore_dav_header = args->ignore_dav_header; use_compression = args->use_compression & ne_has_support(NE_FEATURE_ZLIB); min_propset = args->min_propset; if (min_propset) { prop_names = min_prop_names; anonymous_prop_names = min_anonymous_prop_names; } else { prop_names = full_prop_names; anonymous_prop_names = full_anonymous_prop_names; } } int dav_init_connection(const char *path) { char *spath = ne_path_escape(path); ne_server_capabilities caps = {0, 0, 0}; int ret = ne_options(session, spath, &caps); if (!ret) { initialized = 1; if (!caps.dav_class1 && !ignore_dav_header) { if (have_terminal) { error(EXIT_FAILURE, 0, _("mounting failed; the server does not support WebDAV")); } else { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("mounting failed; the server does not support WebDAV")); ret = EINVAL; } } if ((caps.dav_class2 || ignore_dav_header) && locks) { ne_lockstore_register(locks, session); } else if (locks) { if (have_terminal) error(0, 0, _("warning: the server does not support locks")); ne_lockstore_destroy(locks); locks = NULL; } } else { ret = get_error(ret, "OPTIONS", session); } free(spath); return ret; } void dav_close_webdav(void) { if(session && log_stream) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "Closing connection to %s", ne_get_server_hostport(session)); if (locks) { struct ne_lock *lock = ne_lockstore_first(locks); while (lock) { if (session) { int ret = ne_unlock(session, lock); get_error(ret, "UNLOCK", session); } lock = ne_lockstore_next(locks); } } if (session) ne_session_destroy(session); ne_sock_exit(); } char * dav_conv_from_utf_8(const char *s) { char *new = ne_strdup(s); #ifdef HAVE_ICONV if (from_utf_8) convert(&new, from_utf_8); #endif return new; } char * dav_conv_to_utf_8(const char *s) { char *new = ne_strdup(s); #ifdef HAVE_ICONV if (to_utf_8) convert(&new, to_utf_8); #endif return new; } char * dav_conv_from_server_enc(const char *s) { char *new = ne_strdup(s); #ifdef HAVE_ICONV if (from_server_enc) convert(&new, from_server_enc); #endif return new; } char * dav_conv_to_server_enc(const char *s) { char *new = ne_strdup(s); #ifdef HAVE_ICONV if (to_server_enc) convert(&new, to_server_enc); #endif return new; } int dav_delete(const char *path, time_t *expire) { int ret; if (!initialized) { ret = dav_init_connection(path); if (ret) return ret; } struct ne_lock *lock = NULL; char *spath = ne_path_escape(path); ret = ne_delete(session, spath); ret = get_error(ret, "DELETE", session); if ((ret == EACCES || ret == ENOENT) && locks) { lock_discover(spath, expire); lock = lock_by_path(spath); if (lock && ret == EACCES) { ret = ne_delete(session, spath); ret = get_error(ret, "DELETE", session); } else if (lock) { ne_unlock(session, lock); ret = 0; } } if (!ret && locks) { lock = lock_by_path(spath); if (lock) { ne_lockstore_remove(locks, lock); ne_lock_destroy(lock); } } free(spath); return ret; } int dav_delete_dir(const char *path) { int ret; if (!initialized) { ret = dav_init_connection(path); if (ret) return ret; } char *spath = ne_path_escape(path); ret = ne_delete(session, spath); ret = get_error(ret, "DELETE", session); free(spath); return ret; } void dav_delete_props(dav_props *props) { if (props->path) free(props->path); if (props->name) free(props->name); if (props->etag) free(props->etag); free(props); } int dav_get_collection(const char *path, dav_props **props) { int ret; if (!initialized) { ret = dav_init_connection(path); if (ret) return ret; } propfind_context ctx; ctx.path = path; ctx.results = NULL; char *spath = ne_path_escape(path); ne_propfind_handler *ph = ne_propfind_create(session, spath, NE_DEPTH_ONE); ret = ne_propfind_named(ph, prop_names, prop_result, &ctx); ret = get_error(ret, "PROPFIND", session); ne_propfind_destroy(ph); free(spath); if (ret) { while(ctx.results) { dav_props *tofree = ctx.results; ctx.results = ctx.results->next; dav_delete_props(tofree); } } *props = ctx.results; return ret; } const char * dav_get_webdav_error() { return ne_get_error(session); } int dav_get_file(const char *path, const char *cache_path, off_t *size, char **etag, time_t *mtime, int *modified) { int ret; if (!initialized) { ret = dav_init_connection(path); if (ret) return ret; } get_context ctx; ctx.error = 0; ctx.file = cache_path; ctx.fd = 0; char *spath = ne_path_escape(path); ne_request *req = ne_request_create(session, "GET", spath); if (etag && *etag) ne_add_request_header(req, "If-None-Match", *etag); char *mod_time = NULL; if (mtime && *mtime) { mod_time = ne_rfc1123_date(*mtime); ne_add_request_header(req, "If-Modified-Since", mod_time); } ne_decompress *dc_state = NULL; if (use_compression) { dc_state = ne_decompress_reader(req, ne_accept_2xx, file_reader, &ctx); } else { ne_add_response_body_reader(req, ne_accept_2xx, file_reader, &ctx); } ret = ne_request_dispatch(req); if (use_compression) ne_decompress_destroy(dc_state); ne_session *rd_sess = NULL; const ne_uri *rd_uri = NULL; if (ret == NE_REDIRECT) rd_uri = ne_redirect_location(session); if (rd_uri) { rd_sess = create_rd_session(rd_uri); ne_request_destroy(req); req = ne_request_create(rd_sess, "GET", rd_uri->path); if (etag && *etag) ne_add_request_header(req, "If-None-Match", *etag); if (use_compression) { dc_state = ne_decompress_reader(req, ne_accept_2xx, file_reader, &ctx); } else { ne_add_response_body_reader(req, ne_accept_2xx, file_reader, &ctx); } ret = ne_request_dispatch(req); if (use_compression) ne_decompress_destroy(dc_state); ret = get_error(ret, "GET", rd_sess); } else { ret = get_error(ret, "GET", session); } if (ctx.error) ret = ctx.error; const ne_status *status = ne_get_status(req); if (!ret && status->code == 200) { if (modified) *modified = 1; const char *value = ne_get_response_header(req, "Content-Length"); if (value) #if _FILE_OFFSET_BITS == 64 *size = strtoll(value, NULL, 10); #else /* _FILE_OFFSET_BITS != 64 */ *size = strtol(value, NULL, 10); #endif /* _FILE_OFFSET_BITS != 64 */ value = ne_get_response_header(req, "Last-Modified"); if (mtime && value) *mtime = ne_httpdate_parse(value); if (etag) { if (*etag) free(*etag); *etag = normalize_etag(ne_get_response_header(req, "ETag")); } } ne_request_destroy(req); if (rd_sess) ne_session_destroy(rd_sess); if (ctx.fd > 0) close(ctx.fd); if (mod_time) free(mod_time); free(spath); return ret; } int dav_head(const char *path, char **etag, time_t *mtime, off_t *length) { int ret; if (!initialized) { ret = dav_init_connection(path); if (ret) return ret; } char *spath = ne_path_escape(path); ne_request *req = ne_request_create(session, "HEAD", spath); ret = ne_request_dispatch(req); ret = get_error(ret, "HEAD", session); const char *value = ne_get_response_header(req, "ETag"); if (!ret && etag && value) { if (*etag) free(*etag); *etag = normalize_etag(value); } value = ne_get_response_header(req, "Last-Modified"); if (!ret && mtime && value) { time_t lm = ne_httpdate_parse(value); if (lm) *mtime = lm; } value = ne_get_response_header(req, "Content-Length"); if (!ret && length && value) *length = strtol(value, NULL, 10); ne_request_destroy(req); free(spath); return ret; } int dav_lock(const char *path, time_t *expire, int *exists) { int ret; if (!initialized) { ret = dav_init_connection(path); if (ret) return ret; } if (!locks) { *expire = 0; return 0; } if (precheck && has_if_match_bug && !*exists) { if (dav_head(path, NULL, NULL, NULL) == 0) { return EEXIST; } } char *spath = ne_path_escape(path); struct ne_lock *lock = lock_by_path(spath); if (lock) { free(spath); *expire = -1; lock_refresh(lock, expire); return 0; } lock = ne_lock_create(); ne_fill_server_uri(session, &lock->uri); lock->uri.path = spath; lock->owner = ne_strdup(owner); lock->timeout = lock_timeout; if (!has_if_match_bug && !*exists) ne_hook_pre_send(session, add_header, none_match_header); ret = ne_lock(session, lock); ret = get_error(ret, "LOCK", session); if (!has_if_match_bug && !*exists) { ne_unhook_pre_send(session, add_header, none_match_header); if (ret && strtol(ne_get_error(session), NULL, 10) == 412) ret = EEXIST; } if (!ret) { ne_lockstore_add(locks, lock); if (strtol(ne_get_error(session), NULL, 10) == 201) *exists = 1; if (lock->timeout <= 0) { *expire = LONG_MAX; } else { *expire = lock->timeout + time(NULL); } } else { if (ret == EACCES && lock_discover(spath, expire) == 0) ret = 0; ne_lock_destroy(lock); } return ret; } void dav_lock_refresh(const char *path, time_t *expire) { if (!initialized && dav_init_connection(path) != 0) return; if (!locks) { *expire = 0; return; } char *spath = ne_path_escape(path); struct ne_lock *lock = lock_by_path(spath); if (!lock) { lock_discover(spath, expire); } else { lock_refresh(lock, expire); } free(spath); } int dav_make_collection(const char *path) { int ret; if (!initialized) { ret = dav_init_connection(path); if (ret) return ret; } char *spath = ne_path_escape(path); ret = ne_mkcol(session, spath); ret = get_error(ret, "MKCOL", session); free(spath); return ret; } int dav_move(const char *src, const char *dst) { int ret; if (!initialized) { ret = dav_init_connection(src); if (ret) return ret; } char *spath = ne_path_escape(src); char *dst_path = ne_path_escape(dst); ret = ne_move(session, 1, spath, dst_path); ret = get_error(ret, "MOVE", session); if (!ret && locks) { struct ne_lock *lock = lock_by_path(spath); if (lock) { ne_lockstore_remove(locks, lock); ne_lock_destroy(lock); } } free(spath); free(dst_path); return ret; } int dav_put(const char *path, const char *cache_path, int *exists, time_t *expire, char **etag, time_t *mtime, int execute) { int ret = 0; if (!initialized) { ret = dav_init_connection(path); if (ret) return ret; } if (precheck && (has_if_match_bug || (*exists && (!etag || !*etag))) && (!*exists || (etag && *etag) || (mtime && *mtime))) { char *r_etag = NULL; time_t r_mtime = 0; off_t r_length = 0; ret = dav_head(path, &r_etag, &r_mtime, &r_length); if (!ret) { if (!*exists && r_length) { ret = EEXIST; } else if (etag && *etag && r_etag) { if (strcmp(*etag, r_etag) != 0) ret = EINVAL; } else if (mtime && *mtime && r_mtime) { if (*mtime < r_mtime) ret = EINVAL; } } else if (ret == ENOENT) { if (!*exists) { ret = 0; } else { ret = dav_unlock(path, expire); } } if (r_etag) free(r_etag); if (ret) return ret; } int fd = open(cache_path, O_RDONLY); if (fd <= 0) return EIO; struct stat st; if (fstat(fd, &st) != 0) return EIO; char *spath = ne_path_escape(path); ne_request *req = ne_request_create(session, "PUT", spath); if (!has_if_match_bug) { if (!*exists) { ne_add_request_header(req, "If-None-Match", "*"); } else { if (etag && *etag) ne_add_request_header(req, "If-Match", *etag); } } if (use_expect100) ne_set_request_flag(req, NE_REQFLAG_EXPECT100, 1); ne_lock_using_resource(req, spath, 0); ne_set_request_body_fd(req, fd, 0, st.st_size); ret = ne_request_dispatch(req); ret = get_error(ret, "PUT", session); if (ret == EACCES && lock_discover(spath, expire) == 0) { ne_request_destroy(req); req = ne_request_create(session, "PUT", spath); if (!has_if_match_bug) { if (!*exists) { ne_add_request_header(req, "If-None-Match", "*"); } else { if (etag && *etag) ne_add_request_header(req, "If-Match", *etag); } } if (use_expect100) ne_set_request_flag(req, NE_REQFLAG_EXPECT100, 1); ne_lock_using_resource(req, spath, 0); ne_set_request_body_fd(req, fd, 0, st.st_size); ret = ne_request_dispatch(req); ret = get_error(ret, "PUT", session); } int need_head = 0; if (!ret) { *exists = 1; const char *value; if (etag) { if (*etag) free(*etag); *etag = normalize_etag(ne_get_response_header(req, "ETag")); if (!*etag) need_head = 1; } if (mtime) { value = ne_get_response_header(req, "Last-Modified"); if (!value) value = ne_get_response_header(req, "Date"); if (value) { *mtime = ne_httpdate_parse(value); } else { need_head = 1; } } } ne_request_destroy(req); free(spath); close(fd); if (!ret) { if (execute == 1) dav_set_execute(path, execute); if (need_head) dav_head(path, etag, mtime, NULL); } return ret; } int dav_quota(const char *path, uint64_t *available, uint64_t *used) { int ret; if (!initialized) { ret = dav_init_connection(path); if (ret) return ret; } static int use_rfc = 1; quota_context ctx; ctx.error = 0; ctx.available = 0; ctx.used = 0; ret = EIO; char *spath = ne_path_escape(path); if (use_rfc) { ne_propfind_handler *ph = ne_propfind_create(session, spath, NE_DEPTH_ZERO); ret = ne_propfind_named(ph, quota_names, quota_result, &ctx); ret = get_error(ret, "PROPFIND", session); ne_propfind_destroy(ph); if (!ret && ctx.error) { ret = EIO; if (ctx.error == 2) use_rfc = 0; } } if (!ret) { *available = ctx.available; *used = ctx.used; } free(spath); return ret; } int dav_set_execute(const char *path, int set) { int ret; if (!initialized) { ret = dav_init_connection(path); if (ret) return ret; } ne_proppatch_operation op[2]; op[0].name = &prop_names[EXECUTE]; op[0].type = ne_propset; if (set) { op[0].value = "T"; } else { op[0].value = "F"; } op[1].name = NULL; char *spath = ne_path_escape(path); ret = ne_proppatch(session, spath, &op[0]); ret = get_error(ret, "PROPPATCH", session); free(spath); return ret; } void dav_set_no_terminal(void) { have_terminal = 0; } int dav_unlock(const char *path, time_t *expire) { int ret; if (!initialized) { ret = dav_init_connection(path); if (ret) return ret; } if (!locks) { *expire = 0; return 0; } char *spath = ne_path_escape(path); struct ne_lock *lock = lock_by_path(spath); free(spath); if (!lock) { *expire = 0; return 0; } ret = ne_unlock(session, lock); ret = get_error(ret, "UNLOCK", session); if (!ret || ret == ENOENT || ret == EINVAL) { ne_lockstore_remove(locks, lock); ne_lock_destroy(lock); *expire = 0; return 0; } return ret; } /* Private functions */ /*===================*/ #ifdef HAVE_ICONV static void convert(char **s, iconv_t conv) { size_t insize = strlen(*s); char *in = *s; size_t outsize = MB_LEN_MAX * (insize + 1); char *buf = calloc(outsize, 1); if (!buf) abort(); char *out = buf; iconv(conv, NULL, NULL, &out, &outsize); if (iconv(conv, &in, &insize, &out, &outsize) >= 0 && insize == 0 && outsize >= MB_LEN_MAX) { memset(out, 0, MB_LEN_MAX); free(*s); *s = ne_strndup(buf, out - buf + MB_LEN_MAX); } free(buf); } #endif /* HAVE_ICONV */ /* Creates a new session. Scheme, host and port are taken from uri. read_timout, connect_timeout, useragent and proxy are the same as for the main sessions. The values are taken from the main session or from global variables. The same call back functions for auth and custom headers as for the main session are registered, using the same credentials as the main session. If the scheme is https the ssl_verify function is registered. It is set up to trust in the default CAs. A server certificate or client certificate configured by the user are not used because it may be a different server. TODO: usage of certificates and credentials should depend on uri->host. Return value : the newly created session. It must be destroyed by the caller. */ static ne_session * create_rd_session(const ne_uri *uri) { if (!uri->scheme || !uri->host || !uri->path) return NULL; if (strcmp(uri->scheme, "https") == 0 && !ne_has_support(NE_FEATURE_SSL)) return NULL; int port = uri->port; if (port == 0) port = ne_uri_defaultport(uri->scheme); ne_session *rd_sess = ne_session_create(uri->scheme, uri->host, port); ne_set_read_timeout(rd_sess, read_timeout); ne_set_connect_timeout(rd_sess, connect_timeout); char *useragent = ne_concat(PACKAGE_TARNAME, "/", PACKAGE_VERSION, NULL); ne_set_useragent(session, useragent); free(useragent); ne_add_server_auth(rd_sess, NE_AUTH_ALL, auth, "server"); ne_uri *proxy = (ne_uri *) ne_calloc(sizeof(ne_uri)); ne_fill_proxy_uri(rd_sess, proxy); if (proxy->host) { ne_session_proxy(rd_sess, proxy->host, proxy->port); ne_add_proxy_auth(rd_sess, NE_AUTH_ALL, auth, "proxy"); } if (strcmp(uri->scheme, "https") == 0) { ne_ssl_set_verify(rd_sess, ssl_verify, NULL); ne_ssl_trust_default_ca(rd_sess); } if (custom_header) ne_hook_pre_send(rd_sess, add_header, custom_header); return rd_sess; } /* Returns a file error code according to ret from the last WebDAV method call. If ret has value NE_ERROR the error code from the session is fetched and translated. ret : the error code returned from NEON. method : name of the WebDAV method, used for debug messages. sess : the session to get the HTTP status code from. return value : a file error code according to errno.h. */ static int get_error(int ret, const char *method, ne_session *sess) { int err; switch (ret) { case NE_OK: case NE_ERROR: err = get_ne_error(method, sess); break; case NE_LOOKUP: err = EIO; break; case NE_AUTH: err = EPERM; break; case NE_PROXYAUTH: err = EPERM; break; case NE_CONNECT: err = EAGAIN; break; case NE_TIMEOUT: err = EAGAIN; break; case NE_FAILED: err = EINVAL; break; case NE_RETRY: err = EAGAIN; break; case NE_REDIRECT: err = ENOENT; break; default: err = EIO; break; } return err; } /* Get the error from the session and translates it into a file error code. method : name of the WebDAV method, used for debug messages. sess : the session to get the HTTP status code from. return value : a file error code according to errno.h. */ static int get_ne_error(const char *method, ne_session *sess) { const char *text = ne_get_error(sess); char *tail; int err = strtol(text, &tail, 10); if (tail == text) return EIO; switch (err) { case 200: /* OK */ case 201: /* Created */ case 202: /* Accepted */ case 203: /* Non-Authoritative Information */ case 204: /* No Content */ case 205: /* Reset Content */ case 207: /* Multi-Status */ case 304: /* Not Modified */ return 0; case 401: /* Unauthorized */ case 402: /* Payment Required */ case 407: /* Proxy Authentication Required */ return EPERM; case 301: /* Moved Permanently */ case 303: /* See Other */ case 404: /* Not Found */ case 405: /* Method Not Allowed */ case 410: /* Gone */ return ENOENT; case 408: /* Request Timeout */ case 504: /* Gateway Timeout */ return EAGAIN; case 423: /* Locked */ return EACCES; case 400: /* Bad Request */ case 403: /* Forbidden */ case 409: /* Conflict */ case 411: /* Length Required */ case 412: /* Precondition Failed */ case 414: /* Request-URI Too Long */ case 415: /* Unsupported Media Type */ case 424: /* Failed Dependency */ case 501: /* Not Implemented */ return EINVAL; case 413: /* Request Entity Too Large */ case 507: /* Insufficient Storage */ return ENOSPC; case 206: /* Partial Content */ case 300: /* Multiple Choices */ case 302: /* Found */ case 305: /* Use Proxy */ case 306: /* (Unused) */ case 307: /* Temporary Redirect */ case 406: /* Not Acceptable */ case 416: /* Requested Range Not Satisfiable */ case 417: /* Expectation Failed */ case 422: /* Unprocessable Entity */ case 500: /* Internal Server Error */ case 502: /* Bad Gateway */ case 503: /* Service Unavailable */ case 505: /* HTTP Version Not Supported */ return EIO; default: return EIO; } } /* Searches for a lock for resource at path and returns this lock if successfull, NULL otherwise. */ static struct ne_lock * lock_by_path(const char *path) { struct ne_lock *lock = ne_lockstore_first(locks); while (lock) { if (strcmp(path, lock->uri.path) == 0) return lock; lock = ne_lockstore_next(locks); } return NULL; } /* Checks if there is already a lock for file path that is owned by owner. If successful it stores the lock in the global lock store, refreshes the lock and updates expire. If no matching lock is found or the session is initialized with the nolocks option, it sets expire to 0 and returns -1. If a matching lock is found, but it can not be refreshed, expire is set to -1 (= locked, expire time unknown). If an error occurs it leaves expire unchanged and returns -1: path : URL-escaped path of the file on the server. expire : The time when the lock expires, will be updated. return value : 0 if a matching lock is found, -1 otherwise. */ static int lock_discover(const char *path, time_t *expire) { if (!locks) { *expire = 0; return -1; } struct ne_lock *lock = NULL; int ret = ne_lock_discover(session, path, lock_result, &lock); ret = get_error(ret, "LOCKDISCOVER", session); if (!ret && lock) { *expire = -1; lock_refresh(lock, expire); return 0; } else { if (!ret) *expire = 0; return -1; } } /* Refreshes lock and updates expire. If an error occurs it does nothing. lock : The lock, will be updated on success. expire : The time when the lock expires, updated on success. */ static void lock_refresh(struct ne_lock *lock, time_t *expire) { int ret = ne_lock_refresh(session, lock); ret = get_error(ret, "LOCKREFRESH", session); if (!ret) { if (lock->timeout <= 0) { *expire = LONG_MAX; } else { *expire = lock->timeout + time(NULL); } } } static ssize_t log_writer(void *cookie, const char *buffer, size_t size) { if (size <= 0) return 0; size_t written = 0; const char *bpos = buffer; while (written < size) { size_t n = 2; char *cpos = (char *) cookie; while (n < log_bufsize && written < size) { if (*bpos == '%') { *cpos++ = '%'; n++; } *cpos++ = *bpos++; n++; written++; } *cpos = '\0'; syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_DEBUG), "%s", (char *) cookie); } return written; } /* Checks etag for weakness indicator and quotation marks. The reurn value is either a strong etag with quotation marks or NULL. Depending on global variable drop_weak_etags weak etags are either dropped or convertet into strong ones. */ static char * normalize_etag(const char *etag) { if (!etag) return NULL; const char * e = etag; if (*e == 'W') { if (drop_weak_etags) { return NULL; } else { e++; if (*e == '/') { e++; } else { return NULL; } } } if (!*e) return NULL; char *ne = NULL; if (*e == '\"') { ne = strdup(e); } else { if (asprintf(&ne, "\"%s\"", e) < 0) ne = NULL;; } return ne; } /* Replaces slashes in name by "slash-", "-slash-" or "-slash", depending on the position of the slash within name. */ static void replace_slashes(char **name) { char *slash = strchr(*name, '/'); while (slash) { char *end = *name + strlen(*name) - 1; char *nn; *slash = '\0'; if (slash == *name) { nn = ne_concat("slash-", slash + 1, NULL); } else if (slash == end) { nn = ne_concat(*name, "-slash", NULL); } else { nn = ne_concat(*name, "-slash-", slash + 1, NULL); } free(*name); *name = nn; slash = strchr(*name, '/'); } } /* Call-back functions for neon. */ static void add_header(ne_request *req, void *userdata, ne_buffer *header) { if (custom_header) ne_buffer_zappend(header, custom_header); if (cookie_list && cookie_list[0]) { ne_buffer_zappend(header, "Cookie: "); ne_buffer_zappend(header, cookie_list[0]); int i = 1; while (i < n_cookies && cookie_list[i]) { ne_buffer_zappend(header, ", "); ne_buffer_zappend(header, cookie_list[i]); i++; } ne_buffer_zappend(header, "\r\n"); } } /* Copies credentials from global variables into user and pwd. userdata must be a string with value "server" or "proxy", to decide what the creditentials are needed for. The creditentials are taken form global variables username/password or p_username/p_password. If attempt > 0, this is logged as an error and the value of attempt is returned, so neon will not try again. userdata : What the credentials are needed for ("server" or "proxy"). realm : Used for error log. attempt : Number of attempts to get credentials. If not 0 an error occured. user : A buffer of size NE_ABUFSIZ to return the username. pwd : A buffer of size NE_ABUFSIZ to return the password. return value : value if attempt. neon will not call this function again if it is greater than 0. */ static int auth(void *userdata, const char *realm, int attempt, char *user, char *pwd) { if (attempt) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("authentication failure:")); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), " %s", realm); return attempt; } if (strcmp((char *) userdata, "server") == 0) { if (username) strncpy(user, username, NE_ABUFSIZ - 1); if (password) strncpy(pwd, password, NE_ABUFSIZ - 1); } else if (strcmp((char *) userdata, "proxy") == 0) { if (p_username) strncpy(user, p_username, NE_ABUFSIZ - 1); if (p_password) strncpy(pwd, p_password, NE_ABUFSIZ - 1); } return 0; } /* Reads HTTP-data from blockand writes them to a local file. userdata must be a get_context structure that holds at least the name of the local file. If it does not contain a file descriptor, the file is opened for writing and the file descriptor is stored in the get_context structure. In case of an error a error flag is set. userdata : A get_context structure, containing the name of the local file, the file descriptor (if the file is open), and an error flag. block : Buffer containing the data. length : Number of bytes in the buffer. return value : 0 on success, EIO otherwise. */ static int file_reader(void *userdata, const char *block, size_t length) { get_context *ctx = (get_context *) userdata; if (!ctx->fd) ctx->fd = open(ctx->file, O_WRONLY | O_TRUNC, S_IRUSR | S_IWUSR); if (ctx->fd <= 0) { ne_set_error(session, _("%i can't open cache file"), 0); ctx->error = EIO; } while (!ctx->error && length > 0) { ssize_t ret = write(ctx->fd, block, length); if (ret < 0) { ctx->error = EIO; ne_set_error(session, _("%i error writing to cache file"), 0); } else { length -= ret; block += ret; } } return ctx->error; } /* A ne_post_header_fn to read cookies from the Set-Cookie header and store them in the global arrray of strings cookie_list. The cookies will be send in the Cookie header of subsequent requests. Only the "name=value" part of the cookie is stored. All attributes are completely ignored. When a cookie with the same name as an already stored cookie, but with a different value is received, it's value is updated if necessary. Only n_cookies cookies will be stored. If the server sends more different cookies these will be ignored. status must be of class 2XX or 3XX, otherwise the cookie is ignored. */ static void get_cookies(ne_request *req, void *userdata, const ne_status *status) { if (status->klass != 2 && status->klass != 3) return; const char *cookie_hdr = ne_get_response_header(req, "Set-Cookie"); if (!cookie_hdr) return; const char *next = cookie_hdr; while (next) { const char *start = next; next = strchr(start, ','); const char *end = strchr(start, ';'); if (next) { if (!end || end > next) end = next; next++; } else if (!end) { end = start + strlen(start); } while (start < end && *start == ' ') start++; while (end > start && *(end - 1) == ' ') end--; if ((start + 4) > end || *start == '=' || *(end - 1) == '=') continue; char *es = strchr(start, '='); if (!es) continue; size_t nl = es - start; size_t vl = end - es - 1; int i = 0; for (i = 0; i < n_cookies; i++) { if (!cookie_list[i]) { cookie_list[i] = ne_strndup(start, end - start); break; } if (strncmp(cookie_list[i], start, nl) == 0) { if (strncmp(cookie_list[i] + nl + 1, es + 1, vl) != 0) { free(cookie_list[i]); cookie_list[i] = ne_strndup(start, end - start); } break; } } } } /* If the owner of this lock is the same as global variable owner, lock is stored in the global lock store locks and a pointer to the lock is returned in userdata. Otherwise it does nothing. userdata : *userdata will be set to lock, if lock is ownded ba owner. lock : a lock found by ne_lock_discover() on the server. uri : not used. status : not used. */ static void lock_result(void *userdata, const struct ne_lock *lock, const ne_uri *uri, const ne_status *status) { if (!locks || !owner || !userdata || !lock || !lock->owner) return; if (strcmp(lock->owner, owner) == 0) { struct ne_lock *l = ne_lock_copy(lock); ne_lockstore_add(locks, l); l->timeout = lock_timeout; *((struct ne_lock **) userdata) = l; } } /* Called by ne_propfind_named(). Evaluates a dav_props structure from href/uri and set and stores it in userdata. userdata must be a pointer to a propfind_context structure. Its member path holds the unescaped path of the collection. Its member results is a linked list of the dav_props structures. The unescaped version of href/uri->path must must be equal to the path of the collection or a descendent of it. It is stored as member path of the dav_props structure. It will be normalized (collections have a trailing slash, non-collections do not have one). The name is derived from path. The name of the collection itself will be the empty string. If name contains a '/'-character it is replaced by the ugly string "-slash-". There must not be two dav_props structure with the same path or the same name. in this case one of them is removed from the list, preferable the one that is not a directory or that is less specific. userdata : A pointer to a propfind_context structure containing the path of the collection and the linked list of properties. uri : ne_uri of the resource as returned from the server. set : Points to the set of properties returned from the server.*/ static void prop_result(void *userdata, const ne_uri *uri, const ne_prop_result_set *set) { propfind_context *ctx = (propfind_context *) userdata; if (!ctx || !uri || !uri->path || !set) return; char *tmp_path = (char *) ne_malloc(strlen(uri->path) + 1); const char *from = uri->path; char *to = tmp_path; while (*from) { while (*from == '/' && *(from + 1) == '/') from++; *to++ = *from++; } *to = 0; dav_props *result = ne_calloc(sizeof(dav_props)); result->path = ne_path_unescape(tmp_path); free (tmp_path); if (!result->path || strlen(result->path) < 1) { dav_delete_props(result); return; } const char *data; data = ne_propset_value(set, &prop_names[TYPE]); if (!data) data = ne_propset_value(set, &anonymous_prop_names[TYPE]); if (data && strstr(data, "collection")) result->is_dir = 1; if (*(result->path + strlen(result->path) - 1) == '/') { if (!result->is_dir) *(result->path + strlen(result->path) - 1) = '\0'; } else { if (result->is_dir) { char *tmp = ne_concat(result->path, "/", NULL); free(result->path); result->path = tmp; } } if (strcasestr(result->path, ctx->path) != result->path) { dav_delete_props(result); return; } if (strcasecmp(result->path, ctx->path) == 0) { result->name = ne_strdup(""); } else { if (strlen(result->path) < (strlen(ctx->path) + result->is_dir + 1)) { dav_delete_props(result); return; } result->name = ne_strndup(result->path + strlen(ctx->path), strlen(result->path) - strlen(ctx->path) - result->is_dir); replace_slashes(&result->name); #ifdef HAVE_ICONV if (from_server_enc) convert(&result->name, from_server_enc); #endif } data = ne_propset_value(set, &prop_names[LENGTH]); if (!data) data = ne_propset_value(set, &anonymous_prop_names[LENGTH]); if (data) #if _FILE_OFFSET_BITS == 64 result->size = strtoll(data, NULL, 10); #else /* _FILE_OFFSET_BITS != 64 */ result->size = strtol(data, NULL, 10); #endif /* _FILE_OFFSET_BITS != 64 */ if (!min_propset) { data = ne_propset_value(set, &prop_names[ETAG]); if (!data) data = ne_propset_value(set, &anonymous_prop_names[ETAG]); result->etag = normalize_etag(data); data = ne_propset_value(set, &prop_names[MODIFIED]); if (!data) data = ne_propset_value(set, &anonymous_prop_names[MODIFIED]); if (data) { result->mtime = ne_httpdate_parse(data); if (result->mtime == (time_t) -1) result->mtime = ne_iso8601_parse(data); if (result->mtime == (time_t) -1) result->mtime = 0; } data = ne_propset_value(set, &prop_names[EXECUTE]); if (!data) data = ne_propset_value(set, &anonymous_prop_names[EXECUTE]); if (!data) { result->is_exec = -1; } else if (*data == 'T') { result->is_exec = 1; } } result->next = ctx->results; ctx->results = result; } /* Reads available and used bytes from set and stores them in userdata. */ static void quota_result(void *userdata, const ne_uri *uri, const ne_prop_result_set *set) { quota_context *ctx = (quota_context *) userdata; if (!ctx || !uri || !uri->path || !set) return; const char *data = ne_propset_value(set, "a_names[AVAILABLE]); if (data) { ctx->available = strtoull(data, NULL, 10); } else { const ne_status *st = ne_propset_status(set, "a_names[AVAILABLE]); if (st && st->klass == 4) { ctx->error = 2; } else { ctx->error = 1; } return; } data = ne_propset_value(set, "a_names[USED]); if (data) ctx->used = strtoull(data, NULL, 10); } /* Displays information about cert and asks the user whether to accept the certificate or not. If no terminal is available (according to global variable Have_terminal) it returns an error. Else it displays an error message and certificate date and ask whether to accept the certificate. If the user accepts it returns 0, otherwise an error. In any case the event is logged. userdata : not used. failures : a constant indicating the kind of error. cert : the server certificate that could not be verified by neon. return value : 0 accept the certificate for this session. -1 don't accept the certificate. */ static int ssl_verify(void *userdata, int failures, const ne_ssl_certificate *cert) { if (server_cert) { if (ne_ssl_cert_cmp(cert, server_cert) == 0) return 0; if (have_terminal) error(0, 0, _("the server certificate is not trusted")); return -1; } char *issuer = ne_ssl_readable_dname(ne_ssl_cert_issuer(cert)); char *subject = ne_ssl_readable_dname(ne_ssl_cert_subject(cert)); char *digest = ne_calloc(NE_SSL_DIGESTLEN); if (!issuer || !subject || ne_ssl_cert_digest(cert, digest) != 0) { if (have_terminal) { error(0, 0, _("error processing server certificate")); } else { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("error processing server certificate")); } if (issuer) free(issuer); if (subject) free(subject); if (digest) free(digest); return -1; } int ret = -1; if (have_terminal) { if (failures & NE_SSL_NOTYETVALID) error(0, 0, _("the server certificate is not yet valid")); if (failures & NE_SSL_EXPIRED) error(0, 0, _("the server certificate has expired")); if (failures & NE_SSL_IDMISMATCH) error(0, 0, _("the server certificate does not match the server name")); if (failures & NE_SSL_UNTRUSTED) error(0, 0, _("the server certificate is not trusted")); if (failures & ~NE_SSL_FAILMASK) error(0, 0, _("unknown certificate error")); printf(_(" issuer: %s"), issuer); printf("\n"); printf(_(" subject: %s"), subject); printf("\n"); printf(_(" identity: %s"), ne_ssl_cert_identity(cert)); printf("\n"); printf(_(" fingerprint: %s"), digest); printf("\n"); printf(_("You only should accept this certificate, if you can\n" "verify the fingerprint! The server might be faked\n" "or there might be a man-in-the-middle-attack.\n")); printf(_("Accept certificate for this session? [y,N] ")); char *s = NULL; size_t n = 0; ssize_t len = 0; len = getline(&s, &n, stdin); if (len < 0) abort(); if (rpmatch(s) > 0) ret = 0; free(s); } if (failures & NE_SSL_NOTYETVALID) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("the server certificate is not yet valid")); if (failures & NE_SSL_EXPIRED) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("the server certificate has expired")); if (failures & NE_SSL_IDMISMATCH) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("the server certificate does not match the server name")); if (failures & NE_SSL_UNTRUSTED) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("the server certificate is not trusted")); if (failures & ~NE_SSL_FAILMASK) syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _("unknown certificate error")); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _(" issuer: %s"), issuer); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _(" subject: %s"), subject); syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _(" identity: %s"), ne_ssl_cert_identity(cert)); if (!ret) { syslog(LOG_MAKEPRI(LOG_DAEMON, LOG_ERR), _(" accepted by user")); } if (issuer) free(issuer); if (subject) free(subject); if (digest) free(digest); return ret; } davfs2-1.5.2/BUGS0000644000175000017500000000061412325236345010316 00000000000000davfs2 known bugs 2014-04-21 ---------------------------- davfs2 does not support links. A davfs2 file system cannot be moved with 'mount --move'. If a filename contains a "/"-character, it will be displayed, but it cannot be accessed. A proper GNU-style manual is still missing. Report Bugs ----------- Please report bugs at http://savannah.nongnu.org/support/?func=additem&group=davfs2 davfs2-1.5.2/README.translators0000644000175000017500000000652711171165015013070 000000000000002008-07-12 ---------- #Copyright (C) 2006, 2007, 2008 Werner Baumann #Copying and distribution of this file, with or without modification, are #permitted in any medium without royalty. davfs2 uses the GNU gettext utilities to support localized messages. Information about GNU gettext may be found at http://www.gnu.org/software/gettext/manual/ For the man pages (and probably other documentation in future), it makes use of the po4a tools in order to keep translations of documentation maintainable. po4a (http://po4a.alioth.debian.org/) applies the gettext tools to arbitrary documentation. Messages -------- All messages that need translation are in the file po/davfs2.pot. The translated messages will be in po/ll.po, where ll is the two-letter country code. If you start a translation into a language not yet supported, you may just take a copy of po/davfs2.pot for your ll.po file. Man Pages --------- The .pot files of the man pages are in the man/ subdirectory together with a configuration file for po4a to automatically build all the translated man pages from the .po files. There is a subdirectory for each language, named after the country code, that holds the .po files and the addendum files. As usual the initial .po file can be a copy of the .pot file. Replacement Text in Man Pages ----------------------------- davfs2 uses all uppercase strings enclosed in @-characters for strings that may change with every version or at compile time (like @PACKAGE_STRING@ or @SYS_CACHE_DIR@). They will be replaced at compile time by the correct value. Please use them in your translation unaltered. To allow correct integration into the translated text, here are the most probable values: @PACKAGE@ davfs2 @PACKAGE_STRING@ davfs2 1.2.0 @PROGRAM_NAME@ mount.davfs @CONFIGFILE@ davfs2.conf @SECRETSFILE@ secrets @CERTS_DIR@ certs @CLICERTS_DIR@ certs/private @SYS_CONF_DIR@ /usr/local/etc/davfs2 or /etc/davfs2 @SYS_RUN@ /var/run/mount.davfs @SYS_CACHE_DIR@ /var/cache/davfs2 @USER@ davfs2 @GROUP@ davfs2 Additional Text --------------- At least you want to add a paragraph about the translators into the localized man page. But maybe you feel the need for some more additions that are not present in the English man page. Unfortunately, these additions cannot be inserted directly into the .po file, as the document structure must not differ from the original. So these additions have to go into separate files, called addendum. You can use the template man/template.translator to add a paragraph about the translators. If you need more than this, you have to create additional addendum files. Please see the po4a documentation for the syntax of the PO4A-HEADER to mark the position where to add the text. Please use the same character encoding as in the .po file. Character Encoding ------------------ ** This issue seems to be fixed today and man pages are allowed to be utf-8. But I am not really sure. ** At the moment, the "man" tool, or at least one of its helper programs, do not seem capable of handling UTF-8 encoding. Luckily, gettext can convert the encoding when the translated man page is created. So you may use UTF-8 in the .po file or any other encoding. But please tell me which character encoding should be used when the man page is built. davfs2-1.5.2/config.h.in0000644000175000017500000002463412376155256011675 00000000000000/* config.h.in. Generated from configure.ac by autoheader. */ /* Define to 1 if the `closedir' function returns void instead of `int'. */ #undef CLOSEDIR_VOID /* Define to 1 if translation of program messages to the user's native language is requested. */ #undef ENABLE_NLS /* Define to the type of elements in the array set by `getgroups'. Usually this is either `int' or `gid_t'. */ #undef GETGROUPS_T /* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the CoreFoundation framework. */ #undef HAVE_CFLOCALECOPYCURRENT /* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in the CoreFoundation framework. */ #undef HAVE_CFPREFERENCESCOPYAPPVALUE /* Define to 1 if your system has a working `chown' function. */ #undef HAVE_CHOWN /* Define if the GNU dcgettext() function is already present or preinstalled. */ #undef HAVE_DCGETTEXT /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_DIRENT_H /* Define to 1 if you have the `endpwent' function. */ #undef HAVE_ENDPWENT /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK /* Define to 1 if you have the `ftruncate' function. */ #undef HAVE_FTRUNCATE /* Define to 1 if your system has a working `getgroups' function. */ #undef HAVE_GETGROUPS /* Define to 1 if you have the `getmntent' function. */ #undef HAVE_GETMNTENT /* Define if the GNU gettext() function is already present or preinstalled. */ #undef HAVE_GETTEXT /* Define if you have the iconv() function and it works. */ #undef HAVE_ICONV /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_LANGINFO_H /* Define to 1 if you have the header file. */ #undef HAVE_LIBINTL_H /* Define to 1 if you have the header file. */ #undef HAVE_LIMITS_H /* Define to 1 if you have the header file. */ #undef HAVE_LOCALE_H /* Define to 1 if your system has a GNU libc compatible `malloc' function, and to 0 otherwise. */ #undef HAVE_MALLOC /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Define to 1 if you have the `memset' function. */ #undef HAVE_MEMSET /* Define to 1 if you have the `mkdir' function. */ #undef HAVE_MKDIR /* Define to 1 if you have the header file. */ #undef HAVE_MNTENT_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_NDIR_H /* Define to 1 if you have the `nl_langinfo' function. */ #undef HAVE_NL_LANGINFO /* Define to 1 if you have the `rpmatch' function. */ #undef HAVE_RPMATCH /* Define to 1 if you have the `select' function. */ #undef HAVE_SELECT /* Define to 1 if you have the `setlocale' function. */ #undef HAVE_SETLOCALE /* Define to 1 if `stat' has the bug that it succeeds when given the zero-length file name argument. */ #undef HAVE_STAT_EMPTY_STRING_BUG /* Define to 1 if you have the header file. */ #undef HAVE_STDDEF_H /* Define to 1 if you have the header file. */ #undef HAVE_STDINT_H /* Define to 1 if you have the header file. */ #undef HAVE_STDLIB_H /* Define to 1 if you have the `strcasecmp' function. */ #undef HAVE_STRCASECMP /* Define to 1 if you have the `strchr' function. */ #undef HAVE_STRCHR /* Define to 1 if you have the `strdup' function. */ #undef HAVE_STRDUP /* Define to 1 if you have the `strerror' function. */ #undef HAVE_STRERROR /* Define to 1 if you have the `strftime' function. */ #undef HAVE_STRFTIME /* Define to 1 if you have the header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strpbrk' function. */ #undef HAVE_STRPBRK /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR /* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR /* Define to 1 if you have the `strtol' function. */ #undef HAVE_STRTOL /* Define to 1 if you have the `strtoull' function. */ #undef HAVE_STRTOULL /* Define to 1 if `st_blksize' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLKSIZE /* Define to 1 if you have the header file. */ #undef HAVE_SYSLOG_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_DIR_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_FILE_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_MOUNT_H /* Define to 1 if you have the header file, and it defines `DIR'. */ #undef HAVE_SYS_NDIR_H /* 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_SOCKET_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_TERMIOS_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `utime' function. */ #undef HAVE_UTIME /* Define to 1 if you have the header file. */ #undef HAVE_UTIME_H /* Define to 1 if `utime(file, NULL)' sets file's timestamp to the present. */ #undef HAVE_UTIME_NULL /* Define to 1 if you have the `vfork' function. */ #undef HAVE_VFORK /* Define to 1 if you have the header file. */ #undef HAVE_VFORK_H /* Define to 1 if `fork' works. */ #undef HAVE_WORKING_FORK /* Define to 1 if `vfork' works. */ #undef HAVE_WORKING_VFORK /* Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. */ #undef LSTAT_FOLLOWS_SLASHED_SYMLINK /* 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 /* Defined if IPV6 is supported */ #undef NE_HAVE_IPV6 /* Defined if LFS is supported */ #undef NE_HAVE_LFS /* Defined if SOCKS is supported */ #undef NE_HAVE_SOCKS /* Defined if SSL is supported */ #undef NE_HAVE_SSL /* Defined if TS_SSL is supported */ #undef NE_HAVE_TS_SSL /* Defined if ZLIB is supported */ #undef NE_HAVE_ZLIB /* Define to be neon library major version */ #undef NE_VERSION_MAJOR /* Define to be neon library minor version */ #undef NE_VERSION_MINOR /* Define to be neon library patch version */ #undef NE_VERSION_PATCH /* 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 the type of arg 1 for `select'. */ #undef SELECT_TYPE_ARG1 /* Define to the type of args 2, 3 and 4 for `select'. */ #undef SELECT_TYPE_ARG234 /* Define to the type of arg 5 for `select'. */ #undef SELECT_TYPE_ARG5 /* The size of `void *', as computed by sizeof. */ #undef SIZEOF_VOID_P /* Define to 1 if you have the ANSI C header files. */ #undef STDC_HEADERS /* Define to 1 if you can safely include both and . */ #undef TIME_WITH_SYS_TIME /* Define to 1 if your declares `struct tm'. */ #undef TM_IN_SYS_TIME /* Version number of package */ #undef VERSION /* Enable large inode numbers on Mac OS X 10.5. */ #ifndef _DARWIN_USE_64_BIT_INODE # define _DARWIN_USE_64_BIT_INODE 1 #endif /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS /* Define to enable GNU extensions */ #undef _GNU_SOURCE /* Define for large files, on AIX-style hosts. */ #undef _LARGE_FILES /* Define for Solaris 2.5.1 so the uint32_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ #undef _UINT32_T /* Define for Solaris 2.5.1 so the uint64_t typedef from , , or is not used. If the typedef were allowed, the #define below would cause a syntax error. */ #undef _UINT64_T /* Define to empty if `const' does not conform to ANSI C. */ #undef const /* Define to `int' if doesn't define. */ #undef gid_t /* Define to `__inline__' or `__inline' if that's what the C compiler calls it, or to nothing if 'inline' is not supported under any name. */ #ifndef __cplusplus #undef inline #endif /* Define to the type of a signed integer type of width exactly 16 bits if such a type exists and the standard includes do not define it. */ #undef int16_t /* Define to the type of a signed integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ #undef int32_t /* Define to the type of a signed integer type of width exactly 8 bits if such a type exists and the standard includes do not define it. */ #undef int8_t /* Define to rpl_malloc if the replacement function should be used. */ #undef malloc /* Define to `int' if does not define. */ #undef mode_t /* Define to `long int' if does not define. */ #undef off_t /* Define to `int' if does not define. */ #undef pid_t /* Define to `unsigned int' if does not define. */ #undef size_t /* Define to `int' if does not define. */ #undef ssize_t /* Define to `int' if doesn't define. */ #undef uid_t /* Define to the type of an unsigned integer type of width exactly 32 bits if such a type exists and the standard includes do not define it. */ #undef uint32_t /* Define to the type of an unsigned integer type of width exactly 64 bits if such a type exists and the standard includes do not define it. */ #undef uint64_t /* Define as `fork' if `vfork' does not work. */ #undef vfork /* Define to empty if the keyword `volatile' does not work. Warning: valid code using `volatile' can become incorrect without. Disable with care. */ #undef volatile davfs2-1.5.2/aclocal.m40000644000175000017500000010472312376154601011501 00000000000000# generated automatically by aclocal 1.11.6 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2007, 2008, 2009, 2010, 2011 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_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'.])]) # Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # 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.11' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.11.6], [], [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.11.6])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, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])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, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009, # 2010, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 12 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], 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 8's {/usr,}/bin/sh. touch 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, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' 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, 2000, 2001, 2002, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 5 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [{ # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done } ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006, 2008, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 16 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # 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.62])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl 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], [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], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [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([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl dnl The `parallel-tests' driver may need to know about EXEEXT, so add the dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. AC_CONFIG_COMMANDS_PRE(dnl [m4_provide_if([_AM_COMPILER_EXEEXT], [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl ]) dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further dnl mangled by Autoconf and run in a shell conditional statement. m4_define([_AC_COMPILER_EXEEXT], m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # 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, 2003, 2005, 2008, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # 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, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # 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, 1999, 2000, 2001, 2003, 2004, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 6 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl 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 --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation, # Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 Free Software # Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # _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, 1997, 2000, 2001, 2003, 2005, 2008 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[[\\\"\#\$\&\'\`$am_lf]]*) AC_MSG_ERROR([unsafe absolute working directory name]);; esac case $srcdir in *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 1 # 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, 2008, 2010 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # AM_SUBST_NOTMAKE(VARIABLE) # -------------------------- # Public sister of _AM_SUBST_NOTMAKE. AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. Yes, it's still used # in the wild :-( We should find a proper way to deprecate it ... AC_SUBST([AMTAR], ['$${TAR-tar}']) m4_if([$1], [v7], [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR m4_include([config/davfs2.m4]) m4_include([config/gettext.m4]) m4_include([config/iconv.m4]) m4_include([config/intlmacosx.m4]) m4_include([config/lib-ld.m4]) m4_include([config/lib-link.m4]) m4_include([config/lib-prefix.m4]) m4_include([config/neon.m4]) m4_include([config/nls.m4]) m4_include([config/po.m4]) m4_include([config/progtest.m4]) davfs2-1.5.2/bootstrap0000755000175000017500000000071412325167022011572 00000000000000#!/bin/sh # Copyright (C) 2006, 2007, 2008, 2009 Werner Baumann # 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. set -ex autopoint --force cd man; po4a po4a.conf; cd .. aclocal -I config autoheader automake --add-missing --force-missing --copy autoconf cp -p config/COPYING.davfs2 COPYING cp -p config/INSTALL.davfs2 INSTALL davfs2-1.5.2/configure0000755000175000017500000114024212376154605011551 00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for davfs2 1.5.2. # # Report bugs to . # # # 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 \$(( 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 and $0: http://savannah.nongnu.org/projects/davfs2 about your $0: system, 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'" 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='davfs2' PACKAGE_TARNAME='davfs2' PACKAGE_VERSION='1.5.2' PACKAGE_STRING='davfs2 1.5.2' PACKAGE_BUGREPORT='http://savannah.nongnu.org/projects/davfs2' PACKAGE_URL='' ac_unique_file="src/cache.c" gt_needs= # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_header_list= ac_subst_vars='am__EXEEXT_FALSE am__EXEEXT_TRUE LTLIBOBJS dav_linguas LINGUAS dav_syscachedir dav_localstatedir ssbindir dav_group dav_user LIBOBJS NEON_LIBS NE_FLAG_TS_SSL NE_FLAG_SOCKS NE_FLAG_LFS NE_FLAG_IPV6 NE_FLAG_ZLIB NE_FLAG_SSL NEON_CONFIG POSUB LTLIBINTL LIBINTL INTLLIBS LTLIBICONV LIBICONV INTL_MACOSX_LIBS EGREP GREP CPP host_os host_vendor host_cpu host build_os build_vendor build_cpu build XGETTEXT_EXTRA_OPTIONS MSGMERGE XGETTEXT_015 XGETTEXT GMSGFMT_015 MSGFMT_015 GMSGFMT MSGFMT GETTEXT_MACRO_VERSION USE_NLS LN_S 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 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_dependency_tracking enable_nls with_gnu_ld enable_rpath with_libiconv_prefix with_libintl_prefix with_neon enable_largefile ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CPP dav_user dav_group ssbindir dav_localstatedir dav_syscachedir LINGUAS' # 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 davfs2 1.5.2 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/davfs2] --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 davfs2 1.5.2:";; 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] --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --disable-nls do not use Native Language Support --disable-rpath do not hardcode runtime library paths --disable-largefile omit support for large files Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-gnu-ld assume the C compiler uses GNU ld default=no --with-libiconv-prefix[=DIR] search for libiconv in DIR/include and DIR/lib --without-libiconv-prefix don't search for libiconv in includedir and libdir --with-libintl-prefix[=DIR] search for libintl in DIR/include and DIR/lib --without-libintl-prefix don't search for libintl in includedir and libdir --with-neon[=DIR] specify location of neon library 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 dav_user if invoked by root, mount.davfs runs as this user [davfs2] dav_group the group, the mount.davfs daemon belongs to [davfs2] ssbindir where mount will search for mount-helpers [/sbin] dav_localstatedir directory to store pid-files in [/var/run] dav_syscachedir cache directory [/var/cache] LINGUAS select languages for messages and documentation Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF 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 davfs2 configure 1.5.2 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_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_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;} ( $as_echo "## --------------------------------------------------------- ## ## Report this to http://savannah.nongnu.org/projects/davfs2 ## ## --------------------------------------------------------- ##" ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$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 # 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_find_intX_t LINENO BITS VAR # ----------------------------------- # Finds a signed integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_intX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for int$2_t" >&5 $as_echo_n "checking for int$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in int$2_t 'int' 'long int' \ 'long long int' 'short int' 'signed char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array [1 - 2 * !(0 < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default enum { N = $2 / 2 - 1 }; int main () { static int test_array [1 - 2 * !(($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 1) < ($ac_type) ((((($ac_type) 1 << N) << N) - 1) * 2 + 2))]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else case $ac_type in #( int$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done 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_find_intX_t # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache # variable VAR accordingly. ac_fn_c_check_type () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof ($2)) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { if (sizeof (($2))) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : else eval "$3=yes" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_type # ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES # ---------------------------------------------------- # Tries to find if the field MEMBER exists in type AGGR, after including # INCLUDES, setting cache variable VAR accordingly. ac_fn_c_check_member () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 $as_echo_n "checking for $2.$3... " >&6; } if eval \${$4+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $5 int main () { static $2 ac_aggr; if (sizeof ac_aggr.$3) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$4=yes" else eval "$4=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$4 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_member # ac_fn_c_find_uintX_t LINENO BITS VAR # ------------------------------------ # Finds an unsigned integer type with width BITS, setting cache variable VAR # accordingly. ac_fn_c_find_uintX_t () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uint$2_t" >&5 $as_echo_n "checking for uint$2_t... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else eval "$3=no" # Order is important - never check a type that is potentially smaller # than half of the expected target width. for ac_type in uint$2_t 'unsigned int' 'unsigned long int' \ 'unsigned long long int' 'unsigned short int' 'unsigned char'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { static int test_array [1 - 2 * !((($ac_type) -1 >> ($2 / 2 - 1)) >> ($2 / 2 - 1) == 3)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : case $ac_type in #( uint$2_t) : eval "$3=yes" ;; #( *) : eval "$3=\$ac_type" ;; esac fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if eval test \"x\$"$3"\" = x"no"; then : else break fi done 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_find_uintX_t # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes # INCLUDES, setting VAR accordingly. Returns whether the value could be # computed ac_fn_c_compute_int () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if test "$cross_compiling" = yes; then # Depending upon the size, compute the lo and hi bounds. cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=0 ac_mid=0 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid; break else as_fn_arith $ac_mid + 1 && ac_lo=$as_val if test $ac_lo -le $ac_mid; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) < 0)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=-1 ac_mid=-1 while :; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) >= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_lo=$ac_mid; break else as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val if test $ac_mid -le $ac_hi; then ac_lo= ac_hi= break fi as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done else ac_lo= ac_hi= fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext # Binary search between lo and hi bounds. while test "x$ac_lo" != "x$ac_hi"; do as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 int main () { static int test_array [1 - 2 * !(($2) <= $ac_mid)]; test_array [0] = 0; return test_array [0]; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_hi=$ac_mid else as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done case $ac_lo in #(( ?*) eval "$3=\$ac_lo"; ac_retval=0 ;; '') ac_retval=1 ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 static long int longval () { return $2; } static unsigned long int ulongval () { return $2; } #include #include int main () { FILE *f = fopen ("conftest.val", "w"); if (! f) return 1; if (($2) < 0) { long int i = longval (); if (i != ($2)) return 1; fprintf (f, "%ld", i); } else { unsigned long int i = ulongval (); if (i != ($2)) return 1; fprintf (f, "%lu", i); } /* Do not output a trailing newline, as this causes \r\n confusion on some platforms. */ return ferror (f) || fclose (f) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : echo >>conftest.val; read $3 &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 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 davfs2 $as_me 1.5.2, 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 gt_needs="$gt_needs " as_fn_append ac_header_list " utime.h" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false 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 ac_aux_dir= for ac_dir in config "$srcdir"/config; 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 config \"$srcdir\"/config" "$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. am__api_version='1.11' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # 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; } # Just in case sleep 1 echo timestamp > conftest.file # Reject unsafe characters in $srcdir or the absolute working directory # name. Accept space and tab only in the latter. am_lf=' ' case `pwd` in *[\\\"\#\$\&\'\`$am_lf]*) as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; esac case $srcdir in *[\\\"\#\$\&\'\`$am_lf\ \ ]*) as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; esac # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t "$srcdir/configure" conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". as_fn_error $? "ls -t appears to fail. Make sure there is not a broken alias in your environment" "$LINENO" 5 fi test "$2" = conftest.file ) 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; } 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 --run true"; then am_missing_run="$MISSING --run " 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; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac 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 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='davfs2' VERSION='1.5.2' 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"} # 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}' am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -' ac_config_headers="$ac_config_headers config.h" # Checks for programs. ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { $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 8's {/usr,}/bin/sh. touch 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 { $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 # Checks for libraries. { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether NLS is requested" >&5 $as_echo_n "checking whether NLS is requested... " >&6; } # Check whether --enable-nls was given. if test "${enable_nls+set}" = set; then : enableval=$enable_nls; USE_NLS=$enableval else USE_NLS=yes fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 $as_echo "$USE_NLS" >&6; } GETTEXT_MACRO_VERSION=0.18 # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "msgfmt", so it can be a program name with args. set dummy msgfmt; 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_MSGFMT+:} false; then : $as_echo_n "(cached) " >&6 else case "$MSGFMT" in [\\/]* | ?:[\\/]*) ac_cv_path_MSGFMT="$MSGFMT" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&5 if $ac_dir/$ac_word --statistics /dev/null >&5 2>&1 && (if $ac_dir/$ac_word --statistics /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then ac_cv_path_MSGFMT="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" test -z "$ac_cv_path_MSGFMT" && ac_cv_path_MSGFMT=":" ;; esac fi MSGFMT="$ac_cv_path_MSGFMT" if test "$MSGFMT" != ":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGFMT" >&5 $as_echo "$MSGFMT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi # Extract the first word of "gmsgfmt", so it can be a program name with args. set dummy gmsgfmt; 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_GMSGFMT+:} false; then : $as_echo_n "(cached) " >&6 else case $GMSGFMT in [\\/]* | ?:[\\/]*) ac_cv_path_GMSGFMT="$GMSGFMT" # 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_GMSGFMT="$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_GMSGFMT" && ac_cv_path_GMSGFMT="$MSGFMT" ;; esac fi GMSGFMT=$ac_cv_path_GMSGFMT if test -n "$GMSGFMT"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $GMSGFMT" >&5 $as_echo "$GMSGFMT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi case `$MSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) MSGFMT_015=: ;; *) MSGFMT_015=$MSGFMT ;; esac case `$GMSGFMT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) GMSGFMT_015=: ;; *) GMSGFMT_015=$GMSGFMT ;; esac # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "xgettext", so it can be a program name with args. set dummy xgettext; 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_XGETTEXT+:} false; then : $as_echo_n "(cached) " >&6 else case "$XGETTEXT" in [\\/]* | ?:[\\/]*) ac_cv_path_XGETTEXT="$XGETTEXT" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&5 if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null >&5 2>&1 && (if $ac_dir/$ac_word --omit-header --copyright-holder= --msgid-bugs-address= /dev/null 2>&1 >/dev/null | grep usage >/dev/null; then exit 1; else exit 0; fi); then ac_cv_path_XGETTEXT="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" test -z "$ac_cv_path_XGETTEXT" && ac_cv_path_XGETTEXT=":" ;; esac fi XGETTEXT="$ac_cv_path_XGETTEXT" if test "$XGETTEXT" != ":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $XGETTEXT" >&5 $as_echo "$XGETTEXT" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi rm -f messages.po case `$XGETTEXT --version | sed 1q | sed -e 's,^[^0-9]*,,'` in '' | 0.[0-9] | 0.[0-9].* | 0.1[0-4] | 0.1[0-4].*) XGETTEXT_015=: ;; *) XGETTEXT_015=$XGETTEXT ;; esac # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Find out how to test for executable files. Don't use a zero-byte file, # as systems may use methods other than mode bits to determine executability. cat >conf$$.file <<_ASEOF #! /bin/sh exit 0 _ASEOF chmod +x conf$$.file if test -x conf$$.file >/dev/null 2>&1; then ac_executable_p="test -x" else ac_executable_p="test -f" fi rm -f conf$$.file # Extract the first word of "msgmerge", so it can be a program name with args. set dummy msgmerge; 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_MSGMERGE+:} false; then : $as_echo_n "(cached) " >&6 else case "$MSGMERGE" in [\\/]* | ?:[\\/]*) ac_cv_path_MSGMERGE="$MSGMERGE" # Let the user override the test with a path. ;; *) ac_save_IFS="$IFS"; IFS=$PATH_SEPARATOR for ac_dir in $PATH; do IFS="$ac_save_IFS" test -z "$ac_dir" && ac_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if $ac_executable_p "$ac_dir/$ac_word$ac_exec_ext"; then echo "$as_me: trying $ac_dir/$ac_word..." >&5 if $ac_dir/$ac_word --update -q /dev/null /dev/null >&5 2>&1; then ac_cv_path_MSGMERGE="$ac_dir/$ac_word$ac_exec_ext" break 2 fi fi done done IFS="$ac_save_IFS" test -z "$ac_cv_path_MSGMERGE" && ac_cv_path_MSGMERGE=":" ;; esac fi MSGMERGE="$ac_cv_path_MSGMERGE" if test "$MSGMERGE" != ":"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MSGMERGE" >&5 $as_echo "$MSGMERGE" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -n "$localedir" || localedir='${datadir}/locale' test -n "${XGETTEXT_EXTRA_OPTIONS+set}" || XGETTEXT_EXTRA_OPTIONS= ac_config_commands="$ac_config_commands po-directories" if test "X$prefix" = "XNONE"; then acl_final_prefix="$ac_default_prefix" else acl_final_prefix="$prefix" fi if test "X$exec_prefix" = "XNONE"; then acl_final_exec_prefix='${prefix}' else acl_final_exec_prefix="$exec_prefix" fi acl_save_prefix="$prefix" prefix="$acl_final_prefix" eval acl_final_exec_prefix=\"$acl_final_exec_prefix\" prefix="$acl_save_prefix" # 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 # 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 # Prepare PATH_SEPARATOR. # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi 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 GCC" >&5 $as_echo_n "checking for ld used by GCC... " >&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. [\\/]* | [A-Za-z]:[\\/]*) re_direlt='/[^/][^/]*/\.\./' # Canonicalize the path of ld ac_prog=`echo $ac_prog| sed 's%\\\\%/%g'` while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do ac_prog=`echo $ac_prog| sed "s%$re_direlt%/%"` done test -z "$LD" && LD="$ac_prog" ;; "") # If it fails, then pretend we aren't using GCC. ac_prog=ld ;; *) # If it is relative, then search for the first ld in PATH. with_gnu_ld=unknown ;; esac elif test "$with_gnu_ld" = yes; then { $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 ${acl_cv_path_LD+:} false; then : $as_echo_n "(cached) " >&6 else if test -z "$LD"; then IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATH_SEPARATOR-:}" for ac_dir in $PATH; do test -z "$ac_dir" && ac_dir=. if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then acl_cv_path_LD="$ac_dir/$ac_prog" # Check to see if the program is GNU ld. I'd rather use --version, # but apparently some GNU ld's only accept -v. # Break only if it was the GNU/non-GNU ld that we prefer. case `"$acl_cv_path_LD" -v 2>&1 < /dev/null` in *GNU* | *'with BFD'*) test "$with_gnu_ld" != no && break ;; *) test "$with_gnu_ld" != yes && break ;; esac fi done IFS="$ac_save_ifs" else acl_cv_path_LD="$LD" # Let the user override the test with a path. fi fi LD="$acl_cv_path_LD" if test -n "$LD"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5 $as_echo "$LD" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 $as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } if ${acl_cv_prog_gnu_ld+:} false; then : $as_echo_n "(cached) " >&6 else # I'd rather use --version here, but apparently some GNU ld's only accept -v. case `$LD -v 2>&1 &5 $as_echo "$acl_cv_prog_gnu_ld" >&6; } with_gnu_ld=$acl_cv_prog_gnu_ld { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shared library run path origin" >&5 $as_echo_n "checking for shared library run path origin... " >&6; } if ${acl_cv_rpath+:} false; then : $as_echo_n "(cached) " >&6 else CC="$CC" GCC="$GCC" LDFLAGS="$LDFLAGS" LD="$LD" with_gnu_ld="$with_gnu_ld" \ ${CONFIG_SHELL-/bin/sh} "$ac_aux_dir/config.rpath" "$host" > conftest.sh . ./conftest.sh rm -f ./conftest.sh acl_cv_rpath=done fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $acl_cv_rpath" >&5 $as_echo "$acl_cv_rpath" >&6; } wl="$acl_cv_wl" acl_libext="$acl_cv_libext" acl_shlibext="$acl_cv_shlibext" acl_libname_spec="$acl_cv_libname_spec" acl_library_names_spec="$acl_cv_library_names_spec" acl_hardcode_libdir_flag_spec="$acl_cv_hardcode_libdir_flag_spec" acl_hardcode_libdir_separator="$acl_cv_hardcode_libdir_separator" acl_hardcode_direct="$acl_cv_hardcode_direct" acl_hardcode_minus_L="$acl_cv_hardcode_minus_L" # Check whether --enable-rpath was given. if test "${enable_rpath+set}" = set; then : enableval=$enable_rpath; : else enable_rpath=yes 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 { $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" acl_libdirstem=lib acl_libdirstem2= case "$host_os" in solaris*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking for 64-bit host" >&5 $as_echo_n "checking for 64-bit host... " >&6; } if ${gl_cv_solaris_64bit+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef _LP64 sixtyfour bits #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "sixtyfour bits" >/dev/null 2>&1; then : gl_cv_solaris_64bit=yes else gl_cv_solaris_64bit=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_solaris_64bit" >&5 $as_echo "$gl_cv_solaris_64bit" >&6; } if test $gl_cv_solaris_64bit = yes; then acl_libdirstem=lib/64 case "$host_cpu" in sparc*) acl_libdirstem2=lib/sparcv9 ;; i*86 | x86_64) acl_libdirstem2=lib/amd64 ;; esac fi ;; *) searchpath=`(LC_ALL=C $CC -print-search-dirs) 2>/dev/null | sed -n -e 's,^libraries: ,,p' | sed -e 's,^=,,'` if test -n "$searchpath"; then acl_save_IFS="${IFS= }"; IFS=":" for searchdir in $searchpath; do if test -d "$searchdir"; then case "$searchdir" in */lib64/ | */lib64 ) acl_libdirstem=lib64 ;; */../ | */.. ) # Better ignore directories of this form. They are misleading. ;; *) searchdir=`cd "$searchdir" && pwd` case "$searchdir" in */lib64 ) acl_libdirstem=lib64 ;; esac ;; esac fi done IFS="$acl_save_IFS" fi ;; esac test -n "$acl_libdirstem2" || acl_libdirstem2="$acl_libdirstem" use_additional=yes acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" # Check whether --with-libiconv-prefix was given. if test "${with_libiconv_prefix+set}" = set; then : withval=$with_libiconv_prefix; if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" if test "$acl_libdirstem2" != "$acl_libdirstem" \ && ! test -d "$withval/$acl_libdirstem"; then additional_libdir="$withval/$acl_libdirstem2" fi fi fi fi LIBICONV= LTLIBICONV= INCICONV= LIBICONV_PREFIX= HAVE_LIBICONV= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='iconv ' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIBICONV="${LIBICONV}${LIBICONV:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$value" else : fi else found_dir= found_la= found_so= found_a= eval libname=\"$acl_libname_spec\" # typically: libname=lib$name if test -n "$acl_shlibext"; then shrext=".$acl_shlibext" # typically: shrext=.so else shrext= fi if test $use_additional = yes; then dir="$additional_libdir" if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext"; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext"; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi if test "$acl_hardcode_direct" = yes; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else haveit= for x in $LDFLAGS $LIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_so" else LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then LIBICONV="${LIBICONV}${LIBICONV:+ }$found_a" else LIBICONV="${LIBICONV}${LIBICONV:+ }-L$found_dir -l$name" fi fi additional_includedir= case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` if test "$name" = 'iconv'; then LIBICONV_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem2 | */$acl_libdirstem2/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` if test "$name" = 'iconv'; then LIBICONV_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INCICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then INCICONV="${INCICONV}${INCICONV:+ }-I$additional_includedir" fi fi fi fi fi if test -n "$found_la"; then save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" for dep in $dependency_libs; do case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then haveit= if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then LIBICONV="${LIBICONV}${LIBICONV:+ }-L$additional_libdir" fi fi haveit= for x in $LDFLAGS $LTLIBICONV; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-L$additional_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ;; *.la) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) LIBICONV="${LIBICONV}${LIBICONV:+ }$dep" LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }$dep" ;; esac done fi else LIBICONV="${LIBICONV}${LIBICONV:+ }-l$name" LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$acl_hardcode_libdir_separator"; then alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" done acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" else for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBICONV="${LIBICONV}${LIBICONV:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do LTLIBICONV="${LTLIBICONV}${LTLIBICONV:+ }-R$found_dir" done fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFPreferencesCopyAppValue" >&5 $as_echo_n "checking for CFPreferencesCopyAppValue... " >&6; } if ${gt_cv_func_CFPreferencesCopyAppValue+:} false; then : $as_echo_n "(cached) " >&6 else gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { CFPreferencesCopyAppValue(NULL, NULL) ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : gt_cv_func_CFPreferencesCopyAppValue=yes else gt_cv_func_CFPreferencesCopyAppValue=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$gt_save_LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFPreferencesCopyAppValue" >&5 $as_echo "$gt_cv_func_CFPreferencesCopyAppValue" >&6; } if test $gt_cv_func_CFPreferencesCopyAppValue = yes; then $as_echo "#define HAVE_CFPREFERENCESCOPYAPPVALUE 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CFLocaleCopyCurrent" >&5 $as_echo_n "checking for CFLocaleCopyCurrent... " >&6; } if ${gt_cv_func_CFLocaleCopyCurrent+:} false; then : $as_echo_n "(cached) " >&6 else gt_save_LIBS="$LIBS" LIBS="$LIBS -Wl,-framework -Wl,CoreFoundation" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { CFLocaleCopyCurrent(); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : gt_cv_func_CFLocaleCopyCurrent=yes else gt_cv_func_CFLocaleCopyCurrent=no fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$gt_save_LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_cv_func_CFLocaleCopyCurrent" >&5 $as_echo "$gt_cv_func_CFLocaleCopyCurrent" >&6; } if test $gt_cv_func_CFLocaleCopyCurrent = yes; then $as_echo "#define HAVE_CFLOCALECOPYCURRENT 1" >>confdefs.h fi INTL_MACOSX_LIBS= if test $gt_cv_func_CFPreferencesCopyAppValue = yes || test $gt_cv_func_CFLocaleCopyCurrent = yes; then INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" fi LIBINTL= LTLIBINTL= POSUB= case " $gt_needs " in *" need-formatstring-macros "*) gt_api_version=3 ;; *" need-ngettext "*) gt_api_version=2 ;; *) gt_api_version=1 ;; esac gt_func_gnugettext_libc="gt_cv_func_gnugettext${gt_api_version}_libc" gt_func_gnugettext_libintl="gt_cv_func_gnugettext${gt_api_version}_libintl" if test "$USE_NLS" = "yes"; then gt_use_preinstalled_gnugettext=no if test $gt_api_version -ge 3; then gt_revision_test_code=' #ifndef __GNU_GETTEXT_SUPPORTED_REVISION #define __GNU_GETTEXT_SUPPORTED_REVISION(major) ((major) == 0 ? 0 : -1) #endif typedef int array [2 * (__GNU_GETTEXT_SUPPORTED_REVISION(0) >= 1) - 1]; ' else gt_revision_test_code= fi if test $gt_api_version -ge 2; then gt_expression_test_code=' + * ngettext ("", "", 0)' else gt_expression_test_code= fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libc" >&5 $as_echo_n "checking for GNU gettext in libc... " >&6; } if eval \${$gt_func_gnugettext_libc+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include $gt_revision_test_code extern int _nl_msg_cat_cntr; extern int *_nl_domain_bindings; int main () { bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_domain_bindings ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$gt_func_gnugettext_libc=yes" else eval "$gt_func_gnugettext_libc=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$gt_func_gnugettext_libc { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" != "yes"; }; then am_save_CPPFLAGS="$CPPFLAGS" for element in $INCICONV; do haveit= for x in $CPPFLAGS; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for iconv" >&5 $as_echo_n "checking for iconv... " >&6; } if ${am_cv_func_iconv+:} false; then : $as_echo_n "(cached) " >&6 else am_cv_func_iconv="no, consider installing GNU libiconv" am_cv_lib_iconv=no cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : am_cv_func_iconv=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if test "$am_cv_func_iconv" != yes; then am_save_LIBS="$LIBS" LIBS="$LIBS $LIBICONV" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { iconv_t cd = iconv_open("",""); iconv(cd,NULL,NULL,NULL,NULL); iconv_close(cd); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : am_cv_lib_iconv=yes am_cv_func_iconv=yes fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS="$am_save_LIBS" fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv" >&5 $as_echo "$am_cv_func_iconv" >&6; } if test "$am_cv_func_iconv" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working iconv" >&5 $as_echo_n "checking for working iconv... " >&6; } if ${am_cv_func_iconv_works+:} false; then : $as_echo_n "(cached) " >&6 else am_save_LIBS="$LIBS" if test $am_cv_lib_iconv = yes; then LIBS="$LIBS $LIBICONV" fi if test "$cross_compiling" = yes; then : case "$host_os" in aix* | hpux*) am_cv_func_iconv_works="guessing no" ;; *) am_cv_func_iconv_works="guessing yes" ;; esac else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { /* Test against AIX 5.1 bug: Failures are not distinguishable from successful returns. */ { iconv_t cd_utf8_to_88591 = iconv_open ("ISO8859-1", "UTF-8"); if (cd_utf8_to_88591 != (iconv_t)(-1)) { static const char input[] = "\342\202\254"; /* EURO SIGN */ char buf[10]; const char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_utf8_to_88591, (char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) return 1; } } /* Test against Solaris 10 bug: Failures are not distinguishable from successful returns. */ { iconv_t cd_ascii_to_88591 = iconv_open ("ISO8859-1", "646"); if (cd_ascii_to_88591 != (iconv_t)(-1)) { static const char input[] = "\263"; char buf[10]; const char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_ascii_to_88591, (char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if (res == 0) return 1; } } #if 0 /* This bug could be worked around by the caller. */ /* Test against HP-UX 11.11 bug: Positive return value instead of 0. */ { iconv_t cd_88591_to_utf8 = iconv_open ("utf8", "iso88591"); if (cd_88591_to_utf8 != (iconv_t)(-1)) { static const char input[] = "\304rger mit b\366sen B\374bchen ohne Augenma\337"; char buf[50]; const char *inptr = input; size_t inbytesleft = strlen (input); char *outptr = buf; size_t outbytesleft = sizeof (buf); size_t res = iconv (cd_88591_to_utf8, (char **) &inptr, &inbytesleft, &outptr, &outbytesleft); if ((int)res > 0) return 1; } } #endif /* Test against HP-UX 11.11 bug: No converter from EUC-JP to UTF-8 is provided. */ if (/* Try standardized names. */ iconv_open ("UTF-8", "EUC-JP") == (iconv_t)(-1) /* Try IRIX, OSF/1 names. */ && iconv_open ("UTF-8", "eucJP") == (iconv_t)(-1) /* Try AIX names. */ && iconv_open ("UTF-8", "IBM-eucJP") == (iconv_t)(-1) /* Try HP-UX names. */ && iconv_open ("utf8", "eucJP") == (iconv_t)(-1)) return 1; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : am_cv_func_iconv_works=yes else am_cv_func_iconv_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi LIBS="$am_save_LIBS" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_func_iconv_works" >&5 $as_echo "$am_cv_func_iconv_works" >&6; } case "$am_cv_func_iconv_works" in *no) am_func_iconv=no am_cv_lib_iconv=no ;; *) am_func_iconv=yes ;; esac else am_func_iconv=no am_cv_lib_iconv=no fi if test "$am_func_iconv" = yes; then $as_echo "#define HAVE_ICONV 1" >>confdefs.h fi if test "$am_cv_lib_iconv" = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libiconv" >&5 $as_echo_n "checking how to link with libiconv... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBICONV" >&5 $as_echo "$LIBICONV" >&6; } else CPPFLAGS="$am_save_CPPFLAGS" LIBICONV= LTLIBICONV= fi use_additional=yes acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" # Check whether --with-libintl-prefix was given. if test "${with_libintl_prefix+set}" = set; then : withval=$with_libintl_prefix; if test "X$withval" = "Xno"; then use_additional=no else if test "X$withval" = "X"; then acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval additional_includedir=\"$includedir\" eval additional_libdir=\"$libdir\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" else additional_includedir="$withval/include" additional_libdir="$withval/$acl_libdirstem" if test "$acl_libdirstem2" != "$acl_libdirstem" \ && ! test -d "$withval/$acl_libdirstem"; then additional_libdir="$withval/$acl_libdirstem2" fi fi fi fi LIBINTL= LTLIBINTL= INCINTL= LIBINTL_PREFIX= HAVE_LIBINTL= rpathdirs= ltrpathdirs= names_already_handled= names_next_round='intl ' while test -n "$names_next_round"; do names_this_round="$names_next_round" names_next_round= for name in $names_this_round; do already_handled= for n in $names_already_handled; do if test "$n" = "$name"; then already_handled=yes break fi done if test -z "$already_handled"; then names_already_handled="$names_already_handled $name" uppername=`echo "$name" | sed -e 'y|abcdefghijklmnopqrstuvwxyz./-|ABCDEFGHIJKLMNOPQRSTUVWXYZ___|'` eval value=\"\$HAVE_LIB$uppername\" if test -n "$value"; then if test "$value" = yes; then eval value=\"\$LIB$uppername\" test -z "$value" || LIBINTL="${LIBINTL}${LIBINTL:+ }$value" eval value=\"\$LTLIB$uppername\" test -z "$value" || LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$value" else : fi else found_dir= found_la= found_so= found_a= eval libname=\"$acl_libname_spec\" # typically: libname=lib$name if test -n "$acl_shlibext"; then shrext=".$acl_shlibext" # typically: shrext=.so else shrext= fi if test $use_additional = yes; then dir="$additional_libdir" if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext"; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi fi if test "X$found_dir" = "X"; then for x in $LDFLAGS $LTLIBINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" case "$x" in -L*) dir=`echo "X$x" | sed -e 's/^X-L//'` if test -n "$acl_shlibext"; then if test -f "$dir/$libname$shrext"; then found_dir="$dir" found_so="$dir/$libname$shrext" else if test "$acl_library_names_spec" = '$libname$shrext$versuffix'; then ver=`(cd "$dir" && \ for f in "$libname$shrext".*; do echo "$f"; done \ | sed -e "s,^$libname$shrext\\\\.,," \ | sort -t '.' -n -r -k1,1 -k2,2 -k3,3 -k4,4 -k5,5 \ | sed 1q ) 2>/dev/null` if test -n "$ver" && test -f "$dir/$libname$shrext.$ver"; then found_dir="$dir" found_so="$dir/$libname$shrext.$ver" fi else eval library_names=\"$acl_library_names_spec\" for f in $library_names; do if test -f "$dir/$f"; then found_dir="$dir" found_so="$dir/$f" break fi done fi fi fi if test "X$found_dir" = "X"; then if test -f "$dir/$libname.$acl_libext"; then found_dir="$dir" found_a="$dir/$libname.$acl_libext" fi fi if test "X$found_dir" != "X"; then if test -f "$dir/$libname.la"; then found_la="$dir/$libname.la" fi fi ;; esac if test "X$found_dir" != "X"; then break fi done fi if test "X$found_dir" != "X"; then LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$found_dir -l$name" if test "X$found_so" != "X"; then if test "$enable_rpath" = no \ || test "X$found_dir" = "X/usr/$acl_libdirstem" \ || test "X$found_dir" = "X/usr/$acl_libdirstem2"; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else haveit= for x in $ltrpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $found_dir" fi if test "$acl_hardcode_direct" = yes; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else if test -n "$acl_hardcode_libdir_flag_spec" && test "$acl_hardcode_minus_L" = no; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" haveit= for x in $rpathdirs; do if test "X$x" = "X$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $found_dir" fi else haveit= for x in $LDFLAGS $LIBINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$found_dir"; then haveit=yes break fi done if test -z "$haveit"; then LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir" fi if test "$acl_hardcode_minus_L" != no; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_so" else LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" fi fi fi fi else if test "X$found_a" != "X"; then LIBINTL="${LIBINTL}${LIBINTL:+ }$found_a" else LIBINTL="${LIBINTL}${LIBINTL:+ }-L$found_dir -l$name" fi fi additional_includedir= case "$found_dir" in */$acl_libdirstem | */$acl_libdirstem/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem/"'*$,,'` if test "$name" = 'intl'; then LIBINTL_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; */$acl_libdirstem2 | */$acl_libdirstem2/) basedir=`echo "X$found_dir" | sed -e 's,^X,,' -e "s,/$acl_libdirstem2/"'*$,,'` if test "$name" = 'intl'; then LIBINTL_PREFIX="$basedir" fi additional_includedir="$basedir/include" ;; esac if test "X$additional_includedir" != "X"; then if test "X$additional_includedir" != "X/usr/include"; then haveit= if test "X$additional_includedir" = "X/usr/local/include"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then for x in $CPPFLAGS $INCINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-I$additional_includedir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_includedir"; then INCINTL="${INCINTL}${INCINTL:+ }-I$additional_includedir" fi fi fi fi fi if test -n "$found_la"; then save_libdir="$libdir" case "$found_la" in */* | *\\*) . "$found_la" ;; *) . "./$found_la" ;; esac libdir="$save_libdir" for dep in $dependency_libs; do case "$dep" in -L*) additional_libdir=`echo "X$dep" | sed -e 's/^X-L//'` if test "X$additional_libdir" != "X/usr/$acl_libdirstem" \ && test "X$additional_libdir" != "X/usr/$acl_libdirstem2"; then haveit= if test "X$additional_libdir" = "X/usr/local/$acl_libdirstem" \ || test "X$additional_libdir" = "X/usr/local/$acl_libdirstem2"; then if test -n "$GCC"; then case $host_os in linux* | gnu* | k*bsd*-gnu) haveit=yes;; esac fi fi if test -z "$haveit"; then haveit= for x in $LDFLAGS $LIBINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then LIBINTL="${LIBINTL}${LIBINTL:+ }-L$additional_libdir" fi fi haveit= for x in $LDFLAGS $LTLIBINTL; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X-L$additional_libdir"; then haveit=yes break fi done if test -z "$haveit"; then if test -d "$additional_libdir"; then LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-L$additional_libdir" fi fi fi fi ;; -R*) dir=`echo "X$dep" | sed -e 's/^X-R//'` if test "$enable_rpath" != no; then haveit= for x in $rpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then rpathdirs="$rpathdirs $dir" fi haveit= for x in $ltrpathdirs; do if test "X$x" = "X$dir"; then haveit=yes break fi done if test -z "$haveit"; then ltrpathdirs="$ltrpathdirs $dir" fi fi ;; -l*) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's/^X-l//'` ;; *.la) names_next_round="$names_next_round "`echo "X$dep" | sed -e 's,^X.*/,,' -e 's,^lib,,' -e 's,\.la$,,'` ;; *) LIBINTL="${LIBINTL}${LIBINTL:+ }$dep" LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }$dep" ;; esac done fi else LIBINTL="${LIBINTL}${LIBINTL:+ }-l$name" LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-l$name" fi fi fi done done if test "X$rpathdirs" != "X"; then if test -n "$acl_hardcode_libdir_separator"; then alldirs= for found_dir in $rpathdirs; do alldirs="${alldirs}${alldirs:+$acl_hardcode_libdir_separator}$found_dir" done acl_save_libdir="$libdir" libdir="$alldirs" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" else for found_dir in $rpathdirs; do acl_save_libdir="$libdir" libdir="$found_dir" eval flag=\"$acl_hardcode_libdir_flag_spec\" libdir="$acl_save_libdir" LIBINTL="${LIBINTL}${LIBINTL:+ }$flag" done fi fi if test "X$ltrpathdirs" != "X"; then for found_dir in $ltrpathdirs; do LTLIBINTL="${LTLIBINTL}${LTLIBINTL:+ }-R$found_dir" done fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU gettext in libintl" >&5 $as_echo_n "checking for GNU gettext in libintl... " >&6; } if eval \${$gt_func_gnugettext_libintl+:} false; then : $as_echo_n "(cached) " >&6 else gt_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS $INCINTL" gt_save_LIBS="$LIBS" LIBS="$LIBS $LIBINTL" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include $gt_revision_test_code extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *); int main () { bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$gt_func_gnugettext_libintl=yes" else eval "$gt_func_gnugettext_libintl=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" != yes; } && test -n "$LIBICONV"; then LIBS="$LIBS $LIBICONV" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include $gt_revision_test_code extern int _nl_msg_cat_cntr; extern #ifdef __cplusplus "C" #endif const char *_nl_expand_alias (const char *); int main () { bindtextdomain ("", ""); return * gettext ("")$gt_expression_test_code + _nl_msg_cat_cntr + *_nl_expand_alias ("") ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : LIBINTL="$LIBINTL $LIBICONV" LTLIBINTL="$LTLIBINTL $LTLIBICONV" eval "$gt_func_gnugettext_libintl=yes" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi CPPFLAGS="$gt_save_CPPFLAGS" LIBS="$gt_save_LIBS" fi eval ac_res=\$$gt_func_gnugettext_libintl { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } fi if { eval "gt_val=\$$gt_func_gnugettext_libc"; test "$gt_val" = "yes"; } \ || { { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; } \ && test "$PACKAGE" != gettext-runtime \ && test "$PACKAGE" != gettext-tools; }; then gt_use_preinstalled_gnugettext=yes else LIBINTL= LTLIBINTL= INCINTL= fi if test -n "$INTL_MACOSX_LIBS"; then if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then LIBINTL="$LIBINTL $INTL_MACOSX_LIBS" LTLIBINTL="$LTLIBINTL $INTL_MACOSX_LIBS" fi fi if test "$gt_use_preinstalled_gnugettext" = "yes" \ || test "$nls_cv_use_gnu_gettext" = "yes"; then $as_echo "#define ENABLE_NLS 1" >>confdefs.h else USE_NLS=no fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to use NLS" >&5 $as_echo_n "checking whether to use NLS... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_NLS" >&5 $as_echo "$USE_NLS" >&6; } if test "$USE_NLS" = "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking where the gettext function comes from" >&5 $as_echo_n "checking where the gettext function comes from... " >&6; } if test "$gt_use_preinstalled_gnugettext" = "yes"; then if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then gt_source="external libintl" else gt_source="libc" fi else gt_source="included intl directory" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gt_source" >&5 $as_echo "$gt_source" >&6; } fi if test "$USE_NLS" = "yes"; then if test "$gt_use_preinstalled_gnugettext" = "yes"; then if { eval "gt_val=\$$gt_func_gnugettext_libintl"; test "$gt_val" = "yes"; }; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to link with libintl" >&5 $as_echo_n "checking how to link with libintl... " >&6; } { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIBINTL" >&5 $as_echo "$LIBINTL" >&6; } for element in $INCINTL; do haveit= for x in $CPPFLAGS; do acl_save_prefix="$prefix" prefix="$acl_final_prefix" acl_save_exec_prefix="$exec_prefix" exec_prefix="$acl_final_exec_prefix" eval x=\"$x\" exec_prefix="$acl_save_exec_prefix" prefix="$acl_save_prefix" if test "X$x" = "X$element"; then haveit=yes break fi done if test -z "$haveit"; then CPPFLAGS="${CPPFLAGS}${CPPFLAGS:+ }$element" fi done fi $as_echo "#define HAVE_GETTEXT 1" >>confdefs.h $as_echo "#define HAVE_DCGETTEXT 1" >>confdefs.h fi POSUB=po fi INTLLIBS="$LIBINTL" # Check whether --with-neon was given. if test "${with_neon+set}" = set; then : withval=$with_neon; case $withval in yes|no) neon_ext_path= ;; *) neon_ext_path=$withval ;; esac; else neon_ext_path= fi neon_got_library=no if test "x$neon_ext_path" = "x"; then # Extract the first word of "neon-config", so it can be a program name with args. set dummy neon-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_NEON_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $NEON_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_NEON_CONFIG="$NEON_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_NEON_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 test -z "$ac_cv_path_NEON_CONFIG" && ac_cv_path_NEON_CONFIG="none" ;; esac fi NEON_CONFIG=$ac_cv_path_NEON_CONFIG if test -n "$NEON_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NEON_CONFIG" >&5 $as_echo "$NEON_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x${NEON_CONFIG}" = "xnone"; then { $as_echo "$as_me:${as_lineno-$LINENO}: no external neon library found" >&5 $as_echo "$as_me: no external neon library found" >&6;} elif test -x "${NEON_CONFIG}"; then # Configure to use an external neon, given a neon-config script # found at $NEON_CONFIG. neon_prefix=`$NEON_CONFIG --prefix` # Check whether the library is of required version ne_save_LIBS="$LIBS" ne_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS `$NEON_CONFIG --cflags`" LIBS="$LIBS `$NEON_CONFIG --libs`" ne_libver=`$NEON_CONFIG --version | sed -e "s/neon //g"` # Check whether it's possible to link against neon { $as_echo "$as_me:${as_lineno-$LINENO}: checking linking against neon" >&5 $as_echo_n "checking linking against neon... " >&6; } if ${ne_cv_lib_neon+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { ne_version_match(0, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ne_cv_lib_neon=yes else ne_cv_lib_neon=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: $ne_cv_lib_neon" >&5 $as_echo "$ne_cv_lib_neon" >&6; } if test "$ne_cv_lib_neon" = "yes"; then ne_cv_lib_neonver=no for v in 27 28 29 30; do case $ne_libver in 0.$v.*) ne_cv_lib_neonver=yes ;; esac done fi ne_goodver=$ne_cv_lib_neonver LIBS=$ne_save_LIBS CFLAGS=$ne_save_CFLAGS if test "$ne_goodver" = "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: using neon library $ne_libver" >&5 $as_echo "$as_me: using neon library $ne_libver" >&6;} # Pick up CFLAGS and LIBS needed CFLAGS="$CFLAGS `$NEON_CONFIG --cflags`" NEON_LIBS="$NEON_LIBS `$NEON_CONFIG --libs`" # Pick up library version set dummy `$NEON_CONFIG --version | sed 's/\./ /g'` NE_VERSION_MAJOR=$3; NE_VERSION_MINOR=$4; NE_VERSION_PATCH=$5 NEON_VERSION="${NE_VERSION_MAJOR}.${NE_VERSION_MINOR}.${NE_VERSION_PATCH}${NE_VERSION_TAG}" cat >>confdefs.h <<_ACEOF #define NEON_VERSION "${NEON_VERSION}" _ACEOF cat >>confdefs.h <<_ACEOF #define NE_VERSION_MAJOR (${NE_VERSION_MAJOR}) _ACEOF cat >>confdefs.h <<_ACEOF #define NE_VERSION_MINOR (${NE_VERSION_MINOR}) _ACEOF cat >>confdefs.h <<_ACEOF #define NE_VERSION_PATCH (${NE_VERSION_PATCH}) _ACEOF neon_library_message="library in ${neon_prefix} (${NEON_VERSION})" neon_xml_parser_message="using whatever neon uses" if $NEON_CONFIG --support ssl >/dev/null; then NE_FLAG_SSL=yes $as_echo "#define NE_HAVE_SSL 1" >>confdefs.h ne_SSL_message="SSL is supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: SSL is supported by neon" >&5 $as_echo "$as_me: SSL is supported by neon" >&6;} else NE_FLAG_SSL=no ne_SSL_message="SSL is not supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: SSL is not supported by neon" >&5 $as_echo "$as_me: SSL is not supported by neon" >&6;} fi if $NEON_CONFIG --support zlib >/dev/null; then NE_FLAG_ZLIB=yes $as_echo "#define NE_HAVE_ZLIB 1" >>confdefs.h ne_ZLIB_message="zlib is supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: zlib is supported by neon" >&5 $as_echo "$as_me: zlib is supported by neon" >&6;} else NE_FLAG_ZLIB=no ne_ZLIB_message="zlib is not supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: zlib is not supported by neon" >&5 $as_echo "$as_me: zlib is not supported by neon" >&6;} fi if $NEON_CONFIG --support ipv6 >/dev/null; then NE_FLAG_IPV6=yes $as_echo "#define NE_HAVE_IPV6 1" >>confdefs.h ne_IPV6_message="IPv6 is supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: IPv6 is supported by neon" >&5 $as_echo "$as_me: IPv6 is supported by neon" >&6;} else NE_FLAG_IPV6=no ne_IPV6_message="IPv6 is not supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: IPv6 is not supported by neon" >&5 $as_echo "$as_me: IPv6 is not supported by neon" >&6;} fi if $NEON_CONFIG --support lfs >/dev/null; then NE_FLAG_LFS=yes $as_echo "#define NE_HAVE_LFS 1" >>confdefs.h ne_LFS_message="LFS is supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: LFS is supported by neon" >&5 $as_echo "$as_me: LFS is supported by neon" >&6;} else NE_FLAG_LFS=no ne_LFS_message="LFS is not supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: LFS is not supported by neon" >&5 $as_echo "$as_me: LFS is not supported by neon" >&6;} fi if $NEON_CONFIG --support socks >/dev/null; then NE_FLAG_SOCKS=yes $as_echo "#define NE_HAVE_SOCKS 1" >>confdefs.h ne_SOCKS_message="SOCKSv5 is supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: SOCKSv5 is supported by neon" >&5 $as_echo "$as_me: SOCKSv5 is supported by neon" >&6;} else NE_FLAG_SOCKS=no ne_SOCKS_message="SOCKSv5 is not supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: SOCKSv5 is not supported by neon" >&5 $as_echo "$as_me: SOCKSv5 is not supported by neon" >&6;} fi if $NEON_CONFIG --support ts_ssl >/dev/null; then NE_FLAG_TS_SSL=yes $as_echo "#define NE_HAVE_TS_SSL 1" >>confdefs.h ne_TS_SSL_message="thread-safe SSL is supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: thread-safe SSL is supported by neon" >&5 $as_echo "$as_me: thread-safe SSL is supported by neon" >&6;} else NE_FLAG_TS_SSL=no ne_TS_SSL_message="thread-safe SSL is not supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: thread-safe SSL is not supported by neon" >&5 $as_echo "$as_me: thread-safe SSL is not supported by neon" >&6;} fi neon_got_library=yes else { $as_echo "$as_me:${as_lineno-$LINENO}: incompatible neon library version $ne_libver: wanted 0.27 28 29 30" >&5 $as_echo "$as_me: incompatible neon library version $ne_libver: wanted 0.27 28 29 30" >&6;} neon_got_library=no fi else { $as_echo "$as_me:${as_lineno-$LINENO}: ignoring non-executable ${NEON_CONFIG}" >&5 $as_echo "$as_me: ignoring non-executable ${NEON_CONFIG}" >&6;} fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for neon library in $neon_ext_path" >&5 $as_echo_n "checking for neon library in $neon_ext_path... " >&6; } NEON_CONFIG="$neon_ext_path/bin/neon-config" if test -x ${NEON_CONFIG}; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: found" >&5 $as_echo "found" >&6; } # Configure to use an external neon, given a neon-config script # found at $NEON_CONFIG. neon_prefix=`$NEON_CONFIG --prefix` # Check whether the library is of required version ne_save_LIBS="$LIBS" ne_save_CFLAGS="$CFLAGS" CFLAGS="$CFLAGS `$NEON_CONFIG --cflags`" LIBS="$LIBS `$NEON_CONFIG --libs`" ne_libver=`$NEON_CONFIG --version | sed -e "s/neon //g"` # Check whether it's possible to link against neon { $as_echo "$as_me:${as_lineno-$LINENO}: checking linking against neon" >&5 $as_echo_n "checking linking against neon... " >&6; } if ${ne_cv_lib_neon+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { ne_version_match(0, 0); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ne_cv_lib_neon=yes else ne_cv_lib_neon=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: $ne_cv_lib_neon" >&5 $as_echo "$ne_cv_lib_neon" >&6; } if test "$ne_cv_lib_neon" = "yes"; then ne_cv_lib_neonver=no for v in 27 28 29 30; do case $ne_libver in 0.$v.*) ne_cv_lib_neonver=yes ;; esac done fi ne_goodver=$ne_cv_lib_neonver LIBS=$ne_save_LIBS CFLAGS=$ne_save_CFLAGS if test "$ne_goodver" = "yes"; then { $as_echo "$as_me:${as_lineno-$LINENO}: using neon library $ne_libver" >&5 $as_echo "$as_me: using neon library $ne_libver" >&6;} # Pick up CFLAGS and LIBS needed CFLAGS="$CFLAGS `$NEON_CONFIG --cflags`" NEON_LIBS="$NEON_LIBS `$NEON_CONFIG --libs`" # Pick up library version set dummy `$NEON_CONFIG --version | sed 's/\./ /g'` NE_VERSION_MAJOR=$3; NE_VERSION_MINOR=$4; NE_VERSION_PATCH=$5 NEON_VERSION="${NE_VERSION_MAJOR}.${NE_VERSION_MINOR}.${NE_VERSION_PATCH}${NE_VERSION_TAG}" cat >>confdefs.h <<_ACEOF #define NEON_VERSION "${NEON_VERSION}" _ACEOF cat >>confdefs.h <<_ACEOF #define NE_VERSION_MAJOR (${NE_VERSION_MAJOR}) _ACEOF cat >>confdefs.h <<_ACEOF #define NE_VERSION_MINOR (${NE_VERSION_MINOR}) _ACEOF cat >>confdefs.h <<_ACEOF #define NE_VERSION_PATCH (${NE_VERSION_PATCH}) _ACEOF neon_library_message="library in ${neon_prefix} (${NEON_VERSION})" neon_xml_parser_message="using whatever neon uses" if $NEON_CONFIG --support ssl >/dev/null; then NE_FLAG_SSL=yes $as_echo "#define NE_HAVE_SSL 1" >>confdefs.h ne_SSL_message="SSL is supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: SSL is supported by neon" >&5 $as_echo "$as_me: SSL is supported by neon" >&6;} else NE_FLAG_SSL=no ne_SSL_message="SSL is not supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: SSL is not supported by neon" >&5 $as_echo "$as_me: SSL is not supported by neon" >&6;} fi if $NEON_CONFIG --support zlib >/dev/null; then NE_FLAG_ZLIB=yes $as_echo "#define NE_HAVE_ZLIB 1" >>confdefs.h ne_ZLIB_message="zlib is supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: zlib is supported by neon" >&5 $as_echo "$as_me: zlib is supported by neon" >&6;} else NE_FLAG_ZLIB=no ne_ZLIB_message="zlib is not supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: zlib is not supported by neon" >&5 $as_echo "$as_me: zlib is not supported by neon" >&6;} fi if $NEON_CONFIG --support ipv6 >/dev/null; then NE_FLAG_IPV6=yes $as_echo "#define NE_HAVE_IPV6 1" >>confdefs.h ne_IPV6_message="IPv6 is supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: IPv6 is supported by neon" >&5 $as_echo "$as_me: IPv6 is supported by neon" >&6;} else NE_FLAG_IPV6=no ne_IPV6_message="IPv6 is not supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: IPv6 is not supported by neon" >&5 $as_echo "$as_me: IPv6 is not supported by neon" >&6;} fi if $NEON_CONFIG --support lfs >/dev/null; then NE_FLAG_LFS=yes $as_echo "#define NE_HAVE_LFS 1" >>confdefs.h ne_LFS_message="LFS is supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: LFS is supported by neon" >&5 $as_echo "$as_me: LFS is supported by neon" >&6;} else NE_FLAG_LFS=no ne_LFS_message="LFS is not supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: LFS is not supported by neon" >&5 $as_echo "$as_me: LFS is not supported by neon" >&6;} fi if $NEON_CONFIG --support socks >/dev/null; then NE_FLAG_SOCKS=yes $as_echo "#define NE_HAVE_SOCKS 1" >>confdefs.h ne_SOCKS_message="SOCKSv5 is supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: SOCKSv5 is supported by neon" >&5 $as_echo "$as_me: SOCKSv5 is supported by neon" >&6;} else NE_FLAG_SOCKS=no ne_SOCKS_message="SOCKSv5 is not supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: SOCKSv5 is not supported by neon" >&5 $as_echo "$as_me: SOCKSv5 is not supported by neon" >&6;} fi if $NEON_CONFIG --support ts_ssl >/dev/null; then NE_FLAG_TS_SSL=yes $as_echo "#define NE_HAVE_TS_SSL 1" >>confdefs.h ne_TS_SSL_message="thread-safe SSL is supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: thread-safe SSL is supported by neon" >&5 $as_echo "$as_me: thread-safe SSL is supported by neon" >&6;} else NE_FLAG_TS_SSL=no ne_TS_SSL_message="thread-safe SSL is not supported by neon" { $as_echo "$as_me:${as_lineno-$LINENO}: thread-safe SSL is not supported by neon" >&5 $as_echo "$as_me: thread-safe SSL is not supported by neon" >&6;} fi neon_got_library=yes else { $as_echo "$as_me:${as_lineno-$LINENO}: incompatible neon library version $ne_libver: wanted 0.27 28 29 30" >&5 $as_echo "$as_me: incompatible neon library version $ne_libver: wanted 0.27 28 29 30" >&6;} neon_got_library=no fi else { $as_echo "$as_me:${as_lineno-$LINENO}: result: not found" >&5 $as_echo "not found" >&6; } fi fi if test "$neon_got_library" = "no"; then as_fn_error $? "could not find neon" "$LINENO" 5 fi # Checks for header files. ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`$as_echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_hdr that defines DIR" >&5 $as_echo_n "checking for $ac_hdr that defines DIR... " >&6; } if eval \${$as_ac_Header+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include <$ac_hdr> int main () { if ((DIR *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$as_ac_Header=yes" else eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$as_ac_Header { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if ${ac_cv_search_opendir+:} 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 opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' dir; 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_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_opendir+:} false; then : break fi done if ${ac_cv_search_opendir+:} false; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing opendir" >&5 $as_echo_n "checking for library containing opendir... " >&6; } if ${ac_cv_search_opendir+:} 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 opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' x; 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_opendir=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_opendir+:} false; then : break fi done if ${ac_cv_search_opendir+:} false; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_opendir" >&5 $as_echo "$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi { $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 fcntl.h libintl.h langinfo.h limits.h locale.h mntent.h stddef.h stdint.h stdlib.h string.h sys/file.h sys/mount.h sys/time.h syslog.h termios.h unistd.h utime.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 # Checks for typedefs, structures, and compiler characteristics. { $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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for uid_t in sys/types.h" >&5 $as_echo_n "checking for uid_t in sys/types.h... " >&6; } if ${ac_cv_type_uid_t+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "uid_t" >/dev/null 2>&1; then : ac_cv_type_uid_t=yes else ac_cv_type_uid_t=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_uid_t" >&5 $as_echo "$ac_cv_type_uid_t" >&6; } if test $ac_cv_type_uid_t = no; then $as_echo "#define uid_t int" >>confdefs.h $as_echo "#define gid_t int" >>confdefs.h fi { $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 ac_fn_c_find_intX_t "$LINENO" "16" "ac_cv_c_int16_t" case $ac_cv_c_int16_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int16_t $ac_cv_c_int16_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "32" "ac_cv_c_int32_t" case $ac_cv_c_int32_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int32_t $ac_cv_c_int32_t _ACEOF ;; esac ac_fn_c_find_intX_t "$LINENO" "8" "ac_cv_c_int8_t" case $ac_cv_c_int8_t in #( no|yes) ;; #( *) cat >>confdefs.h <<_ACEOF #define int8_t $ac_cv_c_int8_t _ACEOF ;; esac ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" if test "x$ac_cv_type_mode_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define mode_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "off_t" "ac_cv_type_off_t" "$ac_includes_default" if test "x$ac_cv_type_off_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define off_t long int _ACEOF fi ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" if test "x$ac_cv_type_pid_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define pid_t int _ACEOF fi ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" if test "x$ac_cv_type_size_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define size_t unsigned int _ACEOF fi ac_fn_c_check_type "$LINENO" "ssize_t" "ac_cv_type_ssize_t" "$ac_includes_default" if test "x$ac_cv_type_ssize_t" = xyes; then : else cat >>confdefs.h <<_ACEOF #define ssize_t int _ACEOF fi ac_fn_c_check_member "$LINENO" "struct stat" "st_blksize" "ac_cv_member_struct_stat_st_blksize" "$ac_includes_default" if test "x$ac_cv_member_struct_stat_st_blksize" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLKSIZE 1 _ACEOF fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5 $as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; } if ${ac_cv_header_time+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include #include int main () { if ((struct tm *) 0) return 0; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_header_time=yes else ac_cv_header_time=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5 $as_echo "$ac_cv_header_time" >&6; } if test $ac_cv_header_time = yes; then $as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether struct tm is in sys/time.h or time.h" >&5 $as_echo_n "checking whether struct tm is in sys/time.h or time.h... " >&6; } if ${ac_cv_struct_tm+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { struct tm tm; int *p = &tm.tm_sec; return !p; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_struct_tm=time.h else ac_cv_struct_tm=sys/time.h fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_struct_tm" >&5 $as_echo "$ac_cv_struct_tm" >&6; } if test $ac_cv_struct_tm = sys/time.h; then $as_echo "#define TM_IN_SYS_TIME 1" >>confdefs.h fi ac_fn_c_find_uintX_t "$LINENO" "32" "ac_cv_c_uint32_t" case $ac_cv_c_uint32_t in #( no|yes) ;; #( *) $as_echo "#define _UINT32_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint32_t $ac_cv_c_uint32_t _ACEOF ;; esac ac_fn_c_find_uintX_t "$LINENO" "64" "ac_cv_c_uint64_t" case $ac_cv_c_uint64_t in #( no|yes) ;; #( *) $as_echo "#define _UINT64_T 1" >>confdefs.h cat >>confdefs.h <<_ACEOF #define uint64_t $ac_cv_c_uint64_t _ACEOF ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5 $as_echo_n "checking for working volatile... " >&6; } if ${ac_cv_c_volatile+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ int main () { volatile int x; int * volatile y = (int *) 0; return !x && !y; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_c_volatile=yes else ac_cv_c_volatile=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_volatile" >&5 $as_echo "$ac_cv_c_volatile" >&6; } if test $ac_cv_c_volatile = no; then $as_echo "#define volatile /**/" >>confdefs.h fi # The cast to long int works around a bug in the HP C Compiler # version HP92453-01 B.11.11.23709.GP, which incorrectly rejects # declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. # This bug is HP SR number 8606223364. { $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5 $as_echo_n "checking size of void *... " >&6; } if ${ac_cv_sizeof_void_p+:} false; then : $as_echo_n "(cached) " >&6 else if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then : else if test "$ac_cv_type_void_p" = 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 77 "cannot compute sizeof (void *) See \`config.log' for more details" "$LINENO" 5; } else ac_cv_sizeof_void_p=0 fi fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5 $as_echo "$ac_cv_sizeof_void_p" >&6; } cat >>confdefs.h <<_ACEOF #define SIZEOF_VOID_P $ac_cv_sizeof_void_p _ACEOF # Checks for library functions. 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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working chown" >&5 $as_echo_n "checking for working chown... " >&6; } if ${ac_cv_func_chown_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_chown_works=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #include int main () { char *f = "conftest.chown"; struct stat before, after; if (creat (f, 0600) < 0) return 1; if (stat (f, &before) < 0) return 1; if (chown (f, (uid_t) -1, (gid_t) -1) == -1) return 1; if (stat (f, &after) < 0) return 1; return ! (before.st_uid == after.st_uid && before.st_gid == after.st_gid); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_chown_works=yes else ac_cv_func_chown_works=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi rm -f conftest.chown fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_chown_works" >&5 $as_echo "$ac_cv_func_chown_works" >&6; } if test $ac_cv_func_chown_works = yes; then $as_echo "#define HAVE_CHOWN 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether closedir returns void" >&5 $as_echo_n "checking whether closedir returns void... " >&6; } if ${ac_cv_func_closedir_void+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_closedir_void=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #include <$ac_header_dirent> #ifndef __cplusplus int closedir (); #endif int main () { return closedir (opendir (".")) != 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_closedir_void=no else ac_cv_func_closedir_void=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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_closedir_void" >&5 $as_echo "$ac_cv_func_closedir_void" >&6; } if test $ac_cv_func_closedir_void = yes; then $as_echo "#define CLOSEDIR_VOID 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for error_at_line" >&5 $as_echo_n "checking for error_at_line... " >&6; } if ${ac_cv_lib_error_at_line+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { error_at_line (0, 0, "", 0, "an error occurred"); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_error_at_line=yes else ac_cv_lib_error_at_line=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_lib_error_at_line" >&5 $as_echo "$ac_cv_lib_error_at_line" >&6; } if test $ac_cv_lib_error_at_line = no; then case " $LIBOBJS " in *" error.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS error.$ac_objext" ;; esac fi for ac_header in vfork.h do : ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" if test "x$ac_cv_header_vfork_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VFORK_H 1 _ACEOF fi done for ac_func in fork vfork 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 if test "x$ac_cv_func_fork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 $as_echo_n "checking for working fork... " >&6; } if ${ac_cv_func_fork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_fork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* By Ruediger Kuhlmann. */ return fork () < 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_fork_works=yes else ac_cv_func_fork_works=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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 $as_echo "$ac_cv_func_fork_works" >&6; } else ac_cv_func_fork_works=$ac_cv_func_fork fi if test "x$ac_cv_func_fork_works" = xcross; then case $host in *-*-amigaos* | *-*-msdosdjgpp*) # Override, as these systems have only a dummy fork() stub ac_cv_func_fork_works=no ;; *) ac_cv_func_fork_works=yes ;; esac { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} fi ac_cv_func_vfork_works=$ac_cv_func_vfork if test "x$ac_cv_func_vfork" = xyes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 $as_echo_n "checking for working vfork... " >&6; } if ${ac_cv_func_vfork_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_vfork_works=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Thanks to Paul Eggert for this test. */ $ac_includes_default #include #ifdef HAVE_VFORK_H # include #endif /* On some sparc systems, changes by the child to local and incoming argument registers are propagated back to the parent. The compiler is told about this with #include , but some compilers (e.g. gcc -O) don't grok . Test for this by using a static variable whose address is put into a register that is clobbered by the vfork. */ static void #ifdef __cplusplus sparc_address_test (int arg) # else sparc_address_test (arg) int arg; #endif { static pid_t child; if (!child) { child = vfork (); if (child < 0) { perror ("vfork"); _exit(2); } if (!child) { arg = getpid(); write(-1, "", 0); _exit (arg); } } } int main () { pid_t parent = getpid (); pid_t child; sparc_address_test (0); child = vfork (); if (child == 0) { /* Here is another test for sparc vfork register problems. This test uses lots of local variables, at least as many local variables as main has allocated so far including compiler temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should reuse the register of parent for one of the local variables, since it will think that parent can't possibly be used any more in this routine. Assigning to the local variable will thus munge parent in the parent process. */ pid_t p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); /* Convince the compiler that p..p7 are live; otherwise, it might use the same hardware register for all 8 local variables. */ if (p != p1 || p != p2 || p != p3 || p != p4 || p != p5 || p != p6 || p != p7) _exit(1); /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent from child file descriptors. If the child closes a descriptor before it execs or exits, this munges the parent's descriptor as well. Test for this by closing stdout in the child. */ _exit(close(fileno(stdout)) != 0); } else { int status; struct stat st; while (wait(&status) != child) ; return ( /* Was there some problem with vforking? */ child < 0 /* Did the child fail? (This shouldn't happen.) */ || status /* Did the vfork/compiler bug occur? */ || parent != getpid() /* Did the file descriptor bug occur? */ || fstat(fileno(stdout), &st) != 0 ); } } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_vfork_works=yes else ac_cv_func_vfork_works=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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 $as_echo "$ac_cv_func_vfork_works" >&6; } fi; if test "x$ac_cv_func_fork_works" = xcross; then ac_cv_func_vfork_works=$ac_cv_func_vfork { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 $as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} fi if test "x$ac_cv_func_vfork_works" = xyes; then $as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h else $as_echo "#define vfork fork" >>confdefs.h fi if test "x$ac_cv_func_fork_works" = xyes; then $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking type of array argument to getgroups" >&5 $as_echo_n "checking type of array argument to getgroups... " >&6; } if ${ac_cv_type_getgroups+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_type_getgroups=cross else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Thanks to Mike Rendell for this test. */ $ac_includes_default #define NGID 256 #undef MAX #define MAX(x, y) ((x) > (y) ? (x) : (y)) int main () { gid_t gidset[NGID]; int i, n; union { gid_t gval; long int lval; } val; val.lval = -1; for (i = 0; i < NGID; i++) gidset[i] = val.gval; n = getgroups (sizeof (gidset) / MAX (sizeof (int), sizeof (gid_t)) - 1, gidset); /* Exit non-zero if getgroups seems to require an array of ints. This happens when gid_t is short int but getgroups modifies an array of ints. */ return n > 0 && gidset[n] != val.gval; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_type_getgroups=gid_t else ac_cv_type_getgroups=int 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 $ac_cv_type_getgroups = cross; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "getgroups.*int.*gid_t" >/dev/null 2>&1; then : ac_cv_type_getgroups=gid_t else ac_cv_type_getgroups=int fi rm -f conftest* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_getgroups" >&5 $as_echo "$ac_cv_type_getgroups" >&6; } cat >>confdefs.h <<_ACEOF #define GETGROUPS_T $ac_cv_type_getgroups _ACEOF ac_fn_c_check_func "$LINENO" "getgroups" "ac_cv_func_getgroups" if test "x$ac_cv_func_getgroups" = xyes; then : fi # If we don't yet have getgroups, see if it's in -lbsd. # This is reported to be necessary on an ITOS 3000WS running SEIUX 3.1. ac_save_LIBS=$LIBS if test $ac_cv_func_getgroups = no; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getgroups in -lbsd" >&5 $as_echo_n "checking for getgroups in -lbsd... " >&6; } if ${ac_cv_lib_bsd_getgroups+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $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 getgroups (); int main () { return getgroups (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_bsd_getgroups=yes else ac_cv_lib_bsd_getgroups=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_bsd_getgroups" >&5 $as_echo "$ac_cv_lib_bsd_getgroups" >&6; } if test "x$ac_cv_lib_bsd_getgroups" = xyes; then : GETGROUPS_LIB=-lbsd fi fi # Run the program to test the functionality of the system-supplied # getgroups function only if there is such a function. if test $ac_cv_func_getgroups = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working getgroups" >&5 $as_echo_n "checking for working getgroups... " >&6; } if ${ac_cv_func_getgroups_works+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_getgroups_works=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { /* On Ultrix 4.3, getgroups (0, 0) always fails. */ return getgroups (0, 0) == -1; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_getgroups_works=yes else ac_cv_func_getgroups_works=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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_getgroups_works" >&5 $as_echo "$ac_cv_func_getgroups_works" >&6; } else ac_cv_func_getgroups_works=no fi if test $ac_cv_func_getgroups_works = yes; then $as_echo "#define HAVE_GETGROUPS 1" >>confdefs.h fi LIBS=$ac_save_LIBS # getmntent is in the standard C library on UNICOS, in -lsun on Irix 4, # -lseq on Dynix/PTX, -lgen on Unixware. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing getmntent" >&5 $as_echo_n "checking for library containing getmntent... " >&6; } if ${ac_cv_search_getmntent+:} 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 getmntent (); int main () { return getmntent (); ; return 0; } _ACEOF for ac_lib in '' sun seq gen; 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_getmntent=$ac_res fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext if ${ac_cv_search_getmntent+:} false; then : break fi done if ${ac_cv_search_getmntent+:} false; then : else ac_cv_search_getmntent=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_getmntent" >&5 $as_echo "$ac_cv_search_getmntent" >&6; } ac_res=$ac_cv_search_getmntent if test "$ac_res" != no; then : test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" ac_cv_func_getmntent=yes $as_echo "#define HAVE_GETMNTENT 1" >>confdefs.h else ac_cv_func_getmntent=no fi if test $ac_cv_c_compiler_gnu = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC needs -traditional" >&5 $as_echo_n "checking whether $CC needs -traditional... " >&6; } if ${ac_cv_prog_gcc_traditional+:} false; then : $as_echo_n "(cached) " >&6 else ac_pattern="Autoconf.*'x'" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Autoconf TIOCGETP _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes else ac_cv_prog_gcc_traditional=no fi rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include Autoconf TCGETA _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "$ac_pattern" >/dev/null 2>&1; then : ac_cv_prog_gcc_traditional=yes fi rm -f conftest* fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_gcc_traditional" >&5 $as_echo "$ac_cv_prog_gcc_traditional" >&6; } if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi { $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 stdlib.h do : ac_fn_c_check_header_mongrel "$LINENO" "stdlib.h" "ac_cv_header_stdlib_h" "$ac_includes_default" if test "x$ac_cv_header_stdlib_h" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STDLIB_H 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU libc compatible malloc" >&5 $as_echo_n "checking for GNU libc compatible malloc... " >&6; } if ${ac_cv_func_malloc_0_nonnull+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_malloc_0_nonnull=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined STDC_HEADERS || defined HAVE_STDLIB_H # include #else char *malloc (); #endif int main () { return ! malloc (0); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_malloc_0_nonnull=yes else ac_cv_func_malloc_0_nonnull=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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_malloc_0_nonnull" >&5 $as_echo "$ac_cv_func_malloc_0_nonnull" >&6; } if test $ac_cv_func_malloc_0_nonnull = yes; then : $as_echo "#define HAVE_MALLOC 1" >>confdefs.h else $as_echo "#define HAVE_MALLOC 0" >>confdefs.h case " $LIBOBJS " in *" malloc.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS malloc.$ac_objext" ;; esac $as_echo "#define malloc rpl_malloc" >>confdefs.h fi for ac_header in sys/select.h sys/socket.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 { $as_echo "$as_me:${as_lineno-$LINENO}: checking types of arguments for select" >&5 $as_echo_n "checking types of arguments for select... " >&6; } if ${ac_cv_func_select_args+:} false; then : $as_echo_n "(cached) " >&6 else for ac_arg234 in 'fd_set *' 'int *' 'void *'; do for ac_arg1 in 'int' 'size_t' 'unsigned long int' 'unsigned int'; do for ac_arg5 in 'struct timeval *' 'const struct timeval *'; do cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #ifdef HAVE_SYS_SELECT_H # include #endif #ifdef HAVE_SYS_SOCKET_H # include #endif int main () { extern int select ($ac_arg1, $ac_arg234, $ac_arg234, $ac_arg234, $ac_arg5); ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_func_select_args="$ac_arg1,$ac_arg234,$ac_arg5"; break 3 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext done done done # Provide a safe default value. : "${ac_cv_func_select_args=int,int *,struct timeval *}" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_select_args" >&5 $as_echo "$ac_cv_func_select_args" >&6; } ac_save_IFS=$IFS; IFS=',' set dummy `echo "$ac_cv_func_select_args" | sed 's/\*/\*/g'` IFS=$ac_save_IFS shift cat >>confdefs.h <<_ACEOF #define SELECT_TYPE_ARG1 $1 _ACEOF cat >>confdefs.h <<_ACEOF #define SELECT_TYPE_ARG234 ($2) _ACEOF cat >>confdefs.h <<_ACEOF #define SELECT_TYPE_ARG5 ($3) _ACEOF rm -f conftest* for ac_func in strftime do : ac_fn_c_check_func "$LINENO" "strftime" "ac_cv_func_strftime" if test "x$ac_cv_func_strftime" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRFTIME 1 _ACEOF else # strftime is in -lintl on SCO UNIX. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for strftime in -lintl" >&5 $as_echo_n "checking for strftime in -lintl... " >&6; } if ${ac_cv_lib_intl_strftime+:} false; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lintl $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 strftime (); int main () { return strftime (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_lib_intl_strftime=yes else ac_cv_lib_intl_strftime=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_intl_strftime" >&5 $as_echo "$ac_cv_lib_intl_strftime" >&6; } if test "x$ac_cv_lib_intl_strftime" = xyes; then : $as_echo "#define HAVE_STRFTIME 1" >>confdefs.h LIBS="-lintl $LIBS" fi fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether lstat correctly handles trailing slash" >&5 $as_echo_n "checking whether lstat correctly handles trailing slash... " >&6; } if ${ac_cv_func_lstat_dereferences_slashed_symlink+:} false; then : $as_echo_n "(cached) " >&6 else rm -f conftest.sym conftest.file echo >conftest.file if test "$as_ln_s" = "ln -s" && ln -s conftest.file conftest.sym; then if test "$cross_compiling" = yes; then : ac_cv_func_lstat_dereferences_slashed_symlink=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; /* Linux will dereference the symlink and fail, as required by POSIX. That is better in the sense that it means we will not have to compile and use the lstat wrapper. */ return lstat ("conftest.sym/", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_lstat_dereferences_slashed_symlink=yes else ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi else # If the `ln -s' command failed, then we probably don't even # have an lstat function. ac_cv_func_lstat_dereferences_slashed_symlink=no fi rm -f conftest.sym conftest.file fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_lstat_dereferences_slashed_symlink" >&5 $as_echo "$ac_cv_func_lstat_dereferences_slashed_symlink" >&6; } test $ac_cv_func_lstat_dereferences_slashed_symlink = yes && cat >>confdefs.h <<_ACEOF #define LSTAT_FOLLOWS_SLASHED_SYMLINK 1 _ACEOF if test "x$ac_cv_func_lstat_dereferences_slashed_symlink" = xno; then case " $LIBOBJS " in *" lstat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stat accepts an empty string" >&5 $as_echo_n "checking whether stat accepts an empty string... " >&6; } if ${ac_cv_func_stat_empty_string_bug+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_stat_empty_string_bug=yes else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int main () { struct stat sbuf; return stat ("", &sbuf) == 0; ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_stat_empty_string_bug=no else ac_cv_func_stat_empty_string_bug=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_stat_empty_string_bug" >&5 $as_echo "$ac_cv_func_stat_empty_string_bug" >&6; } if test $ac_cv_func_stat_empty_string_bug = yes; then case " $LIBOBJS " in *" stat.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS stat.$ac_objext" ;; esac cat >>confdefs.h <<_ACEOF #define HAVE_STAT_EMPTY_STRING_BUG 1 _ACEOF fi for ac_header in $ac_header_list do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default " if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether utime accepts a null argument" >&5 $as_echo_n "checking whether utime accepts a null argument... " >&6; } if ${ac_cv_func_utime_null+:} false; then : $as_echo_n "(cached) " >&6 else rm -f conftest.data; >conftest.data # Sequent interprets utime(file, 0) to mean use start of epoch. Wrong. if test "$cross_compiling" = yes; then : ac_cv_func_utime_null='guessing yes' else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default #ifdef HAVE_UTIME_H # include #endif int main () { struct stat s, t; return ! (stat ("conftest.data", &s) == 0 && utime ("conftest.data", 0) == 0 && stat ("conftest.data", &t) == 0 && t.st_mtime >= s.st_mtime && t.st_mtime - s.st_mtime < 120); ; return 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_utime_null=yes else ac_cv_func_utime_null=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 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_utime_null" >&5 $as_echo "$ac_cv_func_utime_null" >&6; } if test "x$ac_cv_func_utime_null" != xno; then ac_cv_func_utime_null=yes $as_echo "#define HAVE_UTIME_NULL 1" >>confdefs.h fi rm -f conftest.data for ac_func in endpwent ftruncate getmntent memset mkdir nl_langinfo rpmatch select setlocale strcasecmp strchr strdup strerror strpbrk strrchr strstr strtol strtoull utime 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 # Misc. if test -z "$dav_user"; then dav_user="davfs2"; fi if test -z "$dav_group"; then dav_group="davfs2"; fi if test -z "$ssbindir"; then ssbindir="/sbin"; fi if test -z "$dav_localstatedir"; then dav_localstatedir="/var/run"; fi if test -z "$dav_syscachedir"; then dav_syscachedir="/var/cache"; fi if test "$ne_LFS_message" = "LFS is supported by neon"; 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 if test "$ac_cv_sys_file_offset_bits" = "64"; then dav_lfs=yes else dav_lfs=no fi dav_desired_linguas="${LINGUAS-%UNSET%}" dav_all_linguas= if test -f "man/po4a.conf"; then dav_all_linguas="`cat 'man/po4a.conf' | grep 'po4a_langs' | sed 's/.po4a_langs.//'`" fi dav_linguas= if test "$dav_desired_linguas" == "%UNSET%"; then dav_linguas="$dav_all_linguas" else for dav_lingua in $dav_desired_linguas; do case "$dav_all_linguas" in *"$dav_lingua"*) dav_linguas="$dav_linguas $dav_lingua";; esac done fi $as_echo "#define _GNU_SOURCE 1" >>confdefs.h ac_config_files="$ac_config_files Makefile po/Makefile.in etc/Makefile man/Makefile man/de/Makefile man/es/Makefile src/Makefile" 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 if test -n "$EXEEXT"; then am__EXEEXT_TRUE= am__EXEEXT_FALSE='#' else am__EXEEXT_TRUE='#' am__EXEEXT_FALSE= 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 : "${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 davfs2 $as_me 1.5.2, 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 ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" ac_cs_version="\\ davfs2 config.status 1.5.2 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" # Capture the value of obsolete ALL_LINGUAS because we need it to compute # POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES, CATALOGS. But hide it # from automake < 1.5. eval 'OBSOLETE_ALL_LINGUAS''="$ALL_LINGUAS"' # Capture the value of LINGUAS because we need it to compute CATALOGS. LINGUAS="${LINGUAS-%UNSET%}" _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 "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;; "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "po-directories") CONFIG_COMMANDS="$CONFIG_COMMANDS po-directories" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "po/Makefile.in") CONFIG_FILES="$CONFIG_FILES po/Makefile.in" ;; "etc/Makefile") CONFIG_FILES="$CONFIG_FILES etc/Makefile" ;; "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; "man/de/Makefile") CONFIG_FILES="$CONFIG_FILES man/de/Makefile" ;; "man/es/Makefile") CONFIG_FILES="$CONFIG_FILES man/es/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; *) 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"" || { # Autoconf 2.62 quotes --file arguments for eval, but not when files # are listed without --file. Let's play safe and only enable the eval # if we detect the quoting. case $CONFIG_FILES in *\'*) eval set x "$CONFIG_FILES" ;; *) set x $CONFIG_FILES ;; esac shift for mf do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || $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"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || $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 } ;; "po-directories":C) for ac_file in $CONFIG_FILES; do # Support "outfile[:infile[:infile...]]" case "$ac_file" in *:*) ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; esac # PO directories have a Makefile.in generated from Makefile.in.in. case "$ac_file" in */Makefile.in) # Adjust a relative srcdir. ac_dir=`echo "$ac_file"|sed 's%/[^/][^/]*$%%'` ac_dir_suffix="/`echo "$ac_dir"|sed 's%^\./%%'`" ac_dots=`echo "$ac_dir_suffix"|sed 's%/[^/]*%../%g'` # In autoconf-2.13 it is called $ac_given_srcdir. # In autoconf-2.50 it is called $srcdir. test -n "$ac_given_srcdir" || ac_given_srcdir="$srcdir" case "$ac_given_srcdir" in .) top_srcdir=`echo $ac_dots|sed 's%/$%%'` ;; /*) top_srcdir="$ac_given_srcdir" ;; *) top_srcdir="$ac_dots$ac_given_srcdir" ;; esac # Treat a directory as a PO directory if and only if it has a # POTFILES.in file. This allows packages to have multiple PO # directories under different names or in different locations. if test -f "$ac_given_srcdir/$ac_dir/POTFILES.in"; then rm -f "$ac_dir/POTFILES" test -n "$as_me" && echo "$as_me: creating $ac_dir/POTFILES" || echo "creating $ac_dir/POTFILES" cat "$ac_given_srcdir/$ac_dir/POTFILES.in" | sed -e "/^#/d" -e "/^[ ]*\$/d" -e "s,.*, $top_srcdir/& \\\\," | sed -e "\$s/\(.*\) \\\\/\1/" > "$ac_dir/POTFILES" POMAKEFILEDEPS="POTFILES.in" # ALL_LINGUAS, POFILES, UPDATEPOFILES, DUMMYPOFILES, GMOFILES depend # on $ac_dir but don't depend on user-specified configuration # parameters. if test -f "$ac_given_srcdir/$ac_dir/LINGUAS"; then # The LINGUAS file contains the set of available languages. if test -n "$OBSOLETE_ALL_LINGUAS"; then test -n "$as_me" && echo "$as_me: setting ALL_LINGUAS in configure.in is obsolete" || echo "setting ALL_LINGUAS in configure.in is obsolete" fi ALL_LINGUAS_=`sed -e "/^#/d" -e "s/#.*//" "$ac_given_srcdir/$ac_dir/LINGUAS"` # Hide the ALL_LINGUAS assigment from automake < 1.5. eval 'ALL_LINGUAS''=$ALL_LINGUAS_' POMAKEFILEDEPS="$POMAKEFILEDEPS LINGUAS" else # The set of available languages was given in configure.in. # Hide the ALL_LINGUAS assigment from automake < 1.5. eval 'ALL_LINGUAS''=$OBSOLETE_ALL_LINGUAS' fi # Compute POFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).po) # Compute UPDATEPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).po-update) # Compute DUMMYPOFILES # as $(foreach lang, $(ALL_LINGUAS), $(lang).nop) # Compute GMOFILES # as $(foreach lang, $(ALL_LINGUAS), $(srcdir)/$(lang).gmo) case "$ac_given_srcdir" in .) srcdirpre= ;; *) srcdirpre='$(srcdir)/' ;; esac POFILES= UPDATEPOFILES= DUMMYPOFILES= GMOFILES= for lang in $ALL_LINGUAS; do POFILES="$POFILES $srcdirpre$lang.po" UPDATEPOFILES="$UPDATEPOFILES $lang.po-update" DUMMYPOFILES="$DUMMYPOFILES $lang.nop" GMOFILES="$GMOFILES $srcdirpre$lang.gmo" done # CATALOGS depends on both $ac_dir and the user's LINGUAS # environment variable. INST_LINGUAS= if test -n "$ALL_LINGUAS"; then for presentlang in $ALL_LINGUAS; do useit=no if test "%UNSET%" != "$LINGUAS"; then desiredlanguages="$LINGUAS" else desiredlanguages="$ALL_LINGUAS" fi for desiredlang in $desiredlanguages; do # Use the presentlang catalog if desiredlang is # a. equal to presentlang, or # b. a variant of presentlang (because in this case, # presentlang can be used as a fallback for messages # which are not translated in the desiredlang catalog). case "$desiredlang" in "$presentlang"*) useit=yes;; esac done if test $useit = yes; then INST_LINGUAS="$INST_LINGUAS $presentlang" fi done fi CATALOGS= if test -n "$INST_LINGUAS"; then for lang in $INST_LINGUAS; do CATALOGS="$CATALOGS $lang.gmo" done fi test -n "$as_me" && echo "$as_me: creating $ac_dir/Makefile" || echo "creating $ac_dir/Makefile" sed -e "/^POTFILES =/r $ac_dir/POTFILES" -e "/^# Makevars/r $ac_given_srcdir/$ac_dir/Makevars" -e "s|@POFILES@|$POFILES|g" -e "s|@UPDATEPOFILES@|$UPDATEPOFILES|g" -e "s|@DUMMYPOFILES@|$DUMMYPOFILES|g" -e "s|@GMOFILES@|$GMOFILES|g" -e "s|@CATALOGS@|$CATALOGS|g" -e "s|@POMAKEFILEDEPS@|$POMAKEFILEDEPS|g" "$ac_dir/Makefile.in" > "$ac_dir/Makefile" for f in "$ac_given_srcdir/$ac_dir"/Rules-*; do if test -f "$f"; then case "$f" in *.orig | *.bak | *~) ;; *) cat "$f" >> "$ac_dir/Makefile" ;; esac fi done fi ;; esac done ;; 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 if test "$USE_NLS" = "yes"; then dav_nls=${gt_source} else dav_nls=no fi cat<