pax_global_header00006660000000000000000000000064130662317770014526gustar00rootroot0000000000000052 comment=5625eb36ef823a58be6308a5a58e909f97e8757d hubicfuse-3.0.1/000077500000000000000000000000001306623177700135045ustar00rootroot00000000000000hubicfuse-3.0.1/.gitignore000066400000000000000000000001641306623177700154750ustar00rootroot00000000000000# Created by configure Makefile config.h config.log config.status # Binary outputs cloudfuse hubicfuse project-vc/hubicfuse-3.0.1/.hubicfuse.sample000066400000000000000000000004301306623177700167370ustar00rootroot00000000000000client_id = api_hubic_xxxxx client_secret = xxxxxx refresh_token = xxxx cache_timeout = 600 temp_dir = /tmp/hubicfuse get_extended_metadata = true curl_verbose = false curl_progress_state = true cache_statfs_timeout = 15 debug_level = 0 enable_chmod = false enable_chown = false hubicfuse-3.0.1/LICENSE000066400000000000000000000020431306623177700145100ustar00rootroot00000000000000Copyright (c) 2009 Michael Barton Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. hubicfuse-3.0.1/Makefile.in000066400000000000000000000030501306623177700155470ustar00rootroot00000000000000.SUFFIXES: .SUFFIXES: .c .o CC = @CC@ CPPFLAGS = @CPPFLAGS@ CFLAGS = @CFLAGS@ @XML_CFLAGS@ @CURL_CFLAGS@ @FUSE_CFLAGS@ @OPENSSL_CFLAGS@ @JSON_CFLAGS@ LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ @XML_LIBS@ @CURL_LIBS@ @FUSE_LIBS@ @OPENSSL_LIBS@ @JSON_LIBS@ -lmagic INSTALL = @INSTALL@ MKDIR_P = @MKDIR_P@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = $(DESTDIR)$(exec_prefix)/bin SOURCES=cloudfsapi.c cloudfuse.c commonfs.c HEADERS=cloudfsapi.h commonfs.h all: hubicfuse install: all $(bindir) $(INSTALL) hubicfuse $(bindir)/hubicfuse uninstall: /bin/rm -f $(bindir)/hubicfuse $(bindir): $(MKDIR_P) $(bindir) hubicfuse: $(SOURCES) $(HEADERS) $(CC) $(CPPFLAGS) $(CFLAGS) -o hubicfuse $(SOURCES) $(LIBS) $(LDFLAGS) clean: /bin/rm -fr hubicfuse *.orig config.h *~ aclocal.m4 autom4te.cache distclean: clean /bin/rm -f Makefile config.h config.status config.cache config.log \ marklib.dvi mostlyclean: clean maintainer-clean: clean debug: CFLAGS += -g debug: hubicfuse config.h.in: stamp-h.in stamp-h.in: configure.in autoheader echo timestamp > stamp-h.in config.h: stamp-h stamp-h: config.h.in config.status ./config.status Makefile: Makefile.in config.status ./config.status config.status: configure ./config.status --recheck reformat: astyle --style=allman \ --convert-tabs \ --indent=spaces=2 \ --lineend=linux \ --max-code-length=79 \ --pad-oper \ --pad-header \ --align-pointer=type \ --align-reference=name \ --break-closing-brackets \ --min-conditional-indent=0 \ --remove-brackets \ --remove-comment-prefix \ *.c *.h hubicfuse-3.0.1/README.md000066400000000000000000000141501306623177700147640ustar00rootroot00000000000000# HubicFuse A FUSE application which provides access to hubiC's cloud files via a mount-point. This version contains support for DLO, symlinks and support to see other tenant's containers. Those features are coming from https://github.com/LabAdvComp/cloudfuse ### BUILDING You'll need libcurl, fuse, libssl, and libxml2 (and probably their development packages) installed to build it. For CentOS and other RedHat-based systems: yum install gcc make fuse-devel curl-devel libxml2-devel \ openssl-devel json-c-devel file-devel PKG_CONFIG_PATH=/lib64/pkgconfig ./configure For Debian GNU/Linux and Ubuntu: sudo apt install gcc make curl libfuse-dev pkg-config \ libcurl4-openssl-dev libxml2-dev libssl-dev libjson-c-dev libmagic-dev ./configure Then just compile and install: make sudo make install ### USAGE Your hubiC Cloud configuration can be placed in a file named `$HOME/.hubicfuse`. All the following variables are required: client_id=[hubiC client id for the registered application] client_secret=[hubiC client secret for the registered application] refresh_token=[A refresh token you got from the script] Optional variables: get_extended_metadata=[true/false, force download of additional file metadata like atime and mtime on first directory list] curl_verbose=[true/false, enable verbose output for curl HTTP requests] curl_progress_state=[true/false, enable verbose progress output for curl HTTP requests. Used for debugging.] cache_statfs_timeout=[value in seconds, large timeout increases the file access speed] debug_level=[0 default, 1 extremely verbose for debugging purposes] enable_chmod=[true/false, false by default, still experimental feature] enable_chown=[true/false, false by default, still experimental feature] `client_id` and `client_secret` can be retrieved from the [hubiC web interface](https://hubic.com/home/browser/developers/) The `refresh_token` can be obtained running the script provided (`hubic_token`) or with any other method you like if you follow the example at https://api.hubic.com/ Then you can call hubicfuse: sudo hubicfuse /mnt/hubic -o noauto_cache,sync_read,allow_other And finaly, it can be set in /etc/fstab: hubicfuse /mnt/hubic fuse user,noauto 0 0 It also inherits a number of command-line arguments and mount options from the Fuse framework. The "-h" argument should provide a summary. It is also possible to pass a custom hubicfuse settings file so that it is possible to mount multiple hubiC accounts: sudo hubicfuse /mnt/hubic1 -o noauto_cache,sync_read,allow_other,settings_filename=/root/hubic/account1.settings sudo hubicfuse /mnt/hubic2 -o noauto_cache,sync_read,allow_other,settings_filename=/root/hubic/account2.settings And finaly, in /etc/fstab : hubicfuse /mnt/hubic1 fuse user,noauto,settings_filename=/root/hubic/account1.settings 0 0 hubicfuse /mnt/hubic2 fuse user,noauto,settings_filename=/root/hubic/account2.settings 0 0 ### USAGE AS NON-ROOT Add the user into the fuse group: sudo usermod -a -G fuse [username] Mount using the above command without the sudo. The `.hubicfuse` file is searched in the user's home. To unmount use: fusermount -u [chemin] ### USAGE WITH RSYNC hubiC protocol has no support for renaming. So be sure to use the `--inplace` option to avoid a second upload for every uploaded object. ### BUGS AND SHORTCOMINGS * A segment size is limited to 5Gb (this is not hubicfuse limit, but hubiC implementation). So segment_above should never exceed 5Gb. * rename() doesn't work on directories (and probably never will). * When reading and writing files, it buffers them in a local temp file. * It keeps an in-memory cache of the directory structure, so it may not be usable for large file systems. Also, files added by other applications will not show up until the cache expires. * The root directory can only contain directories, as these are mapped to containers in cloudfiles. * Directory entries are created as empty files with the content-type "application/directory". * Cloud Files limits container and object listings to 10,000 items. cloudfuse won't list more than that many files in a single directory. * File copy progress when uploading does not work, progress is shown when file is copied in local cache, then upload operation happens at 100% ### RECENT ADDITIONS AND FIXES * Support for atime, mtime, chmod, chown. * Large files (segmented) have correct size listed (was 0 before). * Multiple speed improvements, minimised the number of HTTP calls and added more caching features. * Fixed many segmentation faults. * Cached files are deleted on cache expiration when using a custom temp folder. * Files copied have attributes preserved. * Working well with rsync due to mtime support and proper copy operations. * Debugging support for http progress (track upload / download speed etc.) * Reduced traffic, skips file uploads to cloud if content does not change (using md5sum compare) * Major code refactoring, code documentation, extensive debugging, additional config options * Support for custom hubicfuse settings file in order to mount multiple accounts AWESOME CONTRIBUTORS * Pascal Obry https://github.com/TurboGit * Tim Dysinger https://github.com/dysinger * Chris Wedgwood https://github.com/cwedgwood * Nick Craig-Wood https://github.com/ncw * Dillon Amburgey https://github.com/dillona * Manfred Touron https://github.com/moul * David Brownlee https://github.com/abs0 * Mike Lundy https://github.com/novas0x2a * justinb https://github.com/justinsb * Matt Greenway https://github.com/LabAdvComp * Dan Cristian https://github.com/dan-cristian * Nicolas Cailleaux https://github.com/nikokio Thanks, and I hope you find it useful. Pascal Obry hubicfuse-3.0.1/cloudfsapi.c000066400000000000000000001642711306623177700160140ustar00rootroot00000000000000#define _GNU_SOURCE #include #include #include #include #include #include #include #ifdef __linux__ #include #endif #include #include #include #include #include #include #include #include #include #include #include #include "commonfs.h" #include "cloudfsapi.h" #include "config.h" #define FUSE_USE_VERSION 30 #include #define RHEL5_LIBCURL_VERSION 462597 #define RHEL5_CERTIFICATE_FILE "/etc/pki/tls/certs/ca-bundle.crt" #define REQUEST_RETRIES 3 #define MAX_FILES 10000 // size of buffer for writing to disk look at ioblksize.h in coreutils // and try some values on your own system if you want the best performance #define DISK_BUFF_SIZE 32768 static char storage_url[MAX_URL_SIZE]; static char storage_token[MAX_HEADER_SIZE]; static pthread_mutex_t pool_mut; static CURL* curl_pool[1024]; static int curl_pool_count = 0; extern int debug; extern int verify_ssl; extern bool option_get_extended_metadata; extern bool option_curl_verbose; extern int option_curl_progress_state; extern int option_cache_statfs_timeout; extern bool option_extensive_debug; extern bool option_enable_chown; extern bool option_enable_chmod; static int rhel5_mode = 0; static struct statvfs statcache = { .f_bsize = 4096, .f_frsize = 4096, .f_blocks = INT_MAX, .f_bfree = INT_MAX, .f_bavail = INT_MAX, .f_files = MAX_FILES, .f_ffree = 0, .f_favail = 0, .f_namemax = INT_MAX }; //used to compute statfs cache interval static time_t last_stat_read_time = 0; extern FuseOptions options; struct MemoryStruct { char* memory; size_t size; }; #ifdef HAVE_OPENSSL #include static pthread_mutex_t* ssl_lockarray; static void lock_callback(int mode, int type, char* file, int line) { if (mode & CRYPTO_LOCK) pthread_mutex_lock(&(ssl_lockarray[type])); else pthread_mutex_unlock(&(ssl_lockarray[type])); } static unsigned long thread_id() { return (unsigned long)pthread_self(); } #endif static size_t xml_dispatch(void* ptr, size_t size, size_t nmemb, void* stream) { xmlParseChunk((xmlParserCtxtPtr)stream, (char*)ptr, size * nmemb, 0); return size * nmemb; } static CURL* get_connection(const char* path) { pthread_mutex_lock(&pool_mut); CURL* curl = curl_pool_count ? curl_pool[--curl_pool_count] : curl_easy_init(); if (!curl) { debugf(DBG_LEVEL_NORM, KRED"curl alloc failed"); abort(); } pthread_mutex_unlock(&pool_mut); return curl; } static void return_connection(CURL* curl) { pthread_mutex_lock(&pool_mut); curl_pool[curl_pool_count++] = curl; pthread_mutex_unlock(&pool_mut); } static void add_header(curl_slist** headers, const char* name, const char* value) { char x_header[MAX_HEADER_SIZE]; char safe_value[256]; const char* value_ptr; debugf(DBG_LEVEL_EXT, "add_header(%s:%s)", name, value); if (strlen(value) > 256) { debugf(DBG_LEVEL_NORM, KRED"add_header: warning, value size > 256 (%s:%s) ", name, value); //hubic will throw an HTTP 400 error on X-Copy-To operation if X-Object-Meta-FilePath header value is larger than 256 chars //fix for issue #95 https://github.com/TurboGit/hubicfuse/issues/95 if (!strcasecmp(name, "X-Object-Meta-FilePath")) { debugf(DBG_LEVEL_NORM, KRED"add_header: trimming header (%s) value to max allowed", name); //trim header size to max allowed strncpy(safe_value, value, 256 - 1); safe_value[255] = '\0'; value_ptr = safe_value; } else value_ptr = value; } else value_ptr = value; snprintf(x_header, sizeof(x_header), "%s: %s", name, value_ptr); *headers = curl_slist_append(*headers, x_header); } static size_t header_dispatch(void* ptr, size_t size, size_t nmemb, void* dir_entry) { char* header = (char*)alloca(size * nmemb + 1); char* head = (char*)alloca(size * nmemb + 1); char* value = (char*)alloca(size * nmemb + 1); memcpy(header, (char*)ptr, size * nmemb); header[size * nmemb] = '\0'; if (sscanf(header, "%[^:]: %[^\r\n]", head, value) == 2) { if (!strncasecmp(head, "x-auth-token", size * nmemb)) strncpy(storage_token, value, sizeof(storage_token)); if (!strncasecmp(head, "x-storage-url", size * nmemb)) strncpy(storage_url, value, sizeof(storage_url)); if (!strncasecmp(head, "x-account-meta-quota", size * nmemb)) statcache.f_blocks = (unsigned long) (strtoull(value, NULL, 10) / statcache.f_frsize); if (!strncasecmp(head, "x-account-bytes-used", size * nmemb)) statcache.f_bfree = statcache.f_bavail = statcache.f_blocks - (unsigned long) ( strtoull(value, NULL, 10) / statcache.f_frsize); if (!strncasecmp(head, "x-account-object-count", size * nmemb)) { unsigned long object_count = strtoul(value, NULL, 10); statcache.f_ffree = MAX_FILES - object_count; statcache.f_favail = MAX_FILES - object_count; } } return size * nmemb; } static void header_set_time_from_str(char* time_str, struct timespec* time_entry) { char sec_value[TIME_CHARS] = { 0 }; char nsec_value[TIME_CHARS] = { 0 }; time_t sec; long nsec; sscanf(time_str, "%[^.].%[^\n]", sec_value, nsec_value); sec = strtoll(sec_value, NULL, 10);//to allow for larger numbers nsec = atol(nsec_value); debugf(DBG_LEVEL_EXTALL, "Received time=%s.%s / %li.%li, existing=%li.%li", sec_value, nsec_value, sec, nsec, time_entry->tv_sec, time_entry->tv_nsec); if (sec != time_entry->tv_sec || nsec != time_entry->tv_nsec) { debugf(DBG_LEVEL_EXTALL, "Time changed, setting new time=%li.%li, existing was=%li.%li", sec, nsec, time_entry->tv_sec, time_entry->tv_nsec); time_entry->tv_sec = sec; time_entry->tv_nsec = nsec; char time_str_local[TIME_CHARS] = ""; get_time_as_string((time_t)sec, nsec, time_str_local, sizeof(time_str_local)); debugf(DBG_LEVEL_EXTALL, "header_set_time_from_str received time=[%s]", time_str_local); get_timespec_as_str(time_entry, time_str_local, sizeof(time_str_local)); debugf(DBG_LEVEL_EXTALL, "header_set_time_from_str set time=[%s]", time_str_local); } } static size_t header_get_meta_dispatch(void* ptr, size_t size, size_t nmemb, void* userdata) { char* header = (char*)alloca(size * nmemb + 1); char* head = (char*)alloca(size * nmemb + 1); char* value = (char*)alloca(size * nmemb + 1); memcpy(header, (char*)ptr, size * nmemb); header[size * nmemb] = '\0'; static char storage[MAX_HEADER_SIZE]; if (sscanf(header, "%[^:]: %[^\r\n]", head, value) == 2) { strncpy(storage, head, sizeof(storage)); dir_entry* de = (dir_entry*)userdata; if (de != NULL) { if (!strncasecmp(head, HEADER_TEXT_ATIME, size * nmemb)) header_set_time_from_str(value, &de->atime); if (!strncasecmp(head, HEADER_TEXT_CTIME, size * nmemb)) header_set_time_from_str(value, &de->ctime); if (!strncasecmp(head, HEADER_TEXT_MTIME, size * nmemb)) header_set_time_from_str(value, &de->mtime); if (!strncasecmp(head, HEADER_TEXT_CHMOD, size * nmemb)) de->chmod = atoi(value); if (!strncasecmp(head, HEADER_TEXT_GID, size * nmemb)) de->gid = atoi(value); if (!strncasecmp(head, HEADER_TEXT_UID, size * nmemb)) de->uid = atoi(value); } else debugf(DBG_LEVEL_EXT, "Unexpected NULL dir_entry on header(%s), file should be in cache already", storage); } else { //debugf(DBG_LEVEL_NORM, "Received unexpected header line"); } return size * nmemb; } static size_t rw_callback(size_t (*rw)(void*, size_t, size_t, FILE*), void* ptr, size_t size, size_t nmemb, void* userp) { struct segment_info* info = (struct segment_info*)userp; size_t mem = size * nmemb; if (mem < 1 || info->size < 1) return 0; size_t amt_read = rw(ptr, 1, info->size < mem ? info->size : mem, info->fp); info->size -= amt_read; return amt_read; } size_t fwrite2(void* ptr, size_t size, size_t nmemb, FILE* filep) { return fwrite((const void*)ptr, size, nmemb, filep); } static size_t read_callback(void* ptr, size_t size, size_t nmemb, void* userp) { return rw_callback(fread, ptr, size, nmemb, userp); } static size_t write_callback(void* ptr, size_t size, size_t nmemb, void* userp) { return rw_callback(fwrite2, ptr, size, nmemb, userp); } //http://curl.haxx.se/libcurl/c/CURLOPT_XFERINFOFUNCTION.html int progress_callback_xfer(void* clientp, curl_off_t dltotal, curl_off_t dlnow, curl_off_t ultotal, curl_off_t ulnow) { struct curl_progress* myp = (struct curl_progress*)clientp; CURL* curl = myp->curl; double curtime = 0; double dspeed = 0, uspeed = 0; curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &curtime); curl_easy_getinfo(curl, CURLINFO_SPEED_DOWNLOAD, &dspeed); curl_easy_getinfo(curl, CURLINFO_SPEED_UPLOAD, &uspeed); /* under certain circumstances it may be desirable for certain functionality to only run every N seconds, in order to do this the transaction time can be used */ //http://curl.haxx.se/cvssource/src/tool_cb_prg.c if ((curtime - myp->lastruntime) >= MINIMAL_PROGRESS_FUNCTIONALITY_INTERVAL) { myp->lastruntime = curtime; curl_off_t total; curl_off_t point; double frac, percent; total = dltotal + ultotal; point = dlnow + ulnow; frac = (double)point / (double)total; percent = frac * 100.0f; debugf(DBG_LEVEL_EXT, "TOTAL TIME: %.0f sec Down=%.0f Kbps UP=%.0f Kbps", curtime, dspeed / 1024, uspeed / 1024); debugf(DBG_LEVEL_EXT, "UP: %lld of %lld DOWN: %lld/%lld Completion %.1f %%", ulnow, ultotal, dlnow, dltotal, percent); } return 0; } //http://curl.haxx.se/libcurl/c/CURLOPT_PROGRESSFUNCTION.html int progress_callback(void* clientp, double dltotal, double dlnow, double ultotal, double ulnow) { return progress_callback_xfer(clientp, (curl_off_t)dltotal, (curl_off_t)dlnow, (curl_off_t)ultotal, (curl_off_t)ulnow); } //get the response from HTTP requests, mostly for debug purposes // http://stackoverflow.com/questions/2329571/c-libcurl-get-output-into-a-string // http://curl.haxx.se/libcurl/c/getinmemory.html size_t writefunc_callback(void* contents, size_t size, size_t nmemb, void* userp) { size_t realsize = size * nmemb; struct MemoryStruct* mem = (struct MemoryStruct*)userp; mem->memory = realloc(mem->memory, mem->size + realsize + 1); if (mem->memory == NULL) { /* out of memory! */ debugf(DBG_LEVEL_NORM, KRED"writefunc_callback: realloc() failed"); return 0; } memcpy(&(mem->memory[mem->size]), contents, realsize); mem->size += realsize; mem->memory[mem->size] = 0; return realsize; } // de_cached_entry must be NULL when the file is already in global cache // otherwise point to a new dir_entry that will be added to the cache (usually happens on first dir load) static int send_request_size(const char* method, const char* path, void* fp, xmlParserCtxtPtr xmlctx, curl_slist* extra_headers, off_t file_size, int is_segment, dir_entry* de_cached_entry, const char* unencoded_path) { debugf(DBG_LEVEL_EXT, "send_request_size(%s) (%s)", method, path); char url[MAX_URL_SIZE]; char orig_path[MAX_URL_SIZE]; char header_data[MAX_HEADER_SIZE]; char* slash; long response = -1; int tries = 0; //needed to keep the response data, for debug purposes struct MemoryStruct chunk; if (!storage_url[0]) { debugf(DBG_LEVEL_NORM, KRED"send_request with no storage_url?"); abort(); } //char *encoded_path = curl_escape(path, 0); while ((slash = strstr(path, "%2F")) || (slash = strstr(path, "%2f"))) { *slash = '/'; memmove(slash + 1, slash + 3, strlen(slash + 3) + 1); } while (*path == '/') path++; snprintf(url, sizeof(url), "%s/%s", storage_url, path); snprintf(orig_path, sizeof(orig_path), "/%s", path); // retry on failures for (tries = 0; tries < REQUEST_RETRIES; tries++) { chunk.memory = malloc(1); /* will be grown as needed by the realloc above */ chunk.size = 0; /* no data at this point */ CURL* curl = get_connection(path); if (rhel5_mode) curl_easy_setopt(curl, CURLOPT_CAINFO, RHEL5_CERTIFICATE_FILE); curl_slist* headers = NULL; curl_easy_setopt(curl, CURLOPT_URL, url); curl_easy_setopt(curl, CURLOPT_HEADER, 0); curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); //reversed logic, 0=to enable curl progress curl_easy_setopt(curl, CURLOPT_NOPROGRESS, option_curl_progress_state ? 0 : 1); curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, verify_ssl ? 1 : 0); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, verify_ssl); curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10); curl_easy_setopt(curl, CURLOPT_VERBOSE, option_curl_verbose ? 1 : 0); add_header(&headers, "X-Auth-Token", storage_token); dir_entry* de; if (de_cached_entry == NULL) de = check_path_info(unencoded_path); else { // updating metadata on a file about to be added to cache (for x-copy, dest meta = src meta) de = de_cached_entry; debugf(DBG_LEVEL_EXTALL, "send_request_size: using param dir_entry(%s)", orig_path); } if (!de) debugf(DBG_LEVEL_EXTALL, "send_request_size: "KYEL"file not in cache (%s)(%s)(%s)", orig_path, path, unencoded_path); else { // add headers to save utimens attribs only on upload if (!strcasecmp(method, "PUT") || !strcasecmp(method, "MKDIR")) { debugf(DBG_LEVEL_EXTALL, "send_request_size: Saving utimens for file %s", orig_path); debugf(DBG_LEVEL_EXTALL, "send_request_size: Cached utime for path=%s ctime=%li.%li mtime=%li.%li atime=%li.%li", orig_path, de->ctime.tv_sec, de->ctime.tv_nsec, de->mtime.tv_sec, de->mtime.tv_nsec, de->atime.tv_sec, de->atime.tv_nsec); char atime_str_nice[TIME_CHARS] = "", mtime_str_nice[TIME_CHARS] = "", ctime_str_nice[TIME_CHARS] = ""; get_timespec_as_str(&(de->atime), atime_str_nice, sizeof(atime_str_nice)); debugf(DBG_LEVEL_EXTALL, KCYN"send_request_size: atime=[%s]", atime_str_nice); get_timespec_as_str(&(de->mtime), mtime_str_nice, sizeof(mtime_str_nice)); debugf(DBG_LEVEL_EXTALL, KCYN"send_request_size: mtime=[%s]", mtime_str_nice); get_timespec_as_str(&(de->ctime), ctime_str_nice, sizeof(ctime_str_nice)); debugf(DBG_LEVEL_EXTALL, KCYN"send_request_size: ctime=[%s]", ctime_str_nice); char mtime_str[TIME_CHARS], atime_str[TIME_CHARS], ctime_str[TIME_CHARS]; char string_float[TIME_CHARS]; snprintf(mtime_str, TIME_CHARS, "%lu.%lu", de->mtime.tv_sec, de->mtime.tv_nsec); snprintf(atime_str, TIME_CHARS, "%lu.%lu", de->atime.tv_sec, de->atime.tv_nsec); snprintf(ctime_str, TIME_CHARS, "%lu.%lu", de->ctime.tv_sec, de->ctime.tv_nsec); add_header(&headers, HEADER_TEXT_FILEPATH, orig_path); add_header(&headers, HEADER_TEXT_MTIME, mtime_str); add_header(&headers, HEADER_TEXT_ATIME, atime_str); add_header(&headers, HEADER_TEXT_CTIME, ctime_str); add_header(&headers, HEADER_TEXT_MTIME_DISPLAY, mtime_str_nice); add_header(&headers, HEADER_TEXT_ATIME_DISPLAY, atime_str_nice); add_header(&headers, HEADER_TEXT_CTIME_DISPLAY, ctime_str_nice); char gid_str[INT_CHAR_LEN], uid_str[INT_CHAR_LEN], chmod_str[INT_CHAR_LEN]; snprintf(gid_str, INT_CHAR_LEN, "%d", de->gid); snprintf(uid_str, INT_CHAR_LEN, "%d", de->uid); snprintf(chmod_str, INT_CHAR_LEN, "%d", de->chmod); add_header(&headers, HEADER_TEXT_GID, gid_str); add_header(&headers, HEADER_TEXT_UID, uid_str); add_header(&headers, HEADER_TEXT_CHMOD, chmod_str); } else debugf(DBG_LEVEL_EXTALL, "send_request_size: not setting utimes (%s)", orig_path); } if (!strcasecmp(method, "MKDIR")) { curl_easy_setopt(curl, CURLOPT_UPLOAD, 1); curl_easy_setopt(curl, CURLOPT_INFILESIZE, 0); add_header(&headers, "Content-Type", "application/directory"); } else if (!strcasecmp(method, "MKLINK") && fp) { rewind(fp); curl_easy_setopt(curl, CURLOPT_UPLOAD, 1); curl_easy_setopt(curl, CURLOPT_INFILESIZE, file_size); curl_easy_setopt(curl, CURLOPT_READDATA, fp); add_header(&headers, "Content-Type", "application/link"); } else if (!strcasecmp(method, "PUT")) { //http://blog.chmouel.com/2012/02/06/anatomy-of-a-swift-put-query-to-object-server/ debugf(DBG_LEVEL_EXT, "send_request_size: PUT (%s)", orig_path); curl_easy_setopt(curl, CURLOPT_UPLOAD, 1); if (fp) { curl_easy_setopt(curl, CURLOPT_INFILESIZE, file_size); curl_easy_setopt(curl, CURLOPT_READDATA, fp); } else curl_easy_setopt(curl, CURLOPT_INFILESIZE, 0); if (is_segment) curl_easy_setopt(curl, CURLOPT_READFUNCTION, read_callback); //enable progress reporting //http://curl.haxx.se/libcurl/c/progressfunc.html struct curl_progress prog; prog.lastruntime = 0; prog.curl = curl; curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_callback); /* pass the struct pointer into the progress function */ curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &prog); //get the response for debug purposes /* send all data to this function */ curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writefunc_callback); /* we pass our 'chunk' struct to the callback function */ curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void*)&chunk); } else if (!strcasecmp(method, "GET")) { if (is_segment) { debugf(DBG_LEVEL_EXT, "send_request_size: GET SEGMENT (%s)", orig_path); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_callback); curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); } else if (fp) { debugf(DBG_LEVEL_EXT, "send_request_size: GET FP (%s)", orig_path); rewind(fp); // make sure the file is ready for a-writin' fflush(fp); if (ftruncate(fileno(fp), 0) < 0) { debugf(DBG_LEVEL_NORM, KRED"ftruncate failed. I don't know what to do about that."); abort(); } curl_easy_setopt(curl, CURLOPT_WRITEDATA, fp); curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, &header_get_meta_dispatch); // sample by UThreadCurl.cpp, https://bitbucket.org/pamungkas5/bcbcurl/src // and http://www.codeproject.com/Articles/838366/BCBCurl-a-LibCurl-based-download-manager curl_easy_setopt(curl, CURLOPT_HEADERDATA, (void*)de); struct curl_progress prog; prog.lastruntime = 0; prog.curl = curl; curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, progress_callback); curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, &prog); } else if (xmlctx) { debugf(DBG_LEVEL_EXT, "send_request_size: GET XML (%s)", orig_path); curl_easy_setopt(curl, CURLOPT_WRITEDATA, xmlctx); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &xml_dispatch); } else { //asumming retrieval of headers only debugf(DBG_LEVEL_EXT, "send_request_size: GET HEADERS only(%s)"); curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, &header_get_meta_dispatch); curl_easy_setopt(curl, CURLOPT_HEADERDATA, (void*)de); curl_easy_setopt(curl, CURLOPT_NOBODY, 1); } } else { debugf(DBG_LEVEL_EXT, "send_request_size: catch_all (%s)"); // this posts an HEAD request (e.g. for statfs) curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, method); curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, &header_dispatch); } /* add the headers from extra_headers if any */ curl_slist* extra; for (extra = extra_headers; extra; extra = extra->next) { debugf(DBG_LEVEL_EXT, "adding header: %s", extra->data); headers = curl_slist_append(headers, extra->data); } curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); debugf(DBG_LEVEL_EXT, "status: send_request_size(%s) started HTTP REQ:%s", orig_path, url); curl_easy_perform(curl); double total_time; char* effective_url; curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response); curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &effective_url); curl_easy_getinfo(curl, CURLINFO_TOTAL_TIME, &total_time); debugf(DBG_LEVEL_EXT, "status: send_request_size(%s) completed HTTP REQ:%s total_time=%.1f seconds", orig_path, effective_url, total_time); curl_slist_free_all(headers); curl_easy_reset(curl); return_connection(curl); if (response != 404 && (response >= 400 || response < 200)) { /* Now, our chunk.memory points to a memory block that is chunk.size bytes big and contains the remote file. */ debugf(DBG_LEVEL_NORM, KRED"send_request_size: error message, size=%lu, [HTTP %d] (%s)(%s)", (long)chunk.size, response, method, path); debugf(DBG_LEVEL_NORM, KRED"send_request_size: error message=[%s]", chunk.memory); } free(chunk.memory); if ((response >= 200 && response < 400) || (!strcasecmp(method, "DELETE") && response == 409)) { debugf(DBG_LEVEL_NORM, "exit 0: send_request_size(%s) speed=%.1f sec "KCYN"(%s) "KGRN"[HTTP OK]", orig_path, total_time, method); return response; } //handle cases when file is not found, no point in retrying, will exit if (response == 404) { debugf(DBG_LEVEL_NORM, "send_request_size: not found error for (%s)(%s), ignored "KYEL"[HTTP 404].", method, path); return response; } else { debugf(DBG_LEVEL_NORM, "send_request_size: httpcode=%d (%s)(%s), retrying "KRED"[HTTP ERR]", response, method, path); //todo: try to list response content for debug purposes sleep(8 << tries); // backoff } if (response == 401 && !cloudfs_connect()) { // re-authenticate on 401s debugf(DBG_LEVEL_NORM, KYEL"exit 1: send_request_size(%s) (%s) [HTTP REAUTH]", path, method); return response; } if (xmlctx) xmlCtxtResetPush(xmlctx, NULL, 0, NULL, NULL); } debugf(DBG_LEVEL_NORM, "exit 2: send_request_size(%s)"KCYN"(%s) response=%d", path, method, response); return response; } int send_request(char* method, const char* path, FILE* fp, xmlParserCtxtPtr xmlctx, curl_slist* extra_headers, dir_entry* de_cached_entry, const char* unencoded_path) { long flen = 0; if (fp) { // if we don't flush the size will probably be zero fflush(fp); flen = cloudfs_file_size(fileno(fp)); } return send_request_size(method, path, fp, xmlctx, extra_headers, flen, 0, de_cached_entry, unencoded_path); } //thread that downloads or uploads large file segments void* upload_segment(void* seginfo) { struct segment_info* info = (struct segment_info*)seginfo; char seg_path[MAX_URL_SIZE] = { 0 }; //set pointer to the segment start index in the complete large file (several threads will write to same large file) fseek(info->fp, info->part * info->segment_size, SEEK_SET); setvbuf(info->fp, NULL, _IOFBF, DISK_BUFF_SIZE); snprintf(seg_path, MAX_URL_SIZE, "%s%08i", info->seg_base, info->part); char* encoded = curl_escape(seg_path, 0); debugf(DBG_LEVEL_EXT, KCYN"upload_segment(%s) part=%d size=%d seg_size=%d %s", info->method, info->part, info->size, info->segment_size, seg_path); int response = send_request_size(info->method, encoded, info, NULL, NULL, info->size, 1, NULL, seg_path); if (!(response >= 200 && response < 300)) fprintf(stderr, "Segment upload %s failed with response %d", seg_path, response); curl_free(encoded); fclose(info->fp); pthread_exit(NULL); } // segment_size is the globabl config variable and size_of_segment is local //TODO: return whether the upload/download failed or not void run_segment_threads(const char* method, int segments, int full_segments, int remaining, FILE* fp, char* seg_base, int size_of_segments) { debugf(DBG_LEVEL_EXT, "run_segment_threads(%s)", method); char file_path[PATH_MAX] = { 0 }; struct segment_info* info = (struct segment_info*) malloc(segments * sizeof(struct segment_info)); pthread_t* threads = (pthread_t*)malloc(segments * sizeof(pthread_t)); #ifdef __linux__ snprintf(file_path, PATH_MAX, "/proc/self/fd/%d", fileno(fp)); debugf(DBG_LEVEL_NORM, "On run segment filepath=%s", file_path); #else //TODO: I haven't actually tested this if (fcntl(fileno(fp), F_GETPATH, file_path) == -1) fprintf(stderr, "couldn't get the path name\n"); #endif int i, ret; for (i = 0; i < segments; i++) { info[i].method = method; info[i].fp = fopen(file_path, method[0] == 'G' ? "r+" : "r"); info[i].part = i; info[i].segment_size = size_of_segments; info[i].size = i < full_segments ? size_of_segments : remaining; info[i].seg_base = seg_base; pthread_create(&threads[i], NULL, upload_segment, (void*) & (info[i])); } for (i = 0; i < segments; i++) { if ((ret = pthread_join(threads[i], NULL)) != 0) fprintf(stderr, "error waiting for thread %d, status = %d\n", i, ret); } free(info); free(threads); debugf(DBG_LEVEL_EXT, "exit: run_segment_threads(%s)", method); } void split_path(const char* path, char* seg_base, char* container, char* object) { char* string = strdup(path); snprintf(seg_base, MAX_URL_SIZE, "%s", strsep(&string, "/")); strncat(container, strsep(&string, "/"), MAX_URL_SIZE - strnlen(container, MAX_URL_SIZE)); char* _object = strsep(&string, "/"); char* remstr; while (remstr = strsep(&string, "/")) { strncat(container, "/", MAX_URL_SIZE - strnlen(container, MAX_URL_SIZE)); strncat(container, _object, MAX_URL_SIZE - strnlen(container, MAX_URL_SIZE)); _object = remstr; } //fixed: when removing root folders this will generate a segfault //issue #83, https://github.com/TurboGit/hubicfuse/issues/83 if (_object == NULL) _object = object; else strncpy(object, _object, MAX_URL_SIZE); free(string); } //checks on the cloud if this file (seg_path) have an associated segment folder int internal_is_segmented(const char* seg_path, const char* object, const char* parent_path) { debugf(DBG_LEVEL_EXT, "internal_is_segmented(%s)", seg_path); //try to avoid an additional http request for small files bool potentially_segmented; dir_entry* de = check_path_info(parent_path); if (!de) { //when files in folders are first loaded the path will not be yet in cache, so need //to force segment meta download for segmented files potentially_segmented = true; } else { //potentially segmented, assumption is that 0 size files are potentially segmented //while size>0 is for sure not segmented, so no point in making an expensive HTTP GET call potentially_segmented = (de->size == 0 && !de->isdir) ? true : false; } debugf(DBG_LEVEL_EXT, "internal_is_segmented: potentially segmented=%d", potentially_segmented); dir_entry* seg_dir; if (potentially_segmented && cloudfs_list_directory(seg_path, &seg_dir)) { if (seg_dir && seg_dir->isdir) { do { if (!strncmp(seg_dir->name, object, MAX_URL_SIZE)) { debugf(DBG_LEVEL_EXT, "exit 0: internal_is_segmented(%s) "KGRN"TRUE", seg_path); return 1; } } while ((seg_dir = seg_dir->next)); } } debugf(DBG_LEVEL_EXT, "exit 1: internal_is_segmented(%s) "KYEL"FALSE", seg_path); return 0; } int is_segmented(const char* path) { debugf(DBG_LEVEL_EXT, "is_segmented(%s)", path); char container[MAX_URL_SIZE] = { 0 }; char object[MAX_URL_SIZE] = { 0 }; char seg_base[MAX_URL_SIZE] = { 0 }; split_path(path, seg_base, container, object); char seg_path[MAX_URL_SIZE]; snprintf(seg_path, MAX_URL_SIZE, "%s/%s_segments", seg_base, container); return internal_is_segmented(seg_path, object, path); } //returns segmented file properties by parsing and retrieving the folder structure on the cloud //added totalsize as parameter to return the file size on list directory for segmented files //old implementation returns file size=0 (issue #91) int format_segments(const char* path, char* seg_base, long* segments, long* full_segments, long* remaining, long* size_of_segments, long* total_size) { debugf(DBG_LEVEL_EXT, "format_segments(%s)", path); char container[MAX_URL_SIZE] = ""; char object[MAX_URL_SIZE] = ""; split_path(path, seg_base, container, object); char seg_path[MAX_URL_SIZE]; snprintf(seg_path, MAX_URL_SIZE, "%s/%s_segments", seg_base, container); if (internal_is_segmented(seg_path, object, path)) { char manifest[MAX_URL_SIZE]; dir_entry* seg_dir; snprintf(manifest, MAX_URL_SIZE, "%s/%s", seg_path, object); debugf(DBG_LEVEL_EXT, KMAG"format_segments manifest(%s)", manifest); if (!cloudfs_list_directory(manifest, &seg_dir)) { debugf(DBG_LEVEL_EXT, "exit 0: format_segments(%s)", path); return 0; } // snprintf seesaw between manifest and seg_path to get // the total_size and the segment size as well as the actual objects char* timestamp = seg_dir->name; snprintf(seg_path, MAX_URL_SIZE, "%s/%s", manifest, timestamp); debugf(DBG_LEVEL_EXT, KMAG"format_segments seg_path(%s)", seg_path); if (!cloudfs_list_directory(seg_path, &seg_dir)) { debugf(DBG_LEVEL_EXT, "exit 1: format_segments(%s)", path); return 0; } char* str_size = seg_dir->name; snprintf(manifest, MAX_URL_SIZE, "%s/%s", seg_path, str_size); debugf(DBG_LEVEL_EXT, KMAG"format_segments manifest2(%s) size=%s", manifest, str_size); if (!cloudfs_list_directory(manifest, &seg_dir)) { debugf(DBG_LEVEL_EXT, "exit 2: format_segments(%s)", path); return 0; } //following folder name actually represents the parent file size char* str_segment = seg_dir->name; snprintf(seg_path, MAX_URL_SIZE, "%s/%s", manifest, str_segment); debugf(DBG_LEVEL_EXT, KMAG"format_segments seg_path2(%s)", seg_path); //here is where we get a list with all segment files composing the parent large file if (!cloudfs_list_directory(seg_path, &seg_dir)) { debugf(DBG_LEVEL_EXT, "exit 3: format_segments(%s)", path); return 0; } *total_size = strtoll(str_size, NULL, 10); *size_of_segments = strtoll(str_segment, NULL, 10); *remaining = *total_size % *size_of_segments; *full_segments = *total_size / *size_of_segments; *segments = *full_segments + (*remaining > 0); snprintf(manifest, MAX_URL_SIZE, "%s_segments/%s/%s/%s/%s/", container, object, timestamp, str_size, str_segment); char tmp[MAX_URL_SIZE]; strncpy(tmp, seg_base, MAX_URL_SIZE); snprintf(seg_base, MAX_URL_SIZE, "%s/%s", tmp, manifest); debugf(DBG_LEVEL_EXT, KMAG"format_segments seg_base(%s)", seg_base); debugf(DBG_LEVEL_EXT, KMAG"exit 4: format_segments(%s) total=%d size_of_segments=%d remaining=%d, full_segments=%d segments=%d", path, &total_size, &size_of_segments, &remaining, &full_segments, &segments); return 1; } else { debugf(DBG_LEVEL_EXT, KMAG"exit 5: format_segments(%s) not segmented?", path); return 0; } } /* Public interface */ void cloudfs_init() { LIBXML_TEST_VERSION xmlXPathInit(); curl_global_init(CURL_GLOBAL_ALL); pthread_mutex_init(&pool_mut, NULL); curl_version_info_data* cvid = curl_version_info(CURLVERSION_NOW); // CentOS/RHEL 5 get stupid mode, because they have a broken libcurl if (cvid->version_num == RHEL5_LIBCURL_VERSION) { debugf(DBG_LEVEL_NORM, "RHEL5 mode enabled."); rhel5_mode = 1; } if (!strncasecmp(cvid->ssl_version, "openssl", 7)) { #ifdef HAVE_OPENSSL int i; ssl_lockarray = (pthread_mutex_t*)OPENSSL_malloc(CRYPTO_num_locks() * sizeof(pthread_mutex_t)); for (i = 0; i < CRYPTO_num_locks(); i++) pthread_mutex_init(&(ssl_lockarray[i]), NULL); CRYPTO_set_id_callback((unsigned long (*)())thread_id); CRYPTO_set_locking_callback((void (*)())lock_callback); #endif } else if (!strncasecmp(cvid->ssl_version, "nss", 3)) { // allow https to continue working after forking (for RHEL/CentOS 6) setenv("NSS_STRICT_NOFORK", "DISABLED", 1); } } void cloudfs_free() { debugf(DBG_LEVEL_EXT, "Destroy mutex"); pthread_mutex_destroy(&pool_mut); int n; for (n = 0; n < curl_pool_count; ++n) { debugf(DBG_LEVEL_EXT, "Cleaning curl conn %d", n); curl_easy_cleanup(curl_pool[n]); } } int file_is_readable(const char* fname) { FILE* file; if ( file = fopen( fname, "r" ) ) { fclose( file ); return 1; } return 0; } const char* get_file_mimetype ( const char* path ) { if ( file_is_readable( path ) == 1 ) { magic_t magic; const char* mime; magic = magic_open( MAGIC_MIME_TYPE ); magic_load( magic, NULL ); magic_compile( magic, NULL ); mime = magic_file( magic, path ); magic_close( magic ); return mime; } const char* error = "application/octet-stream"; return error; } int cloudfs_object_read_fp(const char* path, FILE* fp) { debugf(DBG_LEVEL_EXT, "cloudfs_object_read_fp(%s)", path); long flen; fflush(fp); const char* filemimetype = get_file_mimetype( path ); // determine the size of the file and segment if it is above the threshhold fseek(fp, 0, SEEK_END); flen = ftell(fp); // delete the previously uploaded segments if (is_segmented(path)) { if (!cloudfs_delete_object(path)) debugf(DBG_LEVEL_NORM, KRED"cloudfs_object_read_fp: couldn't delete existing file"); else debugf(DBG_LEVEL_EXT, KYEL"cloudfs_object_read_fp: deleted existing file"); } struct timespec now; if (flen >= segment_above) { int i; long remaining = flen % segment_size; int full_segments = flen / segment_size; int segments = full_segments + (remaining > 0); // The best we can do here is to get the current time that way tools that // use the mtime can at least check if the file was changing after now clock_gettime(CLOCK_REALTIME, &now); char string_float[TIME_CHARS]; snprintf(string_float, TIME_CHARS, "%lu.%lu", now.tv_sec, now.tv_nsec); char meta_mtime[TIME_CHARS]; snprintf(meta_mtime, TIME_CHARS, "%f", atof(string_float)); char seg_base[MAX_URL_SIZE] = ""; char container[MAX_URL_SIZE] = ""; char object[MAX_URL_SIZE] = ""; split_path(path, seg_base, container, object); char manifest[MAX_URL_SIZE]; snprintf(manifest, MAX_URL_SIZE, "%s_segments", container); // create the segments container cloudfs_create_directory(manifest); // reusing manifest // TODO: check how addition of meta_mtime in manifest impacts utimens implementation snprintf(manifest, MAX_URL_SIZE, "%s_segments/%s/%s/%ld/%ld/", container, object, meta_mtime, flen, segment_size); char tmp[MAX_URL_SIZE]; strncpy(tmp, seg_base, MAX_URL_SIZE); snprintf(seg_base, MAX_URL_SIZE, "%s/%s", tmp, manifest); run_segment_threads("PUT", segments, full_segments, remaining, fp, seg_base, segment_size); char* encoded = curl_escape(path, 0); curl_slist* headers = NULL; add_header(&headers, "x-object-manifest", manifest); add_header(&headers, "Content-Length", "0"); add_header(&headers, "Content-Type", filemimetype); int response = send_request_size("PUT", encoded, NULL, NULL, headers, 0, 0, NULL, path); curl_slist_free_all(headers); curl_free(encoded); debugf(DBG_LEVEL_EXT, "exit 0: cloudfs_object_read_fp(%s) uploaded ok, response=%d", path, response); return (response >= 200 && response < 300); } else { // assume enters here when file is composed of only one segment (small files) debugf(DBG_LEVEL_EXT, "cloudfs_object_read_fp(%s) "KYEL"unknown state", path); } rewind(fp); char* encoded = curl_escape(path, 0); dir_entry* de = path_info(path); if (!de) debugf(DBG_LEVEL_EXT, "cloudfs_object_read_fp(%s) not in cache", path); else debugf(DBG_LEVEL_EXT, "cloudfs_object_read_fp(%s) found in cache", path); int response = send_request("PUT", encoded, fp, NULL, NULL, NULL, path); curl_free(encoded); debugf(DBG_LEVEL_EXT, "exit 1: cloudfs_object_read_fp(%s)", path); return (response >= 200 && response < 300); } //write file downloaded from cloud to local file int cloudfs_object_write_fp(const char* path, FILE* fp) { debugf(DBG_LEVEL_EXT, "cloudfs_object_write_fp(%s)", path); char* encoded = curl_escape(path, 0); char seg_base[MAX_URL_SIZE] = ""; long segments; long full_segments; long remaining; long size_of_segments; long total_size; //checks if this file is a segmented one if (format_segments(path, seg_base, &segments, &full_segments, &remaining, &size_of_segments, &total_size)) { rewind(fp); fflush(fp); if (ftruncate(fileno(fp), 0) < 0) { debugf(DBG_LEVEL_NORM, KRED"ftruncate failed. I don't know what to do about that."); abort(); } run_segment_threads("GET", segments, full_segments, remaining, fp, seg_base, size_of_segments); debugf(DBG_LEVEL_EXT, "exit 0: cloudfs_object_write_fp(%s)", path); return 1; } int response = send_request("GET", encoded, fp, NULL, NULL, NULL, path); curl_free(encoded); fflush(fp); if ((response >= 200 && response < 300) || ftruncate(fileno(fp), 0)) { debugf(DBG_LEVEL_EXT, "exit 1: cloudfs_object_write_fp(%s)", path); return 1; } rewind(fp); debugf(DBG_LEVEL_EXT, "exit 2: cloudfs_object_write_fp(%s)", path); return 0; } int cloudfs_object_truncate(const char* path, off_t size) { char* encoded = curl_escape(path, 0); int response; if (size == 0) { FILE* fp = fopen("/dev/null", "r"); response = send_request("PUT", encoded, fp, NULL, NULL, NULL, path); fclose(fp); } else { //TODO: this is busted response = send_request("GET", encoded, NULL, NULL, NULL, NULL, path); } curl_free(encoded); return (response >= 200 && response < 300); } //get metadata from cloud, like time attribs. create new entry if not cached yet. void get_file_metadata(dir_entry* de) { if (de->size == 0 && !de->isdir && !de->metadata_downloaded) { //this can be a potential segmented file, try to read segments size debugf(DBG_LEVEL_EXT, KMAG"ZERO size file=%s", de->full_name); char seg_base[MAX_URL_SIZE] = ""; long segments; long full_segments; long remaining; long size_of_segments; long total_size; if (format_segments(de->full_name, seg_base, &segments, &full_segments, &remaining, &size_of_segments, &total_size)) de->size = total_size; } if (option_get_extended_metadata) { debugf(DBG_LEVEL_EXT, KCYN "get_file_metadata(%s)", de->full_name); //retrieve additional file metadata with a quick HEAD query char* encoded = curl_escape(de->full_name, 0); de->metadata_downloaded = true; int response = send_request("GET", encoded, NULL, NULL, NULL, de, de->full_name); curl_free(encoded); debugf(DBG_LEVEL_EXT, KCYN "exit: get_file_metadata(%s)", de->full_name); } return; } //get list of folders from cloud // return 1 for OK, 0 for error int cloudfs_list_directory(const char* path, dir_entry** dir_list) { debugf(DBG_LEVEL_EXT, "cloudfs_list_directory(%s)", path); char container[MAX_PATH_SIZE * 3] = ""; char object[MAX_PATH_SIZE] = ""; char last_subdir[MAX_PATH_SIZE] = ""; int prefix_length = 0; int response = 0; int retval = 0; int entry_count = 0; *dir_list = NULL; xmlNode* onode = NULL, *anode = NULL, *text_node = NULL; xmlParserCtxtPtr xmlctx = xmlCreatePushParserCtxt(NULL, NULL, "", 0, NULL); if (!strcmp(path, "") || !strcmp(path, "/")) { path = ""; strncpy(container, "/?format=xml", sizeof(container)); } else { sscanf(path, "/%[^/]/%[^\n]", container, object); char* encoded_container = curl_escape(container, 0); char* encoded_object = curl_escape(object, 0); // The empty path doesn't get a trailing slash, everything else does char* trailing_slash; prefix_length = strlen(object); if (object[0] == 0) trailing_slash = ""; else { trailing_slash = "/"; prefix_length++; } snprintf(container, sizeof(container), "%s?format=xml&delimiter=/&prefix=%s%s", encoded_container, encoded_object, trailing_slash); curl_free(encoded_container); curl_free(encoded_object); } if ((!strcmp(path, "") || !strcmp(path, "/")) && *override_storage_url) response = 404; else { // this was generating 404 err on non segmented files (small files) response = send_request("GET", container, NULL, xmlctx, NULL, NULL, path); } if (response >= 200 && response < 300) xmlParseChunk(xmlctx, "", 0, 1); if (response >= 200 && response < 300 && xmlctx->wellFormed ) { xmlNode* root_element = xmlDocGetRootElement(xmlctx->myDoc); for (onode = root_element->children; onode; onode = onode->next) { if (onode->type != XML_ELEMENT_NODE) continue; char is_object = !strcasecmp((const char*)onode->name, "object"); char is_container = !strcasecmp((const char*)onode->name, "container"); char is_subdir = !strcasecmp((const char*)onode->name, "subdir"); if (is_object || is_container || is_subdir) { entry_count++; dir_entry* de = init_dir_entry(); // useful docs on nodes here: http://developer.openstack.org/api-ref-objectstorage-v1.html if (is_container || is_subdir) de->content_type = strdup("application/directory"); for (anode = onode->children; anode; anode = anode->next) { char* content = ""; for (text_node = anode->children; text_node; text_node = text_node->next) { if (text_node->type == XML_TEXT_NODE) { content = (char*)text_node->content; //debugf(DBG_LEVEL_NORM, "List dir anode=%s content=%s", (const char *)anode->name, content); } else { //debugf(DBG_LEVEL_NORM, "List dir anode=%s", (const char *)anode->name); } } if (!strcasecmp((const char*)anode->name, "name")) { de->name = strdup(content + prefix_length); // Remove trailing slash char* slash = strrchr(de->name, '/'); if (slash && (0 == *(slash + 1))) *slash = 0; if (asprintf(&(de->full_name), "%s/%s", path, de->name) < 0) de->full_name = NULL; } if (!strcasecmp((const char*)anode->name, "bytes")) de->size = strtoll(content, NULL, 10); if (!strcasecmp((const char*)anode->name, "content_type")) { de->content_type = strdup(content); char* semicolon = strchr(de->content_type, ';'); if (semicolon) *semicolon = '\0'; } if (!strcasecmp((const char*)anode->name, "hash")) de->md5sum = strdup(content); if (!strcasecmp((const char*)anode->name, "last_modified")) { time_t last_modified_t = get_time_from_str_as_gmt(content); char local_time_str[64]; time_t local_time_t = get_time_as_local(last_modified_t, local_time_str, sizeof(local_time_str)); de->last_modified = local_time_t; de->ctime.tv_sec = local_time_t; de->ctime.tv_nsec = 0; //initialise all fields with hubic last modified date in case the file does not have extended attributes set de->mtime.tv_sec = local_time_t; de->mtime.tv_nsec = 0; de->atime.tv_sec = local_time_t; de->atime.tv_nsec = 0; //todo: how can we retrieve and set nanoseconds, are stored by hubic? } } de->isdir = de->content_type && ((strstr(de->content_type, "application/folder") != NULL) || (strstr(de->content_type, "application/directory") != NULL)); de->islink = de->content_type && ((strstr(de->content_type, "application/link") != NULL)); if (de->isdir) { //i guess this will remove a dir_entry from cache if is there already if (!strncasecmp(de->name, last_subdir, sizeof(last_subdir))) { //todo: check why is needed and if memory is freed properly, seems to generate many missed delete operations //cloudfs_free_dir_list(de); debugf(DBG_LEVEL_EXT, "cloudfs_list_directory: "KYEL"ignore "KNRM"cloudfs_free_dir_list(%s) command", de->name); continue; } strncpy(last_subdir, de->name, sizeof(last_subdir)); } de->next = *dir_list; *dir_list = de; char time_str[TIME_CHARS] = { 0 }; get_timespec_as_str(&(de->mtime), time_str, sizeof(time_str)); debugf(DBG_LEVEL_EXT, KCYN"new dir_entry %s size=%d %s dir=%d lnk=%d mod=[%s]", de->full_name, de->size, de->content_type, de->isdir, de->islink, time_str); } else debugf(DBG_LEVEL_EXT, "unknown element: %s", onode->name); } retval = 1; } else if ((!strcmp(path, "") || !strcmp(path, "/")) && *override_storage_url) { entry_count = 1; debugf(DBG_LEVEL_NORM, "Init cache entry container=[%s]", public_container); dir_entry* de = init_dir_entry(); de->name = strdup(public_container); struct tm last_modified; //todo: check what this default time means? strptime("1388434648.01238", "%FT%T", &last_modified); de->last_modified = mktime(&last_modified); de->content_type = strdup("application/directory"); if (asprintf(&(de->full_name), "%s/%s", path, de->name) < 0) de->full_name = NULL; de->isdir = 1; de->islink = 0; de->size = 4096; de->next = *dir_list; *dir_list = de; retval = 1; } xmlFreeDoc(xmlctx->myDoc); xmlFreeParserCtxt(xmlctx); debugf(DBG_LEVEL_EXT, "exit: cloudfs_list_directory(%s)", path); return retval; } int cloudfs_delete_object(const char* path) { debugf(DBG_LEVEL_EXT, "cloudfs_delete_object(%s)", path); char seg_base[MAX_URL_SIZE] = ""; long segments; long full_segments; long remaining; long size_of_segments; long total_size; if (format_segments(path, seg_base, &segments, &full_segments, &remaining, &size_of_segments, &total_size)) { int response; int i; char seg_path[MAX_URL_SIZE] = ""; for (i = 0; i < segments; i++) { snprintf(seg_path, MAX_URL_SIZE, "%s%08i", seg_base, i); char* encoded = curl_escape(seg_path, 0); response = send_request("DELETE", encoded, NULL, NULL, NULL, NULL, seg_path); if (response < 200 || response >= 300) { debugf(DBG_LEVEL_EXT, "exit 1: cloudfs_delete_object(%s) response=%d", path, response); return 0; } } } char* encoded = curl_escape(path, 0); int response = send_request("DELETE", encoded, NULL, NULL, NULL, NULL, path); curl_free(encoded); int ret = (response >= 200 && response < 300); debugf(DBG_LEVEL_EXT, "status: cloudfs_delete_object(%s) response=%d", path, response); if (response == 409) { debugf(DBG_LEVEL_EXT, "status: cloudfs_delete_object(%s) NOT EMPTY", path); ret = -1; } return ret; } //fixme: this op does not preserve src attributes (e.g. will make rsync not work well) // https://ask.openstack.org/en/question/14307/is-there-a-way-to-moverename-an-object/ // this operation also causes an HTTP 400 error if X-Object-Meta-FilePath value is larger than 256 chars int cloudfs_copy_object(const char* src, const char* dst) { debugf(DBG_LEVEL_EXT, "cloudfs_copy_object(%s, %s) lensrc=%d, lendst=%d", src, dst, strlen(src), strlen(dst)); char* dst_encoded = curl_escape(dst, 0); char* src_encoded = curl_escape(src, 0); //convert encoded string (slashes are encoded as well) to encoded string with slashes char* slash; while ((slash = strstr(src_encoded, "%2F")) || (slash = strstr(src_encoded, "%2f"))) { *slash = '/'; memmove(slash + 1, slash + 3, strlen(slash + 3) + 1); } curl_slist* headers = NULL; add_header(&headers, "X-Copy-From", src_encoded); add_header(&headers, "Content-Length", "0"); //get source file entry dir_entry* de_src = check_path_info(src); if (de_src) debugf(DBG_LEVEL_EXT, "status cloudfs_copy_object(%s, %s): src file found", src, dst); else debugf(DBG_LEVEL_NORM, KRED"status cloudfs_copy_object(%s, %s): src file NOT found", src, dst); //pass src metadata so that PUT will set time attributes of the src file int response = send_request("PUT", dst_encoded, NULL, NULL, headers, de_src, dst); curl_free(dst_encoded); curl_free(src_encoded); curl_slist_free_all(headers); debugf(DBG_LEVEL_EXT, "exit: cloudfs_copy_object(%s,%s) response=%d", src, dst, response); return (response >= 200 && response < 300); } // http://developer.openstack.org/api-ref-objectstorage-v1.html#updateObjectMeta int cloudfs_update_meta(dir_entry* de) { int response = cloudfs_copy_object(de->full_name, de->full_name); return response; } //optimised with cache int cloudfs_statfs(const char* path, struct statvfs* stat) { time_t now = get_time_now(); int lapsed = now - last_stat_read_time; if (lapsed > option_cache_statfs_timeout) { //todo: check why stat head request is always set to /, why not path? int response = send_request("HEAD", "/", NULL, NULL, NULL, NULL, "/"); *stat = statcache; debugf(DBG_LEVEL_EXT, "exit: cloudfs_statfs (new recent values, was cached since %d seconds)", lapsed); last_stat_read_time = now; return (response >= 200 && response < 300); } else { debugf(DBG_LEVEL_EXT, "exit: cloudfs_statfs (old values, cached since %d seconds)", lapsed); return 1; } } int cloudfs_create_symlink(const char* src, const char* dst) { char* dst_encoded = curl_escape(dst, 0); FILE* lnk = tmpfile(); fwrite(src, 1, strlen(src), lnk); fwrite("\0", 1, 1, lnk); int response = send_request("MKLINK", dst_encoded, lnk, NULL, NULL, NULL, dst); curl_free(dst_encoded); fclose(lnk); return (response >= 200 && response < 300); } int cloudfs_create_directory(const char* path) { debugf(DBG_LEVEL_EXT, "cloudfs_create_directory(%s)", path); char* encoded = curl_escape(path, 0); int response = send_request("MKDIR", encoded, NULL, NULL, NULL, NULL, path); curl_free(encoded); debugf(DBG_LEVEL_EXT, "cloudfs_create_directory(%s) response=%d", path, response); return (response >= 200 && response < 300); } off_t cloudfs_file_size(int fd) { struct stat buf; fstat(fd, &buf); return buf.st_size; } void cloudfs_verify_ssl(int vrfy) { verify_ssl = vrfy ? 2 : 0; } void cloudfs_option_get_extended_metadata(int option) { option_get_extended_metadata = option ? true : false; } void cloudfs_option_curl_verbose(int option) { option_curl_verbose = option ? true : false; } static struct { char client_id [MAX_HEADER_SIZE]; char client_secret[MAX_HEADER_SIZE]; char refresh_token[MAX_HEADER_SIZE]; } reconnect_args; void cloudfs_set_credentials(char* client_id, char* client_secret, char* refresh_token) { strncpy(reconnect_args.client_id , client_id , sizeof(reconnect_args.client_id )); strncpy(reconnect_args.client_secret, client_secret, sizeof(reconnect_args.client_secret)); strncpy(reconnect_args.refresh_token, refresh_token, sizeof(reconnect_args.refresh_token)); } struct htmlString { char* text; size_t size; }; static size_t writefunc_string(void* contents, size_t size, size_t nmemb, void* data) { struct htmlString* mem = (struct htmlString*) data; size_t realsize = size * nmemb; mem->text = realloc(mem->text, mem->size + realsize + 1); if (mem->text == NULL) /* out of memory! */ { perror(__FILE__); exit(EXIT_FAILURE); } memcpy(&(mem->text[mem->size]), contents, realsize); mem->size += realsize; return realsize; } char* htmlStringGet(CURL* curl) { struct htmlString chunk; chunk.text = malloc(sizeof(char)); chunk.size = 0; chunk.text[0] = '\0';//added to avoid valgrind unitialised warning curl_easy_setopt(curl, CURLOPT_WRITEDATA, &chunk); do { curl_easy_perform(curl); } while (chunk.size == 0); chunk.text[chunk.size] = '\0'; return chunk.text; } /* thanks to http://devenix.wordpress.com */ char* unbase64(unsigned char* input, int length) { BIO* b64, *bmem; char* buffer = (char*)malloc(length); memset(buffer, 0, length); b64 = BIO_new(BIO_f_base64()); bmem = BIO_new_mem_buf(input, length); bmem = BIO_push(b64, bmem); BIO_set_flags(bmem, BIO_FLAGS_BASE64_NO_NL); BIO_read(bmem, buffer, length); BIO_free_all(bmem); return buffer; } int safe_json_string(json_object* jobj, char* buffer, char* name) { int result = 0; if (jobj) { json_object* o; int found; found = json_object_object_get_ex(jobj, name, &o); if (found) { strcpy (buffer, json_object_get_string(o)); result = 1; } } if (!result) debugf(DBG_LEVEL_NORM, KRED"HUBIC cannot get json field '%s'\n", name); return result; } int cloudfs_connect() { #define HUBIC_TOKEN_URL "https://api.hubic.com/oauth/token" #define HUBIC_CRED_URL "https://api.hubic.com/1.0/account/credentials" #define HUBIC_CLIENT_ID (reconnect_args.client_id) #define HUBIC_CLIENT_SECRET (reconnect_args.client_secret) #define HUBIC_REFRESH_TOKEN (reconnect_args.refresh_token) #define HUBIC_OPTIONS_SIZE 2048 long response = -1; char url[HUBIC_OPTIONS_SIZE]; char payload[HUBIC_OPTIONS_SIZE]; struct json_object* json_obj; pthread_mutex_lock(&pool_mut); debugf(DBG_LEVEL_NORM, "Authenticating... (client_id = '%s')", HUBIC_CLIENT_ID); storage_token[0] = storage_url[0] = '\0'; CURL* curl = curl_easy_init(); /* curl default options */ curl_easy_setopt(curl, CURLOPT_VERBOSE, debug); curl_easy_setopt(curl, CURLOPT_USERAGENT, USER_AGENT); curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, verify_ssl ? 1 : 0); curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, verify_ssl); curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10); curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10); curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1); curl_easy_setopt(curl, CURLOPT_VERBOSE, 0L); curl_easy_setopt(curl, CURLOPT_POST, 0L); curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 0); curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, writefunc_string); /* Step 1 : request a token - Not needed anymore with refresh_token */ /* Step 2 : get request code - Not needed anymore with refresh_token */ /* Step 3 : get access token */ sprintf(payload, "refresh_token=%s&grant_type=refresh_token", HUBIC_REFRESH_TOKEN); curl_easy_setopt(curl, CURLOPT_URL, HUBIC_TOKEN_URL); curl_easy_setopt(curl, CURLOPT_POST, 1L); curl_easy_setopt(curl, CURLOPT_HEADER, 0); curl_easy_setopt(curl, CURLOPT_POSTFIELDS, payload); curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, strlen(payload)); curl_easy_setopt(curl, CURLOPT_USERNAME, HUBIC_CLIENT_ID); curl_easy_setopt(curl, CURLOPT_PASSWORD, HUBIC_CLIENT_SECRET); curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); char* json_str = htmlStringGet(curl); json_obj = json_tokener_parse(json_str); debugf(DBG_LEVEL_NORM, "HUBIC TOKEN_URL result: '%s'\n", json_str); free(json_str); char access_token[HUBIC_OPTIONS_SIZE]; char token_type[HUBIC_OPTIONS_SIZE]; int expire_sec; int found; json_object* o; if (!safe_json_string(json_obj, access_token, "access_token")) return 0; if (!safe_json_string(json_obj, token_type, "token_type")) return 0; found = json_object_object_get_ex(json_obj, "expires_in", &o); expire_sec = json_object_get_int(o); debugf(DBG_LEVEL_NORM, "HUBIC Access token: %s\n", access_token); debugf(DBG_LEVEL_NORM, "HUBIC Token type : %s\n", token_type); debugf(DBG_LEVEL_NORM, "HUBIC Expire in : %d\n", expire_sec); /* Step 4 : request OpenStack storage URL */ curl_easy_setopt(curl, CURLOPT_URL, HUBIC_CRED_URL); curl_easy_setopt(curl, CURLOPT_POST, 0L); curl_easy_setopt(curl, CURLOPT_HEADER, 0); curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_NONE); /* create the Bearer authentication header */ curl_slist* headers = NULL; sprintf (payload, "Bearer %s", access_token); add_header(&headers, "Authorization", payload); curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers); char token[HUBIC_OPTIONS_SIZE]; char endpoint[HUBIC_OPTIONS_SIZE]; char expires[HUBIC_OPTIONS_SIZE]; json_str = htmlStringGet(curl); json_obj = json_tokener_parse(json_str); debugf(DBG_LEVEL_NORM, "CRED_URL result: '%s'\n", json_str); free(json_str); if (!safe_json_string(json_obj, token, "token")) return 0; if (!safe_json_string(json_obj, endpoint, "endpoint")) return 0; if (!safe_json_string(json_obj, expires, "expires")) return 0; /* set the global storage_url and storage_token, the only parameters needed for swift */ strcpy (storage_url, endpoint); strcpy (storage_token, token); curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response); curl_easy_cleanup(curl); pthread_mutex_unlock(&pool_mut); return (response >= 200 && response < 300 && storage_token[0] && storage_url[0]); } hubicfuse-3.0.1/cloudfsapi.h000066400000000000000000000046731306623177700160200ustar00rootroot00000000000000#ifndef _CLOUDFSAPI_H #define _CLOUDFSAPI_H #include #include #define FUSE_USE_VERSION 30 #include #include #define BUFFER_INITIAL_SIZE 4096 #define MAX_HEADER_SIZE 8192 #define MAX_URL_SIZE (MAX_PATH_SIZE * 3) #define USER_AGENT "CloudFuse" #define OPTION_SIZE 1024 typedef struct curl_slist curl_slist; #define MINIMAL_PROGRESS_FUNCTIONALITY_INTERVAL 5 struct curl_progress { double lastruntime; CURL* curl; }; typedef struct options { char cache_timeout[OPTION_SIZE]; char verify_ssl[OPTION_SIZE]; char segment_size[OPTION_SIZE]; char segment_above[OPTION_SIZE]; char storage_url[OPTION_SIZE]; char container[OPTION_SIZE]; char temp_dir[OPTION_SIZE]; char client_id[OPTION_SIZE]; char client_secret[OPTION_SIZE]; char refresh_token[OPTION_SIZE]; } FuseOptions; typedef struct extra_options { char settings_filename[MAX_PATH_SIZE]; char get_extended_metadata[OPTION_SIZE]; char curl_verbose[OPTION_SIZE]; char cache_statfs_timeout[OPTION_SIZE]; char debug_level[OPTION_SIZE]; char curl_progress_state[OPTION_SIZE]; char enable_chmod[OPTION_SIZE]; char enable_chown[OPTION_SIZE]; char help[OPTION_SIZE]; } ExtraFuseOptions; void cloudfs_init(void); void cloudfs_free(void); void cloudfs_set_credentials(char* client_id, char* client_secret, char* refresh_token); int cloudfs_connect(void); struct segment_info { FILE* fp; int part; long size; long segment_size; char* seg_base; const char* method; }; long segment_size; long segment_above; char* override_storage_url; char* public_container; int file_is_readable(const char* fname); const char* get_file_mimetype ( const char* filename ); int cloudfs_object_read_fp(const char* path, FILE* fp); int cloudfs_object_write_fp(const char* path, FILE* fp); int cloudfs_list_directory(const char* path, dir_entry**); int cloudfs_delete_object(const char* path); int cloudfs_copy_object(const char* src, const char* dst); int cloudfs_create_symlink(const char* src, const char* dst); int cloudfs_create_directory(const char* label); int cloudfs_object_truncate(const char* path, off_t size); off_t cloudfs_file_size(int fd); int cloudfs_statfs(const char* path, struct statvfs* stat); void cloudfs_verify_ssl(int dbg); void cloudfs_option_get_extended_metadata(int option); void cloudfs_option_curl_verbose(int option); void get_file_metadata(dir_entry* de); int cloudfs_update_meta(dir_entry* de); #endif hubicfuse-3.0.1/cloudfuse.c000066400000000000000000001010411306623177700156360ustar00rootroot00000000000000#define FUSE_USE_VERSION 30 #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "commonfs.h" #include "cloudfsapi.h" #include "config.h" extern char* temp_dir; extern pthread_mutex_t dcachemut; extern pthread_mutexattr_t mutex_attr; extern int debug; extern int cache_timeout; extern int option_cache_statfs_timeout; extern int option_debug_level; extern bool option_get_extended_metadata; extern bool option_curl_progress_state; extern bool option_enable_chown; extern bool option_enable_chmod; extern size_t file_buffer_size; static int cfs_getattr(const char* path, struct stat* stbuf) { debugf(DBG_LEVEL_NORM, KBLU "cfs_getattr(%s)", path); //return standard values for root folder if (!strcmp(path, "/")) { stbuf->st_uid = geteuid(); stbuf->st_gid = getegid(); stbuf->st_mode = S_IFDIR | 0755; stbuf->st_nlink = 2; debug_list_cache_content(); debugf(DBG_LEVEL_NORM, KBLU "exit 0: cfs_getattr(%s)", path); return 0; } //get file. if not in cache will be downloaded. dir_entry* de = path_info(path); if (!de) { debug_list_cache_content(); debugf(DBG_LEVEL_NORM, KBLU"exit 1: cfs_getattr(%s) "KYEL"not-in-cache/cloud", path); return -ENOENT; } //lazzy download of file metadata, only when really needed if (option_get_extended_metadata && !de->metadata_downloaded) get_file_metadata(de); if (option_enable_chown) { stbuf->st_uid = de->uid; stbuf->st_gid = de->gid; } else { stbuf->st_uid = geteuid(); stbuf->st_gid = getegid(); } // change needed due to utimens stbuf->st_atime = de->atime.tv_sec; stbuf->st_atim.tv_nsec = de->atime.tv_nsec; stbuf->st_mtime = de->mtime.tv_sec; stbuf->st_mtim.tv_nsec = de->mtime.tv_nsec; stbuf->st_ctime = de->ctime.tv_sec; stbuf->st_ctim.tv_nsec = de->ctime.tv_nsec; char time_str[TIME_CHARS] = ""; get_timespec_as_str(&(de->atime), time_str, sizeof(time_str)); debugf(DBG_LEVEL_EXT, KCYN"cfs_getattr: atime=[%s]", time_str); get_timespec_as_str(&(de->mtime), time_str, sizeof(time_str)); debugf(DBG_LEVEL_EXT, KCYN"cfs_getattr: mtime=[%s]", time_str); get_timespec_as_str(&(de->ctime), time_str, sizeof(time_str)); debugf(DBG_LEVEL_EXT, KCYN"cfs_getattr: ctime=[%s]", time_str); int default_mode_dir, default_mode_file; if (option_enable_chmod) { default_mode_dir = de->chmod; default_mode_file = de->chmod; } else { default_mode_dir = 0755; default_mode_file = 0666; } if (de->isdir) { stbuf->st_size = 0; stbuf->st_mode = S_IFDIR | default_mode_dir; stbuf->st_nlink = 2; } else if (de->islink) { stbuf->st_size = 1; stbuf->st_mode = S_IFLNK | default_mode_dir; stbuf->st_nlink = 1; stbuf->st_size = de->size; /* calc. blocks as if 4K blocksize filesystem; stat uses units of 512B */ stbuf->st_blocks = ((4095 + de->size) / 4096) * 8; } else { stbuf->st_size = de->size; /* calc. blocks as if 4K blocksize filesystem; stat uses units of 512B */ stbuf->st_blocks = ((4095 + de->size) / 4096) * 8; stbuf->st_mode = S_IFREG | default_mode_file; stbuf->st_nlink = 1; } debugf(DBG_LEVEL_NORM, KBLU "exit 2: cfs_getattr(%s)", path); return 0; } static int cfs_fgetattr(const char* path, struct stat* stbuf, struct fuse_file_info* info) { debugf(DBG_LEVEL_NORM, KBLU "cfs_fgetattr(%s)", path); openfile* of = (openfile*)(uintptr_t)info->fh; if (of) { //get file. if not in cache will be downloaded. dir_entry* de = path_info(path); if (!de) { debug_list_cache_content(); debugf(DBG_LEVEL_NORM, KBLU"exit 1: cfs_fgetattr(%s) "KYEL"not-in-cache/cloud", path); return -ENOENT; } int default_mode_file; if (option_enable_chmod) default_mode_file = de->chmod; else default_mode_file = 0666; stbuf->st_size = cloudfs_file_size(of->fd); stbuf->st_mode = S_IFREG | default_mode_file; stbuf->st_nlink = 1; debugf(DBG_LEVEL_NORM, KBLU "exit 0: cfs_fgetattr(%s)", path); return 0; } debugf(DBG_LEVEL_NORM, KRED "exit 1: cfs_fgetattr(%s)", path); return -ENOENT; } static int cfs_readdir(const char* path, void* buf, fuse_fill_dir_t filldir, off_t offset, struct fuse_file_info* info) { debugf(DBG_LEVEL_NORM, KBLU "cfs_readdir(%s)", path); dir_entry* de; if (!caching_list_directory(path, &de)) { debug_list_cache_content(); debugf(DBG_LEVEL_NORM, KRED "exit 0: cfs_readdir(%s)", path); return -ENOLINK; } filldir(buf, ".", NULL, 0); filldir(buf, "..", NULL, 0); for (; de; de = de->next) filldir(buf, de->name, NULL, 0); debug_list_cache_content(); debugf(DBG_LEVEL_NORM, KBLU "exit 1: cfs_readdir(%s)", path); return 0; } static int cfs_mkdir(const char* path, mode_t mode) { debugf(DBG_LEVEL_NORM, KBLU "cfs_mkdir(%s)", path); int response = cloudfs_create_directory(path); if (response) { update_dir_cache(path, 0, 1, 0); debug_list_cache_content(); debugf(DBG_LEVEL_NORM, KBLU "exit 0: cfs_mkdir(%s)", path); return 0; } debugf(DBG_LEVEL_NORM, KRED "exit 1: cfs_mkdir(%s) response=%d", path, response); return -ENOENT; } static int cfs_create(const char* path, mode_t mode, struct fuse_file_info* info) { debugf(DBG_LEVEL_NORM, KBLU "cfs_create(%s)", path); FILE* temp_file; int errsv; char file_path_safe[NAME_MAX] = ""; if (*temp_dir) { get_safe_cache_file_path(path, file_path_safe, temp_dir); temp_file = fopen(file_path_safe, "w+b"); errsv = errno; if (temp_file == NULL) { debugf(DBG_LEVEL_NORM, KRED "exit 0: cfs_create cannot open temp file %s.error %s\n", file_path_safe, strerror(errsv)); return -EIO; } } else { temp_file = tmpfile(); errsv = errno; if (temp_file == NULL) { debugf(DBG_LEVEL_NORM, KRED "exit 1: cfs_create cannot open tmp file for path %s.error %s\n", path, strerror(errsv)); return -EIO; } } openfile* of = (openfile*)malloc(sizeof(openfile)); of->fd = dup(fileno(temp_file)); fclose(temp_file); of->flags = info->flags; info->fh = (uintptr_t)of; update_dir_cache(path, 0, 0, 0); info->direct_io = 1; dir_entry* de = check_path_info(path); if (de) { debugf(DBG_LEVEL_EXT, KCYN"cfs_create(%s): found in cache", path); struct timespec now; clock_gettime(CLOCK_REALTIME, &now); debugf(DBG_LEVEL_EXT, KCYN"cfs_create(%s) set utimes as now", path); de->atime.tv_sec = now.tv_sec; de->atime.tv_nsec = now.tv_nsec; de->mtime.tv_sec = now.tv_sec; de->mtime.tv_nsec = now.tv_nsec; de->ctime.tv_sec = now.tv_sec; de->ctime.tv_nsec = now.tv_nsec; char time_str[TIME_CHARS] = ""; get_timespec_as_str(&(de->atime), time_str, sizeof(time_str)); debugf(DBG_LEVEL_EXT, KCYN"cfs_create: atime=[%s]", time_str); get_timespec_as_str(&(de->mtime), time_str, sizeof(time_str)); debugf(DBG_LEVEL_EXT, KCYN"cfs_create: mtime=[%s]", time_str); get_timespec_as_str(&(de->ctime), time_str, sizeof(time_str)); debugf(DBG_LEVEL_EXT, KCYN"cfs_create: ctime=[%s]", time_str); //set chmod & chown de->chmod = mode; de->uid = geteuid(); de->gid = getegid(); } else debugf(DBG_LEVEL_EXT, KBLU "cfs_create(%s) "KYEL"dir-entry not found", path); debugf(DBG_LEVEL_NORM, KBLU "exit 2: cfs_create(%s)=(%s) result=%d:%s", path, file_path_safe, errsv, strerror(errsv)); return 0; } // open (download) file from cloud // todo: implement etag optimisation, download only if content changed, http://www.17od.com/2012/12/19/ten-useful-openstack-swift-features/ static int cfs_open(const char* path, struct fuse_file_info* info) { debugf(DBG_LEVEL_NORM, KBLU "cfs_open(%s)", path); FILE* temp_file = NULL; int errsv; dir_entry* de = path_info(path); if (*temp_dir) { char file_path_safe[NAME_MAX]; get_safe_cache_file_path(path, file_path_safe, temp_dir); debugf(DBG_LEVEL_EXT, "cfs_open: try open (%s)", file_path_safe); if (access(file_path_safe, F_OK) != -1) { // file exists temp_file = fopen(file_path_safe, "r"); errsv = errno; if (temp_file == NULL) { debugf(DBG_LEVEL_NORM, KRED"exit 0: cfs_open can't open temp_file=[%s] err=%d:%s", file_path_safe, errsv, strerror(errsv)); return -ENOENT; } else debugf(DBG_LEVEL_EXT, "cfs_open: file exists"); } else { errsv = errno; debugf(DBG_LEVEL_EXT, "cfs_open: file not in cache, err=%s", strerror(errsv)); //FIXME: commented out as this condition will not be meet in some odd cases and program will crash //if (!(info->flags & O_WRONLY)) { debugf(DBG_LEVEL_EXT, "cfs_open: opening for write"); // we need to lock on the filename another process could open the file // while we are writing to it and then only read part of the file // duplicate the directory caching datastructure to make the code easier // to understand. // each file in the cache needs: // filename, is_writing, last_closed, is_removing // the first time a file is opened a new entry is created in the cache // setting the filename and is_writing to true. This check needs to be // wrapped with a lock. // // each time a file is closed we set the last_closed for the file to now // and we check the cache for files whose last // closed is greater than cache_timeout, then start a new thread rming // that file. // TODO: just to prevent this craziness for now temp_file = fopen(file_path_safe, "w+b"); errsv = errno; if (temp_file == NULL) { debugf(DBG_LEVEL_NORM, KRED"exit 1: cfs_open cannot open temp_file=[%s] err=%d:%s", file_path_safe, errsv, strerror(errsv)); return -ENOENT; } if (!cloudfs_object_write_fp(path, temp_file)) { fclose(temp_file); debugf(DBG_LEVEL_NORM, KRED "exit 2: cfs_open(%s) cannot download/write", path); return -ENOENT; } } } else { temp_file = tmpfile(); if (temp_file == NULL) { debugf(DBG_LEVEL_NORM, KRED"exit 3: cfs_open cannot create temp_file err=%s", strerror(errno)); return -ENOENT; } if (!(info->flags & O_TRUNC)) { if (!cloudfs_object_write_fp(path, temp_file) && !(info->flags & O_CREAT)) { fclose(temp_file); debugf(DBG_LEVEL_NORM, KRED"exit 4: cfs_open(%s) cannot download/write", path); return -ENOENT; } } } update_dir_cache(path, (de ? de->size : 0), 0, 0); openfile* of = (openfile*)malloc(sizeof(openfile)); of->fd = dup(fileno(temp_file)); if (of->fd == -1) { //FIXME: potential leak if free not used? free(of); debugf(DBG_LEVEL_NORM, KRED "exit 5: cfs_open(%s) of->fd", path); return -ENOENT; } fclose(temp_file); //TODO: why this allocation to of? of->flags = info->flags; info->fh = (uintptr_t)of; info->direct_io = 1; info->nonseekable = 0; //FIXME: potential leak if free(of) not used? although if free(of) is used will generate bad descriptor errors debugf(DBG_LEVEL_NORM, KBLU "exit 6: cfs_open(%s)", path); return 0; } static int cfs_read(const char* path, char* buf, size_t size, off_t offset, struct fuse_file_info* info) { debugf(DBG_LEVEL_EXTALL, KBLU "cfs_read(%s) buffsize=%lu offset=%lu", path, size, offset); file_buffer_size = size; debug_print_descriptor(info); int result = pread(((openfile*)(uintptr_t)info->fh)->fd, buf, size, offset); debugf(DBG_LEVEL_EXTALL, KBLU "exit: cfs_read(%s) result=%s", path, strerror(errno)); return result; } //todo: flush will upload a file again even if just file attributes are changed. //optimisation needed to detect if content is changed and to only save meta when just attribs are modified. static int cfs_flush(const char* path, struct fuse_file_info* info) { debugf(DBG_LEVEL_NORM, KBLU "cfs_flush(%s)", path); debug_print_descriptor(info); openfile* of = (openfile*)(uintptr_t)info->fh; int errsv = 0; if (of) { // get the actual file size and truncate it. This ensures that if the new file is smaller // than the previous one, the proper size is uploaded. struct stat stbuf; cfs_getattr(path, &stbuf); update_dir_cache(path, stbuf.st_size, 0, 0); ftruncate(of->fd, stbuf.st_size); if (of->flags & O_RDWR || of->flags & O_WRONLY) { FILE* fp = fdopen(dup(of->fd), "r"); errsv = errno; if (fp != NULL) { rewind(fp); //calculate md5 hash, compare with cloud hash to determine if file content is changed char md5_file_hash_str[MD5_DIGEST_HEXA_STRING_LEN] = "\0"; file_md5(fp, md5_file_hash_str); dir_entry* de = check_path_info(path); if (de && de->md5sum != NULL && (!strcasecmp(md5_file_hash_str, de->md5sum))) { //file content is identical, no need to upload entire file, just update metadata debugf(DBG_LEVEL_NORM, KBLU "cfs_flush(%s): skip full upload as content did not change", path); cloudfs_update_meta(de); } else { rewind(fp); debugf(DBG_LEVEL_NORM, KBLU "cfs_flush(%s): perform full upload as content changed (or no file found in cache)", path); if (!cloudfs_object_read_fp(path, fp)) { fclose(fp); errsv = errno; debugf(DBG_LEVEL_NORM, KRED"exit 0: cfs_flush(%s) result=%d:%s", path, errsv, strerror(errno)); return -ENOENT; } } fclose(fp); errsv = errno; } else debugf(DBG_LEVEL_EXT, KRED "status: cfs_flush, err=%d:%s", errsv, strerror(errno)); } } debugf(DBG_LEVEL_NORM, KBLU "exit 1: cfs_flush(%s) result=%d:%s", path, errsv, strerror(errno)); return 0; } static int cfs_release(const char* path, struct fuse_file_info* info) { debugf(DBG_LEVEL_NORM, KBLU "cfs_release(%s)", path); close(((openfile*)(uintptr_t)info->fh)->fd); debugf(DBG_LEVEL_NORM, KBLU "exit: cfs_release(%s)", path); return 0; } static int cfs_rmdir(const char* path) { debugf(DBG_LEVEL_NORM, KBLU "cfs_rmdir(%s)", path); int success = cloudfs_delete_object(path); if (success == -1) { debugf(DBG_LEVEL_NORM, KBLU "exit 0: cfs_rmdir(%s)", path); return -ENOTEMPTY; } if (success) { dir_decache(path); debugf(DBG_LEVEL_NORM, KBLU "exit 1: cfs_rmdir(%s)", path); return 0; } debugf(DBG_LEVEL_NORM, KBLU "exit 2: cfs_rmdir(%s)", path); return -ENOENT; } static int cfs_ftruncate(const char* path, off_t size, struct fuse_file_info* info) { debugf(DBG_LEVEL_NORM, KBLU "cfs_ftruncate(%s) size=%lu", path, size); file_buffer_size = size; openfile* of = (openfile*)(uintptr_t)info->fh; if (ftruncate(of->fd, size)) return -errno; lseek(of->fd, 0, SEEK_SET); update_dir_cache(path, size, 0, 0); debugf(DBG_LEVEL_NORM, KBLU "exit: cfs_ftruncate(%s)", path); return 0; } static int cfs_write(const char* path, const char* buf, size_t length, off_t offset, struct fuse_file_info* info) { debugf(DBG_LEVEL_EXTALL, KBLU "cfs_write(%s) bufflength=%lu offset=%lu", path, length, offset); // FIXME: Potential inconsistent cache update if pwrite fails? update_dir_cache(path, offset + length, 0, 0); //int result = pwrite(info->fh, buf, length, offset); int result = pwrite(((openfile*)(uintptr_t)info->fh)->fd, buf, length, offset); int errsv = errno; if (errsv == 0) debugf(DBG_LEVEL_EXTALL, KBLU "exit 0: cfs_write(%s) result=%d:%s", path, errsv, strerror(errsv)); else debugf(DBG_LEVEL_EXTALL, KBLU "exit 1: cfs_write(%s) "KRED"result=%d:%s", path, errsv, strerror(errsv)); return result; } static int cfs_unlink(const char* path) { debugf(DBG_LEVEL_NORM, KBLU "cfs_unlink(%s)", path); int success = cloudfs_delete_object(path); if (success == -1) { debugf(DBG_LEVEL_NORM, KRED "exit 0: cfs_unlink(%s)", path); return -EACCES; } if (success) { dir_decache(path); debugf(DBG_LEVEL_NORM, KBLU "exit 1: cfs_unlink(%s)", path); return 0; } debugf(DBG_LEVEL_NORM, KRED "exit 2: cfs_unlink(%s)", path); return -ENOENT; } static int cfs_fsync(const char* path, int idunno, struct fuse_file_info* info) { debugf(DBG_LEVEL_NORM, "cfs_fsync(%s)", path); return 0; } static int cfs_truncate(const char* path, off_t size) { debugf(DBG_LEVEL_NORM, "cfs_truncate(%s) size=%lu", path, size); cloudfs_object_truncate(path, size); update_dir_cache(path, size, 0, 0); debugf(DBG_LEVEL_NORM, "exit: cfs_truncate(%s)", path); return 0; } //this is called regularly on copy (via mc), is optimised (cached) static int cfs_statfs(const char* path, struct statvfs* stat) { debugf(DBG_LEVEL_NORM, KBLU "cfs_statfs(%s)", path); if (cloudfs_statfs(path, stat)) { debugf(DBG_LEVEL_NORM, KBLU "exit 0: cfs_statfs(%s)", path); return 0; } else { debugf(DBG_LEVEL_NORM, KRED"exit 1: cfs_statfs(%s) not-found", path); return -EIO; } } static int cfs_chown(const char* path, uid_t uid, gid_t gid) { debugf(DBG_LEVEL_NORM, KBLU "cfs_chown(%s,%d,%d)", path, uid, gid); dir_entry* de = check_path_info(path); if (de) { if (de->uid != uid || de->gid != gid) { debugf(DBG_LEVEL_NORM, "cfs_chown(%s): change from uid:gid %d:%d to %d:%d", path, de->uid, de->gid, uid, gid); de->uid = uid; de->gid = gid; //issue a PUT request to update metadata (quick request just to update headers) int response = cloudfs_update_meta(de); } } return 0; } static int cfs_chmod(const char* path, mode_t mode) { debugf(DBG_LEVEL_NORM, KBLU"cfs_chmod(%s,%d)", path, mode); dir_entry* de = check_path_info(path); if (de) { if (de->chmod != mode) { debugf(DBG_LEVEL_NORM, "cfs_chmod(%s): change mode from %d to %d", path, de->chmod, mode); de->chmod = mode; //todo: issue a PUT request to update metadata (empty request just to update headers?) int response = cloudfs_update_meta(de); } } return 0; } static int cfs_rename(const char* src, const char* dst) { debugf(DBG_LEVEL_NORM, KBLU"cfs_rename(%s, %s)", src, dst); dir_entry* src_de = path_info(src); if (!src_de) { debugf(DBG_LEVEL_NORM, KRED"exit 0: cfs_rename(%s,%s) not-found", src, dst); return -ENOENT; } if (src_de->isdir) { debugf(DBG_LEVEL_NORM, KRED"exit 1: cfs_rename(%s,%s) cannot rename dirs!", src, dst); return -EISDIR; } if (cloudfs_copy_object(src, dst)) { /* FIXME this isn't quite right as doesn't preserve last modified */ //fix done in cloudfs_copy_object() update_dir_cache(dst, src_de->size, 0, 0); int result = cfs_unlink(src); dir_entry* dst_de = path_info(dst); if (!dst_de) debugf(DBG_LEVEL_NORM, KRED"cfs_rename(%s,%s) dest-not-found-in-cache", src, dst); else { debugf(DBG_LEVEL_NORM, KBLU"cfs_rename(%s,%s) upload ok", src, dst); //copy attributes, shortcut, rather than forcing a download from cloud copy_dir_entry(src_de, dst_de); } debugf(DBG_LEVEL_NORM, KBLU"exit 3: cfs_rename(%s,%s)", src, dst); return result; } debugf(DBG_LEVEL_NORM, KRED"exit 4: cfs_rename(%s,%s) io error", src, dst); return -EIO; } static int cfs_symlink(const char* src, const char* dst) { debugf(DBG_LEVEL_NORM, KBLU"cfs_symlink(%s, %s)", src, dst); if (cloudfs_create_symlink(src, dst)) { update_dir_cache(dst, 1, 0, 1); debugf(DBG_LEVEL_NORM, KBLU"exit0: cfs_symlink(%s, %s)", src, dst); return 0; } debugf(DBG_LEVEL_NORM, KRED"exit1: cfs_symlink(%s, %s) io error", src, dst); return -EIO; } static int cfs_readlink(const char* path, char* buf, size_t size) { debugf(DBG_LEVEL_NORM, KBLU"cfs_readlink(%s)", path); //fixme: use temp file specified in config FILE* temp_file = tmpfile(); int ret = 0; if (!cloudfs_object_write_fp(path, temp_file)) { debugf(DBG_LEVEL_NORM, KRED"exit 1: cfs_readlink(%s) not found", path); ret = -ENOENT; } if (!pread(fileno(temp_file), buf, size, 0)) { debugf(DBG_LEVEL_NORM, KRED"exit 2: cfs_readlink(%s) not found", path); ret = -ENOENT; } fclose(temp_file); debugf(DBG_LEVEL_NORM, KBLU"exit 3: cfs_readlink(%s)", path); return ret; } static void* cfs_init(struct fuse_conn_info* conn) { signal(SIGPIPE, SIG_IGN); return NULL; } //http://man7.org/linux/man-pages/man2/utimensat.2.html static int cfs_utimens(const char* path, const struct timespec times[2]) { debugf(DBG_LEVEL_NORM, KBLU "cfs_utimens(%s)", path); dir_entry* path_de = path_info(path); if (!path_de) { debugf(DBG_LEVEL_NORM, KRED"exit 0: cfs_utimens(%s) file not in cache", path); return -ENOENT; } struct timespec now; clock_gettime(CLOCK_REALTIME, &now); if (path_de->atime.tv_sec != times[0].tv_sec || path_de->atime.tv_nsec != times[0].tv_nsec || path_de->mtime.tv_sec != times[1].tv_sec || path_de->mtime.tv_nsec != times[1].tv_nsec) { debugf(DBG_LEVEL_EXT, KCYN "cfs_utimens: change for %s, prev: atime=%li.%li mtime=%li.%li, new: atime=%li.%li mtime=%li.%li", path, path_de->atime.tv_sec, path_de->atime.tv_nsec, path_de->mtime.tv_sec, path_de->mtime.tv_nsec, times[0].tv_sec, times[0].tv_nsec, times[1].tv_sec, times[1].tv_nsec); char time_str[TIME_CHARS] = ""; get_timespec_as_str(×[1], time_str, sizeof(time_str)); debugf(DBG_LEVEL_EXT, KCYN"cfs_utimens: set mtime=[%s]", time_str); get_timespec_as_str(×[0], time_str, sizeof(time_str)); debugf(DBG_LEVEL_EXT, KCYN"cfs_utimens: set atime=[%s]", time_str); path_de->atime = times[0]; path_de->mtime = times[1]; // not sure how to best obtain ctime from fuse source file. just record current date. path_de->ctime = now; //calling a meta cloud update here is not always needed. //touch for example opens and closes/flush the file. //worth implementing a meta cache functionality to avoid multiple uploads on meta changes //when changing timestamps on very large files, touch command will trigger 2 x long and useless file uploads on cfs_flush() } else debugf(DBG_LEVEL_EXT, KCYN"cfs_utimens: a/m/time not changed"); debugf(DBG_LEVEL_NORM, KBLU "exit 1: cfs_utimens(%s)", path); return 0; } int cfs_setxattr(const char* path, const char* name, const char* value, size_t size, int flags) { return 0; } int cfs_getxattr(const char* path, const char* name, char* value, size_t size) { return 0; } int cfs_removexattr(const char* path, const char* name) { return 0; } int cfs_listxattr(const char* path, char* list, size_t size) { return 0; } FuseOptions options = { .cache_timeout = "600", .verify_ssl = "true", .segment_size = "1073741824", .segment_above = "2147483647", .storage_url = "", .container = "", //.temp_dir = "/tmp/", .temp_dir = "", .client_id = "", .client_secret = "", .refresh_token = "" }; ExtraFuseOptions extra_options = { .settings_filename = "", .get_extended_metadata = "false", .curl_verbose = "false", .cache_statfs_timeout = 0, .debug_level = 0, .curl_progress_state = "false", .enable_chown = "false", .enable_chmod = "false", .help = "false" }; int parse_option(void* data, const char* arg, int key, struct fuse_args* outargs) { if (sscanf(arg, " cache_timeout = %[^\r\n ]", options.cache_timeout) || sscanf(arg, " verify_ssl = %[^\r\n ]", options.verify_ssl) || sscanf(arg, " segment_above = %[^\r\n ]", options.segment_above) || sscanf(arg, " segment_size = %[^\r\n ]", options.segment_size) || sscanf(arg, " storage_url = %[^\r\n ]", options.storage_url) || sscanf(arg, " container = %[^\r\n ]", options.container) || sscanf(arg, " temp_dir = %[^\r\n ]", options.temp_dir) || sscanf(arg, " client_id = %[^\r\n ]", options.client_id) || sscanf(arg, " client_secret = %[^\r\n ]", options.client_secret) || sscanf(arg, " refresh_token = %[^\r\n ]", options.refresh_token) || sscanf(arg, " get_extended_metadata = %[^\r\n ]", extra_options.get_extended_metadata) || sscanf(arg, " curl_verbose = %[^\r\n ]", extra_options.curl_verbose) || sscanf(arg, " cache_statfs_timeout = %[^\r\n ]", extra_options.cache_statfs_timeout) || sscanf(arg, " debug_level = %[^\r\n ]", extra_options.debug_level) || sscanf(arg, " curl_progress_state = %[^\r\n ]", extra_options.curl_progress_state) || sscanf(arg, " enable_chmod = %[^\r\n ]", extra_options.enable_chmod) || sscanf(arg, " enable_chown = %[^\r\n ]", extra_options.enable_chown) ) return 0; if (!strncmp(arg, "settings_filename=", 18)) { arg += 18; strncpy(extra_options.settings_filename, arg, MAX_PATH_SIZE); return 0; } // Detect help for help enrichment if (!strcmp(arg, "-h") || !strcmp(arg, "--help")) strcpy(extra_options.help, "true"); if (!strcmp(arg, "-f") || !strcmp(arg, "-d") || !strcmp(arg, "debug")) cloudfs_debug(1); return 1; } //allows memory leaks inspections void interrupt_handler(int sig) { debugf(DBG_LEVEL_NORM, "Got interrupt signal %d, cleaning memory", sig); //TODO: clean memory allocations //http://www.cprogramming.com/debugging/valgrind.html cloudfs_free(); //TODO: clear dir cache pthread_mutex_destroy(&dcachemut); exit(0); } void initialise_options() { //todo: handle param init consistently, quite heavy implementation cloudfs_verify_ssl(!strcasecmp(options.verify_ssl, "true")); cloudfs_option_get_extended_metadata(!strcasecmp( extra_options.get_extended_metadata, "true")); cloudfs_option_curl_verbose(!strcasecmp(extra_options.curl_verbose, "true")); //lean way to init params, to be used as reference if (*extra_options.debug_level) option_debug_level = atoi(extra_options.debug_level); if (*extra_options.cache_statfs_timeout) option_cache_statfs_timeout = atoi(extra_options.cache_statfs_timeout); if (*extra_options.curl_progress_state) option_curl_progress_state = !strcasecmp(extra_options.curl_progress_state, "true"); if (*extra_options.enable_chmod) option_enable_chmod = !strcasecmp(extra_options.enable_chmod, "true"); if (*extra_options.enable_chown) option_enable_chown = !strcasecmp(extra_options.enable_chown, "true"); } int main(int argc, char** argv) { #if __x86_64__ || __ppc64__ const unsigned long MAX_SEGMENT_SIZE = (unsigned long)5 * (unsigned long)(1 << 30); #else const unsigned long MAX_SEGMENT_SIZE = (unsigned long)2 * (unsigned long)(1 << 30); #endif if (debug) fprintf(stderr, "Starting hubicfuse on homedir %s!\n", get_home_dir()); signal(SIGINT, interrupt_handler); int return_code; FILE* settings; struct fuse_args args = FUSE_ARGS_INIT(argc, argv); char default_settings[MAX_PATH_SIZE]; // Default value for extra_options.settings_filename snprintf(default_settings, MAX_PATH_SIZE, "%s/.hubicfuse", get_home_dir()); strncpy(extra_options.settings_filename, default_settings, MAX_PATH_SIZE); // Reading FUSE options fuse_opt_parse(&args, &options, NULL, parse_option); // Reading hubiC settings if ((settings = fopen(extra_options.settings_filename, "r"))) { char line[OPTION_SIZE]; while (fgets(line, sizeof(line), settings)) parse_option(NULL, line, -1, &args); fclose(settings); } cache_timeout = atoi(options.cache_timeout); segment_size = atoll(options.segment_size); segment_above = atoll(options.segment_above); // check consistency if (segment_above > MAX_SEGMENT_SIZE) { printf ("A segment cannot be larger than 5Gb\n"); return 1; } if (segment_size > segment_above) { printf ("segment_size must be smaller than segment_above\n"); return 1; } // this is ok since main is on the stack during the entire execution override_storage_url = options.storage_url; public_container = options.container; temp_dir = options.temp_dir; if (!*options.client_id || !*options.client_secret || !*options.refresh_token) { fprintf(stderr, "Unable to determine client_id, client_secret or refresh_token.\n\n"); fprintf(stderr, "These can be set either as mount options or in " "a file named %s\n\n", default_settings); fprintf(stderr, " client_id=[App's id]\n"); fprintf(stderr, " client_secret=[App's secret]\n"); fprintf(stderr, " refresh_token=[Get it running hubic_token]\n"); fprintf(stderr, "The following settings are optional:\n\n"); fprintf(stderr, " cache_timeout=[Seconds for directory caching, default 600]\n"); fprintf(stderr, " verify_ssl=[false to disable SSL cert verification]\n"); fprintf(stderr, " segment_size=[Size to use when creating DLOs, default 1073741824]\n"); fprintf(stderr, " segment_above=[File size at which to use segments, default 2147483648]\n"); fprintf(stderr, " storage_url=[Storage URL for other tenant to view container]\n"); fprintf(stderr, " container=[Public container to view of tenant specified by storage_url]\n"); fprintf(stderr, " temp_dir=[Directory to store temp files]\n"); fprintf(stderr, " get_extended_metadata=[true to enable download of utime, chmod, chown file attributes (but slower)]\n"); fprintf(stderr, " curl_verbose=[true to debug info on curl requests (lots of output)]\n"); fprintf(stderr, " curl_progress_state=[true to enable progress callback enabled. Mostly used for debugging]\n"); fprintf(stderr, " cache_statfs_timeout=[number of seconds to cache requests to statfs (cloud statistics), 0 for no cache]\n"); fprintf(stderr, " debug_level=[0 to 2, 0 for minimal verbose debugging. No debug if -d or -f option is not provided.]\n"); fprintf(stderr, " enable_chmod=[true to enable chmod support on fuse]\n"); fprintf(stderr, " enable_chown=[true to enable chown support on fuse]\n"); return 1; } cloudfs_init(); initialise_options(); if (debug) { fprintf(stderr, "settings_filename = %s\n", extra_options.settings_filename); fprintf(stderr, "debug_level = %d\n", option_debug_level); fprintf(stderr, "get_extended_metadata = %d\n", option_get_extended_metadata); fprintf(stderr, "curl_progress_state = %d\n", option_curl_progress_state); fprintf(stderr, "enable_chmod = %d\n", option_enable_chmod); fprintf(stderr, "enable_chown = %d\n", option_enable_chown); } cloudfs_set_credentials(options.client_id, options.client_secret, options.refresh_token); if (!cloudfs_connect()) { fprintf(stderr, "Failed to authenticate.\n"); return 1; } //todo: check why in some cases the define below is not available (when running the binary on symbolic linked folders) #ifndef HAVE_OPENSSL #warning Compiling without libssl, will run single-threaded. fuse_opt_add_arg(&args, "-s"); #endif struct fuse_operations cfs_oper = { .readdir = cfs_readdir, .mkdir = cfs_mkdir, .read = cfs_read, .create = cfs_create, .open = cfs_open, .fgetattr = cfs_fgetattr, .getattr = cfs_getattr, .flush = cfs_flush, .release = cfs_release, .rmdir = cfs_rmdir, .ftruncate = cfs_ftruncate, .truncate = cfs_truncate, .write = cfs_write, .unlink = cfs_unlink, .fsync = cfs_fsync, .statfs = cfs_statfs, .chmod = cfs_chmod, .chown = cfs_chown, .rename = cfs_rename, .symlink = cfs_symlink, .readlink = cfs_readlink, .init = cfs_init, .utimens = cfs_utimens, #ifdef HAVE_SETXATTR .setxattr = cfs_setxattr, .getxattr = cfs_getxattr, .listxattr = cfs_listxattr, .removexattr = cfs_removexattr, #endif }; pthread_mutexattr_init(&mutex_attr); pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE); pthread_mutex_init(&dcachemut, &mutex_attr); return_code = fuse_main(args.argc, args.argv, &cfs_oper, &options); if (return_code > 0 && !strcmp(extra_options.help, "true")) { fprintf(stderr, "\nhubiC options:\n"); fprintf(stderr, " -o settings_filename=FILE use FILE as hubiC settings\n"); fprintf(stderr, " instead of %s\n", default_settings); } return return_code; } hubicfuse-3.0.1/commonfs.c000066400000000000000000000471501306623177700155000ustar00rootroot00000000000000#define _GNU_SOURCE #include #include #include #include #include #include #include #ifdef __linux__ #include #endif #include #include #include #include #include #include #include #include #define FUSE_USE_VERSION 30 #include #include #include #include #include "commonfs.h" #include "config.h" pthread_mutex_t dcachemut; pthread_mutexattr_t mutex_attr; dir_cache* dcache; char* temp_dir; int cache_timeout; int debug = 0; int verify_ssl = 2; bool option_get_extended_metadata = false; bool option_curl_verbose = false; int option_cache_statfs_timeout = 0; int option_debug_level = 0; int option_curl_progress_state = 1;//1 to disable curl progress bool option_enable_chown = false; bool option_enable_chmod = false; bool option_enable_progressive_upload = false; bool option_enable_progressive_download = false; size_t file_buffer_size = 0; // needed to get correct GMT / local time // hubic stores time as GMT so we have to do conversions // http://zhu-qy.blogspot.ro/2012/11/ref-how-to-convert-from-utc-to-local.html time_t my_timegm(struct tm* tm) { time_t epoch = 0; time_t offset = mktime(gmtime(&epoch)); time_t utc = mktime(tm); return difftime(utc, offset); } //expect time_str as a friendly string format time_t get_time_from_str_as_gmt(char* time_str) { struct tm val_time_tm; time_t val_time_t; strptime(time_str, "%FT%T", &val_time_tm); val_time_tm.tm_isdst = -1; val_time_t = my_timegm(&val_time_tm); return val_time_t; } time_t get_time_as_local(time_t time_t_val, char time_str[], int char_buf_size) { struct tm loc_time_tm; loc_time_tm = *localtime(&time_t_val); if (time_str != NULL) { //debugf(DBG_LEVEL_NORM, 0,"Local len=%d size=%d pass=%d", strlen(time_str), sizeof(time_str), char_buf_size); strftime(time_str, char_buf_size, "%c", &loc_time_tm); //debugf(DBG_LEVEL_NORM, 0,"Local timestr=[%s] size=%d", time_str, strlen(time_str)); } //debugf(DBG_LEVEL_NORM, 0,"Local time_t %li", mktime(&loc_time_tm)); return mktime(&loc_time_tm); } int get_time_as_string(time_t time_t_val, long nsec, char* time_str, int time_str_len) { struct tm time_val_tm; time_t safe_input_time; //if time is incorrect (too long) you get segfault, need to check length and trim if (time_t_val > INT_MAX) { debugf(DBG_LEVEL_NORM, KRED"get_time_as_string: input time length too long, %lu > max=%lu, trimming!", time_t_val, INT_MAX); safe_input_time = 0;//(int)time_t_val; } else safe_input_time = time_t_val; time_val_tm = *gmtime(&safe_input_time); int str_len = strftime(time_str, time_str_len, HUBIC_DATE_FORMAT, &time_val_tm); char nsec_str[TIME_CHARS]; sprintf(nsec_str, "%ld", nsec); strcat(time_str, nsec_str); return str_len + strlen(nsec_str); } time_t get_time_now() { struct timespec now; clock_gettime(CLOCK_REALTIME, &now); return now.tv_sec; } size_t get_time_now_as_str(char* time_str, int time_str_len) { time_t now = time(0); struct tm tstruct; tstruct = *localtime(&now); // Visit http://en.cppreference.com/w/cpp/chrono/c/strftime // for more information about date/time format size_t result = strftime(time_str, time_str_len, HUBIC_DATE_FORMAT, &tstruct); return result; } int get_timespec_as_str(const struct timespec* times, char* time_str, int time_str_len) { return get_time_as_string(times->tv_sec, times->tv_nsec, time_str, time_str_len); } char* str2md5(const char* str, int length) { int n; MD5_CTX c; unsigned char digest[16]; char* out = (char*)malloc(33); MD5_Init(&c); while (length > 0) { if (length > 512) MD5_Update(&c, str, 512); else MD5_Update(&c, str, length); length -= 512; str += 512; } MD5_Final(digest, &c); for (n = 0; n < 16; ++n) snprintf(&(out[n * 2]), 16 * 2, "%02x", (unsigned int)digest[n]); return out; } // http://stackoverflow.com/questions/10324611/how-to-calculate-the-md5-hash-of-a-large-file-in-c int file_md5(FILE* file_handle, char* md5_file_str) { if (file_handle == NULL) { debugf(DBG_LEVEL_NORM, KRED"file_md5: NULL file handle"); return 0; } unsigned char c[MD5_DIGEST_LENGTH]; int i; MD5_CTX mdContext; int bytes; char mdchar[3];//2 chars for md5 + null string terminator unsigned char* data_buf = malloc(1024 * sizeof(unsigned char)); MD5_Init(&mdContext); while ((bytes = fread(data_buf, 1, 1024, file_handle)) != 0) MD5_Update(&mdContext, data_buf, bytes); MD5_Final(c, &mdContext); for (i = 0; i < MD5_DIGEST_LENGTH; i++) { snprintf(mdchar, 3, "%02x", c[i]); strcat(md5_file_str, mdchar); } free(data_buf); return 0; } int get_safe_cache_file_path(const char* path, char* file_path_safe, char* temp_dir) { char tmp_path[PATH_MAX]; strncpy(tmp_path, path, PATH_MAX); char* pch; while ((pch = strchr(tmp_path, '/'))) * pch = '.'; char file_path[PATH_MAX] = ""; //temp file name had process pid in it, removed as on restart files are left in cache (pid changes) snprintf(file_path, PATH_MAX, TEMP_FILE_NAME_FORMAT, temp_dir, tmp_path); //fixme check if sizeof or strlen is suitable int file_path_len = sizeof(file_path); //the file path name using this format can go beyond NAME_MAX size and will generate error on fopen //solution: cap file length to NAME_MAX, use a prefix from original path for debug purposes and add md5 id char* md5_path = str2md5(file_path, file_path_len); int md5len = strlen(md5_path); size_t safe_len_prefix = min(NAME_MAX - md5len, file_path_len); strncpy(file_path_safe, file_path, safe_len_prefix); strncpy(file_path_safe + safe_len_prefix, md5_path, md5len); //sometimes above copy process produces longer strings that NAME_MAX, force a null terminated string file_path_safe[safe_len_prefix + md5len - 1] = '\0'; free(md5_path); return strlen(file_path_safe); } void get_file_path_from_fd(int fd, char* path, int size_path) { char proc_path[MAX_PATH_SIZE]; /* Read out the link to our file descriptor. */ sprintf(proc_path, "/proc/self/fd/%d", fd); memset(path, 0, size_path); if (readlink(proc_path, path, size_path - 1) == -1) debugf(DBG_LEVEL_NORM, KRED "get_file_path_from_fd: cannot open %d\n", fd); } //for file descriptor debugging void debug_print_flags(int flags) { int accmode, val; accmode = flags & O_ACCMODE; if (accmode == O_RDONLY) debugf(DBG_LEVEL_EXTALL, KYEL"read only"); else if (accmode == O_WRONLY) debugf(DBG_LEVEL_EXTALL, KYEL"write only"); else if (accmode == O_RDWR) debugf(DBG_LEVEL_EXTALL, KYEL"read write"); else debugf(DBG_LEVEL_EXT, KYEL"unknown access mode"); if (val & O_APPEND) debugf(DBG_LEVEL_EXTALL, KYEL", append"); if (val & O_NONBLOCK) debugf(DBG_LEVEL_EXTALL, KYEL", nonblocking"); #if !defined(_POSIX_SOURCE) && defined(O_SYNC) if (val & O_SYNC) debugf(DBG_LEVEL_EXT, 0, KRED ", synchronous writes"); #endif } //for file descriptor debugging void debug_print_descriptor(struct fuse_file_info* info) { char file_path[MAX_PATH_SIZE]; openfile* of = (openfile *)(uintptr_t)info->fh; get_file_path_from_fd(of->fd, file_path, sizeof(file_path)); debugf(DBG_LEVEL_EXT, KCYN "descriptor localfile=[%s] fd=%lld", file_path, of->fd); debug_print_flags(info->flags); } void dir_for(const char* path, char* dir) { strncpy(dir, path, MAX_PATH_SIZE); char* slash = strrchr(dir, '/'); if (slash) *slash = '\0'; } //prints cache content for debug purposes void debug_list_cache_content() { return;//disabled dir_cache* cw; dir_entry* de; for (cw = dcache; cw; cw = cw->next) { debugf(DBG_LEVEL_EXT, "LIST-CACHE: DIR[%s]", cw->path); for (de = cw->entries; de; de = de->next) debugf(DBG_LEVEL_EXT, "LIST-CACHE: FOLDER[%s]", de->full_name); } } int delete_file(char* path) { debugf(DBG_LEVEL_NORM, KYEL"delete_file(%s)", path); char file_path_safe[NAME_MAX] = ""; get_safe_cache_file_path(path, file_path_safe, temp_dir); int result = unlink(file_path_safe); debugf(DBG_LEVEL_EXT, KYEL"delete_file(%s) (%s) result=%s", path, file_path_safe, strerror(result)); return result; } //adding a directory in cache dir_cache* new_cache(const char* path) { debugf(DBG_LEVEL_NORM, KCYN"new_cache(%s)", path); dir_cache* cw = (dir_cache*)calloc(sizeof(dir_cache), 1); cw->path = strdup(path); cw->prev = NULL; cw->entries = NULL; cw->cached = time(NULL); //added cache by access cw->accessed_in_cache = time(NULL); cw->was_deleted = false; if (dcache) dcache->prev = cw; cw->next = dcache; dir_cache* result; result = (dcache = cw); debugf(DBG_LEVEL_EXT, "exit: new_cache(%s)", path); return result; } //todo: check if the program behaves ok when free_dir //is made on a folder that has an operation in progress void cloudfs_free_dir_list(dir_entry* dir_list) { //check for NULL as dir might be already removed from cache by other thread debugf(DBG_LEVEL_NORM, "cloudfs_free_dir_list(%s)", dir_list->full_name); while (dir_list) { dir_entry* de = dir_list; dir_list = dir_list->next; //remove file from disk cache, fix for issue #89, https://github.com/TurboGit/hubicfuse/issues/89 delete_file(de->full_name); free(de->name); free(de->full_name); free(de->content_type); //TODO free all added fields free(de->md5sum); free(de); } } void dir_decache(const char* path) { dir_cache* cw; debugf(DBG_LEVEL_NORM, "dir_decache(%s)", path); pthread_mutex_lock(&dcachemut); dir_entry* de, *tmpde; char dir[MAX_PATH_SIZE]; dir_for(path, dir); for (cw = dcache; cw; cw = cw->next) { debugf(DBG_LEVEL_EXT, "dir_decache: parse(%s)", cw->path); if (!strcmp(cw->path, path)) { if (cw == dcache) dcache = cw->next; if (cw->prev) cw->prev->next = cw->next; if (cw->next) cw->next->prev = cw->prev; debugf(DBG_LEVEL_EXT, "dir_decache: free_dir1(%s)", cw->path); //fixme: this sometimes is NULL and generates segfaults, checking first if (cw->entries != NULL) cloudfs_free_dir_list(cw->entries); free(cw->path); free(cw); } else if (cw->entries && !strcmp(dir, cw->path)) { if (!strcmp(cw->entries->full_name, path)) { de = cw->entries; cw->entries = de->next; de->next = NULL; debugf(DBG_LEVEL_EXT, "dir_decache: free_dir2()"); cloudfs_free_dir_list(de); } else for (de = cw->entries; de->next; de = de->next) { if (!strcmp(de->next->full_name, path)) { tmpde = de->next; de->next = de->next->next; tmpde->next = NULL; debugf(DBG_LEVEL_EXT, "dir_decache: free_dir3()", cw->path); cloudfs_free_dir_list(tmpde); break; } } } } pthread_mutex_unlock(&dcachemut); } dir_entry* init_dir_entry() { dir_entry* de = (dir_entry*)malloc(sizeof(dir_entry)); de->metadata_downloaded = false; de->size = 0; de->next = NULL; de->md5sum = NULL; de->accessed_in_cache = time(NULL); de->last_modified = time(NULL); de->mtime.tv_sec = time(NULL); de->atime.tv_sec = time(NULL); de->ctime.tv_sec = time(NULL); de->mtime.tv_nsec = 0; de->atime.tv_nsec = 0; de->ctime.tv_nsec = 0; de->chmod = 0; de->gid = 0; de->uid = 0; return de; } void copy_dir_entry(dir_entry* src, dir_entry* dst) { dst->atime.tv_sec = src->atime.tv_sec; dst->atime.tv_nsec = src->atime.tv_nsec; dst->mtime.tv_sec = src->mtime.tv_sec; dst->mtime.tv_nsec = src->mtime.tv_nsec; dst->ctime.tv_sec = src->ctime.tv_sec; dst->ctime.tv_nsec = src->ctime.tv_nsec; dst->chmod = src->chmod; //todo: copy md5sum as well } //check for file in cache, if found size will be updated, if not found //and this is a dir, a new dir cache entry is created void update_dir_cache(const char* path, off_t size, int isdir, int islink) { debugf(DBG_LEVEL_EXTALL, KCYN "update_dir_cache(%s)", path); pthread_mutex_lock(&dcachemut); dir_cache* cw; dir_entry* de; char dir[MAX_PATH_SIZE]; dir_for(path, dir); for (cw = dcache; cw; cw = cw->next) { if (!strcmp(cw->path, dir)) { for (de = cw->entries; de; de = de->next) { if (!strcmp(de->full_name, path)) { de->size = size; pthread_mutex_unlock(&dcachemut); debugf(DBG_LEVEL_EXTALL, "exit 0: update_dir_cache(%s)", path); return; } } de = init_dir_entry(); de->size = size; de->isdir = isdir; de->islink = islink; de->name = strdup(&path[strlen(cw->path) + 1]); de->full_name = strdup(path); //fixed: the conditions below were mixed up dir -> link? if (islink) de->content_type = strdup("application/link"); if (isdir) de->content_type = strdup("application/directory"); else de->content_type = strdup("application/octet-stream"); de->next = cw->entries; cw->entries = de; if (isdir) new_cache(path); break; } } debugf(DBG_LEVEL_EXTALL, "exit 1: update_dir_cache(%s)", path); pthread_mutex_unlock(&dcachemut); } //returns first file entry in linked list. if not in cache will be downloaded. int caching_list_directory(const char* path, dir_entry** list) { debugf(DBG_LEVEL_EXT, "caching_list_directory(%s)", path); pthread_mutex_lock(&dcachemut); bool new_entry = false; if (!strcmp(path, "/")) path = ""; dir_cache* cw; for (cw = dcache; cw; cw = cw->next) { if (cw->was_deleted == true) { debugf(DBG_LEVEL_EXT, KMAG"caching_list_directory status: dir(%s) is empty as cached expired, reload from cloud", cw->path); if (!cloudfs_list_directory(cw->path, list)) debugf(DBG_LEVEL_EXT, KMAG"caching_list_directory status: cannot reload dir(%s)", cw->path); else { debugf(DBG_LEVEL_EXT, KMAG"caching_list_directory status: reloaded dir(%s)", cw->path); //cw->entries = *list; cw->was_deleted = false; cw->cached = time(NULL); } } if (cw->was_deleted == false) { if (!strcmp(cw->path, path)) break; } } if (!cw) { //trying to download this entry from cloud, list will point to cached or downloaded entries if (!cloudfs_list_directory(path, list)) { //download was not ok pthread_mutex_unlock(&dcachemut); debugf(DBG_LEVEL_EXT, "exit 0: caching_list_directory(%s) "KYEL"[CACHE-DIR-MISS]", path); return 0; } debugf(DBG_LEVEL_EXT, "caching_list_directory: new_cache(%s) "KYEL"[CACHE-CREATE]", path); cw = new_cache(path); new_entry = true; } else if (cache_timeout > 0 && (time(NULL) - cw->cached > cache_timeout)) { if (!cloudfs_list_directory(path, list)) { //mutex unlock was forgotten pthread_mutex_unlock(&dcachemut); debugf(DBG_LEVEL_EXT, "exit 1: caching_list_directory(%s)", path); return 0; } //fixme: this frees dir subentries but leaves the dir parent entry, this confuses path_info //which believes this dir has no entries if (cw->entries != NULL) { cloudfs_free_dir_list(cw->entries); cw->was_deleted = true; cw->cached = time(NULL); debugf(DBG_LEVEL_EXT, "caching_list_directory(%s) "KYEL"[CACHE-EXPIRED]", path); } else { debugf(DBG_LEVEL_EXT, "got NULL on caching_list_directory(%s) "KYEL"[CACHE-EXPIRED w NULL]", path); pthread_mutex_unlock(&dcachemut); return 0; } } else { debugf(DBG_LEVEL_EXT, "caching_list_directory(%s) "KGRN"[CACHE-DIR-HIT]", path); *list = cw->entries; } //adding new dir file list to global cache, now this dir becomes visible in cache cw->entries = *list; pthread_mutex_unlock(&dcachemut); debugf(DBG_LEVEL_EXT, "exit 2: caching_list_directory(%s)", path); return 1; } dir_entry* path_info(const char* path) { debugf(DBG_LEVEL_EXT, "path_info(%s)", path); char dir[MAX_PATH_SIZE]; dir_for(path, dir); dir_entry* tmp; if (!caching_list_directory(dir, &tmp)) { debugf(DBG_LEVEL_EXT, "exit 0: path_info(%s) "KYEL"[CACHE-DIR-MISS]", dir); return NULL; } else debugf(DBG_LEVEL_EXT, "path_info(%s) "KGRN"[CACHE-DIR-HIT]", dir); //iterate in file list obtained from cache or downloaded for (; tmp; tmp = tmp->next) { if (!strcmp(tmp->full_name, path)) { debugf(DBG_LEVEL_EXT, "exit 1: path_info(%s) "KGRN"[CACHE-FILE-HIT]", path); return tmp; } } //miss in case the file is not found on a cached folder debugf(DBG_LEVEL_EXT, "exit 2: path_info(%s) "KYEL"[CACHE-MISS]", path); return NULL; } //retrieve folder from local cache if exists, return null if does not exist (rather than download) int check_caching_list_directory(const char* path, dir_entry** list) { debugf(DBG_LEVEL_EXT, "check_caching_list_directory(%s)", path); pthread_mutex_lock(&dcachemut); if (!strcmp(path, "/")) path = ""; dir_cache* cw; for (cw = dcache; cw; cw = cw->next) if (!strcmp(cw->path, path)) { *list = cw->entries; pthread_mutex_unlock(&dcachemut); debugf(DBG_LEVEL_EXT, "exit 0: check_caching_list_directory(%s) "KGRN"[CACHE-DIR-HIT]", path); return 1; } pthread_mutex_unlock(&dcachemut); debugf(DBG_LEVEL_EXT, "exit 1: check_caching_list_directory(%s) "KYEL"[CACHE-DIR-MISS]", path); return 0; } dir_entry* check_parent_folder_for_file(const char* path) { char dir[MAX_PATH_SIZE]; dir_for(path, dir); dir_entry* tmp; if (!check_caching_list_directory(dir, &tmp)) return NULL; else return tmp; } //check if local path is in cache, without downloading from cloud if not in cache dir_entry* check_path_info(const char* path) { debugf(DBG_LEVEL_EXT, "check_path_info(%s)", path); char dir[MAX_PATH_SIZE]; dir_for(path, dir); dir_entry* tmp; //get parent folder cache entry if (!check_caching_list_directory(dir, &tmp)) { debugf(DBG_LEVEL_EXT, "exit 0: check_path_info(%s) "KYEL"[CACHE-MISS]", path); return NULL; } for (; tmp; tmp = tmp->next) { if (!strcmp(tmp->full_name, path)) { debugf(DBG_LEVEL_EXT, "exit 1: check_path_info(%s) "KGRN"[CACHE-HIT]", path); return tmp; } } if (!strcmp(path, "/")) debugf(DBG_LEVEL_EXT, "exit 2: check_path_info(%s) "KYEL"ignoring root [CACHE-MISS]", path); else debugf(DBG_LEVEL_EXT, "exit 3: check_path_info(%s) "KYEL"[CACHE-MISS]", path); return NULL; } char* get_home_dir() { char* home; if ((home = getenv("HOME")) && !access(home, R_OK)) return home; struct passwd* pwd = getpwuid(geteuid()); if ((home = pwd->pw_dir) && !access(home, R_OK)) return home; return "~"; } void cloudfs_debug(int dbg) { debug = dbg; } void debugf(int level, char* fmt, ...) { if (debug) { if (level <= option_debug_level) { #ifdef SYS_gettid pid_t thread_id = syscall(SYS_gettid); #else int thread_id = 0; #error "SYS_gettid unavailable on this system" #endif va_list args; char prefix[] = "==DBG %d [%s]:%d=="; char line[4096]; char time_str[TIME_CHARS]; get_time_now_as_str(time_str, sizeof(time_str)); sprintf(line, prefix, level, time_str, thread_id); fputs(line, stderr); va_start(args, fmt); vfprintf(stderr, fmt, args); va_end(args); fputs(KNRM, stderr); putc('\n', stderr); putc('\r', stderr); } } } hubicfuse-3.0.1/commonfs.h000066400000000000000000000072461306623177700155070ustar00rootroot00000000000000#ifndef _COMMONFS_H #define _COMMONFS_H #define FUSE_USE_VERSION 30 #include typedef enum { false, true } bool; #define MAX_PATH_SIZE (1024 + 256 + 3) #define THREAD_NAMELEN 16 // 64 bit time + nanoseconds #define TIME_CHARS 32 #define DBG_LEVEL_NORM 0 #define DBG_LEVEL_EXT 1 #define DBG_LEVEL_EXTALL 2 #define INT_CHAR_LEN 16 #define MD5_DIGEST_HEXA_STRING_LEN (2 * MD5_DIGEST_LENGTH + 1) // utimens support #define HEADER_TEXT_MTIME "X-Object-Meta-Mtime" #define HEADER_TEXT_ATIME "X-Object-Meta-Atime" #define HEADER_TEXT_CTIME "X-Object-Meta-Ctime" #define HEADER_TEXT_MTIME_DISPLAY "X-Object-Meta-Mtime-Display" #define HEADER_TEXT_ATIME_DISPLAY "X-Object-Meta-Atime-Display" #define HEADER_TEXT_CTIME_DISPLAY "X-Object-Meta-Ctime-Display" #define HEADER_TEXT_CHMOD "X-Object-Meta-Chmod" #define HEADER_TEXT_UID "X-Object-Meta-Uid" #define HEADER_TEXT_GID "X-Object-Meta-Gid" #define HEADER_TEXT_FILEPATH "X-Object-Meta-FilePath" #define TEMP_FILE_NAME_FORMAT "%s/.cloudfuse_%s" #define HUBIC_DATE_FORMAT "%Y-%m-%d %T." #define KNRM "\x1B[0m" #define KRED "\x1B[31m" #define KGRN "\x1B[32m" #define KYEL "\x1B[33m" #define KBLU "\x1B[34m" #define KMAG "\x1B[35m" #define KCYN "\x1B[36m" #define KWHT "\x1B[37m" #define min(x, y) ({ \ typeof(x) _min1 = (x); \ typeof(y) _min2 = (y); \ (void)(&_min1 == &_min2); \ _min1 < _min2 ? _min1 : _min2; }) //linked list with files in a directory typedef struct dir_entry { char* name; char* full_name; char* content_type; off_t size; time_t last_modified; // implement utimens struct timespec mtime; struct timespec ctime; struct timespec atime; char* md5sum; //interesting capability for rsync/scrub mode_t chmod; uid_t uid; gid_t gid; bool issegmented; time_t accessed_in_cache;//todo: cache support based on access time bool metadata_downloaded; // end change int isdir; int islink; struct dir_entry* next; } dir_entry; // linked list with cached folder names typedef struct dir_cache { char* path; dir_entry* entries; time_t cached; //added cache support based on access time time_t accessed_in_cache; bool was_deleted; //end change struct dir_cache* next, *prev; } dir_cache; typedef struct { int fd; int flags; } openfile; time_t my_timegm(struct tm* tm); time_t get_time_from_str_as_gmt(char* time_str); time_t get_time_as_local(time_t time_t_val, char time_str[], int char_buf_size); int get_time_as_string(time_t time_t_val, long nsec, char* time_str, int time_str_len); time_t get_time_now(); int get_timespec_as_str(const struct timespec* times, char* time_str, int time_str_len); char* str2md5(const char* str, int length); int file_md5(FILE* file_handle, char* md5_file_str); void debug_print_descriptor(struct fuse_file_info* info); int get_safe_cache_file_path(const char* file_path, char* file_path_safe, char* temp_dir); dir_entry* init_dir_entry(); void copy_dir_entry(dir_entry* src, dir_entry* dst); dir_cache* new_cache(const char* path); void dir_for(const char* path, char* dir); void debug_list_cache_content(); void update_dir_cache(const char* path, off_t size, int isdir, int islink); dir_entry* path_info(const char* path); dir_entry* check_path_info(const char* path); dir_entry* check_parent_folder_for_file(const char* path); void dir_decache(const char* path); void cloudfs_free_dir_list(dir_entry* dir_list); extern int cloudfs_list_directory(const char* path, dir_entry**); int caching_list_directory(const char* path, dir_entry** list); char* get_home_dir(); void cloudfs_debug(int dbg); void debugf(int level, char* fmt, ...); #endif hubicfuse-3.0.1/config.h.in000066400000000000000000000112441306623177700155310ustar00rootroot00000000000000/* config.h.in. Generated from configure.in by autoheader. */ /* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP systems. This function is required for `alloca.c' support on those systems. */ #undef CRAY_STACKSEG_END /* Define to 1 if using `alloca.c'. */ #undef C_ALLOCA /* Define to 1 if you have the `alarm' function. */ #undef HAVE_ALARM /* Define to 1 if you have `alloca', as a function or macro. */ #undef HAVE_ALLOCA /* Define to 1 if you have and it should be used (not on Ultrix). */ #undef HAVE_ALLOCA_H /* Define to 1 if you have the header file. */ #undef HAVE_CURL_CURL_H /* Define to 1 if you don't have `vprintf' but do have `_doprnt.' */ #undef HAVE_DOPRNT /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H /* Define to 1 if you have the `ftruncate' function. */ #undef HAVE_FTRUNCATE /* Define to 1 if you have the header file. */ #undef HAVE_FUSE_H /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_LIBXML_TREE_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 `memmove' function. */ #undef HAVE_MEMMOVE /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H /* Openssl headers were found */ #undef HAVE_OPENSSL /* Define to 1 if you have the header file. */ #undef HAVE_PTHREAD_H /* 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 header file. */ #undef HAVE_STRINGS_H /* Define to 1 if you have the header file. */ #undef HAVE_STRING_H /* Define to 1 if you have the `strncasecmp' function. */ #undef HAVE_STRNCASECMP /* Define to 1 if you have the `strrchr' function. */ #undef HAVE_STRRCHR /* Define to 1 if you have the `strstr' function. */ #undef HAVE_STRSTR /* Define to 1 if `st_blocks' is a member of `struct stat'. */ #undef HAVE_STRUCT_STAT_ST_BLOCKS /* Define to 1 if your `struct stat' has `st_blocks'. Deprecated, use `HAVE_STRUCT_STAT_ST_BLOCKS' instead. */ #undef HAVE_ST_BLOCKS /* Define to 1 if you have the header file. */ #undef HAVE_SYS_STAT_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TIME_H /* Define to 1 if you have the header file. */ #undef HAVE_SYS_TYPES_H /* Define to 1 if you have the header file. */ #undef HAVE_UNISTD_H /* Define to 1 if you have the `vprintf' function. */ #undef HAVE_VPRINTF /* 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 as the return type of signal handlers (`int' or `void'). */ #undef RETSIGTYPE /* If using the C implementation of alloca, define if you know the direction of stack growth for your system; otherwise it will be automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ #undef STACK_DIRECTION /* 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 /* 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 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 `unsigned int' if does not define. */ #undef size_t /* Define to `int' if doesn't define. */ #undef uid_t hubicfuse-3.0.1/configure000077500000000000000000005575431306623177700154360ustar00rootroot00000000000000#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.69 for hubicfuse 3.0.0. # # 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 Pascal Obry $0: about your system, including any $0: error possibly output before this message. Then install $0: a modern shell, or manually run the script under such a $0: 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='hubicfuse' PACKAGE_TARNAME='hubicfuse' PACKAGE_VERSION='3.0.0' PACKAGE_STRING='hubicfuse 3.0.0' PACKAGE_BUGREPORT='Pascal Obry ' PACKAGE_URL='' ac_unique_file="cloudfuse.c" # 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_func_list= ac_subst_vars='LTLIBOBJS LIBOBJS ALLOCA EGREP GREP CPP OPENSSL_LIBS OPENSSL_CFLAGS JSON_LIBS JSON_CFLAGS FUSE_LIBS FUSE_CFLAGS CURL_LIBS CURL_CFLAGS XML_LIBS XML_CFLAGS PKG_CONFIG_LIBDIR PKG_CONFIG_PATH PKG_CONFIG MKDIR_P INSTALL_DATA INSTALL_SCRIPT INSTALL_PROGRAM OBJEXT EXEEXT ac_ct_CC LDFLAGS CFLAGS CC CPPFLAGS 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 runstatedir 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 ' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS PKG_CONFIG PKG_CONFIG_PATH PKG_CONFIG_LIBDIR XML_CFLAGS XML_LIBS CURL_CFLAGS CURL_LIBS FUSE_CFLAGS FUSE_LIBS JSON_CFLAGS JSON_LIBS OPENSSL_CFLAGS OPENSSL_LIBS CPP' # 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' runstatedir='${localstatedir}/run' 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 ;; -runstatedir | --runstatedir | --runstatedi | --runstated \ | --runstate | --runstat | --runsta | --runst | --runs \ | --run | --ru | --r) ac_prev=runstatedir ;; -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \ | --run=* | --ru=* | --r=*) runstatedir=$ac_optarg ;; -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 runstatedir 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 hubicfuse 3.0.0 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] --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run] --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/hubicfuse] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of hubicfuse 3.0.0:";; esac cat <<\_ACEOF 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 PKG_CONFIG path to pkg-config utility PKG_CONFIG_PATH directories to add to pkg-config's search path PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path XML_CFLAGS C compiler flags for XML, overriding pkg-config XML_LIBS linker flags for XML, overriding pkg-config CURL_CFLAGS C compiler flags for CURL, overriding pkg-config CURL_LIBS linker flags for CURL, overriding pkg-config FUSE_CFLAGS C compiler flags for FUSE, overriding pkg-config FUSE_LIBS linker flags for FUSE, overriding pkg-config OPENSSL_CFLAGS C compiler flags for OPENSSL, overriding pkg-config OPENSSL_LIBS linker flags for OPENSSL, overriding pkg-config CPP C preprocessor 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 hubicfuse configure 3.0.0 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_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_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_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_compile LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists and can be compiled using the include files in # INCLUDES, setting the cache variable VAR accordingly. ac_fn_c_check_header_compile () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_header_compile # ac_fn_c_try_link LINENO # ----------------------- # Try to link conftest.$ac_ext, and return whether this succeeded. ac_fn_c_try_link () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack rm -f conftest.$ac_objext conftest$ac_exeext if { { ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" $as_echo "$ac_try_echo"; } >&5 (eval "$ac_link") 2>conftest.err ac_status=$? if test -s conftest.err; then grep -v '^ *+' conftest.err >conftest.er1 cat conftest.er1 >&5 mv -f conftest.er1 conftest.err fi $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && { test "$cross_compiling" = yes || test -x conftest$ac_exeext }; then : ac_retval=0 else $as_echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_retval=1 fi # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would # interfere with the next link command; also delete a directory that is # left behind by Apple's compiler. We do this before executing the actions. rm -rf conftest.dSYM conftest_ipa8_conftest.oo eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno as_fn_set_status $ac_retval } # ac_fn_c_try_link # ac_fn_c_check_func LINENO FUNC VAR # ---------------------------------- # Tests whether FUNC exists, setting the cache variable VAR accordingly ac_fn_c_check_func () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Define $2 to an innocuous variant, in case declares $2. For example, HP-UX 11i declares gettimeofday. */ #define $2 innocuous_$2 /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $2 (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $2 /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $2 (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$2 || defined __stub___$2 choke me #endif int main () { return $2 (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : eval "$3=yes" else eval "$3=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno } # ac_fn_c_check_func # ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES # ------------------------------------------------------- # Tests whether HEADER exists, giving a warning if it cannot be compiled using # the include files in INCLUDES and setting the cache variable VAR # accordingly. ac_fn_c_check_header_mongrel () { as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack if eval \${$3+:} false; then : { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 $as_echo_n "checking for $2... " >&6; } if eval \${$3+:} false; then : $as_echo_n "(cached) " >&6 fi eval ac_res=\$$3 { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 $as_echo "$ac_res" >&6; } else # Is the header compilable? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 $as_echo_n "checking $2 usability... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $4 #include <$2> _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_header_compiler=yes else ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 $as_echo "$ac_header_compiler" >&6; } # Is the header present? { $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 $as_echo_n "checking $2 presence... " >&6; } cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include <$2> _ACEOF if ac_fn_c_try_cpp "$LINENO"; then : ac_header_preproc=yes else ac_header_preproc=no fi rm -f conftest.err conftest.i conftest.$ac_ext { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 $as_echo "$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( yes:no: ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 $as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ;; no:yes:* ) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 $as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 $as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 $as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 $as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 $as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} ( $as_echo "## -------------------------------------------- ## ## Report this to Pascal Obry ## ## -------------------------------------------- ##" ) | 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_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 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 hubicfuse $as_me 3.0.0, which was generated by GNU Autoconf 2.69. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. $as_echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; 2) as_fn_append ac_configure_args1 " '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi as_fn_append ac_configure_args " '$ac_arg'" ;; esac done done { ac_configure_args0=; unset ac_configure_args0;} { ac_configure_args1=; unset ac_configure_args1;} # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo $as_echo "## ---------------- ## ## Cache variables. ## ## ---------------- ##" echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( *) { eval $ac_var=; unset $ac_var;} ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo $as_echo "## ----------------- ## ## Output variables. ## ## ----------------- ##" echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then $as_echo "## ------------------- ## ## File substitutions. ## ## ------------------- ##" echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac $as_echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then $as_echo "## ----------- ## ## confdefs.h. ## ## ----------- ##" echo cat confdefs.h echo fi test "$ac_signal" != 0 && $as_echo "$as_me: caught signal $ac_signal" $as_echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h $as_echo "/* confdefs.h */" > confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_URL "$PACKAGE_URL" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer an explicitly selected file to automatically selected ones. ac_site_file1=NONE ac_site_file2=NONE if test -n "$CONFIG_SITE"; then # We do not want a PATH search for config.site. case $CONFIG_SITE in #(( -*) ac_site_file1=./$CONFIG_SITE;; */*) ac_site_file1=$CONFIG_SITE;; *) ac_site_file1=./$CONFIG_SITE;; esac elif test "x$prefix" != xNONE; then ac_site_file1=$prefix/share/config.site ac_site_file2=$prefix/etc/config.site else ac_site_file1=$ac_default_prefix/share/config.site ac_site_file2=$ac_default_prefix/etc/config.site fi for ac_site_file in "$ac_site_file1" "$ac_site_file2" do test "x$ac_site_file" = xNONE && continue if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 $as_echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" \ || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "failed to load site script $ac_site_file See \`config.log' for more details" "$LINENO" 5; } fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special files # actually), so we avoid doing that. DJGPP emulates it as a regular file. if test /dev/null != "$cache_file" && test -f "$cache_file"; then { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 $as_echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi as_fn_append ac_header_list " sys/time.h" as_fn_append ac_header_list " unistd.h" as_fn_append ac_func_list " alarm" # 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 CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2" 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_config_headers="$ac_config_headers config.h" ac_config_files="$ac_config_files Makefile" # 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 ac_aux_dir= for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. # Reject install programs that cannot install multiple files. { $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 $as_echo_n "checking for a BSD-compatible install... " >&6; } if test -z "$INSTALL"; then if ${ac_cv_path_install+:} false; then : $as_echo_n "(cached) " >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in #(( ./ | .// | /[cC]/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else rm -rf conftest.one conftest.two conftest.dir echo one > conftest.one echo two > conftest.two mkdir conftest.dir if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && test -s conftest.one && test -s conftest.two && test -s conftest.dir/conftest.one && test -s conftest.dir/conftest.two then ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi fi done done ;; esac done IFS=$as_save_IFS rm -rf conftest.one conftest.two conftest.dir fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 $as_echo "$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { $as_echo "$as_me:${as_lineno-$LINENO}: checking 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; } # Checks that pkg-config is installed if test "x$ac_cv_env_PKG_CONFIG_set" != "xset"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}pkg-config", so it can be a program name with args. set dummy ${ac_tool_prefix}pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_PKG_CONFIG="$PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi PKG_CONFIG=$ac_cv_path_PKG_CONFIG if test -n "$PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PKG_CONFIG" >&5 $as_echo "$PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi fi if test -z "$ac_cv_path_PKG_CONFIG"; then ac_pt_PKG_CONFIG=$PKG_CONFIG # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } if ${ac_cv_path_ac_pt_PKG_CONFIG+:} false; then : $as_echo_n "(cached) " >&6 else case $ac_pt_PKG_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_ac_pt_PKG_CONFIG="$ac_pt_PKG_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then ac_cv_path_ac_pt_PKG_CONFIG="$as_dir/$ac_word$ac_exec_ext" $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi ac_pt_PKG_CONFIG=$ac_cv_path_ac_pt_PKG_CONFIG if test -n "$ac_pt_PKG_CONFIG"; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_pt_PKG_CONFIG" >&5 $as_echo "$ac_pt_PKG_CONFIG" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } fi if test "x$ac_pt_PKG_CONFIG" = x; then PKG_CONFIG="" else case $cross_compiling:$ac_tool_warned in yes:) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 $as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} ac_tool_warned=yes ;; esac PKG_CONFIG=$ac_pt_PKG_CONFIG fi else PKG_CONFIG="$ac_cv_path_PKG_CONFIG" fi fi if test -n "$PKG_CONFIG"; then _pkg_min_version=0.9.0 { $as_echo "$as_me:${as_lineno-$LINENO}: checking pkg-config is at least version $_pkg_min_version" >&5 $as_echo_n "checking pkg-config is at least version $_pkg_min_version... " >&6; } if $PKG_CONFIG --atleast-pkgconfig-version $_pkg_min_version; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } else { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } PKG_CONFIG="" fi fi # Checks for libraries. pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for XML" >&5 $as_echo_n "checking for XML... " >&6; } if test -n "$XML_CFLAGS"; then pkg_cv_XML_CFLAGS="$XML_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "libxml-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_XML_CFLAGS=`$PKG_CONFIG --cflags "libxml-2.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$XML_LIBS"; then pkg_cv_XML_LIBS="$XML_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libxml-2.0\""; } >&5 ($PKG_CONFIG --exists --print-errors "libxml-2.0") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_XML_LIBS=`$PKG_CONFIG --libs "libxml-2.0" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then XML_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libxml-2.0" 2>&1` else XML_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libxml-2.0" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$XML_PKG_ERRORS" >&5 as_fn_error $? "'Unable to find libxml2. Please make sure library and header files are installed.'" "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "'Unable to find libxml2. Please make sure library and header files are installed.'" "$LINENO" 5 else XML_CFLAGS=$pkg_cv_XML_CFLAGS XML_LIBS=$pkg_cv_XML_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for CURL" >&5 $as_echo_n "checking for CURL... " >&6; } if test -n "$CURL_CFLAGS"; then pkg_cv_CURL_CFLAGS="$CURL_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcurl\""; } >&5 ($PKG_CONFIG --exists --print-errors "libcurl") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CURL_CFLAGS=`$PKG_CONFIG --cflags "libcurl" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$CURL_LIBS"; then pkg_cv_CURL_LIBS="$CURL_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libcurl\""; } >&5 ($PKG_CONFIG --exists --print-errors "libcurl") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_CURL_LIBS=`$PKG_CONFIG --libs "libcurl" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then CURL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libcurl" 2>&1` else CURL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libcurl" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$CURL_PKG_ERRORS" >&5 as_fn_error $? "'Unable to find libcurl. Please make sure library and header files are installed.'" "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "'Unable to find libcurl. Please make sure library and header files are installed.'" "$LINENO" 5 else CURL_CFLAGS=$pkg_cv_CURL_CFLAGS CURL_LIBS=$pkg_cv_CURL_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for FUSE" >&5 $as_echo_n "checking for FUSE... " >&6; } if test -n "$FUSE_CFLAGS"; then pkg_cv_FUSE_CFLAGS="$FUSE_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fuse\""; } >&5 ($PKG_CONFIG --exists --print-errors "fuse") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_FUSE_CFLAGS=`$PKG_CONFIG --cflags "fuse" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$FUSE_LIBS"; then pkg_cv_FUSE_LIBS="$FUSE_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"fuse\""; } >&5 ($PKG_CONFIG --exists --print-errors "fuse") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_FUSE_LIBS=`$PKG_CONFIG --libs "fuse" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then FUSE_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "fuse" 2>&1` else FUSE_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "fuse" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$FUSE_PKG_ERRORS" >&5 as_fn_error $? "'Unable to find libfuse. Please make sure library and header files are installed.'" "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "'Unable to find libfuse. Please make sure library and header files are installed.'" "$LINENO" 5 else FUSE_CFLAGS=$pkg_cv_FUSE_CFLAGS FUSE_LIBS=$pkg_cv_FUSE_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JSON" >&5 $as_echo_n "checking for JSON... " >&6; } if test -n "$JSON_CFLAGS"; then pkg_cv_JSON_CFLAGS="$JSON_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-c\""; } >&5 ($PKG_CONFIG --exists --print-errors "json-c") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_JSON_CFLAGS=`$PKG_CONFIG --cflags "json-c" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$JSON_LIBS"; then pkg_cv_JSON_LIBS="$JSON_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json-c\""; } >&5 ($PKG_CONFIG --exists --print-errors "json-c") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_JSON_LIBS=`$PKG_CONFIG --libs "json-c" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then JSON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "json-c" 2>&1` else JSON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "json-c" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$JSON_PKG_ERRORS" >&5 JSON_CFLAGS C compiler flags for JSON, overriding pkg-config JSON_LIBS linker flags for JSON, overriding pkg-config pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JSON" >&5 $as_echo_n "checking for JSON... " >&6; } if test -n "$JSON_CFLAGS"; then pkg_cv_JSON_CFLAGS="$JSON_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json\""; } >&5 ($PKG_CONFIG --exists --print-errors "json") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_JSON_CFLAGS=`$PKG_CONFIG --cflags "json" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$JSON_LIBS"; then pkg_cv_JSON_LIBS="$JSON_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json\""; } >&5 ($PKG_CONFIG --exists --print-errors "json") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_JSON_LIBS=`$PKG_CONFIG --libs "json" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then JSON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "json" 2>&1` else JSON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "json" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$JSON_PKG_ERRORS" >&5 as_fn_error $? "'Unable to find libjson. Please make sure library and header files are installed.'" "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "'Unable to find libjson. Please make sure library and header files are installed.'" "$LINENO" 5 else JSON_CFLAGS=$pkg_cv_JSON_CFLAGS JSON_LIBS=$pkg_cv_JSON_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } JSON_CFLAGS C compiler flags for JSON, overriding pkg-config JSON_LIBS linker flags for JSON, overriding pkg-config pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for JSON" >&5 $as_echo_n "checking for JSON... " >&6; } if test -n "$JSON_CFLAGS"; then pkg_cv_JSON_CFLAGS="$JSON_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json\""; } >&5 ($PKG_CONFIG --exists --print-errors "json") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_JSON_CFLAGS=`$PKG_CONFIG --cflags "json" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$JSON_LIBS"; then pkg_cv_JSON_LIBS="$JSON_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"json\""; } >&5 ($PKG_CONFIG --exists --print-errors "json") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_JSON_LIBS=`$PKG_CONFIG --libs "json" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then JSON_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "json" 2>&1` else JSON_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "json" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$JSON_PKG_ERRORS" >&5 as_fn_error $? "'Unable to find libjson. Please make sure library and header files are installed.'" "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } as_fn_error $? "'Unable to find libjson. Please make sure library and header files are installed.'" "$LINENO" 5 else JSON_CFLAGS=$pkg_cv_JSON_CFLAGS JSON_LIBS=$pkg_cv_JSON_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi else JSON_CFLAGS=$pkg_cv_JSON_CFLAGS JSON_LIBS=$pkg_cv_JSON_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi pkg_failed=no { $as_echo "$as_me:${as_lineno-$LINENO}: checking for OPENSSL" >&5 $as_echo_n "checking for OPENSSL... " >&6; } if test -n "$OPENSSL_CFLAGS"; then pkg_cv_OPENSSL_CFLAGS="$OPENSSL_CFLAGS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5 ($PKG_CONFIG --exists --print-errors "openssl") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_OPENSSL_CFLAGS=`$PKG_CONFIG --cflags "openssl" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test -n "$OPENSSL_LIBS"; then pkg_cv_OPENSSL_LIBS="$OPENSSL_LIBS" elif test -n "$PKG_CONFIG"; then if test -n "$PKG_CONFIG" && \ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"openssl\""; } >&5 ($PKG_CONFIG --exists --print-errors "openssl") 2>&5 ac_status=$? $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 test $ac_status = 0; }; then pkg_cv_OPENSSL_LIBS=`$PKG_CONFIG --libs "openssl" 2>/dev/null` test "x$?" != "x0" && pkg_failed=yes else pkg_failed=yes fi else pkg_failed=untried fi if test $pkg_failed = yes; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then _pkg_short_errors_supported=yes else _pkg_short_errors_supported=no fi if test $_pkg_short_errors_supported = yes; then OPENSSL_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "openssl" 2>&1` else OPENSSL_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "openssl" 2>&1` fi # Put the nasty error message in config.log where it belongs echo "$OPENSSL_PKG_ERRORS" >&5 as_fn_error $? "Package requirements (openssl) were not met: $OPENSSL_PKG_ERRORS Consider adjusting the PKG_CONFIG_PATH environment variable if you installed software in a non-standard prefix. Alternatively, you may set the environment variables OPENSSL_CFLAGS and OPENSSL_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details." "$LINENO" 5 elif test $pkg_failed = untried; then { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 $as_echo "no" >&6; } { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 $as_echo "$as_me: error: in \`$ac_pwd':" >&2;} as_fn_error $? "The pkg-config script could not be found or is too old. Make sure it is in your PATH or set the PKG_CONFIG environment variable to the full path to pkg-config. Alternatively, you may set the environment variables OPENSSL_CFLAGS and OPENSSL_LIBS to avoid the need to call pkg-config. See the pkg-config man page for more details. To get pkg-config, see . See \`config.log' for more details" "$LINENO" 5; } else OPENSSL_CFLAGS=$pkg_cv_OPENSSL_CFLAGS OPENSSL_LIBS=$pkg_cv_OPENSSL_LIBS { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 $as_echo "yes" >&6; } fi # Checks for header files. 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" { $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 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 # The Ultrix 4.2 mips builtin alloca declared by alloca.h only works # for constant arguments. Useless! { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 $as_echo_n "checking for working alloca.h... " >&6; } if ${ac_cv_working_alloca_h+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include int main () { char *p = (char *) alloca (2 * sizeof (int)); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_working_alloca_h=yes else ac_cv_working_alloca_h=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_working_alloca_h" >&5 $as_echo "$ac_cv_working_alloca_h" >&6; } if test $ac_cv_working_alloca_h = yes; then $as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 $as_echo_n "checking for alloca... " >&6; } if ${ac_cv_func_alloca_works+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #ifdef __GNUC__ # define alloca __builtin_alloca #else # ifdef _MSC_VER # include # define alloca _alloca # else # ifdef HAVE_ALLOCA_H # include # else # ifdef _AIX #pragma alloca # else # ifndef alloca /* predefined by HP cc +Olibcalls */ void *alloca (size_t); # endif # endif # endif # endif #endif int main () { char *p = (char *) alloca (1); if (p) return 0; ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : ac_cv_func_alloca_works=yes else ac_cv_func_alloca_works=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_func_alloca_works" >&5 $as_echo "$ac_cv_func_alloca_works" >&6; } if test $ac_cv_func_alloca_works = yes; then $as_echo "#define HAVE_ALLOCA 1" >>confdefs.h else # The SVR3 libPW and SVR4 libucb both contain incompatible functions # that cause trouble. Some versions do not even contain alloca or # contain a buggy version. If you still want to use their alloca, # use ar to extract alloca.o from them instead of compiling alloca.c. ALLOCA=\${LIBOBJDIR}alloca.$ac_objext $as_echo "#define C_ALLOCA 1" >>confdefs.h { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 $as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } if ${ac_cv_os_cray+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #if defined CRAY && ! defined CRAY2 webecray #else wenotbecray #endif _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "webecray" >/dev/null 2>&1; then : ac_cv_os_cray=yes else ac_cv_os_cray=no fi rm -f conftest* fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 $as_echo "$ac_cv_os_cray" >&6; } if test $ac_cv_os_cray = yes; then for ac_func in _getb67 GETB67 getb67; 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 CRAY_STACKSEG_END $ac_func _ACEOF break fi done fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 $as_echo_n "checking stack direction for C alloca... " >&6; } if ${ac_cv_c_stack_direction+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_c_stack_direction=0 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ $ac_includes_default int find_stack_direction (int *addr, int depth) { int dir, dummy = 0; if (! addr) addr = &dummy; *addr = addr < &dummy ? 1 : addr == &dummy ? 0 : -1; dir = depth ? find_stack_direction (addr, depth - 1) : 0; return dir + dummy; } int main (int argc, char **argv) { return find_stack_direction (0, argc + !argv + 20) < 0; } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_c_stack_direction=1 else ac_cv_c_stack_direction=-1 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_c_stack_direction" >&5 $as_echo "$ac_cv_c_stack_direction" >&6; } cat >>confdefs.h <<_ACEOF #define STACK_DIRECTION $ac_cv_c_stack_direction _ACEOF 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 for ac_header in fcntl.h stdint.h stddef.h stdlib.h string.h strings.h sys/time.h unistd.h pthread.h fuse.h curl/curl.h libxml/tree.h do : as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default" if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done ac_fn_c_check_header_mongrel "$LINENO" "openssl/crypto.h" "ac_cv_header_openssl_crypto_h" "$ac_includes_default" if test "x$ac_cv_header_openssl_crypto_h" = xyes; then : $as_echo "#define HAVE_OPENSSL /**/" >>confdefs.h fi ac_fn_c_check_header_mongrel "$LINENO" "magic.h" "ac_cv_header_magic_h" "$ac_includes_default" if test "x$ac_cv_header_magic_h" = xyes; then : else as_fn_error $? "'Unable to find libmagic headers. Please make sure header files are installed.'" "$LINENO" 5 fi # 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 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" "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 { $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_check_member "$LINENO" "struct stat" "st_blocks" "ac_cv_member_struct_stat_st_blocks" "$ac_includes_default" if test "x$ac_cv_member_struct_stat_st_blocks" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_STRUCT_STAT_ST_BLOCKS 1 _ACEOF $as_echo "#define HAVE_ST_BLOCKS 1" >>confdefs.h else case " $LIBOBJS " in *" fileblocks.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS fileblocks.$ac_objext" ;; esac fi # Checks for library functions. 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 { $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 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 for ac_func in $ac_func_list do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" if eval test \"x\$"$as_ac_var"\" = x"yes"; then : cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working mktime" >&5 $as_echo_n "checking for working mktime... " >&6; } if ${ac_cv_func_working_mktime+:} false; then : $as_echo_n "(cached) " >&6 else if test "$cross_compiling" = yes; then : ac_cv_func_working_mktime=no else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ /* Test program from Paul Eggert and Tony Leneis. */ #ifdef TIME_WITH_SYS_TIME # include # include #else # ifdef HAVE_SYS_TIME_H # include # else # include # endif #endif #include #include #ifdef HAVE_UNISTD_H # include #endif #ifndef HAVE_ALARM # define alarm(X) /* empty */ #endif /* Work around redefinition to rpl_putenv by other config tests. */ #undef putenv static time_t time_t_max; static time_t time_t_min; /* Values we'll use to set the TZ environment variable. */ static const char *tz_strings[] = { (const char *) 0, "TZ=GMT0", "TZ=JST-9", "TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00" }; #define N_STRINGS (sizeof (tz_strings) / sizeof (tz_strings[0])) /* Return 0 if mktime fails to convert a date in the spring-forward gap. Based on a problem report from Andreas Jaeger. */ static int spring_forward_gap () { /* glibc (up to about 1998-10-07) failed this test. */ struct tm tm; /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0" instead of "TZ=America/Vancouver" in order to detect the bug even on systems that don't support the Olson extension, or don't have the full zoneinfo tables installed. */ putenv ((char*) "TZ=PST8PDT,M4.1.0,M10.5.0"); tm.tm_year = 98; tm.tm_mon = 3; tm.tm_mday = 5; tm.tm_hour = 2; tm.tm_min = 0; tm.tm_sec = 0; tm.tm_isdst = -1; return mktime (&tm) != (time_t) -1; } static int mktime_test1 (time_t now) { struct tm *lt; return ! (lt = localtime (&now)) || mktime (lt) == now; } static int mktime_test (time_t now) { return (mktime_test1 (now) && mktime_test1 ((time_t) (time_t_max - now)) && mktime_test1 ((time_t) (time_t_min + now))); } static int irix_6_4_bug () { /* Based on code from Ariel Faigon. */ struct tm tm; tm.tm_year = 96; tm.tm_mon = 3; tm.tm_mday = 0; tm.tm_hour = 0; tm.tm_min = 0; tm.tm_sec = 0; tm.tm_isdst = -1; mktime (&tm); return tm.tm_mon == 2 && tm.tm_mday == 31; } static int bigtime_test (int j) { struct tm tm; time_t now; tm.tm_year = tm.tm_mon = tm.tm_mday = tm.tm_hour = tm.tm_min = tm.tm_sec = j; now = mktime (&tm); if (now != (time_t) -1) { struct tm *lt = localtime (&now); if (! (lt && lt->tm_year == tm.tm_year && lt->tm_mon == tm.tm_mon && lt->tm_mday == tm.tm_mday && lt->tm_hour == tm.tm_hour && lt->tm_min == tm.tm_min && lt->tm_sec == tm.tm_sec && lt->tm_yday == tm.tm_yday && lt->tm_wday == tm.tm_wday && ((lt->tm_isdst < 0 ? -1 : 0 < lt->tm_isdst) == (tm.tm_isdst < 0 ? -1 : 0 < tm.tm_isdst)))) return 0; } return 1; } static int year_2050_test () { /* The correct answer for 2050-02-01 00:00:00 in Pacific time, ignoring leap seconds. */ unsigned long int answer = 2527315200UL; struct tm tm; time_t t; tm.tm_year = 2050 - 1900; tm.tm_mon = 2 - 1; tm.tm_mday = 1; tm.tm_hour = tm.tm_min = tm.tm_sec = 0; tm.tm_isdst = -1; /* Use the portable POSIX.1 specification "TZ=PST8PDT,M4.1.0,M10.5.0" instead of "TZ=America/Vancouver" in order to detect the bug even on systems that don't support the Olson extension, or don't have the full zoneinfo tables installed. */ putenv ((char*) "TZ=PST8PDT,M4.1.0,M10.5.0"); t = mktime (&tm); /* Check that the result is either a failure, or close enough to the correct answer that we can assume the discrepancy is due to leap seconds. */ return (t == (time_t) -1 || (0 < t && answer - 120 <= t && t <= answer + 120)); } int main () { time_t t, delta; int i, j; /* This test makes some buggy mktime implementations loop. Give up after 60 seconds; a mktime slower than that isn't worth using anyway. */ alarm (60); for (;;) { t = (time_t_max << 1) + 1; if (t <= time_t_max) break; time_t_max = t; } time_t_min = - ((time_t) ~ (time_t) 0 == (time_t) -1) - time_t_max; delta = time_t_max / 997; /* a suitable prime number */ for (i = 0; i < N_STRINGS; i++) { if (tz_strings[i]) putenv ((char*) tz_strings[i]); for (t = 0; t <= time_t_max - delta; t += delta) if (! mktime_test (t)) return 1; if (! (mktime_test ((time_t) 1) && mktime_test ((time_t) (60 * 60)) && mktime_test ((time_t) (60 * 60 * 24)))) return 1; for (j = 1; ; j <<= 1) if (! bigtime_test (j)) return 1; else if (INT_MAX / 2 < j) break; if (! bigtime_test (INT_MAX)) return 1; } return ! (irix_6_4_bug () && spring_forward_gap () && year_2050_test ()); } _ACEOF if ac_fn_c_try_run "$LINENO"; then : ac_cv_func_working_mktime=yes else ac_cv_func_working_mktime=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_working_mktime" >&5 $as_echo "$ac_cv_func_working_mktime" >&6; } if test $ac_cv_func_working_mktime = no; then case " $LIBOBJS " in *" mktime.$ac_objext "* ) ;; *) LIBOBJS="$LIBOBJS mktime.$ac_objext" ;; esac fi { $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5 $as_echo_n "checking return type of signal handlers... " >&6; } if ${ac_cv_type_signal+:} false; then : $as_echo_n "(cached) " >&6 else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include #include int main () { return *(signal (0, 0)) (0) == 1; ; return 0; } _ACEOF if ac_fn_c_try_compile "$LINENO"; then : ac_cv_type_signal=int else ac_cv_type_signal=void fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5 $as_echo "$ac_cv_type_signal" >&6; } cat >>confdefs.h <<_ACEOF #define RETSIGTYPE $ac_cv_type_signal _ACEOF for ac_func in vprintf do : ac_fn_c_check_func "$LINENO" "vprintf" "ac_cv_func_vprintf" if test "x$ac_cv_func_vprintf" = xyes; then : cat >>confdefs.h <<_ACEOF #define HAVE_VPRINTF 1 _ACEOF ac_fn_c_check_func "$LINENO" "_doprnt" "ac_cv_func__doprnt" if test "x$ac_cv_func__doprnt" = xyes; then : $as_echo "#define HAVE_DOPRNT 1" >>confdefs.h fi fi done for ac_func in ftruncate memmove strcasecmp strchr strdup strncasecmp strrchr strstr 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 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 : "${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 hubicfuse $as_me 3.0.0, 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" _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 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="\\ hubicfuse config.status 3.0.0 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' 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 _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" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES 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 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 " 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 ;; 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 hubicfuse-3.0.1/configure.ac000066400000000000000000000036241306623177700157770ustar00rootroot00000000000000# -*- Autoconf -*- # Process this file with autoconf to produce a configure script. AC_PREREQ(2.61) AC_INIT([hubicfuse], [3.0.0], [Pascal Obry ]) AC_SUBST(CPPFLAGS, "$CPPFLAGS -D_FILE_OFFSET_BITS=64 -I/usr/include/libxml2") AC_LANG([C]) AC_CONFIG_SRCDIR([cloudfuse.c]) AC_CONFIG_HEADER([config.h]) AC_CONFIG_FILES([Makefile]) # Checks for programs. AC_PROG_CC AC_PROG_INSTALL AC_PROG_MKDIR_P # Checks that pkg-config is installed PKG_PROG_PKG_CONFIG # Checks for libraries. PKG_CHECK_MODULES(XML, libxml-2.0, , AC_MSG_ERROR('Unable to find libxml2. Please make sure library and header files are installed.')) PKG_CHECK_MODULES(CURL, libcurl, , AC_MSG_ERROR('Unable to find libcurl. Please make sure library and header files are installed.')) PKG_CHECK_MODULES(FUSE, fuse, , AC_MSG_ERROR('Unable to find libfuse. Please make sure library and header files are installed.')) PKG_CHECK_MODULES(JSON, json-c, , PKG_CHECK_MODULES(JSON, json, , AC_MSG_ERROR('Unable to find libjson. Please make sure library and header files are installed.'))) PKG_CHECK_MODULES(OPENSSL, openssl, , []) # Checks for header files. AC_FUNC_ALLOCA AC_HEADER_STDC AC_CHECK_HEADERS([fcntl.h stdint.h stddef.h stdlib.h string.h strings.h sys/time.h unistd.h pthread.h fuse.h curl/curl.h libxml/tree.h]) AC_CHECK_HEADER([openssl/crypto.h], AC_DEFINE([HAVE_OPENSSL], [], [Openssl headers were found]), , []) AC_CHECK_HEADER([magic.h], , AC_MSG_ERROR('Unable to find libmagic headers. Please make sure header files are installed.')) # Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_TYPE_UID_T AC_TYPE_MODE_T AC_TYPE_OFF_T AC_TYPE_SIZE_T AC_STRUCT_TM AC_STRUCT_ST_BLOCKS # Checks for library functions. AC_FUNC_MALLOC AC_FUNC_MKTIME AC_TYPE_SIGNAL AC_FUNC_VPRINTF AC_CHECK_FUNCS([ftruncate memmove strcasecmp strchr strdup strncasecmp strrchr strstr]) AC_OUTPUT hubicfuse-3.0.1/debian/000077500000000000000000000000001306623177700147265ustar00rootroot00000000000000hubicfuse-3.0.1/debian/README.Debian000066400000000000000000000007701306623177700167730ustar00rootroot00000000000000cloudfuse for Debian -------------------- Please note that the simplest way to allow mounting of Swift shares is to add the user to the fuse group (which will be created by the fuse-utils package). To add user 'foo' to the 'fuse' group type the following command (with root privileges): adduser foo fuse If the user is currently logged in he/she should log out and log in in order for this change to take effect. -- Mike Mestnik Mon, 04 Jun 2012 13:47:28 -0500 hubicfuse-3.0.1/debian/changelog000066400000000000000000000005361306623177700166040ustar00rootroot00000000000000cloudfuse (0.9-1ubuntu1) precise; urgency=low * Imported Upstream version 0.9 * Remove Debian patches already committed upstream -- pataquets Wed, 15 Jan 2014 21:07:18 +0100 cloudfuse (0.1-1) unstable; urgency=low * Initial release -- Mike Mestnik Mon, 04 Jun 2012 13:47:28 -0500 hubicfuse-3.0.1/debian/compat000066400000000000000000000000021306623177700161240ustar00rootroot000000000000008 hubicfuse-3.0.1/debian/control000066400000000000000000000015461306623177700163370ustar00rootroot00000000000000Source: cloudfuse Section: utils Priority: optional Maintainer: Mike Mestnik Build-Depends: debhelper (>= 8.0.0), autotools-dev, libcurl4-openssl-dev, libxml2-dev, libssl-dev, libfuse-dev, pkg-config, libmagic-dev, libjson0-dev Standards-Version: 3.9.2 #Vcs-Git: git://git.debian.org/collab-maint/cloudfuse.git #Vcs-Browser: http://git.debian.org/?p=collab-maint/cloudfuse.git;a=summary Package: cloudfuse Architecture: any Depends: ${shlibs:Depends}, ${misc:Depends}, fuse (>= 2.7) [linux-any] | fuse4bsd [kfreebsd-any] Description: filesystem client based on Swift as used by Rackspace. cloudfuse is a FUSE application which provides access to Rackspace's Cloud Files (or any installation of Swift). . cloudfuse is FUSE (Filesystem in USErspace). . cloudfuse may work with Openstack's Swift, but is not provided by Openstack. hubicfuse-3.0.1/debian/copyright000066400000000000000000000071621306623177700166670ustar00rootroot00000000000000Format: http://dep.debian.net/deps/dep5 Upstream-Name: cloudfuse Files: * Copyright: 2009 Michael Barton License: MIT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: . The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. . THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Files: debian/* Copyright: 2012 Mike Mestnik License: GPL-2+ This package is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. . This package is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. . You should have received a copy of the GNU General Public License along with this program. If not, see . On Debian systems, the complete text of the GNU General Public License version 2 can be found in "/usr/share/common-licenses/GPL-2". Files: configure Copyright: 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. License: No problem Bugroff configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Files: install-sh Copyright: 1994 X Consortium License: MIT Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: . The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. . THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. . Except as contained in this notice, the name of the X Consortium shall not be used in advertising or otherwise to promote the sale, use or other deal- ings in this Software without prior written authorization from the X Consor- tium. hubicfuse-3.0.1/debian/docs000066400000000000000000000000071306623177700155760ustar00rootroot00000000000000README hubicfuse-3.0.1/debian/rules000077500000000000000000000006721306623177700160130ustar00rootroot00000000000000#!/usr/bin/make -f # -*- makefile -*- # Sample debian/rules that uses debhelper. # This file was originally written by Joey Hess and Craig Small. # As a special exception, when this file is copied by dh-make into a # dh-make output file, you may use that output file without restriction. # This special exception was added by Craig Small in version 0.37 of dh-make. # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 %: dh $@ hubicfuse-3.0.1/debian/source/000077500000000000000000000000001306623177700162265ustar00rootroot00000000000000hubicfuse-3.0.1/debian/source/format000066400000000000000000000000141306623177700174340ustar00rootroot000000000000003.0 (quilt) hubicfuse-3.0.1/debian/watch000066400000000000000000000001131306623177700157520ustar00rootroot00000000000000version=3 http://githubredir.debian.net/github/redbo/cloudfuse (.*).tar.gz hubicfuse-3.0.1/hubic_token000077500000000000000000000641111306623177700157270ustar00rootroot00000000000000#!/bin/sh # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE # Version 2, December 2004 # Copyright (C) 2014 - Alain BENEDETTI # Everyone is permitted to copy and distribute verbatim or modified # copies of this license document, and changing it is allowed as long # as the name is changed. # DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE # TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION # 0. You just DO WHAT THE FUCK YOU WANT TO. # This program is free software. It comes without any warranty, to # the extent permitted by applicable law. You can redistribute it # and/or modify it under the terms of the Do What The Fuck You Want # To Public License, Version 2, as published by Sam Hocevar. See # http://www.wtfpl.net/ for more details. #=========================================================== # Fonction : # ---------- # - This utility will get you the 'refresh_token' that is needed for your # programm/app/script, etc... to access your hubiC objects. # # Usage : # ------- # hubic_token [-k|--insecure] [-V|--version] # -k|--insecure: connects to the server even when certificate # verification fails. If certificate verification fails # and this option is not passed, the script will fail to # protect from possible security issues. # -V|--version : displays the version of this script and exits. # # # Tested : Ubuntu Trusty, # ------ Synology (with coreutils and curl installed as Syno wget does NOT # have HTTPS support compiled in) # # Depends on : - a shell (bash NOT required, dash or ash is enough) # ---------- - sed # - curl (better) or wget (with HTTPS support) as a fallback. # No other gnu utility is necessary to run this script! # Optionnaly, if you have dd and base64, you will get a better # random seed, but that is not mandatory at all. # # Version : 1.0.0 # ------- # # Date : 2014-11-28 # ----- # # Author : Alain BENEDETTI # ------ # # History : # ------- # 1.0.0 # - Initial version # # Contributor : // Add your name if you contribute and redistribute // # ----------- # - Sofiane, who gave me the initial raw version of the full connection script. # - Pascal Obry - added the URL encoding of user password # ====================================================================================== # General notes: the script is written to work on the Ubuntu's default shell (dash), # -------------- thus it contains no 'bashism' and can be run easily on plaforms like # NAS. It is also tested with Synology (with coreutils and curl installed). # # Why this script: the oAuth used by hubiC (OVH) is now quite well documented but only # ---------------- partially implemented by hubiC. # - What is implemented: declare an "app". Here you will get the client_id and # client_secret necessary to authorize your app to interact. You also declare a # redirect_uri. This is where you should normally have to implement what is # missing from hubiC to get the access_token for you app! To avoid having # to implement anything, you can use this script instead, then the redirect_uri # you give can be any fake uri (as long as it is a valid uri), like for # example http://localhost # - What is NOT implemented by Hubic: # ... well, pretty much everything else beyond declaring your app! # So the rest of the process is: # -1) deciding which permissions you grant to your 'app' # -2) get the refresh_token/access_token # For 1), you obviously need your main hubiC user/password, but once you # get that refresh_token, your app can connect to your hubiC account with # only that, plus the app id and secret... which is the purpose of oAuth # (authorize an app to access some of your objects without exposing your main # user/password). # So, this is a second layer above the id/secret of the app, because id/secret # alone is not enough to connect. # Let's suppose you gave id/secret AND refresh_token to someone. He can run the # app, and have access to what is authorized to the app. If you want to revoke # the authorizations of that person, you don't need to revoke the app, just run # this script again. You will then get a new refresh_token for yourself to connect # but the old refresh_token you gave to the other person won't be valid anymore. # # Legal concern: I don't work at OVH... but from their perspective this script does # -------------- not more that what you could do yourself with a browser. As you # don't need to run it often: just once to get the refresh_token, and once more # if you lose that token, there should be no harm done to OVH infrastructures! # It will even save some calls... for example, hubicfuse does all the process # everytime you connect it! So with that script, we should be able to save some # requests! # ... so, unless OVH raises any objection, this should be safe... otherwise copy # the requests, and do them with your browser! # # Security: As this is mainly for security (and also to get better performance # --------- at the initialization of your app), this script does not read secrets # from a configuration file, nor as parameters... this is also to keep the script # very simple! # The script simply prompts for those elements. # Nevertheless, if you ever want to use this script in an automated way, you can: # - prepare a file with all the answers and redirect the input to that file. # - set the appropriate environment variable prior to using that script. # The variables are named according to their names in the hubiC requests: # -- client_id (The id of your app) # -- client_secret (The secret of your app) # -- redirect_uri (The redirect_uri you declared at the app creation) # -- scope (The authorizations you grant to the app, see hubiC's documentation). # -- user_login (Your main hubiC identification -the email you gave when you applied) # NOTE: it is called 'login' in hubiC's requests, but to avoid confusion with the # standard utility login, we call it here: user_login. # -- user_pwd (Your main hubic password) # # Embedding: This scripts writes only the version (when option -V is passed) and the # --------- final result if all went OK to standard output. All other messages go # to error output. # The exit code let you know what happened. # You can then easily embed this script, pipe it, or redirect the output to a file # for the rest of your script that needs the tokens. # -------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------- # Internal constants | # -------------------------------------------------------------------------------------- URL_AUTH='https://api.hubic.com/oauth' VERSION='1.0.0' RANDOM_STR='TVq6zsU0A_GHIS6iYtbc7uc2c5jdpwIMczyMCsABJXbd' # -------------------------------------------------------------------------------------- # Messages | # -------------------------------------------------------------------------------------- # ENGLISH PROMPT_CLIENT_ID="client_id (the app's id): " PROMPT_CLIENT_SECRET="client_secret (the app's secret): " PROMPT_REDIRECT_URI="redirect_uri (declared at app's creation): " PROMPT_USER_LOGIN='user_login (the e-mail you used to subscribe): ' PROMPT_USER_PWD="user_pwd (your hubiC's main password): " MSG_SCOPE="For the scope -what you authorize your app to do-, enter characters as suggested in parenthesis, or just hit return if you don't need the item authorized." PROMPT_USAGE='Get account usage (r): ' PROMPT_GETALLLINKS='Get all published links in one call (r): ' PROMPT_CREDENTIALS='Get OpenStack credentials, eg. access to your files (r): ' PROMPT_ACTIVATE='Send activation email (w): ' PROMPT_LINKS='Add new/Get/Delete published link (wrd): ' ERR_BAD_ARG='Unknown argument: ' MSG_USAGE='Usage: ' MSG_OPTIONS=" [-k|--insecure] [-V|--version] -k --insecure: connects to the server even when certificate authentication fails. -V --version : displays the version of this script and exits." MSG_VERSION=", version: " ERR_CURL="Can't find: curl or wget. Please intall one, ex.: sudo apt-get install curl." ERR_HTTPS="ERROR: certificate verification failed. If you want to ignore certificate verification, use -k option." ERR_CNX='Unexpected error trying to connect to hubiC, see error code.' ERR_UNEXPECTED='Unexpected response from hubiC. Do your wget/curl have HTTPS support?' ERR_SED="Can't find: sed. Please intall it." ERR_CURL_FAILED='failed with error (see the exit code) at step' ERR_OAUTH_NOT_FOUND="Could not find 'oauth' in the server's response." ERR_OAUTH_HTTP="HTTP unexpected response code during oauth's request." ERR_REASON='The server said, error: ' ERR_REASON_DESC='Error description: ' ERR_REASON_UNKNOWN="Could not parse the error message from the server's response." ERR_CODE_NOT_FOUND="Could not find 'code' in the server's response." ERR_CODE_HTTP="HTTP unexpected response code during code's request." ERR_TOKEN_NOT_FOUND="Could not find 'refresh_token' in the server's response." ERR_TOKEN_HTTP="HTTP unexpected response code during refresh_token's request." ERR_OUT='Server full response:' MSG_SUCCESS='Success!' MSG_HEAD_RESULT='# Here is what your app needs to connect to hubiC:' # -------------------------------------------------------------------------------------- # Intenationalization: If the message files corresponding to your language, | # -------------------- as detected through the LANG environment variable, are | # provided, they will be used instead of fallback english | # messages defined above. | # The language file must be in the same directory as the script. As LANG is of the | # form: LANG="fr_FR.UTF-8", we will search first for: script_name_fr_FR.txt, and | # if it does not exist, for script_name_fr.txt | # The first file that exists will be sourced here. If none exist, or if LANG is not | # defined in the environment variables, you get the default english messages above. | # -------------------------------------------------------------------------------------- if [ -n "${LANG}" ]; then LANG_FILE="${0}_$( printf '%.5s' "${LANG}" ).txt" if [ -f "${LANG_FILE}" ]; then . "${LANG_FILE}" else LANG_FILE="${0}_$( printf '%.2s' "${LANG}" ).txt" [ -f "${LANG_FILE}" ] && . "${LANG_FILE}" fi fi # -------------------------------------------------------------------------------------- # error utility | # $1 is the error message we want to print out (if not empty). | # $2 if present, will trigger the display of the response from the server. | # Unless wget/curl fails, the exit code will indicate at which step we failed: | # -100: illegal argument | # -101: initialization failed | # -102: first request | # -103: second request | # -104: last request | # When wget/curl fails, this function is not used, and you get instead the exit code | # of wget/curl. | # Our codes begin are from 101 to 104 to be able to distinguish from wget/curl error | # codes that are from 1 to 89. | # -------------------------------------------------------------------------------------- STEP=0 error() { [ -n "${1}" ] && echo "${1}" >&2 if [ -n "${2}" ] && [ -n "${out}" ]; then echo "${ERR_OUT}" >&2 printf -- '%s' "${out}" >&2 fi exit $(( ${STEP} + 100 )) } # -------------------------------------------------------------------------------------- # URL encoder | # $1 is a string to be passed as URL parameter | # the string is URL encoded and returned as result | # -------------------------------------------------------------------------------------- urlenc() { echo "$1" | sed -e 's|%|%25|g' \ -e 's|!|%21|g' \ -e 's|#|%23|g' \ -e 's|\$|%24|g' \ -e 's| |%20|g' \ -e 's|&|%26|g' \ -e "s|'|%27|g" \ -e 's|(|%28|g' \ -e 's|)|%29|g' \ -e 's|*|%2A|g' \ -e 's|+|%2B|g' \ -e 's|,|%2C|g' \ -e 's|/|%2F|g' \ -e 's|:|%3A|g' \ -e 's|;|%3B|g' \ -e 's|=|%3D|g' \ -e 's|?|%3F|g' \ -e 's|@|%40|g' \ -e 's|\[|%5B|g' \ -e 's|]|%5D|g' } # -------------------------------------------------------------------------------------- # STEP 0: Read arguments. | # NOTE: to make it simple, we don't accept things like -kV because anyway it | # is identical to -V | # -------------------------------------------------------------------------------------- V='' CURL_OPTS='-s' for arg in "$@"; do case "${arg}" in '-k' | '--insecure' ) CURL_OPTS='-k' ;; '-V' | '--version' ) V='-V' ;; *) echo "${ERR_BAD_ARG} '${arg}'" >&2 error "${MSG_USAGE}$(printf -- '%s' "${0}" | sed 's|.*/||')${MSG_OPTIONS}" esac done if [ -n "${V}" ]; then echo "$(printf -- '%s' "${0}" | sed 's|.*/||')${MSG_VERSION}${VERSION}" exit 0 fi # -------------------------------------------------------------------------------------- # STEP 1: Check the existence of programs we absolutely need (no possible fallback). | # Note: we also test if there is https support on the detected wget/curl, plus | # that a connection to our hubiC URL returns a 301 (it is expected). | # -------------------------------------------------------------------------------------- STEP=1 if [ -z "$( sed --version 2>/dev/null )" ]; then error 1 "${ERR_SED}" fi if [ -z "$( curl --version 2>/dev/null )" ]; then if [ -z "$( wget --version 2>/dev/null )" ]; then error 1 "${ERR_CURL}" else CURL=wget CURL_DATA='--post-data' if [ "${CURL_OPTS}" == '-s' ]; then CURL_OPTS='-q' else CURL_OPTS='--no-check-certificate' fi out="$(wget -S -q "${CURL_OPTS}" --max-redirect 0 "${URL_AUTH}" -O /dev/null 2>&1)" ERR=$? [ $ERR -eq 5 ] && error "${ERR_HTTPS}" [ $ERR -eq 8 ] && ERR=0 fi else CURL=curl CURL_DATA='--data' out="$(curl -i -s "${CURL_OPTS}" "${URL_AUTH}")" ERR=$? [ $ERR -eq 60 ] && error "${ERR_HTTPS}" fi if [ $ERR -ne 0 ]; then echo "$ERR_CNX" >&2 exit $ERR else if [ -z "$( printf '%s' "${out}" | grep 'HTTP\/1\.1 301' )" ]; then error "${ERR_UNEXPECTED}" 'y' fi fi # -------------------------------------------------------------------------------------- # curl/wget wrapper. | # For wget, we 'trap' the exit code 8 that only means we didn't get a 200. It is a | # 'normal' condition as we expect some 302, and have some documented errors with 400. | # -------------------------------------------------------------------------------------- ccurl() { if [ "${CURL}" = 'wget' ]; then out="$(wget "${CURL_OPTS}" -q -O - --max-redirect 0 -S "${@}" 2>&1 )" ERR=$? [ $ERR -eq 8 ] && return 0 else out="$(curl "${CURL_OPTS}" -i -s "${@}")" ERR=$? fi if [ $ERR -ne 0 ]; then echo "${CURL} ${ERR_CURL_FAILED} ${STEP}." >&2 exit $ERR fi } # -------------------------------------------------------------------------------------- # Prompt for the variables: client_id, client_secret, etc... | # NOTE: we don't prompt for account basic information access in the scope, because | # apparently, even if you don't give it in the scope, it is always authorized. | # So the minimal 'scope' variable will be: scope='account.r' | # -------------------------------------------------------------------------------------- if [ -z "${client_id}" ]; then read -p "${PROMPT_CLIENT_ID}" client_id || exit $? fi if [ -z "${client_secret}" ]; then read -p "${PROMPT_CLIENT_SECRET}" client_secret || exit $? fi if [ -z "${redirect_uri}" ]; then read -p "${PROMPT_REDIRECT_URI}" redirect_uri || exit $? fi if [ -z "${scope}" ]; then printf '\n%s\n' "${MSG_SCOPE}" >&2 scope='account.r' read -p "${PROMPT_USAGE}" usage || exit $? [ "$usage" = 'r' ] && scope="${scope},usage.r" read -p "${PROMPT_GETALLLINKS}" getAllLinks || exit $? [ "$getAllLinks" = 'r' ] && scope="${scope},getAllLinks.r" read -p "${PROMPT_CREDENTIALS}" credentials || exit $? [ "$credentials" = 'r' ] && scope="${scope},credentials.r" read -p "${PROMPT_ACTIVATE}" activate || exit $? [ "$activate" = 'w' ] && scope="${scope},activate.w" read -p "${PROMPT_LINKS}" links || exit $? l="$( printf -- '%s' "${links}" | sed 's/[^\(w\|r\|d\)]//g' )" [ -n "$l" ] && [ "${l}" = "${links}" ] && scope="${scope},links.${l}" printf '\n' >&2 fi if [ -z "${user_login}" ]; then read -p "${PROMPT_USER_LOGIN}" user_login || exit $? fi # -------------------------------------------------------------------------------------- # Each step is based on the same principle: | # - Prepare and send the request. | # - extract a string from the response. | # - error handling: | # = An error can happen during the request, in which case we exit with the | # return code of wget/curl. | # = An error can happen when trying to extract the string, if we can't find the | # string we search. The error message and entire server response will be | # displayed in this case. | # = There are some "documented" errors, generally indicated by a different HTTP | # status code. Should such error happen, we will then try to extract and | # display the documented message. Again if this documented message cannot be | # extracted, or we have another HTTP status, the whole response is dumped. | # | # STEP2: getting oauth | # The expected response is a html page with HTTP status 200. | # From this page we extract 'oauth' which is the value here: | # ... name="oauth" value="168341">&2 if [ -n "$( printf '%s' "${out}" | sed -n '/1/h;/HTTP\/1\.1 302/p;q' )" ]; then ERR="$( printf '%s' "${out}" | sed -n 's/\&.*//;/error=/s/.*error=//p' )" if [ -n "${ERR}" ]; then printf "${ERR_REASON}%s\n" "${ERR}" >&2 ERR="$( printf '%s' "${out}" | sed -n 's/.*error_description=//;s/\&.*//p' )" if [ -n "${ERR}" ]; then printf "${ERR_REASON_DESC}%s\n" "${ERR}" >&2 fi error '' else error "${ERR_REASON_UNKNOWN}" 'y' fi fi error '' 'y' fi # -------------------------------------------------------------------------------------- # STEP3: setting app permissions and getting 'code' | # The expected response is a redirect (302). | # We extract the 'code' from the Location header of the redirect: | # Location: http://localhost/?code=14163171312491G7k3O0O2VGbRyk8t83&scope=usage.r ... | # | # Error extraction, if instead we get a 200, it is probably a bad login/user_pwd, so | # we extract the error given by the server (in the HTML page). | # | # NOTE: the user_pwd is read here for security reason, because we don't need it before | # this step. It is done inside a subshell to reduce its presence in memory. | # Also note that dash does not have the -s option for read, hence we use the | # stty command (hopefully it exists and works!..). We also disable tracing in | # the subshell, to avoid having the password displayed if the script was runned | # with traces on. | # -------------------------------------------------------------------------------------- STEP=3 out="$( set +x if [ -z "${user_pwd}" ]; then printf -- '%s' "${PROMPT_USER_PWD}" >&2 stty -echo 2>/dev/null read user_pwd || exit $? stty echo 2>/dev/null fi printf '\n' >&2 POST="$( printf '%s' "${scope}" | sed 's|,|\&|g;s|\.|=|g' )&oauth=${oauth}&action=accepted&login=$(urlenc "${user_login}")&user_pwd=$(urlenc "${user_pwd}")" ccurl "${URL_AUTH}/auth/" "${CURL_DATA}" "${POST}" printf -- '%s' "${out}" )" || exit $? if [ -n "$( printf '%s' "${out}" | sed -n '/1/h;/HTTP\/1\.1 302/p;q' )" ]; then code="$(echo "${out}" | sed -n "s/.*?code=\(.*\)\&scope.*/\1/p")" if [ -z "$code" ]; then error "${ERR_CODE_NOT_FOUND}" 'y' fi else echo "${ERR_CODE_HTTP}" >&2 if [ -n "$( printf '%s' "${out}" | sed -n '/1/h;/HTTP\/1\.1 200/p;q' )" ]; then ERR="$( printf '%s' "${out}" | sed -n '/class="text-error"/!d;N;s/.*\n//;s/^[ \t]*//;p' )" if [ -n "${ERR}" ]; then printf "${ERR_REASON}%s\n" "${ERR}" >&2 error '' else error "${ERR_REASON_UNKNOWN}" 'y' fi fi error '' 'y' fi # -------------------------------------------------------------------------------------- # STEP4: getting the refresh_token | # The expected response is a JSON object (HTTP/1.1 200). | # Documented errors are with 400 and 401 return codes. We don't try to extract | # error strings with wget, because wget simply exits with an error when not | # receiving a 200 (the exception is 302 with can still be caugh). So when using | # wget, either this works (200) or we display the whole response. | # -------------------------------------------------------------------------------------- STEP=4 POST="client_id=${client_id}&client_secret=${client_secret}&code=${code}&grant_type=authorization_code" if [ "${CURL}" = 'wget' ]; then POST="${POST}&redirect_uri=${redirect_uri}" CURL_ENCODE='-q' REDIR='-q' else CURL_ENCODE='--data-urlencode' REDIR="redirect_uri=${redirect_uri}" fi ccurl "${URL_AUTH}/token/" \ "${CURL_DATA}" "${POST}" \ "${CURL_ENCODE}" "${REDIR}" if [ -n "$( printf '%s' "${out}" | sed -n '/1/h;/HTTP\/1\.1 200/p;q' )" ]; then refresh_token="$( printf '%s' "${out}" | sed -n 's/{\"refresh_token\":\"//;s/\",\"expires_in\".*//p' )" if [ -z "$refresh_token" ]; then error "${ERR_TOKEN_NOT_FOUND}" 'y' fi else echo "${ERR_TOKEN_HTTP}" >&2 if [ "${CURL}" = 'curl' ] && [ -n "$( printf '%s' "${out}" | sed -n '/1/h;/HTTP\/1\.1 40\(0\|1\)/p;q' )" ]; then ERR="$( printf '%s' "${out}" | sed -n 's/"}//;/"error"/s/.*"error":"//p' )" if [ -n "${ERR}" ]; then printf "${ERR_REASON}%s\n" "${ERR}" >&2 ERR="$( printf '%s' "${out}" | sed -n 's/","error".*//;/error_description/s/{"error_description":"//p' )" if [ -n "${ERR}" ]; then printf "${ERR_REASON_DESC}%s\n" "${ERR}" >&2 fi error '' else error "${ERR_REASON_UNKNOWN}" 'y' fi fi error '' 'y' fi # -------------------------------------------------------------------------------------- # THE END: we display the final result if all was successful | # -------------------------------------------------------------------------------------- echo >&2 echo "${MSG_SUCCESS}" >&2 echo >&2 echo >&2 echo "${MSG_HEAD_RESULT}" echo "client_id=${client_id}" echo "client_secret=${client_secret}" echo "refresh_token=${refresh_token}" hubicfuse-3.0.1/hubic_token_fr.txt000077500000000000000000000052331306623177700172340ustar00rootroot00000000000000# -------------------------------------------------------------------------------------- # Messages | # -------------------------------------------------------------------------------------- # FRENCH PROMPT_CLIENT_ID="client_id (l'id de l'app): " PROMPT_CLIENT_SECRET="client_secret (le secret de l'app): " PROMPT_REDIRECT_URI="redirect_uri (declaré à la création de l'app): " PROMPT_USER_LOGIN="user_login (l'e-mail utilisé lors de l'inscription): " PROMPT_USER_PWD="user_pwd (votre mot de passe hubiC): " MSG_SCOPE="Pour le 'scope' -ce que vous autorisez à votre app-, entrez des caractères suggérés entre parenthèses, ou entrée si vous ne voulez pas autoriser l'item." PROMPT_USAGE="Lire le quota d'usage (r): " PROMPT_GETALLLINKS="Lire tous les liens publiés en une fois (r): " PROMPT_CREDENTIALS="Obtenir les autorisations OpenStack, ie. accéder à vos fichiers (r): " PROMPT_ACTIVATE="Envoyer un e-mail d'activation (w): " PROMPT_LINKS="Créer/Lire/Supprimer un lien publié (wrd): " ERR_BAD_ARG='Argument inconnu : ' MSG_USAGE='Usage : ' MSG_OPTIONS=" [-k|--insecure] [-V|--version] -k --insecure: se connecte même si l'authentification du certificat échoue. -V --version : affiche la version de ce script et se termine." MSG_VERSION=", version : " ERR_CURL="Impossible de trouver : curl or wget. Installez-en un, ex.: sudo apt-get install curl." ERR_HTTPS="ERREUR: vérification du certificat échouée. Si vous voulez ignorer la vérification du certificat, utilisez l'option -k." ERR_CNX="Erreur inattendue en essayant de se connecter à hubiC, voir code d'error." ERR_UNEXPECTED="Response inattendue d'hubiC. Votre wget/curl supporte-t-il HTTPS ?" ERR_SED="Impossible de trouver: sed. Merci de l'installer." ERR_CURL_FAILED="a échoué (voir le code de sortie) à l'étape" ERR_OAUTH_NOT_FOUND="Impossible de trouver 'oauth' dans la response du serveur." ERR_OAUTH_HTTP="Status de la réponse HTTP inattendu lors de la requête 'oauth'." ERR_REASON="Le serveur a dit, erreur : " ERR_REASON_DESC="Description de l'erreur : " ERR_REASON_UNKNOWN="Impossible de récupérer le message d'erreur dans la response du serveur." ERR_CODE_NOT_FOUND="Impossible de trouver 'code' dans la response du serveur." ERR_CODE_HTTP="Status de la réponse HTTP inattendu lors de la requête 'code'." ERR_TOKEN_NOT_FOUND="Impossible de trouver 'refresh_token' dans la response du serveur." ERR_TOKEN_HTTP="Status de la réponse HTTP inattendu lors de la requête 'refresh_token'." ERR_OUT="Réponse complète du serveur:" MSG_SUCCESS='Succès!' MSG_HEAD_RESULT="# Voici de dont vote app a besoin pour se connecter à hubiC :" hubicfuse-3.0.1/install-sh000077500000000000000000000316001306623177700155100ustar00rootroot00000000000000#!/bin/sh # install - install a program, script, or datafile scriptversion=2006-10-14.15 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" posix_glob= posix_mkdir= # Desired mode of installed file. mode=0755 chmodcmd=$chmodprog chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) mode=$2 shift shift case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac done if test $# -ne 0 && test -z "$dir_arg$dstarg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix=/ ;; -*) prefix=./ ;; *) prefix= ;; esac case $posix_glob in '') if (set -f) 2>/dev/null; then posix_glob=true else posix_glob=false fi ;; esac oIFS=$IFS IFS=/ $posix_glob && set -f set fnord $dstdir shift $posix_glob && set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dst"; then $doit $rmcmd -f "$dst" 2>/dev/null \ || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \ && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\ || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } } || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: